diff --git a/examples/hello/package.json b/examples/hello/package.json index bff6cc00..d9606986 100644 --- a/examples/hello/package.json +++ b/examples/hello/package.json @@ -28,7 +28,7 @@ "@types/node": ">=12.0.0", "@typescript-eslint/eslint-plugin": "^5.59.9", "@typescript-eslint/parser": "^5.59.9", - "@zetachain/localnet": "4.0.0-rc5", + "@zetachain/localnet": "4.0.0-rc6", "@zetachain/toolkit": "13.0.0-rc7", "axios": "^1.3.6", "chai": "^4.2.0", diff --git a/examples/hello/yarn.lock b/examples/hello/yarn.lock index 1bccc7cd..65dd7967 100644 --- a/examples/hello/yarn.lock +++ b/examples/hello/yarn.lock @@ -2743,10 +2743,10 @@ typescript "5.5.4" zod "3.22.4" -"@zetachain/localnet@4.0.0-rc5": - version "4.0.0-rc5" - resolved "https://registry.yarnpkg.com/@zetachain/localnet/-/localnet-4.0.0-rc5.tgz#dcb06202250956aba31e979709018b53071e1844" - integrity sha512-zr2rM/9DPtBlvjZVvhuBYbVgYIy81E5Woc09KqYY1DfvdfYzJmtOR1IJULyVBNTArl125ibwl22AxOnKv5ri2g== +"@zetachain/localnet@4.0.0-rc6": + version "4.0.0-rc6" + resolved "https://registry.yarnpkg.com/@zetachain/localnet/-/localnet-4.0.0-rc6.tgz#9b36f5ab0e8fac766d63cfca4b1cab6a263bdd5d" + integrity sha512-DGKspMAJZLUrgNirc3NzFYg9jRfaOyuF5ePj85D93qAA//f8lOsXpmh/6Bvq/MrEscCLpVavgVP7+ePy4KJ2Fw== dependencies: "@inquirer/prompts" "^5.5.0" "@uniswap/v2-core" "^1.0.1" diff --git a/examples/nft/contracts/Universal.sol b/examples/nft/contracts/Universal.sol index f323f5f4..15793305 100644 --- a/examples/nft/contracts/Universal.sol +++ b/examples/nft/contracts/Universal.sol @@ -34,7 +34,7 @@ contract Universal is error InvalidAddress(); error InvalidGasLimit(); - mapping(address => bytes) public counterparty; + mapping(address => address) public counterparty; modifier onlyGateway() { if (msg.sender != address(gateway)) revert Unauthorized(); @@ -57,7 +57,7 @@ contract Universal is function setCounterparty( address zrc20, - bytes memory contractAddress + address contractAddress ) external onlyOwner { counterparty[zrc20] = contractAddress; emit CounterpartySet(zrc20, contractAddress); @@ -92,7 +92,7 @@ contract Universal is ); gateway.call( - counterparty[destination], + abi.encodePacked(counterparty[destination]), destination, message, callOptions, @@ -115,14 +115,16 @@ contract Universal is _setTokenURI(tokenId, uri); } + event Foo(address); + function onCall( MessageContext calldata context, address zrc20, uint256 amount, bytes calldata message ) external override onlyGateway { - if (keccak256(context.origin) != keccak256(counterparty[zrc20])) - revert("Unauthorized"); + emit Foo(context.sender); + if (context.sender != counterparty[zrc20]) revert("Unauthorized"); ( uint256 tokenId, @@ -150,7 +152,7 @@ contract Universal is IZRC20(destination).approve(address(gateway), gasFee); gateway.call( - counterparty[destination], + abi.encodePacked(counterparty[destination]), destination, abi.encode(tokenId, sender, uri), CallOptions(gasLimit, false), diff --git a/examples/nft/contracts/shared/Events.sol b/examples/nft/contracts/shared/Events.sol index a0beba21..46039d0f 100644 --- a/examples/nft/contracts/shared/Events.sol +++ b/examples/nft/contracts/shared/Events.sol @@ -20,7 +20,7 @@ contract Events { address indexed sender, string uri ); - event CounterpartySet(address indexed zrc20, bytes indexed contractAddress); + event CounterpartySet(address indexed zrc20, address contractAddress); event TokenTransferToDestination( uint256 indexed tokenId, address indexed sender, diff --git a/examples/nft/package.json b/examples/nft/package.json index c6c26b84..3230694a 100644 --- a/examples/nft/package.json +++ b/examples/nft/package.json @@ -27,7 +27,7 @@ "@types/node": ">=12.0.0", "@typescript-eslint/eslint-plugin": "^5.59.9", "@typescript-eslint/parser": "^5.59.9", - "@zetachain/localnet": "4.0.0-rc4", + "@zetachain/localnet": "4.0.0-rc6", "@zetachain/toolkit": "13.0.0-rc7", "axios": "^1.3.6", "chai": "^4.2.0", diff --git a/examples/nft/yarn.lock b/examples/nft/yarn.lock index 65591b29..65dd7967 100644 --- a/examples/nft/yarn.lock +++ b/examples/nft/yarn.lock @@ -2743,10 +2743,10 @@ typescript "5.5.4" zod "3.22.4" -"@zetachain/localnet@4.0.0-rc4": - version "4.0.0-rc4" - resolved "https://registry.yarnpkg.com/@zetachain/localnet/-/localnet-4.0.0-rc4.tgz#916c58f83dd4901691fbc1216aec2ee88e7f531e" - integrity sha512-yNlA6qaQZiuHXRx4pgNLLHlJ+2ENet9WTIWxoslnLzzDljWwYTJHkErlTQcWa5oL9jjyn2/hQB/laoqXzlX1gQ== +"@zetachain/localnet@4.0.0-rc6": + version "4.0.0-rc6" + resolved "https://registry.yarnpkg.com/@zetachain/localnet/-/localnet-4.0.0-rc6.tgz#9b36f5ab0e8fac766d63cfca4b1cab6a263bdd5d" + integrity sha512-DGKspMAJZLUrgNirc3NzFYg9jRfaOyuF5ePj85D93qAA//f8lOsXpmh/6Bvq/MrEscCLpVavgVP7+ePy4KJ2Fw== dependencies: "@inquirer/prompts" "^5.5.0" "@uniswap/v2-core" "^1.0.1" diff --git a/examples/swap/package.json b/examples/swap/package.json index 919144e7..d7477480 100644 --- a/examples/swap/package.json +++ b/examples/swap/package.json @@ -29,7 +29,7 @@ "@types/node": ">=12.0.0", "@typescript-eslint/eslint-plugin": "^5.59.9", "@typescript-eslint/parser": "^5.59.9", - "@zetachain/localnet": "4.0.0-rc5", + "@zetachain/localnet": "4.0.0-rc6", "axios": "^1.3.6", "chai": "^4.2.0", "dotenv": "^16.0.3", diff --git a/examples/swap/yarn.lock b/examples/swap/yarn.lock index 62a01ac6..11c6d40a 100644 --- a/examples/swap/yarn.lock +++ b/examples/swap/yarn.lock @@ -2481,10 +2481,10 @@ typescript "5.5.4" zod "3.22.4" -"@zetachain/localnet@4.0.0-rc5": - version "4.0.0-rc5" - resolved "https://registry.yarnpkg.com/@zetachain/localnet/-/localnet-4.0.0-rc5.tgz#dcb06202250956aba31e979709018b53071e1844" - integrity sha512-zr2rM/9DPtBlvjZVvhuBYbVgYIy81E5Woc09KqYY1DfvdfYzJmtOR1IJULyVBNTArl125ibwl22AxOnKv5ri2g== +"@zetachain/localnet@4.0.0-rc6": + version "4.0.0-rc6" + resolved "https://registry.yarnpkg.com/@zetachain/localnet/-/localnet-4.0.0-rc6.tgz#9b36f5ab0e8fac766d63cfca4b1cab6a263bdd5d" + integrity sha512-DGKspMAJZLUrgNirc3NzFYg9jRfaOyuF5ePj85D93qAA//f8lOsXpmh/6Bvq/MrEscCLpVavgVP7+ePy4KJ2Fw== dependencies: "@inquirer/prompts" "^5.5.0" "@uniswap/v2-core" "^1.0.1"