0

I am working on adding liquidity to a curve pool in Foundry in order to test the curve pool oracle in my project, however, I'm getting some difficulty in adding liquidity to a curve pool. I believe the pool is set up correctly and all the prerequisite conditions are met, but in foundry, I kept getting "EvmError: Revert" message. Wondering why this is the case.

   ├─ [104547] 0xedCe214e7a52c77914342B072230ac971149Eb00::add_liquidity([2000000000000000000000000, 2000000000000000000000000], 0) 
    │   ├─ [81494] 0x73Ec37618683C274D0bBf5f5726aA856B2BDAB81::add_liquidity([2000000000000000000000000, 2000000000000000000000000], 0) [delegatecall]
    │   │   ├─ [23005] 0x730D5ab5a375c3a6cDC22A9D3bEc1573FDeA97D6::transferFrom(0x9aF2E2B7e57c1CD7C68C5C3796d8ea67e0018dB7, 0xedCe214e7a52c77914342B072230ac971149Eb00, 2000000000000000000000000) 
    │   │   │   ├─ emit Approval(owner: 0x9aF2E2B7e57c1CD7C68C5C3796d8ea67e0018dB7, spender: 0xedCe214e7a52c77914342B072230ac971149Eb00, value: 0)
    │   │   │   ├─ emit Transfer(from: 0x9aF2E2B7e57c1CD7C68C5C3796d8ea67e0018dB7, to: 0xedCe214e7a52c77914342B072230ac971149Eb00, value: 2000000000000000000000000)
    │   │   │   └─ ← 0x0000000000000000000000000000000000000000000000000000000000000001
    │   │   ├─ [22217] 0xaf88d065e77c8cC2239327C5EDb3A432268e5831::transferFrom(0x9aF2E2B7e57c1CD7C68C5C3796d8ea67e0018dB7, 0xedCe214e7a52c77914342B072230ac971149Eb00, 2000000000000000000000000) 
    │   │   │   ├─ [21678] 0x0f4fb9474303d10905AB86aA8d5A65FE44b6E04A::transferFrom(0x9aF2E2B7e57c1CD7C68C5C3796d8ea67e0018dB7, 0xedCe214e7a52c77914342B072230ac971149Eb00, 2000000000000000000000000) [delegatecall]
    │   │   │   │   ├─ emit Transfer(from: 0x9aF2E2B7e57c1CD7C68C5C3796d8ea67e0018dB7, to: 0xedCe214e7a52c77914342B072230ac971149Eb00, value: 2000000000000000000000000)
    │   │   │   │   └─ ← 0x0000000000000000000000000000000000000000000000000000000000000001
    │   │   │   └─ ← 0x0000000000000000000000000000000000000000000000000000000000000001
    │   │   └─ ← "EvmError: Revert"
    │   └─ ← "EvmError: Revert"
    └─ ← "EvmError: Revert"

1 Answer 1

1

Looking at the code the call fails here:

# Invariant after change
D1: uint256 = self.get_D_mem(rates, new_balances, amp)
assert D1 > D0 // this assert fails!

Are you planning to provide liquidity with a ratio of 1-1?

Note that USDC has 6 decimals of precision and the other token has 18. Depending on how you set the original price, this could cause the problem.

1
  • You nailed it. It's exactly the issue of USDC decimals. Many thanks.
    – Maxareo
    Commented Jul 4, 2023 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.