-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Frax Debt/Collateral adaptors + permission updates (#223)
* ABI for Legacy Cellar, Debt F Token, and Collateral F Token adaptors * Protos * Handlers for Debt/Collateral F token and Legacy Cellar adaptors * Rename legacy cellar const, add new permissions * Review items * Remove old permissions
- Loading branch information
Showing
34 changed files
with
20,196 additions
and
979 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Protos for function calls to the Frax Collateral F Token adaptor. | ||
*/ | ||
|
||
syntax = "proto3"; | ||
package steward.v3; | ||
|
||
option go_package = "/steward_proto"; | ||
|
||
import "adaptors/base.proto"; | ||
|
||
// Represents call data for the Frax Collateral F Token adaptor. | ||
message CollateralFTokenAdaptorV1 { | ||
oneof function { | ||
/***** BASE ADAPTOR FUNCTIONS *****/ | ||
|
||
// Represents function `revokeApproval(ERC20 asset, address spender)` | ||
RevokeApproval revoke_approval = 1; | ||
|
||
/***** ADAPTOR-SPECIFIC FUNCTIONS *****/ | ||
|
||
// Represents function `addCollateral(IFToken _fraxlendPair, uint256 _collateralToDeposit)` | ||
AddCollateral add_collateral = 2; | ||
// Represents function `removeCollateral(uint256 _collateralAmount, IFToken _fraxlendPair)` | ||
RemoveCollateral remove_collateral = 3; | ||
} | ||
|
||
/* | ||
* Allows strategists to add collateral to the respective cellar position on FraxLend, enabling borrowing. | ||
* | ||
* Represents function `addCollateral(IFToken _fraxlendPair, uint256 _collateralToDeposit)` | ||
*/ | ||
message AddCollateral { | ||
// The FraxLend pair to add collateral to. | ||
string fraxlend_pair = 1; | ||
// The amount of collateral to add to the cellar position. | ||
string collateral_to_deposit = 2; | ||
} | ||
|
||
/* | ||
* Allows strategists to remove collateral from the respective cellar position on FraxLend. | ||
* | ||
* Represents function `removeCollateral(uint256 _collateralAmount, IFToken _fraxlendPair)` | ||
*/ | ||
message RemoveCollateral { | ||
// The amount of collateral to remove from the cellar position. | ||
string collateral_amount = 1; | ||
// The FraxLend pair to remove collateral from. | ||
string fraxlend_pair = 2; | ||
} | ||
} | ||
|
||
message CollateralFTokenAdaptorV1Calls { | ||
repeated CollateralFTokenAdaptorV1 calls = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Protos for function calls to the Frax Debt F Token adaptor. | ||
*/ | ||
|
||
syntax = "proto3"; | ||
package steward.v3; | ||
|
||
option go_package = "/steward_proto"; | ||
|
||
import "adaptors/base.proto"; | ||
|
||
// Represents call data for the Frax adaptor. | ||
message DebtFTokenAdaptorV1 { | ||
oneof function { | ||
/***** BASE ADAPTOR FUNCTIONS *****/ | ||
|
||
// Represents function `revokeApproval(ERC20 asset, address spender)` | ||
RevokeApproval revoke_approval = 1; | ||
|
||
/***** ADAPTOR-SPECIFIC FUNCTIONS *****/ | ||
|
||
// Represents function `borrowFromFraxlend(IFToken fraxlendPair, uint256 amountToBorrow)` | ||
BorrowFromFraxlend borrow_from_fraxlend = 2; | ||
// Represents function `repayFraxlendDebt(IFToken _fraxlendPair, uint256 _debtTokenRepayAmount)` | ||
RepayFraxlendDebt repay_fraxlend_debt = 3; | ||
// Represents function `callAddInterest(IFToken _fraxlendPair)` | ||
CallAddInterest call_add_interest = 4; | ||
} | ||
|
||
/* | ||
* Allows a strategist to borrow assets from Fraxlend | ||
* | ||
* Represents `function borrowFromFraxlend(IFToken fraxlendPair, uint256 amountToBorrow)` | ||
*/ | ||
message BorrowFromFraxlend { | ||
// The address of the Frax Pair to borrow from. | ||
string fraxlend_pair = 1; | ||
// The amount of the asset to borrow. | ||
string amount_to_borrow = 2; | ||
} | ||
|
||
/* | ||
* Allows strategists to repay loan debt on Fraxlend Pair. | ||
* Make sure to call addInterest() beforehand to ensure we are repaying what is required. | ||
* | ||
* Represents `function repayFraxlendDebt(IFToken _fraxlendPair, uint256 _debtTokenRepayAmount)` | ||
*/ | ||
message RepayFraxlendDebt { | ||
// The address of the Frax Pair to repay debt on. | ||
string fraxlend_pair = 1; | ||
// The amount of the debt token to repay. | ||
string debt_token_repay_amount = 2; | ||
} | ||
|
||
/* | ||
* Allows a strategist to call `addInterest` on a Frax Pair they are using | ||
* | ||
* Represents `function callAddInterest(IFToken _fraxlendPair)` | ||
*/ | ||
message CallAddInterest { | ||
// The address of the pair to call addInterest on. | ||
string fraxlend_pair = 1; | ||
} | ||
} | ||
|
||
message DebtFTokenAdaptorV1Calls { | ||
repeated DebtFTokenAdaptorV1 calls = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Protos for depositing/withdrawing from Legacy Cellars | ||
|
||
syntax = "proto3"; | ||
package steward.v3; | ||
|
||
option go_package = "/steward_proto"; | ||
|
||
import "adaptors/base.proto"; | ||
|
||
message LegacyCellarAdaptorV1 { | ||
oneof function { | ||
/***** BASE ADAPTOR FUNCTIONS *****/ | ||
|
||
// Represents function `revokeApproval(ERC20 asset, address spender)` | ||
RevokeApproval revoke_approval = 1; | ||
|
||
/***** ADAPTOR-SPECIFIC FUNCTIONS *****/ | ||
|
||
// Represents function `depositToCellar(Cellar cellar, uint256 assets, address oracle)` | ||
DepositToCellar depositToCellar = 2; | ||
// Represents function `withdrawFromCellar(Cellar cellar, uint256 assets, address oracle)` | ||
WithdrawFromCellar withdrawFromCellar = 3; | ||
} | ||
|
||
/* | ||
* Allows strategists to deposit into Cellar positions. | ||
* | ||
* Represents function `depositToCellar(Cellar cellar, uint256 assets, address oracle)` | ||
*/ | ||
message DepositToCellar { | ||
string cellar = 1; | ||
string assets = 2; | ||
string oracle = 3; | ||
} | ||
|
||
/* | ||
* Allows strategists to withdraw from Cellar positions. | ||
* | ||
* Represents function `withdrawFromCellar(Cellar cellar, uint256 assets, address oracle)` | ||
*/ | ||
message WithdrawFromCellar { | ||
string cellar = 1; | ||
string assets = 2; | ||
string oracle = 3; | ||
} | ||
} | ||
|
||
message LegacyCellarAdaptorV1Calls { | ||
repeated LegacyCellarAdaptorV1 calls = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[package] | ||
name = "steward" | ||
authors = [] | ||
version = "3.4.3" | ||
version = "3.5.0" | ||
edition = "2018" | ||
|
||
[dependencies] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.