Skip to main content

ISecurityModule

Git Source

Inherits: IERC20Metadata, IMachinePeriphery

Functions

machineShare

Address of the machine share token locked in this contract.

function machineShare() external view returns (address);

cooldownReceipt

Address of the cooldown receipt NFT.

function cooldownReceipt() external view returns (address);

cooldownDuration

Cooldown duration in seconds for unlocking.

function cooldownDuration() external view returns (uint256);

maxSlashableBps

Maximum slashable proportion of the vault balance in basis points.

function maxSlashableBps() external view returns (uint256);

minBalanceAfterSlash

Minimum balance that must remain in the vault after a slash.

function minBalanceAfterSlash() external view returns (uint256);

pendingCooldown

Returns data of a pending cooldown.

function pendingCooldown(uint256 cooldownId)
external
view
returns (uint256 shares, uint256 currentExpectedAssets, uint256 maturity);

Parameters

NameTypeDescription
cooldownIduint256ID of the cooldown receipt NFT representing the pending cooldown.

Returns

NameTypeDescription
sharesuint256Amount of security shares to be redeemed.
currentExpectedAssetsuint256Current expected amount of machine shares that can be redeemed.
maturityuint256Timestamp 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);

totalLockedAmount

Total amount of machine shares locked in the module.

function totalLockedAmount() external view returns (uint256);

maxSlashable

Total amount of machine shares currently slashable in the module.

function maxSlashable() external view returns (uint256);

convertToShares

Converts machine shares to security shares.

function convertToShares(uint256 assets) external view returns (uint256 shares);

Parameters

NameTypeDescription
assetsuint256Amount of machine shares to convert.

Returns

NameTypeDescription
sharesuint256Amount 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

NameTypeDescription
sharesuint256Amount of security shares to convert.

Returns

NameTypeDescription
assetsuint256Amount 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

NameTypeDescription
assetsuint256Amount of machine shares to convert.

Returns

NameTypeDescription
sharesuint256Estimated 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

NameTypeDescription
assetsuint256Amount of machine shares to lock.
receiveraddressAddress that will receive the security shares.
minSharesuint256Minimum amount of security shares to receive.

Returns

NameTypeDescription
sharesuint256Amount 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

NameTypeDescription
sharesuint256Amount of security shares to redeem.
receiveraddressAddress that will receive the cooldown receipt.

Returns

NameTypeDescription
cooldownIduint256ID of the minted cooldown receipt NFT representing the pending cooldown.
maxAssetsuint256Maximum amount of machine shares that can be redeemed.
maturityuint256Timestamp 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

NameTypeDescription
cooldownIduint256ID of the cooldown receipt NFT representing the pending cooldown.

Returns

NameTypeDescription
sharesuint256Amount 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

NameTypeDescription
cooldownIduint256ID of the cooldown receipt NFT representing the pending cooldown.
minAssetsuint256Minimum amount of machine shares to receive.

Returns

NameTypeDescription
assetsuint256Amount 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

NameTypeDescription
amountuint256Amount 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 cooldownDuration) external;

Parameters

NameTypeDescription
cooldownDurationuint256New cooldown duration in seconds.

setMaxSlashableBps

Sets the maximum slashable proportion of the vault balance in basis points.

function setMaxSlashableBps(uint256 maxSlashableBps) external;

Parameters

NameTypeDescription
maxSlashableBpsuint256New maximum slashable proportion in basis points.

setMinBalanceAfterSlash

Sets the minimum balance that must remain in the vault after a slash.

function setMinBalanceAfterSlash(uint256 minBalanceAfterSlash) external;

Parameters

NameTypeDescription
minBalanceAfterSlashuint256New minimum balance after slash.

Events

Cooldown

event Cooldown(
uint256 indexed cooldownId, address indexed account, address indexed receiver, uint256 shares, uint256 maturity
);

CooldownCancelled

event CooldownCancelled(uint256 indexed cooldownId, address indexed receiver, uint256 shares);

CooldownDurationChanged

event CooldownDurationChanged(uint256 oldCooldownDuration, uint256 newCooldownDuration);

MaxSlashableBpsChanged

event MaxSlashableBpsChanged(uint256 oldMaxSlashableBps, uint256 newMaxSlashableBps);

MinBalanceAfterSlashChanged

event MinBalanceAfterSlashChanged(uint256 oldMinBalanceAfterSlash, uint256 newMinBalanceAfterSlash);

Lock

event Lock(address indexed account, address indexed receiver, uint256 assets, uint256 shares);

Redeem

event Redeem(uint256 indexed cooldownId, address indexed receiver, uint256 assets, uint256 shares);

Slash

event Slash(uint256 amount);

SlashingSettled

event SlashingSettled();

Structs

SecurityModuleInitParams

Initialization parameters.

struct SecurityModuleInitParams {
address machineShare;
uint256 initialCooldownDuration;
uint256 initialMaxSlashableBps;
uint256 initialMinBalanceAfterSlash;
}

Properties

NameTypeDescription
machineShareaddressAddress of the machine share token locked in this contract.
initialCooldownDurationuint256Cooldown duration in seconds for unlocking.
initialMaxSlashableBpsuint256Maximum slashable proportion of the vault balance in basis points.
initialMinBalanceAfterSlashuint256

PendingCooldown

Pending cooldown parameters.

struct PendingCooldown {
uint256 shares;
uint256 maxAssets;
uint256 maturity;
}

Properties

NameTypeDescription
sharesuint256Amount of security shares to be redeemed.
maxAssetsuint256Maximum amount of machine shares that can be redeemed.
maturityuint256Timestamp at which the cooldown period will end and the shares can be redeemed.