From 03966a4c63054410d5d959d622dcb76e2e6563af Mon Sep 17 00:00:00 2001 From: Hunter King Date: Tue, 21 May 2024 15:40:20 -0700 Subject: [PATCH 01/13] add metadata uri --- src/contracts/Vault721Adapter.sol | 27 ++++++++++++++++++++++++--- test/unit/Vault721Adapter.t.sol | 12 ++++++++++-- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/src/contracts/Vault721Adapter.sol b/src/contracts/Vault721Adapter.sol index 9679bca..6fb26f5 100644 --- a/src/contracts/Vault721Adapter.sol +++ b/src/contracts/Vault721Adapter.sol @@ -1,8 +1,9 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.24; +import {Base64} from '@openzeppelin/utils/Base64.sol'; import {IERC7496} from 'shipyard-core/src/dynamic-traits/interfaces/IERC7496.sol'; -import {IVault721} from '../interfaces/IVault721.sol'; +import {IVault721} from 'src/interfaces/IVault721.sol'; /** * @notice IERC7496 events are never emitted since NFVState is tracked in Vault721 @@ -10,6 +11,10 @@ import {IVault721} from '../interfaces/IVault721.sol'; contract Vault721Adapter is IERC7496 { bytes32 public constant COLLATERAL = keccak256('COLLATERAL'); bytes32 public constant DEBT = keccak256('DEBT'); + string public constant JSON_OPEN = '{"traits":{"'; + string public constant JSON_DISPLAYNAME = '":{"displayName":"'; + string public constant JSON_DATATYPE = '","dataType":{"type": "string","minLength":1},"validateOnSale": "requireEq"}'; + string public constant JSON_CLOSE = '}}'; IVault721 public vault721; @@ -41,10 +46,11 @@ contract Vault721Adapter is IERC7496 { } /** - * @dev ??? + * @dev return onchain data uri of trait details */ function getTraitMetadataURI() external view returns (string memory _uri) { - _uri = '?'; + string memory _json = _formatJsonMetaData(); + _uri = string.concat('data:application/json;base64,', Base64.encode(bytes(_json))); } /** @@ -64,4 +70,19 @@ contract Vault721Adapter is IERC7496 { if (_traitKey == DEBT) return bytes32(_nfvState.debt); else revert UnknownTraitKeys(); } + + function _formatJsonMetaData() internal pure returns (string memory _json) { + _json = string.concat( + JSON_OPEN, + 'collateral', + JSON_DISPLAYNAME, + 'Collateral', + JSON_DATATYPE, + ',"debt', + JSON_DISPLAYNAME, + 'Debt', + JSON_DATATYPE, + JSON_CLOSE + ); + } } diff --git a/test/unit/Vault721Adapter.t.sol b/test/unit/Vault721Adapter.t.sol index a29a77a..f5bcd79 100644 --- a/test/unit/Vault721Adapter.t.sol +++ b/test/unit/Vault721Adapter.t.sol @@ -130,8 +130,16 @@ contract Unit_Vault721Adapter is Base { } function test_getTraitMetadataURI() public { - bytes32 _uri = bytes32(abi.encode(adapter.getTraitMetadataURI())); - assertEq(_uri, bytes32(abi.encode('?'))); + string memory _uri = adapter.getTraitMetadataURI(); + emit log_named_string('Metadata URI', _uri); + assertEq( + bytes32(bytes(_uri)), + bytes32( + bytes( + 'data:application/json;base64,eyJ0cmFpdHMiOnsiY29sbGF0ZXJhbCI6eyJkaXNwbGF5TmFtZSI6IkNvbGxhdGVyYWwiLCJkYXRhVHlwZSI6eyJ0eXBlIjogInN0cmluZyIsIm1pbkxlbmd0aCI6MX0sInZhbGlkYXRlT25TYWxlIjogInJlcXVpcmVFcSJ9LCJkZWJ0Ijp7ImRpc3BsYXlOYW1lIjoiRGVidCIsImRhdGFUeXBlIjp7InR5cGUiOiAic3RyaW5nIiwibWluTGVuZ3RoIjoxfSwidmFsaWRhdGVPblNhbGUiOiAicmVxdWlyZUVxIn19fQ==' + ) + ) + ); } function test_setTraitValues_Revert(uint256 _tokenId, bytes32 _traitKey, bytes32 _traitValue) public { From a028d15bb53aeca05c6429196cdd4b7f6dce258c Mon Sep 17 00:00:00 2001 From: Hunter King Date: Tue, 21 May 2024 16:09:58 -0700 Subject: [PATCH 02/13] add unit test --- test/unit/Vault721Adapter.t.sol | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/unit/Vault721Adapter.t.sol b/test/unit/Vault721Adapter.t.sol index f5bcd79..c33878f 100644 --- a/test/unit/Vault721Adapter.t.sol +++ b/test/unit/Vault721Adapter.t.sol @@ -38,9 +38,24 @@ contract Base is Test { contract Unit_Vault721Adapter_SetUp is Base { function test_initialize() public { + assertTrue(adapter.vault721() == vault721); + } + + function test_constants() public { assertTrue(adapter.COLLATERAL() == C); assertTrue(adapter.DEBT() == D); - assertTrue(adapter.vault721() == vault721); + assertEq( + bytes32( + bytes( + string.concat(adapter.JSON_OPEN(), adapter.JSON_DISPLAYNAME(), adapter.JSON_DATATYPE(), adapter.JSON_CLOSE()) + ) + ), + bytes32( + bytes( + '{"traits":{"":{"displayName":"","dataType":{"type": "string","minLength":1},"validateOnSale": "requireEq"}}}' + ) + ) + ); } function test_mockCall(uint256 _tokenId, nfvValue memory _nfvValue) public nfvValues(_nfvValue) { From b7c0e334e47283b0f6bf6728083f9e932ec389c8 Mon Sep 17 00:00:00 2001 From: Hunter King Date: Tue, 21 May 2024 16:59:20 -0700 Subject: [PATCH 03/13] add comment --- test/unit/Vault721Adapter.t.sol | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/unit/Vault721Adapter.t.sol b/test/unit/Vault721Adapter.t.sol index c33878f..aa1f173 100644 --- a/test/unit/Vault721Adapter.t.sol +++ b/test/unit/Vault721Adapter.t.sol @@ -144,6 +144,13 @@ contract Unit_Vault721Adapter is Base { ); } + /** + * @notice encoded json data that OpenSea uses to enforce rules about traits: + * + * {"traits":{"collateral":{"displayName":"Collateral","dataType":{"type": "string","minLength":1},"validateOnSale": "requireEq"},"debt":{"displayName":"Debt","dataType":{"type": "string","minLength":1},"validateOnSale": "requireEq"}}} + * to base64 + * eyJ0cmFpdHMiOnsiY29sbGF0ZXJhbCI6eyJkaXNwbGF5TmFtZSI6IkNvbGxhdGVyYWwiLCJkYXRhVHlwZSI6eyJ0eXBlIjogInN0cmluZyIsIm1pbkxlbmd0aCI6MX0sInZhbGlkYXRlT25TYWxlIjogInJlcXVpcmVFcSJ9LCJkZWJ0Ijp7ImRpc3BsYXlOYW1lIjoiRGVidCIsImRhdGFUeXBlIjp7InR5cGUiOiAic3RyaW5nIiwibWluTGVuZ3RoIjoxfSwidmFsaWRhdGVPblNhbGUiOiAicmVxdWlyZUVxIn19fQ== + */ function test_getTraitMetadataURI() public { string memory _uri = adapter.getTraitMetadataURI(); emit log_named_string('Metadata URI', _uri); From 728a68aa3e05e3f7a8a007e92ed959b4e9f80247 Mon Sep 17 00:00:00 2001 From: Hunter King Date: Wed, 22 May 2024 19:17:40 -0700 Subject: [PATCH 04/13] change validateOnSale json-field --- src/contracts/Vault721Adapter.sol | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/contracts/Vault721Adapter.sol b/src/contracts/Vault721Adapter.sol index 6fb26f5..bedf0e8 100644 --- a/src/contracts/Vault721Adapter.sol +++ b/src/contracts/Vault721Adapter.sol @@ -13,7 +13,7 @@ contract Vault721Adapter is IERC7496 { bytes32 public constant DEBT = keccak256('DEBT'); string public constant JSON_OPEN = '{"traits":{"'; string public constant JSON_DISPLAYNAME = '":{"displayName":"'; - string public constant JSON_DATATYPE = '","dataType":{"type": "string","minLength":1},"validateOnSale": "requireEq"}'; + string public constant JSON_DATATYPE = '","dataType":{"type": "string","minLength":1},"validateOnSale": "'; string public constant JSON_CLOSE = '}}'; IVault721 public vault721; @@ -78,10 +78,12 @@ contract Vault721Adapter is IERC7496 { JSON_DISPLAYNAME, 'Collateral', JSON_DATATYPE, + 'requireUintGte"}', ',"debt', JSON_DISPLAYNAME, 'Debt', JSON_DATATYPE, + 'requireUintLte"}', JSON_CLOSE ); } From 88ed8d326c6d8624042420b25def8427e0ea1fdc Mon Sep 17 00:00:00 2001 From: Hunter King Date: Wed, 22 May 2024 19:25:34 -0700 Subject: [PATCH 05/13] fix test --- test/unit/Vault721Adapter.t.sol | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/test/unit/Vault721Adapter.t.sol b/test/unit/Vault721Adapter.t.sol index aa1f173..51baa8c 100644 --- a/test/unit/Vault721Adapter.t.sol +++ b/test/unit/Vault721Adapter.t.sol @@ -44,18 +44,6 @@ contract Unit_Vault721Adapter_SetUp is Base { function test_constants() public { assertTrue(adapter.COLLATERAL() == C); assertTrue(adapter.DEBT() == D); - assertEq( - bytes32( - bytes( - string.concat(adapter.JSON_OPEN(), adapter.JSON_DISPLAYNAME(), adapter.JSON_DATATYPE(), adapter.JSON_CLOSE()) - ) - ), - bytes32( - bytes( - '{"traits":{"":{"displayName":"","dataType":{"type": "string","minLength":1},"validateOnSale": "requireEq"}}}' - ) - ) - ); } function test_mockCall(uint256 _tokenId, nfvValue memory _nfvValue) public nfvValues(_nfvValue) { @@ -158,7 +146,7 @@ contract Unit_Vault721Adapter is Base { bytes32(bytes(_uri)), bytes32( bytes( - 'data:application/json;base64,eyJ0cmFpdHMiOnsiY29sbGF0ZXJhbCI6eyJkaXNwbGF5TmFtZSI6IkNvbGxhdGVyYWwiLCJkYXRhVHlwZSI6eyJ0eXBlIjogInN0cmluZyIsIm1pbkxlbmd0aCI6MX0sInZhbGlkYXRlT25TYWxlIjogInJlcXVpcmVFcSJ9LCJkZWJ0Ijp7ImRpc3BsYXlOYW1lIjoiRGVidCIsImRhdGFUeXBlIjp7InR5cGUiOiAic3RyaW5nIiwibWluTGVuZ3RoIjoxfSwidmFsaWRhdGVPblNhbGUiOiAicmVxdWlyZUVxIn19fQ==' + 'data:application/json;base64,eyJ0cmFpdHMiOnsiY29sbGF0ZXJhbCI6eyJkaXNwbGF5TmFtZSI6IkNvbGxhdGVyYWwiLCJkYXRhVHlwZSI6eyJ0eXBlIjogInN0cmluZyIsIm1pbkxlbmd0aCI6MX0sInZhbGlkYXRlT25TYWxlIjogInJlcXVpcmVVaW50R3RlIn0sImRlYnQiOnsiZGlzcGxheU5hbWUiOiJEZWJ0IiwiZGF0YVR5cGUiOnsidHlwZSI6ICJzdHJpbmciLCJtaW5MZW5ndGgiOjF9LCJ2YWxpZGF0ZU9uU2FsZSI6ICJyZXF1aXJlVWludEx0ZSJ9fX0=' ) ) ); From 2f1dbcbd6936d54fa10082832e400c52e0a0b65d Mon Sep 17 00:00:00 2001 From: Hunter King Date: Wed, 22 May 2024 19:27:17 -0700 Subject: [PATCH 06/13] edit comment --- test/unit/Vault721Adapter.t.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/Vault721Adapter.t.sol b/test/unit/Vault721Adapter.t.sol index 51baa8c..077421c 100644 --- a/test/unit/Vault721Adapter.t.sol +++ b/test/unit/Vault721Adapter.t.sol @@ -137,7 +137,7 @@ contract Unit_Vault721Adapter is Base { * * {"traits":{"collateral":{"displayName":"Collateral","dataType":{"type": "string","minLength":1},"validateOnSale": "requireEq"},"debt":{"displayName":"Debt","dataType":{"type": "string","minLength":1},"validateOnSale": "requireEq"}}} * to base64 - * eyJ0cmFpdHMiOnsiY29sbGF0ZXJhbCI6eyJkaXNwbGF5TmFtZSI6IkNvbGxhdGVyYWwiLCJkYXRhVHlwZSI6eyJ0eXBlIjogInN0cmluZyIsIm1pbkxlbmd0aCI6MX0sInZhbGlkYXRlT25TYWxlIjogInJlcXVpcmVFcSJ9LCJkZWJ0Ijp7ImRpc3BsYXlOYW1lIjoiRGVidCIsImRhdGFUeXBlIjp7InR5cGUiOiAic3RyaW5nIiwibWluTGVuZ3RoIjoxfSwidmFsaWRhdGVPblNhbGUiOiAicmVxdWlyZUVxIn19fQ== + * eyJ0cmFpdHMiOnsiY29sbGF0ZXJhbCI6eyJkaXNwbGF5TmFtZSI6IkNvbGxhdGVyYWwiLCJkYXRhVHlwZSI6eyJ0eXBlIjogInN0cmluZyIsIm1pbkxlbmd0aCI6MX0sInZhbGlkYXRlT25TYWxlIjogInJlcXVpcmVVaW50R3RlIn0sImRlYnQiOnsiZGlzcGxheU5hbWUiOiJEZWJ0IiwiZGF0YVR5cGUiOnsidHlwZSI6ICJzdHJpbmciLCJtaW5MZW5ndGgiOjF9LCJ2YWxpZGF0ZU9uU2FsZSI6ICJyZXF1aXJlVWludEx0ZSJ9fX0== */ function test_getTraitMetadataURI() public { string memory _uri = adapter.getTraitMetadataURI(); From 065ad3263f31b09befefef140cef371f97c93fb5 Mon Sep 17 00:00:00 2001 From: Hunter King Date: Wed, 22 May 2024 19:32:46 -0700 Subject: [PATCH 07/13] fixed merge conflict, but sol versions are incompatible - awaiting fix --- package.json | 1 + remappings.txt | 14 ++++- src/contracts/Vault721Adapter.sol | 2 +- src/interfaces/IVault721.sol | 21 ------- test/unit/Vault721Adapter.t.sol | 2 +- yarn.lock | 100 +++++++++++++++++++++++++++++- 6 files changed, 115 insertions(+), 25 deletions(-) delete mode 100644 src/interfaces/IVault721.sol diff --git a/package.json b/package.json index 5134678..ef40a41 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "test:coverage": "forge coverage --report lcov && lcov --ignore-errors unused --remove lcov.info 'node_modules/*' 'script/*' 'test/*' 'src/contracts/for-test/*' 'src/libraries/*' -o lcov.info.pruned && mv lcov.info.pruned lcov.info && genhtml -o coverage-report lcov.info" }, "dependencies": { + "@opendollar/contracts": "^0.0.0-e31c2151", "@openzeppelin/contracts": "^4.9.6" }, "devDependencies": { diff --git a/remappings.txt b/remappings.txt index 2fe51b5..893d4a2 100644 --- a/remappings.txt +++ b/remappings.txt @@ -1,7 +1,19 @@ @openzeppelin/=node_modules/@openzeppelin/contracts/ +@openzeppelin-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/ +@defi-wonderland/solidity-utils/=node_modules/@defi-wonderland/solidity-utils/solidity/ + +@opendollar/contracts/=node_modules/@opendollar/contracts/src/contracts/ +@opendollar/interfaces/=node_modules/@opendollar/contracts/src/interfaces/ +@opendollar/libraries/=node_modules/@opendollar/contracts/src/libraries/ +@opendollar/test/=node_modules/@opendollar/contracts/test/ + seaport-types/=lib/seaport-types/ shipyard-core/=lib/shipyard-core/ + +@console2/=forge-std/console2.sol; + @script/=script/ @contracts/=src/contracts/ @interfaces/=src/interfaces/ -@test/=test/ \ No newline at end of file +@test/=test/ +@libraries/=src/libraries/ \ No newline at end of file diff --git a/src/contracts/Vault721Adapter.sol b/src/contracts/Vault721Adapter.sol index bedf0e8..66b763d 100644 --- a/src/contracts/Vault721Adapter.sol +++ b/src/contracts/Vault721Adapter.sol @@ -2,8 +2,8 @@ pragma solidity 0.8.24; import {Base64} from '@openzeppelin/utils/Base64.sol'; +import {IVault721} from '@opendollar/interfaces/proxies/IVault721.sol'; import {IERC7496} from 'shipyard-core/src/dynamic-traits/interfaces/IERC7496.sol'; -import {IVault721} from 'src/interfaces/IVault721.sol'; /** * @notice IERC7496 events are never emitted since NFVState is tracked in Vault721 diff --git a/src/interfaces/IVault721.sol b/src/interfaces/IVault721.sol deleted file mode 100644 index 57b1e35..0000000 --- a/src/interfaces/IVault721.sol +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity 0.8.24; - -/** - * todo remove this after open-dollar package is added to this repo - */ -interface IVault721 { - struct NFVState { - bytes32 cType; - uint256 collateral; - uint256 debt; - uint256 lastBlockNumber; - uint256 lastBlockTimestamp; - address safeHandler; - } - - /** - * @dev get nfv state by vault id - */ - function getNfvState(uint256 _vaultId) external view returns (NFVState memory); -} diff --git a/test/unit/Vault721Adapter.t.sol b/test/unit/Vault721Adapter.t.sol index 077421c..df0f379 100644 --- a/test/unit/Vault721Adapter.t.sol +++ b/test/unit/Vault721Adapter.t.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.24; import {Test, console} from 'forge-std/Test.sol'; import {Vault721Adapter} from 'src/contracts/Vault721Adapter.sol'; -import {IVault721} from 'src/interfaces/IVault721.sol'; +import {IVault721} from '@opendollar/interfaces/proxies/IVault721.sol'; struct nfvValue { uint256 collateral; diff --git a/yarn.lock b/yarn.lock index df3c7c0..e8887f9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,11 @@ # yarn lockfile v1 +"@adraffy/ens-normalize@1.10.1": + version "1.10.1" + resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz#63430d04bd8c5e74f8d7d049338f1cd9d4f02069" + integrity sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw== + "@babel/code-frame@^7.0.0": version "7.24.2" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.2.tgz#718b4b19841809a58b29b68cde80bc5e1aa6d9ae" @@ -25,6 +30,27 @@ js-tokens "^4.0.0" picocolors "^1.0.0" +"@defi-wonderland/solidity-utils@0.0.0-4298c6c6": + version "0.0.0-4298c6c6" + resolved "https://registry.yarnpkg.com/@defi-wonderland/solidity-utils/-/solidity-utils-0.0.0-4298c6c6.tgz#4ac9e4bcc586f7434715357310a7a3c30e81f17f" + integrity sha512-jpecgVx9hpnXXGnYnN8ayd1ONj4ljk0hI36ltNfkNwlDkLLzPt4/FY5YSyY/628Exfuy5X9Rl9gGv5UtYgAmtw== + dependencies: + "@openzeppelin/contracts" "4.8.1" + ds-test "https://github.com/dapphub/ds-test" + forge-std "https://github.com/foundry-rs/forge-std" + +"@noble/curves@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" + integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== + dependencies: + "@noble/hashes" "1.3.2" + +"@noble/hashes@1.3.2": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" + integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -46,7 +72,29 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@openzeppelin/contracts@^4.9.6": +"@opendollar/contracts@^0.0.0-e31c2151": + version "0.0.0-eae7604c" + resolved "https://registry.yarnpkg.com/@opendollar/contracts/-/contracts-0.0.0-eae7604c.tgz#295e50dcf3a1518f9bd73aa4ac74482c1a563354" + integrity sha512-fyUMytsKNIT1LWT91mNd4p2szFAo+qlpe6usRqYv/IaUED3x5o3IrVH9OYfqqfI2b+Dp5pbxejcbAIiDrHafFw== + dependencies: + "@defi-wonderland/solidity-utils" "0.0.0-4298c6c6" + "@openzeppelin/contracts" "4.9.6" + "@openzeppelin/contracts-upgradeable" "4.9.6" + dotenv "^16.4.5" + ethers "^6.12.0" + forge-std "https://github.com/foundry-rs/forge-std.git#e8a047e3f40f13fa37af6fe14e6e06283d9a060e" + +"@openzeppelin/contracts-upgradeable@4.9.6": + version "4.9.6" + resolved "https://registry.yarnpkg.com/@openzeppelin/contracts-upgradeable/-/contracts-upgradeable-4.9.6.tgz#38b21708a719da647de4bb0e4802ee235a0d24df" + integrity sha512-m4iHazOsOCv1DgM7eD7GupTJ+NFVujRZt1wzddDPSVGpWdKq1SKkla5htKG7+IS4d2XOCtzkUNwRZ7Vq5aEUMA== + +"@openzeppelin/contracts@4.8.1": + version "4.8.1" + resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-4.8.1.tgz#709cfc4bbb3ca9f4460d60101f15dac6b7a2d5e4" + integrity sha512-xQ6eUZl+RDyb/FiZe1h+U7qr/f4p/SrTSQcTPH2bjur3C5DbuW/zFgCU/b1P/xcIaEqJep+9ju4xDRi3rmChdQ== + +"@openzeppelin/contracts@4.9.6", "@openzeppelin/contracts@^4.9.6": version "4.9.6" resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-4.9.6.tgz#2a880a24eb19b4f8b25adc2a5095f2aa27f39677" integrity sha512-xSmezSupL+y9VkHZJGDoCBpmnB2ogM13ccaYDWqJTfS3dbuHkgjuwDFUmaFauBCboQMGB/S5UqUl2y54X99BmA== @@ -101,6 +149,11 @@ resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz#b979ebad3919799c979b17c72621c0bc0a31c6c4" integrity sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA== +"@types/node@18.15.13": + version "18.15.13" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.13.tgz#f64277c341150c979e42b00e4ac289290c9df469" + integrity sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q== + acorn-jsx@^5.0.0: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" @@ -111,6 +164,11 @@ acorn@^6.0.7: resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.2.tgz#35866fd710528e92de10cf06016498e47e39e1e6" integrity sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ== +aes-js@4.0.0-beta.5: + version "4.0.0-beta.5" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-4.0.0-beta.5.tgz#8d2452c52adedebc3a3e28465d858c11ca315873" + integrity sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q== + ajv@^6.10.2, ajv@^6.12.6, ajv@^6.6.1, ajv@^6.9.1: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" @@ -457,6 +515,15 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" +dotenv@^16.4.5: + version "16.4.5" + resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.5.tgz#cdd3b3b604cb327e286b4762e13502f717cb099f" + integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg== + +"ds-test@git+https://github.com/dapphub/ds-test.git": + version "1.0.0" + resolved "git+https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0" + emoji-regex@^7.0.1: version "7.0.3" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" @@ -584,6 +651,19 @@ esutils@^2.0.2: resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== +ethers@^6.12.0: + version "6.12.1" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.12.1.tgz#517ff6d66d4fd5433e38e903051da3e57c87ff37" + integrity sha512-j6wcVoZf06nqEcBbDWkKg8Fp895SS96dSnTCjiXT+8vt2o02raTn4Lo9ERUuIVU5bAjoPYeA+7ytQFexFmLuVw== + dependencies: + "@adraffy/ens-normalize" "1.10.1" + "@noble/curves" "1.2.0" + "@noble/hashes" "1.3.2" + "@types/node" "18.15.13" + aes-js "4.0.0-beta.5" + tslib "2.4.0" + ws "8.5.0" + external-editor@^3.0.3: version "3.1.0" resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495" @@ -666,6 +746,14 @@ flatted@^2.0.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138" integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA== +"forge-std@git+https://github.com/foundry-rs/forge-std.git": + version "1.8.2" + resolved "git+https://github.com/foundry-rs/forge-std.git#52715a217dc51d0de15877878ab8213f6cbbbab5" + +"forge-std@git+https://github.com/foundry-rs/forge-std.git#e8a047e3f40f13fa37af6fe14e6e06283d9a060e": + version "1.5.6" + resolved "git+https://github.com/foundry-rs/forge-std.git#e8a047e3f40f13fa37af6fe14e6e06283d9a060e" + form-data-encoder@^2.1.2: version "2.1.4" resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-2.1.4.tgz#261ea35d2a70d48d30ec7a9603130fa5515e9cd5" @@ -1588,6 +1676,11 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" +tslib@2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" + integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== + tslib@^1.9.0: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" @@ -1637,3 +1730,8 @@ write@1.0.3: integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig== dependencies: mkdirp "^0.5.1" + +ws@8.5.0: + version "8.5.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f" + integrity sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg== From afde924d341e07e38a63e1c276ab940a3638866a Mon Sep 17 00:00:00 2001 From: Hunter King Date: Wed, 22 May 2024 19:36:27 -0700 Subject: [PATCH 08/13] update package version --- package.json | 2 +- remappings.txt | 2 +- yarn.lock | 38 +++++++++++++++++++------------------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index ef40a41..d90c0b9 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "test:coverage": "forge coverage --report lcov && lcov --ignore-errors unused --remove lcov.info 'node_modules/*' 'script/*' 'test/*' 'src/contracts/for-test/*' 'src/libraries/*' -o lcov.info.pruned && mv lcov.info.pruned lcov.info && genhtml -o coverage-report lcov.info" }, "dependencies": { - "@opendollar/contracts": "^0.0.0-e31c2151", + "@opendollar/contracts": "^0.0.0-e31c2151", "@openzeppelin/contracts": "^4.9.6" }, "devDependencies": { diff --git a/remappings.txt b/remappings.txt index 893d4a2..5782fe5 100644 --- a/remappings.txt +++ b/remappings.txt @@ -16,4 +16,4 @@ shipyard-core/=lib/shipyard-core/ @contracts/=src/contracts/ @interfaces/=src/interfaces/ @test/=test/ -@libraries/=src/libraries/ \ No newline at end of file +@libraries/=src/libraries/ diff --git a/yarn.lock b/yarn.lock index e8887f9..e1cda55 100644 --- a/yarn.lock +++ b/yarn.lock @@ -285,12 +285,12 @@ brace-expansion@^2.0.1: dependencies: balanced-match "^1.0.0" -braces@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" - integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== +braces@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" + integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== dependencies: - fill-range "^7.0.1" + fill-range "^7.1.1" cacheable-lookup@^7.0.0: version "7.0.0" @@ -725,10 +725,10 @@ file-entry-cache@^5.0.1: dependencies: flat-cache "^2.0.1" -fill-range@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" - integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== +fill-range@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" + integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== dependencies: to-regex-range "^5.0.1" @@ -1095,11 +1095,11 @@ merge2@^1.3.0, merge2@^1.4.1: integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== micromatch@^4.0.4: - version "4.0.5" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" - integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== + version "4.0.7" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.7.tgz#33e8190d9fe474a9895525f5618eee136d46c2e5" + integrity sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q== dependencies: - braces "^3.0.2" + braces "^3.0.3" picomatch "^2.3.1" mimic-fn@^1.0.0: @@ -1265,9 +1265,9 @@ path-type@^4.0.0: integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== picocolors@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" - integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== + version "1.0.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1" + integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew== picomatch@^2.3.1: version "2.3.1" @@ -1430,9 +1430,9 @@ semver@^6.3.0: integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== semver@^7.3.7, semver@^7.5.2, semver@^7.6.0: - version "7.6.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.1.tgz#60bfe090bf907a25aa8119a72b9f90ef7ca281b2" - integrity sha512-f/vbBsu+fOiYt+lmwZV0rVwJScl46HppnOA1ZvIuBWKOTlllpyJ3bfVax76/OrhCH38dyxoDIA8K7uB963IYgA== + version "7.6.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.2.tgz#1e3b34759f896e8f14d6134732ce798aeb0c6e13" + integrity sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w== shebang-command@^1.2.0: version "1.2.0" From 7fc79652d444cfbbebe9e13b69a8815a34ca18ee Mon Sep 17 00:00:00 2001 From: Hunter King Date: Wed, 22 May 2024 19:40:09 -0700 Subject: [PATCH 09/13] update package --- package.json | 3 ++- yarn.lock | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index d90c0b9..d03a7dd 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "test:coverage": "forge coverage --report lcov && lcov --ignore-errors unused --remove lcov.info 'node_modules/*' 'script/*' 'test/*' 'src/contracts/for-test/*' 'src/libraries/*' -o lcov.info.pruned && mv lcov.info.pruned lcov.info && genhtml -o coverage-report lcov.info" }, "dependencies": { - "@opendollar/contracts": "^0.0.0-e31c2151", + "@opendollar/contracts": "^0.0.0-04ddd4b0", "@openzeppelin/contracts": "^4.9.6" }, "devDependencies": { @@ -35,3 +35,4 @@ "sort-package-json": "^2.8.0" } } + \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index e1cda55..8e7436e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -72,10 +72,10 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@opendollar/contracts@^0.0.0-e31c2151": - version "0.0.0-eae7604c" - resolved "https://registry.yarnpkg.com/@opendollar/contracts/-/contracts-0.0.0-eae7604c.tgz#295e50dcf3a1518f9bd73aa4ac74482c1a563354" - integrity sha512-fyUMytsKNIT1LWT91mNd4p2szFAo+qlpe6usRqYv/IaUED3x5o3IrVH9OYfqqfI2b+Dp5pbxejcbAIiDrHafFw== +"@opendollar/contracts@^0.0.0-04ddd4b0": + version "0.0.0-04ddd4b0" + resolved "https://registry.yarnpkg.com/@opendollar/contracts/-/contracts-0.0.0-04ddd4b0.tgz#210042d26d2d79c412a38646bffeacd62797b93b" + integrity sha512-Jn15R/fOXZi50PY0qw86O6ahNkn/AB7k3Rf0gMKI32myoPEyj5gNSFEiumsSkYWsbMmrhMVXPUj5NqSE+4V8aw== dependencies: "@defi-wonderland/solidity-utils" "0.0.0-4298c6c6" "@openzeppelin/contracts" "4.9.6" @@ -520,9 +520,9 @@ dotenv@^16.4.5: resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.5.tgz#cdd3b3b604cb327e286b4762e13502f717cb099f" integrity sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg== -"ds-test@git+https://github.com/dapphub/ds-test.git": +"ds-test@https://github.com/dapphub/ds-test": version "1.0.0" - resolved "git+https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0" + resolved "https://github.com/dapphub/ds-test#e282159d5170298eb2455a6c05280ab5a73a4ef0" emoji-regex@^7.0.1: version "7.0.3" @@ -746,14 +746,14 @@ flatted@^2.0.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.2.tgz#4575b21e2bcee7434aa9be662f4b7b5f9c2b5138" integrity sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA== -"forge-std@git+https://github.com/foundry-rs/forge-std.git": - version "1.8.2" - resolved "git+https://github.com/foundry-rs/forge-std.git#52715a217dc51d0de15877878ab8213f6cbbbab5" - "forge-std@git+https://github.com/foundry-rs/forge-std.git#e8a047e3f40f13fa37af6fe14e6e06283d9a060e": version "1.5.6" resolved "git+https://github.com/foundry-rs/forge-std.git#e8a047e3f40f13fa37af6fe14e6e06283d9a060e" +"forge-std@https://github.com/foundry-rs/forge-std": + version "1.8.2" + resolved "https://github.com/foundry-rs/forge-std#52715a217dc51d0de15877878ab8213f6cbbbab5" + form-data-encoder@^2.1.2: version "2.1.4" resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-2.1.4.tgz#261ea35d2a70d48d30ec7a9603130fa5515e9cd5" From 65a705b1e739681a2d4a3c0a3809389e6393d56d Mon Sep 17 00:00:00 2001 From: Hunter King Date: Thu, 23 May 2024 15:54:53 -0700 Subject: [PATCH 10/13] edit commit, all tests pass --- test/unit/Vault721Adapter.t.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/Vault721Adapter.t.sol b/test/unit/Vault721Adapter.t.sol index 35a3cbd..df294d4 100644 --- a/test/unit/Vault721Adapter.t.sol +++ b/test/unit/Vault721Adapter.t.sol @@ -135,7 +135,7 @@ contract Unit_Vault721Adapter is Base { /** * @notice encoded json data that OpenSea uses to enforce rules about traits: * - * {"traits":{"collateral":{"displayName":"Collateral","dataType":{"type": "string","minLength":1},"validateOnSale": "requireEq"},"debt":{"displayName":"Debt","dataType":{"type": "string","minLength":1},"validateOnSale": "requireEq"}}} + * {"traits":{"collateral":{"displayName":"Collateral","dataType":{"type": "string","minLength":1},"validateOnSale": "requireUintGte"},"debt":{"displayName":"Debt","dataType":{"type": "string","minLength":1},"validateOnSale": "requireUintLte"}}} * to base64 * eyJ0cmFpdHMiOnsiY29sbGF0ZXJhbCI6eyJkaXNwbGF5TmFtZSI6IkNvbGxhdGVyYWwiLCJkYXRhVHlwZSI6eyJ0eXBlIjogInN0cmluZyIsIm1pbkxlbmd0aCI6MX0sInZhbGlkYXRlT25TYWxlIjogInJlcXVpcmVVaW50R3RlIn0sImRlYnQiOnsiZGlzcGxheU5hbWUiOiJEZWJ0IiwiZGF0YVR5cGUiOnsidHlwZSI6ICJzdHJpbmciLCJtaW5MZW5ndGgiOjF9LCJ2YWxpZGF0ZU9uU2FsZSI6ICJyZXF1aXJlVWludEx0ZSJ9fX0== */ From 59fb274723fff7ce96dd912ad9d2b7a7ac556a07 Mon Sep 17 00:00:00 2001 From: Patrick Gallagher Date: Thu, 23 May 2024 16:09:15 -0700 Subject: [PATCH 11/13] update actions --- .github/workflows/test.yml | 100 ++++++++++++++++++++++++++----------- 1 file changed, 70 insertions(+), 30 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9282e82..1ee41f2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,34 +1,74 @@ -name: test +name: CI -on: workflow_dispatch +on: [push] -env: - FOUNDRY_PROFILE: ci +concurrency: + group: ${{ github.workflow}}-${{github.ref}} + cancel-in-progress: true jobs: - check: - strategy: - fail-fast: true - - name: Foundry project - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 - with: - version: nightly - - - name: Run Forge build - run: | - forge --version - forge build --sizes - id: build - - - name: Run Forge tests - run: | - forge test -vvv - id: test + lint: + name: Run Linters + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x] + + steps: + - uses: actions/checkout@v3 + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: "yarn" + + - name: Install dependencies + run: yarn --frozen-lockfile --network-concurrency 1 + + - run: yarn lint:check + + forge: + name: Run Unit and E2E Tests + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x] + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + cache: true + + - name: Install forge dependencies + run: forge install + + - name: Install yarn dependencies + run: yarn install --frozen-lockfile + + - name: Build + run: forge build + + - name: "Create env file" + run: | + touch .env + echo ARB_MAINNET_RPC="${{ secrets.ARB_MAINNET_RPC }}" >> .env + echo ARB_MAINNET_DEPLOYER_PK="${{ secrets.ARB_MAINNET_DEPLOYER_PK }}" >> .env + cat .env + + - name: Run tests + shell: bash + run: yarn test From 0320a551f6ca0c09151196ffccba4f045c1cd13e Mon Sep 17 00:00:00 2001 From: Patrick Gallagher Date: Thu, 23 May 2024 18:36:19 -0500 Subject: [PATCH 12/13] Update Vault721Adapter.t.sol --- test/unit/Vault721Adapter.t.sol | 1 - 1 file changed, 1 deletion(-) diff --git a/test/unit/Vault721Adapter.t.sol b/test/unit/Vault721Adapter.t.sol index df294d4..f231072 100644 --- a/test/unit/Vault721Adapter.t.sol +++ b/test/unit/Vault721Adapter.t.sol @@ -137,7 +137,6 @@ contract Unit_Vault721Adapter is Base { * * {"traits":{"collateral":{"displayName":"Collateral","dataType":{"type": "string","minLength":1},"validateOnSale": "requireUintGte"},"debt":{"displayName":"Debt","dataType":{"type": "string","minLength":1},"validateOnSale": "requireUintLte"}}} * to base64 - * eyJ0cmFpdHMiOnsiY29sbGF0ZXJhbCI6eyJkaXNwbGF5TmFtZSI6IkNvbGxhdGVyYWwiLCJkYXRhVHlwZSI6eyJ0eXBlIjogInN0cmluZyIsIm1pbkxlbmd0aCI6MX0sInZhbGlkYXRlT25TYWxlIjogInJlcXVpcmVVaW50R3RlIn0sImRlYnQiOnsiZGlzcGxheU5hbWUiOiJEZWJ0IiwiZGF0YVR5cGUiOnsidHlwZSI6ICJzdHJpbmciLCJtaW5MZW5ndGgiOjF9LCJ2YWxpZGF0ZU9uU2FsZSI6ICJyZXF1aXJlVWludEx0ZSJ9fX0== */ function test_getTraitMetadataURI() public { string memory _uri = adapter.getTraitMetadataURI(); From cd74b1d278296d1162906ca31cde6177bc75f5a0 Mon Sep 17 00:00:00 2001 From: Patrick Gallagher Date: Thu, 23 May 2024 16:50:48 -0700 Subject: [PATCH 13/13] re-order functions --- package.json | 7 +++---- src/contracts/Vault721Adapter.sol | 32 ++++++++++++++++--------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 3ad2890..8c30f20 100644 --- a/package.json +++ b/package.json @@ -4,12 +4,12 @@ "private": true, "description": "Seaport Zone SIP-15 and EIP-7496", "homepage": "https://opendollar.com/", - "license": "GNU AGPL", - "author": "OpenFi Foundation", "repository": { "type": "git", "url": "git+https://github.com/open-dollar/od-seaport-zone.git" }, + "license": "GNU AGPL", + "author": "OpenFi Foundation", "contributors": [ "pi0neerpat (https://github.com/pi0neerpat)", "daopunk (https://github.com/daopunk)", @@ -34,5 +34,4 @@ "solhint-plugin-defi-wonderland": "^1.1.3", "sort-package-json": "^2.8.0" } -} - \ No newline at end of file +} \ No newline at end of file diff --git a/src/contracts/Vault721Adapter.sol b/src/contracts/Vault721Adapter.sol index 5dbc902..134725e 100644 --- a/src/contracts/Vault721Adapter.sol +++ b/src/contracts/Vault721Adapter.sol @@ -6,6 +6,8 @@ import {IVault721} from '@opendollar/interfaces/proxies/IVault721.sol'; import {IERC7496} from 'shipyard-core/src/dynamic-traits/interfaces/IERC7496.sol'; /** + * @title Adds support for ERC7496 to an existing ERC721 + * @author OpenFi Foundation * @notice IERC7496 events are never emitted since NFVState is tracked in Vault721 */ contract Vault721Adapter is IERC7496 { @@ -45,21 +47,6 @@ contract Vault721Adapter is IERC7496 { return _traitValues; } - /** - * @dev return onchain data uri of trait details - */ - function getTraitMetadataURI() external view returns (string memory _uri) { - string memory _json = _formatJsonMetaData(); - _uri = string.concat('data:application/json;base64,', Base64.encode(bytes(_json))); - } - - /** - * @dev setTrait is disabled; NFVState is found in Vault721 - */ - function setTrait(uint256, bytes32, bytes32) external { - revert Disabled(); - } - /** * @dev get NFVState from Vault721 * @notice return values are not hashed to enable enforceable condition in zone @@ -71,6 +58,14 @@ contract Vault721Adapter is IERC7496 { else revert UnknownTraitKeys(); } + /** + * @dev return onchain data uri of trait details + */ + function getTraitMetadataURI() external view returns (string memory _uri) { + string memory _json = _formatJsonMetaData(); + _uri = string.concat('data:application/json;base64,', Base64.encode(bytes(_json))); + } + function _formatJsonMetaData() internal pure returns (string memory _json) { _json = string.concat( JSON_OPEN, @@ -87,4 +82,11 @@ contract Vault721Adapter is IERC7496 { JSON_CLOSE ); } + + /** + * @dev setTrait is disabled; NFVState is found in Vault721 + */ + function setTrait(uint256, bytes32, bytes32) external { + revert Disabled(); + } }