Skip to content

Commit

Permalink
Alpha Version (#245)
Browse files Browse the repository at this point in the history
* Adds core authorization and attribution to the GIPR (#157)

* Adds core authorization and attribution to the GIPR

* Fixes accidental old code merge

* Fixes IPAssetOrg Test

* Added callpath from SPG to ModuleRegistry, refactor Relationship module (#160)

* story protocol entrypoint

* remove event emitter

* refactor IPOrg

* fix

* register ipOrg

* wip

* module registry basic functionality

* remove leftover test

* module registry routing to modules

* add module registyr to SPG

* relationship registry

* connected SPG with protocol module

* config types

* test remove relationship

* relationship setting

* comments and fixes

* unify module registry events

* refactor selfParams into moduleParams

* view methods in IPAssetRegistry

---------

Co-authored-by: Raul <[email protected]>

* refactor_tests (#163)

Authored-by: Raul <[email protected]>

* Implementation of Hooks Architecture with Asynchronous and Synchronous Base Hooks (#161)

* Implementation of Hooks Architecture with Async and Sync Base Hooks

* Add TokenGatedHook Contract for NFT Ownership Verification (#167)

* Add TokenGatedHook Contract for NFT Ownership Verification

* Enhance HookRegistry to Support Separate Config (#171)

* Refactor HookRegistry to support multiple config domain

Introduce `registryKey` to separate different config domains.
And Integrating BaseModule and Hooks

* Upgrade openzeppline to 4.9.3 (#173)

* list all files in workspace

* upgrade openzepplin to 4.9.3

* IPOrg refactor for creation & registration  (#168)

* Refactors IP Org

* Adds scaffolding for metadata rendering and ip asset creation

* Modularizes IP Org transfers and adds metadata wrapping

* Adds IPOrg registration

* Fixes stack too deep

* Adds back hookregistrykey

* Fixes testing

* Finalizes registration module (adds necessary FEs needed for SPG integration)

* Fix transfer bug

* Refactor licensing (#170)

* configure ipOrg license

* terms repository, framework config

* wip

* introducing hooks for terms

* short string helpers

* terms hook

* licensing module, config ipOrg licensing framework

* cleanup

* IPA goes into IPAsset library

* deleted old interfaces

* delete old contracts

* refactored configuration to be purely terms based, testing creating licenses

* refactor TermsConfig, added FixedSet

* create root license

* minting LNFT

* refactor licensing term libs

* fix test

* refactor to account for enshrined share alike

* refactored IPA_LICENSE and SUBLICENSE_OF back into the licensing module

* simplified terms data

* add comments:

* more comments

* fixed comments and added access control to license registry

* import order

* todo hook key providing

* remove hardhat tests

* fixing compilation errors

* introducing ipa registration module

* temporally remove tests

---------

Co-authored-by: Raul <[email protected]>

* Refactor Access Control in HookRegistry Contract (#175)

* Refactor hook registry access control by IPOrg owner
* Add hooksRegistry() function to modules

* Iporg types and tests (#177)

* Adds testing for registration module

* Adds scaffolding for custom ipAssetTypes

* Remove old comments

* Adding support register IP Asset with user defined mediaURL (#181)

* License activation (#176)

* hookity hook

* hook ouuuut

* lol

* wip testing

* simplify licensing

* WIP

* fixes

* more fixes

* wip

* fix tests

* typo

* separated termrepository from accesscontrol

* Update contracts/modules/licensing/LicensingModule.sol

Co-authored-by: kingster-will <[email protected]>

---------

Co-authored-by: Raul <[email protected]>
Co-authored-by: kingster-will <[email protected]>

* Deployment scripts for Alpha release on Sepolia (#178)

* deploy stroy protocol contracts to Sepolia

* redeploy with latest change

* redeploy for with PR#181

* redeploy for with active license PR#176

* Update script/foundry/deployment/Main.s.sol

* Update script/foundry/deployment/Main.s.sol

---------

Co-authored-by: Ramarti <[email protected]>

* remove logs and add Multicall to StoryProtocol.sol (#186)

Co-authored-by: Raul <[email protected]>

* Fixes IP asset types (#179)

* Address a series issues of event (#187)

* Fix following issues
- remove underscore postfix from event field
- rename event field `ipaId` to `ipAssetId`
- fix wrong `owner` in IPOrgRegistered event
- add ipAssetTypes into IPOrgRegistered event
- remove `indexed` from string or array event fields
---------

Co-authored-by: Ramarti <[email protected]>

* Add E2E tests for Alpha (#189)

* Implementing Dual Licensing Model for Core and Extended Functionalities (#190)

* Apply dual licenses to source code, BUSL and MIT

* Connected IPOrg asset types to relationship module and removed IP Asset Type (#188)

* ip org types and elimination of ip asset type

* fixing tests

* refactor registration tests

* fixed existing tests

* test iporg

* test protocol relationship types configuration

* test relationship setting

* remove unused struct

* removed commented out code

* refactor tokenURI

* fix

---------

Co-authored-by: Raul <[email protected]>

* Temporarily Comment Out Unused Modules for Alpha Release Preparation (#191)

* Temporarily Comment Out Unused Modules for Alpha Release Preparation

We have temporarily commented out the Collect and Royalty
modules to streamline the codebase for the alpha release.

These changes are not permanent and these modules will
be reintroduced in future releases.

* Introduce solidity-docgen in the project for generating documents (#202)

Authored-by: Samuel Zhou

* cleanup deployment broadcast directory (#197)

* Adds detailed contract documentation (#203)

* Adds detailed documentation for major contracts

* Prevent complaining about max line

* Update Deployment Script and Re-deploy Protocol Contracts (#204)

* Update deployment script and Re-deploy protocol

* Test access control (#206)

* test access control

* test access controlled

---------

Co-authored-by: Raul <[email protected]>

* Remove 'indexed' from string relType events

* remove underscore postfix from registration events

* License refactor to simplify and fit Protocol IP License (#214)

* licensing framework repo

* config iporg

* WIP

* moved some verification to LicenseRegistry

* simplify libs

* wip

* addReciprocal is in LicenseRegistry for efficiency, non reciprocal has implementation, uncommented the rest

* wip testing licensing

* test create license

* test other happy paths and fixes

* some comments

* whitespace

* made default revoker configurable

---------

Co-authored-by: Raul <[email protected]>

* Increase Code Lines Coverage (Unit + Integration) (#216)

* Remove 'indexed' from string relType events

* Module registry events test

* Add make coverage script

* Add more access control tests

* Add more IPOrg (controller) tests

* fix: IPOrgTransferred event emit, cache record.owner for prevOwner event arg

* Add more test for IPOrg controller

Coverage except internal functions and `initialize` for upgradable. Need
to use harness for internal functions.

* Add basic tests for FixedSet util

* fix: FixedSet.UintSet indexOf argument signature

* Add integration tests to full line coverage

* Add coverage instruction

* Updated tests for e2e and modules

* Contract bug fix & comment nit

* lcov update

* Fix licensing module test cases

* Separate tests & remove lcov file

* deployment script with licensing module and sepolia (#224)

Co-authored-by: Raul <[email protected]>

* Emit license data (#228)

* emit License data and gas saving in reciprocals

* deployment

---------

Co-authored-by: Raul <[email protected]>

* Alpha agreement (#229)

* BUSL changed to alpha agreement

* verified deployment

---------

Co-authored-by: Raul <[email protected]>

* allow param def empty array

* fix empty config param array ipOrg

* Introducing Polygon Token Async Hook and Integration Async Hook with BaseModule (#230)

* Introduce PolygonTokenHook and integrate Async hook with BaseMoudle
- A new contract PolygonTokenHook is introduced. 
- The BaseModule contract is updated to support the execution of asynchronous hooks.
- The type of hook (synchronous or asynchronous) is determined by the first two bits of the hook address.

* Support Licensing Framework default values (#233)

* bitmask

* wip refactor derivatives to proper options

* wip, hitting stack too deep

* wip fixed stack too deep, fixing tests

* fix bitmask

* fix, test, remove logs, fix internal to pure

---------

Co-authored-by: Raul <[email protected]>

* refactor to SPUML, comments

* deployment

* fix dep script

* Adds authorization (#227)

Adds new authorization logic around the module registry

* Fix events (#237)

* fix emission for ipOrg config

* deployed fix events

---------

Co-authored-by: Raul <[email protected]>

* Add license metadata (#238)

* wip

* wip

* fix emission for ipOrg config

* metadata

* event for indexing

* Update test/foundry/lib/BitMask.t.sol

* Update test/foundry/lib/BitMask.t.sol

* fix

* deployment

---------

Co-authored-by: Raul <[email protected]>

* Improved Unit & Integration Test (#231)

* Remove 'indexed' from string relType events

* Module registry events test

* Add make coverage script

* Add more access control tests

* Add more IPOrg (controller) tests

* fix: IPOrgTransferred event emit, cache record.owner for prevOwner event arg

* Add more test for IPOrg controller

Coverage except internal functions and `initialize` for upgradable. Need
to use harness for internal functions.

* Add basic tests for FixedSet util

* fix: FixedSet.UintSet indexOf argument signature

* Add integration tests to full line coverage

* Add coverage instruction

* Updated tests for e2e and modules

* Contract bug fix & comment nit

* lcov update

* Fix licensing module test cases

* Separate tests & remove lcov file

* Update integration tests

* Small fixes for contracts & interfaces

* Update e2e and module tests & comment out unready fn

* Updated tests

* More integration tests

* Fix param comment

* Add integration tests, fix unit tests, fix contract bugs

* Remove commented out function

* Update LicensingModule.Licensing.t.sol

* Update LicensingModule.Config.t.sol

* Link existing license to ipa on creation (#239)

* fix emission for ipOrg config

* added optional ipa_param

* link ipa to license on creation

* deployment

---------

Co-authored-by: Raul <[email protected]>

* Format and commenting refactor (#241)

* Polishes comments and standardizes formatting

* Fixes more formatting

* Adds more comments

* Fixes minor doc error

* Comment licensing (#240)

* licensing lib commented

* framework repo

* comment licensing module

* fixes

* lint

---------

Co-authored-by: Raul <[email protected]>

* Small test coverages (#242)

* Add more nit tests for coverage

* Remove unused lib

* Remove library

* Fix nit testcase

* Readme (#243)

* readme

* renamed mvp folder to legacy

* fix image

---------

Co-authored-by: Raul <[email protected]>

* Update README.md

* Update README.md

* changeset

* changelog

* Update README.md

---------

Co-authored-by: Leeren <[email protected]>
Co-authored-by: Raul <[email protected]>
Co-authored-by: kingster-will <[email protected]>
Co-authored-by: Samuel Zhou <[email protected]>
Co-authored-by: Jongwon Park <[email protected]>
Co-authored-by: Kingster <[email protected]>
  • Loading branch information
7 people authored Dec 8, 2023
1 parent 0c2d499 commit 7248437
Show file tree
Hide file tree
Showing 264 changed files with 29,728 additions and 14,598 deletions.
14 changes: 0 additions & 14 deletions .changeset/slow-apples-fry.md

This file was deleted.

14 changes: 13 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,17 @@ MAINNET_PRIVATEKEY= 12341234123412341234123412341234
GOERLI_RPC_URL = https://eth-goerli.g.alchemy.com/v2/1234123412341234
GOERLI_PRIVATEKEY = 12341234123412341234123412341234

# SEPOLIA
SEPOLIA_RPC_URL = https://eth-sepolia.g.alchemy.com/v2/1234123412341234
SEPOLIA_PRIVATEKEY = 12341234123412341234123412341234
SEPOLIA_ADMIN_ADDRESS = 0x12341234123412341234123412341234

# ETHSCAN
ETHERSCAN_API_KEY = ETHERSCANAPIKEYETHERSCANAPIKEY
ETHERSCAN_API_KEY = ETHERSCANAPIKEYETHERSCANAPIKEY

# PROTOCOL LICENSE URL
SPUML_URL=https://url-to-license-file.pdf

# POLYGON TOKEN ORACLE
POLYGON_TOKEN_ORACLE_CLIENT=0x123412341234123412341234123412341234
POLYGON_TOKEN_ORACLE_COORDINATOR=0x123412341234123412341234123412341234
21 changes: 4 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ jobs:
with:
version: nightly

- name: List files in the repository
run: |
ls -R ${{ github.workspace }}
- name: Run Forge build
run: |
forge --version
Expand All @@ -63,20 +67,3 @@ jobs:
# run:
# forge coverage --report lcov --report summary
# id: forge-code-coverage

hardhat-test:
strategy:
fail-fast: true

name: Hardhat Unit Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Environment
uses: actions/setup-node@v3
- name: Test
uses: ambersun1234/[email protected]
with:
network: hardhat
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ docs/
.env

.idea/
.vscode
.github/
node_modules/

Expand All @@ -28,3 +29,6 @@ deployment-31337.json
# Script data
script/data/

# Coverage
coverage/
lcov.info
4 changes: 3 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"useTabs": false,
"printWidth": 120,
"trailingComma": "es5",
"tabWidth": 4,
"semi": false,
"singleQuote": false,
"bracketSpacing": true
}
}
6 changes: 4 additions & 2 deletions .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
"plugins": ["prettier"],
"rules": {
"code-complexity": ["error", 8],
"compiler-version": ["error", ">=0.8.0"],
"compiler-version": ["error", ">=0.8.19"],
"const-name-snakecase": "off",
"no-empty-blocks": "off",
"constructor-syntax": "error",
"func-visibility": ["error", { "ignoreConstructors": true }],
"modifier-name-mixedcase": "error",
"max-line-length": ["error", 120],
"not-rely-on-time": "off",
"reason-string": ["warn", { "maxLength": 64 }],
Expand All @@ -17,4 +19,4 @@
"no-global-import": "error",
"prettier/prettier": "error"
}
}
}
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,42 @@
# @story-protocol/contracts

## 0.2.0

### Alpha Version

Unification of the modules and registries of the MVP under a common architecture:

**Protocol registries and repositories:**

- IPAssetRegistry: Source of truth for the registered IPAssets across the protocol.
- ModuleRegistry: Registers the protocol modules, and acts router of module execution and configuration.
- LicenseRegistry: Registers the License NFTs.
- LicensingFrameworkRepo: Holds the supported licensing framework, with parameters expressing the licensing terms and their configurations. Currently, it will only hold the SPUML-1.0 framework.

**IP Org related contracts:**

- IPOrgController: factory for IPOrg creation, registering organizations that can configure the modules to form a common environment under which IPAs can be registered.
- IPOrg: acts as an NFT view into the global IPAssetRegistry. Adds metadata personalization, and its owner can configure the modules.

**Modules**

- BaseModule: defines a common architecture and entrypoints for all modules, along with references to the registries.
- HookRegistry: every module can register hooks, configurable actions to be executed before and after the module action.
- Registration: logic to create IPAs under an IPOrg.
- RelationshipModule: allow the creation of relationship types (protocol wide and specific to ipOrgs) that can relate different elements of the protocol (for example, to express a remixing content graph within an IPOrg)
- Licensing: allows IpOrg to register a common legal framework with some default terms, and has the logic for users to create licenses and link them to IPAs

**Hooks**

- SyncBaseHook: to be inherited by all the syncrhonous actions (payment, token gating, etc)
- AsyncBaseHook: to be inherited by all the asyncrhonous actions (oracles, multi step/sig actions, etc)
- TokenGatedHook: checks if caller owns an NFT, if not the module action cannot continue.
- PolygonTokenHook: example async hook, checks if caller owns tokens in the Polygon network.

**"Frontend" Contracts**

- StoryProtocol: exposes the write functionality for all the modules, combined.

## 0.1.0

### First Changes
Expand Down
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-include .env

.PHONY: all test clean
.PHONY: all test clean coverage

all: clean install build

Expand All @@ -20,16 +20,23 @@ forge-build:; forge build
build :; npx hardhat compile

# TODO: remove --no-match-path after refactor
test :; forge test --no-match-path 'test/foundry/modules/*' -vvv
test :; forge test -vvv --no-match-path 'test/foundry/_old_modules/*'

snapshot :; forge snapshot

slither :; slither ./contracts

format :; npx prettier --write contracts/**/*.sol && npx prettier --write contracts/*.sol
format :; npx prettier --write --plugin=prettier-plugin-solidity 'contracts/**/*.sol' && npx prettier --write --plugin=prettier-plugin-solidity --write 'contracts/*.sol'

# remove `test` and `script` folders from coverage
coverage:
mkdir -p coverage
forge coverage --report lcov
lcov --remove lcov.info -o lcov.info 'test/*' 'script/*'
genhtml lcov.info --output-dir coverage

# solhint should be installed globally
lint :; npx solhint contracts/**/*.sol && npx solhint contracts/*.sol
lint :; npx solhint 'contracts/**/*.sol'

deploy-goerli :; npx hardhat run ./script/deploy-reveal-engine.js --network goerli
verify-goerli :; npx hardhat verify --network goerli ${contract}
Expand Down
Loading

0 comments on commit 7248437

Please sign in to comment.