Skip to content

Commit

Permalink
feat:porting over add adaptor/position/oracle/price router permission…
Browse files Browse the repository at this point in the history
… structure (#246)

* Restore permission structure for SP calls to add adaptor/position

* Remove AddPosition changes for v2.2 Cellars

* Go protos

* Port the rest of the protos to SP API

* Remove functions mistakenly added to SP API, force position out one off stuff

* Remove unnecessary checks
  • Loading branch information
cbrit committed Feb 4, 2024
1 parent 2997b55 commit f9b55d2
Show file tree
Hide file tree
Showing 8 changed files with 5,200 additions and 2,166 deletions.
305 changes: 271 additions & 34 deletions proto/steward/v4/cellar_v2.proto
Original file line number Diff line number Diff line change
Expand Up @@ -46,37 +46,38 @@ import "curve.proto";
*/
message CellarV2 {
// The function you wish to execute on the target cellar
oneof function {
// Represents function `addPosition(uint256 index, address position)`
AddPosition add_position = 1;
oneof function {
// Represents function `callOnAdaptor(AdaptorCall[] memory data)`
CallOnAdaptor call_on_adaptor = 2;
CallOnAdaptor call_on_adaptor = 1;
// Represents function `removePosition(uint256 index)`
RemovePosition remove_position = 3;
RemovePosition remove_position = 2;
// Represents function `setHoldingPosition(uint32 position_id)`
SetHoldingPosition set_holding_position = 4;
SetHoldingPosition set_holding_position = 3;
// Represents function `setStrategistPayoutAddress(address payout)`
SetStrategistPayoutAddress set_strategist_payout_address = 5;
SetStrategistPayoutAddress set_strategist_payout_address = 4;
// Represents function `swapPositions(uint256 index1, uint256 index2)`
SwapPositions swap_positions = 6;
SwapPositions swap_positions = 5;
// Represents function `setShareLockPeriod(uint256 newLock)`
SetShareLockPeriod set_share_lock_period = 7;
}
SetShareLockPeriod set_share_lock_period = 6;

/*
* Insert a trusted position to the list of positions used by the cellar at a given index.
*
* Represents function `addPosition(uint32 index, uint32 positionId, bytes configurationData, bool inDebtArray)`
*/
message AddPosition {
// Index at which to add the position
uint32 index = 1;
// The position's ID in the cellar registry
uint32 position_id = 2;
// Data used to configure how the position behaves
bytes configuration_data = 3;
// Whether to add position in the debt array, or the credit array.
bool in_debt_array = 4;
// TEMPORARY
// These are governance functions, but will be allowed in a limited capacity for SPs while
// the new governance model is still in early adoption for emergencies.

// Represents function `addPosition(uint256 index, address position)`
AddPosition add_position = 7;
// Represents function `setupAdaptor(address adaptor)`
SetupAdaptor setup_adaptor = 8;
// Represents function `initiateShutdown()`
InitiateShutdown initiate_shutdown = 9;
// Represents function `liftShutdown()`
LiftShutdown lift_shutdown = 10;
// Represents function `setPlatformFee(uint256)`
SetPlatformFee set_platform_fee = 11;
// Represents function `setStrategistPlatformCut(address)`
SetStrategistPlatformCut set_strategist_platform_cut = 12;
// Represents function `setRebalanceDeviation(uint256)`
SetRebalanceDeviation set_rebalance_deviation = 13;
}

/*
Expand Down Expand Up @@ -141,6 +142,63 @@ message CellarV2 {
message SetShareLockPeriod {
string new_lock = 1;
}

/*
* Insert a trusted position to the list of positions used by the cellar at a given index.
*
* Represents function `addPosition(uint32 index, uint32 positionId, bytes configurationData, bool inDebtArray)`
*/
message AddPosition {
// Index at which to add the position
uint32 index = 1;
// The position's ID in the cellar registry
uint32 position_id = 2;
// Data used to configure how the position behaves
bytes configuration_data = 3;
// Whether to add position in the debt array, or the credit array.
bool in_debt_array = 4;
}

// Represents function `initiateShutdown()`
message InitiateShutdown {
}

// Represents function `liftShutdown()`
message LiftShutdown {
}

// Represents function `setPlatformFee(uint64)`
message SetPlatformFee {
// New platform fee
uint64 amount = 1;
}

// Represents function `setStrategistPlatformCut(uint64)`
message SetStrategistPlatformCut {
// New strategist platform cut
uint64 amount = 1;
}

/*
* Allows owner to add new adaptors for the cellar to use.
*
* Represents function `setupAdaptor(address adaptor)`
*/
message SetupAdaptor {
// Address of the adaptor
string adaptor = 1;
}

/*
* Changes the cellar's allowed rebalance deviation, which is the percent the total assets of a cellar may deviate
* during a `callOnAdaptor`(rebalance) call. The maximum allowed deviation is 100000000000000000 (0.1e18), or 10%.
*
* Represents function `setRebalanceDeviation(uint256)`
*/
message SetRebalanceDeviation {
string new_deviation = 1;
}

}

/*
Expand Down Expand Up @@ -231,6 +289,27 @@ message CellarV2_2 {
SetStrategistPayoutAddress set_strategist_payout_address = 7;
// Represents function `swapPositions(uint256 index1, uint256 index2)`
SwapPositions swap_positions = 8;

// TEMPORARY
// These are governance functions, but will be allowed in a limited capacity for SPs while
// the new governance model is still in early adoption for emergencies.

// Represents function `addAdaptorToCatalogue(address adaptor)`
AddAdaptorToCatalogue add_adaptor_to_catalogue = 9;
// Represents function `addPositionToCatalogue(uint32 positionId)`
AddPositionToCatalogue add_position_to_catalogue = 10;
// Represents function `setRebalanceDeviation(uint265)`
SetRebalanceDeviation set_rebalance_deviation = 11;
// Represents function `setShareLockPeriod(uint256 newLock)`
SetShareLockPeriod set_share_lock_period = 12;
// Represents function `setStrategistPlatformCut(uint64 cut)`
SetStrategistPlatformCut set_strategist_platform_cut = 13;
// Represents function `initiateShutdown()`
InitiateShutdown initiate_shutdown = 14;
// Represents function `liftShutdown()`
LiftShutdown lift_shutdown = 15;
// Represents function `cachePriceRouter(bool checkTotalAssets, uint16 allowableRange, address expectedPriceRouter)`
CachePriceRouter cache_price_router = 16;
}
}

Expand Down Expand Up @@ -330,6 +409,82 @@ message CellarV2_2 {
message Multicall {
repeated FunctionCall function_calls = 1;
}

/*
* Allows the owner to add an adaptor to the Cellar's adaptor catalogue
*
* Represents function `addAdaptorToCatalogue(address adaptor)`
*/
message AddAdaptorToCatalogue {
string adaptor = 1;
}

/*
* Allows the owner to add a position to the Cellar's position catalogue
*
* Represents function `addPositionToCatalogue(uint32 positionId)`
*/
message AddPositionToCatalogue {
uint32 position_id = 1;
}

/*
* Allows share lock period to be updated.
*
* Represents function `setShareLockPeriod()`
*/
message SetShareLockPeriod {
string new_lock = 1;
}

/*
* Changes the cellar's allowed rebalance deviation, which is the percent the total assets of a cellar may deviate
* during a `callOnAdaptor`(rebalance) call. The maximum allowed deviation is 100000000000000000 (0.1e18), or 10%.
*
* Represents function `setRebalanceDeviation(uint256)`
*/
message SetRebalanceDeviation {
string new_deviation = 1;
}

/*
* Shutdown the cellar. Used in an emergency or if the cellar has been deprecated.
*
* Represents function `initiateShutdown()`
*/
message InitiateShutdown {}

/*
* Allows strategist to set the platform cut for the cellar.
*
* Represents function `setStrategistPlatformCut(uint64 cut)`
*/
message SetStrategistPlatformCut {
// The new strategist platform cut
uint64 new_cut = 1;
}

/*
* Allows the owner to restart a shut down Cellar
*
* Represents function `liftShutdown()`
*/
message LiftShutdown {}

/*
* Updates the cellar to use the latest price router in the registry.
*
* Represents function `cachePriceRouter(bool checkTotalAssets, uint16 allowableRange, address expectedPriceRouter)`
*/
message CachePriceRouter {
// Whether to check the total assets of the cellar
bool check_total_assets = 1;
// The allowable range of the cellar's total assets to deviate between old and new routers
uint32 allowable_range = 2;
// The expected price router address
string expected_price_router = 3;
}

}

/*
Expand Down Expand Up @@ -495,6 +650,25 @@ message CellarV2_5 {
SetAlternativeAssetData set_alternative_asset_data = 17;
// Represents function `setDropAlternativeAssetData(ERC20 _alternativeAsset)`
DropAlternativeAssetData drop_alternative_asset_data = 18;

// TEMPORARY
// These are governance functions, but will be allowed in a limited capacity for SPs while
// the new governance model is still in early adoption for emergencies.

// Represents function `addAdaptorToCatalogue(address adaptor)`
AddAdaptorToCatalogue add_adaptor_to_catalogue = 19;
// Represents function `addPositionToCatalogue(uint32 positionId)`
AddPositionToCatalogue add_position_to_catalogue = 20;
// Represents function `setRebalanceDeviation(uint265)`
SetRebalanceDeviation set_rebalance_deviation = 21;
// Represents function `setStrategistPlatformCut(uint64 cut)`
SetStrategistPlatformCut set_strategist_platform_cut = 22;
// Represents function `setSharePriceOracle(uint256 _registryId, ERC4626SharePriceOracle _sharePriceOracle)`
SetSharePriceOracle set_share_price_oracle = 23;
// Represents function `increaseShareSupplyCap(uint192 _newShareSupplyCap)`
IncreaseShareSupplyCap increase_share_supply_cap = 24;
// Represents function `cachePriceRouter(bool checkTotalAssets, uint16 allowableRange, address expectedPriceRouter)`
CachePriceRouter cache_price_router = 25;
}
}

Expand Down Expand Up @@ -577,16 +751,6 @@ message CellarV2_5 {
string new_lock = 1;
}

/*
* Changes the cellar's allowed rebalance deviation, which is the percent the total assets of a cellar may deviate
* during a `callOnAdaptor`(rebalance) call. The maximum allowed deviation is 100000000000000000 (0.1e18), or 10%.
*
* Represents function `setRebalanceDeviation(uint256)`
*/
message SetRebalanceDeviation {
string new_deviation = 1;
}

/*
* Shutdown the cellar. Used in an emergency or if the cellar has been deprecated.
*
Expand Down Expand Up @@ -660,6 +824,79 @@ message CellarV2_5 {
// The address of the alternative asset
string alternative_asset = 1;
}

/*
* Allows the owner to add an adaptor to the Cellar's adaptor catalogue
*
* Represents function `addAdaptorToCatalogue(address adaptor)`
*/
message AddAdaptorToCatalogue {
string adaptor = 1;
}

/*
* Allows the owner to add a position to the Cellar's position catalogue
*
* Represents function `addPositionToCatalogue(uint32 positionId)`
*/
message AddPositionToCatalogue {
uint32 position_id = 1;
}

/*
* Changes the cellar's allowed rebalance deviation, which is the percent the total assets of a cellar may deviate
* during a `callOnAdaptor`(rebalance) call. The maximum allowed deviation is 100000000000000000 (0.1e18), or 10%.
*
* Represents function `setRebalanceDeviation(uint256)`
*/
message SetRebalanceDeviation {
string new_deviation = 1;
}

/*
* Allows strategist to set the platform cut for the cellar.
*
* Represents function `setStrategistPlatformCut(uint64 cut)`
*/
message SetStrategistPlatformCut {
// The new strategist platform cut
uint64 new_cut = 1;
}

/*
* Allows the caller to increase the share supply cap
*
* Represents function `increaseShareSupplyCap(uint192 _newShareSupplyCap)`
*/
message IncreaseShareSupplyCap {
string new_cap = 1;
}

/*
* Allows the caller to set the share price oracle contract
*
* Represents function `setSharePriceOracle(uint256 _registryId, ERC4626SharePriceOracle _sharePriceOracle)`
*/
message SetSharePriceOracle {
// The oracle registry ID
string registry_id = 1;
// The oracle contract address
string share_price_oracle = 2;
}

/*
* Updates the cellar to use the latest price router in the registry.
*
* Represents function `cachePriceRouter(bool checkTotalAssets, uint16 allowableRange, address expectedPriceRouter)`
*/
message CachePriceRouter {
// Whether to check the total assets of the cellar
bool check_total_assets = 1;
// The allowable range of the cellar's total assets to deviate between old and new routers
uint32 allowable_range = 2;
// The expected price router address
string expected_price_router = 3;
}
}

/*
Expand Down
Loading

0 comments on commit f9b55d2

Please sign in to comment.