Skip to content

Commit

Permalink
the100 Redeployment (#7)
Browse files Browse the repository at this point in the history
* Set col data setup

* Integrate col data WIP

* Tweak, add comments

* Col data fully linked up

* Use function for mint fee

* Tweak pricing

* Secure collection data, parallelize tests

* Tweak collection data instructions

* Tweak tests

* Update scripts, verify hash

* Update scripts, hash

* Use collection data in member seeds, update naming

* Format

* Rename mint fee
  • Loading branch information
jacksondoherty authored Nov 10, 2024
1 parent d766e7f commit a3b9891
Show file tree
Hide file tree
Showing 25 changed files with 559 additions and 312 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Full docs: <a href="https://developers.gardenlabs.com/">developers.gardenlabs.co
- `the100`
- _Description_: NFT collection which mints NFTs that control channels on <a href="https://the100.tv">the100.tv</a>.
- _Program ID_: `hundhVJRpUuamCdMthaPchfwEm2fiCpKgpxgUCNWXt9`
- _Solana Verify Hash_: `4af2032db69343eaddba2aa63c30d33cc78255925373f1876686352a806b2a79`
- _Solana Verify Hash_: `ffac3bd7a79a02980bc89c0c1c5d6f25383cb33ced779cb2619cde3473dc06a6`
- `vending-machine`
- In development.

Expand Down
7 changes: 1 addition & 6 deletions common/rust/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
use {
anchor_lang::prelude::*,
spl_token_metadata_interface::state::Field,
spl_type_length_value::state::{TlvState, TlvStateBorrowed},
std::str::FromStr,
};
use {anchor_lang::prelude::*, spl_token_metadata_interface::state::Field, std::str::FromStr};

#[error_code]
pub enum GplError {
Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
"build:sdk": "tsup sdk/index.ts --format esm --dts --clean --outDir build",
"deploy:mainnet": "solana program deploy --with-compute-unit-price 200000 --max-sign-attempts 10000 --buffer $(solana-keygen pubkey buffer.json) --program-id --",
"dev:sdk": "tsc --project sdk/tsconfig.json --watch",
"get-size:executable": "stat -f %z --",
"get-size:program": "solana program show --",
"lint": "eslint .",
"recover-all-buffers": "solana program close --buffers",
"recover-buffer": "solana-keygen recover -o buffer.json",
Expand All @@ -24,9 +22,10 @@
"test:localnet": "scripts/build/advanced-token-metadata.sh && anchor test",
"test:localnet:manual-validator": "npm run test:localnet -- --skip-local-validator",
"test:localnet:the100": "TEST_INCLUDE_PATH=the100/test/**/*.ts npm run test:localnet",
"verify:get-hash:buffer:mainnet": "solana-verify get-buffer-hash --url https://api.mainnet-beta.solana.com $(solana-keygen pubkey buffer.json)",
"verify:get-hash:executable": "solana-verify get-executable-hash --",
"verify:get-hash:program:mainnet": "solana-verify get-program-hash --url https://api.mainnet-beta.solana.com --",
"get-size:the100:executable": "stat -f %z target/deploy/the_100.so",
"get-size:the100:program": "solana program show --url https://api.mainnet-beta.solana.com hundhVJRpUuamCdMthaPchfwEm2fiCpKgpxgUCNWXt9",
"verify:the100:executable": "solana-verify get-executable-hash target/deploy/the_100.so",
"verify:the100:program": "solana-verify get-program-hash --url https://api.mainnet-beta.solana.com hundhVJRpUuamCdMthaPchfwEm2fiCpKgpxgUCNWXt9",
"write-buffer:prio-fees:staked-rpc": "solana program write-buffer --url https://deploy-qos.mainnet.rpcpool.com --with-compute-unit-price 200000 --max-sign-attempts 10000 --"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/extend/devnet/the100.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
source $ROOT_DIR/.env

# Config
BYTES=1024
BYTES=30000

solana config set --url $DEVNET_RPC

Expand Down
14 changes: 14 additions & 0 deletions scripts/extend/mainnet/the100.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
set -e
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
source $ROOT_DIR/.env

# Config
BYTES=30000

solana config set --url $MAINNET_RPC

DEPLOY_DIR="$ROOT_DIR/target/deploy"

THE100_KEYPAIR="$DEPLOY_DIR/the_100-keypair.json"
solana program extend $THE100_KEYPAIR $BYTES
2 changes: 1 addition & 1 deletion scripts/resume/mainnet/the100.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ THE100_KEYPAIR="$DEPLOY_DIR/the_100-keypair.json"
THE100_BINARY="$DEPLOY_DIR/the_100.so"

# NOTE: Change this as needed
BUFFER="the100-temp.json"
BUFFER="buffer.json"

solana program deploy --with-compute-unit-price 200000 --max-sign-attempts 10000 --program-id $THE100_KEYPAIR --buffer $BUFFER $THE100_BINARY
6 changes: 4 additions & 2 deletions sdk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ export { default as The100Idl } from "./target/idl/the_100.json";
export { optimizeSimSignSendAndConf, randomStr, sleep } from "../common/js";
export { The100 } from "./target/types/the_100";
export { ATM_PROGRAM_ID } from "../advanced-token-metadata/js";
export { TREASURY_PUBLIC_KEY } from "../vending-machine/js";
export { TREASURY_PUBKEY } from "../vending-machine/js";
export {
MEMBER_PDA_SEED as THE100_MEMBER_PDA_SEED,
indexToSeed as the100IndexToSeed,
PRICE_LUT as THE100_PRICE_LUT,
getMintFeeLamports as the100GetMintFeeLamports,
TREASURY_PUBKEY as THE100_TREASURY_PUBKEY,
COL_DATA_PUBKEY,
} from "../the100/js";
126 changes: 126 additions & 0 deletions sdk/target/idl/the_100.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,45 @@
"description": "Created with Anchor"
},
"instructions": [
{
"name": "init_col_data",
"discriminator": [
212,
90,
64,
12,
47,
10,
148,
64
],
"accounts": [
{
"name": "payer",
"writable": true,
"signer": true
},
{
"name": "col_data",
"writable": true,
"signer": true
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
}
],
"args": [
{
"name": "admin",
"type": "pubkey"
},
{
"name": "treasury",
"type": "pubkey"
}
]
},
{
"name": "mint_nft",
"discriminator": [
Expand Down Expand Up @@ -114,6 +153,10 @@
97
]
},
{
"kind": "account",
"path": "col_data"
},
{
"kind": "arg",
"path": "index"
Expand Down Expand Up @@ -143,6 +186,9 @@
]
}
},
{
"name": "col_data"
},
{
"name": "token_program",
"address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
Expand All @@ -163,6 +209,48 @@
}
]
},
{
"name": "update_col_data",
"discriminator": [
125,
142,
255,
220,
209,
161,
3,
50
],
"accounts": [
{
"name": "payer",
"writable": true,
"signer": true
},
{
"name": "admin",
"signer": true
},
{
"name": "col_data",
"writable": true
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
}
],
"args": [
{
"name": "admin",
"type": "pubkey"
},
{
"name": "treasury",
"type": "pubkey"
}
]
},
{
"name": "update_holder_field",
"discriminator": [
Expand Down Expand Up @@ -294,6 +382,19 @@
}
],
"accounts": [
{
"name": "ColData",
"discriminator": [
107,
169,
189,
167,
153,
208,
163,
185
]
},
{
"name": "MemberPda",
"discriminator": [
Expand Down Expand Up @@ -328,9 +429,30 @@
"code": 6003,
"name": "ReservedChannel",
"msg": "Channel is reserved"
},
{
"code": 6004,
"name": "NotAdminOfColData",
"msg": "Not admin of collection data"
}
],
"types": [
{
"name": "ColData",
"type": {
"kind": "struct",
"fields": [
{
"name": "treasury",
"type": "pubkey"
},
{
"name": "admin",
"type": "pubkey"
}
]
}
},
{
"name": "MemberPda",
"type": {
Expand All @@ -339,6 +461,10 @@
{
"name": "mint",
"type": "pubkey"
},
{
"name": "col_data",
"type": "pubkey"
}
]
}
Expand Down
Loading

0 comments on commit a3b9891

Please sign in to comment.