Skip to content
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

Token betting program used with solrand #4

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

fulltimemike
Copy link
Collaborator

No description provided.

import { UserSession } from '@demox-labs/solrand';
import { Keypair, PublicKey } from '@solana/web3.js';

export class SolrandSession {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class was necessary to run the initializing in parallel with other operation

Ok(())
}

pub fn cancel_before_acceptor<'info>(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally, this was a single method (cancel before acceptor + cancel after acceptor), but I was unable to load the acceptor's receiving token account via remaining accounts with the correct owner. The owner was showing as the token program itself, but this is a pretty important check to make sure the acceptor receives their bet back.

@@ -9,7 +9,7 @@ cluster = "localnet"
wallet = <Your Key Path Here>

[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
test = "yarn run ts-mocha -p --parallel ./tsconfig.json -t 1000000 tests/**/*.ts"

[test.validator]
url = "mainnet"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we have to update these to the current accounts below: 8nzxsNf74ZHDguHi51SjQWxDxegL2DBgxeGHA2pQVtTJ & K2z1qkxZdsw6WpFd63hqhqx9MYUc5c85NdbXULNeGhW

app/challenge.ts Outdated
export class Challenge {
// part of initialization
seed: string = "challenge";
programId: PublicKey = workspace.CrossPile.programId;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work if implemented by client side code. Can we pass in the programId? If we release a client library we can then export it as a constant as part of the NPM package like: https://github.com/demox-labs/solrand/blob/main/index.js#L4

"@demox-labs/solrand": "^0.0.3",
"@project-serum/anchor": "^0.18.2",
"@project-serum/anchor-cli": "0.18.2"
"@demox-labs/solrand": "^0.0.5",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not about this file, but should the package-lock.json be completely removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, it should probably be added back in here

}

// arguments list for new_challenge
// TODO: make the challenge bump include a UUID to allow initiators to create as many challenges as they want
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add the requester key here to the seeds ie: seeds = [b"coin-seed".as_ref(), initiator.key().as_ref(), requester.key().as_ref()] . Since the requester takes a uuid, this will effectively enable a user to create as many challenges as they want.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'll add the requester key 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants