Skip to content

Commit

Permalink
share test stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
thesoftwarejedi committed Sep 29, 2021
1 parent ca94423 commit 0e3a775
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
target
test-ledger
**/*.rs.bk
keys/
/keys/
.rustc_info.json
debug/
node_modules
Expand Down
20 changes: 20 additions & 0 deletions Anchor.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
anchor_version = "0.16.2"

[workspace]
members = ["programs/reward-pool"]

[registry]
url = "https://anchor.projectserum.com"

[provider]
cluster = "localnet"
wallet = "~/.config/solana/id.json"

[scripts]
test = "mocha -t 1000000 tests/"

[programs.localnet]
reward_pool = "TeSTKchdpa2FKNV6gYNAENpququb3aT2r1pD41tZw36"

#[programs.devnet]
#reward_pool = "UNKNOWN"

#[programs.testnet]
#reward_pool = "UNKNOWN"

#[programs.mainnet]
#reward_pool = "UNKNOWN"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ can be deterministically generated with docker.

### Test

When testing locally, be sure to build with feature "local-testing" to enable the testing IDs. You can do this by editing `programs/step-staking/Cargo.toml` and uncommenting the default feature set line.

```
anchor test
```
Expand Down
2 changes: 1 addition & 1 deletion programs/reward-pool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ no-entrypoint = []
cpi = ["no-entrypoint"]

#add to default for local testing
default = ["local-testing"]
#default = ["local-testing"]
local-testing = []

[dependencies]
Expand Down
4 changes: 2 additions & 2 deletions programs/reward-pool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::convert::TryInto;
#[cfg(not(feature = "local-testing"))]
declare_id!("UNKNOWN" fail build );
#[cfg(feature = "local-testing")]
declare_id!("SRWdZfXVSH7usoNVGAMBMpTnRf4PDQWRCtd3ZLUYDsP");
declare_id!("TeSTKchdpa2FKNV6gYNAENpququb3aT2r1pD41tZw36");

#[cfg(not(feature = "local-testing"))]
mod constants {
Expand All @@ -19,7 +19,7 @@ mod constants {

#[cfg(feature = "local-testing")]
mod constants {
pub const X_STEP_TOKEN_MINT_PUBKEY: &str = "xsTPvEj7rELYcqe2D1k3M5zRe85xWWFK3x1SWDN5qPY";
pub const X_STEP_TOKEN_MINT_PUBKEY: &str = "tEsTL8G8drugWztoCKrPpEAXV21qEajfHg4q45KYs6s";
pub const X_STEP_DEPOSIT_REQUIREMENT: u64 = 10_000_000_000_000;
pub const MIN_DURATION: u64 = 1;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[99,88,159,24,211,86,41,8,220,47,170,72,113,8,235,248,163,245,155,116,136,37,0,234,29,195,51,32,107,84,14,97,6,211,110,235,255,101,133,147,157,75,55,231,230,2,30,58,113,250,121,172,228,125,95,21,9,28,194,76,18,158,209,1]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[189,65,246,88,57,128,70,1,53,105,104,67,55,128,210,188,81,117,180,44,137,15,53,94,186,60,127,245,98,220,241,179,13,32,77,211,54,104,98,71,147,164,12,225,147,190,146,162,246,165,174,16,157,170,173,120,22,111,46,157,85,216,114,148]
2 changes: 1 addition & 1 deletion tests/reward-pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('Multiuser Reward Pool', () => {
console.log("Wallet: ", provider.wallet.publicKey.toString());
//this is the xstep token
//test xstep token hardcoded in program, mint authority is itself
rawdata = fs.readFileSync('tests/keys/TESTING-xsTPvEj7rELYcqe2D1k3M5zRe85xWWFK3x1SWDN5qPY.json');
rawdata = fs.readFileSync('tests/keys/xstep-tEsTL8G8drugWztoCKrPpEAXV21qEajfHg4q45KYs6s.json');
keyData = JSON.parse(rawdata);
xMintKey = anchor.web3.Keypair.fromSecretKey(new Uint8Array(keyData));
xMintPubkey = xMintKey.publicKey;
Expand Down

0 comments on commit 0e3a775

Please sign in to comment.