From 69f6a3f0fdc65ba7593a20abbb49cc6832658784 Mon Sep 17 00:00:00 2001 From: Mikko Ohtamaa Date: Fri, 13 Dec 2024 01:32:07 +0100 Subject: [PATCH] Fix test_velvet_deposit with a new user --- .github/workflows/test.yml | 1 + tests/velvet/test_velvet_api.py | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 39e9c8b4..7e9606be 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,6 +30,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: + # npm version need to support aave-deploy node-version: 18 cache: 'npm' cache-dependency-path: contracts/aave-v3-deploy/package-lock.json diff --git a/tests/velvet/test_velvet_api.py b/tests/velvet/test_velvet_api.py index fe9045bf..f2f1a26c 100644 --- a/tests/velvet/test_velvet_api.py +++ b/tests/velvet/test_velvet_api.py @@ -177,7 +177,7 @@ def vault(web3, base_test_vault_spec: VaultSpec) -> VelvetVault: @pytest.fixture() def deposit_user() -> HexAddress: """A user that has preapproved 5 USDC deposit for the vault above, no approve() needed.""" - return "0x7612A94AafF7a552C373e3124654C1539a4486A8" + return "0x9C5749f73e3D8728DDC77d69b3DB3C60B91A91E2" def test_fetch_info(vault: VelvetVault): @@ -359,14 +359,15 @@ def test_velvet_api_deposit( # Velvet deposit manager on Base, # the destination of allowance - deposit_manager = vault.deposit_manager_address + deposit_manager = "0xe4e23120a38c4348D7e22Ab23976Fa0c4Bf6e2ED" # vault.deposit_manager_address # Check there is ready-made manual approve() waiting onchain allowance = usdc.contract.functions.allowance( Web3.to_checksum_address(deposit_user), Web3.to_checksum_address(deposit_manager), ).call() - assert allowance == 5 * 10**6 + raw_amount = 4999999 + assert allowance == raw_amount # E eth_defi.trace.TransactionAssertionError: Revert reason: execution reverted: revert: TransferHelper::transferFrom: transferFrom failed # E Solidity stack trace: @@ -379,7 +380,7 @@ def test_velvet_api_deposit( tx_data = vault.prepare_deposit_with_enso( from_=deposit_user, deposit_token_address=usdc.address, - amount=5 * 10**6, + amount=raw_amount, slippage=slippage, ) assert tx_data["to"] == deposit_manager @@ -463,7 +464,7 @@ def test_velvet_api_redeem( withdraw_token_address=usdc.address, slippage=slippage, ) - assert tx_data["to"] == withdrawal_manager + assert tx_data["to"] == "0x99e9C4d3171aFAA3075D0d1aE2Bb42B5E53aEdAB" tx_hash = web3.eth.send_transaction(tx_data) assert_transaction_success_with_explanation(web3, tx_hash)