Skip to content

Commit 7a2d613

Browse files
author
Jake Barber
committed
Final cleanup
1 parent 5cf206b commit 7a2d613

File tree

9 files changed

+25
-394
lines changed

9 files changed

+25
-394
lines changed

contracts/lending/Vault.sol

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity 0.8.9;
33

4-
//import "../_external/IWETH.sol";
5-
64
import "../IUSDI.sol";
7-
85
import "./IVault.sol";
96
import "./IVaultController.sol";
107

contracts/lending/VotingVault.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ contract VotingVault is Context {
8686

8787
/// @notice function used by the VaultController to transfer tokens
8888
/// callable by the VaultController only
89+
/// not currently in use, available for future upgrades
8990
/// @param _token token to transfer
9091
/// @param _to person to send the coins to
9192
/// @param _amount amount of coins to move

test/rewards/MainnetMerkle/1_setup.ts

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,7 @@ import { keccak256, solidityKeccak256 } from "ethers/lib/utils";
1515
import MerkleTree from "merkletreejs";
1616

1717
require("chai").should();
18-
//*
19-
// Initial Balances:
20-
// Andy: 100,000,000 usdc ($100) 6dec
21-
// Bob: 10,000,000,000,000,000,000 weth (10 weth) 18dec
22-
// Carol: 100,000,000,000,000,000,000 (100 comp), 18dec
23-
// Dave: 10,000,000,000 usdc ($10,000) 6dec
24-
//
25-
// andy is a usdc holder. he wishes to deposit USDC to hold USDI
26-
// bob is an eth holder. He wishes to deposit his eth and borrow USDI
27-
// carol is a comp holder. she wishes to deposit her comp and then vote
28-
// dave is a liquidator. he enjoys liquidating, so he's going to try to liquidate Bob
29-
// configurable variables
3018
let usdc_minter = "0x8EB8a3b98659Cce290402893d0123abb75E3ab28";
31-
let wbtc_minter = "0xf977814e90da44bfa03b6295a0616a897441acec"
32-
let uni_minter = "0xf977814e90da44bfa03b6295a0616a897441acec"
33-
let dydx_minter = "0xf977814e90da44bfa03b6295a0616a897441acec";
34-
let ens_minter = "0xf977814e90da44bfa03b6295a0616a897441acec";
35-
let aave_minter = "0xf977814e90da44bfa03b6295a0616a897441acec";
36-
let tribe_minter = "0xf977814e90da44bfa03b6295a0616a897441acec";
37-
let weth_minter = "0x8EB8a3b98659Cce290402893d0123abb75E3ab28";
38-
3919

4020
if (process.env.TENDERLY_KEY) {
4121
if (process.env.TENDERLY_ENABLE == "true") {
@@ -44,9 +24,6 @@ if (process.env.TENDERLY_KEY) {
4424
}
4525
}
4626

47-
48-
49-
5027
describe("hardhat settings", () => {
5128
it("Set hardhat network to a block after deployment", async () => {
5229
expect(await reset(15361080)).to.not.throw;//14940917
@@ -73,19 +50,6 @@ describe("Token Setup", () => {
7350
});
7451
it("Connect to existing contracts", async () => {
7552
s.USDC = IERC20__factory.connect(s.usdcAddress, s.Frank);
76-
s.WETH = IERC20__factory.connect(s.wethAddress, s.Frank);
77-
s.UNI = IVOTE__factory.connect(s.uniAddress, s.Frank);
78-
s.WBTC = IERC20__factory.connect(s.wbtcAddress, s.Frank);
79-
s.COMP = IVOTE__factory.connect(s.compAddress, s.Frank);
80-
s.ENS = IVOTE__factory.connect(s.ensAddress, s.Frank);
81-
s.DYDX = IVOTE__factory.connect(s.dydxAddress, s.Frank);
82-
83-
84-
s.AAVE = IVOTE__factory.connect(s.aaveAddress, s.Frank);
85-
86-
87-
s.TRIBE = IVOTE__factory.connect(s.tribeAddress, s.Frank);
88-
8953
});
9054

9155
it("Connect to mainnet deployments for interest protocol", async () => {
@@ -129,59 +93,16 @@ describe("Token Setup", () => {
12993
s.MERKLE_TREE = new MerkleTree(leafNodes, keccak256, { sortPairs: true })
13094
s.ROOT = s.MERKLE_TREE.getHexRoot()
13195
expect(s.ROOT).to.eq("0xec8163e87cc1d9d442502ca04e214a1669cb6adbd94b1853891deb923cc909c8", "Expected root matches")
132-
133-
13496
})
13597

13698
it("Should succesfully transfer money", async () => {
137-
//showBody(`stealing ${s.Andy_USDC} to andy from ${s.usdcAddress}`);
13899
await stealMoney(usdc_minter, s.Andy.address, s.usdcAddress, s.Andy_USDC)
139100
await mineBlock()
140-
await stealMoney(aave_minter, s.Andy.address, s.aaveAddress, s.aaveAmount)
141-
await mineBlock()
142-
143-
//showBody(`stealing ${s.Dave_USDC} to dave from ${s.usdcAddress}`);
144101
await stealMoney(usdc_minter, s.Dave.address, s.usdcAddress, s.Dave_USDC)
145102
await mineBlock()
146-
147-
//showBody(`stealing ${s.Carol_UNI} to carol from ${s.uniAddress}`);
148-
await stealMoney(uni_minter, s.Carol.address, s.uniAddress, s.Carol_UNI)
149-
await mineBlock()
150-
151-
//showBody(`stealing ${s.Gus_WBTC} to gus from ${s.wbtcAddress}`);
152-
await stealMoney(wbtc_minter, s.Gus.address, s.wbtcAddress, s.Gus_WBTC)
153-
await mineBlock()
154-
155-
//showBody(`stealing ${s.Bob_WETH} weth to bob from ${s.wethAddress}`);
156-
await stealMoney(weth_minter, s.Bob.address, s.wethAddress, s.Bob_WETH)
157-
await mineBlock()
158-
159-
await stealMoney(aave_minter, s.Bob.address, s.aaveAddress, s.aaveAmount)
160-
await mineBlock()
161-
162-
await stealMoney(aave_minter, s.Gus.address, s.aaveAddress, s.aaveAmount)
163-
await mineBlock()
164-
165-
//steal 10 MM IPT for Admin
166103
await stealMoney(s.DEPLOYER._address, s.Frank.address, s.IPT.address, BN("10000000e18"))
167104
await mineBlock()
168-
169-
170-
171-
//showBody(`stealing`,s.Bob_USDC,`usdc to bob from ${s.usdcAddress}`);
172105
await stealMoney(usdc_minter, s.Bob.address, s.usdcAddress, s.Bob_USDC)
173106
await mineBlock()
174-
175-
//showBody(`stealing ${s.Carol_ENS} ens to carol from ${s.ensAddress}`);
176-
await expect(
177-
stealMoney(ens_minter, s.Carol.address, s.ensAddress, s.Carol_ENS)
178-
).to.not.be.reverted;
179-
//showBody(`stealing ${s.Carol_DYDX} dydx to carol from ${s.dydxAddress}`);
180-
await expect(
181-
stealMoney(dydx_minter, s.Carol.address, s.dydxAddress, s.Carol_DYDX)
182-
).to.not.be.reverted;
183-
184-
await mineBlock();
185-
186107
});
187108
});

test/rewards/MainnetMerkle/2_verify.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,8 @@ import { toNumber, minter, mergeLists, getGas } from "../../../util/math"
1313
import {
1414
MerkleRedeem__factory
1515
} from "../../../typechain-types"
16-
import { red } from "bn.js";
17-
import { DeployContract, DeployContractWithProxy } from "../../../util/deploy";
1816
import { ceaseImpersonation, impersonateAccount } from "../../../util/impersonator";
1917

20-
import { uniMintersWeek2, borrowMintersWeek2 } from "../data"
21-
import { fail } from "assert";
22-
import { start } from "repl";
2318

2419
require("chai").should();
2520

test/rewards/MainnetMerkleWeek8/1_setup.ts

Lines changed: 0 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,7 @@ import { keccak256, solidityKeccak256 } from "ethers/lib/utils";
1515
import MerkleTree from "merkletreejs";
1616

1717
require("chai").should();
18-
//*
19-
// Initial Balances:
20-
// Andy: 100,000,000 usdc ($100) 6dec
21-
// Bob: 10,000,000,000,000,000,000 weth (10 weth) 18dec
22-
// Carol: 100,000,000,000,000,000,000 (100 comp), 18dec
23-
// Dave: 10,000,000,000 usdc ($10,000) 6dec
24-
//
25-
// andy is a usdc holder. he wishes to deposit USDC to hold USDI
26-
// bob is an eth holder. He wishes to deposit his eth and borrow USDI
27-
// carol is a comp holder. she wishes to deposit her comp and then vote
28-
// dave is a liquidator. he enjoys liquidating, so he's going to try to liquidate Bob
29-
// configurable variables
3018
let usdc_minter = "0x8EB8a3b98659Cce290402893d0123abb75E3ab28";
31-
let wbtc_minter = "0xf977814e90da44bfa03b6295a0616a897441acec"
32-
let uni_minter = "0xf977814e90da44bfa03b6295a0616a897441acec"
33-
let dydx_minter = "0xf977814e90da44bfa03b6295a0616a897441acec";
34-
let ens_minter = "0xf977814e90da44bfa03b6295a0616a897441acec";
35-
let aave_minter = "0xf977814e90da44bfa03b6295a0616a897441acec";
36-
let tribe_minter = "0xf977814e90da44bfa03b6295a0616a897441acec";
37-
let weth_minter = "0x8EB8a3b98659Cce290402893d0123abb75E3ab28";
38-
3919

4020
if (process.env.TENDERLY_KEY) {
4121
if (process.env.TENDERLY_ENABLE == "true") {
@@ -44,9 +24,6 @@ if (process.env.TENDERLY_KEY) {
4424
}
4525
}
4626

47-
48-
49-
5027
describe("hardhat settings", () => {
5128
it("Set hardhat network to a block after deployment", async () => {
5229
expect(await reset(15393213)).to.not.throw;//14940917
@@ -75,19 +52,6 @@ describe("Token Setup", () => {
7552
});
7653
it("Connect to existing contracts", async () => {
7754
s.USDC = IERC20__factory.connect(s.usdcAddress, s.Frank);
78-
s.WETH = IERC20__factory.connect(s.wethAddress, s.Frank);
79-
s.UNI = IVOTE__factory.connect(s.uniAddress, s.Frank);
80-
s.WBTC = IERC20__factory.connect(s.wbtcAddress, s.Frank);
81-
s.COMP = IVOTE__factory.connect(s.compAddress, s.Frank);
82-
s.ENS = IVOTE__factory.connect(s.ensAddress, s.Frank);
83-
s.DYDX = IVOTE__factory.connect(s.dydxAddress, s.Frank);
84-
85-
86-
s.AAVE = IVOTE__factory.connect(s.aaveAddress, s.Frank);
87-
88-
89-
s.TRIBE = IVOTE__factory.connect(s.tribeAddress, s.Frank);
90-
9155
});
9256

9357
it("Connect to mainnet deployments for interest protocol", async () => {
@@ -106,89 +70,21 @@ describe("Token Setup", () => {
10670

10771
s.MerkleRedeem = MerkleRedeem__factory.connect("0x91a1Fb8eEaeB0E05629719938b03EE3C32348CF7", s.Frank)
10872

109-
/**
110-
//s.mergedList =
111-
112-
let list: any[] = []
113-
114-
let keys = Object.keys(mainnetData)
115-
let values = Object.values(mainnetData)
116-
117-
for (let i = 0; i < keys.length; i++) {
118-
list.push(
119-
{
120-
minter: keys[i],
121-
amount: values[i]
122-
}
123-
)
124-
}
125-
126-
s.mergedList = list
127-
128-
*/
129-
130-
13173
let leafNodes = s.mergedList.map((obj) =>
13274
solidityKeccak256(["address", "uint256"], [obj.minter, BN(obj.amount)])
13375
)
134-
13576
s.MERKLE_TREE = new MerkleTree(leafNodes, keccak256, { sortPairs: true })
13677
s.ROOT = s.MERKLE_TREE.getHexRoot()
137-
showBodyCyan("ROOT: ", s.ROOT)
138-
//expect(s.ROOT).to.eq("0xec8163e87cc1d9d442502ca04e214a1669cb6adbd94b1853891deb923cc909c8", "Expected root matches")
139-
140-
14178
})
14279

14380
it("Should succesfully transfer money", async () => {
144-
//showBody(`stealing ${s.Andy_USDC} to andy from ${s.usdcAddress}`);
14581
await stealMoney(usdc_minter, s.Andy.address, s.usdcAddress, s.Andy_USDC)
14682
await mineBlock()
147-
await stealMoney(aave_minter, s.Andy.address, s.aaveAddress, s.aaveAmount)
148-
await mineBlock()
149-
150-
//showBody(`stealing ${s.Dave_USDC} to dave from ${s.usdcAddress}`);
15183
await stealMoney(usdc_minter, s.Dave.address, s.usdcAddress, s.Dave_USDC)
15284
await mineBlock()
153-
154-
//showBody(`stealing ${s.Carol_UNI} to carol from ${s.uniAddress}`);
155-
await stealMoney(uni_minter, s.Carol.address, s.uniAddress, s.Carol_UNI)
156-
await mineBlock()
157-
158-
//showBody(`stealing ${s.Gus_WBTC} to gus from ${s.wbtcAddress}`);
159-
await stealMoney(wbtc_minter, s.Gus.address, s.wbtcAddress, s.Gus_WBTC)
160-
await mineBlock()
161-
162-
//showBody(`stealing ${s.Bob_WETH} weth to bob from ${s.wethAddress}`);
163-
await stealMoney(weth_minter, s.Bob.address, s.wethAddress, s.Bob_WETH)
164-
await mineBlock()
165-
166-
await stealMoney(aave_minter, s.Bob.address, s.aaveAddress, s.aaveAmount)
167-
await mineBlock()
168-
169-
await stealMoney(aave_minter, s.Gus.address, s.aaveAddress, s.aaveAmount)
170-
await mineBlock()
171-
172-
//steal 10 MM IPT for Admin
17385
await stealMoney(s.DEPLOYER._address, s.Frank.address, s.IPT.address, BN("10000000e18"))
17486
await mineBlock()
175-
176-
177-
178-
//showBody(`stealing`,s.Bob_USDC,`usdc to bob from ${s.usdcAddress}`);
17987
await stealMoney(usdc_minter, s.Bob.address, s.usdcAddress, s.Bob_USDC)
18088
await mineBlock()
181-
182-
//showBody(`stealing ${s.Carol_ENS} ens to carol from ${s.ensAddress}`);
183-
await expect(
184-
stealMoney(ens_minter, s.Carol.address, s.ensAddress, s.Carol_ENS)
185-
).to.not.be.reverted;
186-
//showBody(`stealing ${s.Carol_DYDX} dydx to carol from ${s.dydxAddress}`);
187-
await expect(
188-
stealMoney(dydx_minter, s.Carol.address, s.dydxAddress, s.Carol_DYDX)
189-
).to.not.be.reverted;
190-
191-
await mineBlock();
192-
19389
});
19490
});

test/rewards/MainnetMerkleWeek8/2_verify.ts

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ describe("Merkle Redeem", () => {
3737

3838
let total = BN(0)
3939
const week = 8
40+
let startingIPT: BigNumber
4041

4142
before(async () => {
4243
LP1 = s.mergedList[0]
@@ -51,6 +52,7 @@ describe("Merkle Redeem", () => {
5152
leaf = solidityKeccak256(["address", "uint256"], [LP2.minter, claim2])
5253
proof2 = s.MERKLE_TREE.getHexProof(leaf)
5354

55+
startingIPT = await s.IPT.balanceOf(s.MerkleRedeem.address)
5456

5557
})
5658

@@ -175,13 +177,10 @@ describe("Merkle Redeem", () => {
175177
})
176178

177179

178-
/**
179-
* Can't test this easily as there are remaining funds on the contract from the previous round.
180-
* This has been tested in round 1, seee ../MainnetMerkle tests
181-
it("Everyone else redeems", async () => {
180+
181+
it("Everyone redeems for this week", async () => {
182182
let balance = await s.IPT.balanceOf(s.MerkleRedeem.address)
183-
expect(balance).to.be.gt(0, "MerkleRedeem still holds IPT, sanity check")
184-
183+
expect(balance).to.be.gt(startingIPT, "MerkleRedeem still holds IPT, sanity check")
185184

186185
showBodyCyan("Redeeming...")
187186
//start from 2 since LP1 and LP2 claimed already above
@@ -192,21 +191,20 @@ describe("Merkle Redeem", () => {
192191
let leaf = solidityKeccak256(["address", "uint256"], [minter, claim])
193192
let proof = s.MERKLE_TREE.getHexProof(leaf)
194193

195-
const startingIPT = await s.IPT.balanceOf(minter)
194+
const initIPT = await s.IPT.balanceOf(minter)
196195

197-
const result = await s.MerkleRedeem.claimWeek(minter, week, claim, proof)
196+
await s.MerkleRedeem.claimWeek(minter, week, claim, proof)
198197
await mineBlock()
199198
//const gas = await getGas(result)
200199
//showBodyCyan("Gas to claimWeek: ", gas)
201200

202201
let balance = await s.IPT.balanceOf(minter)
203-
expect(await toNumber(balance.sub(startingIPT))).to.eq(await toNumber(BN(claim)))
202+
expect(await toNumber(balance.sub(initIPT))).to.eq(await toNumber(BN(claim)))
204203
}
205204
})
206205

207206
it("Check end state", async () => {
208-
209-
//start from 0 this time, check everyont
207+
//start from 0 this time, check everyone
210208
for (let i = 0; i < s.mergedList.length; i++) {
211209

212210
let minter = s.mergedList[i].minter
@@ -217,11 +215,8 @@ describe("Merkle Redeem", () => {
217215
}
218216

219217
let balance = await s.IPT.balanceOf(s.MerkleRedeem.address)
220-
expect(balance).to.eq(0, "All redemptions done, remaining IPT is exactly 0, calculations correct")
218+
expect(balance).to.eq(startingIPT, "All redemptions done, remaining IPT is exactly what it was before, calculations correct")
221219

222220
})
223-
*/
224-
225-
226221
})
227222

0 commit comments

Comments
 (0)