Skip to content

Commit

Permalink
Morpho adaptors
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrit committed Jun 27, 2023
1 parent 7196d65 commit 1a3d3c1
Show file tree
Hide file tree
Showing 60 changed files with 39,092 additions and 612 deletions.
15 changes: 15 additions & 0 deletions proto/adaptors/aave/aave_v3_debt_token.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ import "adaptors/aave/aave_v3_a_token.proto";
import "adaptors/compound/c_token.proto";
import "adaptors/balancer/balancer_pool.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";
import "adaptors/morpho/morpho_aave_v3_a_token_collateral.proto";
import "adaptors/morpho/morpho_aave_v3_a_token_p2p.proto";
import "adaptors/morpho/morpho_aave_v3_debt_token.proto";
import "adaptors/uniswap/uniswap_v3.proto";
import "adaptors/uniswap/swap_with_uniswap.proto";
import "adaptors/fees_and_reserves.proto";
Expand Down Expand Up @@ -137,6 +142,16 @@ message AaveV3DebtTokenAdaptorV1 {
BalancerPoolAdaptorV1Calls balancer_pool_v1_calls = 18;
// Represents function calls to the FTokenAdaptor V1
FTokenAdaptorV1Calls f_token_v1_calls = 19;
// Represents function calls to the MorphoAaveV2AToken V1
MorphoAaveV2ATokenAdaptorV1Calls morpho_aave_v2_a_token_v1_calls = 20;
// Represents function calls to the MorphoAaveV2DebtToken V1
MorphoAaveV2DebtTokenAdaptorV1Calls morpho_aave_v2_debt_token_v1_calls = 21;
// Represents function calls to the MorphoAaveV3ATokenCollateral V1
MorphoAaveV3ATokenCollateralAdaptorV1Calls morpho_aave_v3_a_token_collateral_v1_calls = 22;
// Represents function calls to the MorphoAaveV3ATokenP2P V1
MorphoAaveV3ATokenP2PAdaptorV1Calls morpho_aave_v3_a_token_p2p_v1_calls = 23;
// Represents function calls to the MorphoAaveV3DebtToken V1
MorphoAaveV3DebtTokenAdaptorV1Calls morpho_aave_v3_debt_token_v1_calls = 24;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions proto/adaptors/balancer/balancer_pool.proto
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Protos for function calls to the Compound CToken adaptor.
* Protos for function calls to the Balancer Pool adaptor.
*/

syntax = "proto3";
Expand All @@ -9,7 +9,7 @@ option go_package = "/steward_proto";

import "adaptors/base.proto";

// Represents call data for the Compound C Token adaptor V2, managing lending positions on Compound.
// Represents call data for the Balancer Pool adaptor V1, for managing pool positions on Balancer.
message BalancerPoolAdaptorV1 {
oneof function {
/***** BASE ADAPTOR FUNCTIONS *****/
Expand Down
4 changes: 2 additions & 2 deletions proto/adaptors/frax/f_token.proto
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Protos for function calls to the OneInch adaptor.
* Protos for function calls to the Frax adaptor.
*/

syntax = "proto3";
Expand All @@ -9,7 +9,7 @@ option go_package = "/steward_proto";

import "adaptors/base.proto";

// Represents call data for the OneInch adaptor.
// Represents call data for the Frax adaptor.
message FTokenAdaptorV1 {
oneof function {
/***** BASE ADAPTOR FUNCTIONS *****/
Expand Down
58 changes: 58 additions & 0 deletions proto/adaptors/morpho/morpho_aave_v2_a_token.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Protos for function calls to the Morpho Aave V2 AToken adaptor.
*/

syntax = "proto3";
package steward.v3;

option go_package = "/steward_proto";

import "adaptors/base.proto";

// Represents call data for the Morpho Aave V2 AToken adaptor.
message MorphoAaveV2ATokenAdaptorV1 {
oneof function {
/***** BASE ADAPTOR FUNCTIONS *****/

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

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

// Represents function `depositToAaveV2Morpho(IAaveToken aToken, uint256 amountToDeposit)`
DepositToAaveV2Morpho deposit_to_aave_v2_morpho = 2;
// Represents function `withdrawFromAaveV2Morpho(IAaveToken aToken, uint256 amountToWithdraw)`
WithdrawFromAaveV2Morpho withdraw_from_aave_v2_morpho = 3;
}

/*
* Allows strategists to lend assets on Morpho.
*
* Represents function `depositToAaveV2Morpho(IAaveToken aToken, uint256 amountToDeposit)`
*/
message DepositToAaveV2Morpho {
// The address of the Aave V2 aToken to deposit to.
string a_token = 1;

// The amount of the asset to deposit.
string amount_to_deposit = 2;
}

/*
* Allows strategists to withdraw assets from Morpho.
*
* Represents function `withdrawFromAaveV2Morpho(IAaveToken aToken, uint256 amountToWithdraw)`
*/
message WithdrawFromAaveV2Morpho {
// The address of the Aave V2 aToken to withdraw from.
string a_token = 1;

// The amount of the asset to withdraw.
string amount_to_withdraw = 2;
}

}

message MorphoAaveV2ATokenAdaptorV1Calls {
repeated MorphoAaveV2ATokenAdaptorV1 calls = 1;
}
58 changes: 58 additions & 0 deletions proto/adaptors/morpho/morpho_aave_v2_debt_token.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Protos for function calls to the Morpho Aave V2 Debt Token adaptor.
*/

syntax = "proto3";
package steward.v3;

option go_package = "/steward_proto";

import "adaptors/base.proto";

// Represents call data for the Morpho Aave V2 Debt Token adaptor.
message MorphoAaveV2DebtTokenAdaptorV1 {
oneof function {
/***** BASE ADAPTOR FUNCTIONS *****/

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

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

// Represents function `borrowFromAaveV2Morpho(address aToken, uint256 amountToBorrow)`
BorrowFromAaveV2Morpho borrow_from_aave_v2_morpho = 2;
// Represents function `repayAaveV2MorphoDebt(IAaveToken aToken, uint256 amountToRepay)`
RepayAaveV2MorphoDebt repay_aave_v2_morpho_debt = 3;
}

/*
* Allows strategists to borrow assets from Aave.
*
* Represents function `borrowFromAaveV2Morpho(address aToken, uint256 amountToBorrow)`
*/
message BorrowFromAaveV2Morpho {
// The address of the Aave V2 aToken to borrow.
string a_token = 1;

// The amount of the asset to borrow.
string amount_to_borrow = 2;
}

/*
* Allows strategists to repay loan debt on Aave.
*
* Represents function `repayAaveV2MorphoDebt(IAaveToken aToken, uint256 amountToRepay)`
*/
message RepayAaveV2MorphoDebt {
// The address of the Aave V2 aToken to repay.
string a_token = 1;

// The amount of the asset to repay.
string amount_to_repay = 2;
}

}

message MorphoAaveV2DebtTokenAdaptorV1Calls {
repeated MorphoAaveV2DebtTokenAdaptorV1 calls = 1;
}
57 changes: 57 additions & 0 deletions proto/adaptors/morpho/morpho_aave_v3_a_token_collateral.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Protos for function calls to the Morpho Aave V3 AToken Collateral adaptor.
*/

syntax = "proto3";
package steward.v3;

option go_package = "/steward_proto";

import "adaptors/base.proto";

// Represents call data for the Morpho Aave V3 AToken Collateral adaptor.
message MorphoAaveV3ATokenCollateralAdaptorV1 {
oneof function {
/***** BASE ADAPTOR FUNCTIONS *****/

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

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

// Represents function `depositToAaveV3Morpho(ERC20 tokenToDeposit, uint256 amountToDeposit)`
DepositToAaveV3Morpho deposit_to_aave_v3_morpho = 2;
// Represents function `withdrawFromAaveV3Morpho(ERC20 tokenToWithdraw, uint256 amountToWithdraw)`
WithdrawFromAaveV3Morpho withdraw_from_aave_v3_morpho = 3;
}

/*
* Allows strategists to lend assets on Morpho
*
* Represents function `depositToAaveV3Morpho(ERC20 tokenToDeposit, uint256 amountToDeposit)`
*/
message DepositToAaveV3Morpho {
// The address of the token to deposit
string token_to_deposit = 1;

// The amount of tokens to deposit
string amount_to_deposit = 2;
}

/*
* Allows strategists to withdraw assets from Morpho
*
* Represents function `withdrawFromAaveV3Morpho(ERC20 tokenToWithdraw, uint256 amountToWithdraw)`
*/
message WithdrawFromAaveV3Morpho {
// The address of the token to withdraw
string token_to_withdraw = 1;

// The amount of tokens to withdraw
string amount_to_withdraw = 2;
}
}

message MorphoAaveV3ATokenCollateralAdaptorV1Calls {
repeated MorphoAaveV3ATokenCollateralAdaptorV1 calls = 1;
}
63 changes: 63 additions & 0 deletions proto/adaptors/morpho/morpho_aave_v3_a_token_p2p.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Protos for function calls to the Morpho Aave V3 AToken P2P adaptor.
*/

syntax = "proto3";
package steward.v3;

option go_package = "/steward_proto";

import "adaptors/base.proto";

// Represents call data for the Morpho Aave V3 A Token P2P adaptor.
message MorphoAaveV3ATokenP2PAdaptorV1 {
oneof function {
/***** BASE ADAPTOR FUNCTIONS *****/

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

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

// Represents function `depositToAaveV3Morpho(ERC20 tokenToDeposit, uint256 amountToDeposit, uint256 maxIterations)`
DepositToAaveV3Morpho deposit_to_aave_v3_morpho = 2;
// Represents function `withdrawFromAaveV3Morpho(ERC20 tokenToWithdraw, uint256 amountToWithdraw, uint256 maxIterations)`
WithdrawFromAaveV3Morpho withdraw_from_aave_v3_morpho = 3;
}

/*
* Allows strategists to lend assets on Morpho
*
* Represents function `depositToAaveV3Morpho(ERC20 tokenToDeposit, uint256 amountToDeposit, uint256 maxIterations)`
*/
message DepositToAaveV3Morpho {
// The address of the token to deposit
string token_to_deposit = 1;

// The amount of tokens to deposit
string amount_to_deposit = 2;

// The maximum number of iterations to run
string max_iterations = 3;
}

/*
* Allows strategists to withdraw assets from Morpho
*
* Represents function `withdrawFromAaveV3Morpho(ERC20 tokenToWithdraw, uint256 amountToWithdraw, uint256 maxIterations)`
*/
message WithdrawFromAaveV3Morpho {
// The address of the token to withdraw
string token_to_withdraw = 1;

// The amount of tokens to withdraw
string amount_to_withdraw = 2;

// The maximum number of iterations to run
string max_iterations = 3;
}
}

message MorphoAaveV3ATokenP2PAdaptorV1Calls {
repeated MorphoAaveV3ATokenP2PAdaptorV1 calls = 1;
}
60 changes: 60 additions & 0 deletions proto/adaptors/morpho/morpho_aave_v3_debt_token.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Protos for function calls to the Morpho Aave V3 Debt Token adaptor.
*/

syntax = "proto3";
package steward.v3;

option go_package = "/steward_proto";

import "adaptors/base.proto";

// Represents call data for the Morpho Aave V3 Debt Token adaptor.
message MorphoAaveV3DebtTokenAdaptorV1 {
oneof function {
/***** BASE ADAPTOR FUNCTIONS *****/

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

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

// Represents function `borrowFromAaveV3Morpho(address underlying, uint256 amountToBorrow, uint256 maxIterations)`
BorrowFromAaveV3Morpho borrow_from_aave_v3_morpho = 2;
// Represents function `repayAaveV3MorphoDebt(ERC20 tokenToRepay, uint256 amountToRepay)`
RepayAaveV3MorphoDebt repay_aave_v3_morpho_debt = 3;
}

/*
* Allows strategists to borrow assets from Morpho
*
* Represents function `borrowFromAaveV3Morpho(address underlying, uint256 amountToBorrow, uint256 maxIterations)`
*/
message BorrowFromAaveV3Morpho {
// The underlying asset to borrow
string underlying = 1;

// The amount of the underlying asset to borrow
string amount_to_borrow = 2;

// The maximum number of iterations to perform
string max_iterations = 3;
}

/*
* Allows strategists to repay loan debt on Morpho
*
* Represents function `repayAaveV3MorphoDebt(ERC20 tokenToRepay, uint256 amountToRepay)`
*/
message RepayAaveV3MorphoDebt {
// The token to repay
string token_to_repay = 1;

// The amount of the token to repay
string amount_to_repay = 2;
}
}

message MorphoAaveV3DebtTokenAdaptorV1Calls {
repeated MorphoAaveV3DebtTokenAdaptorV1 calls = 1;
}
15 changes: 15 additions & 0 deletions proto/cellar_v2.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ import "adaptors/aave/aave_v3_debt_token.proto";
import "adaptors/balancer/balancer_pool.proto";
import "adaptors/compound/c_token.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";
import "adaptors/morpho/morpho_aave_v3_a_token_collateral.proto";
import "adaptors/morpho/morpho_aave_v3_a_token_p2p.proto";
import "adaptors/morpho/morpho_aave_v3_debt_token.proto";
import "adaptors/uniswap/uniswap_v3.proto";
import "adaptors/uniswap/swap_with_uniswap.proto";
import "adaptors/fees_and_reserves.proto";
Expand Down Expand Up @@ -404,5 +409,15 @@ message AdaptorCall {
BalancerPoolAdaptorV1Calls balancer_pool_v1_calls = 18;
// Represents function calls to the FTokenAdaptor V1
FTokenAdaptorV1Calls f_token_v1_calls = 19;
// Represents function calls to the MorphoAaveV2AToken V1
MorphoAaveV2ATokenAdaptorV1Calls morpho_aave_v2_a_token_v1_calls = 20;
// Represents function calls to the MorphoAaveV2DebtToken V1
MorphoAaveV2DebtTokenAdaptorV1Calls morpho_aave_v2_debt_token_v1_calls = 21;
// Represents function calls to the MorphoAaveV3ATokenCollateral V1
MorphoAaveV3ATokenCollateralAdaptorV1Calls morpho_aave_v3_a_token_collateral_v1_calls = 22;
// Represents function calls to the MorphoAaveV3ATokenP2P V1
MorphoAaveV3ATokenP2PAdaptorV1Calls morpho_aave_v3_a_token_p2p_v1_calls = 23;
// Represents function calls to the MorphoAaveV3DebtToken V1
MorphoAaveV3DebtTokenAdaptorV1Calls morpho_aave_v3_debt_token_v1_calls = 24;
}
}
1 change: 1 addition & 0 deletions steward/src/cellars/adaptors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pub mod balancer_pool;
pub mod compound;
pub mod f_token;
pub mod fees_and_reserves;
pub mod morpho;
pub mod oneinch;
pub mod sommelier;
pub mod swap_with_uniswap;
Expand Down
Loading

0 comments on commit 1a3d3c1

Please sign in to comment.