Open
Description
When testing with Anvil, Enzo and Velvet trades and deposits fail more often than succeed.
We suspect this is a timing issue with Enzo.
Steps to repeat:
git clone --recursive [email protected]:tradingstrategy-ai/web3-ethereum-defi.git
cd web3-ethereum-defi
poetry shell
poetry install --all-extras
poetry activate
export JSON_RPC_BASE=...
Repeat until a failure (usually takes 1-3 attempts):
pytest -x -k test_velvet_api
You will see the error:
E eth_defi.trace.TransactionAssertionError: Revert reason: execution reverted: revert: TransferHelper::transferFrom: transferFrom failed
E Solidity stack trace:
E CALL: [reverted] 0xe4e23120a38c4348D7e22Ab23976Fa0c4Bf6e2ED.0x9136d415(<unknown>) [29874 gas]
E └── CALL: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913.transferFrom(sender=0x7612a94aaff7a552c373e3124654c1539a4486a8, recipient=0x6e3e0fe13dae2c42cca7ae2e849b0976e2e63e05, amount=5000000) [18763 gas]
E └── DELEGATECALL: 0x2Ce6311ddAE708829bc0784C967b7d77D19FD779.0x23b872dd(<unknown>) [11573 gas]
E Transaction details:
- When doing deposit on Velvet website, the approve() target is the deposit manager contract.
Here is an example approve() for USDC made from Velvet website:
https://basescan.org/tx/0x8f19a53b5484bc97e2aaa76a389a9a1b748ee77008d14d5e99478ed2d1c3fe09
You can see the target address 0xe4e23120a38c4348d7e22ab23976fa0c4bf6e2ed
- However sometimes when trying to deposit this transaction created with /portfolio/deposit, DepositManager contract thinks the approve() target should be rebalancer contract.
The test output above is an example failed simulated transaction where it tries to do USDC.transferFrom() call to rebalancer address (0x6e3e0fe13dae2c42cca7ae2e849b0976e2e63e05
) instead of deposit manager on Base (0xe4e23120a38c4348D7e22Ab23976Fa0c4Bf6e2ED
).
No idea what could be causing this.
Metadata
Metadata
Assignees
Labels
No labels