From c98327b2ca1d19941bac70b6df9d5ab8b4925ac2 Mon Sep 17 00:00:00 2001 From: Aryeh Greenberg <13561405+arr00@users.noreply.github.com> Date: Mon, 28 Dec 2020 13:17:09 -0500 Subject: [PATCH] Hypothetical cDAI implementation and IRM migration (#85) * cDai hypthetical migration * update irm as well * Additional Tests * clean up * revert change * Give Gauntlet sim 6 * comment * Create hypothetical_migration_post_propose.scen --- .../hypothetical_migration.scen | 44 +++++++++++++++++ .../hypothetical_migration_post_propose.scen | 47 +++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100755 spec/sim/0007-cdai-impl-migration/hypothetical_migration.scen create mode 100755 spec/sim/0007-cdai-impl-migration/hypothetical_migration_post_propose.scen diff --git a/spec/sim/0007-cdai-impl-migration/hypothetical_migration.scen b/spec/sim/0007-cdai-impl-migration/hypothetical_migration.scen new file mode 100755 index 000000000..9b5f9e9c1 --- /dev/null +++ b/spec/sim/0007-cdai-impl-migration/hypothetical_migration.scen @@ -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" \ No newline at end of file diff --git a/spec/sim/0007-cdai-impl-migration/hypothetical_migration_post_propose.scen b/spec/sim/0007-cdai-impl-migration/hypothetical_migration_post_propose.scen new file mode 100755 index 000000000..242534611 --- /dev/null +++ b/spec/sim/0007-cdai-impl-migration/hypothetical_migration_post_propose.scen @@ -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" \ No newline at end of file