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:Convex, Curve, Aura adaptors support + Turbo eETH permissions #236

Merged
merged 23 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from 22 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
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sommelier_steward"
version = "3.6.1"
version = "3.7.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Reference: https://www.lpalmieri.com/posts/fast-rust-docker-builds/

FROM rust:1.65 as cargo-chef-rust
RUN cargo install cargo-chef --version 0.1.51
FROM rust:1.70-bullseye as cargo-chef-rust
RUN cargo install cargo-chef --version 0.1.62
RUN rustup component add rustfmt

FROM cargo-chef-rust as planner
WORKDIR app
Expand All @@ -15,7 +16,6 @@ RUN cargo chef prepare --recipe-path recipe.json
FROM cargo-chef-rust as cacher
WORKDIR app
COPY --from=planner /app/recipe.json recipe.json
RUN rustup component add rustfmt
RUN cargo chef cook --release --recipe-path recipe.json

FROM cargo-chef-rust as builder
Expand All @@ -26,7 +26,7 @@ COPY --from=cacher /app/target target
COPY --from=cacher /usr/local/cargo /usr/local/cargo
RUN cargo build --release --bin steward

FROM cargo-chef-rust as runtime
FROM debian:bullseye as runtime
WORKDIR app
COPY --from=builder /app/target/release/steward /usr/local/bin
CMD steward start
9 changes: 9 additions & 0 deletions proto/adaptors/aave/aave_v3_debt_token_flash_loan.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ option go_package = "/steward_proto";
import "adaptors/aave/a_token.proto";
import "adaptors/aave/debt_token.proto";
import "adaptors/aave/aave_v3_a_token.proto";
import "adaptors/aura/aura_erc4626.proto";
import "adaptors/balancer/balancer_pool.proto";
import "adaptors/compound/c_token.proto";
import "adaptors/convex/convex_curve.proto";
import "adaptors/curve/curve.proto";
import "adaptors/frax/f_token.proto";
import "adaptors/morpho/morpho_aave_v2_a_token.proto";
import "adaptors/morpho/morpho_aave_v2_debt_token.proto";
Expand Down Expand Up @@ -103,6 +106,12 @@ message AaveV3DebtTokenAdaptorV1FlashLoan {
DebtFTokenAdaptorV1Calls debt_f_token_v1_calls = 25;
// Represents function calls to the CollateralFTokenAdaptor V1
CollateralFTokenAdaptorV1Calls collateral_f_token_v1_calls = 26;
// Represents function calls for the ConvexCurveAdaptorV1
ConvexCurveAdaptorV1Calls convex_curve_v1_calls = 30;
// Represents function calls for the CurveAdaptorV1
CurveAdaptorV1Calls curve_v1_calls = 31;
// Represents function calls for the AuraERC4626AdaptorV1
AuraERC4626AdaptorV1Calls aura_erc4626_v1_calls = 32;
EricBolten marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Expand Down
40 changes: 40 additions & 0 deletions proto/adaptors/aura/aura_erc4626.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Protos for function calls to the Aura ERC4626 adaptor.
*/

syntax = "proto3";
package steward.v3;

option go_package = "/steward_proto";

import "adaptors/base.proto";

// Represents call data for the Aura ERC4626 adaptor V1
message AuraERC4626AdaptorV1 {
oneof function {
/***** BASE ADAPTOR FUNCTIONS *****/

// Represents function `revokeApproval(ERC20 asset, address spender)`
RevokeApproval revoke_approval = 1;

/***** ADAPTOR-SPECIFIC FUNCTIONS *****/

// Represents function `getRewards(IBaseRewardPool _auraPool, bool _claimExtras)`
GetRewards get_rewards = 2;
}

/*
* Allows strategist to get rewards for an Aura pool.
*
* Represents function `getRewards(IBaseRewardPool _auraPool, bool _claimExtras)` */
message GetRewards {
// The address of the Aura pool to get rewards for
string aura_pool = 1;
// Whether to claim extra rewards associated with the pool
bool claim_extras = 2;
}
}

message AuraERC4626AdaptorV1Calls {
repeated AuraERC4626AdaptorV1 calls = 1;
}
9 changes: 9 additions & 0 deletions proto/adaptors/balancer/balancer_pool_flash_loan.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import "adaptors/aave/a_token.proto";
import "adaptors/aave/debt_token.proto";
import "adaptors/aave/aave_v3_a_token.proto";
import "adaptors/aave/aave_v3_debt_token.proto";
import "adaptors/aura/aura_erc4626.proto";
import "adaptors/compound/c_token.proto";
import "adaptors/convex/convex_curve.proto";
import "adaptors/curve/curve.proto";
import "adaptors/frax/f_token.proto";
import "adaptors/morpho/morpho_aave_v2_a_token.proto";
import "adaptors/morpho/morpho_aave_v2_debt_token.proto";
Expand Down Expand Up @@ -102,6 +105,12 @@ message BalancerPoolAdaptorV1FlashLoan {
DebtFTokenAdaptorV1Calls debt_f_token_v1_calls = 26;
// Represents function calls to the CollateralFTokenAdaptor V1
CollateralFTokenAdaptorV1Calls collateral_f_token_v1_calls = 27;
// Represents function calls for the ConvexCurveAdaptorV1
ConvexCurveAdaptorV1Calls convex_curve_v1_calls = 28;
// Represents function calls for the CurveAdaptorV1
CurveAdaptorV1Calls curve_v1_calls = 29;
// Represents function calls for the AuraERC4626AdaptorV1
AuraERC4626AdaptorV1Calls aura_erc4626_v1_calls = 30;
}
}
}
Expand Down
68 changes: 68 additions & 0 deletions proto/adaptors/convex/convex_curve.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Protos for function calls to the Convex Curve adaptor.
*/

