sei-chain icon indicating copy to clipboard operation
sei-chain copied to clipboard

Pointers contracts: support for ERC1155 and CW1155 contracts

Open dvli2007 opened this issue 1 year ago • 0 comments

Describe your changes and provide context

This pull request is a collaboration by Orbiters/Frensei and Pallet Exchange to bring full support for 1155 contract standards to Sei. We added:

  • an ERC1155 pointer contract for the new CW1155 standard
  • a CW1155 pointer contract for any ERC1155 contracts

The ERC1155 contract is a well known and battle tested contract standard for NFTs and for semi-fungible tokens, allowing efficient creation and handling of very large quantities of tokens. Supporting the 1155 standard on-chain opens up the possibility for gaming (games with onchain assets almost always need to use a 1155 contract), open edition mints, and much more. The Orbiters/Frensei and Pallet Exchange teams see full support for 1155-type contracts/assets on Sei as mission critical to having a feature-complete general-purpose blockchain.

To further note, we have pioneered the first CW1155 standard that we know of. Cosmwasm ecosystem has historically lacked any such standard, with a few known attempts in the past that never received traction. Given Sei is EVM compatible and the ecosystem's momentum, we believe Sei will be the first Cosmwasm chain with a well-adopted CW1155 standard.

Testing performed to validate your change

  • Added Solidity unit tests for the ERC1155 pointer contract. This tests for pointer contract code logic. Also tested for gas efficiency for batch calls/sends. (/contracts/test/CW1155ERC1155PointerTest.t.sol)
  • Added integration test for an ERC1155 pointer pointing to a CW1155 contract. This tests out both queries and executions. (/contracts/test/ERC1155toCW1155PointerTest.js)
  • Added integration test for a CW1155 pointer pointing to an ERC1155 contract . This tests out both queries and executions. (/contracts/test/CW1155toERC1155PointerTest.js)
  • Added to test case to verify that PointerView precompile correctly returns the set ERC1155 pointer (/precompiles/pointerview/pointerview_test.go)
  • Added a test case for every ERC1155-related query bindings (/x/evm/client/wasm/query_test.go)
  • Added new integration test cases for validating ERC/CW2981 behavior on ERC/CW1155 pointers (/x/evm/integration_test.go)
  • Added tests to validate that GRPC queries can return pointer contract address for both ERC1155 and CW1155 pointers (/x/evm/keeper/grpc_query_test.go)
  • Added tests to verify that CW1155 pointer contracts can be registered, and cannot be re-registered if already exists (/x/evm/keeper/msg_server_test.go)
  • Added test cases to verify no unexpected behavior when registering ERC/CW1155 pointers (/x/evm/keeper/pointer_test.go)
  • Manually tested out changes to the CLI, such as seid q evm erc1155-payload, seid tx evm register-cw-pointer, seid tx evm register-evm-pointer

dvli2007 avatar Jul 04 '24 03:07 dvli2007