diff --git a/contracts/.openzeppelin/sepolia.json b/contracts/.openzeppelin/sepolia.json index 808736e1..fc1c4190 100644 --- a/contracts/.openzeppelin/sepolia.json +++ b/contracts/.openzeppelin/sepolia.json @@ -371,6 +371,372 @@ }, "namespaces": {} } + }, + "125db54394ee349f18c5e7b6f717dff5868c4ccab68a96eeef38a6321b3f05b2": { + "address": "0x0c4e5Be5D99B33A2a860C21D9B9f5C98Be8A758C", + "txHash": "0x8350264379987de7496543b843aea532c11608bdfae6a47d301d5fe45acdd720", + "layout": { + "solcVersion": "0.8.17", + "storage": [ + { + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8", + "contract": "Initializable", + "src": "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol:62", + "retypedFrom": "bool" + }, + { + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool", + "contract": "Initializable", + "src": "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol:67" + }, + { + "label": "__gap", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)50_storage", + "contract": "ContextUpgradeable", + "src": "lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol:36" + }, + { + "label": "__gap", + "offset": 0, + "slot": "51", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC165Upgradeable", + "src": "lib/openzeppelin-contracts-upgradeable/contracts/utils/introspection/ERC165Upgradeable.sol:41" + }, + { + "label": "_balances", + "offset": 0, + "slot": "101", + "type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))", + "contract": "ERC1155Upgradeable", + "src": "lib/openzeppelin-contracts-upgradeable/contracts/token/ERC1155/ERC1155Upgradeable.sol:25" + }, + { + "label": "_operatorApprovals", + "offset": 0, + "slot": "102", + "type": "t_mapping(t_address,t_mapping(t_address,t_bool))", + "contract": "ERC1155Upgradeable", + "src": "lib/openzeppelin-contracts-upgradeable/contracts/token/ERC1155/ERC1155Upgradeable.sol:28" + }, + { + "label": "_uri", + "offset": 0, + "slot": "103", + "type": "t_string_storage", + "contract": "ERC1155Upgradeable", + "src": "lib/openzeppelin-contracts-upgradeable/contracts/token/ERC1155/ERC1155Upgradeable.sol:31" + }, + { + "label": "__gap", + "offset": 0, + "slot": "104", + "type": "t_array(t_uint256)47_storage", + "contract": "ERC1155Upgradeable", + "src": "lib/openzeppelin-contracts-upgradeable/contracts/token/ERC1155/ERC1155Upgradeable.sol:528" + }, + { + "label": "__gap", + "offset": 0, + "slot": "151", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC1155BurnableUpgradeable", + "src": "lib/openzeppelin-contracts-upgradeable/contracts/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol:52" + }, + { + "label": "_baseURI", + "offset": 0, + "slot": "201", + "type": "t_string_storage", + "contract": "ERC1155URIStorageUpgradeable", + "src": "lib/openzeppelin-contracts-upgradeable/contracts/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol:27" + }, + { + "label": "_tokenURIs", + "offset": 0, + "slot": "202", + "type": "t_mapping(t_uint256,t_string_storage)", + "contract": "ERC1155URIStorageUpgradeable", + "src": "lib/openzeppelin-contracts-upgradeable/contracts/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol:30" + }, + { + "label": "__gap", + "offset": 0, + "slot": "203", + "type": "t_array(t_uint256)48_storage", + "contract": "ERC1155URIStorageUpgradeable", + "src": "lib/openzeppelin-contracts-upgradeable/contracts/token/ERC1155/extensions/ERC1155URIStorageUpgradeable.sol:77" + }, + { + "label": "_owner", + "offset": 0, + "slot": "251", + "type": "t_address", + "contract": "OwnableUpgradeable", + "src": "lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol:22" + }, + { + "label": "__gap", + "offset": 0, + "slot": "252", + "type": "t_array(t_uint256)49_storage", + "contract": "OwnableUpgradeable", + "src": "lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol:94" + }, + { + "label": "__gap", + "offset": 0, + "slot": "301", + "type": "t_array(t_uint256)50_storage", + "contract": "ERC1967UpgradeUpgradeable", + "src": "lib/openzeppelin-contracts-upgradeable/contracts/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol:211" + }, + { + "label": "__gap", + "offset": 0, + "slot": "351", + "type": "t_array(t_uint256)50_storage", + "contract": "UUPSUpgradeable", + "src": "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol:107" + }, + { + "label": "typeCounter", + "offset": 0, + "slot": "401", + "type": "t_uint256", + "contract": "SemiFungible1155", + "src": "src/protocol/SemiFungible1155.sol:27" + }, + { + "label": "owners", + "offset": 0, + "slot": "402", + "type": "t_mapping(t_uint256,t_address)", + "contract": "SemiFungible1155", + "src": "src/protocol/SemiFungible1155.sol:38" + }, + { + "label": "creators", + "offset": 0, + "slot": "403", + "type": "t_mapping(t_uint256,t_address)", + "contract": "SemiFungible1155", + "src": "src/protocol/SemiFungible1155.sol:41" + }, + { + "label": "tokenValues", + "offset": 0, + "slot": "404", + "type": "t_mapping(t_uint256,t_uint256)", + "contract": "SemiFungible1155", + "src": "src/protocol/SemiFungible1155.sol:44" + }, + { + "label": "maxIndex", + "offset": 0, + "slot": "405", + "type": "t_mapping(t_uint256,t_uint256)", + "contract": "SemiFungible1155", + "src": "src/protocol/SemiFungible1155.sol:47" + }, + { + "label": "__gap", + "offset": 0, + "slot": "406", + "type": "t_array(t_uint256)25_storage", + "contract": "SemiFungible1155", + "src": "src/protocol/SemiFungible1155.sol:648" + }, + { + "label": "merkleRoots", + "offset": 0, + "slot": "431", + "type": "t_mapping(t_uint256,t_bytes32)", + "contract": "AllowlistMinter", + "src": "src/protocol/AllowlistMinter.sol:17" + }, + { + "label": "hasBeenClaimed", + "offset": 0, + "slot": "432", + "type": "t_mapping(t_uint256,t_mapping(t_bytes32,t_bool))", + "contract": "AllowlistMinter", + "src": "src/protocol/AllowlistMinter.sol:18" + }, + { + "label": "maxUnits", + "offset": 0, + "slot": "433", + "type": "t_mapping(t_uint256,t_uint256)", + "contract": "AllowlistMinter", + "src": "src/protocol/AllowlistMinter.sol:19" + }, + { + "label": "minted", + "offset": 0, + "slot": "434", + "type": "t_mapping(t_uint256,t_uint256)", + "contract": "AllowlistMinter", + "src": "src/protocol/AllowlistMinter.sol:20" + }, + { + "label": "__gap", + "offset": 0, + "slot": "435", + "type": "t_array(t_uint256)26_storage", + "contract": "AllowlistMinter", + "src": "src/protocol/AllowlistMinter.sol:75" + }, + { + "label": "_paused", + "offset": 0, + "slot": "461", + "type": "t_bool", + "contract": "PausableUpgradeable", + "src": "lib/openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol:29" + }, + { + "label": "__gap", + "offset": 0, + "slot": "462", + "type": "t_array(t_uint256)49_storage", + "contract": "PausableUpgradeable", + "src": "lib/openzeppelin-contracts-upgradeable/contracts/security/PausableUpgradeable.sol:116" + }, + { + "label": "typeRestrictions", + "offset": 0, + "slot": "511", + "type": "t_mapping(t_uint256,t_enum(TransferRestrictions)19459)", + "contract": "HypercertMinter", + "src": "src/protocol/HypercertMinter.sol:20" + }, + { + "label": "__gap", + "offset": 0, + "slot": "512", + "type": "t_array(t_uint256)29_storage", + "contract": "HypercertMinter", + "src": "src/protocol/HypercertMinter.sol:258" + } + ], + "types": { + "t_address": { + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)25_storage": { + "label": "uint256[25]", + "numberOfBytes": "800" + }, + "t_array(t_uint256)26_storage": { + "label": "uint256[26]", + "numberOfBytes": "832" + }, + "t_array(t_uint256)29_storage": { + "label": "uint256[29]", + "numberOfBytes": "928" + }, + "t_array(t_uint256)47_storage": { + "label": "uint256[47]", + "numberOfBytes": "1504" + }, + "t_array(t_uint256)48_storage": { + "label": "uint256[48]", + "numberOfBytes": "1536" + }, + "t_array(t_uint256)49_storage": { + "label": "uint256[49]", + "numberOfBytes": "1568" + }, + "t_array(t_uint256)50_storage": { + "label": "uint256[50]", + "numberOfBytes": "1600" + }, + "t_bool": { + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_enum(TransferRestrictions)19459": { + "label": "enum IHypercertToken.TransferRestrictions", + "members": [ + "AllowAll", + "DisallowAll", + "FromCreatorOnly" + ], + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_bool)": { + "label": "mapping(address => bool)", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_mapping(t_address,t_bool))": { + "label": "mapping(address => mapping(address => bool))", + "numberOfBytes": "32" + }, + "t_mapping(t_address,t_uint256)": { + "label": "mapping(address => uint256)", + "numberOfBytes": "32" + }, + "t_mapping(t_bytes32,t_bool)": { + "label": "mapping(bytes32 => bool)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_address)": { + "label": "mapping(uint256 => address)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_bytes32)": { + "label": "mapping(uint256 => bytes32)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_enum(TransferRestrictions)19459)": { + "label": "mapping(uint256 => enum IHypercertToken.TransferRestrictions)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_mapping(t_address,t_uint256))": { + "label": "mapping(uint256 => mapping(address => uint256))", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_mapping(t_bytes32,t_bool))": { + "label": "mapping(uint256 => mapping(bytes32 => bool))", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_string_storage)": { + "label": "mapping(uint256 => string)", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_uint256)": { + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32" + }, + "t_string_storage": { + "label": "string", + "numberOfBytes": "32" + }, + "t_uint256": { + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "label": "uint8", + "numberOfBytes": "1" + } + }, + "namespaces": {} + } } } } diff --git a/contracts/contracts/HypercertMinter.sol b/contracts/contracts/HypercertMinter.sol index 4679ddb3..6e97b17f 100644 --- a/contracts/contracts/HypercertMinter.sol +++ b/contracts/contracts/HypercertMinter.sol @@ -116,11 +116,8 @@ contract HypercertMinter is IHypercertToken, SemiFungible1155, AllowlistMinter, /// @notice Split a claimtokens value into parts with summed value equal to the original /// @dev see {IHypercertToken} - function splitFraction(address _account, uint256 _tokenID, uint256[] calldata _newFractions) - external - whenNotPaused - { - _splitTokenUnits(_account, _tokenID, _newFractions); + function splitFraction(address _to, uint256 _tokenID, uint256[] calldata _newFractions) external whenNotPaused { + _splitTokenUnits(_to, _tokenID, _newFractions); } /// @notice Merge the value of tokens belonging to the same claim diff --git a/contracts/contracts/SemiFungible1155.sol b/contracts/contracts/SemiFungible1155.sol index 1add3178..07a0382a 100644 --- a/contracts/contracts/SemiFungible1155.sol +++ b/contracts/contracts/SemiFungible1155.sol @@ -193,11 +193,13 @@ contract SemiFungible1155 is emit BatchValueTransfer(_typeIDs, zeroes, tokenIDs, _units); } - /// @dev Split the units of `_tokenID` owned by `account` across `_values` + /// @dev Split the units of `_tokenID` across `_values` to `_to` /// @dev `_values` must sum to total `units` held at `_tokenID` - function _splitTokenUnits(address _account, uint256 _tokenID, uint256[] calldata _values) internal { + /// @dev `_to` must not be zero address, that's a burn + function _splitTokenUnits(address _to, uint256 _tokenID, uint256[] calldata _values) internal { if (_values.length > FRACTION_LIMIT || _values.length < 2) revert Errors.ArraySize(); if (tokenValues[_tokenID] != _getSum(_values)) revert Errors.NotAllowed(); + if (_to == address(0)) revert Errors.NotAllowed(); // Current token uint256 _typeID = getBaseType(_tokenID); @@ -233,7 +235,7 @@ contract SemiFungible1155 is } } - _beforeUnitTransfer(_msgSender(), _account, fromIDs, toIDs, values, ""); + _beforeUnitTransfer(_msgSender(), owners(_tokenID), fromIDs, toIDs, values, ""); for (uint256 i; i < len;) { valueLeft -= values[i]; @@ -247,7 +249,7 @@ contract SemiFungible1155 is tokenValues[_tokenID] = valueLeft; - _mintBatch(_account, toIDs, amounts, ""); + _mintBatch(_to, toIDs, amounts, ""); emit BatchValueTransfer(typeIDs, fromIDs, toIDs, values); } @@ -258,10 +260,13 @@ contract SemiFungible1155 is if (_fractionIDs.length > FRACTION_LIMIT || _fractionIDs.length < 2) { revert Errors.ArraySize(); } + uint256 len = _fractionIDs.length - 1; uint256 target = _fractionIDs[len]; + if (_to == address(0) || owners[target] != _account) revert Errors.NotAllowed(); + uint256 _totalValue; uint256[] memory fromIDs = new uint256[](len); uint256[] memory toIDs = new uint256[](len); @@ -276,6 +281,10 @@ contract SemiFungible1155 is amounts[i] = 1; values[i] = tokenValues[_fractionID]; + if (owners[_fractionID] != _account) { + revert Errors.NotAllowed(); + } + unchecked { ++i; } @@ -344,6 +353,7 @@ contract SemiFungible1155 is bytes memory data ) internal virtual { uint256 len = fromIDs.length; + if (from != _msgSender() && !isApprovedForAll(from, _msgSender())) revert Errors.NotApprovedOrOwner(); for (uint256 i; i < len;) { uint256 _from = fromIDs[i]; @@ -351,7 +361,6 @@ contract SemiFungible1155 is if (isBaseType(_from)) revert Errors.NotAllowed(); if (getBaseType(_from) != getBaseType(_to)) revert Errors.TypeMismatch(); - if (from != _msgSender() && !isApprovedForAll(from, _msgSender())) revert Errors.NotApprovedOrOwner(); unchecked { ++i; } diff --git a/contracts/package.json b/contracts/package.json index d4eacb93..08946ccc 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -1,7 +1,7 @@ { "name": "@hypercerts-org/contracts", "description": "EVM compatible protocol for managing impact claims", - "version": "1.1.1-alpha.0", + "version": "1.1.1-alpha.1", "author": { "name": "Hypercerts Foundation", "url": "https://github.com/hypercerts-org/hypercerts" diff --git a/contracts/src/deployments/deployment-marketplace-sepolia.json b/contracts/src/deployments/deployment-marketplace-sepolia.json index 321c4af0..c6922df9 100644 --- a/contracts/src/deployments/deployment-marketplace-sepolia.json +++ b/contracts/src/deployments/deployment-marketplace-sepolia.json @@ -1,91 +1,91 @@ { "TransferManager": { - "address": "0xF0983523e44A0c1EE3a02E7F6e7E53A3FBc52aD8", + "address": "0x95d0D2986Ea7acC6c8D56880e6155c950E9B62F9", "fullNamespace": "TransferManager", "args": ["0xdf2c3dace6f31e650fd03b8ff72bee82cb1c199a"], "encodedArgs": "0xdf2c3dace6f31e650fd03b8ff72bee82cb1c199a", - "tx": "0x9201deac4acc079637fd8550c3b23ca0991150bf87943afd6c8f14ecddd3621f" + "tx": "0x978640bf72b6f75237f131bb848cb485b1f693454891bef215839c3fcda67d2a" }, "ProtocolFeeRecipient": { - "address": "0x76DB24D89EEe9f1E591A43C734a0a04A6762a29e", + "address": "0x0e7b2baA3B5bCB9d851A41Bd8C9f277F92e3da5c", "fullNamespace": "ProtocolFeeRecipient", "args": ["0xdf2c3dace6f31e650fd03b8ff72bee82cb1c199a", "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9"], "encodedArgs": "0xdf2c3dace6f31e650fd03b8ff72bee82cb1c199a7b79995e5f793a07bc00c21412e50ecae098e7f9", - "tx": "0x527753c230b7d8673a79c8b3aa5ca9b0ce75180cb378760d3af1db793293559c" + "tx": "0x0e3c124a69a49e1bfeff119a02c5336b40cef6c7b91b2cf9ae17443b1611d0f7" }, "HypercertExchange": { - "address": "0xfCC76C05867dad129f1D89a593Da8d55821084Eb", + "address": "0x4DDe28116255775E6097Aa4edD288355eb74fcf6", "fullNamespace": "LooksRareProtocol", "args": [ "0xdf2c3dace6f31e650fd03b8ff72bee82cb1c199a", - "0x76DB24D89EEe9f1E591A43C734a0a04A6762a29e", - "0xF0983523e44A0c1EE3a02E7F6e7E53A3FBc52aD8", + "0x0e7b2baA3B5bCB9d851A41Bd8C9f277F92e3da5c", + "0x95d0D2986Ea7acC6c8D56880e6155c950E9B62F9", "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9" ], - "encodedArgs": "0xdf2c3dace6f31e650fd03b8ff72bee82cb1c199a76db24d89eee9f1e591a43c734a0a04a6762a29ef0983523e44a0c1ee3a02e7f6e7e53a3fbc52ad87b79995e5f793a07bc00c21412e50ecae098e7f9", - "tx": "0x12adf8ad8166b6df9c506c9f09091e3903785c98e175099b5c962f3d5a459d78" + "encodedArgs": "0xdf2c3dace6f31e650fd03b8ff72bee82cb1c199a0e7b2baa3b5bcb9d851a41bd8c9f277f92e3da5c95d0d2986ea7acc6c8d56880e6155c950e9b62f97b79995e5f793a07bc00c21412e50ecae098e7f9", + "tx": "0x38b1edc3e6272530ea3e6f80b490225f3fa2eb317c6d3d5b3daac6f272aa06fc" }, "RoyaltyFeeRegistry": { - "address": "0xa0C9e21e18A6Eff0ea075325Ec71c4f95b0DE5C4", + "address": "0x81d3fba12f3D1f5A2cC6566b278AdAF8FEEb14e4", "fullNamespace": "RoyaltyFeeRegistry", "args": ["1000"], "encodedArgs": "0x00000000000000000000000000000000000000000000000000000000000003e8", - "tx": "0x2682f3c13de931f47baebf864a66727183121e82f22e8d97008864d90e023f59" + "tx": "0x02357415077edb5adf9294d7b998eb37920847b42f1ff08d2d987aaa852b97ea" }, "OrderValidator": { - "address": "0x45cae10e94d31f9d04f007fafd989d2cf7193ba6", + "address": "0xde42d94e6c5f07731f5e53104e7bc809ff8bc483", "fullNamespace": "OrderValidatorV2A", - "args": ["0xfCC76C05867dad129f1D89a593Da8d55821084Eb"], - "encodedArgs": "0xfcc76c05867dad129f1d89a593da8d55821084eb", - "tx": "0xdb0798ea42157958e194e82afeb10474ae147c46a5eac3ad080252cff8f62fc8" + "args": ["0x4DDe28116255775E6097Aa4edD288355eb74fcf6"], + "encodedArgs": "0x4dde28116255775e6097aa4edd288355eb74fcf6", + "tx": "0xbc6ad72a7f61f0b3ae6cb70cd603621b380810171bf3658e266f60f30db3f848" }, "CreatorFeeManager": { - "address": "0xe9179d10249b5c20412f8421eee2c0177f0a3beb", + "address": "0x6cca0accb70bb48244feb69da05a8f5269234330", "fullNamespace": "CreatorFeeManagerWithRoyalties", - "args": ["0xa0C9e21e18A6Eff0ea075325Ec71c4f95b0DE5C4"], - "encodedArgs": "0xa0c9e21e18a6eff0ea075325ec71c4f95b0de5c4", - "tx": "0xcde3521039b8a9382b5c94e364add8d0a8ea8db8cf66b6b5cd3de2b22c565221" + "args": ["0x81d3fba12f3D1f5A2cC6566b278AdAF8FEEb14e4"], + "encodedArgs": "0x81d3fba12f3d1f5a2cc6566b278adaf8feeb14e4", + "tx": "0xc53a46e1d99e0be9e226da8c3ed232e997160cf0655f8612412044ea3f398a36" }, "StrategyCollectionOffer": { - "address": "0xc7c884c81740a3ec1e6cbf0d1aea1991f7ddf4b8", + "address": "0xa9c539f94212794c3a81d18a54658775b35a8061", "fullNamespace": "StrategyCollectionOffer", "args": [], "encodedArgs": "0x", - "tx": "0xf8c202c2fc6978b2d48314594739918fa77db4552aa2b2baef8e7839133b5c10" + "tx": "0xaa325bfb22b43e9a4ebe80c4890a5d58b7ed068510328db8f89c69d645d7af7f" }, "StrategyDutchAuction": { - "address": "0x1c91994909fb224b89dbb42e0f62ced998bdea21", + "address": "0xa4d163baaa46f232538dff90dfb87042caa1a29b", "fullNamespace": "StrategyDutchAuction", "args": [], "encodedArgs": "0x", - "tx": "0xae44f43b2641cab5105f05ff97fe7874f882d2d77a1c56db307d3b89dcbc80a9" + "tx": "0x95588a5bde437366e2447fb6a734a0f5dd6d362db1f2b7729b5a821051f1019f" }, "StrategyItemIdsRange": { - "address": "0x853da9e437b360f5f1a45e3f21104ab776398f67", + "address": "0x04d7ac3a3671a81aed467db9257f45e9c03efa0d", "fullNamespace": "StrategyItemIdsRange", "args": [], "encodedArgs": "0x", - "tx": "0x38875ae84530c89685b0b4ce778fadd6e0d0da4552f706d89f509faf8bbb579a" + "tx": "0xf880c4c3820b8593d7faf5513812d549f4d7819bca379a87258e1985eed4a08f" }, "StrategyHypercertCollectionOffer": { - "address": "0x919e0638b1915784c6eb012f716013089fed036e", + "address": "0x62b911d000a2bfe303668dbaa7fc509f1bb9509f", "fullNamespace": "StrategyHypercertCollectionOffer", "args": [], "encodedArgs": "0x", - "tx": "0x11080958f3e75da847f8c6fbcb911db02e553e2febca7f8ccf4769fd2da1d7b9" + "tx": "0xf6c824975a0785f02da2ce835f016fbd9581635fb601f0c350244dae3d69e647" }, "StrategyHypercertDutchAuction": { - "address": "0x25370812dbe35ce2665605cf0bc206c3395180a9", + "address": "0xe1bf35ba5ff0a0cc022f85c8b07c01dc6db01900", "fullNamespace": "StrategyHypercertDutchAuction", "args": [], "encodedArgs": "0x", - "tx": "0x43564e0766be9a537f34fe9e0e4937d3abb9725c033f2fee0cbabbfb6b8023a3" + "tx": "0x7edfcd705c10bb829c147296916be36a2ea44f113c9a923f7dcad9d7bd687fb1" }, "StrategyHypercertFractionOffer": { - "address": "0xdfa561b7ef886c4daedfbd64f6965eb04c520aea", + "address": "0x39c3a18bea1d49e4d73a352db0fcf974c23beada", "fullNamespace": "StrategyHypercertFractionOffer", "args": [], "encodedArgs": "0x", - "tx": "0x29e124fea536fde38ceb5cad9641c64140547cbf737363d0415f444b544eab54" + "tx": "0xfb83fdebb640e18b1b7558859f61c6cf27505295436509b83850937958ab66fe" } } diff --git a/contracts/src/protocol/interfaces/IHypercertToken.sol b/contracts/src/protocol/interfaces/IHypercertToken.sol index 3e7738b4..be76de30 100644 --- a/contracts/src/protocol/interfaces/IHypercertToken.sol +++ b/contracts/src/protocol/interfaces/IHypercertToken.sol @@ -34,9 +34,9 @@ interface IHypercertToken { TransferRestrictions restrictions ) external; - /// @dev Function called to split `tokenID` owned by `account` into units declared in `values`. + /// @dev Function called to split `tokenID` and transfer `to` into units declared in `values`. /// @notice The sum of `values` must equal the current value of `_tokenID`. - function splitFraction(address account, uint256 tokenID, uint256[] memory _values) external; + function splitFraction(address to, uint256 tokenID, uint256[] memory _values) external; /// @dev Function called to merge tokens within `tokenIDs`. /// @notice Tokens that have been merged are burned. diff --git a/contracts/tasks/deploy-marketplace.ts b/contracts/tasks/deploy-marketplace.ts index 42ead511..8eb6307b 100644 --- a/contracts/tasks/deploy-marketplace.ts +++ b/contracts/tasks/deploy-marketplace.ts @@ -99,7 +99,7 @@ task("deploy-marketplace", "Deploy marketplace contracts and verify") const _minTotalFeeBp = 50; const _maxProtocolFeeBp = 200; - const releaseCounter = "v0.4"; + const releaseCounter = "v0.7"; const salt = slice( encodePacked(["address", "string", "address"], [deployer.account?.address, releaseCounter, create2Address]), @@ -129,6 +129,7 @@ task("deploy-marketplace", "Deploy marketplace contracts and verify") { contract: strategyCollectionOfferContract, name: "StrategyCollectionOffer", + isMakerBid: true, strategies: [ "executeCollectionStrategyWithTakerAsk", "executeCollectionStrategyWithTakerAskWithProof", @@ -138,16 +139,19 @@ task("deploy-marketplace", "Deploy marketplace contracts and verify") { contract: strategyDutchAuctionContract, name: "StrategyDutchAuction", + isMakerBid: false, strategies: ["executeStrategyWithTakerBid"], }, { contract: strategyItemIdsRangeContract, name: "StrategyItemIdsRange", + isMakerBid: true, strategies: ["executeStrategyWithTakerAsk"], }, { contract: strategyHypercertCollectionOfferContract, name: "StrategyHypercertCollectionOffer", + isMakerBid: true, strategies: [ "executeHypercertCollectionStrategyWithTakerAsk", "executeHypercertCollectionStrategyWithTakerAskWithProof", @@ -157,11 +161,13 @@ task("deploy-marketplace", "Deploy marketplace contracts and verify") { contract: strategyHypercertDutchAuctionContract, name: "StrategyHypercertDutchAuction", + isMakerBid: false, strategies: ["executeStrategyWithTakerBid"], }, { contract: strategyHypercertFractionOfferContract, name: "StrategyHypercertFractionOffer", + isMakerBid: false, strategies: [ "executeHypercertFractionStrategyWithTakerBid", "executeHypercertFractionStrategyWithTakerBidWithAllowlist", @@ -470,7 +476,7 @@ task("deploy-marketplace", "Deploy marketplace contracts and verify") _minTotalFeeBp, _maxProtocolFeeBp, strategyFactory.interface.getFunction(strat)?.selector, - true, + strategy.isMakerBid, strategyTx.contractAddress, ]); diff --git a/contracts/tasks/upgrade.ts b/contracts/tasks/upgrade.ts index 6e783646..d7b1d33c 100644 --- a/contracts/tasks/upgrade.ts +++ b/contracts/tasks/upgrade.ts @@ -17,17 +17,17 @@ task("upgrade-minter", "Upgrade implementation contract of Minter and verify") kind: "uups", unsafeAllow: ["constructor"], }); - await hypercertMinterUpgrade.deployed(); - console.log(`HypercertMinter at proxy address ${hypercertMinterUpgrade.address} was upgraded`); + + console.log(`HypercertMinter at proxy address ${proxy} was upgraded`); try { - const code = await hypercertMinterUpgrade.instance?.provider.getCode(hypercertMinterUpgrade.address); + const code = await hypercertMinterUpgrade.instance?.provider.getCode(proxy); if (code === "0x") { console.log(`${hypercertMinterUpgrade.name} contract upgrade has not completed. waiting to verify...`); await hypercertMinterUpgrade.instance?.deployed(); } await run("verify:verify", { - address: hypercertMinterUpgrade.address, + address: proxy, }); } catch (error) { const errorMessage = (error as Error).message; @@ -39,44 +39,6 @@ task("upgrade-minter", "Upgrade implementation contract of Minter and verify") } }); -/** - * Used to upgrade a contract directly via local keys - */ -task("upgrade-trader", "Upgrade implementation contract of Trader and verify") - .addParam("proxy", "Provider proxy address") - .setAction(async ({ proxy }, { ethers, upgrades, run }) => { - const HypercertTrader = await ethers.getContractFactory("HypercertTrader"); - - // Validate (redundant?) - console.log("Validating upgrade.."); - await upgrades.validateUpgrade(proxy, HypercertTrader).then(() => console.log("Valid upgrade. Deploying..")); - - // Upgrade - const hypercertTraderUpgrade = await upgrades.upgradeProxy(proxy, HypercertTrader, { - kind: "uups", - unsafeAllow: ["constructor"], - }); - await hypercertTraderUpgrade.deployed(); - console.log(`HypercertTrader at proxy address ${hypercertTraderUpgrade.address} was upgraded`); - - try { - const code = await hypercertTraderUpgrade.instance?.provider.getCode(hypercertTraderUpgrade.address); - if (code === "0x") { - console.log(`${hypercertTraderUpgrade.name} contract upgrade has not completed. waiting to verify...`); - await hypercertTraderUpgrade.instance?.deployed(); - } - await run("verify:verify", { - address: hypercertTraderUpgrade.address, - }); - } catch (error) { - const errorMessage = (error as Error).message; - if (errorMessage.includes("Reason: Already Verified")) { - console.log("Reason: Already Verified"); - } - console.error(errorMessage); - } - }); - /** * Used to propose a multi-sig upgrade via OpenZeppelin Defender for HypercertMinter */ @@ -95,22 +57,3 @@ task("propose-upgrade-minter", "Propose an upgrade to OpenZeppelin Defender") }); console.log("Upgrade proposal created at: ", proposal.url); }); - -/** - * Used to propose a multi-sig upgrade via OpenZeppelin Defender for HypercertTrader - */ -task("propose-upgrade-trader", "Propose an upgrade to OpenZeppelin Defender") - .addParam("proxy", "Proxy contract address") - .addParam("multisig", "Owner multisig address") - .addOptionalParam("description", "Description of upgrade") - .setAction(async ({ proxy, multisig, description = "Upgrade Trader contract" }, { ethers, defender }) => { - const HypercertTrader = await ethers.getContractFactory("HypercertTrader"); - console.log(`Proposing upgrade to multisig ${multisig} as address ${proxy}`); - const proposal = await defender.proposeUpgrade(proxy, HypercertTrader, { - description, - multisig, - multisigType: "Gnosis Safe", - title: "Upgrade Trader contract", - }); - console.log("Upgrade proposal created at: ", proposal.url); - }); diff --git a/docs/docs/developer/api/contracts/protocol/interfaces/IHypercertToken.md b/docs/docs/developer/api/contracts/protocol/interfaces/IHypercertToken.md index 30ed6f95..5bd0e8a9 100644 --- a/docs/docs/developer/api/contracts/protocol/interfaces/IHypercertToken.md +++ b/docs/docs/developer/api/contracts/protocol/interfaces/IHypercertToken.md @@ -97,18 +97,18 @@ _Function called to store a claim referenced via `uri` with a set of `fractions` ### splitFraction ```solidity -function splitFraction(address account, uint256 tokenID, uint256[] _values) external nonpayable +function splitFraction(address to, uint256 tokenID, uint256[] _values) external nonpayable ``` The sum of `values` must equal the current value of `_tokenID`. -_Function called to split `tokenID` owned by `account` into units declared in `values`._ +_Function called to split `tokenID` and transfer `to` into units declared in `values`._ #### Parameters | Name | Type | Description | | -------- | --------- | ----------- | -| account | address | undefined | +| to | address | undefined | | tokenID | uint256 | undefined | | \_values | uint256[] | undefined | diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 53adc75c..8d922a2b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -568,8 +568,8 @@ importers: specifier: ^3.2.0 version: 3.2.0(graphql@16.8.1) '@hypercerts-org/contracts': - specifier: 1.1.1-alpha.0 - version: 1.1.1-alpha.0(ts-node@10.9.1)(typescript@5.3.2) + specifier: 1.1.1-alpha.1 + version: 1.1.1-alpha.1(ts-node@10.9.1)(typescript@5.3.2) '@openzeppelin/merkle-tree': specifier: ^1.0.5 version: 1.0.5 @@ -7323,10 +7323,10 @@ packages: - utf-8-validate dev: false - /@hypercerts-org/contracts@1.1.1-alpha.0(ts-node@10.9.1)(typescript@5.3.2): + /@hypercerts-org/contracts@1.1.1-alpha.0(typescript@5.1.6): resolution: {integrity: sha512-3bypIOuTMLM/5KXopzOCOxcR+nUImFf/phPtZ/PoHceAx4CZZe1ygnK8l+GHaBxOX7/HcAp/9D7NBbcnJjHYcw==} dependencies: - hardhat: 2.19.1(ts-node@10.9.1)(typescript@5.3.2) + hardhat: 2.19.1(typescript@5.1.6) transitivePeerDependencies: - bufferutil - supports-color @@ -7335,10 +7335,10 @@ packages: - utf-8-validate dev: false - /@hypercerts-org/contracts@1.1.1-alpha.0(typescript@5.1.6): - resolution: {integrity: sha512-3bypIOuTMLM/5KXopzOCOxcR+nUImFf/phPtZ/PoHceAx4CZZe1ygnK8l+GHaBxOX7/HcAp/9D7NBbcnJjHYcw==} + /@hypercerts-org/contracts@1.1.1-alpha.1(ts-node@10.9.1)(typescript@5.3.2): + resolution: {integrity: sha512-M7cNYEf+i6rT2jSOT4sob/oIlKalT2zSweBQq6iP1wCA16Vhf0Y5JDhwLH64z4XENJfOKKSO0TmDDF2kKvHReg==} dependencies: - hardhat: 2.19.1(typescript@5.1.6) + hardhat: 2.19.1(ts-node@10.9.1)(typescript@5.3.2) transitivePeerDependencies: - bufferutil - supports-color @@ -18539,7 +18539,6 @@ packages: dependencies: is-hex-prefixed: 1.0.0 strip-hex-prefix: 1.0.0 - bundledDependencies: false /eval@0.1.8: resolution: {integrity: sha512-EzV94NYKoO09GLXGjXj9JIlXijVck4ONSr5wiCWDvhsvj5jxSrzTmRU/9C1DyB6uToszLs8aifA6NQ7lEQdvFw==} @@ -27753,7 +27752,7 @@ packages: /puppeteer@18.2.1: resolution: {integrity: sha512-7+UhmYa7wxPh2oMRwA++k8UGVDxh3YdWFB52r9C3tM81T6BU7cuusUSxImz0GEYSOYUKk/YzIhkQ6+vc0gHbxQ==} engines: {node: '>=14.1.0'} - deprecated: < 21.3.7 is no longer supported + deprecated: < 21.5.0 is no longer supported requiresBuild: true dependencies: https-proxy-agent: 5.0.1 diff --git a/sdk/package.json b/sdk/package.json index 152b446b..e9d327d4 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@hypercerts-org/sdk", - "version": "1.4.2-alpha.1", + "version": "1.4.2-alpha.2", "description": "SDK for hypercerts protocol", "repository": "git@github.com:hypercerts-org/hypercerts.git", "author": "Hypercerts team", @@ -24,7 +24,7 @@ "@ethereum-attestation-service/eas-sdk": "1.3.7", "@ethersproject/abstract-signer": "^5.7.0", "@graphql-typed-document-node/core": "^3.2.0", - "@hypercerts-org/contracts": "1.1.1-alpha.0", + "@hypercerts-org/contracts": "1.1.1-alpha.1", "@openzeppelin/merkle-tree": "^1.0.5", "@urql/core": "^4.2.0", "@whatwg-node/fetch": "^0.9.13",