syntax = "proto3";
package steward.v3;

option go_package = "/steward_proto";

import "adaptors/base.proto";

// Represents call data for the Convex Curve adaptor V1
message ConvexCurveAdaptorV1 {
oneof function {
/***** BASE ADAPTOR FUNCTIONS *****/

// Represents function `revokeApproval(ERC20 asset, address spender)`
RevokeApproval revoke_approval = 1;

/***** ADAPTOR-SPECIFIC FUNCTIONS *****/

// Represents function `depositLPTInConvexAndStake(uint256 _pid, address baseRewardPool, ERC20 _lpt, CurvePool _pool, bytes4 _selector, uint256 _amount)`
DepositLPTInConvexAndStake deposit_lpt_in_convex_and_stake = 2;
// Represents function `withdrawFromBaseRewardPoolAsLPTaddress(_baseRewardPool, uint256 _amount, bool _claim)`
WithdrawFromBaseRewardPoolAsLPT withdraw_from_base_reward_pool_as_lpt = 3;
// Represents function `getRewards(address _baseRewardPool, bool _claimExtras)`
GetRewards get_rewards = 4;
}

/*
* Allows strategists to deposit and stake LPTs into Convex markets via the respective Convex market Booster contract
*
* Represents function `depositLPTInConvexAndStake(uint256 _pid, address baseRewardPool, ERC20 _lpt, CurvePool _pool, bytes4 _selector, uint256 _amount)`
*/
message DepositLPTInConvexAndStake {
string pid = 1;
string base_reward_pool = 2;
string lpt = 3;
string pool = 4;
string selector = 5;
string amount_to_deposit = 6;
}

/*
* Allows strategists to withdraw from Convex markets via Booster contract w/ or w/o claiming rewards
*
* Represents function `withdrawFromBaseRewardPoolAsLPTaddress(_baseRewardPool, uint256 _amount, bool _claim)`
*/
message WithdrawFromBaseRewardPoolAsLPT {
string base_reward_pool = 1;
string amount_to_withdraw = 2;
bool claim = 3;
}

/*
* Allows strategists to get rewards for an Convex Booster without withdrawing/unwrapping from Convex market
*
* Represents function `getRewards(address _baseRewardPool, bool _claimExtras)`
*/
message GetRewards {
string base_reward_pool = 1;
bool claim_extras = 2;
}
}

message ConvexCurveAdaptorV1Calls {
repeated ConvexCurveAdaptorV1 calls = 1;
}
165 changes: 165 additions & 0 deletions proto/adaptors/curve/curve.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
/*
* Protos for function calls to the Curve adaptor.
*/

syntax = "proto3";
package steward.v3;

option go_package = "/steward_proto";

import "adaptors/base.proto";

