Skip to content
LogoLogo

ISecurityModule

Git Source

Inherits: IERC20Metadata, IMachinePeriphery

Functions

machineShare

Address of the machine share token locked in this contract.

function machineShare() external view returns (address);

Returns

NameTypeDescription
<none>address

cooldownReceipt

Address of the cooldown receipt NFT.

function cooldownReceipt() external view returns (address);

Returns

NameTypeDescription
<none>address

cooldownDuration

Cooldown duration in seconds for unlocking.

function cooldownDuration() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256

maxSlashableBps

Maximum slashable proportion of the vault balance in basis points.

function maxSlashableBps() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256

minBalanceAfterSlash

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

function minBalanceAfterSlash() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256

pendingCooldown

Returns data of a pending cooldown.

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

Parameters

NameTypeDescription
cooldownIduint256The ID of the cooldown receipt NFT representing the pending cooldown.

Returns

NameTypeDescription
sharesuint256The amount of security shares to be redeemed.
currentExpectedAssetsuint256The current expected amount of machine shares that can be redeemed.
maturityuint256The 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

NameTypeDescription
<none>bool

totalLockedAmount

Total amount of machine shares locked in the module.

function totalLockedAmount() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256

maxSlashable

Total amount of machine shares currently slashable in the module.

function maxSlashable() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256

convertToShares

Converts machine shares to security shares.

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

Parameters

NameTypeDescription
assetsuint256The amount of machine shares to convert.

Returns

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

NameTypeDescription
sharesuint256The amount of security shares to convert.

Returns

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

NameTypeDescription
assetsuint256The amount of machine shares to convert.

Returns

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

NameTypeDescription
assetsuint256The amount of machine shares to lock.
receiveraddressThe address that will receive the security shares.
minSharesuint256The minimum amount of security shares to receive.

Returns

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

NameTypeDescription
sharesuint256The amount of security shares to redeem.
receiveraddressThe address that will receive the cooldown receipt.

Returns

NameTypeDescription
cooldownIduint256The ID of the minted cooldown receipt NFT representing the pending cooldown.
maxAssetsuint256The maximum amount of machine shares that can be redeemed.
maturityuint256The 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

NameTypeDescription
cooldownIduint256The ID of the cooldown receipt NFT representing the pending cooldown.

Returns

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

NameTypeDescription
cooldownIduint256The ID of the cooldown receipt NFT representing the pending cooldown.
minAssetsuint256The minimum amount of machine shares to receive.

Returns

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

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

NameTypeDescription
newCooldownDurationuint256The new cooldown duration in seconds.

setMaxSlashableBps

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

function setMaxSlashableBps(uint256 newMaxSlashableBps) external;

Parameters

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

NameTypeDescription
newMinBalanceAfterSlashuint256The new minimum balance after slash.

Events

Cooldown

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

Parameters

NameTypeDescription
cooldownIduint256
accountaddress
receiveraddress
sharesuint256
maturityuint256

CooldownCancelled

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

Parameters

NameTypeDescription
cooldownIduint256
receiveraddress
sharesuint256

CooldownDurationChanged

event CooldownDurationChanged(uint256 oldCooldownDuration, uint256 newCooldownDuration);

Parameters

NameTypeDescription
oldCooldownDurationuint256
newCooldownDurationuint256

MaxSlashableBpsChanged

event MaxSlashableBpsChanged(uint256 oldMaxSlashableBps, uint256 newMaxSlashableBps);

Parameters

NameTypeDescription
oldMaxSlashableBpsuint256
newMaxSlashableBpsuint256

MinBalanceAfterSlashChanged

event MinBalanceAfterSlashChanged(uint256 oldMinBalanceAfterSlash, uint256 newMinBalanceAfterSlash);

Parameters

NameTypeDescription
oldMinBalanceAfterSlashuint256
newMinBalanceAfterSlashuint256

Lock

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

Parameters

NameTypeDescription
accountaddress
receiveraddress
assetsuint256
sharesuint256

Redeem

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

Parameters

NameTypeDescription
cooldownIduint256
receiveraddress
assetsuint256
sharesuint256

Slash

event Slash(uint256 amount);

Parameters

NameTypeDescription
amountuint256

SlashingSettled

event SlashingSettled();

Structs

SecurityModuleInitParams

Initialization parameters.

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

Properties

NameTypeDescription
machineShareaddressThe address of the machine share token locked in this contract.
initialCooldownDurationuint256The cooldown duration in seconds for unlocking.
initialMaxSlashableBpsuint256The maximum slashable proportion of the vault balance in basis points.
initialMinBalanceAfterSlashuint256The minimum balance that must remain in the vault after a slash.

PendingCooldown

Pending cooldown parameters.

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

Properties

NameTypeDescription
sharesuint256The amount of security shares to be redeemed.
maxAssetsuint256The maximum amount of machine shares that can be redeemed.
maturityuint256The timestamp at which the cooldown period will end and the shares can be redeemed.