-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚚 debt-manager: rename leverager and prepare deployment
- Loading branch information
1 parent
0bc8f01
commit e7a1bb2
Showing
11 changed files
with
162 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@exactly/protocol": patch | ||
--- | ||
|
||
🚚 debt-manager: rename leverager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@exactly/protocol": patch | ||
--- | ||
|
||
✨ debt-manager: add rollover functions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
import type { DeployFunction } from "hardhat-deploy/types"; | ||
import Leverager from "../Leverager"; | ||
|
||
const func: DeployFunction = async ({ | ||
ethers: { | ||
constants: { AddressZero }, | ||
}, | ||
deployments: { getOrNull, save }, | ||
network: { live }, | ||
}) => { | ||
if (!(await getOrNull("BalancerVault")) && !live) await save("BalancerVault", { address: AddressZero, abi: [] }); | ||
const func: DeployFunction = async ({ deployments: { deploy }, getNamedAccounts }) => { | ||
const { deployer } = await getNamedAccounts(); | ||
await deploy("BalancerVault", { | ||
skipIfAlreadyDeployed: true, | ||
contract: "MockBalancerVault", | ||
from: deployer, | ||
log: true, | ||
}); | ||
}; | ||
|
||
func.tags = ["BalancerVault"]; | ||
func.skip = Leverager.skip; | ||
|
||
export default func; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"address": "0xBA12222222228d8Ba445958a75a0704d566BF2C8" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,38 @@ | ||
import { expect } from "chai"; | ||
import { ethers, deployments } from "hardhat"; | ||
import type { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; | ||
import type { Market, Leverager, ERC20 } from "../types"; | ||
import type { Market, DebtManager, ERC20 } from "../types"; | ||
|
||
describe("Leverager", function () { | ||
describe("DebtManager", function () { | ||
let usdc: ERC20; | ||
let marketUSDC: Market; | ||
let leverager: Leverager; | ||
let debtManager: DebtManager; | ||
let alice: SignerWithAddress; | ||
|
||
before(async () => { | ||
[alice] = await ethers.getUnnamedSigners(); | ||
}); | ||
|
||
beforeEach(async () => { | ||
await deployments.fixture("Leverager"); | ||
await deployments.fixture("DebtManager"); | ||
usdc = await ethers.getContract<ERC20>("USDC"); | ||
marketUSDC = await ethers.getContract<Market>("MarketUSDC"); | ||
leverager = await ethers.getContract<Leverager>("Leverager", alice); | ||
debtManager = await ethers.getContract<DebtManager>("DebtManager", alice); | ||
}); | ||
|
||
describe("GIVEN an approval of the MarketUSDC to spend USDC from the leverage contract", () => { | ||
it("THEN the tx should emit Approval", async () => { | ||
await expect(leverager.approve(marketUSDC.address)) | ||
await expect(debtManager.approve(marketUSDC.address)) | ||
.to.emit(usdc, "Approval") | ||
.withArgs(leverager.address, marketUSDC.address, ethers.constants.MaxUint256); | ||
.withArgs(debtManager.address, marketUSDC.address, ethers.constants.MaxUint256); | ||
}); | ||
}); | ||
describe("AND GIVEN an approval of an invalid address to spend USDC from the leverage contract", () => { | ||
it("THEN the tx should revert", async () => { | ||
await expect(leverager.approve(leverager.address)).to.be.revertedWithCustomError(leverager, "MarketNotListed"); | ||
await expect(debtManager.approve(debtManager.address)).to.be.revertedWithCustomError( | ||
debtManager, | ||
"MarketNotListed", | ||
); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.