Skip to content

Commit

Permalink
Hypothetical cDAI implementation and IRM migration (#85)
Browse files Browse the repository at this point in the history
* cDai hypthetical migration

* update irm as well

* Additional Tests

* clean up

* revert change

* Give Gauntlet sim 6

* comment

* Create hypothetical_migration_post_propose.scen
  • Loading branch information
arr00 authored Dec 28, 2020
1 parent 4e99ea3 commit c98327b
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
44 changes: 44 additions & 0 deletions spec/sim/0007-cdai-impl-migration/hypothetical_migration.scen
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env yarn repl -s

PrintTransactionLogs
Alias CompHolder "0xC89b6f0146642688bb254bF93C28fcCF1E182C81"
Alias DaiHolder "0xf977814e90da44bfa03b6295a0616a897441acec"
Alias CUSDCHolder "0x5e34bc93a7506ecc8562ade4d5c8b090247a6349"
Alias CUsdtImplementation "0x976aa93ca5aaa569109f4267589c619a097f001d"
Alias CUsdtIRM "0xFB564da37B41b2F6B6EDcc3e56FbF523bD9F2012"
Web3Fork "https://mainnet-eth.compound.finance/@11447815" (CompHolder DaiHolder CUSDCHolder)
UseConfigs mainnet


-- Delegate and propose update
From CompHolder (Comp Delegate CompHolder)
From CompHolder (Governor GovernorAlpha Propose "Update cDai implementation" [(Address cDai) (Address cDai)] [0 0] ["_setImplementation(address,bool,bytes)" "_setInterestRateModel(address)"] [[(address CUsdtImplementation) true "0x"] [(address CUsdtIRM)]])

-- Fast forward, vote, queue, execute
MineBlock
From CompHolder (Governor GovernorAlpha Proposal LastProposal Vote For)
AdvanceBlocks 20000
Governor GovernorAlpha Proposal LastProposal Queue
IncreaseTime 604910
Governor GovernorAlpha Proposal LastProposal Execute

-- Assert Dai retrieved from DSR
Assert Equal (Erc20 Dai TokenBalance cDai) (284058478303890709049107567)

-- IRM changed correctly
Assert Equal (CToken cDai InterestRateModel) (Address CUsdtIRM)

-- Ensure accrue interest works
CToken cDai AccrueInterest

-- Mint Test
From DaiHolder (Erc20 Dai Approve (Address cDai) 10000000)
From DaiHolder (CToken cDai Mint 10000000)
Assert Equal (Erc20 Dai TokenBalance cDai) (284058478303890709059107567)

-- Borrow Test
From CUSDCHolder (CToken cDai Borrow 10000000)
Assert Equal (Erc20 Dai TokenBalance CUSDCHolder) (4235678125976069)
Assert Equal (Erc20 Dai TokenBalance cDai) (284058478303890709049107567)

Print "cDai implementation migration ok"
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env yarn repl -s

PrintTransactionLogs
Alias CompHolder "0xed409c9ff60f3020abf9012bcd45fc294f5608ff"
Alias CompHolder2 "0x6626593c237f530d15ae9980a95ef938ac15c35c"
Alias DaiHolder "0xf977814e90da44bfa03b6295a0616a897441acec"
Alias CUSDCHolder "0x5e34bc93a7506ecc8562ade4d5c8b090247a6349"
Alias CUsdtImplementation "0x976aa93ca5aaa569109f4267589c619a097f001d"
Alias CUsdtIRM "0xFB564da37B41b2F6B6EDcc3e56FbF523bD9F2012"
Web3Fork "https://mainnet-eth.compound.finance/@11499832" (CompHolder CompHolder2 DaiHolder CUSDCHolder)
UseConfigs mainnet




-- Fast forward, vote, queue, execute
MineBlock
From CompHolder (Governor GovernorAlpha Proposal LastProposal Vote For)
From CompHolder2 (Governor GovernorAlpha Proposal LastProposal Vote For)
AdvanceBlocks 20000
Governor GovernorAlpha Proposal LastProposal Queue
IncreaseTime 604910
Governor GovernorAlpha Proposal LastProposal Execute

-- Assert Dai retrieved from DSR
Assert Equal (Erc20 Dai TokenBalance cDai) (247764889541500427246579984)

-- Assert Impl Changed Correctly
Assert Equal (CToken cDai Implementation) (Address CUsdtImplementation)

-- IRM changed correctly
Assert Equal (CToken cDai InterestRateModel) (Address CUsdtIRM)

-- Ensure accrue interest works
CToken cDai AccrueInterest

-- Mint Test
From DaiHolder (Erc20 Dai Approve (Address cDai) 10000000)
From DaiHolder (CToken cDai Mint 10000000)
Assert Equal (Erc20 Dai TokenBalance cDai) (247764889541500427256579984)

-- Borrow Test
From CUSDCHolder (CToken cDai Borrow 10000000)
Assert Equal (Erc20 Dai TokenBalance CUSDCHolder) (4235678125976069)
Assert Equal (Erc20 Dai TokenBalance cDai) (247764889541500427246579984)

Print "cDai implementation migration ok"

0 comments on commit c98327b

Please sign in to comment.