Skip to content
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

feat: curve incentives script #1540

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions helpers/addresses.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@
"LIQ": "0xD82fd4D6D62f89A1E50b1db69AD19932314aa408",
"LIQLIT": "0x03C6F0Ca0363652398abfb08d154F114e61c4Ad8",
"LUSD": "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0",
"STETH": "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84",
"WSTETH": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
},
# every slp token listed in treasury tokens above must also be listed here.
# the lp_tokens in this list are processed by scount to determine holdings
Expand Down Expand Up @@ -306,6 +308,10 @@
"t_eth_f": "0x752eBeb79963cf0732E9c0fec72a49FD1DEfAEAC",
"cvx_eth_f": "0xB576491F1E6e5E62f1d8F26062Ee822B40B0E0d4",
"badgerFRAXBP_f": "0x13B876C26Ad6d21cb87AE459EaF6d7A1b788A113",
"ebtc_wsteth": "0x94a5B3A7AAF67415B7F5973ed1Adf542897a45F1",
},
"crv_gauges": {
"ebtc_wsteth_gauge": "0xBEb468BEb5C72d8b4d4f076F473Db398562769ed",
},
# mStable want tokens
"mstable_vaults": {
Expand Down
6 changes: 6 additions & 0 deletions interfaces/curve/ILiquidityGaugeV6.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0;

interface ILiquidityGaugeV6 {
function deposit_reward_token(address _reward_token, uint256 _amount, uint256 _epoch) external;
}
68 changes: 68 additions & 0 deletions scripts/curve/Lido incentives.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"version": "1.0",
"chainId": "1",
"createdAt": 1716833176007,
"meta": {
"name": "Lido incentives",
"description": "",
"txBuilderVersion": "1.16.5",
"createdFromSafeAddress": "0x042B32Ac6b453485e357938bdC38e0340d4b9276",
"createdFromOwnerAddress": "",
"checksum": "0x399a8a1116b44bdee7fc0fd346975092a154cb5bf1698941d9a3de226986a5a8"
},
"transactions": [
{
"to": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
"value": "0",
"data": null,
"contractMethod": {
"inputs": [
{
"name": "spender",
"type": "address",
"internalType": "address"
},
{
"name": "amount",
"type": "uint256",
"internalType": "uint256"
}
],
"name": "approve",
"payable": false
},
"contractInputsValues": {
"spender": "0xBEb468BEb5C72d8b4d4f076F473Db398562769ed",
"amount": "4220000000000000000"
}
},
{
"to": "0xBEb468BEb5C72d8b4d4f076F473Db398562769ed",
"value": "0",
"data": null,
"contractMethod": {
"inputs": [
{
"name": "_reward_token",
"type": "address"
},
{
"name": "_amount",
"type": "uint256"
},
{
"name": "_epoch",
"type": "uint256"
}
],
"name": "deposit_reward_token",
"payable": false
},
"contractInputsValues": {
"_reward_token": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
"_amount": "4220000000000000000",
"_epoch": "2419200"
Copy link
Collaborator

@petrovska-petro petrovska-petro May 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice adding the json file ✅

before posting it w/ either method json or working env worth having clarity of the final arguments for deposit_reward_token based on latest convos and then post in the pr the official json filed which will get posted

}
}
]
}
47 changes: 47 additions & 0 deletions scripts/curve/lido_gauge_incentives.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
from great_ape_safe import GreatApeSafe
from helpers.addresses import r
from brownie import interface
from decimal import Decimal

STETH = r.treasury_tokens.STETH
WSTETH = r.treasury_tokens.WSTETH
GAUGE = r.crv_gauges.ebtc_wsteth_gauge

TROPS = r.badger_wallets.treasury_ops_multisig

MONTH = 60 * 60 * 24 * 7 * 4 # Epoch


def main(amount=0, epoch=MONTH, use_wsteth=True):
"""
NOTE: Script fails with active ganache/brownie versions. As a workaround,
the the "Lido_incentives.json" file contains a batch of the approval and deposit transactions.
This can be imported into the Gnosis Safe UI to perform the operation below. Note that the
amount to be approved and deposited must be adjusted as needed either through the JSON or the UI.

Deposit stETH or wstETH into the eBTC/wstETH Curve gauge for a given epoch

Args:
amount (int): Decimal amount of stETH or wstETH to deposit
epoch (int): Epoch length to deposit the amount, default 1 month
use_wsteth (bool): Use wstETH instead of stETH
"""
safe = GreatApeSafe(TROPS)
gauge = safe.contract(GAUGE, Interface=interface.ILiquidityGaugeV6)
amount = int(Decimal(amount) * 1e18)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you test this? i dont think you can multiply a Decimal with a non Decimal type:

>>> int(Decimal(4.22)*1e18)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for *: 'decimal.Decimal' and 'float'


if use_wsteth:
token = safe.contract(WSTETH)
else:
token = safe.contract(STETH)

# 1. Approve amount
token.approve(GAUGE, amount)

# 2. Deposit amount
gauge.deposit_reward_token(token.address, amount, epoch)

# 3. Confirm deposit
print(gauge.reward_data(token))

safe.post_safe_tx()
Loading