diff --git a/clients/js/jito_tip_router/accounts/epochSnapshot.ts b/clients/js/jito_tip_router/accounts/epochSnapshot.ts index 18dcef0..16f5aa5 100644 --- a/clients/js/jito_tip_router/accounts/epochSnapshot.ts +++ b/clients/js/jito_tip_router/accounts/epochSnapshot.ts @@ -19,8 +19,6 @@ import { getArrayEncoder, getStructDecoder, getStructEncoder, - getU128Decoder, - getU128Encoder, getU64Decoder, getU64Encoder, getU8Decoder, @@ -39,8 +37,12 @@ import { import { getFeesDecoder, getFeesEncoder, + getStakeWeightDecoder, + getStakeWeightEncoder, type Fees, type FeesArgs, + type StakeWeight, + type StakeWeightArgs, } from '../types'; export type EpochSnapshot = { @@ -55,7 +57,7 @@ export type EpochSnapshot = { vaultCount: bigint; operatorsRegistered: bigint; validOperatorVaultDelegations: bigint; - stakeWeight: bigint; + stakeWeight: StakeWeight; reserved: Array; }; @@ -71,7 +73,7 @@ export type EpochSnapshotArgs = { vaultCount: number | bigint; operatorsRegistered: number | bigint; validOperatorVaultDelegations: number | bigint; - stakeWeight: number | bigint; + stakeWeight: StakeWeightArgs; reserved: Array; }; @@ -88,7 +90,7 @@ export function getEpochSnapshotEncoder(): Encoder { ['vaultCount', getU64Encoder()], ['operatorsRegistered', getU64Encoder()], ['validOperatorVaultDelegations', getU64Encoder()], - ['stakeWeight', getU128Encoder()], + ['stakeWeight', getStakeWeightEncoder()], ['reserved', getArrayEncoder(getU8Encoder(), { size: 128 })], ]); } @@ -106,7 +108,7 @@ export function getEpochSnapshotDecoder(): Decoder { ['vaultCount', getU64Decoder()], ['operatorsRegistered', getU64Decoder()], ['validOperatorVaultDelegations', getU64Decoder()], - ['stakeWeight', getU128Decoder()], + ['stakeWeight', getStakeWeightDecoder()], ['reserved', getArrayDecoder(getU8Decoder(), { size: 128 })], ]); } diff --git a/clients/js/jito_tip_router/accounts/ncnConfig.ts b/clients/js/jito_tip_router/accounts/ncnConfig.ts index 6299e66..b396a55 100644 --- a/clients/js/jito_tip_router/accounts/ncnConfig.ts +++ b/clients/js/jito_tip_router/accounts/ncnConfig.ts @@ -35,10 +35,10 @@ import { type MaybeEncodedAccount, } from '@solana/web3.js'; import { - getFeesDecoder, - getFeesEncoder, - type Fees, - type FeesArgs, + getFeeConfigDecoder, + getFeeConfigEncoder, + type FeeConfig, + type FeeConfigArgs, } from '../types'; export type NcnConfig = { @@ -46,7 +46,7 @@ export type NcnConfig = { ncn: Address; tieBreakerAdmin: Address; feeAdmin: Address; - fees: Fees; + feeConfig: FeeConfig; bump: number; reserved: Array; }; @@ -56,7 +56,7 @@ export type NcnConfigArgs = { ncn: Address; tieBreakerAdmin: Address; feeAdmin: Address; - fees: FeesArgs; + feeConfig: FeeConfigArgs; bump: number; reserved: Array; }; @@ -67,7 +67,7 @@ export function getNcnConfigEncoder(): Encoder { ['ncn', getAddressEncoder()], ['tieBreakerAdmin', getAddressEncoder()], ['feeAdmin', getAddressEncoder()], - ['fees', getFeesEncoder()], + ['feeConfig', getFeeConfigEncoder()], ['bump', getU8Encoder()], ['reserved', getArrayEncoder(getU8Encoder(), { size: 127 })], ]); @@ -79,7 +79,7 @@ export function getNcnConfigDecoder(): Decoder { ['ncn', getAddressDecoder()], ['tieBreakerAdmin', getAddressDecoder()], ['feeAdmin', getAddressDecoder()], - ['fees', getFeesDecoder()], + ['feeConfig', getFeeConfigDecoder()], ['bump', getU8Decoder()], ['reserved', getArrayDecoder(getU8Decoder(), { size: 127 })], ]); diff --git a/clients/js/jito_tip_router/accounts/operatorSnapshot.ts b/clients/js/jito_tip_router/accounts/operatorSnapshot.ts index 76a521b..a927496 100644 --- a/clients/js/jito_tip_router/accounts/operatorSnapshot.ts +++ b/clients/js/jito_tip_router/accounts/operatorSnapshot.ts @@ -21,8 +21,6 @@ import { getBoolEncoder, getStructDecoder, getStructEncoder, - getU128Decoder, - getU128Encoder, getU16Decoder, getU16Encoder, getU64Decoder, @@ -41,8 +39,12 @@ import { type MaybeEncodedAccount, } from '@solana/web3.js'; import { + getStakeWeightDecoder, + getStakeWeightEncoder, getVaultOperatorStakeWeightDecoder, getVaultOperatorStakeWeightEncoder, + type StakeWeight, + type StakeWeightArgs, type VaultOperatorStakeWeight, type VaultOperatorStakeWeightArgs, } from '../types'; @@ -62,7 +64,7 @@ export type OperatorSnapshot = { vaultOperatorDelegationCount: bigint; vaultOperatorDelegationsRegistered: bigint; validOperatorVaultDelegations: bigint; - stakeWeight: bigint; + stakeWeight: StakeWeight; reserved: Array; vaultOperatorStakeWeight: Array; }; @@ -82,7 +84,7 @@ export type OperatorSnapshotArgs = { vaultOperatorDelegationCount: number | bigint; vaultOperatorDelegationsRegistered: number | bigint; validOperatorVaultDelegations: number | bigint; - stakeWeight: number | bigint; + stakeWeight: StakeWeightArgs; reserved: Array; vaultOperatorStakeWeight: Array; }; @@ -103,7 +105,7 @@ export function getOperatorSnapshotEncoder(): Encoder { ['vaultOperatorDelegationCount', getU64Encoder()], ['vaultOperatorDelegationsRegistered', getU64Encoder()], ['validOperatorVaultDelegations', getU64Encoder()], - ['stakeWeight', getU128Encoder()], + ['stakeWeight', getStakeWeightEncoder()], ['reserved', getArrayEncoder(getU8Encoder(), { size: 256 })], [ 'vaultOperatorStakeWeight', @@ -128,7 +130,7 @@ export function getOperatorSnapshotDecoder(): Decoder { ['vaultOperatorDelegationCount', getU64Decoder()], ['vaultOperatorDelegationsRegistered', getU64Decoder()], ['validOperatorVaultDelegations', getU64Decoder()], - ['stakeWeight', getU128Decoder()], + ['stakeWeight', getStakeWeightDecoder()], ['reserved', getArrayDecoder(getU8Decoder(), { size: 256 })], [ 'vaultOperatorStakeWeight', diff --git a/clients/js/jito_tip_router/errors/jitoTipRouter.ts b/clients/js/jito_tip_router/errors/jitoTipRouter.ts index 74b4496..80f9ed9 100644 --- a/clients/js/jito_tip_router/errors/jitoTipRouter.ts +++ b/clients/js/jito_tip_router/errors/jitoTipRouter.ts @@ -52,38 +52,42 @@ export const JITO_TIP_ROUTER_ERROR__TRACKED_MINT_LIST_FULL = 0x220b; // 8715 export const JITO_TIP_ROUTER_ERROR__TRACKED_MINTS_LOCKED = 0x220c; // 8716 /** VaultIndexAlreadyInUse: Vault index already in use by a different mint */ export const JITO_TIP_ROUTER_ERROR__VAULT_INDEX_ALREADY_IN_USE = 0x220d; // 8717 +/** MintEntryNotFound: Mint Entry not found */ +export const JITO_TIP_ROUTER_ERROR__MINT_ENTRY_NOT_FOUND = 0x220e; // 8718 /** FeeCapExceeded: Fee cap exceeded */ -export const JITO_TIP_ROUTER_ERROR__FEE_CAP_EXCEEDED = 0x220e; // 8718 +export const JITO_TIP_ROUTER_ERROR__FEE_CAP_EXCEEDED = 0x220f; // 8719 /** IncorrectNcnAdmin: Incorrect NCN Admin */ -export const JITO_TIP_ROUTER_ERROR__INCORRECT_NCN_ADMIN = 0x220f; // 8719 +export const JITO_TIP_ROUTER_ERROR__INCORRECT_NCN_ADMIN = 0x2210; // 8720 /** IncorrectNcn: Incorrect NCN */ -export const JITO_TIP_ROUTER_ERROR__INCORRECT_NCN = 0x2210; // 8720 +export const JITO_TIP_ROUTER_ERROR__INCORRECT_NCN = 0x2211; // 8721 /** IncorrectFeeAdmin: Incorrect fee admin */ -export const JITO_TIP_ROUTER_ERROR__INCORRECT_FEE_ADMIN = 0x2211; // 8721 +export const JITO_TIP_ROUTER_ERROR__INCORRECT_FEE_ADMIN = 0x2212; // 8722 /** WeightTableNotFinalized: Weight table not finalized */ -export const JITO_TIP_ROUTER_ERROR__WEIGHT_TABLE_NOT_FINALIZED = 0x2212; // 8722 +export const JITO_TIP_ROUTER_ERROR__WEIGHT_TABLE_NOT_FINALIZED = 0x2213; // 8723 /** WeightNotFound: Weight not found */ -export const JITO_TIP_ROUTER_ERROR__WEIGHT_NOT_FOUND = 0x2213; // 8723 +export const JITO_TIP_ROUTER_ERROR__WEIGHT_NOT_FOUND = 0x2214; // 8724 /** NoOperators: No operators in ncn */ -export const JITO_TIP_ROUTER_ERROR__NO_OPERATORS = 0x2214; // 8724 +export const JITO_TIP_ROUTER_ERROR__NO_OPERATORS = 0x2215; // 8725 /** VaultOperatorDelegationFinalized: Vault operator delegation is already finalized - should not happen */ -export const JITO_TIP_ROUTER_ERROR__VAULT_OPERATOR_DELEGATION_FINALIZED = 0x2215; // 8725 +export const JITO_TIP_ROUTER_ERROR__VAULT_OPERATOR_DELEGATION_FINALIZED = 0x2216; // 8726 /** OperatorFinalized: Operator is already finalized - should not happen */ -export const JITO_TIP_ROUTER_ERROR__OPERATOR_FINALIZED = 0x2216; // 8726 +export const JITO_TIP_ROUTER_ERROR__OPERATOR_FINALIZED = 0x2217; // 8727 /** TooManyVaultOperatorDelegations: Too many vault operator delegations */ -export const JITO_TIP_ROUTER_ERROR__TOO_MANY_VAULT_OPERATOR_DELEGATIONS = 0x2217; // 8727 +export const JITO_TIP_ROUTER_ERROR__TOO_MANY_VAULT_OPERATOR_DELEGATIONS = 0x2218; // 8728 /** DuplicateVaultOperatorDelegation: Duplicate vault operator delegation */ -export const JITO_TIP_ROUTER_ERROR__DUPLICATE_VAULT_OPERATOR_DELEGATION = 0x2218; // 8728 +export const JITO_TIP_ROUTER_ERROR__DUPLICATE_VAULT_OPERATOR_DELEGATION = 0x2219; // 8729 /** DuplicateVoteCast: Duplicate Vote Cast */ -export const JITO_TIP_ROUTER_ERROR__DUPLICATE_VOTE_CAST = 0x2219; // 8729 +export const JITO_TIP_ROUTER_ERROR__DUPLICATE_VOTE_CAST = 0x221a; // 8730 /** OperatorVotesFull: Operator votes full */ -export const JITO_TIP_ROUTER_ERROR__OPERATOR_VOTES_FULL = 0x221a; // 8730 +export const JITO_TIP_ROUTER_ERROR__OPERATOR_VOTES_FULL = 0x221b; // 8731 /** BallotTallyFull: Merkle root tally full */ -export const JITO_TIP_ROUTER_ERROR__BALLOT_TALLY_FULL = 0x221b; // 8731 +export const JITO_TIP_ROUTER_ERROR__BALLOT_TALLY_FULL = 0x221c; // 8732 /** ConsensusAlreadyReached: Consensus already reached */ -export const JITO_TIP_ROUTER_ERROR__CONSENSUS_ALREADY_REACHED = 0x221c; // 8732 +export const JITO_TIP_ROUTER_ERROR__CONSENSUS_ALREADY_REACHED = 0x221d; // 8733 /** ConsensusNotReached: Consensus not reached */ -export const JITO_TIP_ROUTER_ERROR__CONSENSUS_NOT_REACHED = 0x221d; // 8733 +export const JITO_TIP_ROUTER_ERROR__CONSENSUS_NOT_REACHED = 0x221e; // 8734 +/** InvalidNcnFeeGroup: Not a valid NCN fee group */ +export const JITO_TIP_ROUTER_ERROR__INVALID_NCN_FEE_GROUP = 0x221f; // 8735 export type JitoTipRouterError = | typeof JITO_TIP_ROUTER_ERROR__ARITHMETIC_OVERFLOW @@ -104,6 +108,8 @@ export type JitoTipRouterError = | typeof JITO_TIP_ROUTER_ERROR__INCORRECT_NCN_ADMIN | typeof JITO_TIP_ROUTER_ERROR__INCORRECT_WEIGHT_TABLE_ADMIN | typeof JITO_TIP_ROUTER_ERROR__INVALID_MINT_FOR_WEIGHT_TABLE + | typeof JITO_TIP_ROUTER_ERROR__INVALID_NCN_FEE_GROUP + | typeof JITO_TIP_ROUTER_ERROR__MINT_ENTRY_NOT_FOUND | typeof JITO_TIP_ROUTER_ERROR__MODULO_OVERFLOW | typeof JITO_TIP_ROUTER_ERROR__NEW_PRECISE_NUMBER_ERROR | typeof JITO_TIP_ROUTER_ERROR__NO_MINTS_IN_TABLE @@ -143,6 +149,8 @@ if (process.env.NODE_ENV !== 'production') { [JITO_TIP_ROUTER_ERROR__INCORRECT_NCN_ADMIN]: `Incorrect NCN Admin`, [JITO_TIP_ROUTER_ERROR__INCORRECT_WEIGHT_TABLE_ADMIN]: `Incorrect weight table admin`, [JITO_TIP_ROUTER_ERROR__INVALID_MINT_FOR_WEIGHT_TABLE]: `Invalid mint for weight table`, + [JITO_TIP_ROUTER_ERROR__INVALID_NCN_FEE_GROUP]: `Not a valid NCN fee group`, + [JITO_TIP_ROUTER_ERROR__MINT_ENTRY_NOT_FOUND]: `Mint Entry not found`, [JITO_TIP_ROUTER_ERROR__MODULO_OVERFLOW]: `Modulo Overflow`, [JITO_TIP_ROUTER_ERROR__NEW_PRECISE_NUMBER_ERROR]: `New precise number error`, [JITO_TIP_ROUTER_ERROR__NO_MINTS_IN_TABLE]: `There are no mints in the table`, diff --git a/clients/js/jito_tip_router/instructions/setConfigFees.ts b/clients/js/jito_tip_router/instructions/setConfigFees.ts index d5b0dc4..808ad2b 100644 --- a/clients/js/jito_tip_router/instructions/setConfigFees.ts +++ b/clients/js/jito_tip_router/instructions/setConfigFees.ts @@ -76,27 +76,30 @@ export type SetConfigFeesInstruction< export type SetConfigFeesInstructionData = { discriminator: number; + newFeeWallet: Option
; + newBlockEngineFeeBps: Option; newDaoFeeBps: Option; newNcnFeeBps: Option; - newBlockEngineFeeBps: Option; - newFeeWallet: Option
; + newNcnFeeGroup: Option; }; export type SetConfigFeesInstructionDataArgs = { + newFeeWallet: OptionOrNullable
; + newBlockEngineFeeBps: OptionOrNullable; newDaoFeeBps: OptionOrNullable; newNcnFeeBps: OptionOrNullable; - newBlockEngineFeeBps: OptionOrNullable; - newFeeWallet: OptionOrNullable
; + newNcnFeeGroup: OptionOrNullable; }; export function getSetConfigFeesInstructionDataEncoder(): Encoder { return transformEncoder( getStructEncoder([ ['discriminator', getU8Encoder()], + ['newFeeWallet', getOptionEncoder(getAddressEncoder())], + ['newBlockEngineFeeBps', getOptionEncoder(getU64Encoder())], ['newDaoFeeBps', getOptionEncoder(getU64Encoder())], ['newNcnFeeBps', getOptionEncoder(getU64Encoder())], - ['newBlockEngineFeeBps', getOptionEncoder(getU64Encoder())], - ['newFeeWallet', getOptionEncoder(getAddressEncoder())], + ['newNcnFeeGroup', getOptionEncoder(getU8Encoder())], ]), (value) => ({ ...value, discriminator: SET_CONFIG_FEES_DISCRIMINATOR }) ); @@ -105,10 +108,11 @@ export function getSetConfigFeesInstructionDataEncoder(): Encoder { return getStructDecoder([ ['discriminator', getU8Decoder()], + ['newFeeWallet', getOptionDecoder(getAddressDecoder())], + ['newBlockEngineFeeBps', getOptionDecoder(getU64Decoder())], ['newDaoFeeBps', getOptionDecoder(getU64Decoder())], ['newNcnFeeBps', getOptionDecoder(getU64Decoder())], - ['newBlockEngineFeeBps', getOptionDecoder(getU64Decoder())], - ['newFeeWallet', getOptionDecoder(getAddressDecoder())], + ['newNcnFeeGroup', getOptionDecoder(getU8Decoder())], ]); } @@ -134,10 +138,11 @@ export type SetConfigFeesInput< ncn: Address; ncnAdmin: TransactionSigner; restakingProgram: Address; + newFeeWallet: SetConfigFeesInstructionDataArgs['newFeeWallet']; + newBlockEngineFeeBps: SetConfigFeesInstructionDataArgs['newBlockEngineFeeBps']; newDaoFeeBps: SetConfigFeesInstructionDataArgs['newDaoFeeBps']; newNcnFeeBps: SetConfigFeesInstructionDataArgs['newNcnFeeBps']; - newBlockEngineFeeBps: SetConfigFeesInstructionDataArgs['newBlockEngineFeeBps']; - newFeeWallet: SetConfigFeesInstructionDataArgs['newFeeWallet']; + newNcnFeeGroup: SetConfigFeesInstructionDataArgs['newNcnFeeGroup']; }; export function getSetConfigFeesInstruction< diff --git a/clients/js/jito_tip_router/instructions/snapshotVaultOperatorDelegation.ts b/clients/js/jito_tip_router/instructions/snapshotVaultOperatorDelegation.ts index 17fbe18..e077e0c 100644 --- a/clients/js/jito_tip_router/instructions/snapshotVaultOperatorDelegation.ts +++ b/clients/js/jito_tip_router/instructions/snapshotVaultOperatorDelegation.ts @@ -45,6 +45,7 @@ export type SnapshotVaultOperatorDelegationInstruction< TProgram extends string = typeof JITO_TIP_ROUTER_PROGRAM_ADDRESS, TAccountNcnConfig extends string | IAccountMeta = string, TAccountRestakingConfig extends string | IAccountMeta = string, + TAccountTrackedMints extends string | IAccountMeta = string, TAccountNcn extends string | IAccountMeta = string, TAccountOperator extends string | IAccountMeta = string, TAccountVault extends string | IAccountMeta = string, @@ -69,6 +70,9 @@ export type SnapshotVaultOperatorDelegationInstruction< TAccountRestakingConfig extends string ? ReadonlyAccount : TAccountRestakingConfig, + TAccountTrackedMints extends string + ? ReadonlyAccount + : TAccountTrackedMints, TAccountNcn extends string ? ReadonlyAccount : TAccountNcn, TAccountOperator extends string ? ReadonlyAccount @@ -146,6 +150,7 @@ export function getSnapshotVaultOperatorDelegationInstructionDataCodec(): Codec< export type SnapshotVaultOperatorDelegationInput< TAccountNcnConfig extends string = string, TAccountRestakingConfig extends string = string, + TAccountTrackedMints extends string = string, TAccountNcn extends string = string, TAccountOperator extends string = string, TAccountVault extends string = string, @@ -160,6 +165,7 @@ export type SnapshotVaultOperatorDelegationInput< > = { ncnConfig: Address; restakingConfig: Address; + trackedMints: Address; ncn: Address; operator: Address; vault: Address; @@ -177,6 +183,7 @@ export type SnapshotVaultOperatorDelegationInput< export function getSnapshotVaultOperatorDelegationInstruction< TAccountNcnConfig extends string, TAccountRestakingConfig extends string, + TAccountTrackedMints extends string, TAccountNcn extends string, TAccountOperator extends string, TAccountVault extends string, @@ -193,6 +200,7 @@ export function getSnapshotVaultOperatorDelegationInstruction< input: SnapshotVaultOperatorDelegationInput< TAccountNcnConfig, TAccountRestakingConfig, + TAccountTrackedMints, TAccountNcn, TAccountOperator, TAccountVault, @@ -210,6 +218,7 @@ export function getSnapshotVaultOperatorDelegationInstruction< TProgramAddress, TAccountNcnConfig, TAccountRestakingConfig, + TAccountTrackedMints, TAccountNcn, TAccountOperator, TAccountVault, @@ -233,6 +242,7 @@ export function getSnapshotVaultOperatorDelegationInstruction< value: input.restakingConfig ?? null, isWritable: false, }, + trackedMints: { value: input.trackedMints ?? null, isWritable: false }, ncn: { value: input.ncn ?? null, isWritable: false }, operator: { value: input.operator ?? null, isWritable: false }, vault: { value: input.vault ?? null, isWritable: false }, @@ -267,6 +277,7 @@ export function getSnapshotVaultOperatorDelegationInstruction< accounts: [ getAccountMeta(accounts.ncnConfig), getAccountMeta(accounts.restakingConfig), + getAccountMeta(accounts.trackedMints), getAccountMeta(accounts.ncn), getAccountMeta(accounts.operator), getAccountMeta(accounts.vault), @@ -287,6 +298,7 @@ export function getSnapshotVaultOperatorDelegationInstruction< TProgramAddress, TAccountNcnConfig, TAccountRestakingConfig, + TAccountTrackedMints, TAccountNcn, TAccountOperator, TAccountVault, @@ -311,17 +323,18 @@ export type ParsedSnapshotVaultOperatorDelegationInstruction< accounts: { ncnConfig: TAccountMetas[0]; restakingConfig: TAccountMetas[1]; - ncn: TAccountMetas[2]; - operator: TAccountMetas[3]; - vault: TAccountMetas[4]; - vaultNcnTicket: TAccountMetas[5]; - ncnVaultTicket: TAccountMetas[6]; - vaultOperatorDelegation: TAccountMetas[7]; - weightTable: TAccountMetas[8]; - epochSnapshot: TAccountMetas[9]; - operatorSnapshot: TAccountMetas[10]; - vaultProgram: TAccountMetas[11]; - restakingProgram: TAccountMetas[12]; + trackedMints: TAccountMetas[2]; + ncn: TAccountMetas[3]; + operator: TAccountMetas[4]; + vault: TAccountMetas[5]; + vaultNcnTicket: TAccountMetas[6]; + ncnVaultTicket: TAccountMetas[7]; + vaultOperatorDelegation: TAccountMetas[8]; + weightTable: TAccountMetas[9]; + epochSnapshot: TAccountMetas[10]; + operatorSnapshot: TAccountMetas[11]; + vaultProgram: TAccountMetas[12]; + restakingProgram: TAccountMetas[13]; }; data: SnapshotVaultOperatorDelegationInstructionData; }; @@ -334,7 +347,7 @@ export function parseSnapshotVaultOperatorDelegationInstruction< IInstructionWithAccounts & IInstructionWithData ): ParsedSnapshotVaultOperatorDelegationInstruction { - if (instruction.accounts.length < 13) { + if (instruction.accounts.length < 14) { // TODO: Coded error. throw new Error('Not enough accounts'); } @@ -349,6 +362,7 @@ export function parseSnapshotVaultOperatorDelegationInstruction< accounts: { ncnConfig: getNextAccount(), restakingConfig: getNextAccount(), + trackedMints: getNextAccount(), ncn: getNextAccount(), operator: getNextAccount(), vault: getNextAccount(), diff --git a/clients/js/jito_tip_router/types/fee.ts b/clients/js/jito_tip_router/types/fee.ts deleted file mode 100644 index f91f0c4..0000000 --- a/clients/js/jito_tip_router/types/fee.ts +++ /dev/null @@ -1,61 +0,0 @@ -/** - * This code was AUTOGENERATED using the kinobi library. - * Please DO NOT EDIT THIS FILE, instead use visitors - * to add features, then rerun kinobi to update it. - * - * @see https://github.com/kinobi-so/kinobi - */ - -import { - combineCodec, - getAddressDecoder, - getAddressEncoder, - getStructDecoder, - getStructEncoder, - getU64Decoder, - getU64Encoder, - type Address, - type Codec, - type Decoder, - type Encoder, -} from '@solana/web3.js'; - -export type Fee = { - wallet: Address; - daoShareBps: bigint; - ncnShareBps: bigint; - blockEngineFeeBps: bigint; - activationEpoch: bigint; -}; - -export type FeeArgs = { - wallet: Address; - daoShareBps: number | bigint; - ncnShareBps: number | bigint; - blockEngineFeeBps: number | bigint; - activationEpoch: number | bigint; -}; - -export function getFeeEncoder(): Encoder { - return getStructEncoder([ - ['wallet', getAddressEncoder()], - ['daoShareBps', getU64Encoder()], - ['ncnShareBps', getU64Encoder()], - ['blockEngineFeeBps', getU64Encoder()], - ['activationEpoch', getU64Encoder()], - ]); -} - -export function getFeeDecoder(): Decoder { - return getStructDecoder([ - ['wallet', getAddressDecoder()], - ['daoShareBps', getU64Decoder()], - ['ncnShareBps', getU64Decoder()], - ['blockEngineFeeBps', getU64Decoder()], - ['activationEpoch', getU64Decoder()], - ]); -} - -export function getFeeCodec(): Codec { - return combineCodec(getFeeEncoder(), getFeeDecoder()); -} diff --git a/clients/js/jito_tip_router/types/feeConfig.ts b/clients/js/jito_tip_router/types/feeConfig.ts new file mode 100644 index 0000000..5482cfe --- /dev/null +++ b/clients/js/jito_tip_router/types/feeConfig.ts @@ -0,0 +1,48 @@ +/** + * This code was AUTOGENERATED using the kinobi library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun kinobi to update it. + * + * @see https://github.com/kinobi-so/kinobi + */ + +import { + combineCodec, + getAddressDecoder, + getAddressEncoder, + getStructDecoder, + getStructEncoder, + type Address, + type Codec, + type Decoder, + type Encoder, +} from '@solana/web3.js'; +import { getFeesDecoder, getFeesEncoder, type Fees, type FeesArgs } from '.'; + +export type FeeConfig = { daoFeeWallet: Address; fee1: Fees; fee2: Fees }; + +export type FeeConfigArgs = { + daoFeeWallet: Address; + fee1: FeesArgs; + fee2: FeesArgs; +}; + +export function getFeeConfigEncoder(): Encoder { + return getStructEncoder([ + ['daoFeeWallet', getAddressEncoder()], + ['fee1', getFeesEncoder()], + ['fee2', getFeesEncoder()], + ]); +} + +export function getFeeConfigDecoder(): Decoder { + return getStructDecoder([ + ['daoFeeWallet', getAddressDecoder()], + ['fee1', getFeesDecoder()], + ['fee2', getFeesDecoder()], + ]); +} + +export function getFeeConfigCodec(): Codec { + return combineCodec(getFeeConfigEncoder(), getFeeConfigDecoder()); +} diff --git a/clients/js/jito_tip_router/types/fees.ts b/clients/js/jito_tip_router/types/fees.ts index 2803f66..aee87bc 100644 --- a/clients/js/jito_tip_router/types/fees.ts +++ b/clients/js/jito_tip_router/types/fees.ts @@ -8,29 +8,61 @@ import { combineCodec, + fixDecoderSize, + fixEncoderSize, + getArrayDecoder, + getArrayEncoder, + getBytesDecoder, + getBytesEncoder, getStructDecoder, getStructEncoder, + getU64Decoder, + getU64Encoder, type Codec, type Decoder, type Encoder, + type ReadonlyUint8Array, } from '@solana/web3.js'; -import { getFeeDecoder, getFeeEncoder, type Fee, type FeeArgs } from '.'; +import { + getNcnFeeDecoder, + getNcnFeeEncoder, + type NcnFee, + type NcnFeeArgs, +} from '.'; -export type Fees = { fee1: Fee; fee2: Fee }; +export type Fees = { + activationEpoch: bigint; + blockEngineFeeBps: bigint; + daoFeeBps: bigint; + ncnFeeGroupsBps: Array; + reserved: ReadonlyUint8Array; +}; -export type FeesArgs = { fee1: FeeArgs; fee2: FeeArgs }; +export type FeesArgs = { + activationEpoch: number | bigint; + blockEngineFeeBps: number | bigint; + daoFeeBps: number | bigint; + ncnFeeGroupsBps: Array; + reserved: ReadonlyUint8Array; +}; export function getFeesEncoder(): Encoder { return getStructEncoder([ - ['fee1', getFeeEncoder()], - ['fee2', getFeeEncoder()], + ['activationEpoch', getU64Encoder()], + ['blockEngineFeeBps', getU64Encoder()], + ['daoFeeBps', getU64Encoder()], + ['ncnFeeGroupsBps', getArrayEncoder(getNcnFeeEncoder(), { size: 16 })], + ['reserved', fixEncoderSize(getBytesEncoder(), 64)], ]); } export function getFeesDecoder(): Decoder { return getStructDecoder([ - ['fee1', getFeeDecoder()], - ['fee2', getFeeDecoder()], + ['activationEpoch', getU64Decoder()], + ['blockEngineFeeBps', getU64Decoder()], + ['daoFeeBps', getU64Decoder()], + ['ncnFeeGroupsBps', getArrayDecoder(getNcnFeeDecoder(), { size: 16 })], + ['reserved', fixDecoderSize(getBytesDecoder(), 64)], ]); } diff --git a/clients/js/jito_tip_router/types/index.ts b/clients/js/jito_tip_router/types/index.ts index b49207d..aff498b 100644 --- a/clients/js/jito_tip_router/types/index.ts +++ b/clients/js/jito_tip_router/types/index.ts @@ -9,9 +9,13 @@ export * from './ballot'; export * from './ballotTally'; export * from './configAdminRole'; -export * from './fee'; +export * from './feeConfig'; export * from './fees'; export * from './mintEntry'; +export * from './ncnFee'; +export * from './ncnFeeGroup'; export * from './operatorVote'; +export * from './rewardStakeWeight'; +export * from './stakeWeight'; export * from './vaultOperatorStakeWeight'; export * from './weightEntry'; diff --git a/clients/js/jito_tip_router/types/mintEntry.ts b/clients/js/jito_tip_router/types/mintEntry.ts index aade315..3dfaf49 100644 --- a/clients/js/jito_tip_router/types/mintEntry.ts +++ b/clients/js/jito_tip_router/types/mintEntry.ts @@ -24,16 +24,24 @@ import { type Encoder, type ReadonlyUint8Array, } from '@solana/web3.js'; +import { + getNcnFeeGroupDecoder, + getNcnFeeGroupEncoder, + type NcnFeeGroup, + type NcnFeeGroupArgs, +} from '.'; export type MintEntry = { stMint: Address; vaultIndex: bigint; + ncnFeeGroup: NcnFeeGroup; reserved: ReadonlyUint8Array; }; export type MintEntryArgs = { stMint: Address; vaultIndex: number | bigint; + ncnFeeGroup: NcnFeeGroupArgs; reserved: ReadonlyUint8Array; }; @@ -41,6 +49,7 @@ export function getMintEntryEncoder(): Encoder { return getStructEncoder([ ['stMint', getAddressEncoder()], ['vaultIndex', getU64Encoder()], + ['ncnFeeGroup', getNcnFeeGroupEncoder()], ['reserved', fixEncoderSize(getBytesEncoder(), 32)], ]); } @@ -49,6 +58,7 @@ export function getMintEntryDecoder(): Decoder { return getStructDecoder([ ['stMint', getAddressDecoder()], ['vaultIndex', getU64Decoder()], + ['ncnFeeGroup', getNcnFeeGroupDecoder()], ['reserved', fixDecoderSize(getBytesDecoder(), 32)], ]); } diff --git a/clients/js/jito_tip_router/types/ncnFee.ts b/clients/js/jito_tip_router/types/ncnFee.ts new file mode 100644 index 0000000..e232a91 --- /dev/null +++ b/clients/js/jito_tip_router/types/ncnFee.ts @@ -0,0 +1,45 @@ +/** + * This code was AUTOGENERATED using the kinobi library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun kinobi to update it. + * + * @see https://github.com/kinobi-so/kinobi + */ + +import { + combineCodec, + fixDecoderSize, + fixEncoderSize, + getBytesDecoder, + getBytesEncoder, + getStructDecoder, + getStructEncoder, + getU64Decoder, + getU64Encoder, + type Codec, + type Decoder, + type Encoder, + type ReadonlyUint8Array, +} from '@solana/web3.js'; + +export type NcnFee = { fee: bigint; reserved: ReadonlyUint8Array }; + +export type NcnFeeArgs = { fee: number | bigint; reserved: ReadonlyUint8Array }; + +export function getNcnFeeEncoder(): Encoder { + return getStructEncoder([ + ['fee', getU64Encoder()], + ['reserved', fixEncoderSize(getBytesEncoder(), 64)], + ]); +} + +export function getNcnFeeDecoder(): Decoder { + return getStructDecoder([ + ['fee', getU64Decoder()], + ['reserved', fixDecoderSize(getBytesDecoder(), 64)], + ]); +} + +export function getNcnFeeCodec(): Codec { + return combineCodec(getNcnFeeEncoder(), getNcnFeeDecoder()); +} diff --git a/clients/js/jito_tip_router/types/ncnFeeGroup.ts b/clients/js/jito_tip_router/types/ncnFeeGroup.ts new file mode 100644 index 0000000..c9e3c57 --- /dev/null +++ b/clients/js/jito_tip_router/types/ncnFeeGroup.ts @@ -0,0 +1,34 @@ +/** + * This code was AUTOGENERATED using the kinobi library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun kinobi to update it. + * + * @see https://github.com/kinobi-so/kinobi + */ + +import { + combineCodec, + getStructDecoder, + getStructEncoder, + getU8Decoder, + getU8Encoder, + type Codec, + type Decoder, + type Encoder, +} from '@solana/web3.js'; + +export type NcnFeeGroup = { group: number }; + +export type NcnFeeGroupArgs = NcnFeeGroup; + +export function getNcnFeeGroupEncoder(): Encoder { + return getStructEncoder([['group', getU8Encoder()]]); +} + +export function getNcnFeeGroupDecoder(): Decoder { + return getStructDecoder([['group', getU8Decoder()]]); +} + +export function getNcnFeeGroupCodec(): Codec { + return combineCodec(getNcnFeeGroupEncoder(), getNcnFeeGroupDecoder()); +} diff --git a/clients/js/jito_tip_router/types/rewardStakeWeight.ts b/clients/js/jito_tip_router/types/rewardStakeWeight.ts new file mode 100644 index 0000000..160f104 --- /dev/null +++ b/clients/js/jito_tip_router/types/rewardStakeWeight.ts @@ -0,0 +1,57 @@ +/** + * This code was AUTOGENERATED using the kinobi library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun kinobi to update it. + * + * @see https://github.com/kinobi-so/kinobi + */ + +import { + combineCodec, + fixDecoderSize, + fixEncoderSize, + getBytesDecoder, + getBytesEncoder, + getStructDecoder, + getStructEncoder, + getU128Decoder, + getU128Encoder, + type Codec, + type Decoder, + type Encoder, + type ReadonlyUint8Array, +} from '@solana/web3.js'; + +export type RewardStakeWeight = { + rewardStakeWeight: bigint; + reserved: ReadonlyUint8Array; +}; + +export type RewardStakeWeightArgs = { + rewardStakeWeight: number | bigint; + reserved: ReadonlyUint8Array; +}; + +export function getRewardStakeWeightEncoder(): Encoder { + return getStructEncoder([ + ['rewardStakeWeight', getU128Encoder()], + ['reserved', fixEncoderSize(getBytesEncoder(), 64)], + ]); +} + +export function getRewardStakeWeightDecoder(): Decoder { + return getStructDecoder([ + ['rewardStakeWeight', getU128Decoder()], + ['reserved', fixDecoderSize(getBytesDecoder(), 64)], + ]); +} + +export function getRewardStakeWeightCodec(): Codec< + RewardStakeWeightArgs, + RewardStakeWeight +> { + return combineCodec( + getRewardStakeWeightEncoder(), + getRewardStakeWeightDecoder() + ); +} diff --git a/clients/js/jito_tip_router/types/stakeWeight.ts b/clients/js/jito_tip_router/types/stakeWeight.ts new file mode 100644 index 0000000..0c5e293 --- /dev/null +++ b/clients/js/jito_tip_router/types/stakeWeight.ts @@ -0,0 +1,69 @@ +/** + * This code was AUTOGENERATED using the kinobi library. + * Please DO NOT EDIT THIS FILE, instead use visitors + * to add features, then rerun kinobi to update it. + * + * @see https://github.com/kinobi-so/kinobi + */ + +import { + combineCodec, + fixDecoderSize, + fixEncoderSize, + getArrayDecoder, + getArrayEncoder, + getBytesDecoder, + getBytesEncoder, + getStructDecoder, + getStructEncoder, + getU128Decoder, + getU128Encoder, + type Codec, + type Decoder, + type Encoder, + type ReadonlyUint8Array, +} from '@solana/web3.js'; +import { + getRewardStakeWeightDecoder, + getRewardStakeWeightEncoder, + type RewardStakeWeight, + type RewardStakeWeightArgs, +} from '.'; + +export type StakeWeight = { + stakeWeight: bigint; + rewardStakeWeights: Array; + reserved: ReadonlyUint8Array; +}; + +export type StakeWeightArgs = { + stakeWeight: number | bigint; + rewardStakeWeights: Array; + reserved: ReadonlyUint8Array; +}; + +export function getStakeWeightEncoder(): Encoder { + return getStructEncoder([ + ['stakeWeight', getU128Encoder()], + [ + 'rewardStakeWeights', + getArrayEncoder(getRewardStakeWeightEncoder(), { size: 16 }), + ], + ['reserved', fixEncoderSize(getBytesEncoder(), 64)], + ]); +} + +export function getStakeWeightDecoder(): Decoder { + return getStructDecoder([ + ['stakeWeight', getU128Decoder()], + [ + 'rewardStakeWeights', + getArrayDecoder(getRewardStakeWeightDecoder(), { size: 16 }), + ], + ['reserved', fixDecoderSize(getBytesDecoder(), 64)], + ]); +} + +export function getStakeWeightCodec(): Codec { + return combineCodec(getStakeWeightEncoder(), getStakeWeightDecoder()); +} diff --git a/clients/js/jito_tip_router/types/vaultOperatorStakeWeight.ts b/clients/js/jito_tip_router/types/vaultOperatorStakeWeight.ts index bd2932c..97785ae 100644 --- a/clients/js/jito_tip_router/types/vaultOperatorStakeWeight.ts +++ b/clients/js/jito_tip_router/types/vaultOperatorStakeWeight.ts @@ -16,8 +16,6 @@ import { getBytesEncoder, getStructDecoder, getStructEncoder, - getU128Decoder, - getU128Encoder, getU64Decoder, getU64Encoder, type Address, @@ -26,26 +24,32 @@ import { type Encoder, type ReadonlyUint8Array, } from '@solana/web3.js'; +import { + getStakeWeightDecoder, + getStakeWeightEncoder, + type StakeWeight, + type StakeWeightArgs, +} from '.'; export type VaultOperatorStakeWeight = { vault: Address; - stakeWeight: bigint; vaultIndex: bigint; + stakeWeight: StakeWeight; reserved: ReadonlyUint8Array; }; export type VaultOperatorStakeWeightArgs = { vault: Address; - stakeWeight: number | bigint; vaultIndex: number | bigint; + stakeWeight: StakeWeightArgs; reserved: ReadonlyUint8Array; }; export function getVaultOperatorStakeWeightEncoder(): Encoder { return getStructEncoder([ ['vault', getAddressEncoder()], - ['stakeWeight', getU128Encoder()], ['vaultIndex', getU64Encoder()], + ['stakeWeight', getStakeWeightEncoder()], ['reserved', fixEncoderSize(getBytesEncoder(), 32)], ]); } @@ -53,8 +57,8 @@ export function getVaultOperatorStakeWeightEncoder(): Encoder { return getStructDecoder([ ['vault', getAddressDecoder()], - ['stakeWeight', getU128Decoder()], ['vaultIndex', getU64Decoder()], + ['stakeWeight', getStakeWeightDecoder()], ['reserved', fixDecoderSize(getBytesDecoder(), 32)], ]); } diff --git a/clients/rust/jito_tip_router/src/generated/accounts/epoch_snapshot.rs b/clients/rust/jito_tip_router/src/generated/accounts/epoch_snapshot.rs index 991ef77..a3d0959 100644 --- a/clients/rust/jito_tip_router/src/generated/accounts/epoch_snapshot.rs +++ b/clients/rust/jito_tip_router/src/generated/accounts/epoch_snapshot.rs @@ -7,7 +7,7 @@ use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::pubkey::Pubkey; -use crate::generated::types::Fees; +use crate::generated::types::{Fees, StakeWeight}; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] @@ -27,7 +27,7 @@ pub struct EpochSnapshot { pub vault_count: u64, pub operators_registered: u64, pub valid_operator_vault_delegations: u64, - pub stake_weight: u128, + pub stake_weight: StakeWeight, #[cfg_attr(feature = "serde", serde(with = "serde_with::As::"))] pub reserved: [u8; 128], } diff --git a/clients/rust/jito_tip_router/src/generated/accounts/ncn_config.rs b/clients/rust/jito_tip_router/src/generated/accounts/ncn_config.rs index eaca31b..6d4eb2a 100644 --- a/clients/rust/jito_tip_router/src/generated/accounts/ncn_config.rs +++ b/clients/rust/jito_tip_router/src/generated/accounts/ncn_config.rs @@ -7,7 +7,7 @@ use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::pubkey::Pubkey; -use crate::generated::types::Fees; +use crate::generated::types::FeeConfig; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] @@ -28,7 +28,7 @@ pub struct NcnConfig { serde(with = "serde_with::As::") )] pub fee_admin: Pubkey, - pub fees: Fees, + pub fee_config: FeeConfig, pub bump: u8, #[cfg_attr(feature = "serde", serde(with = "serde_with::As::"))] pub reserved: [u8; 127], diff --git a/clients/rust/jito_tip_router/src/generated/accounts/operator_snapshot.rs b/clients/rust/jito_tip_router/src/generated/accounts/operator_snapshot.rs index a30fbde..e232166 100644 --- a/clients/rust/jito_tip_router/src/generated/accounts/operator_snapshot.rs +++ b/clients/rust/jito_tip_router/src/generated/accounts/operator_snapshot.rs @@ -7,7 +7,7 @@ use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::pubkey::Pubkey; -use crate::generated::types::VaultOperatorStakeWeight; +use crate::generated::types::{StakeWeight, VaultOperatorStakeWeight}; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] @@ -34,7 +34,7 @@ pub struct OperatorSnapshot { pub vault_operator_delegation_count: u64, pub vault_operator_delegations_registered: u64, pub valid_operator_vault_delegations: u64, - pub stake_weight: u128, + pub stake_weight: StakeWeight, #[cfg_attr(feature = "serde", serde(with = "serde_with::As::"))] pub reserved: [u8; 256], pub vault_operator_stake_weight: [VaultOperatorStakeWeight; 32], diff --git a/clients/rust/jito_tip_router/src/generated/errors/jito_tip_router.rs b/clients/rust/jito_tip_router/src/generated/errors/jito_tip_router.rs index ce806cb..778efe5 100644 --- a/clients/rust/jito_tip_router/src/generated/errors/jito_tip_router.rs +++ b/clients/rust/jito_tip_router/src/generated/errors/jito_tip_router.rs @@ -66,54 +66,60 @@ pub enum JitoTipRouterError { /// 8717 - Vault index already in use by a different mint #[error("Vault index already in use by a different mint")] VaultIndexAlreadyInUse = 0x220D, - /// 8718 - Fee cap exceeded + /// 8718 - Mint Entry not found + #[error("Mint Entry not found")] + MintEntryNotFound = 0x220E, + /// 8719 - Fee cap exceeded #[error("Fee cap exceeded")] - FeeCapExceeded = 0x220E, - /// 8719 - Incorrect NCN Admin + FeeCapExceeded = 0x220F, + /// 8720 - Incorrect NCN Admin #[error("Incorrect NCN Admin")] - IncorrectNcnAdmin = 0x220F, - /// 8720 - Incorrect NCN + IncorrectNcnAdmin = 0x2210, + /// 8721 - Incorrect NCN #[error("Incorrect NCN")] - IncorrectNcn = 0x2210, - /// 8721 - Incorrect fee admin + IncorrectNcn = 0x2211, + /// 8722 - Incorrect fee admin #[error("Incorrect fee admin")] - IncorrectFeeAdmin = 0x2211, - /// 8722 - Weight table not finalized + IncorrectFeeAdmin = 0x2212, + /// 8723 - Weight table not finalized #[error("Weight table not finalized")] - WeightTableNotFinalized = 0x2212, - /// 8723 - Weight not found + WeightTableNotFinalized = 0x2213, + /// 8724 - Weight not found #[error("Weight not found")] - WeightNotFound = 0x2213, - /// 8724 - No operators in ncn + WeightNotFound = 0x2214, + /// 8725 - No operators in ncn #[error("No operators in ncn")] - NoOperators = 0x2214, - /// 8725 - Vault operator delegation is already finalized - should not happen + NoOperators = 0x2215, + /// 8726 - Vault operator delegation is already finalized - should not happen #[error("Vault operator delegation is already finalized - should not happen")] - VaultOperatorDelegationFinalized = 0x2215, - /// 8726 - Operator is already finalized - should not happen + VaultOperatorDelegationFinalized = 0x2216, + /// 8727 - Operator is already finalized - should not happen #[error("Operator is already finalized - should not happen")] - OperatorFinalized = 0x2216, - /// 8727 - Too many vault operator delegations + OperatorFinalized = 0x2217, + /// 8728 - Too many vault operator delegations #[error("Too many vault operator delegations")] - TooManyVaultOperatorDelegations = 0x2217, - /// 8728 - Duplicate vault operator delegation + TooManyVaultOperatorDelegations = 0x2218, + /// 8729 - Duplicate vault operator delegation #[error("Duplicate vault operator delegation")] - DuplicateVaultOperatorDelegation = 0x2218, - /// 8729 - Duplicate Vote Cast + DuplicateVaultOperatorDelegation = 0x2219, + /// 8730 - Duplicate Vote Cast #[error("Duplicate Vote Cast")] - DuplicateVoteCast = 0x2219, - /// 8730 - Operator votes full + DuplicateVoteCast = 0x221A, + /// 8731 - Operator votes full #[error("Operator votes full")] - OperatorVotesFull = 0x221A, - /// 8731 - Merkle root tally full + OperatorVotesFull = 0x221B, + /// 8732 - Merkle root tally full #[error("Merkle root tally full")] - BallotTallyFull = 0x221B, - /// 8732 - Consensus already reached + BallotTallyFull = 0x221C, + /// 8733 - Consensus already reached #[error("Consensus already reached")] - ConsensusAlreadyReached = 0x221C, - /// 8733 - Consensus not reached + ConsensusAlreadyReached = 0x221D, + /// 8734 - Consensus not reached #[error("Consensus not reached")] - ConsensusNotReached = 0x221D, + ConsensusNotReached = 0x221E, + /// 8735 - Not a valid NCN fee group + #[error("Not a valid NCN fee group")] + InvalidNcnFeeGroup = 0x221F, } impl solana_program::program_error::PrintProgramError for JitoTipRouterError { diff --git a/clients/rust/jito_tip_router/src/generated/instructions/set_config_fees.rs b/clients/rust/jito_tip_router/src/generated/instructions/set_config_fees.rs index 877c04f..4ecd0fe 100644 --- a/clients/rust/jito_tip_router/src/generated/instructions/set_config_fees.rs +++ b/clients/rust/jito_tip_router/src/generated/instructions/set_config_fees.rs @@ -86,10 +86,11 @@ impl Default for SetConfigFeesInstructionData { #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct SetConfigFeesInstructionArgs { + pub new_fee_wallet: Option, + pub new_block_engine_fee_bps: Option, pub new_dao_fee_bps: Option, pub new_ncn_fee_bps: Option, - pub new_block_engine_fee_bps: Option, - pub new_fee_wallet: Option, + pub new_ncn_fee_group: Option, } /// Instruction builder for `SetConfigFees`. @@ -108,10 +109,11 @@ pub struct SetConfigFeesBuilder { ncn: Option, ncn_admin: Option, restaking_program: Option, + new_fee_wallet: Option, + new_block_engine_fee_bps: Option, new_dao_fee_bps: Option, new_ncn_fee_bps: Option, - new_block_engine_fee_bps: Option, - new_fee_wallet: Option, + new_ncn_fee_group: Option, __remaining_accounts: Vec, } @@ -152,26 +154,32 @@ impl SetConfigFeesBuilder { } /// `[optional argument]` #[inline(always)] - pub fn new_dao_fee_bps(&mut self, new_dao_fee_bps: u64) -> &mut Self { - self.new_dao_fee_bps = Some(new_dao_fee_bps); + pub fn new_fee_wallet(&mut self, new_fee_wallet: Pubkey) -> &mut Self { + self.new_fee_wallet = Some(new_fee_wallet); self } /// `[optional argument]` #[inline(always)] - pub fn new_ncn_fee_bps(&mut self, new_ncn_fee_bps: u64) -> &mut Self { - self.new_ncn_fee_bps = Some(new_ncn_fee_bps); + pub fn new_block_engine_fee_bps(&mut self, new_block_engine_fee_bps: u64) -> &mut Self { + self.new_block_engine_fee_bps = Some(new_block_engine_fee_bps); self } /// `[optional argument]` #[inline(always)] - pub fn new_block_engine_fee_bps(&mut self, new_block_engine_fee_bps: u64) -> &mut Self { - self.new_block_engine_fee_bps = Some(new_block_engine_fee_bps); + pub fn new_dao_fee_bps(&mut self, new_dao_fee_bps: u64) -> &mut Self { + self.new_dao_fee_bps = Some(new_dao_fee_bps); self } /// `[optional argument]` #[inline(always)] - pub fn new_fee_wallet(&mut self, new_fee_wallet: Pubkey) -> &mut Self { - self.new_fee_wallet = Some(new_fee_wallet); + pub fn new_ncn_fee_bps(&mut self, new_ncn_fee_bps: u64) -> &mut Self { + self.new_ncn_fee_bps = Some(new_ncn_fee_bps); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn new_ncn_fee_group(&mut self, new_ncn_fee_group: u8) -> &mut Self { + self.new_ncn_fee_group = Some(new_ncn_fee_group); self } /// Add an additional account to the instruction. @@ -204,10 +212,11 @@ impl SetConfigFeesBuilder { .expect("restaking_program is not set"), }; let args = SetConfigFeesInstructionArgs { + new_fee_wallet: self.new_fee_wallet.clone(), + new_block_engine_fee_bps: self.new_block_engine_fee_bps.clone(), new_dao_fee_bps: self.new_dao_fee_bps.clone(), new_ncn_fee_bps: self.new_ncn_fee_bps.clone(), - new_block_engine_fee_bps: self.new_block_engine_fee_bps.clone(), - new_fee_wallet: self.new_fee_wallet.clone(), + new_ncn_fee_group: self.new_ncn_fee_group.clone(), }; accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) @@ -373,10 +382,11 @@ impl<'a, 'b> SetConfigFeesCpiBuilder<'a, 'b> { ncn: None, ncn_admin: None, restaking_program: None, + new_fee_wallet: None, + new_block_engine_fee_bps: None, new_dao_fee_bps: None, new_ncn_fee_bps: None, - new_block_engine_fee_bps: None, - new_fee_wallet: None, + new_ncn_fee_group: None, __remaining_accounts: Vec::new(), }); Self { instruction } @@ -420,26 +430,32 @@ impl<'a, 'b> SetConfigFeesCpiBuilder<'a, 'b> { } /// `[optional argument]` #[inline(always)] - pub fn new_dao_fee_bps(&mut self, new_dao_fee_bps: u64) -> &mut Self { - self.instruction.new_dao_fee_bps = Some(new_dao_fee_bps); + pub fn new_fee_wallet(&mut self, new_fee_wallet: Pubkey) -> &mut Self { + self.instruction.new_fee_wallet = Some(new_fee_wallet); self } /// `[optional argument]` #[inline(always)] - pub fn new_ncn_fee_bps(&mut self, new_ncn_fee_bps: u64) -> &mut Self { - self.instruction.new_ncn_fee_bps = Some(new_ncn_fee_bps); + pub fn new_block_engine_fee_bps(&mut self, new_block_engine_fee_bps: u64) -> &mut Self { + self.instruction.new_block_engine_fee_bps = Some(new_block_engine_fee_bps); self } /// `[optional argument]` #[inline(always)] - pub fn new_block_engine_fee_bps(&mut self, new_block_engine_fee_bps: u64) -> &mut Self { - self.instruction.new_block_engine_fee_bps = Some(new_block_engine_fee_bps); + pub fn new_dao_fee_bps(&mut self, new_dao_fee_bps: u64) -> &mut Self { + self.instruction.new_dao_fee_bps = Some(new_dao_fee_bps); self } /// `[optional argument]` #[inline(always)] - pub fn new_fee_wallet(&mut self, new_fee_wallet: Pubkey) -> &mut Self { - self.instruction.new_fee_wallet = Some(new_fee_wallet); + pub fn new_ncn_fee_bps(&mut self, new_ncn_fee_bps: u64) -> &mut Self { + self.instruction.new_ncn_fee_bps = Some(new_ncn_fee_bps); + self + } + /// `[optional argument]` + #[inline(always)] + pub fn new_ncn_fee_group(&mut self, new_ncn_fee_group: u8) -> &mut Self { + self.instruction.new_ncn_fee_group = Some(new_ncn_fee_group); self } /// Add an additional account to the instruction. @@ -484,10 +500,11 @@ impl<'a, 'b> SetConfigFeesCpiBuilder<'a, 'b> { signers_seeds: &[&[&[u8]]], ) -> solana_program::entrypoint::ProgramResult { let args = SetConfigFeesInstructionArgs { + new_fee_wallet: self.instruction.new_fee_wallet.clone(), + new_block_engine_fee_bps: self.instruction.new_block_engine_fee_bps.clone(), new_dao_fee_bps: self.instruction.new_dao_fee_bps.clone(), new_ncn_fee_bps: self.instruction.new_ncn_fee_bps.clone(), - new_block_engine_fee_bps: self.instruction.new_block_engine_fee_bps.clone(), - new_fee_wallet: self.instruction.new_fee_wallet.clone(), + new_ncn_fee_group: self.instruction.new_ncn_fee_group.clone(), }; let instruction = SetConfigFeesCpi { __program: self.instruction.__program, @@ -524,10 +541,11 @@ struct SetConfigFeesCpiBuilderInstruction<'a, 'b> { ncn: Option<&'b solana_program::account_info::AccountInfo<'a>>, ncn_admin: Option<&'b solana_program::account_info::AccountInfo<'a>>, restaking_program: Option<&'b solana_program::account_info::AccountInfo<'a>>, + new_fee_wallet: Option, + new_block_engine_fee_bps: Option, new_dao_fee_bps: Option, new_ncn_fee_bps: Option, - new_block_engine_fee_bps: Option, - new_fee_wallet: Option, + new_ncn_fee_group: Option, /// Additional instruction accounts `(AccountInfo, is_writable, is_signer)`. __remaining_accounts: Vec<( &'b solana_program::account_info::AccountInfo<'a>, diff --git a/clients/rust/jito_tip_router/src/generated/instructions/snapshot_vault_operator_delegation.rs b/clients/rust/jito_tip_router/src/generated/instructions/snapshot_vault_operator_delegation.rs index 86b411b..051b40f 100644 --- a/clients/rust/jito_tip_router/src/generated/instructions/snapshot_vault_operator_delegation.rs +++ b/clients/rust/jito_tip_router/src/generated/instructions/snapshot_vault_operator_delegation.rs @@ -12,6 +12,8 @@ pub struct SnapshotVaultOperatorDelegation { pub restaking_config: solana_program::pubkey::Pubkey, + pub tracked_mints: solana_program::pubkey::Pubkey, + pub ncn: solana_program::pubkey::Pubkey, pub operator: solana_program::pubkey::Pubkey, @@ -48,7 +50,7 @@ impl SnapshotVaultOperatorDelegation { args: SnapshotVaultOperatorDelegationInstructionArgs, remaining_accounts: &[solana_program::instruction::AccountMeta], ) -> solana_program::instruction::Instruction { - let mut accounts = Vec::with_capacity(13 + remaining_accounts.len()); + let mut accounts = Vec::with_capacity(14 + remaining_accounts.len()); accounts.push(solana_program::instruction::AccountMeta::new_readonly( self.ncn_config, false, @@ -57,6 +59,10 @@ impl SnapshotVaultOperatorDelegation { self.restaking_config, false, )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + self.tracked_mints, + false, + )); accounts.push(solana_program::instruction::AccountMeta::new_readonly( self.ncn, false, )); @@ -143,21 +149,23 @@ pub struct SnapshotVaultOperatorDelegationInstructionArgs { /// /// 0. `[]` ncn_config /// 1. `[]` restaking_config -/// 2. `[]` ncn -/// 3. `[]` operator -/// 4. `[]` vault -/// 5. `[]` vault_ncn_ticket -/// 6. `[]` ncn_vault_ticket -/// 7. `[]` vault_operator_delegation -/// 8. `[]` weight_table -/// 9. `[writable]` epoch_snapshot -/// 10. `[writable]` operator_snapshot -/// 11. `[]` vault_program -/// 12. `[]` restaking_program +/// 2. `[]` tracked_mints +/// 3. `[]` ncn +/// 4. `[]` operator +/// 5. `[]` vault +/// 6. `[]` vault_ncn_ticket +/// 7. `[]` ncn_vault_ticket +/// 8. `[]` vault_operator_delegation +/// 9. `[]` weight_table +/// 10. `[writable]` epoch_snapshot +/// 11. `[writable]` operator_snapshot +/// 12. `[]` vault_program +/// 13. `[]` restaking_program #[derive(Clone, Debug, Default)] pub struct SnapshotVaultOperatorDelegationBuilder { ncn_config: Option, restaking_config: Option, + tracked_mints: Option, ncn: Option, operator: Option, vault: Option, @@ -191,6 +199,11 @@ impl SnapshotVaultOperatorDelegationBuilder { self } #[inline(always)] + pub fn tracked_mints(&mut self, tracked_mints: solana_program::pubkey::Pubkey) -> &mut Self { + self.tracked_mints = Some(tracked_mints); + self + } + #[inline(always)] pub fn ncn(&mut self, ncn: solana_program::pubkey::Pubkey) -> &mut Self { self.ncn = Some(ncn); self @@ -289,6 +302,7 @@ impl SnapshotVaultOperatorDelegationBuilder { let accounts = SnapshotVaultOperatorDelegation { ncn_config: self.ncn_config.expect("ncn_config is not set"), restaking_config: self.restaking_config.expect("restaking_config is not set"), + tracked_mints: self.tracked_mints.expect("tracked_mints is not set"), ncn: self.ncn.expect("ncn is not set"), operator: self.operator.expect("operator is not set"), vault: self.vault.expect("vault is not set"), @@ -321,6 +335,8 @@ pub struct SnapshotVaultOperatorDelegationCpiAccounts<'a, 'b> { pub restaking_config: &'b solana_program::account_info::AccountInfo<'a>, + pub tracked_mints: &'b solana_program::account_info::AccountInfo<'a>, + pub ncn: &'b solana_program::account_info::AccountInfo<'a>, pub operator: &'b solana_program::account_info::AccountInfo<'a>, @@ -353,6 +369,8 @@ pub struct SnapshotVaultOperatorDelegationCpi<'a, 'b> { pub restaking_config: &'b solana_program::account_info::AccountInfo<'a>, + pub tracked_mints: &'b solana_program::account_info::AccountInfo<'a>, + pub ncn: &'b solana_program::account_info::AccountInfo<'a>, pub operator: &'b solana_program::account_info::AccountInfo<'a>, @@ -388,6 +406,7 @@ impl<'a, 'b> SnapshotVaultOperatorDelegationCpi<'a, 'b> { __program: program, ncn_config: accounts.ncn_config, restaking_config: accounts.restaking_config, + tracked_mints: accounts.tracked_mints, ncn: accounts.ncn, operator: accounts.operator, vault: accounts.vault, @@ -435,7 +454,7 @@ impl<'a, 'b> SnapshotVaultOperatorDelegationCpi<'a, 'b> { bool, )], ) -> solana_program::entrypoint::ProgramResult { - let mut accounts = Vec::with_capacity(13 + remaining_accounts.len()); + let mut accounts = Vec::with_capacity(14 + remaining_accounts.len()); accounts.push(solana_program::instruction::AccountMeta::new_readonly( *self.ncn_config.key, false, @@ -444,6 +463,10 @@ impl<'a, 'b> SnapshotVaultOperatorDelegationCpi<'a, 'b> { *self.restaking_config.key, false, )); + accounts.push(solana_program::instruction::AccountMeta::new_readonly( + *self.tracked_mints.key, + false, + )); accounts.push(solana_program::instruction::AccountMeta::new_readonly( *self.ncn.key, false, @@ -506,10 +529,11 @@ impl<'a, 'b> SnapshotVaultOperatorDelegationCpi<'a, 'b> { accounts, data, }; - let mut account_infos = Vec::with_capacity(13 + 1 + remaining_accounts.len()); + let mut account_infos = Vec::with_capacity(14 + 1 + remaining_accounts.len()); account_infos.push(self.__program.clone()); account_infos.push(self.ncn_config.clone()); account_infos.push(self.restaking_config.clone()); + account_infos.push(self.tracked_mints.clone()); account_infos.push(self.ncn.clone()); account_infos.push(self.operator.clone()); account_infos.push(self.vault.clone()); @@ -539,17 +563,18 @@ impl<'a, 'b> SnapshotVaultOperatorDelegationCpi<'a, 'b> { /// /// 0. `[]` ncn_config /// 1. `[]` restaking_config -/// 2. `[]` ncn -/// 3. `[]` operator -/// 4. `[]` vault -/// 5. `[]` vault_ncn_ticket -/// 6. `[]` ncn_vault_ticket -/// 7. `[]` vault_operator_delegation -/// 8. `[]` weight_table -/// 9. `[writable]` epoch_snapshot -/// 10. `[writable]` operator_snapshot -/// 11. `[]` vault_program -/// 12. `[]` restaking_program +/// 2. `[]` tracked_mints +/// 3. `[]` ncn +/// 4. `[]` operator +/// 5. `[]` vault +/// 6. `[]` vault_ncn_ticket +/// 7. `[]` ncn_vault_ticket +/// 8. `[]` vault_operator_delegation +/// 9. `[]` weight_table +/// 10. `[writable]` epoch_snapshot +/// 11. `[writable]` operator_snapshot +/// 12. `[]` vault_program +/// 13. `[]` restaking_program #[derive(Clone, Debug)] pub struct SnapshotVaultOperatorDelegationCpiBuilder<'a, 'b> { instruction: Box>, @@ -561,6 +586,7 @@ impl<'a, 'b> SnapshotVaultOperatorDelegationCpiBuilder<'a, 'b> { __program: program, ncn_config: None, restaking_config: None, + tracked_mints: None, ncn: None, operator: None, vault: None, @@ -594,6 +620,14 @@ impl<'a, 'b> SnapshotVaultOperatorDelegationCpiBuilder<'a, 'b> { self } #[inline(always)] + pub fn tracked_mints( + &mut self, + tracked_mints: &'b solana_program::account_info::AccountInfo<'a>, + ) -> &mut Self { + self.instruction.tracked_mints = Some(tracked_mints); + self + } + #[inline(always)] pub fn ncn(&mut self, ncn: &'b solana_program::account_info::AccountInfo<'a>) -> &mut Self { self.instruction.ncn = Some(ncn); self @@ -735,6 +769,11 @@ impl<'a, 'b> SnapshotVaultOperatorDelegationCpiBuilder<'a, 'b> { .restaking_config .expect("restaking_config is not set"), + tracked_mints: self + .instruction + .tracked_mints + .expect("tracked_mints is not set"), + ncn: self.instruction.ncn.expect("ncn is not set"), operator: self.instruction.operator.expect("operator is not set"), @@ -794,6 +833,7 @@ struct SnapshotVaultOperatorDelegationCpiBuilderInstruction<'a, 'b> { __program: &'b solana_program::account_info::AccountInfo<'a>, ncn_config: Option<&'b solana_program::account_info::AccountInfo<'a>>, restaking_config: Option<&'b solana_program::account_info::AccountInfo<'a>>, + tracked_mints: Option<&'b solana_program::account_info::AccountInfo<'a>>, ncn: Option<&'b solana_program::account_info::AccountInfo<'a>>, operator: Option<&'b solana_program::account_info::AccountInfo<'a>>, vault: Option<&'b solana_program::account_info::AccountInfo<'a>>, diff --git a/clients/rust/jito_tip_router/src/generated/types/fee.rs b/clients/rust/jito_tip_router/src/generated/types/fee_config.rs similarity index 77% rename from clients/rust/jito_tip_router/src/generated/types/fee.rs rename to clients/rust/jito_tip_router/src/generated/types/fee_config.rs index e3ed1ce..71a6ba7 100644 --- a/clients/rust/jito_tip_router/src/generated/types/fee.rs +++ b/clients/rust/jito_tip_router/src/generated/types/fee_config.rs @@ -7,16 +7,16 @@ use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::pubkey::Pubkey; +use crate::generated::types::Fees; + #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct Fee { +pub struct FeeConfig { #[cfg_attr( feature = "serde", serde(with = "serde_with::As::") )] - pub wallet: Pubkey, - pub dao_share_bps: u64, - pub ncn_share_bps: u64, - pub block_engine_fee_bps: u64, - pub activation_epoch: u64, + pub dao_fee_wallet: Pubkey, + pub fee1: Fees, + pub fee2: Fees, } diff --git a/clients/rust/jito_tip_router/src/generated/types/fees.rs b/clients/rust/jito_tip_router/src/generated/types/fees.rs index ffd0b22..f7bcf11 100644 --- a/clients/rust/jito_tip_router/src/generated/types/fees.rs +++ b/clients/rust/jito_tip_router/src/generated/types/fees.rs @@ -6,11 +6,15 @@ use borsh::{BorshDeserialize, BorshSerialize}; -use crate::generated::types::Fee; +use crate::generated::types::NcnFee; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct Fees { - pub fee1: Fee, - pub fee2: Fee, + pub activation_epoch: u64, + pub block_engine_fee_bps: u64, + pub dao_fee_bps: u64, + pub ncn_fee_groups_bps: [NcnFee; 16], + #[cfg_attr(feature = "serde", serde(with = "serde_with::As::"))] + pub reserved: [u8; 64], } diff --git a/clients/rust/jito_tip_router/src/generated/types/mint_entry.rs b/clients/rust/jito_tip_router/src/generated/types/mint_entry.rs index 7100f19..0ee75ea 100644 --- a/clients/rust/jito_tip_router/src/generated/types/mint_entry.rs +++ b/clients/rust/jito_tip_router/src/generated/types/mint_entry.rs @@ -7,6 +7,8 @@ use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::pubkey::Pubkey; +use crate::generated::types::NcnFeeGroup; + #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct MintEntry { @@ -16,5 +18,6 @@ pub struct MintEntry { )] pub st_mint: Pubkey, pub vault_index: u64, + pub ncn_fee_group: NcnFeeGroup, pub reserved: [u8; 32], } diff --git a/clients/rust/jito_tip_router/src/generated/types/mod.rs b/clients/rust/jito_tip_router/src/generated/types/mod.rs index 82ebe6f..0a6d1a3 100644 --- a/clients/rust/jito_tip_router/src/generated/types/mod.rs +++ b/clients/rust/jito_tip_router/src/generated/types/mod.rs @@ -7,14 +7,20 @@ pub(crate) mod r#ballot; pub(crate) mod r#ballot_tally; pub(crate) mod r#config_admin_role; -pub(crate) mod r#fee; +pub(crate) mod r#fee_config; pub(crate) mod r#fees; pub(crate) mod r#mint_entry; +pub(crate) mod r#ncn_fee; +pub(crate) mod r#ncn_fee_group; pub(crate) mod r#operator_vote; +pub(crate) mod r#reward_stake_weight; +pub(crate) mod r#stake_weight; pub(crate) mod r#vault_operator_stake_weight; pub(crate) mod r#weight_entry; pub use self::{ - r#ballot::*, r#ballot_tally::*, r#config_admin_role::*, r#fee::*, r#fees::*, r#mint_entry::*, - r#operator_vote::*, r#vault_operator_stake_weight::*, r#weight_entry::*, + r#ballot::*, r#ballot_tally::*, r#config_admin_role::*, r#fee_config::*, r#fees::*, + r#mint_entry::*, r#ncn_fee::*, r#ncn_fee_group::*, r#operator_vote::*, + r#reward_stake_weight::*, r#stake_weight::*, r#vault_operator_stake_weight::*, + r#weight_entry::*, }; diff --git a/clients/rust/jito_tip_router/src/generated/types/ncn_fee.rs b/clients/rust/jito_tip_router/src/generated/types/ncn_fee.rs new file mode 100644 index 0000000..62d973c --- /dev/null +++ b/clients/rust/jito_tip_router/src/generated/types/ncn_fee.rs @@ -0,0 +1,15 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! + +use borsh::{BorshDeserialize, BorshSerialize}; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct NcnFee { + pub fee: u64, + #[cfg_attr(feature = "serde", serde(with = "serde_with::As::"))] + pub reserved: [u8; 64], +} diff --git a/clients/rust/jito_tip_router/src/generated/types/ncn_fee_group.rs b/clients/rust/jito_tip_router/src/generated/types/ncn_fee_group.rs new file mode 100644 index 0000000..204ccff --- /dev/null +++ b/clients/rust/jito_tip_router/src/generated/types/ncn_fee_group.rs @@ -0,0 +1,13 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! + +use borsh::{BorshDeserialize, BorshSerialize}; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct NcnFeeGroup { + pub group: u8, +} diff --git a/clients/rust/jito_tip_router/src/generated/types/reward_stake_weight.rs b/clients/rust/jito_tip_router/src/generated/types/reward_stake_weight.rs new file mode 100644 index 0000000..2dd41fd --- /dev/null +++ b/clients/rust/jito_tip_router/src/generated/types/reward_stake_weight.rs @@ -0,0 +1,15 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! + +use borsh::{BorshDeserialize, BorshSerialize}; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct RewardStakeWeight { + pub reward_stake_weight: u128, + #[cfg_attr(feature = "serde", serde(with = "serde_with::As::"))] + pub reserved: [u8; 64], +} diff --git a/clients/rust/jito_tip_router/src/generated/types/stake_weight.rs b/clients/rust/jito_tip_router/src/generated/types/stake_weight.rs new file mode 100644 index 0000000..a274273 --- /dev/null +++ b/clients/rust/jito_tip_router/src/generated/types/stake_weight.rs @@ -0,0 +1,18 @@ +//! This code was AUTOGENERATED using the kinobi library. +//! Please DO NOT EDIT THIS FILE, instead use visitors +//! to add features, then rerun kinobi to update it. +//! +//! + +use borsh::{BorshDeserialize, BorshSerialize}; + +use crate::generated::types::RewardStakeWeight; + +#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub struct StakeWeight { + pub stake_weight: u128, + pub reward_stake_weights: [RewardStakeWeight; 16], + #[cfg_attr(feature = "serde", serde(with = "serde_with::As::"))] + pub reserved: [u8; 64], +} diff --git a/clients/rust/jito_tip_router/src/generated/types/vault_operator_stake_weight.rs b/clients/rust/jito_tip_router/src/generated/types/vault_operator_stake_weight.rs index e45eb5b..4027c02 100644 --- a/clients/rust/jito_tip_router/src/generated/types/vault_operator_stake_weight.rs +++ b/clients/rust/jito_tip_router/src/generated/types/vault_operator_stake_weight.rs @@ -7,6 +7,8 @@ use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::pubkey::Pubkey; +use crate::generated::types::StakeWeight; + #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct VaultOperatorStakeWeight { @@ -15,7 +17,7 @@ pub struct VaultOperatorStakeWeight { serde(with = "serde_with::As::") )] pub vault: Pubkey, - pub stake_weight: u128, pub vault_index: u64, + pub stake_weight: StakeWeight, pub reserved: [u8; 32], } diff --git a/core/src/error.rs b/core/src/error.rs index 489d56d..bd57b73 100644 --- a/core/src/error.rs +++ b/core/src/error.rs @@ -42,6 +42,8 @@ pub enum TipRouterError { TrackedMintsLocked, #[error("Vault index already in use by a different mint")] VaultIndexAlreadyInUse, + #[error("Mint Entry not found")] + MintEntryNotFound, #[error("Fee cap exceeded")] FeeCapExceeded, #[error("Incorrect NCN Admin")] diff --git a/core/src/fees.rs b/core/src/fees.rs index d026bb5..ca6fc77 100644 --- a/core/src/fees.rs +++ b/core/src/fees.rs @@ -40,7 +40,7 @@ impl FeeConfig { } // ------------- Getters ------------- - fn current_fees(&self, current_epoch: u64) -> &Fees { + pub fn current_fees(&self, current_epoch: u64) -> &Fees { // If either fee is not yet active, return the other one if self.fee_1.activation_epoch() > current_epoch { return &self.fee_2; @@ -271,7 +271,7 @@ pub struct Fees { block_engine_fee_bps: PodU64, dao_fee_bps: PodU64, - ncn_fee_groups_bps: [NcnFee; NcnFeeGroup::FEE_GROUP_COUNT], + ncn_fee_groups_bps: [NcnFee; 16], // Reserves reserved: [u8; 64], diff --git a/core/src/instruction.rs b/core/src/instruction.rs index bc42ba6..c708d56 100644 --- a/core/src/instruction.rs +++ b/core/src/instruction.rs @@ -35,10 +35,11 @@ pub enum TipRouterInstruction { #[account(3, signer, name = "ncn_admin")] #[account(4, name = "restaking_program")] SetConfigFees { + new_fee_wallet: Option, + new_block_engine_fee_bps: Option, new_dao_fee_bps: Option, new_ncn_fee_bps: Option, - new_block_engine_fee_bps: Option, - new_fee_wallet: Option, + new_ncn_fee_group: Option, }, /// Sets a new secondary admin for the NCN @@ -106,17 +107,18 @@ pub enum TipRouterInstruction { /// Initializes the Vault Operator Delegation Snapshot #[account(0, name = "ncn_config")] #[account(1, name = "restaking_config")] - #[account(2, name = "ncn")] - #[account(3, name = "operator")] - #[account(4, name = "vault")] - #[account(5, name = "vault_ncn_ticket")] - #[account(6, name = "ncn_vault_ticket")] - #[account(7, name = "vault_operator_delegation")] - #[account(8, name = "weight_table")] - #[account(9, writable, name = "epoch_snapshot")] - #[account(10, writable, name = "operator_snapshot")] - #[account(11, name = "vault_program")] - #[account(12, name = "restaking_program")] + #[account(2, name = "tracked_mints")] + #[account(3, name = "ncn")] + #[account(4, name = "operator")] + #[account(5, name = "vault")] + #[account(6, name = "vault_ncn_ticket")] + #[account(7, name = "ncn_vault_ticket")] + #[account(8, name = "vault_operator_delegation")] + #[account(9, name = "weight_table")] + #[account(10, writable, name = "epoch_snapshot")] + #[account(11, writable, name = "operator_snapshot")] + #[account(12, name = "vault_program")] + #[account(13, name = "restaking_program")] SnapshotVaultOperatorDelegation{ first_slot_of_ncn_epoch: Option, }, diff --git a/core/src/stake_weight.rs b/core/src/stake_weight.rs index e9d98ec..3dc7034 100644 --- a/core/src/stake_weight.rs +++ b/core/src/stake_weight.rs @@ -1,5 +1,5 @@ use bytemuck::{Pod, Zeroable}; -use jito_bytemuck::types::{PodU128, PodU64}; +use jito_bytemuck::types::PodU128; use shank::ShankType; use crate::{error::TipRouterError, ncn_fee_group::NcnFeeGroup}; @@ -8,7 +8,7 @@ use crate::{error::TipRouterError, ncn_fee_group::NcnFeeGroup}; #[repr(C)] pub struct StakeWeight { stake_weight: PodU128, - reward_stake_weights: [RewardStakeWeight; NcnFeeGroup::FEE_GROUP_COUNT], + reward_stake_weights: [RewardStakeWeight; 16], // Reserves reserved: [u8; 64], } @@ -28,7 +28,7 @@ impl StakeWeight { self.stake_weight.into() } - pub fn reward_stake_weight(&self, ncn_fee_group: NcnFeeGroup) -> Result { + pub fn reward_stake_weight(&self, ncn_fee_group: NcnFeeGroup) -> Result { let group_index = ncn_fee_group.group_index()?; Ok(self.reward_stake_weights[group_index].reward_stake_weight()) @@ -57,11 +57,11 @@ impl StakeWeight { pub fn increment_reward_stake_weight( &mut self, ncn_fee_group: NcnFeeGroup, - stake_weight: u64, + stake_weight: u128, ) -> Result<(), TipRouterError> { let group_index = ncn_fee_group.group_index()?; - self.reward_stake_weights[group_index].reward_stake_weight = PodU64::from( + self.reward_stake_weights[group_index].reward_stake_weight = PodU128::from( self.reward_stake_weight(ncn_fee_group)? .checked_add(stake_weight) .ok_or(TipRouterError::ArithmeticOverflow)?, @@ -74,28 +74,28 @@ impl StakeWeight { #[derive(Debug, Clone, Copy, Zeroable, ShankType, Pod)] #[repr(C)] pub struct RewardStakeWeight { - reward_stake_weight: PodU64, + reward_stake_weight: PodU128, reserved: [u8; 64], } impl Default for RewardStakeWeight { fn default() -> Self { Self { - reward_stake_weight: PodU64::from(0), + reward_stake_weight: PodU128::from(0), reserved: [0; 64], } } } impl RewardStakeWeight { - pub fn new(reward_stake_weight: u64) -> Self { + pub fn new(reward_stake_weight: u128) -> Self { Self { - reward_stake_weight: PodU64::from(reward_stake_weight), + reward_stake_weight: PodU128::from(reward_stake_weight), reserved: [0; 64], } } - pub fn reward_stake_weight(&self) -> u64 { + pub fn reward_stake_weight(&self) -> u128 { self.reward_stake_weight.into() } } diff --git a/core/src/tracked_mints.rs b/core/src/tracked_mints.rs index fc6bcbc..beb19fe 100644 --- a/core/src/tracked_mints.rs +++ b/core/src/tracked_mints.rs @@ -5,13 +5,14 @@ use jito_bytemuck::{types::PodU64, AccountDeserialize, Discriminator}; use shank::{ShankAccount, ShankType}; use solana_program::{account_info::AccountInfo, msg, program_error::ProgramError, pubkey::Pubkey}; -use crate::{discriminators::Discriminators, error::TipRouterError}; +use crate::{discriminators::Discriminators, error::TipRouterError, ncn_fee_group::NcnFeeGroup}; #[derive(Debug, Clone, Copy, Zeroable, ShankType, Pod)] #[repr(C)] pub struct MintEntry { st_mint: Pubkey, vault_index: PodU64, + ncn_fee_group: NcnFeeGroup, reserved: [u8; 32], } @@ -20,6 +21,7 @@ impl MintEntry { Self { st_mint: mint, vault_index: PodU64::from(vault_index), + ncn_fee_group: NcnFeeGroup::default(), reserved: [0; 32], } } @@ -27,6 +29,10 @@ impl MintEntry { pub fn vault_index(&self) -> u64 { self.vault_index.into() } + + pub fn ncn_fee_group(&self) -> NcnFeeGroup { + self.ncn_fee_group + } } impl Default for MintEntry { @@ -157,6 +163,31 @@ impl TrackedMints { Ok(()) } + + pub fn get_ncn_fee_group(&self, vault_index: u64) -> Result { + let mint_entry = self + .st_mint_list + .iter() + .find(|m| m.vault_index() == vault_index) + .ok_or(TipRouterError::MintEntryNotFound)?; + + Ok(mint_entry.ncn_fee_group) + } + + pub fn set_ncn_fee_group( + &mut self, + vault_index: u64, + ncn_fee_group: NcnFeeGroup, + ) -> Result<(), ProgramError> { + let mint_entry = self + .st_mint_list + .iter_mut() + .find(|m| m.vault_index() == vault_index) + .ok_or(TipRouterError::MintEntryNotFound)?; + + mint_entry.ncn_fee_group = ncn_fee_group; + Ok(()) + } } #[cfg(test)] diff --git a/idl/jito_tip_router.json b/idl/jito_tip_router.json index dbac2f4..c6e616b 100644 --- a/idl/jito_tip_router.json +++ b/idl/jito_tip_router.json @@ -96,27 +96,33 @@ ], "args": [ { - "name": "newDaoFeeBps", + "name": "newFeeWallet", + "type": { + "option": "publicKey" + } + }, + { + "name": "newBlockEngineFeeBps", "type": { "option": "u64" } }, { - "name": "newNcnFeeBps", + "name": "newDaoFeeBps", "type": { "option": "u64" } }, { - "name": "newBlockEngineFeeBps", + "name": "newNcnFeeBps", "type": { "option": "u64" } }, { - "name": "newFeeWallet", + "name": "newNcnFeeGroup", "type": { - "option": "publicKey" + "option": "u8" } } ], @@ -405,6 +411,11 @@ "isMut": false, "isSigner": false }, + { + "name": "trackedMints", + "isMut": false, + "isSigner": false + }, { "name": "ncn", "isMut": false, @@ -713,7 +724,7 @@ { "name": "stakeWeight", "type": { - "defined": "PodU128" + "defined": "StakeWeight" } }, { @@ -808,7 +819,7 @@ { "name": "stakeWeight", "type": { - "defined": "PodU128" + "defined": "StakeWeight" } }, { @@ -852,9 +863,9 @@ "type": "publicKey" }, { - "name": "fees", + "name": "feeConfig", "type": { - "defined": "Fees" + "defined": "FeeConfig" } }, { @@ -1069,15 +1080,15 @@ "type": "publicKey" }, { - "name": "stakeWeight", + "name": "vaultIndex", "type": { - "defined": "PodU128" + "defined": "PodU64" } }, { - "name": "vaultIndex", + "name": "stakeWeight", "type": { - "defined": "PodU64" + "defined": "StakeWeight" } }, { @@ -1093,57 +1104,163 @@ } }, { - "name": "Fees", + "name": "FeeConfig", "type": { "kind": "struct", "fields": [ + { + "name": "daoFeeWallet", + "type": "publicKey" + }, { "name": "fee1", "type": { - "defined": "Fee" + "defined": "Fees" } }, { "name": "fee2", "type": { - "defined": "Fee" + "defined": "Fees" } } ] } }, { - "name": "Fee", + "name": "Fees", "type": { "kind": "struct", "fields": [ { - "name": "wallet", - "type": "publicKey" + "name": "activationEpoch", + "type": { + "defined": "PodU64" + } }, { - "name": "daoShareBps", + "name": "blockEngineFeeBps", "type": { "defined": "PodU64" } }, { - "name": "ncnShareBps", + "name": "daoFeeBps", "type": { "defined": "PodU64" } }, { - "name": "blockEngineFeeBps", + "name": "ncnFeeGroupsBps", "type": { - "defined": "PodU64" + "array": [ + { + "defined": "NcnFee" + }, + 16 + ] } }, { - "name": "activationEpoch", + "name": "reserved", + "type": { + "array": [ + "u8", + 64 + ] + } + } + ] + } + }, + { + "name": "NcnFee", + "type": { + "kind": "struct", + "fields": [ + { + "name": "fee", "type": { "defined": "PodU64" } + }, + { + "name": "reserved", + "type": { + "array": [ + "u8", + 64 + ] + } + } + ] + } + }, + { + "name": "NcnFeeGroup", + "type": { + "kind": "struct", + "fields": [ + { + "name": "group", + "type": "u8" + } + ] + } + }, + { + "name": "StakeWeight", + "type": { + "kind": "struct", + "fields": [ + { + "name": "stakeWeight", + "type": { + "defined": "PodU128" + } + }, + { + "name": "rewardStakeWeights", + "type": { + "array": [ + { + "defined": "RewardStakeWeight" + }, + 16 + ] + } + }, + { + "name": "reserved", + "type": { + "array": [ + "u8", + 64 + ] + } + } + ] + } + }, + { + "name": "RewardStakeWeight", + "type": { + "kind": "struct", + "fields": [ + { + "name": "rewardStakeWeight", + "type": { + "defined": "PodU128" + } + }, + { + "name": "reserved", + "type": { + "array": [ + "u8", + 64 + ] + } } ] } @@ -1163,6 +1280,12 @@ "defined": "PodU64" } }, + { + "name": "ncnFeeGroup", + "type": { + "defined": "NcnFeeGroup" + } + }, { "name": "reserved", "type": { @@ -1327,83 +1450,93 @@ }, { "code": 8718, + "name": "MintEntryNotFound", + "msg": "Mint Entry not found" + }, + { + "code": 8719, "name": "FeeCapExceeded", "msg": "Fee cap exceeded" }, { - "code": 8719, + "code": 8720, "name": "IncorrectNcnAdmin", "msg": "Incorrect NCN Admin" }, { - "code": 8720, + "code": 8721, "name": "IncorrectNcn", "msg": "Incorrect NCN" }, { - "code": 8721, + "code": 8722, "name": "IncorrectFeeAdmin", "msg": "Incorrect fee admin" }, { - "code": 8722, + "code": 8723, "name": "WeightTableNotFinalized", "msg": "Weight table not finalized" }, { - "code": 8723, + "code": 8724, "name": "WeightNotFound", "msg": "Weight not found" }, { - "code": 8724, + "code": 8725, "name": "NoOperators", "msg": "No operators in ncn" }, { - "code": 8725, + "code": 8726, "name": "VaultOperatorDelegationFinalized", "msg": "Vault operator delegation is already finalized - should not happen" }, { - "code": 8726, + "code": 8727, "name": "OperatorFinalized", "msg": "Operator is already finalized - should not happen" }, { - "code": 8727, + "code": 8728, "name": "TooManyVaultOperatorDelegations", "msg": "Too many vault operator delegations" }, { - "code": 8728, + "code": 8729, "name": "DuplicateVaultOperatorDelegation", "msg": "Duplicate vault operator delegation" }, { - "code": 8729, + "code": 8730, "name": "DuplicateVoteCast", "msg": "Duplicate Vote Cast" }, { - "code": 8730, + "code": 8731, "name": "OperatorVotesFull", "msg": "Operator votes full" }, { - "code": 8731, + "code": 8732, "name": "BallotTallyFull", "msg": "Merkle root tally full" }, { - "code": 8732, + "code": 8733, "name": "ConsensusAlreadyReached", "msg": "Consensus already reached" }, { - "code": 8733, + "code": 8734, "name": "ConsensusNotReached", "msg": "Consensus not reached" + }, + { + "code": 8735, + "name": "InvalidNcnFeeGroup", + "msg": "Not a valid NCN fee group" } ], "metadata": { diff --git a/integration_tests/tests/tip_router/set_config_fees.rs b/integration_tests/tests/tip_router/set_config_fees.rs index 03923ec..494d69d 100644 --- a/integration_tests/tests/tip_router/set_config_fees.rs +++ b/integration_tests/tests/tip_router/set_config_fees.rs @@ -1,6 +1,6 @@ #[cfg(test)] mod tests { - use jito_tip_router_core::error::TipRouterError; + use jito_tip_router_core::{error::TipRouterError, ncn_fee_group::NcnFeeGroup}; use solana_sdk::{ clock::DEFAULT_SLOTS_PER_EPOCH, signature::{Keypair, Signer}, @@ -102,13 +102,19 @@ mod tests { .get_ncn_config(ncn_root.ncn_pubkey) .await?; let clock = fixture.clock().await; - assert_eq!(config.fee_config.dao_fee(clock.epoch as u64).unwrap(), 100); - assert_eq!(config.fee_config.ncn_fee(clock.epoch as u64).unwrap(), 200); - assert_eq!(config.fee_config.block_engine_fee(clock.epoch as u64), 0); + assert_eq!(config.fee_config.dao_fee_bps(clock.epoch as u64), 100); assert_eq!( - config.fee_config.fee_wallet(clock.epoch as u64), - new_fee_wallet.pubkey() + config + .fee_config + .ncn_fee_bps(NcnFeeGroup::default(), clock.epoch as u64) + .unwrap(), + 200 ); + assert_eq!( + config.fee_config.block_engine_fee_bps(clock.epoch as u64), + 0 + ); + assert_eq!(config.fee_config.fee_wallet(), new_fee_wallet.pubkey()); Ok(()) } diff --git a/program/src/initialize_epoch_snapshot.rs b/program/src/initialize_epoch_snapshot.rs index df0b939..3c3ca6a 100644 --- a/program/src/initialize_epoch_snapshot.rs +++ b/program/src/initialize_epoch_snapshot.rs @@ -86,7 +86,7 @@ pub fn process_initialize_epoch_snapshot( let ncn_fees: fees::Fees = { let ncn_config_data = ncn_config.data.borrow(); let ncn_config_account = NcnConfig::try_from_slice_unchecked(&ncn_config_data)?; - ncn_config_account.fee_config + *ncn_config_account.fee_config.current_fees(ncn_epoch) }; let operator_count: u64 = { diff --git a/program/src/initialize_operator_snapshot.rs b/program/src/initialize_operator_snapshot.rs index a2d72c8..d4a0be5 100644 --- a/program/src/initialize_operator_snapshot.rs +++ b/program/src/initialize_operator_snapshot.rs @@ -10,6 +10,7 @@ use jito_tip_router_core::{ epoch_snapshot::{EpochSnapshot, OperatorSnapshot}, loaders::load_ncn_epoch, ncn_config::NcnConfig, + stake_weight::StakeWeight, }; use solana_program::{ account_info::AccountInfo, clock::Clock, entrypoint::ProgramResult, msg, @@ -153,7 +154,11 @@ pub fn process_initialize_operator_snapshot( let epoch_snapshot_account = EpochSnapshot::try_from_slice_unchecked_mut(&mut epoch_snapshot_data)?; - epoch_snapshot_account.increment_operator_registration(current_slot, 0, 0)?; + epoch_snapshot_account.increment_operator_registration( + current_slot, + 0, + &StakeWeight::default(), + )?; } Ok(()) diff --git a/program/src/lib.rs b/program/src/lib.rs index df0b144..eedeaf0 100644 --- a/program/src/lib.rs +++ b/program/src/lib.rs @@ -113,19 +113,21 @@ pub fn process_instruction( process_admin_update_weight_table(program_id, accounts, ncn_epoch, weight) } TipRouterInstruction::SetConfigFees { + new_fee_wallet, + new_block_engine_fee_bps, new_dao_fee_bps, new_ncn_fee_bps, - new_block_engine_fee_bps, - new_fee_wallet, + new_ncn_fee_group, } => { msg!("Instruction: SetConfigFees"); process_set_config_fees( program_id, accounts, + new_fee_wallet, + new_block_engine_fee_bps, new_dao_fee_bps, new_ncn_fee_bps, - new_block_engine_fee_bps, - new_fee_wallet, + new_ncn_fee_group, ) } TipRouterInstruction::SetNewAdmin { role } => { diff --git a/program/src/set_config_fees.rs b/program/src/set_config_fees.rs index 0cff379..268bd8b 100644 --- a/program/src/set_config_fees.rs +++ b/program/src/set_config_fees.rs @@ -1,7 +1,9 @@ use jito_bytemuck::{AccountDeserialize, Discriminator}; use jito_jsm_core::loader::load_signer; use jito_restaking_core::{config::Config, ncn::Ncn}; -use jito_tip_router_core::{error::TipRouterError, ncn_config::NcnConfig}; +use jito_tip_router_core::{ + error::TipRouterError, ncn_config::NcnConfig, ncn_fee_group::NcnFeeGroup, +}; use solana_program::{ account_info::AccountInfo, clock::Clock, entrypoint::ProgramResult, program_error::ProgramError, pubkey::Pubkey, sysvar::Sysvar, @@ -54,17 +56,17 @@ pub fn process_set_config_fees( return Err(TipRouterError::IncorrectFeeAdmin.into()); } - let new_ncn_fee_group = let Some(new_ncn_fee_group) = new_ncn_fee_group { - new_ncn_fee_group + let new_ncn_fee_group = if let Some(new_ncn_fee_group) = new_ncn_fee_group { + Some(NcnFeeGroup::from_u8(new_ncn_fee_group)?) } else { - config.fee_config.ncn_fee_group() + None }; config.fee_config.update_fee_config( + new_fee_wallet, + new_block_engine_fee_bps, new_dao_fee_bps, new_ncn_fee_bps, - new_block_engine_fee_bps, - new_fee_wallet, new_ncn_fee_group, epoch, )?; diff --git a/program/src/snapshot_vault_operator_delegation.rs b/program/src/snapshot_vault_operator_delegation.rs index fdb2dba..8099a3f 100644 --- a/program/src/snapshot_vault_operator_delegation.rs +++ b/program/src/snapshot_vault_operator_delegation.rs @@ -6,6 +6,8 @@ use jito_tip_router_core::{ epoch_snapshot::{EpochSnapshot, OperatorSnapshot}, loaders::load_ncn_epoch, ncn_config::NcnConfig, + stake_weight::StakeWeight, + tracked_mints::TrackedMints, weight_table::WeightTable, }; use jito_vault_core::{ @@ -22,7 +24,7 @@ pub fn process_snapshot_vault_operator_delegation( accounts: &[AccountInfo], first_slot_of_ncn_epoch: Option, ) -> ProgramResult { - let [ncn_config, restaking_config, ncn, operator, vault, vault_ncn_ticket, ncn_vault_ticket, vault_operator_delegation, weight_table, epoch_snapshot, operator_snapshot, vault_program, restaking_program] = + let [ncn_config, restaking_config, tracked_mints, ncn, operator, vault, vault_ncn_ticket, ncn_vault_ticket, vault_operator_delegation, weight_table, epoch_snapshot, operator_snapshot, vault_program, restaking_program] = accounts else { return Err(ProgramError::NotEnoughAccountKeys); @@ -68,6 +70,7 @@ pub fn process_snapshot_vault_operator_delegation( let (ncn_epoch, ncn_epoch_length) = load_ncn_epoch(restaking_config, current_slot, first_slot_of_ncn_epoch)?; + TrackedMints::load(program_id, ncn.key, tracked_mints, false)?; WeightTable::load(program_id, weight_table, ncn, ncn_epoch, false)?; EpochSnapshot::load(program_id, ncn.key, ncn_epoch, epoch_snapshot, true)?; OperatorSnapshot::load( @@ -108,7 +111,13 @@ pub fn process_snapshot_vault_operator_delegation( vault_ncn_okay && ncn_vault_okay && !delegation_dne }; - let total_votes: u128 = if is_active { + let ncn_fee_group = { + let tracked_mints_data = tracked_mints.data.borrow(); + let tracked_mints_account = TrackedMints::try_from_slice_unchecked(&tracked_mints_data)?; + tracked_mints_account.get_ncn_fee_group(vault_index)? + }; + + let total_stake_weight: u128 = if is_active { let vault_operator_delegation_data = vault_operator_delegation.data.borrow(); let vault_operator_delegation_account = VaultOperatorDelegation::try_from_slice_unchecked(&vault_operator_delegation_data)?; @@ -130,11 +139,16 @@ pub fn process_snapshot_vault_operator_delegation( let operator_snapshot_account = OperatorSnapshot::try_from_slice_unchecked_mut(&mut operator_snapshot_data)?; + let mut stake_weight = StakeWeight::default(); + + stake_weight.increment_stake_weight(total_stake_weight)?; + stake_weight.increment_reward_stake_weight(ncn_fee_group, total_stake_weight)?; + operator_snapshot_account.increment_vault_operator_delegation_registration( current_slot, *vault.key, vault_index, - total_votes, + &stake_weight, )?; // If operator is finalized, increment operator registration