-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
For much larger games the authority (or permissionless) oracle may want to be resized. #30
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This configuration file was automatically generated by Gitpod. | ||
# Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file) | ||
# and commit this file to your remote git repository to share the goodness with others. | ||
|
||
tasks: | ||
- init: yarn install | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,7 +119,11 @@ export interface CreateMatchAdditionalArgs { | |
tokenTransferRoot: null; | ||
tokenTransfers: null | AnchorTokenDelta[]; | ||
} | ||
|
||
export interface ResizeOracleArgs { | ||
seed: string; | ||
authority: web3.PublicKey; | ||
resize: BN; | ||
} | ||
export interface CreateOrUpdateOracleArgs { | ||
seed: string; | ||
authority: web3.PublicKey; | ||
|
@@ -538,6 +542,37 @@ export class MatchesInstruction { | |
signers: [], | ||
}; | ||
} | ||
|
||
async resizeOracle( | ||
args: ResizeOracleArgs, | ||
_accounts = {}, | ||
_additionalArgs = {} | ||
) { | ||
const [oracle, _oracleBump] = await getOracle( | ||
new web3.PublicKey(args.seed), | ||
args.authority | ||
); | ||
|
||
const match = (await getMatch(oracle))[0]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename this to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't forget about this one |
||
|
||
return { | ||
instructions: [ | ||
await this.program.methods | ||
.resizeOracle({ | ||
...args, | ||
}) | ||
.accounts({ | ||
oracle, | ||
matchInstance: match, | ||
payer: (this.program.provider as AnchorProvider).wallet.publicKey, | ||
systemProgram: SystemProgram.programId, | ||
rent: web3.SYSVAR_RENT_PUBKEY, | ||
}) | ||
.instruction(), | ||
], | ||
signers: [], | ||
}; | ||
} | ||
} | ||
|
||
export class MatchesProgram { | ||
|
@@ -745,6 +780,22 @@ export class MatchesProgram { | |
signers | ||
); | ||
} | ||
|
||
async resizeOracle( | ||
args: ResizeOracleArgs, | ||
_accounts = {}, | ||
_additionalArgs = {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like you removed these ones from the |
||
) { | ||
const { instructions, signers } = | ||
await this.instruction.resizeOracle(args); | ||
|
||
await sendTransactionWithRetry( | ||
(this.program.provider as AnchorProvider).connection, | ||
(this.program.provider as AnchorProvider).wallet, | ||
instructions, | ||
signers | ||
); | ||
} | ||
} | ||
|
||
export async function getMatchesProgram( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove gitpod config