// Represents call data for the Curve adaptor V1
message CurveAdaptorV1 {
oneof function {
/***** BASE ADAPTOR FUNCTIONS *****/

// Represents function `revokeApproval(ERC20 asset, address spender)`
RevokeApproval revoke_approval = 1;

/***** ADAPTOR-SPECIFIC FUNCTIONS *****/

// Represents function `addLiquidity(address pool, ERC20 lpToken, uint256[] orderedUnderlyingTokenAmounts, uint256 minLPAmount, CurveGauge gauge, bytes4 selector)`
AddLiquidity add_liquidity = 2;
// Represents function `addLiquidityETH(address pool, ERC20 lpToken, uint256[] orderedMinimumUnderlyingTokenAmountsOut, uint256 minLPAmount, bool useUnderlying, CurveGauge gauge, bytes4 selector)`
AddLiquidityETH add_liquidity_eth = 3;
// Represents function `removeLiquidity(address pool, ERC20 lpToken, uint256 lpTokenAmount, uint256[] orderedMinimumUnderlyingTokenAmountsOut, CurveGauge gauge, bytes4 selector)`
RemoveLiquidity remove_liquidity = 4;
// Represents function `removeLiquidityETH(address pool, ERC20 lpToken, uint256 lpTokenAmount, uint256[] orderedMinimumUnderlyingTokenAmountsOut, bool useUnderlying, CurveGauge gauge, bytes4 selector)`
RemoveLiquidityETH remove_liquidity_eth = 5;
// Represents function `stakeInGauge(ERC20 lpToken, CurveGauge gauge, uint256 amount, CurvePool pool, bytes4 selector)`
StakeInGauge stake_in_gauge = 6;
// Represents function `unstakeFromGauge(CurveGauge gauge, uint256 amount)`
UnstakeFromGauge unstake_from_gauge = 7;
// Represents function `claimRewards(CurveGauge gauge)`
ClaimRewards claim_rewards = 8;
}

/*
* Allows strategist to add liquidity to Curve pairs that do NOT use the native asset.
*
* Represents function `addLiquidity(address pool, ERC20 lpToken, uint256[] orderedUnderlyingTokenAmounts, uint256 minLPAmount, CurveGauge gauge, bytes4 selector)`
*/
message AddLiquidity {
// Address of the Curve pool
string pool = 1;
// Address of the LP token
string lp_token = 2;
// Minimum amount of each underlying token to receive
repeated string ordered_underlying_token_amounts = 3;
// Minimum amount of LP tokens to receive
string min_lp_amount = 4;
// Address of the Curve gauge
string gauge = 5;
// Selector of the function to call
string selector = 6;
}

/*
* Allows strategist to add liquidity to Curve pairs that use the native asset.
*
* Represents function `addLiquidityETH(address pool, ERC20 lpToken, uint256[] orderedUnderlyingTokenAmounts, uint256 minLPAmount, bool useUnderlying, CurveGauge gauge, bytes4 selector)`
*/
message AddLiquidityETH {
// Address of the Curve pool
string pool = 1;
// Address of the LP token
string lp_token = 2;
EricBolten marked this conversation as resolved.
Show resolved Hide resolved
// Minimum amount of each underlying token to receive
repeated string ordered_underlying_token_amounts = 3;
// Minimum amount of LP tokens to receive
string min_lp_amount = 4;
// Whether to use the underlying asset or the wrapped asset
bool use_underlying = 5;
// Address of the Curve gauge
string gauge = 6;
// Selector of the function to call
string selector = 7;
}

/*
* Allows strategist to remove liquidity from Curve pairs that do NOT use the native asset.
*
* Represents function `removeLiquidity(address pool, ERC20 lpToken, uint256 lpTokenAmount, uint256[] orderedMinimumUnderlyingTokenAmountsOut, CurveGauge gauge, bytes4 selector)`
*/
message RemoveLiquidity {
// Address of the Curve pool
string pool = 1;
// Address of the LP token
string lp_token = 2;
// Amount of LP tokens to remove
string lp_token_amount = 3;
// Minimum amount of each underlying token to receive
repeated string ordered_minimum_underlying_token_amounts_out = 4;
// Address of the Curve gauge
string gauge = 5;
// Selector of the function to call
string selector = 6;
}

/*
* Allows strategist to remove liquidity from Curve pairs that use the native asset.
*
* Represents function `removeLiquidityETH(address pool, ERC20 lpToken, uint256 lpTokenAmount, uint256[] orderedMinimumUnderlyingTokenAmountsOut, bool useUnderlying, CurveGauge gauge, bytes4 selector)`
*/
message RemoveLiquidityETH {
// Address of the Curve pool
string pool = 1;
// Address of the LP token
string lp_token = 2;
// Amount of LP tokens to remove
string lp_token_amount = 3;
// Minimum amount of each underlying token to receive
repeated string ordered_minimum_underlying_token_amounts_out = 4;
// Whether to use the underlying asset or the wrapped asset
bool use_underlying = 5;
// Address of the Curve gauge
string gauge = 6;
// Selector of the function to call
string selector = 7;
}

/*
* Allows strategist to stake Curve LP tokens in their gauge.
*
* Represents function `stakeInGauge(ERC20 lpToken, CurveGauge gauge, uint256 amount, CurvePool pool, bytes4 selector)`
*/
message StakeInGauge {
// Address of the LP token
string lp_token = 1;
// Address of the Curve gauge
string gauge = 2;
// Amount of LP tokens to stake
string amount = 3;
// Address of the Curve pool
string pool = 4;
// Selector of the function to call
string selector = 5;
}

/*
* Allows strategist to unstake Curve LP tokens from their gauge.
*
* Represents function `unstakeFromGauge(CurveGauge gauge, uint256 amount)`
*/
message UnstakeFromGauge {
// Address of the Curve gauge
string gauge = 1;
// Amount of LP tokens to unstake
string amount = 2;
}

/*
* Allows strategist to claim rewards from a gauge.
*
* Represents function `claimRewards(CurveGauge gauge)`
*/
message ClaimRewards {
// Address of the Curve gauge
string gauge = 1;
}
}

message CurveAdaptorV1Calls {
repeated CurveAdaptorV1 calls = 1;
}
Loading
Loading