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
Name | Type | Description |
---|---|---|
policyID | uint64 | Unique identifier of the policy |
bondRecipient | address | Address receiving the bonded tokens |
amount | uint256 | Amount 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
Name | Type | Description |
---|---|---|
policyID | uint64 | Unique identifier of the policy |
bondRecipient | address | Address receiving the bonded tokens |
amountToBond | uint256 | Amount 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
Name | Type | Description |
---|---|---|
policyID | uint64 | Unique identifier of the policy |
amount | uint256 | Amount of tokens to unbond |
newMinBalance | uint256 | Updated minimum bonded balance for the user under this policy |
Returns
Type | Description |
---|---|
uint256 | The 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
Name | Type | Description |
---|---|---|
policyID | uint64 | Unique identifier of the policy |
amount | uint256 | Amount 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
Name | Type | Description |
---|---|---|
policyID | uint64 | Unique identifier of the policy |
amount | uint256 | Amount of tokens to claim from unbonded state |
Returns
Type | Description |
---|---|
uint256 | The 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
Name | Type | Description |
---|---|---|
fromPolicyID | uint64 | Original policy from which unbonded tokens are claimed |
toPolicyID | uint64 | New policy to which tokens are bonded |
bondRecipient | address | Address receiving the newly bonded tokens |
amount | uint256 | Amount 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
Name | Type | Description |
---|---|---|
policyID | uint64 | Policy ID for which to set minimum bonded balance |
minBonded | uint128 | Minimum number of tokens to remain bonded in each period |
maxTopUpPerPeriod | uint128 | Maximum tokens allowed to be topped up in a single period |
topUpPeriodDuration | uint32 | Duration 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
.