Skip to main content

sysio.system

The sysio.system contract provides essential structures and actions to manage various system-level features, such as resource allocation, voting, RAM market, and governance in SysIO-based blockchains.

Actions


init

Initializes the system contract with a specified version and core symbol.

Parameter NameDescription
versionThe version of the contract initialization (should be 0).
coreThe core symbol of the system.

onblock

Triggered when a block is applied, used to pay producers and calculate producer rewards and block information.

Parameter NameDescription
headerThe block header produced.

setalimits

Sets the resource limits (RAM, NET, CPU) for a specific account.

Parameter NameDescription
accountName of the account whose resource limits are being set.
ram_bytesRAM limit in absolute bytes.
net_weightFractional NET limit based on the total weight of all accounts.
cpu_weightFractional CPU limit based on the total weight of all accounts.

setacctram

Sets the RAM limit for an account.

Parameter NameDescription
accountName of the account whose RAM limit is being set.
ram_bytesRAM limit in absolute bytes (optional).

setacctnet

Sets the NET resource limit for an account.

Parameter NameDescription
accountName of the account whose NET limit is being set.
net_weightNET resource limit (optional).

setacctcpu

Sets the CPU resource limit for an account.

Parameter NameDescription
accountName of the account whose CPU limit is being set.
cpu_weightCPU resource limit (optional).

activate

Activates a protocol feature.

Parameter NameDescription
feature_digestHash of the protocol feature to activate.

delegatebw

Delegates bandwidth (NET and CPU) from one account to another.

Parameter NameDescription
fromAccount from which resources are being delegated.
receiverAccount to receive the delegated bandwidth.
stake_net_quantityQuantity of tokens staked for NET bandwidth.
stake_cpu_quantityQuantity of tokens staked for CPU bandwidth.
transferBoolean flag indicating whether ownership of the staked tokens is transferred to the receiver.

setrex

Sets the total rent balance of the REX pool to a specified value.

Parameter NameDescription
balanceThe balance to set for the REX pool.

deposit

Deposits core tokens into the REX fund for a user.

Parameter NameDescription
ownerREX fund owner account.
amountAmount of tokens to deposit.

withdraw

Withdraws core tokens from a user’s REX fund.

Parameter NameDescription
ownerREX fund owner account.
amountAmount of tokens to withdraw.

buyrex

Buys REX tokens using the deposited core tokens.

Parameter NameDescription
fromThe account buying REX.
amountAmount of core tokens to convert into REX.

unstaketorex

Uses staked tokens to buy REX.

Parameter NameDescription
ownerOwner of the staked tokens.
receiverAccount that the tokens were staked to.
from_netAmount of tokens to unstake from NET bandwidth.
from_cpuAmount of tokens to unstake from CPU bandwidth.

sellrex

Sells REX in exchange for core tokens at the current exchange rate.

Parameter NameDescription
fromAccount selling the REX.
rexAmount of REX to sell.

cnclrexorder

Cancels an unfilled REX sell order.

Parameter NameDescription
ownerThe account owning the unfilled sell order.

rentcpu

Rents CPU resources by paying the market-determined amount of tokens.

Parameter NameDescription
fromAccount paying for the CPU loan.
receiverAccount receiving the rented CPU resources.
loan_paymentTokens paid for the loan.
loan_fundAdditional tokens added to the loan balance.

rentnet

Rents NET resources by paying the market-determined amount of tokens.

Parameter NameDescription
fromAccount paying for the NET loan.
receiverAccount receiving the rented NET resources.
loan_paymentTokens paid for the loan.
loan_fundAdditional tokens added to the loan balance.

fundcpuloan

Adds funds to a specific CPU loan to extend its duration.

Parameter NameDescription
fromThe account adding funds to the loan.
loan_numThe ID of the loan to fund.
paymentTokens transferred from the REX fund to the loan fund.

fundnetloan

Adds funds to a specific NET loan to extend its duration.

Parameter NameDescription
fromThe account adding funds to the loan.
loan_numThe ID of the loan to fund.
paymentTokens transferred from the REX fund to the loan fund.

defcpuloan

Withdraws funds from a specific CPU loan and adds them back to the REX fund.

Parameter NameDescription
fromThe account withdrawing funds from the loan.
loan_numThe ID of the loan to defund.
amountAmount of tokens to withdraw.

defnetloan

Withdraws funds from a specific NET loan and adds them back to the REX fund.

Parameter NameDescription
fromThe account withdrawing funds from the loan.
loan_numThe ID of the loan to defund.
amountAmount of tokens to withdraw.

updaterex

Updates a user's vote weight to reflect the current value of held REX tokens.

Parameter NameDescription
ownerThe account whose REX balance is updated.

rexexec

Processes a specified number of queued REX-related actions, such as CPU/NET loans and sell orders.

Parameter NameDescription
userThe account executing the action.
maxMaximum number of items to process.

consolidate

Consolidates REX maturity buckets into a single bucket available for selling after 4 days.

Parameter NameDescription
ownerThe REX owner account.

mvtosavings

Moves a specified amount of REX into a savings bucket that never matures.

Parameter NameDescription
ownerThe REX owner account.
rexAmount of REX to move to savings.

mvfrsavings

Moves a specified amount of REX out of savings, which will mature in 4 days.

Parameter NameDescription
ownerThe REX owner account.
rexAmount of REX to move out of savings.

closerex

Deletes all of the REX-related records for an account and frees up the associated RAM.

Parameter NameDescription
ownerThe user account whose REX entries are being closed.

undelegatebw

Decreases the total tokens delegated from one account to another for NET or CPU bandwidth.

Parameter NameDescription
fromThe account to undelegate bandwidth from.
receiverThe account to undelegate bandwidth to.
unstake_net_quantityAmount of tokens to unstake from NET bandwidth.
unstake_cpu_quantityAmount of tokens to unstake from CPU bandwidth.

buyram

Increases the RAM quota for an account by purchasing RAM using tokens.

Parameter NameDescription
payerThe account buying the RAM.
receiverThe account receiving the RAM.
quantThe quantity of tokens to use for purchasing RAM.

buyrambytes

Increases the RAM quota for an account by purchasing a specified amount of RAM in bytes.

Parameter NameDescription
payerThe account buying the RAM.
receiverThe account receiving the RAM.
bytesThe quantity of RAM to buy, in bytes.

sellram

Decreases the RAM quota for an account by selling RAM and receiving tokens in exchange.

Parameter NameDescription
accountThe account selling the RAM.
bytesThe amount of RAM to sell, in bytes.

refund

Claims all pending unstaked tokens after the delegation period.

Parameter NameDescription
ownerThe owner of the unstaked tokens.