Entity–relationship model with roles

Contracts

The community multisig controls DEFAULT_ADMIN_ROLE and _TIMELOCK_ROLE (via the OpenZeppelin TimelockController contract). Other roles will be controlled by an ops multisig, EOAs for OpenZeppelin Defender keepers, and external strategists.

BasketManager

Roles

RoleDescriptionPrivilegesControlled By
_MANAGER_ROLEManagers can create new baskets.createNewBasket, collectSwapFeeDEFAULT_ADMIN_ROLE
_PAUSER_ROLECan pause the contract.pauseDEFAULT_ADMIN_ROLE
_REBALANCE_PROPOSER_ROLECan propose a new rebalance.proposeRebalanceDEFAULT_ADMIN_ROLE
_TOKENSWAP_PROPOSER_ROLECan propose a new token swap.proposeTokenSwapDEFAULT_ADMIN_ROLE
_TOKENSWAP_EXECUTOR_ROLECan execute a token swap.executeTokenSwapDEFAULT_ADMIN_ROLE
_TIMELOCK_ROLECan set critical parameters like fees and adapters.setManagementFee, setSwapFee, setTokenSwapAdapter_TIMELOCK_ROLE
_BASKET_TOKEN_ROLERole given to basket token contracts when created.proRataRedeemDEFAULT_ADMIN_ROLE

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_MANAGERRole given to the associated BasketManager.fulfillDeposit, fulfillRedeem, fallbackRedeemTrigger, prepareForRebalanceN/A

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 only given to the BasketManager contract at the BasketToken creation, ensuring only the BasketManager contract can call critical functions during the rebalance cycle.
  • 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, setSponsorSplitDEFAULT_ADMIN_ROLE
_BASKET_TOKEN_ROLERole given to each BasketToken contractnotifyHarvestFeeDEFAULT_ADMIN_ROLE

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.
claimSponsorFeeDEFAULT_ADMIN_ROLE or SponsorClaims the sponsor fee for a given basket token.
claimTreasuryFeeDEFAULT_ADMIN_ROLE or TreasuryClaims 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, setAssetStatusDEFAULT_ADMIN_ROLE

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
DEFAULT_ADMIN_ROLEAdmin role for managing the contract.Can assign/revoke roles and manage strategies.DEFAULT_ADMIN_ROLE
_WEIGHT_STRATEGY_ROLERole given to approved weight strategies.None (used for validation in supportsBitFlag)DEFAULT_ADMIN_ROLE

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
DEFAULT_ADMIN_ROLEAdmin role responsible for assigning and revoking _MANAGER_ROLE.DEFAULT_ADMIN_ROLE
_MANAGER_ROLERole responsible for managing assets and setting target weights for the assets in the strategy.setTargetWeightsDEFAULT_ADMIN_ROLE

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 bit flag.