Skip to content

Commit

Permalink
Fix test_velvet_deposit with a new user
Browse files Browse the repository at this point in the history
  • Loading branch information
miohtama committed Dec 13, 2024
1 parent 11532ad commit 69f6a3f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions tests/velvet/test_velvet_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 69f6a3f

Please sign in to comment.