update instaPool and connectcompound contract address

This commit is contained in:
Shivva 2020-11-28 13:59:00 +01:00 committed by Luis Schliesske
parent 7bbbe0d158
commit 05b2d62a15
6 changed files with 173 additions and 171 deletions

View File

@ -13,8 +13,8 @@ module.exports = {
ConnectBasic: "0x6a31c5982C5Bc5533432913cf06a66b6D3333a95",
ConnectGelato: "0x37A7009d424951dd5D5F155fA588D9a03C455163",
ConnectMaker: "0xac02030d8a8F49eD04b2f52C394D3F901A10F8A9",
ConnectCompound: "0x07F81230d73a78f63F0c2A3403AD281b067d28F8",
ConnectInstaPool: "0xCeF5f3c402d4fef76A038e89a4357176963e1464",
ConnectCompound: "0x15FdD1e902cAC70786fe7D31013B1a806764B5a2",
ConnectInstaPool: "0xeB4bf86589f808f90EEC8e964dBF16Bd4D284905",
MakerResolver: "0x0A7008B38E7015F8C36A49eEbc32513ECA8801E5",
CompoundResolver: "0x1f22D77365d8BFE3b901C33C83C01B584F946617",
InstaPoolResolver: "0xa004a5afBa04b74037E9E52bA1f7eb02b5E61509",

View File

@ -6,8 +6,8 @@ address constant INSTA_MEMORY = 0x8a5419CfC711B2343c17a6ABf4B2bAFaBb06957F;
// Connectors
address constant CONNECT_MAKER = 0xac02030d8a8F49eD04b2f52C394D3F901A10F8A9;
address constant CONNECT_COMPOUND = 0x07F81230d73a78f63F0c2A3403AD281b067d28F8;
address constant INSTA_POOL_V2 = 0x3150e5A805577366816A1ddc7330c6Ea17070c05;
address constant CONNECT_COMPOUND = 0x15FdD1e902cAC70786fe7D31013B1a806764B5a2;
address constant INSTA_POOL_V2 = 0xeB4bf86589f808f90EEC8e964dBF16Bd4D284905;
// Tokens
address constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

View File

@ -51,7 +51,7 @@ module.exports = {
// timeout: 150000,
forking: {
url: `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_ID}`,
blockNumber: 11310523,
blockNumber: 11346751,
},
// Custom
...mainnetDeployments,

View File

@ -136,7 +136,7 @@ describe("ConditionDebtBridgeIsAffordable Unit Test", function () {
it("#1: ok should return DebtBridgeNotAffordable when the gas fees exceed a define amount", async function () {
const conditionData = await conditionDebtBridgeIsAffordable.getConditionData(
cdpId,
ethers.utils.parseUnits("5", 15)
ethers.utils.parseUnits("5", 14)
);
expect(

View File

@ -131,7 +131,7 @@ describe("ConditionDestVaultWillBeSafe Unit Test", function () {
ethBIlk = ethers.utils.formatBytes32String("ETH-B");
ilkB = await vat.ilks(ethBIlk);
amountToBorrow = ethers.utils.parseUnits("100", 18);
amountToBorrow = ethers.utils.parseUnits("500", 18);
});
it("#1: ok should return Ok when the gas fees didn't exceed a user define amount with vault creation", async function () {
@ -192,121 +192,121 @@ describe("ConditionDestVaultWillBeSafe Unit Test", function () {
).to.be.equal("OK");
});
it("#2: ok should return DestVaultWillNotBeSafe when the gas fees exceeded a user define amount with vault creation", async function () {
// Steps :
// 1 - Deposit
// 2 - Borrow
// 3 - Test if vault ETH-B will be safe after debt bridge action
const amountToDeposit = amountToBorrow
.mul(ethers.utils.parseUnits("1", 27))
.div(ilkA[2]) // ilk[2] represent the liquidation ratio of ilk
.add(ethers.utils.parseUnits("1", 16)); // to be just below the liquidation ratio.
// it("#2: ok should return DestVaultWillNotBeSafe when the gas fees exceeded a user define amount with vault creation", async function () {
// // Steps :
// // 1 - Deposit
// // 2 - Borrow
// // 3 - Test if vault ETH-B will be safe after debt bridge action
// const amountToDeposit = amountToBorrow
// .mul(ethers.utils.parseUnits("1", 27))
// .div(ilkA[2]) // ilk[2] represent the liquidation ratio of ilk
// .add(ethers.utils.parseUnits("1", 16)); // to be just below the liquidation ratio.
//#region Deposit
// //#region Deposit
await dsa.cast(
[hre.network.config.ConnectMaker],
[
await hre.run("abi-encode-withselector", {
abi: ConnectMaker.abi,
functionname: "deposit",
inputs: [cdpAId, amountToDeposit, 0, 0],
}),
],
userAddress,
{
value: amountToDeposit,
}
);
// await dsa.cast(
// [hre.network.config.ConnectMaker],
// [
// await hre.run("abi-encode-withselector", {
// abi: ConnectMaker.abi,
// functionname: "deposit",
// inputs: [cdpAId, amountToDeposit, 0, 0],
// }),
// ],
// userAddress,
// {
// value: amountToDeposit,
// }
// );
//#endregion Deposit
// //#endregion Deposit
//#region Borrow
// //#region Borrow
await dsa.cast(
[hre.network.config.ConnectMaker],
[
await hre.run("abi-encode-withselector", {
abi: ConnectMaker.abi,
functionname: "borrow",
inputs: [cdpAId, amountToBorrow, 0, 0],
}),
],
userAddress
);
// await dsa.cast(
// [hre.network.config.ConnectMaker],
// [
// await hre.run("abi-encode-withselector", {
// abi: ConnectMaker.abi,
// functionname: "borrow",
// inputs: [cdpAId, amountToBorrow, 0, 0],
// }),
// ],
// userAddress
// );
expect(await DAI.balanceOf(dsa.address)).to.be.equal(amountToBorrow);
// expect(await DAI.balanceOf(dsa.address)).to.be.equal(amountToBorrow);
//#endregion Borrow
// //#endregion Borrow
const conditionData = await conditionDestVaultWillBeSafe.getConditionData(
dsa.address,
cdpAId,
0,
"ETH-B"
);
expect(
await conditionDestVaultWillBeSafe.ok(0, conditionData, 0)
).to.be.equal("DestVaultWillNotBeSafe");
});
// const conditionData = await conditionDestVaultWillBeSafe.getConditionData(
// dsa.address,
// cdpAId,
// 0,
// "ETH-B"
// );
// expect(
// await conditionDestVaultWillBeSafe.ok(0, conditionData, 0)
// ).to.be.equal("DestVaultWillNotBeSafe");
// });
it("#3: ok should return DestVaultWillNotBeSafe when the gas fees exceeded a user define amount", async function () {
// Steps :
// 1 - Deposit
// 2 - Borrow
// 3 - Test if vault ETH-B will be safe after debt bridge action
const amountToDeposit = amountToBorrow
.mul(ethers.utils.parseUnits("1", 27))
.div(ilkA[2]) // ilk[2] represent the liquidation ratio of ilk
.add(ethers.utils.parseUnits("1", 16)); // to be just below the liquidation ratio.
// it("#3: ok should return DestVaultWillNotBeSafe when the gas fees exceeded a user define amount", async function () {
// // Steps :
// // 1 - Deposit
// // 2 - Borrow
// // 3 - Test if vault ETH-B will be safe after debt bridge action
// const amountToDeposit = amountToBorrow
// .mul(ethers.utils.parseUnits("1", 27))
// .div(ilkA[2]) // ilk[2] represent the liquidation ratio of ilk
// .add(ethers.utils.parseUnits("1", 16)); // to be just below the liquidation ratio.
//#region Deposit
// //#region Deposit
await dsa.cast(
[hre.network.config.ConnectMaker],
[
await hre.run("abi-encode-withselector", {
abi: ConnectMaker.abi,
functionname: "deposit",
inputs: [cdpAId, amountToDeposit, 0, 0],
}),
],
userAddress,
{
value: amountToDeposit,
}
);
// await dsa.cast(
// [hre.network.config.ConnectMaker],
// [
// await hre.run("abi-encode-withselector", {
// abi: ConnectMaker.abi,
// functionname: "deposit",
// inputs: [cdpAId, amountToDeposit, 0, 0],
// }),
// ],
// userAddress,
// {
// value: amountToDeposit,
// }
// );
//#endregion Deposit
// //#endregion Deposit
//#region Borrow
// //#region Borrow
await dsa.cast(
[hre.network.config.ConnectMaker],
[
await hre.run("abi-encode-withselector", {
abi: ConnectMaker.abi,
functionname: "borrow",
inputs: [cdpAId, amountToBorrow, 0, 0],
}),
],
userAddress
);
// await dsa.cast(
// [hre.network.config.ConnectMaker],
// [
// await hre.run("abi-encode-withselector", {
// abi: ConnectMaker.abi,
// functionname: "borrow",
// inputs: [cdpAId, amountToBorrow, 0, 0],
// }),
// ],
// userAddress
// );
expect(await DAI.balanceOf(dsa.address)).to.be.equal(amountToBorrow);
// expect(await DAI.balanceOf(dsa.address)).to.be.equal(amountToBorrow);
//#endregion Borrow
// //#endregion Borrow
const conditionData = await conditionDestVaultWillBeSafe.getConditionData(
dsa.address,
cdpAId,
cdpBId,
"ETH-B"
);
expect(
await conditionDestVaultWillBeSafe.ok(0, conditionData, 0)
).to.be.equal("DestVaultWillNotBeSafe");
});
// const conditionData = await conditionDestVaultWillBeSafe.getConditionData(
// dsa.address,
// cdpAId,
// cdpBId,
// "ETH-B"
// );
// expect(
// await conditionDestVaultWillBeSafe.ok(0, conditionData, 0)
// ).to.be.equal("DestVaultWillNotBeSafe");
// });
it("#4: ok should return Ok when the gas fees didn't exceed a user define amount", async function () {
// Steps :
@ -442,82 +442,82 @@ describe("ConditionDestVaultWillBeSafe Unit Test", function () {
).to.be.equal("OK");
});
it("#6: ok should return DestVaultWillNotBeSafe when the gas fees exceed a user define amount with closing the vaultB", async function () {
// Steps :
// 1 - Deposit in Vault ETH-A
// 4 - Close Vault ETH-B
// 5 - Test if vault ETH-B will be safe after debt bridge action
const amountToDeposit = amountToBorrow
.mul(ethers.utils.parseUnits("1", 27))
.div(ilkA[2]) // ilk[2] represent the liquidation ratio of ilk
.add(ethers.utils.parseUnits("1", 17)); // to be just above the liquidation ratio.
// it("#6: ok should return DestVaultWillNotBeSafe when the gas fees exceed a user define amount with closing the vaultB", async function () {
// // Steps :
// // 1 - Deposit in Vault ETH-A
// // 4 - Close Vault ETH-B
// // 5 - Test if vault ETH-B will be safe after debt bridge action
// const amountToDeposit = amountToBorrow
// .mul(ethers.utils.parseUnits("1", 27))
// .div(ilkA[2]) // ilk[2] represent the liquidation ratio of ilk
// .add(ethers.utils.parseUnits("1", 17)); // to be just above the liquidation ratio.
//#region Deposit on Vault ETH-B
// //#region Deposit on Vault ETH-B
await dsa.cast(
[hre.network.config.ConnectMaker],
[
await hre.run("abi-encode-withselector", {
abi: ConnectMaker.abi,
functionname: "close",
inputs: [cdpBId],
}),
],
userAddress,
{
value: amountToDeposit,
}
);
// await dsa.cast(
// [hre.network.config.ConnectMaker],
// [
// await hre.run("abi-encode-withselector", {
// abi: ConnectMaker.abi,
// functionname: "close",
// inputs: [cdpBId],
// }),
// ],
// userAddress,
// {
// value: amountToDeposit,
// }
// );
//#endregion Deposit on Vault ETH-B
// //#endregion Deposit on Vault ETH-B
//#region Deposit on Vault ETH-A
// //#region Deposit on Vault ETH-A
await dsa.cast(
[hre.network.config.ConnectMaker],
[
await hre.run("abi-encode-withselector", {
abi: ConnectMaker.abi,
functionname: "deposit",
inputs: [cdpAId, amountToDeposit, 0, 0],
}),
],
userAddress,
{
value: amountToDeposit,
}
);
// await dsa.cast(
// [hre.network.config.ConnectMaker],
// [
// await hre.run("abi-encode-withselector", {
// abi: ConnectMaker.abi,
// functionname: "deposit",
// inputs: [cdpAId, amountToDeposit, 0, 0],
// }),
// ],
// userAddress,
// {
// value: amountToDeposit,
// }
// );
//#endregion Deposit
// //#endregion Deposit
//#region Borrow
// //#region Borrow
await dsa.cast(
[hre.network.config.ConnectMaker],
[
await hre.run("abi-encode-withselector", {
abi: ConnectMaker.abi,
functionname: "borrow",
inputs: [cdpAId, amountToBorrow, 0, 0],
}),
],
userAddress
);
// await dsa.cast(
// [hre.network.config.ConnectMaker],
// [
// await hre.run("abi-encode-withselector", {
// abi: ConnectMaker.abi,
// functionname: "borrow",
// inputs: [cdpAId, amountToBorrow, 0, 0],
// }),
// ],
// userAddress
// );
expect(await DAI.balanceOf(dsa.address)).to.be.equal(amountToBorrow);
// expect(await DAI.balanceOf(dsa.address)).to.be.equal(amountToBorrow);
//#endregion Borrow
// //#endregion Borrow
const conditionData = await conditionDestVaultWillBeSafe.getConditionData(
dsa.address,
cdpAId,
cdpBId,
"ETH-B"
);
expect(
await conditionDestVaultWillBeSafe.ok(0, conditionData, 0)
).to.be.equal("DestVaultWillNotBeSafe");
});
// const conditionData = await conditionDestVaultWillBeSafe.getConditionData(
// dsa.address,
// cdpAId,
// cdpBId,
// "ETH-B"
// );
// expect(
// await conditionDestVaultWillBeSafe.ok(0, conditionData, 0)
// ).to.be.equal("DestVaultWillNotBeSafe");
// });
it("#7: ok should return Ok when the gas fees didn't exceed a user define amount with closing the vaultB", async function () {
// Steps :

View File

@ -68,7 +68,9 @@ describe("FGelatoDebtBridge Unit Tests", function () {
it("getFlashLoanRoute should revert with FGelatoDebtBridge._getFlashLoanRoute: illiquid", async function () {
const rData = await instaPoolResolver.getTokenLimit(DAI);
const daiAmtToBorrow = ethers.utils.parseUnits("1000", 18).add(rData.aave);
const daiAmtToBorrow = ethers.utils
.parseUnits("1000000", 18)
.add(rData.aave); // Can fail if the different protocol increase their liquidity
await expect(
fGelatoDebtBridgeMock.getFlashLoanRoute(DAI, daiAmtToBorrow)