Concerning a tutorial video that I came across around adding/removing liquidity into Uniswap https://www.youtube.com/watch?v=816kTTNzcHs, I have the following the issue.
When I attempt to run test-uniswap-liquidity.js under truffle environment, it keeps failing on this line of code:
await tokenA.transfer(CALLER, TOKEN_A_AMOUNT, { from: TOKEN_A_WHALE });
_truffle(mainnet_fork)> truffle test test/test-uniswap-liquidity.js --network mainnet_fork
Using network 'mainnet_fork'.
Compiling your contracts...
Compiling https://github.com/OpenZeppelin\contracts\token\ERC20\IERC20.sol
Compiling https://github.com/OpenZeppelin\contracts\utils\math\SafeMath.sol
Compiling .\contracts\Flashloan-arbitrage.sol
Compiling .\contracts\Migrations.sol
Compiling .\contracts\TestUniswapLiquidity.sol
Compiling .\contracts\UniswapV2Library.sol
Compiling .\contracts\interfaces\IERC20.sol
Compiling .\contracts\interfaces\IUniswapV2Callee.sol
Compiling .\contracts\interfaces\IUniswapV2Factory.sol
Compiling .\contracts\interfaces\IUniswapV2Pair.sol
Compiling .\contracts\interfaces\IUniswapV2Router01.sol
Compiling .\contracts\interfaces\IUniswapV2Router02.sol
Compiling .\contracts\interfaces\Uniswap.sol
Artifacts written to C:\Users\SAMUEL~1.SAD\AppData\Local\Temp\test--17744-7ubcxUBqpENh
Compiled successfully using:
solc: 0.8.16+commit.07a7930e.Emscripten.clang
step1...
step2...
step4...TOKEN_A_AMOUNT = BN {
negative: 0,
words: [ 779264, 149, <1 empty item> ],
length: 2,
red: null
}
step4...TOKEN_B_AMOUNT = BN {
negative: 0,
words: [ 779264, 149, <1 empty item> ],
length: 2,
red: null
}
Contract: TestUniswapLiquidity
CALLER... 0x031213df405840b7BCdEb5A7A9126BbD77A6aed3
step6...contract: 0xa0A14ceC4C0cFa67a3d5f39A4704465fC2e446B1
step7 - sent Ether...
step8a - CALLER: 0x031213df405840b7BCdEb5A7A9126BbD77A6aed3
step8b - TOKEN_A_AMOUNT (parsed): 10000000000
step8c - TOKEN_B_AMOUNT (parsed): 10000000000
calling again CALLER... 0x031213df405840b7BCdEb5A7A9126BbD77A6aed3
TOKEN_A_WHALE: 0xee2826453A4Fd5AfeB7ceffeEF3fFA2320081268
- "before each" hook for "add liquidity and remove liquidity"
0 passing (2s)
1 failing
Contract: TestUniswapLiquidity
"before each" hook for "add liquidity and remove liquidity":
Error: Returned error: sender account not recognized -- Reason given: Custom error (could not decode).
at Context. (test\test-uniswap-liquidity.js:48:18)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
truffle(mainnet_fork)> truffle --version
Truffle v5.5.28 (core: 5.5.28)
Ganache v7.4.0
Solidity - 0.8.16 (solc-js)
Node v16.17.0
Web3.js v1.7.4_
I would greatly appreciate any insights as to how I could resolve this problem which has been going on for several days now.
One other thing, the liquidity concept is only applicable for non-flash swap contracts/transactions, is that correct?
Reason being, I attempted to run a flash swap loan arbitrage app in truffle that I´ve developed but keeps giving me with the Insufficient liquidity error message which was the original reason why I came across your video.
Thanks once again for your help.
BR,
Samuel