-
Notifications
You must be signed in to change notification settings - Fork 17
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: Frax Debt/Collateral adaptors + permission updates #223
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4c10660
ABI for Legacy Cellar, Debt F Token, and Collateral F Token adaptors
cbrit 7d473fb
Protos
cbrit 236a84c
Handlers for Debt/Collateral F token and Legacy Cellar adaptors
cbrit 7681904
Rename legacy cellar const, add new permissions
cbrit 3137d37
Review items
cbrit 6bf8aaf
Remove old permissions
cbrit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a dumb question but sanity checking: all the other Fraxlend functions start with the
IFToken
, is this an error or just an anomaly?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they just changed the param name in the latest contracts, they are still
address
underneathThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was referring to the order in the function call rather than the
IFToken
type.