smartcontractkit / ccip-starter-kit-foundry

This project demonstrates a couple of basic Chainlink CCIP use cases
MIT License
73 stars 53 forks source link

Non-descript error when running Example 1 #6

Open michaelkaplan13 opened 1 year ago

michaelkaplan13 commented 1 year ago

I was attempting to go through the workflow for example, documented here.

I have a wallet (0xF759607ffee4B5482492927E51D3b7820DE4189d) that has native token balances on both Fuji and Sepolia, and also has LINK on each of those chains, and set the proper variables in the .env file.

When I run the script however, I get this error:

$ forge script ./script/Example01.s.sol -vvv --broadcast --rpc-url avalancheFuji --sig "run(uint8,uint8,address,address,uint256,uint8)" -- 2 0 0xF759607ffee4B5482492927E51D3b7820DE4189d 0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846 100 0
[⠢] Compiling...
No files changed, compilation skipped
Traces:
  [814329] → new CCIPTokenTransfer@0x5b73C5498c1E3b4dbA84de0F1833c4a029d90519
    └─ ← 3282 bytes of code

  [172975] CCIPTokenTransfer::run(2, 0, 0xF759607ffee4B5482492927E51D3b7820DE4189d, 0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846, 100, 0) 
    ├─ [0] VM::envUint(PRIVATE_KEY) [staticcall]
    │   └─ ← <env var value>
    ├─ [0] VM::startBroadcast(<pk>) 
    │   └─ ← ()
    ├─ [24716] 0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846::approve(0x554472a2720E5E7D5D3C817529aBA05EEd5F82D8, 100) 
    │   ├─ emit Approval(param0: 0xF759607ffee4B5482492927E51D3b7820DE4189d, param1: 0x554472a2720E5E7D5D3C817529aBA05EEd5F82D8, param2: 100)
    │   └─ ← 0x0000000000000000000000000000000000000000000000000000000000000001
    ├─ [35014] 0x554472a2720E5E7D5D3C817529aBA05EEd5F82D8::getFee(16015286601757825753 [1.601e19], (0x000000000000000000000000f759607ffee4b5482492927e51d3b7820de4189d, 0x, [(0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846, 100)], 0x0000000000000000000000000000000000000000, 0x97a657c900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)) [staticcall]
    │   ├─ [23788] 0xA799c1855875e79b2e1752412058B485ee51AEc4::getFee((0x000000000000000000000000f759607ffee4b5482492927e51d3b7820de4189d, 0x, [(0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846, 100)], 0xd00ae08403B9bbb9124bB305C09058E32C39A48c, 0x97a657c900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)) [staticcall]
    │   │   ├─ [5540] 0xE42Ecce39ce5Bd2bbf2443660Ba6979EeafD48dF::getTokenAndGasPrices(0xd00ae08403B9bbb9124bB305C09058E32C39A48c, 16015286601757825753 [1.601e19]) [staticcall]
    │   │   │   └─ ← 0x000000000000000000000000000000000000000000000000d02ab486cedc00000000000000000000000000000000000000000000000000000000038849975ca0
    │   │   ├─ [2938] 0xE42Ecce39ce5Bd2bbf2443660Ba6979EeafD48dF::getValidatedTokenPrice(0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846) [staticcall]
    │   │   │   └─ ← 0x0000000000000000000000000000000000000000000000005a34a38fc00a0000
    │   │   └─ ← 0x00000000000000000000000000000000000000000000000002a53b813c3461ff
    │   └─ ← 0x00000000000000000000000000000000000000000000000002a53b813c3461ff
    ├─ [56254] 0x554472a2720E5E7D5D3C817529aBA05EEd5F82D8::ccipSend{value: 190623985479999999}(16015286601757825753 [1.601e19], (0x000000000000000000000000f759607ffee4b5482492927e51d3b7820de4189d, 0x, [(0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846, 100)], 0x0000000000000000000000000000000000000000, 0x97a657c900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)) 
    │   ├─ [7456] 0xAc8CFc3762a979628334a0E4C1026244498E821b::isCursed() [staticcall]
    │   │   ├─ [2394] 0x0ea0D7B2b78DD3A926fC76d6875a287F0AEB158F::isCursed() 
    │   │   │   └─ ← 0x0000000000000000000000000000000000000000000000000000000000000000
    │   │   └─ ← 0x0000000000000000000000000000000000000000000000000000000000000000
    │   ├─ [9288] 0xA799c1855875e79b2e1752412058B485ee51AEc4::getFee((0x000000000000000000000000f759607ffee4b5482492927e51d3b7820de4189d, 0x, [(0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846, 100)], 0xd00ae08403B9bbb9124bB305C09058E32C39A48c, 0x97a657c900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)) [staticcall]
    │   │   ├─ [1540] 0xE42Ecce39ce5Bd2bbf2443660Ba6979EeafD48dF::getTokenAndGasPrices(0xd00ae08403B9bbb9124bB305C09058E32C39A48c, 16015286601757825753 [1.601e19]) [staticcall]
    │   │   │   └─ ← 0x000000000000000000000000000000000000000000000000d02ab486cedc00000000000000000000000000000000000000000000000000000000038849975ca0
    │   │   ├─ [938] 0xE42Ecce39ce5Bd2bbf2443660Ba6979EeafD48dF::getValidatedTokenPrice(0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846) [staticcall]
    │   │   │   └─ ← 0x0000000000000000000000000000000000000000000000005a34a38fc00a0000
    │   │   └─ ← 0x00000000000000000000000000000000000000000000000002a53b813c3461ff
    │   ├─ [23878] 0xd00ae08403B9bbb9124bB305C09058E32C39A48c::deposit{value: 190623985479999999}() 
    │   │   ├─ emit Deposit(param0: 0x554472a2720E5E7D5D3C817529aBA05EEd5F82D8, param1: 190623985479999999 [1.906e17])
    │   │   └─ ← ()
    │   ├─ [6413] 0xd00ae08403B9bbb9124bB305C09058E32C39A48c::transfer(0xA799c1855875e79b2e1752412058B485ee51AEc4, 190623985479999999 [1.906e17]) 
    │   │   ├─ emit Transfer(param0: 0x554472a2720E5E7D5D3C817529aBA05EEd5F82D8, param1: 0xA799c1855875e79b2e1752412058B485ee51AEc4, param2: 190623985479999999 [1.906e17])
    │   │   └─ ← 0x0000000000000000000000000000000000000000000000000000000000000001
    │   ├─ [2829] 0xA799c1855875e79b2e1752412058B485ee51AEc4::getPoolBySourceToken(0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846) [staticcall]
    │   │   └─ ← "Custom Error bf16aab6:(0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846)"
    │   └─ ← "Custom Error bf16aab6:(0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846)"
    └─ ← "Custom Error bf16aab6:(0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846)"

Error: 
Custom Error bf16aab6:(0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846)

The error is coming from the getPoolBySourceToken call to this contract. Looks like it could be an "Unsupport Token" error, but I checked that 0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846 is the correct LINK token address for Fuji.

Any idea why I'm hitting this error?

michaelkaplan13 commented 1 year ago

FWIW, I also get the same error when going through example 2 on the second step to send tokens to the BasicMessageReceiver instance that was deployed on the destination chain.

andrevmatos commented 1 year ago

OK, we may need to update the docs on this one. To mimic the current mainnet setup, LINK is supported as FeeTokenOnly, i.e. it isn't available for bridging, and that's why it's failing. You can test with the CCIP-BnM (burn & mint) token (0xD21341536c5cF5EB1bcb58f6723cE26e8D8E90e4 on Avax Fuji), which has public drip mint function and should be available for testing and bridging.

michaelkaplan13 commented 1 year ago

@andrevmatos, thanks. I was able to run the example successfully using the CCIP-BnM token now.