zeta-chain/example-contracts

Swap contract

Closed this issue · 2 comments

We’ve recently updated the swap contract, and I’m now testing all the combinations of swaps I can and the behavior I’m observing is odd.
There is at least one example of each type of swap that’s working fine:

  • native -> native
  • ERC-20 -> native
  • native -> ERC-20
  • ERC-20 -> ERC-20

So it can’t be that the contract is wrong (it works). But a bunch are not registering. I’m guessing it could be imbalanced pools or maybe the recent Mumbai outbound issue, but still.

Goerli ETH -> BSC BNB

Success.

npx hardhat interact --contract 0xdee0d592C430DA1cC7f7E8A715a04d79fA1DEf37 --amount 0.05 --target-token 0xd97B1de3619ed2c6BEb3860147E30cA8A7dC9891 --network goerli_testnet --recipient 0x2cD3D070aE1BD365909dD859d29F387AA96911e1

✓ 0xf0e122012889867cff58517a57398db7d5e7fcf9f291d419805f01edc63090da: 5 → 7001: OutboundMined (Remote omnichain contract call completed)
⠸ 0x30207b7e22330f9d6073640e65d5611e100ade3678acfaa484763e51b0472355: 7001 → 97: PendingOutbound 

Goerli ETH -> BTC

No outbound.

npx hardhat interact --contract 0xdee0d592C430DA1cC7f7E8A715a04d79fA1DEf37 --amount 0.01 --target-token 0x65a45c57636f9BcCeD4fe193A602008578BcA90b --network goerli_testnet --recipient 0x2cD3D070aE1BD365909dD859d29F387AA96911e1

✓ 0xf853fcd0f27186657d2b865115719a7324f48178d5a30d6f674fe204cae07155: 5 → 7001: OutboundMined (Remote omnichain contract call completed)

Goerli ETH -> Mumbai MATIC

Success.

npx hardhat interact --contract 0xdee0d592C430DA1cC7f7E8A715a04d79fA1DEf37 --amount 0.01 --target-token 0x48f80608B672DC30DC7e3dbBd0343c5F02C738Eb --network goerli_testnet --recipient 0x2cD3D070aE1BD365909dD859d29F387AA96911e1

✓ 0xeb0c5c8aafb350c4fead603208386908fd5438068d4a41926cc49ff9853adbdc: 5 → 7001: OutboundMined (Remote omnichain contract call completed)
⠇ 0x30323daf3fac9c70f64fe2db3a2d49c36a743daa29ae2ea6531677f4d4a250cf: 7001 → 80001 (285 in queue): PendingOutbound 

Goerli ETH -> Mumbai USDC

Success.

npx hardhat interact --contract 0xdee0d592C430DA1cC7f7E8A715a04d79fA1DEf37 --amount 0.01 --target-token 0x91d4F0D54090Df2D81e834c3c8CE71C6c865e79F --network goerli_testnet --recipient 0x2cD3D070aE1BD365909dD859d29F387AA96911e1

✓ 0xb9bc778d49af659338db6aa74d844381df1c62f0e3e7895812dde97b31e14c81: 5 → 7001: OutboundMined (Remote omnichain contract call completed)
⠇ 0x28fd96923aa519a027d639e4045ffdb248f9525002d4c10f694ac175a55f072d: 7001 → 80001 (286 in queue): PendingOutbound 

Goerli USDC -> Mumbai MATIC

Success.

npx hardhat interact --contract 0xdee0d592C430DA1cC7f7E8A715a04d79fA1DEf37 --amount 10 --token 0x07865c6e87b9f70255377e024ace6630c1eaa37f --target-token 0x48f80608B672DC30DC7e3dbBd0343c5F02C738Eb --network goerli_testnet --recipient 0x2cD3D070aE1BD365909dD859d29F387AA96911e1

npx hardhat cctx 0x1056d969473831c916e2b5355e3a845acab3c1210a579a11103cd76c184ede1f

✓ 0x9640e0060bbe6df9364791dd7ffd78e58ae7b8cc4060d965eca0efb3b28165db: 5 → 7001: OutboundMined (Remote omnichain contract call
 completed)
⠙ 0x7d29083bbb13f8562eee887cc87b5ee51d4c59771fbb86ee2ddd899ac03cbb50: 7001 → 80001 (297 in queue): PendingOutbound 

Goerli USDC -> Mumbai USDC

Success.

npx hardhat interact --contract 0xdee0d592C430DA1cC7f7E8A715a04d79fA1DEf37 --amount 10 --token 0x07865c6e87b9f70255377e024ace6630c1eaa37f --target-token 0x91d4F0D54090Df2D81e834c3c8CE71C6c865e79F --network goerli_testnet --recipient 0x2cD3D070aE1BD365909dD859d29F387AA96911e1

npx hardhat cctx 0xb4ae53461ea3ca49738531eb5c8079685237afb1b747ab550471a3c69648e6c4

✓ 0x2023a1ff26e8862ed49e3cac4fb3421db509b9e7e8d17cefad898af667211d53: 5 → 7001: OutboundMined (Remote omnichain contract call completed)
⠴ 0xd3db1554954ec1420c817dcb0dea57677434bded39ba70ee3298e68dcdbe4f5f: 7001 → 80001 (298 in queue): PendingOutbound 

BSC BNB -> BTC

No outbound.

