Skip to content

Delegation calls reference

uprendis edited this page Mar 25, 2021 · 2 revisions

Delegation calls

Delegate

Delegate an amount of FTM to a validator.

Can be used to create a new delegation or increase an existing delegation.

The delegated stake is always unlocked unless locked explicitly with lockStake.

sfcc.delegate(validatorID, {from: "0xAddress", value: web3.toWei("amount", "ftm")})

Checks

  • Validator must exist
  • Validator is active
  • Amount is greater than zero
  • Validator's stake is less or equal to 16.0 * validator's self-stake

Undelegate

Put in a request to withdraw an amount of delegated stake.

After a number of seconds and epochs have passed since calling the function below, you will be able to call withdraw successfully.

requestID is any number which isn't occupied by an existing withdrawal request for this delegation.

sfcc.undelegate(validatorID, requestID, web3.toWei("amount", "ftm"), {from: "0xAddress"})

Checks

  • Amount is greater than zero
  • Delegation's unlocked stake is greater or equal to the amount to undelegate
  • requestID isn't occupied by an existing withdrawal request for this delegation
  • If called for validator's self-delegation, then the following stays true after the operation: either validator's stake is less or equal to 16.0 * validator's self-stake or the self-stake is 0

Withdraw

Finalize withdrawal request.

Erases request object and withdraws requested stake, transfers requested stake to account address.

Note that a number of seconds and epochs must elapse since undelegate call.

If validator is a cheater (i.e. double-signed), then the stake may be fully or partially slashed according to validator's slashingRefundRatio.

sfcc.withdraw(validatorID, requestID, {from: "0xAddress"})
Clone this wiki locally