-
Notifications
You must be signed in to change notification settings - Fork 34
Delegation calls reference
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")})
- Validator must exist
- Validator is active
- Amount is greater than zero
-
Validator's stake
is less or equal to16.0
*validator's self-stake
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 (called withdrawal period), 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"})
- 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 to16.0
*validator's self-stake
or theself-stake
is0
Withdrawal period in seconds and epochs can be retrieved via
sfcc.withdrawalPeriodTime()
sfcc.withdrawalPeriodEpochs()
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 (called withdrawal period).
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"})
- Withdrawal request with given address, validator ID and requestID exists
- At least
sfcc.withdrawalPeriodTime()
seconds passed sinceundelegate
call - At least
sfcc.withdrawalPeriodEpochs()
epochs passed sinceundelegate
call - Non-slashed part of stake is above zero