npx hardhat interact --contract 0xdee0d592C430DA1cC7f7E8A715a04d79fA1DEf37 --amount 1 --target-token 0x65a45c57636f9BcCeD4fe193A602008578BcA90b --network bsc_testnet --recipient 0x2cD3D070aE1BD365909dD859d29F387AA96911e1

 npx hardhat cctx 0x8c76e49ec8ce92f9dc2a578b8515126f2f3d1902176a0718c99367ccf8218947

✓ CCTXs on ZetaChain found.

✓ 0xca49cca94931e8a71d2be94a081b19e62096b901d8579f474ba9134bc7b431bf: 97 → 7001: OutboundMined (Remote omnichain contract call completed)

BSC BNB -> Goerli ETH

Success.

npx hardhat interact --contract 0xdee0d592C430DA1cC7f7E8A715a04d79fA1DEf37 --amount 1 --target-token 0x13A0c5930C028511Dc02665E7285134B6d11A5f4 --network bsc_testnet --recipient 0x2cD3D070aE1BD365909dD859d29F387AA96911e1

npx hardhat cctx 0x6b89963520c495b351170287f0778bfda734bee9b6c0844300355f1604971805

✓ 0xc0cc85e6000c14c993f12d17c76aca47fc4cf1598f072f8dcc62ed6f1d19b43f: 97 → 7001: OutboundMined (Remote omnichain contract call completed)
⠦ 0x02f818460a6b234c062b7d2e816ecf9a2aae2e0b4448aef9cc4823931eba2ba0: 7001 → 5 (38 in queue): PendingOutbound 

BSC BNB -> Goerli USDC

Success.

npx hardhat interact --contract 0xdee0d592C430DA1cC7f7E8A715a04d79fA1DEf37 --amount 1 --target-token 0x0cbe0dF132a6c6B4a2974Fa1b7Fb953CF0Cc798a --network bsc_testnet --recipient 0x2cD3D070aE1BD365909dD859d29F387AA96911e1

npx hardhat cctx 0xfe15962c10187aa0129d7a9987118a8a792848faffa10493346aa43eb1d08591

✓ 0xe56467370084936e8017604c66fd6aa4d370a2b0adf10d4ee3e875e0c03c63cd: 97 → 7001: OutboundMined (Remote omnichain contract call completed)
⠙ 0xbd1cc780b2464520112506b91a48aede02772ec9d8657348ebf237b4655b5df9: 7001 → 5 (39 in queue): PendingOutbound 

BSC BNB -> Mumbai MATIC

Success.

npx hardhat interact --contract 0xdee0d592C430DA1cC7f7E8A715a04d79fA1DEf37 --amount 1 --target-token 0x48f80608B672DC30DC7e3dbBd0343c5F02C738Eb --network bsc_testnet --recipient 0x2cD3D070aE1BD365909dD859d29F387AA96911e1

npx hardhat cctx 0x48f6140bb6a509d2b791eacd2ecacf940a4bfa536eb155f68431c03aba8e9c56

✓ 0x1d036cd36d8ad1d9bbb7e3bcff683c3ef230d32d8a5028766004528fa382b57b: 97 → 7001: OutboundMined (Remote omnichain contract call completed)
⠧ 0x6931b07a876f0ee0f17a06f24aee94a240655f7f605a040a06be6bf7885d34b8: 7001 → 80001 (288 in queue): PendingOutbound 

Mumbai MATIC -> BSC BNB

Not registered.

npx hardhat interact --contract 0xdee0d592C430DA1cC7f7E8A715a04d79fA1DEf37 --amount 5 --target-token 0xd97B1de3619ed2c6BEb3860147E30cA8A7dC9891 --network mumbai_testnet --recipient 0x2cD3D070aE1BD365909dD859d29F387AA96911e1

npx hardhat cctx 0x26e76370f6273b5cada451577d8f10dd17e7b746077694cd42c971efc06d9dff

Mumbai MATIC -> Goerli ETH

Not registered.

npx hardhat interact --contract 0xdee0d592C430DA1cC7f7E8A715a04d79fA1DEf37 --amount 5 --target-token 0x13A0c5930C028511Dc02665E7285134B6d11A5f4 --network mumbai_testnet --recipient 0x2cD3D070aE1BD365909dD859d29F387AA96911e1

npx hardhat cctx 0xff7ad46542064b322a3fa76ff47d9e8715ccfaf4af5a662a046eb13455eaa89b

BTC -> Goerli ETH

npx hardhat cctx 4082f853619b522304f0e2f7f8c7bedabc3db3180fc3209bde13bd34b6062f14

I think the "Not registered" cases is when the contract tries to swap enough for gas, but fails, because either not enough input was provided or there is not enough liquidity (like with BTC).

Mumbai seems to be working fine now:

npx hardhat cctx 0x020920d12e21cd0c0dc35a20001b22fd724bdda67312f52bbb4bbcee8c7c5483

✓ CCTXs on ZetaChain found.

✓ 0xf6700a3161c46c6eab2c68e13869c12d6ce8fdc3b11e6d5f58cd9ff9af071b6a: 80001 → 7001: OutboundMined (Remote omnichain contract 
call completed)
⠙ 0x6cbee19fc74a7abb5cd707668247d9952acc41c2a759933f26bbc8f7a2bc5462: 7001 → 5: PendingOutbound