ChainSafe / ChainBridge

🌉 Modular Multi-Directional Blockchain Bridge to interact with Multiple Networks; Ethereum, Ethereum Classic, Substrate, based chains. Stay tuned for ChainBridge Hub!
GNU Lesser General Public License v3.0
475 stars 300 forks source link

When transfering ERC721, execution proposal not working #754

Closed jwchoi3120 closed 2 years ago

jwchoi3120 commented 2 years ago

https://chainbridge.chainsafe.io/live-evm-bridge/

I have successfully transfered ERC20 token by going though the tutorial above. But when I tried transfering ERC721 token, every process succeeds but the final step: execution proposal.

image

image

Also, my relayer shows that it's creating ERC20 proposal.

dragon1

dragon2

This is my chainbridge-vars:

SRC_GATEWAY=https://ropsten.infura.io/v3/my infura project ID DST_GATEWAY=https://rinkeby.infura.io/v3/my infura project ID SRC_ADDR="0xB76539074A024D2862a561Ee6435C572C1b7ACD8" SRC_PK="metamask account 1 private key" DST_ADDR="0x8F3b781AA169B758c99a7A5856f078195d5CA345" DST_PK="metamask account 2 private key" SRC_TOKEN="0x83D8ec7d77cEBDAB6982A002628Ec9ec9720912b" RESOURCE_ID="0x000000000000000000000000000000c76ebe4a02bbc34786d860b366f2a4ce00" SRC_BRIDGE="0x0849C0035D41c2aaD0eA2584e7770F1da9315763" SRC_HANDLER="0xb40a4553FB4d424B91186C345c276Ca9666AeaeE" DST_BRIDGE="0x665691B598883FD3ebC5cED376D7C30A5ebC6258" DST_HANDLER="0x6C3D0673a94cF9cCab795c3328b2f26e88ebB0C0" DST_TOKEN="0x0390b0f4f6c794c3dcA4A9AE6771DD65a87FdFe7"


Extra information

Source chain : Ropsten Destination chain : Rinkeby

I have used infura for source and destination gateway and endpoint.

This document contains all the commands that I have run step by step to tranfer ERC721:

ERC721 transfer commands.txt

Any help will be appreciated! If you have any questions regard to this, please let me know.

P1sar commented 2 years ago

Hey @jwchoi3120! It looks like the recipient address was not set properly. I checked you cmds that were used to process the deposit. Maybe you forget to set the env variable?

jwchoi3120 commented 2 years ago

Hey @jwchoi3120! It looks like the recipient address was not set properly. I checked you cmds that were used to process the deposit. Maybe you forget to set the env variable?

Thanks for replying! I have used chainbridge-vars file and used set command to set the env variable.. Are you talking about DST_ADDR?

edit: I use set -a; source ./chainbridge-vars; set +a command everytime when I fix chainbridge-vars.

P1sar commented 2 years ago

Could you please provide me links to your resent deposits/executions, because I can't find any of them under new addresses

jwchoi3120 commented 2 years ago

Could you please provide me links to your resent deposits/executions, because I can't find any of them under new addresses

I checked it again, and when I check https://ropsten.etherscan.io/address/0x2dfb1d465423fCce95A541cA9Ec4a8d4d0eEeE04 which is SRC_BRIDGE, it says deposit failed. However, when I mint from DST_ADDR, it works.

jwchoi3120 commented 2 years ago

After i talked to @waymobetta , I post this document for him to look at.

githubissue.pdf

Please check!

waymobetta commented 2 years ago

Hi @jwchoi3120 , thanks for collecting more information for us. We'd like to ask that you please post the logs within a comment here so that we don't have to download any files. We can review after this is done, thank you

jwchoi3120 commented 2 years ago

Network : Ropsten(source), Rinkeby(destination) ERC721 token: badNFTs(bNFT)

I created ERC721 token, and I used token ID 4 for this one.

https://ropsten.etherscan.io/token/0x290d583d125ffda4a4159a728bd0bc300bbce883

with my ERC721 token (0x290D583d125fFda4A4159A728bD0bC300bbCE883),

I fix my chainbridge-vars file.

SRC_GATEWAY=https://ropsten.infura.io/v3/eeb5f96800d74c22aa69985a122ec8ba DST_GATEWAY=https://rinkeby.infura.io/v3/eeb5f96800d74c22aa69985a122ec8ba

