0

I'm trying to supply assets to the compound protocol using this guide: Supplying Assets to the Compound Protocol.

  1. I created account at https://infura.io/ and got my ProjectID.
  2. I cloned https://github.com/compound-developers/compound-supply-examples
  3. Then i ran blockchain with this command with my infura ProjectID:
ganache-cli \
-f https://mainnet.infura.io/v3/<YOUR INFURA API KEY HERE> \
-m "clutch captain shoe salt awake harvest setup primary inmate ugly among become" \
-i 1 \
-u 0x9759A6Ac90977b93B58547b4A71c78317f391A28
  1. After that, i ran node web3-js-examples/supply-eth-via-web3.js with generated privateKey for address on previous step supply-eth-via-web3.js.

And i got an error:

My wallet's ETH balance: 100
Supplying ETH to the Compound Protocol...
cETH "Mint" operation successful.
Error: Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, o
r querying a node which is not fully synced.
    at ABICoder.decodeParameters (C:\Users\adel1\PhpstormProjects\compound-supply-examples\node_modules\web3-eth-abi\lib\index.js:288:15)
    at Contract._decodeMethodReturn (C:\Users\adel1\PhpstormProjects\compound-supply-examples\node_modules\web3-eth-contract\lib\index.js:470:22)
    at Method.outputFormatter (C:\Users\adel1\PhpstormProjects\compound-supply-examples\node_modules\web3-eth-contract\lib\index.js:760:42)
    at Method.formatOutput (C:\Users\adel1\PhpstormProjects\compound-supply-examples\node_modules\web3-core-method\lib\index.js:147:54)
    at sendTxCallback (C:\Users\adel1\PhpstormProjects\compound-supply-examples\node_modules\web3-core-method\lib\index.js:523:33)
    at C:\Users\adel1\PhpstormProjects\compound-supply-examples\node_modules\web3-core-requestmanager\lib\index.js:293:9
    at XMLHttpRequest.request.onreadystatechange (C:\Users\adel1\PhpstormProjects\compound-supply-examples\node_modules\web3-providers-http\lib\index.js:98:13)
    at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\adel1\PhpstormProjects\compound-supply-examples\node_modules\xhr2-cookies\dist\xml-http-request-event-target.js:34:22)
    at XMLHttpRequest._setReadyState (C:\Users\adel1\PhpstormProjects\compound-supply-examples\node_modules\xhr2-cookies\dist\xml-http-request.js:208:14)
    at XMLHttpRequest._onHttpResponseEnd (C:\Users\adel1\PhpstormProjects\compound-supply-examples\node_modules\xhr2-cookies\dist\xml-http-request.js:318:14)
    at IncomingMessage.<anonymous> (C:\Users\adel1\PhpstormProjects\compound-supply-examples\node_modules\xhr2-cookies\dist\xml-http-request.js:289:61)
    at IncomingMessage.emit (events.js:327:22)
    at endReadableNT (_stream_readable.js:1327:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)

Seems to be the method cEthContract.methods.mint().send() executing correctly and balance of ETH wallet is changing. But after that all other methods returning same error (see above).

After running the script node web3-js-examples/supply-eth-via-web3.js, I see this in the console:

eth_getBalance
eth_chainId
eth_getTransactionCount
eth_sendRawTransaction

  Transaction: 0xb88879e6aff2b0431d21f12a53c4bd2d2ffc09b7cf8df2a7fb6d74ca29231d5c
  Gas usage: 21064
  Block Number: 1
  Block Time: Thu May 27 2021 10:31:22 GMT+0700 (GMT+07:00)

eth_getTransactionReceipt
eth_call

P.S.: And one more thing - i don't see any request in my infura project dashboard requests after i ran a script.

0

Sorry, everything is all right, this command in windows cmd executed without 'after \' parts:

ganache-cli \
-f https://mainnet.infura.io/v3/<YOUR INFURA API KEY HERE> \
-m "clutch captain shoe salt awake harvest setup primary inmate ugly among become" \
-i 1 \
-u 0x9759A6Ac90977b93B58547b4A71c78317f391A28

So i didn't get fork mainnet.infura.io. After launching ganache you must see in console information about successful Forked Chain:

Forked Chain
==================
Location:       https://mainnet.infura.io/v3/<>
Block:          12514639
Network ID:     1
Time:           Thu May 27 2021 12:47:03 GMT+0700 (GMT+07:00)
Max Cache Size: 1073741824 bytes

Also, this video explains how to work with smart contracts with ganache-cli and infura.io service

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.