ISecurityModule
Inherits: IERC20Metadata, IMachinePeriphery
Functions
machineShare
Address of the machine share token locked in this contract.
function machineShare() external view returns (address);Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
cooldownReceipt
Address of the cooldown receipt NFT.
function cooldownReceipt() external view returns (address);Returns
| Name | Type | Description |
|---|---|---|
| <none> | address |
cooldownDuration
Cooldown duration in seconds for unlocking.
function cooldownDuration() external view returns (uint256);Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
maxSlashableBps
Maximum slashable proportion of the vault balance in basis points.
function maxSlashableBps() external view returns (uint256);Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
minBalanceAfterSlash
Minimum balance that must remain in the vault after a slash.
function minBalanceAfterSlash() external view returns (uint256);Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
pendingCooldown
Returns data of a pending cooldown.
function pendingCooldown(uint256 cooldownId)
external
view
returns (uint256 shares, uint256 currentExpectedAssets, uint256 maturity);Parameters
| Name | Type | Description |
|---|---|---|
| cooldownId | uint256 | The ID of the cooldown receipt NFT representing the pending cooldown. |
Returns
| Name | Type | Description |
|---|---|---|
| shares | uint256 | The amount of security shares to be redeemed. |
| currentExpectedAssets | uint256 | The current expected amount of machine shares that can be redeemed. |
| maturity | uint256 | The timestamp at which the cooldown period will end and the shares can be redeemed. |
slashingMode
Whether the security module is in slashing mode.
function slashingMode() external view returns (bool);Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool |
totalLockedAmount
Total amount of machine shares locked in the module.
function totalLockedAmount() external view returns (uint256);Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
maxSlashable
Total amount of machine shares currently slashable in the module.
function maxSlashable() external view returns (uint256);Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |
convertToShares
Converts machine shares to security shares.
function convertToShares(uint256 assets) external view returns (uint256 shares);Parameters
| Name | Type | Description |
|---|---|---|
| assets | uint256 | The amount of machine shares to convert. |
Returns
| Name | Type | Description |
|---|---|---|
| shares | uint256 | The amount of security shares corresponding to the input machine shares. |
convertToAssets
Converts security shares to machine shares.
function convertToAssets(uint256 shares) external view returns (uint256 assets);Parameters
| Name | Type | Description |
|---|---|---|
| shares | uint256 | The amount of security shares to convert. |
Returns
| Name | Type | Description |
|---|---|---|
| assets | uint256 | The amount of machine shares corresponding to the input security shares. |
previewLock
Estimates the amount of security shares that would be received for a given amount of machine shares.
function previewLock(uint256 assets) external view returns (uint256 shares);Parameters
| Name | Type | Description |
|---|---|---|
| assets | uint256 | The amount of machine shares to convert. |
Returns
| Name | Type | Description |
|---|---|---|
| shares | uint256 | The estimated amount of security shares corresponding to the input machine shares. |
lock
Locks machine shares in the module and mints security shares.
function lock(uint256 assets, address receiver, uint256 minShares) external returns (uint256 shares);Parameters
| Name | Type | Description |
|---|---|---|
| assets | uint256 | The amount of machine shares to lock. |
| receiver | address | The address that will receive the security shares. |
| minShares | uint256 | The minimum amount of security shares to receive. |
Returns
| Name | Type | Description |
|---|---|---|
| shares | uint256 | The amount of security shares minted. |
startCooldown
Requests a cooldown for redeeming security shares. Shares are locked in the contract until the cooldown is cancelled or expires. A cooldown receipt NFT is minted to the specified receiver address.
function startCooldown(uint256 shares, address receiver)
external
returns (uint256 cooldownId, uint256 maxAssets, uint256 maturity);Parameters
| Name | Type | Description |
|---|---|---|
| shares | uint256 | The amount of security shares to redeem. |
| receiver | address | The address that will receive the cooldown receipt. |
Returns
| Name | Type | Description |
|---|---|---|
| cooldownId | uint256 | The ID of the minted cooldown receipt NFT representing the pending cooldown. |
| maxAssets | uint256 | The maximum amount of machine shares that can be redeemed. |
| maturity | uint256 | The timestamp at which the cooldown period will end and the shares can be redeemed. |
cancelCooldown
Cancels a pending cooldown. Shares for which the cooldown was cancelled are transferred back to caller. The associated cooldown receipt NFT is burned.
function cancelCooldown(uint256 cooldownId) external returns (uint256 shares);Parameters
| Name | Type | Description |
|---|---|---|
| cooldownId | uint256 | The ID of the cooldown receipt NFT representing the pending cooldown. |
Returns
| Name | Type | Description |
|---|---|---|
| shares | uint256 | The amount of security shares for which the cooldown was cancelled. |
redeem
Redeems security shares and transfers machine shares to caller.
function redeem(uint256 cooldownId, uint256 minAssets) external returns (uint256 assets);Parameters
| Name | Type | Description |
|---|---|---|
| cooldownId | uint256 | The ID of the cooldown receipt NFT representing the pending cooldown. |
| minAssets | uint256 | The minimum amount of machine shares to receive. |
Returns
| Name | Type | Description |
|---|---|---|
| assets | uint256 | The amount of machine shares transferred to the receiver. |
slash
Slashes a specified amount from the total locked amount and triggers the slashing mode.
function slash(uint256 amount) external;Parameters
| Name | Type | Description |
|---|---|---|
| amount | uint256 | The amount to slash from the total locked amount. |
settleSlashing
Settles the current slashing, allowing the contract to exit slashing mode and resume normal operations.
function settleSlashing() external;setCooldownDuration
Sets the cooldown duration for unlocking.
function setCooldownDuration(uint256 newCooldownDuration) external;Parameters
| Name | Type | Description |
|---|---|---|
| newCooldownDuration | uint256 | The new cooldown duration in seconds. |
setMaxSlashableBps
Sets the maximum slashable proportion of the vault balance in basis points.
function setMaxSlashableBps(uint256 newMaxSlashableBps) external;Parameters
| Name | Type | Description |
|---|---|---|
| newMaxSlashableBps | uint256 | The new maximum slashable proportion in basis points. |
setMinBalanceAfterSlash
Sets the minimum balance that must remain in the vault after a slash.
function setMinBalanceAfterSlash(uint256 newMinBalanceAfterSlash) external;Parameters
| Name | Type | Description |
|---|---|---|
| newMinBalanceAfterSlash | uint256 | The new minimum balance after slash. |
Events
Cooldown
event Cooldown(
uint256 indexed cooldownId, address indexed account, address indexed receiver, uint256 shares, uint256 maturity
);Parameters
| Name | Type | Description |
|---|---|---|
| cooldownId | uint256 | |
| account | address | |
| receiver | address | |
| shares | uint256 | |
| maturity | uint256 |
CooldownCancelled
event CooldownCancelled(uint256 indexed cooldownId, address indexed receiver, uint256 shares);Parameters
| Name | Type | Description |
|---|---|---|
| cooldownId | uint256 | |
| receiver | address | |
| shares | uint256 |
CooldownDurationChanged
event CooldownDurationChanged(uint256 oldCooldownDuration, uint256 newCooldownDuration);Parameters
| Name | Type | Description |
|---|---|---|
| oldCooldownDuration | uint256 | |
| newCooldownDuration | uint256 |
MaxSlashableBpsChanged
event MaxSlashableBpsChanged(uint256 oldMaxSlashableBps, uint256 newMaxSlashableBps);Parameters
| Name | Type | Description |
|---|---|---|
| oldMaxSlashableBps | uint256 | |
| newMaxSlashableBps | uint256 |
MinBalanceAfterSlashChanged
event MinBalanceAfterSlashChanged(uint256 oldMinBalanceAfterSlash, uint256 newMinBalanceAfterSlash);Parameters
| Name | Type | Description |
|---|---|---|
| oldMinBalanceAfterSlash | uint256 | |
| newMinBalanceAfterSlash | uint256 |
Lock
event Lock(address indexed account, address indexed receiver, uint256 assets, uint256 shares);Parameters
| Name | Type | Description |
|---|---|---|
| account | address | |
| receiver | address | |
| assets | uint256 | |
| shares | uint256 |
Redeem
event Redeem(uint256 indexed cooldownId, address indexed receiver, uint256 assets, uint256 shares);Parameters
| Name | Type | Description |
|---|---|---|
| cooldownId | uint256 | |
| receiver | address | |
| assets | uint256 | |
| shares | uint256 |
Slash
event Slash(uint256 amount);Parameters
| Name | Type | Description |
|---|---|---|
| amount | uint256 |
SlashingSettled
event SlashingSettled();Structs
SecurityModuleInitParams
Initialization parameters.
struct SecurityModuleInitParams {
address machineShare;
uint256 initialCooldownDuration;
uint256 initialMaxSlashableBps;
uint256 initialMinBalanceAfterSlash;
}Properties
| Name | Type | Description |
|---|---|---|
| machineShare | address | The address of the machine share token locked in this contract. |
| initialCooldownDuration | uint256 | The cooldown duration in seconds for unlocking. |
| initialMaxSlashableBps | uint256 | The maximum slashable proportion of the vault balance in basis points. |
| initialMinBalanceAfterSlash | uint256 | The minimum balance that must remain in the vault after a slash. |
PendingCooldown
Pending cooldown parameters.
struct PendingCooldown {
uint256 shares;
uint256 maxAssets;
uint256 maturity;
}Properties
| Name | Type | Description |
|---|---|---|
| shares | uint256 | The amount of security shares to be redeemed. |
| maxAssets | uint256 | The maximum amount of machine shares that can be redeemed. |
| maturity | uint256 | The timestamp at which the cooldown period will end and the shares can be redeemed. |