SRC_ADDR="0xB76539074A024D2862a561Ee6435C572C1b7ACD8" SRC_PK="srcpk" DST_ADDR="0x8F3b781AA169B758c99a7A5856f078195d5CA345" DST_PK="dstpk"

SRC_TOKEN="0x5d2ceA06100EC5e4CF26Af56540D7ed6C28C46D2" RESOURCE_ID="0x000000000000000000000000000000c76ebe4a03c1124716d860b366f2a4de00"

↑ this resource ID, I randomly changed nubmers. If this is not the way I approach, please note!

After, I do:

set -a; source ./chainbridge-vars; set +a

deploy(source chain)

I run:

cb-sol-cli --url $SRC_GATEWAY --privateKey $SRC_PK --gasPrice 10000000000 deploy \ --bridge --erc721Handler \ --relayers $SRC_ADDR \ --relayerThreshold 1\ --chainId 0

I get:


Bridge: 0xdaCE00A2841bA3Ca61057Bd78B9023BF50B42d8c Erc20 Handler: Not Deployed Erc721 Handler: 0x1606C846293ae26554ea1df0a2B3108D4165fF97


After I add these to my chainbridge-vars:

SRC_GATEWAY=https://ropsten.infura.io/v3/eeb5f96800d74c22aa69985a122ec8ba DST_GATEWAY=https://rinkeby.infura.io/v3/eeb5f96800d74c22aa69985a122ec8ba

SRC_ADDR="0xB76539074A024D2862a561Ee6435C572C1b7ACD8" SRC_PK="srcpk" DST_ADDR="0x8F3b781AA169B758c99a7A5856f078195d5CA345" DST_PK="dstpk"

SRC_TOKEN="0x5d2ceA06100EC5e4CF26Af56540D7ed6C28C46D2" RESOURCE_ID="0x000000000000000000000000000000c76ebe4a03c1124716d860b366f2a4de00"

SRC_BRIDGE="0xdaCE00A2841bA3Ca61057Bd78B9023BF50B42d8c" SRC_HANDLER="0x1606C846293ae26554ea1df0a2B3108D4165fF97"

I do:

set -a; source ./chainbridge-vars; set +a

register resource (source chain)

After, I do:

cb-sol-cli --url $SRC_GATEWAY --privateKey $SRC_PK --gasPrice 10000000000 bridge register-resource \ --bridge $SRC_BRIDGE \ --handler $SRC_HANDLER \ --resourceId $RESOURCE_ID \ --targetContract $SRC_TOKEN

Doesn't show anything.

deploy (destination chain)

Then, I do:

cb-sol-cli --url $DST_GATEWAY --privateKey $DST_PK --gasPrice 10000000000 deploy\ --bridge --erc721 --erc721Handler \ --relayers $DST_ADDR \ --relayerThreshold 1 \ --chainId 1

I get:


Bridge: 0x3623c3A8aCfc73939b0ca45A45BD339aEf60c7b2

Erc20 Handler: Not Deployed

Erc721 Handler: 0x08e611b3a06123314c3F5f3A99DFc885646A2F76

Generic Handler: Not Deployed

Erc20: Not Deployed

Erc721: 0xbc206d2dB900d6d22890Eb5f8246d474Dbc1afa7

Centrifuge Asset: Not Deployed

WETC: Not Deployed


Then, I add these to chainbridge-vars:

SRC_GATEWAY=https://ropsten.infura.io/v3/eeb5f96800d74c22aa69985a122ec8ba DST_GATEWAY=https://rinkeby.infura.io/v3/eeb5f96800d74c22aa69985a122ec8ba

SRC_ADDR="0xB76539074A024D2862a561Ee6435C572C1b7ACD8" SRC_PK="srcpk" DST_ADDR="0x8F3b781AA169B758c99a7A5856f078195d5CA345" DST_PK="dstpk"

SRC_TOKEN="0x5d2ceA06100EC5e4CF26Af56540D7ed6C28C46D2" RESOURCE_ID="0x000000000000000000000000000000c76ebe4a03c1124716d860b366f2a4de00"

SRC_BRIDGE="0xdaCE00A2841bA3Ca61057Bd78B9023BF50B42d8c" SRC_HANDLER="0x1606C846293ae26554ea1df0a2B3108D4165fF97"

