/** * This code was AUTOGENERATED using the Codama library. * Please DO NOT EDIT THIS FILE, instead use visitors * to add features, then rerun Codama to update it. * * @see https://github.com/codama-idl/codama */ import { combineCodec, getStructDecoder, getStructEncoder, getU32Decoder, getU32Encoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, } from "@solana/kit"; import { getListDecoder, getListEncoder, type List, type ListArgs } from "."; export type StakeSystem = { stakeList: List; delayedUnstakeCoolingDown: bigint; stakeDepositBumpSeed: number; stakeWithdrawBumpSeed: number; /** set by admin, how much slots before the end of the epoch, stake-delta can start */ slotsForStakeDelta: bigint; /** * Marks the start of stake-delta operations, meaning that if somebody starts a delayed-unstake ticket * after this var is set with epoch_num the ticket will have epoch_created = current_epoch+1 * (the user must wait one more epoch, because their unstake-delta will be execute in this epoch) */ lastStakeDeltaEpoch: bigint; minStake: bigint; /** * can be set by validator-manager-auth to allow a second run of stake-delta to stake late stakers in the last minute of the epoch * so we maximize user's rewards */ extraStakeDeltaRuns: number; }; export type StakeSystemArgs = { stakeList: ListArgs; delayedUnstakeCoolingDown: number | bigint; stakeDepositBumpSeed: number; stakeWithdrawBumpSeed: number; /** set by admin, how much slots before the end of the epoch, stake-delta can start */ slotsForStakeDelta: number | bigint; /** * Marks the start of stake-delta operations, meaning that if somebody starts a delayed-unstake ticket * after this var is set with epoch_num the ticket will have epoch_created = current_epoch+1 * (the user must wait one more epoch, because their unstake-delta will be execute in this epoch) */ lastStakeDeltaEpoch: number | bigint; minStake: number | bigint; /** * can be set by validator-manager-auth to allow a second run of stake-delta to stake late stakers in the last minute of the epoch * so we maximize user's rewards */ extraStakeDeltaRuns: number; }; export function getStakeSystemEncoder(): FixedSizeEncoder { return getStructEncoder([ ["stakeList", getListEncoder()], ["delayedUnstakeCoolingDown", getU64Encoder()], ["stakeDepositBumpSeed", getU8Encoder()], ["stakeWithdrawBumpSeed", getU8Encoder()], ["slotsForStakeDelta", getU64Encoder()], ["lastStakeDeltaEpoch", getU64Encoder()], ["minStake", getU64Encoder()], ["extraStakeDeltaRuns", getU32Encoder()], ]); } export function getStakeSystemDecoder(): FixedSizeDecoder { return getStructDecoder([ ["stakeList", getListDecoder()], ["delayedUnstakeCoolingDown", getU64Decoder()], ["stakeDepositBumpSeed", getU8Decoder()], ["stakeWithdrawBumpSeed", getU8Decoder()], ["slotsForStakeDelta", getU64Decoder()], ["lastStakeDeltaEpoch", getU64Decoder()], ["minStake", getU64Decoder()], ["extraStakeDeltaRuns", getU32Decoder()], ]); } export function getStakeSystemCodec(): FixedSizeCodec< StakeSystemArgs, StakeSystem > { return combineCodec(getStakeSystemEncoder(), getStakeSystemDecoder()); }