Entity–relationship model with roles

Contracts

BasketManager

Roles

RoleDescriptionPrivilegesControlled By
_MANAGER_ROLEManagers can create new baskets.createNewBasket, collectSwapFeeAssigned during contract initialization.
_PAUSER_ROLECan pause the contract.pauseAssigned during contract initialization.
_REBALANCE_PROPOSER_ROLECan propose a new rebalance.proposeRebalanceAssigned during contract initialization.
_TOKENSWAP_PROPOSER_ROLECan propose a new token swap.proposeTokenSwapAssigned during contract initialization.
_TOKENSWAP_EXECUTOR_ROLECan execute a token swap.executeTokenSwapAssigned during contract initialization.
_TIMELOCK_ROLECan set critical parameters like fees and adapters.setManagementFee, setSwapFee, setTokenSwapAdapterAssigned during contract initialization.
_BASKET_TOKEN_ROLERole given to basket token contracts when created.proRataRedeemAssigned dynamically during basket creation.

Functions

Function NameRequired RolesDescription
createNewBasket_MANAGER_ROLECreates a new basket token with the given parameters.
proposeRebalance_REBALANCE_PROPOSER_ROLEProposes a rebalance for the given baskets.
proposeTokenSwap_TOKENSWAP_PROPOSER_ROLEProposes internal and external trades for rebalancing baskets.
executeTokenSwap_TOKENSWAP_EXECUTOR_ROLEExecutes token swaps proposed in proposeTokenSwap.
setManagementFee_TIMELOCK_ROLESets the management fee for a basket.
setSwapFee_TIMELOCK_ROLESets the swap fee for the protocol.
setTokenSwapAdapter_TIMELOCK_ROLESets the address of the TokenSwapAdapter contract.
pause_PAUSER_ROLE or DEFAULT_ADMIN_ROLEPauses the contract.
unpauseDEFAULT_ADMIN_ROLEUnpauses the contract.
collectSwapFee_MANAGER_ROLEClaims the swap fee for a given asset and sends it to the protocol treasury.

Notes

  • The _TIMELOCK_ROLE is critical for setting parameters that affect the protocol’s operation, such as fees and adapters.
  • _BASKET_TOKEN_ROLE is dynamically assigned to basket tokens during their creation, allowing them to call specific functions like proRataRedeem.

BasketToken

Roles

RoleDescriptionPrivilegesControlled By
_BASKET_MANAGERAddress of the BasketManager contract.fulfillDeposit, fulfillRedeem, fallbackRedeemTrigger, prepareForRebalanceAssigned during initialization.

Functions

Function NameRequired RolesDescription
fulfillDeposit_BASKET_MANAGERFulfills all pending deposit requests.
fulfillRedeem_BASKET_MANAGERFulfills all pending redeem requests.
fallbackRedeemTrigger_BASKET_MANAGERTriggers fallback logic for failed redemption fulfillment.
prepareForRebalance_BASKET_MANAGERPrepares the basket for rebalance by advancing the epoch.

Notes

  • The _BASKET_MANAGER role is hardcoded to the BasketManager contract, ensuring only the manager can call critical functions.
  • The contract uses a fallback mechanism for failed redemptions, which is triggered by the BasketManager.

FeeCollector

Roles

RoleDescriptionPrivilegesControlled By
DEFAULT_ADMIN_ROLEAdmin role with full control over the contract.setProtocolTreasury, setSponsor, setSponsorSplitAssigned during contract initialization.
_BASKET_TOKEN_ROLERole for basket tokens to notify fees.notifyHarvestFeeAssigned dynamically by BasketManager.

Functions

Function NameRequired RolesDescription
setProtocolTreasuryDEFAULT_ADMIN_ROLESets the protocol treasury address.
setSponsorDEFAULT_ADMIN_ROLESets the sponsor for a given basket token.
setSponsorSplitDEFAULT_ADMIN_ROLESets the sponsor fee split for a given basket token.
notifyHarvestFee_BASKET_TOKEN_ROLENotifies the FeeCollector of fees collected from a basket token.
claimSponsorFeeNone (only callable by sponsor)Claims the sponsor fee for a given basket token.
claimTreasuryFeeNone (only callable by treasury)Claims the treasury fee for a given basket token.

Notes

  • The _BASKET_TOKEN_ROLE is dynamically assigned by the BasketManager to basket tokens, allowing them to notify fees.
  • Only the protocol treasury or admin can claim treasury fees.

AssetRegistry

Roles

RoleDescriptionPrivilegesControlled By
_MANAGER_ROLERole responsible for managing assets in the registry.addAsset, setAssetStatusAssigned during contract initialization.

Functions

Function NameRequired RolesDescription
addAsset_MANAGER_ROLEAdds a new asset to the registry.
setAssetStatus_MANAGER_ROLESets the status of an asset in the registry.

Notes

  • The _MANAGER_ROLE is critical for adding and managing assets in the registry.
  • The contract uses a bit flag system to represent enabled assets, which is updated dynamically based on asset status.

StrategyRegistry

Roles

RoleDescriptionPrivilegesControlled By
_WEIGHT_STRATEGY_ROLERole given to approved weight strategies.None (used for validation in supportsBitFlag)Assigned during contract initialization.

Functions

Function NameRequired RolesDescription
supportsBitFlagNone (validates _WEIGHT_STRATEGY_ROLE)Checks if a given weight strategy supports a specific bit flag.

Notes

  • The _WEIGHT_STRATEGY_ROLE is used to validate weight strategies before calling their supportsBitFlag function.

ManagedWeightStrategy

Roles

RoleDescriptionPrivilegesControlled By
_MANAGER_ROLERole for managing target weights.setTargetWeightsAssigned during contract initialization.
DEFAULT_ADMIN_ROLEAdmin role with full control over the contract.Assigned during contract initialization.

Functions

Function NameRequired RolesDescription
setTargetWeights_MANAGER_ROLESets the target weights for the assets for the next epoch.

Notes

  • The _MANAGER_ROLE is critical for setting target weights, which directly affect the strategy’s behavior.
  • The contract uses a mapping to store target weights for each rebalance epoch and bit flag.