-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hardhat tasks #2234
Hardhat tasks #2234
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2234 +/- ##
=======================================
Coverage 56.57% 56.57%
=======================================
Files 75 75
Lines 3848 3848
Branches 1014 1014
=======================================
Hits 2177 2177
Misses 1668 1668
Partials 3 3 ☔ View full report in Codecov by Sentry. |
Added simulation Hardhat tasks deployForceEtherSender and forceSend
Hardhat tasks
🚨 Report Summary
For more details view the full report in OpenZeppelin Code Inspector |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM left a couple of comments
contracts/tasks/aero.js
Outdated
const sugarHelper = await resolveContract(base.sugarHelper, "ISugarHelper"); | ||
|
||
const Q96 = BigNumber.from(2).pow(96); | ||
const sqrtRatioX96TickLower = BigNumber.from("79224201403219477170569942574"); // -1 tick |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These could be read from the strategy contract. Would make it easier to use the same script for different strategies:
https://github.com/OriginProtocol/origin-dollar/blob/master/contracts/contracts/strategies/aerodrome/AerodromeAMOStrategy.sol#L87
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I'll add
const weth = await resolveAsset("WETH"); | ||
const vault = await resolveContract("OETHBaseVaultProxy", "IVault"); | ||
const oeth = await resolveContract("OETHBaseProxy", "OETHBase"); | ||
const pool = await resolveContract(base.aerodromeOETHbWETHClPool, "ICLPool"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could be read from the strategy contract:
https://github.com/OriginProtocol/origin-dollar/blob/master/contracts/contracts/strategies/aerodrome/AerodromeAMOStrategy.sol#L75
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could, but I'll leave it from addresses.js
contracts/tasks/aero.js
Outdated
); // 0 tick | ||
|
||
const { tick, sqrtPriceX96 } = await pool.connect(signer).slot0({ blockTag }); | ||
const { liquidityGross } = await pool.connect(signer).ticks(-1, { blockTag }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the -1 tick is true for this strategy, might be a different thing for other chain strategies. Available as a constant here: https://github.com/OriginProtocol/origin-dollar/blob/master/contracts/contracts/strategies/aerodrome/AerodromeAMOStrategy.sol#L67
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea. I'll change
.mul(10000000000) | ||
.div(Q96) | ||
.div(Q96); | ||
const poolWethBalance = await weth |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good to know this isn't WETH liquidity in the pool, rather WETH balance/tokens of the pool.
WETH balance = WETH liquidity + unclaimed WETH
Unclaimed WETH can originate from decreasing liquidity in the pool and not yet collecting it. (the decrease + collect are separate calls).
In most cases though the WETH on the pool will probably be the pool's liquidity.
Also I think the WETH swap fees remain on the pool (since those are claimed by the veAreo voters)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add the pool balances so we can see when its different to the actual WETH balance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought there was a getBalances
function but there isn't. It needs to be calculated from the sqrtPriceX96 and liquidity. I'll leave for now but can add if you thinks its useful information
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it is pretty annoying that there isn't a simple way to get that data off of the contract
console.log( | ||
`Pool price : ${formatUnits(poolPrice, 10)} OETHb/WETH, ${tick} tick` | ||
); | ||
console.log( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these are fine, maybe there should be just additional notice, that these balances include unclaimed WETH/OETH from swap fees and liquidity decreases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a comment
exitValidators
andremoveValidators
make it easier to bulk exit and remove validators.npx hardhat snapVault --network base
manuallyFixAccounting
ForceEtherSender
contract to transfer ETH to contracts on self destructmine
Hardhat task that mines a number of blockssnapAero
Hardhat taskThe bulk Hardhat tasks are an alternative off-chain solution to PR #2185
Example snapAero task