-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/nicka/lp' into clement/testnet-d…
…etector
- Loading branch information
Showing
6 changed files
with
170 additions
and
21 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
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
const { parseUnits } = require("ethers"); | ||
|
||
const { getSigner } = require("../utils/signers"); | ||
const { parseDeployedAddress } = require("../utils/addressParser"); | ||
const { logTxDetails } = require("../utils/txLogger"); | ||
|
||
const log = require("../utils/logger")("task:lpCap"); | ||
|
||
async function lpDeposit({ amount }) { | ||
const signer = await getSigner(); | ||
|
||
const amountBn = parseUnits(amount.toString()); | ||
|
||
const lidArmAddress = await parseDeployedAddress("LIDO_ARM"); | ||
const lidoARM = await ethers.getContractAt("LidoARM", lidArmAddress); | ||
|
||
log(`About to deposit ${amount} WETH to the Lido ARM`); | ||
const tx = await lidoARM.connect(signer).deposit(amountBn); | ||
await logTxDetails(tx, "deposit"); | ||
} | ||
|
||
async function setLiquidityProviderCaps({ accounts, cap }) { | ||
const signer = await getSigner(); | ||
|
||
const capBn = parseUnits(cap.toString()); | ||
|
||
const liquidityProviders = accounts.split(","); | ||
|
||
const lpcAddress = await parseDeployedAddress("LIDO_ARM_LPC"); | ||
const liquidityProviderController = await ethers.getContractAt( | ||
"LiquidityProviderController", | ||
lpcAddress | ||
); | ||
|
||
log( | ||
`About to set deposit cap of ${cap} WETH for liquidity providers ${liquidityProviders}` | ||
); | ||
const tx = await liquidityProviderController | ||
.connect(signer) | ||
.setLiquidityProviderCaps(liquidityProviders, capBn); | ||
await logTxDetails(tx, "setLiquidityProviderCaps"); | ||
} | ||
|
||
async function setTotalAssetsCap({ cap }) { | ||
const signer = await getSigner(); | ||
|
||
const capBn = parseUnits(cap.toString()); | ||
|
||
const lpcAddress = await parseDeployedAddress("LIDO_ARM_LPC"); | ||
const liquidityProviderController = await ethers.getContractAt( | ||
"LiquidityProviderController", | ||
lpcAddress | ||
); | ||
|
||
log(`About to set total asset cap of ${cap} WETH`); | ||
const tx = await liquidityProviderController | ||
.connect(signer) | ||
.setTotalAssetsCap(capBn); | ||
await logTxDetails(tx, "setTotalAssetsCap"); | ||
} | ||
|
||
module.exports = { | ||
lpDeposit, | ||
setLiquidityProviderCaps, | ||
setTotalAssetsCap, | ||
}; |
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