Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maker migrator recipe and test case #6

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Conversation

edmulraney
Copy link

@edmulraney edmulraney commented Aug 31, 2021

Currently running as part of the test suite so we can prove it works off a mainnet fork.

Random Maker vault chosen for migration: 24225 - see https://defiexplore.com/cdp/24225

Vault
ID: 24225
Collateral: 45.74 ETH
Debt: 26,728 DAI

Execution steps

  • Fork mainnet off a recent-ish block number ✅
  • Query Instadapp's on-chain Maker Resolver to get vault details from the ID (24225) ✅
  • Transfer ownership of Maker vault to the test DSA user in the test case (and send the vault owner address some ETH to cover the gas cost of this) ✅
  • Flash loan from dydx the same amount of ETH as the vault owner has in collateral ✅
  • Open a Trove using the flash loaned ETH as collateral, borrow the same amount of LUSD as the vault had in DAI debt ✅
  • Fetch a swap quote from 1-inch off chain API for swapping the borrowed LUSD into DAI ✅
  • Swap borrowed LUSD for DAI using 1-inch ✅
  • Repay Maker vault debt using the swapped DAI ❌
  • Withdraw the ETH collateral from the Maker vault
  • Repay flash loan using the ETH collateral

The recipe fails when repaying the DAI debt due to having "dust" leftover in the vault debt (it should be 0). There are two values for the vault debt given back from the Maker Resolver:
vault.debt = 28150.579662849398312088
and
vault.art = 26728.972153870455837076

From Maker glossary:

art: normalized outstanding stablecoin debt.

When we repay using vault.debt as the amount, we get the following error:
Error: VM Exception while processing transaction: reverted with reason string 'paying-excess-debt'
When we repay using vault.art as the amount, we get the following error:
Error: VM Exception while processing transaction: reverted with reason string 'Vat/dust'

So the available values either repay too much or not enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant