Modules
The main modules used in Definitive's contracts are
AccessControl
This module extends OpenZeppelin's AccessControl
, focusing on role management within the system. It defines specific roles like ROLE_CLIENT
, ROLE_DEFINITIVE
, and ROLE_DEFINITIVE_ADMIN
, which can be used to manage permissions and access control within the contract ecosystem.
ROLE_DEFINITIVE
- Definitive's performer address(es)ROLE_CLIENT
- Client wallet(s) (only for dedicated vaults)DEFAULT_ADMIN_ROLE
- The default admin role has role granting and revoking privileges meaning it can remove or add addresses to the two roles above. This role is secured by a multisig account.
For the most part, role assignment is done at the constructor of the strategy. It should be rare to need to grant or revoke additional roles after the strategy has been deployed unless it was some sort of emergency.
Transfers
This module is designed to handle the deposit and withdraw of native blockchain assets alongside ERC20 tokens. . It allows users to deposit and withdraw multiple assets at once, as specified by amounts
and assetAddresses
. The Deposit
and Withdraw
event logs these transactions, making it easy to track deposits on-chain.
The module has rigorous validations to ensure that only the depositors address is able to withdraw from the contract
Rewards
This module is responsible for everything related to the management and distribution of rewards within the system.
The primary function, claimAllRewards
, allows whitelisted addresses to claim rewards. Upon successful claim of rewards, the contract emits a RewardsClaimed
event, providing transparency and traceability. This event logs the details of the reward tokens, the amounts claimed, and the fees deducted.
Swaps
This module manages token swapping operations. It allows enabling and disabling of swap tokens, output tokens, and swap handlers. The main functionality is the swap
function, which executes a series of swaps as per given payloads. Events like SwapHandlerUpdate
, SwapTokenUpdate
, SwapOutputTokenUpdate
, and SwapHandled
provide detailed logs of swap operations.
Last updated