Skip to content

Commit

Permalink
chore: clean up borrow caps
Browse files Browse the repository at this point in the history
  • Loading branch information
rhlsthrm committed Jan 30, 2024
1 parent b626cb1 commit 26dfef2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/sdk/tasks/market/risk/borrow-caps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default task("market:set-borrow-cap", "Set borrow cap on market")
.addParam("maxBorrow", "Maximum amount of tokens that can be borrowed", undefined, types.string)
.setAction(async ({ admin, market, maxBorrow }, { ethers }) => {
const signer = await ethers.getNamedSigner(admin);
console.log("signer: ", signer.address);

const ionicSdkModule = await import("../../ionicSdk");
const sdk = await ionicSdkModule.getOrCreateIonic(signer);
Expand All @@ -15,7 +16,7 @@ export default task("market:set-borrow-cap", "Set borrow cap on market")
const comptroller = await cToken.callStatic.comptroller();
const pool = sdk.createComptroller(comptroller, signer);

const currentBorrowCap = await pool.callStatic.supplyCaps(cToken.address);
const currentBorrowCap = await pool.callStatic.borrowCaps(cToken.address);
console.log(`Current borrow cap is ${currentBorrowCap}`);

const newBorrowCap = ethers.BigNumber.from(maxBorrow);
Expand All @@ -27,8 +28,8 @@ export default task("market:set-borrow-cap", "Set borrow cap on market")
const tx: providers.TransactionResponse = await pool._setMarketBorrowCaps([cToken.address], [newBorrowCap]);
await tx.wait();

const newSupplyCapSet = await pool.callStatic.supplyCaps(cToken.address);
console.log(`New supply cap set: ${newSupplyCapSet.toNumber()}`);
const newBorrowCapset = await pool.callStatic.borrowCaps(cToken.address);
console.log(`New borrow cap set: ${newBorrowCapset.toString()}`);
});

task("market:set-borrow-cap-whitelist", "Pauses borrowing on a market")
Expand Down

0 comments on commit 26dfef2

Please sign in to comment.