jamesbachini / DEX-Arbitrage

Example arbitrage trading bot
GNU General Public License v3.0
615 stars 350 forks source link

TRANSFER_FROM_FAILED #8

Closed nautonk closed 2 years ago

nautonk commented 2 years ago

Hi James,

I am trying to implement your code in my application. So far so good except when executing dualDexTrade there is an error : TRANSFER_FROM_FAILED The following is an example transaction { reason: 'transaction failed', code: 'CALL_EXCEPTION', transactionHash: '0xd37bc026ee379f28cb427a7ea60e51cxxx', transaction: { hash: '0xd37bc026ee379f28cb427a7ea60e51c6c25e50a8bxxx', type: 0, accessList: null, blockHash: null, blockNumber: null, transactionIndex: null, confirmations: 0, from: '0x95d7EeB05Dae75fE2C36Dd39eexxx', gasPrice: BigNumber { value: "15000000000" }, gasLimit: BigNumber { value: "1912876" }, to: '0x502fD79C50c8c156D3206eD4xxx', value: BigNumber { value: "0" }, nonce: 25, data: '0x1aa513180000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d000000000000000000000000c778417e063141139fce010982780140aa0cd5ab000000000000000000000000ddea378a6ddc8afec82c36e9b0078826bf9e68b600000000000000000000000000000000000000000000000014d1120d7b160000', r: '0x73586aead779b1470e64ee253b65cfb69216194c68c8999b7211ea0a596665b1', s: '0x755535229aabcfa130b6eabd761a856920cedea092bf5044729ba1677571e504', v: 43, creates: null, chainId: 4, wait: [Function (anonymous)] }, receipt: { to: '0x502fD79C50c8c156D3206eD488xxx', from: '0x95d7EeB05Dae75fE2C36Dxxx', contractAddress: null, transactionIndex: 3, gasUsed: BigNumber { value: "79154" }, logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', blockHash: '0x8b4ad68f6239ab825a04f09de8bc84a0c8440f350xxx', transactionHash: '0xd37bc026ee379f28cb427a7ea60e51c6c25e50axxx', logs: [], blockNumber: 10500723, confirmations: 1, cumulativeGasUsed: BigNumber { value: "2292105" }, effectiveGasPrice: BigNumber { value: "15000000000" }, status: 0, type: 0, byzantium: true } }

Thank you very much in advance for this very useful code.

nautonk commented 2 years ago

Problem solved, i need to fund the contract first. Thank you so much James.