Skip to content

Commit

Permalink
feat: added cooldown end time to stkAAVE in liquidator
Browse files Browse the repository at this point in the history
  • Loading branch information
naddison36 committed Jun 4, 2021
1 parent e8aab2e commit f562c5b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tasks/utils/snap-utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/* eslint-disable no-await-in-loop */
/* eslint-disable no-restricted-syntax */
import { Signer } from "ethers"
import { fullScale, ONE_YEAR } from "@utils/constants"
import { fullScale, ONE_DAY, ONE_YEAR } from "@utils/constants"
import { applyDecimals, applyRatio, BN } from "@utils/math"
import { formatUnits } from "ethers/lib/utils"
import {
AaveStakedTokenV2__factory,
Comptroller__factory,
ERC20__factory,
ExposedMassetLogic,
Expand Down Expand Up @@ -726,7 +727,7 @@ export const getCompTokens = async (signer: Signer, toBlock: BlockInfo, quantity
export const getAaveTokens = async (signer: Signer, toBlock: BlockInfo, quantityFormatter = usdFormatter): Promise<void> => {
const aaveTokens = tokens.filter((token) => token.platform === Platform.Aave && token.chain === Chain.mainnet)

const stkAaveToken = ERC20__factory.connect(stkAAVE.address, signer)
const stkAaveToken = AaveStakedTokenV2__factory.connect(stkAAVE.address, signer)
const aaveIncentivesAddress = "0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5"
const aaveIncentives = IAaveIncentivesController__factory.connect(aaveIncentivesAddress, signer)

Expand All @@ -742,7 +743,10 @@ export const getAaveTokens = async (signer: Signer, toBlock: BlockInfo, quantity
// Get stkAave and AAVE in liquidity manager
const liquidatorStkAaveBal = await stkAaveToken.balanceOf(liquidatorAddress, { blockTag: toBlock.blockNumber })
totalStkAave = totalStkAave.add(liquidatorStkAaveBal)
console.log(`Liquidator ${quantityFormatter(liquidatorStkAaveBal)}`)
const cooldownStart = await stkAaveToken.stakersCooldowns(liquidatorAddress)
const cooldownEnd = cooldownStart.add(ONE_DAY.mul(10))
const colldownEndDate = new Date(cooldownEnd.toNumber() * 1000)
console.log(`Liquidator ${quantityFormatter(liquidatorStkAaveBal)} unlock ${colldownEndDate.toUTCString()}`)

const aaveUsdc = await quoteSwap(signer, AAVE, USDC, totalStkAave, toBlock)
console.log(
Expand Down

0 comments on commit f562c5b

Please sign in to comment.