-
Notifications
You must be signed in to change notification settings - Fork 11
Validator calls reference
Create a new validator (staker)
Minimum stake is 3175000 FTM
sfcc.createStake("0x", {from:"0xAddress", value: web3.toWei("amount", "ftm")})
- Stake amount is greater or equal to
sfcc.minStake()
- This address isn't a staker
- This address isn't a delegator
Not availible since sfc2.0.2-rc2.
To partially withdraw stake. This function can only be called after all the rewards are claimed.
After calling partially withdrawing stake for a number of seconds and epochs, you will be able to call partialWithdrawByRequest()
successfully.
requestID
is any number which wasn't used by this validator previously.
Remember this number, it'll be needed to finalize withdrawal. Use 0
if not sure.
Validator cannot leave less stake than minStake()
or less than delegations amount
* 15.0
.
This call doesn't affect already earned rewards by delegators.
The validator's stake will be decreased in next epoch by amount
.
sfcc.prepareToWithdrawStakePartial(requestID, web3.toWei("amountToWithdraw", "ftm"), {from: "0xAddress"})
- Staker must exist
- All staker rewards are claimed
- Staker isn't deactivated (i.e. didn't prepare to withdraw)
- requestID isn't occupied by another request
-
amountToWithdraw
>=minStakeDecrease()
-
left amount
>=minStake()
-
left amount
>=delegations amount
*15.0
- Validator's outstanding SFTM balance is zero
To finalize withdrawal request, wait for number of seconds and epochs must elaps since prepareToWithdrawStakePartial
call. Erases request object and withdraws requested stake, transfers requested stake to account address.
If staker is a cheater (i.e. double-signed), then object will be erased, but stake won't be withdrawn (i.e. will be slashed).
sfcc.partialWithdrawByRequest(requestID, {from: "0xAddress"})
- Passed at least
sfcc.stakeLockPeriodTime()
seconds sinceprepareToWithdrawStakePartial
- Passed at least
sfcc.stakeLockPeriodEpochs()
epochs sinceprepareToWithdrawStakePartial
Validator can call prepareToWithdrawStake
to prepare to withdraw their stake fully.
Note that locked validator cannot withdraw his stake.
sfcc.prepareToWithdrawStake({from: address})
- Staker must exist
- All staker rewards are claimed
- Staker isn't deactivated (i.e. didn't prepare to withdraw)
- Validator's outstanding SFTM balance is zero
After enough seconds and epochs have passed since calling prepareToWithdrawStake()
, validator can call this function successfully.
If staker is a cheater (i.e. double-signed), then staker will be erased, but delegated stake won't be withdrawn (i.e. will be slashed).
sfcc.withdrawStake({from: "0xAddress"})
- Passed at least
sfcc.stakeLockPeriodTime()
seconds sinceprepareToWithdrawStake
was called - Passed at least
sfcc.stakeLockPeriodEpochs()
epochs sinceprepareToWithdrawStake
was called
Reward for a non-locked stake is 30% (base rate) of the full reward for a locked stake.
If withdrawal is to be made before lockup period expired, the following penalty will be withheld from the withdrawn amount:
- 85% of rewards received for epochs during the lockup period. On partial withdrawal, the penalty is multiplied by a ratio of withdrawn stake (in a case of withdrawing a half of stake, 85%/2=42.5% penalty is applied). 85% is the penalty calculated as (base rate = 30%)/2 + lockup rate = 70%.
sfcc.lockUpStake(lockupDuration, {from: "0xAddress"})
lockupDuration
is lockup duration in seconds. Must be >= 14 days, <= 365 days.
-
lockupDuration
>= 14 days -
lockupDuration
<= 365 days - All the lockup rewards are claimed (including the last epoch of lockup period).