Skip to main content

IShMonad Interface

Functions

These functions allow users to commit/uncommit their ShMONAD tokens and manage their re-staked positions in the ShMonad contract.


bond

function bond(
uint64 policyID,
address bondRecipient,
uint256 amount
) external;

Bonds amount of tokens under a specific policy (policyID) and credits the bonded tokens to bondRecipient.

Parameters

NameTypeDescription
policyIDuint64Unique identifier of the policy
bondRecipientaddressAddress receiving the bonded tokens
amountuint256Amount of tokens to bond

Important Notes:

  • The caller must have an approved or sufficient unbonded token balance to move into a bonded state.

depositAndBond

function depositAndBond(
uint64 policyID,
address bondRecipient,
uint256 amountToBond
) external payable;

Combines a deposit operation with a bond in a single transaction. The caller may need to send msg.value if the Vault requires native tokens for depositing.

Parameters

NameTypeDescription
policyIDuint64Unique identifier of the policy
bondRecipientaddressAddress receiving the bonded tokens
amountToBonduint256Amount of tokens to deposit into the Vault and then bond

unbond

function unbond(
uint64 policyID,
uint256 amount,
uint256 newMinBalance
) external returns (uint256 unbondBlock);

Unbonds a specified amount from a given policyID, potentially setting a new minimum bonded balance. Returns a block number (unbondBlock) after which the unbonding can be considered completed (based on policy logic).

Parameters

NameTypeDescription
policyIDuint64Unique identifier of the policy
amountuint256Amount of tokens to unbond
newMinBalanceuint256Updated minimum bonded balance for the user under this policy

Returns

TypeDescription
uint256The block number by which unbonding completes (if applicable)

claim

function claim(uint64 policyID, uint256 amount) external;

Claims (or finalizes) the unbonded tokens from the specified policy. Typically, this moves them from a pending/unbonding state to a freely usable state.

Parameters

NameTypeDescription
policyIDuint64Unique identifier of the policy
amountuint256Amount of unbonded tokens to claim

claimAndWithdraw

function claimAndWithdraw(
uint64 policyID,
uint256 amount
) external returns (uint256 shares);

Claims the specified amount of unbonded tokens from the policy and then withdraws them (burns shares and returns the underlying assets). Returns the number of shares burned.

Parameters

NameTypeDescription
policyIDuint64Unique identifier of the policy
amountuint256Amount of tokens to claim from unbonded state

Returns

TypeDescription
uint256The number of shares burned

claimAndRebond

function claimAndRebond(
uint64 fromPolicyID,
uint64 toPolicyID,
address bondRecipient,
uint256 amount
) external;

Claims an amount of unbonded tokens from fromPolicyID and immediately bonds them into toPolicyID on behalf of bondRecipient.

Parameters

NameTypeDescription
fromPolicyIDuint64Original policy from which unbonded tokens are claimed
toPolicyIDuint64New policy to which tokens are bonded
bondRecipientaddressAddress receiving the newly bonded tokens
amountuint256Amount of tokens to move from unbonded to bonded state

setMinBondedBalance

function setMinBondedBalance(
uint64 policyID,
uint128 minBonded,
uint128 maxTopUpPerPeriod,
uint32 topUpPeriodDuration
) external;

Sets parameters for maintaining a minimum bonded balance under a policy, specifying the maximum amount that can be topped up per period and the duration of each top-up period.

Parameters

NameTypeDescription
policyIDuint64Policy ID for which to set minimum bonded balance
minBondeduint128Minimum number of tokens to remain bonded in each period
maxTopUpPerPerioduint128Maximum tokens allowed to be topped up in a single period
topUpPeriodDurationuint32Duration of each top-up period (in blocks or seconds)

unbondingCompleteBlock

function unbondingCompleteBlock(uint64 policyID, address account) external view returns (uint256);

Returns the block number at which unbonding completes for a given policyID and account.

balanceOfBonded

function balanceOfBonded(uint64 policyID, address account) external view returns (uint256);

Returns the bonded token balance of account for policyID.

balanceOfUnbonding

function balanceOfUnbonding(uint64 policyID, address account) external view returns (uint256);

Returns the unbonding token balance of account for policyID.