Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

staking state

Back to all declarations

rewardPerBlock

uint64

Value

100

precision

uint64

Value

1000000

account

type

Value

staking.account

accounts

v0.Tree

// address string -> \*account

Open
OID
06e47e…ee64:4
accounts details

Inspect ref

totalStaked

uint64

Value

0

rewardPerTokenAcc

uint64

// global accumulator, scaled by precision

Value

0

lastUpdateBlock

uint64

Value

0

computeRewardPerToken

func(stored uint64, rate uint64, elapsed uint64, total uint64) uint64

computeRewardPerToken advances the accumulator by the rewards earned per staked unit over \`elapsed\` blocks. With no stake, the accumulator is frozen.

Open
OID
06e47e…ee64:8
computeRewardPerToken details

Inspect func

computeEarned

func(balance uint64, rptCurrent uint64, rptPaid uint64, accrued uint64) uint64

computeEarned returns total rewards owed to an account given its stake, the current accumulator, the accumulator value already paid, and prior accrual.

Open
OID
06e47e…ee64:10
computeEarned details

Inspect func

getOrCreate

func(addr string) *staking.account
Open
OID
06e47e…ee64:12
getOrCreate details

Inspect func

accrue

func(addr string) *staking.account

accrue rolls the global accumulator forward to the current block and folds the caller's freshly-earned rewards into its stored balance. Mirrors the Synthetix \`updateReward(account)\` modifier.

Open
OID
06e47e…ee64:13
accrue details

Inspect func

Stake

func(amount uint64)

Stake adds \`amount\` to the caller's staked balance.

Open
OID
06e47e…ee64:14
Stake details

Inspect func

Withdraw

func(amount uint64)

Withdraw removes \`amount\` from the caller's staked balance.

Open
OID
06e47e…ee64:15
Withdraw details

Inspect func

GetReward

func() uint64

GetReward mints all accrued rewards into the caller's reward balance and resets the accrual counter. Returns the amount minted this call.

Open
OID
06e47e…ee64:16
GetReward details

Inspect func

Earned

func(addr .uverse.address) uint64

Earned reports the rewards currently owed to \`addr\` (accrued but unminted), projected to the current block without mutating any state.

Open
OID
06e47e…ee64:17
Earned details

Inspect func

StakedOf

func(addr .uverse.address) uint64

StakedOf reports the current staked balance of \`addr\`.

Open
OID
06e47e…ee64:18
StakedOf details

Inspect func

Render

func(path string) string

Render renders pool stats and a stakers table.

Open
OID
06e47e…ee64:19
Render details

Inspect func
rewardPerBlock : uint64 =100
precision : uint64 =1000000
account : type =staking.account
accounts : v0.Tree Inspect
totalStaked : uint64 =0
rewardPerTokenAcc : uint64 =0
lastUpdateBlock : uint64 =0
computeRewardPerToken : func(stored uint64, rate uint64, elapsed uint64, total uint64) uint64 Inspect
computeEarned : func(balance uint64, rptCurrent uint64, rptPaid uint64, accrued uint64) uint64 Inspect
currentBlock : func() uint64 Inspect
getOrCreate : func(addr string) *staking.account Inspect
accrue : func(addr string) *staking.account Inspect
Stake : func(amount uint64) Inspect
Withdraw : func(amount uint64) Inspect
GetReward : func() uint64 Inspect
Earned : func(addr .uverse.address) uint64 Inspect
StakedOf : func(addr .uverse.address) uint64 Inspect
Render : func(path string) string Inspect