crank pop params

This commit is contained in:
Conner Gallagher 2022-12-22 10:53:17 -07:00
parent c9cdb058c5
commit 1d1b0da1f2
2 changed files with 35 additions and 24 deletions

View File

@ -313,10 +313,11 @@ export class CrankAccount extends Account<types.CrankAccountData> {
payer: PublicKey,
params: {
payoutTokenWallet: PublicKey;
crank: types.CrankAccountData;
crankRows: Array<types.CrankRow>;
queueAccount: QueueAccount;
queue: types.OracleQueueAccountData;
queuePubkey: PublicKey;
queueAuthority: PublicKey;
queueDataBuffer: PublicKey;
crankDataBuffer: PublicKey;
remainingAccounts: Array<PublicKey>;
leaseBumps: Map<string, number>;
@ -353,13 +354,13 @@ export class CrankAccount extends Account<types.CrankAccountData> {
},
{
crank: this.publicKey,
oracleQueue: params.queueAccount.publicKey,
queueAuthority: params.queue.authority,
oracleQueue: params.queuePubkey,
queueAuthority: params.queueAuthority,
programState: this.program.programState.publicKey,
payoutWallet: params.payoutTokenWallet,
tokenProgram: TOKEN_PROGRAM_ID,
crankDataBuffer: params.crank.dataBuffer,
queueDataBuffer: params.queue.dataBuffer,
crankDataBuffer: params.crankDataBuffer,
queueDataBuffer: params.queueDataBuffer,
mint: this.program.mint.address,
}
);
@ -377,10 +378,12 @@ export class CrankAccount extends Account<types.CrankAccountData> {
payer: PublicKey,
params: {
payoutTokenWallet: PublicKey;
crank: types.CrankAccountData;
crankRows: Array<types.CrankRow>;
queueAccount: QueueAccount;
queue: types.OracleQueueAccountData;
queuePubkey: PublicKey;
queueAuthority: PublicKey;
queueDataBuffer: PublicKey;
crankDataBuffer: PublicKey;
readyAggregators: Array<[AggregatorAccount, AggregatorPdaAccounts]>;
nonce?: number;
@ -466,10 +469,12 @@ export class CrankAccount extends Account<types.CrankAccountData> {
payer: PublicKey,
params: {
payoutTokenWallet: PublicKey;
crank: types.CrankAccountData;
crankRows: Array<types.CrankRow>;
queueAccount: QueueAccount;
queue: types.OracleQueueAccountData;
queuePubkey: PublicKey;
queueAuthority: PublicKey;
queueDataBuffer: PublicKey;
crankDataBuffer: PublicKey;
readyAggregators: Array<[AggregatorAccount, AggregatorPdaAccounts]>;
nonce?: number;
@ -510,10 +515,12 @@ export class CrankAccount extends Account<types.CrankAccountData> {
public async packAndPop(
params: {
payoutTokenWallet: PublicKey;
crank: types.CrankAccountData;
crankRows: Array<types.CrankRow>;
queueAccount: QueueAccount;
queue: types.OracleQueueAccountData;
queuePubkey: PublicKey;
queueAuthority: PublicKey;
queueDataBuffer: PublicKey;
crankDataBuffer: PublicKey;
readyAggregators: Array<[AggregatorAccount, AggregatorPdaAccounts]>;
nonce?: number;

View File

@ -166,6 +166,8 @@ describe('Crank Tests', () => {
return (await SolanaClock.fetch(ctx.program.connection)).unixTimestamp;
};
const crank = await crankAccount.loadData();
let timestamp = await getTimestamp();
const nextAvailable = (await crankAccount.loadCrank()).reduce(
@ -225,10 +227,12 @@ describe('Crank Tests', () => {
ctx.payer.publicKey,
{
payoutTokenWallet: userTokenAddress,
crank: await crankAccount.loadData(),
crankRows: initialCrankRows,
queueAccount,
queue,
queuePubkey: queueAccount.publicKey,
queueAuthority: queue.authority,
queueDataBuffer: queue.dataBuffer,
crankDataBuffer: crank.dataBuffer,
readyAggregators: readyAggregators,
failOpenOnMismatch: true,
}