From 8a1b16eb112fcaeda8c3e364235e60bfe6f5c02f Mon Sep 17 00:00:00 2001 From: sajanrajdev Date: Mon, 27 May 2024 13:09:25 -0500 Subject: [PATCH 1/3] feat: curve incentives script --- helpers/addresses.py | 6 ++++ interfaces/curve/ILiquidityGaugeV6.sol | 6 ++++ scripts/curve/lido_gauge_incentives.py | 40 ++++++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 interfaces/curve/ILiquidityGaugeV6.sol create mode 100644 scripts/curve/lido_gauge_incentives.py diff --git a/helpers/addresses.py b/helpers/addresses.py index 811be54a..d1e22984 100644 --- a/helpers/addresses.py +++ b/helpers/addresses.py @@ -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 @@ -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": { diff --git a/interfaces/curve/ILiquidityGaugeV6.sol b/interfaces/curve/ILiquidityGaugeV6.sol new file mode 100644 index 00000000..52eaf6cd --- /dev/null +++ b/interfaces/curve/ILiquidityGaugeV6.sol @@ -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; +} \ No newline at end of file diff --git a/scripts/curve/lido_gauge_incentives.py b/scripts/curve/lido_gauge_incentives.py new file mode 100644 index 00000000..91321436 --- /dev/null +++ b/scripts/curve/lido_gauge_incentives.py @@ -0,0 +1,40 @@ +from great_ape_safe import GreatApeSafe +from helpers.addresses import r +from brownie import interface + +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): + """ + 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(float(amount) * 1e18) + + 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() \ No newline at end of file From 6843e02446d655444a8f53c254f62456ac72f20f Mon Sep 17 00:00:00 2001 From: sajanrajdev Date: Mon, 27 May 2024 13:22:14 -0500 Subject: [PATCH 2/3] fix: lint --- scripts/curve/lido_gauge_incentives.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/curve/lido_gauge_incentives.py b/scripts/curve/lido_gauge_incentives.py index 91321436..492a7606 100644 --- a/scripts/curve/lido_gauge_incentives.py +++ b/scripts/curve/lido_gauge_incentives.py @@ -8,12 +8,13 @@ TROPS = r.badger_wallets.treasury_ops_multisig -MONTH = 60 * 60 * 24 * 7 * 4 # Epoch +MONTH = 60 * 60 * 24 * 7 * 4 # Epoch + def main(amount=0, epoch=MONTH, use_wsteth=True): """ 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 @@ -37,4 +38,4 @@ def main(amount=0, epoch=MONTH, use_wsteth=True): # 3. Confirm deposit print(gauge.reward_data(token)) - safe.post_safe_tx() \ No newline at end of file + safe.post_safe_tx() From b7b289055e5716fe2e4f567533cccdb09fee0564 Mon Sep 17 00:00:00 2001 From: sajanrajdev Date: Tue, 28 May 2024 13:16:29 -0500 Subject: [PATCH 3/3] feat: add json --- scripts/curve/Lido incentives.json | 68 ++++++++++++++++++++++++++ scripts/curve/lido_gauge_incentives.py | 8 ++- 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 scripts/curve/Lido incentives.json diff --git a/scripts/curve/Lido incentives.json b/scripts/curve/Lido incentives.json new file mode 100644 index 00000000..f0398d78 --- /dev/null +++ b/scripts/curve/Lido incentives.json @@ -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" + } + } + ] +} \ No newline at end of file diff --git a/scripts/curve/lido_gauge_incentives.py b/scripts/curve/lido_gauge_incentives.py index 492a7606..11316e7e 100644 --- a/scripts/curve/lido_gauge_incentives.py +++ b/scripts/curve/lido_gauge_incentives.py @@ -1,6 +1,7 @@ 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 @@ -13,6 +14,11 @@ 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: @@ -22,7 +28,7 @@ def main(amount=0, epoch=MONTH, use_wsteth=True): """ safe = GreatApeSafe(TROPS) gauge = safe.contract(GAUGE, Interface=interface.ILiquidityGaugeV6) - amount = int(float(amount) * 1e18) + amount = int(Decimal(amount) * 1e18) if use_wsteth: token = safe.contract(WSTETH)