DST_BRIDGE="0x3623c3A8aCfc73939b0ca45A45BD339aEf60c7b2" DST_HANDLER="0x08e611b3a06123314c3F5f3A99DFc885646A2F76" DST_TOKEN="0xbc206d2dB900d6d22890Eb5f8246d474Dbc1afa7"

after, of course I do:

set -a; source ./chainbridge-vars; set +a

register resource (destination chain)

Then,

cb-sol-cli --url $DST_GATEWAY --privateKey $DST_PK --gasPrice 10000000000 bridge register-resource \ --bridge $DST_BRIDGE \ --handler $DST_HANDLER \ --resourceId $RESOURCE_ID \ --targetContract $DST_TOKEN

Nothing shows up.(Normal)

set burn (destination chain)

After,

cb-sol-cli --url $DST_GATEWAY --privateKey $DST_PK --gasPrice 10000000000 bridge set-burn \ --bridge $DST_BRIDGE \ --handler $DST_HANDLER \ --tokenContract $DST_TOKEN

Nothing shows up.(Normal)

add minter (destination chain)

cb-sol-cli --url $DST_GATEWAY --privateKey $DST_PK --gasPrice 10000000000 erc721 add-minter \ --minter $DST_HANDLER \ --erc721Address $DST_TOKEN

After, I open up another terminal and fix config.json with addresses I got from running those commands above.

{ "chains": [ { "name": "Ropsten", "type": "ethereum", "id": "0", "endpoint": "wss://ropsten.infura.io/ws/v3/eeb5f96800d74c22aa69985a122ec8ba", "from": "0xB76539074A024D2862a561Ee6435C572C1b7ACD8", "opts": { "bridge": "0xdaCE00A2841bA3Ca61057Bd78B9023BF50B42d8c", "erc20Handler": "0x1606C846293ae26554ea1df0a2B3108D4165fF97", "erc721Handler": "0x1606C846293ae26554ea1df0a2B3108D4165fF97", "genericHandler": "0x1606C846293ae26554ea1df0a2B3108D4165fF97", "gasLimit": "1000000", "maxGasPrice": "10000000000" } }, { "name": "Rinkeby", "type": "ethereum", "id": "1", "endpoint": "wss://rinkeby.infura.io/ws/v3/eeb5f96800d74c22aa69985a122ec8ba", "from": "0x8F3b781AA169B758c99a7A5856f078195d5CA345", "opts": { "bridge": "0x3623c3A8aCfc73939b0ca45A45BD339aEf60c7b2", "erc20Handler": "0x08e611b3a06123314c3F5f3A99DFc885646A2F76", "erc721Handler": "0x08e611b3a06123314c3F5f3A99DFc885646A2F76", "genericHandler": "0x08e611b3a06123314c3F5f3A99DFc885646A2F76", "gasLimit": "1000000", "maxGasPrice": "10000000000" } } ] }

After, I run relayer with:

./build/chainbridge --config config.json --verbosity trace --latest

approve (source chain)

Coming back to original terminal, then I type:

cb-sol-cli --url $SRC_GATEWAY --privateKey $SRC_PK --gasPrice 10000000000 erc721 approve \ --id 0x4 \ --erc721Address $SRC_TOKEN \ --recipient $SRC_HANDLER

deposit (source chain)

then,

cb-sol-cli --url $SRC_GATEWAY --privateKey $SRC_PK --gasPrice 10000000000 erc721 deposit \ --id 0x4 \ --dest 1 \ --bridge $SRC_BRIDGE \ --recipient $DST_ADDR \ --resourceId $RESOURCE_ID

If I check DST_BRIDGE in etherscan Rinkeby network,

image

this shows up, and if I check that txn hash,

it shows, image

I tried minting DST Token with:

cb-sol-cli --url $DST_GATEWAY --privateKey $DST_PK --gasPrice 10000000000 erc721 mint --erc721Address $DST_TOKEN \

But if you go to https://rinkeby.etherscan.io/tx/0x8e48b6f1f8438a21e3452cc0bb5e33783d2c9458c0da6823721551ad099a3fd4 and check, input Data looks like this:

image

jwchoi3120 commented 2 years ago

Hi @jwchoi3120 , thanks for collecting more information for us. We'd like to ask that you please post the logs within a comment here so that we don't have to download any files. We can review after this is done, thank you

Comment I posted above is what's in the document. Thanks!