Skip to content

Commit

Permalink
Theta >> Mainnet (#17)
Browse files Browse the repository at this point in the history
* changes

* update the program ids for mainnet

* changes

* update with the new minter

* use the correct miner in target/types/sol_xen_miner_3.ts

---------

Co-authored-by: Nicholas Pettas <[email protected]>
  • Loading branch information
lbelyaev and nibty authored May 29, 2024
1 parent fd166ba commit 665e010
Show file tree
Hide file tree
Showing 10 changed files with 148 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/sol-xen-client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use std::time::Duration;

const MINERS: &str = "B8HwMYCk1o7EaJhooM4P43BHSk5M8zZHsTeJixqw7LMN,2Ewuie2KnTvMLwGqKWvEM1S2gUStHzDUfrANdJfu45QJ,5dxcK28nyAJdK9fSFuReRREeKnmAGVRpXPhwkZxAxFtJ,DdVCjv7fsPPm64HnepYy5MBfh2bNfkd84Rawey9rdt5S";

const MINTER: &str = "7A5q3Cw4oN5w1UXfsRTJbxGDXmVhXL2PLhL1Hp7gGCmj";
const MINTER: &str = "5tungisGgk1fmGXxacNT1NkPtZgRwJnJPVMK5kfHqx2m";

#[derive(BorshSerialize, Debug)]
pub struct EthAccount {
Expand Down
2 changes: 1 addition & 1 deletion app/sol-xen-multiminer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use solana_sdk::signature::Keypair;

const MINERS: &str = "B8HwMYCk1o7EaJhooM4P43BHSk5M8zZHsTeJixqw7LMN,2Ewuie2KnTvMLwGqKWvEM1S2gUStHzDUfrANdJfu45QJ,5dxcK28nyAJdK9fSFuReRREeKnmAGVRpXPhwkZxAxFtJ,DdVCjv7fsPPm64HnepYy5MBfh2bNfkd84Rawey9rdt5S";

const MINTER: &str = "7A5q3Cw4oN5w1UXfsRTJbxGDXmVhXL2PLhL1Hp7gGCmj";
const MINTER: &str = "5tungisGgk1fmGXxacNT1NkPtZgRwJnJPVMK5kfHqx2m";

const MAX_MINERS: u8 = 4;

Expand Down
3 changes: 1 addition & 2 deletions client/miner.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ async function main() {
process.exit(1);
}
}
const minersStr = process.env.MINERS
|| '5i4ZPZujwASXGSYENhQEEijiU4EWBzobPAKzKUs87khw,HbUSxXr4FKPShRyk813rHcXYnLkTwWEnhABe9gHJbe9Y,FMjsA783PDyU7856mT1v44vh5FgrL2VAFR241NF5Zd1w,6uxwCexinySFNP6fox9Zf48yhPTfAGYBw4j8QWQrCzmW';
const minersStr = process.env.MINERS || 'B8HwMYCk1o7EaJhooM4P43BHSk5M8zZHsTeJixqw7LMN,2Ewuie2KnTvMLwGqKWvEM1S2gUStHzDUfrANdJfu45QJ,5dxcK28nyAJdK9fSFuReRREeKnmAGVRpXPhwkZxAxFtJ,DdVCjv7fsPPm64HnepYy5MBfh2bNfkd84Rawey9rdt5S';
const miners = minersStr.split(',').map(s => new web3.PublicKey(s));
const programId = miners[kind];
// SETUP SOLANA ENVIRONMENT
Expand Down
3 changes: 1 addition & 2 deletions client/minter.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ async function main() {
process.exit(1);
}
// SETUP SOLANA ENVIRONMENT
const minersStr = process.env.MINERS
|| '5i4ZPZujwASXGSYENhQEEijiU4EWBzobPAKzKUs87khw,HbUSxXr4FKPShRyk813rHcXYnLkTwWEnhABe9gHJbe9Y,FMjsA783PDyU7856mT1v44vh5FgrL2VAFR241NF5Zd1w,6uxwCexinySFNP6fox9Zf48yhPTfAGYBw4j8QWQrCzmW';
const minersStr = process.env.MINERS || 'B8HwMYCk1o7EaJhooM4P43BHSk5M8zZHsTeJixqw7LMN,2Ewuie2KnTvMLwGqKWvEM1S2gUStHzDUfrANdJfu45QJ,5dxcK28nyAJdK9fSFuReRREeKnmAGVRpXPhwkZxAxFtJ,DdVCjv7fsPPm64HnepYy5MBfh2bNfkd84Rawey9rdt5S';
const miners = minersStr.split(',').map(s => new web3.PublicKey(s));
const minerProgramId = miners[kind];
const network = process.env.ANCHOR_PROVIDER_URL || 'localnet';
Expand Down
137 changes: 137 additions & 0 deletions deploy_new_minter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
#!/bin/bash

# Solana mainnet
# slot # 268,321,180 @ May 27, 2024 21:40:11 UTC
# target slot # 268495152 @ May 28, 2024 10:00:00 PDT

# localnet
# url="http://127.0.0.1:8899"

# xolana
# url="http://127.0.0.1:8899"

# devnet
# url="https://api.devnet.solana.com"

# mainnet
url="https://api.mainnet-beta.solana.com"

# nohup solana-test-validator &

solana config set --url "$url"

# solana airdrop 100

max=4
miners=''

current_slot=$(solana slot | awk '{print $0}')
echo "current slot= $current_slot"

# start_slot=$((current_slot+330))
start_slot=1
echo "start slot= $start_slot"

timestamp=$(date +%s)

miners="B8HwMYCk1o7EaJhooM4P43BHSk5M8zZHsTeJixqw7LMN,2Ewuie2KnTvMLwGqKWvEM1S2gUStHzDUfrANdJfu45QJ,5dxcK28nyAJdK9fSFuReRREeKnmAGVRpXPhwkZxAxFtJ,DdVCjv7fsPPm64HnepYy5MBfh2bNfkd84Rawey9rdt5S"

echo
echo "Miners=$miners"

echo
echo
echo "##### Minter #####"
echo

gsed -i 's/comma_delimited = "\(.*\)";/comma_delimited = "'$miners'";/' ./programs/sol-xen-minter/src/lib.rs

rm ./target/deploy/sol_xen_minter.so
rm ./target/deploy/sol_xen_minter-keypair.json

anchor build -p sol-xen-miner
minter_key=$(anchor keys list | grep "sol_xen_minter" | awk -F': ' '{print $2}')

echo " minter key= $minter_key"
gsed -i 's/declare_id!("\(.*\)");/declare_id!("'$minter_key'");/' ./programs/sol-xen-minter/src/lib.rs
gsed -i 's/const START_SLOT: u64 = \(.*\);/const START_SLOT: u64 = '$start_slot';/' ./programs/sol-xen-minter/src/lib.rs

anchor build -p sol-xen-minter

echo
echo
anchor deploy -p sol-xen-minter -- --with-compute-unit-price 1000000 ----max-sign-attempts 1000 --use-rpc
# anchor deploy -p sol-xen-minter

echo
echo "Sleeping for 5s..."
sleep 5

echo
echo "Initializing minter..."
echo

tsx ./admin/init_minter.ts

# should fail
# tsx ./admin/init_minter.ts

# solana program set-upgrade-authority "$minter_key" -u "$url" --final

timestamp_end=$(date +%s)

delta=$((timestamp_end-timestamp))

echo "Deployment took $delta s"

# echo
# echo "Relinquishing control..."
# echo
# tsx ./admin/relinquish_mint_control.ts

echo
echo "Deployment done"
echo

echo
echo "Modifying clients"
echo
# || '....';
# gsed -i "s/process.env.MINERS || '\(.*\)';/process.env.MINERS || '"$miners"';/" ./client/multiminer.ts

# const MINERS: &str = "
# gsed -i 's/const MINERS: \&str = "\(.*\)";/const MINERS: \&str = "'$miners'";/' ./app/sol-xen-client/src/main.rs
# gsed -i 's/const MINERS: \&str = "\(.*\)";/const MINERS: \&str = "'$miners'";/' ./app/sol-xen-multiminer/src/main.rs
gsed -i 's/const MINTER: \&str = "\(.*\)";/const MINTER: \&str = "'$minter_key'";/' ./app/sol-xen-client/src/main.rs
gsed -i 's/const MINTER: \&str = "\(.*\)";/const MINTER: \&str = "'$minter_key'";/' ./app/sol-xen-multiminer/src/main.rs

# echo
# echo "Doing test mines and mints"
# echo "Running TSX multiminer"
# echo
# tsx ./client/multiminer.ts mine --address 0x6B889Dcfad1a6ddf7dE3bC9417F5F51128efc964 -r 10 -f 1 -d 1 -a 10

echo
# echo "Pausing for 5s"
# sleep 5
echo "Compiling and Running NodeJS multiminer"

tsc 1>/dev/null

# runner.ts
gsed -i "s/runner.ts/runner.js/" ./client/multiminer.js
gsed -i "s/autominter.ts/autominter.js/" ./client/multiminer.js
gsed -i "s/multiminer/multiminer.js/" ./client/runner.js

# node ./client/multiminer.js mine --address 0x6B889Dcfad1a6ddf7dE3bC9417F5F51128efc964 -r 10 -f 1 -d 1 -a 10

# echo
# echo "Pausing for 5s"
# sleep 5
# echo "Running Rust multiminer"
# cargo run --package sol-xen-multiminer -- --address 0x6B889Dcfad1a6ddf7dE3bC9417F5F51128efc964 -r 10 -f 1 -d 1 -a 10





6 changes: 3 additions & 3 deletions programs/sol-xen-minter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ use anchor_spl::{
};
use mpl_token_metadata::{types::DataV2};

declare_id!("7A5q3Cw4oN5w1UXfsRTJbxGDXmVhXL2PLhL1Hp7gGCmj");
declare_id!("5tungisGgk1fmGXxacNT1NkPtZgRwJnJPVMK5kfHqx2m");

const START_SLOT: u64 = 268484759;
const START_SLOT: u64 = 1;

// TODO: lock to a specifig admin key
// const ADMIN_KEY: &str = "somesecretadminkey";
Expand Down Expand Up @@ -170,7 +170,7 @@ pub struct InitTokenMint<'info> {
payer = admin,
mint::decimals = params.decimals,
mint::authority = mint_account.key(),
mint::freeze_authority = mint_account.key(),
// mint::freeze_authority = admin.key(),
)]
pub mint_account: Box<Account<'info, Mint>>,
/// CHECK: Address validated using constraint
Expand Down
2 changes: 1 addition & 1 deletion target/idl/sol_xen_miner_0.json
Original file line number Diff line number Diff line change
Expand Up @@ -503,4 +503,4 @@
}
}
]
}
}
2 changes: 1 addition & 1 deletion target/idl/sol_xen_minter.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"address": "7A5q3Cw4oN5w1UXfsRTJbxGDXmVhXL2PLhL1Hp7gGCmj",
"address": "5tungisGgk1fmGXxacNT1NkPtZgRwJnJPVMK5kfHqx2m",
"metadata": {
"name": "sol_xen_minter",
"version": "0.1.0-epsilon",
Expand Down
2 changes: 1 addition & 1 deletion target/types/sol_xen_miner_3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* IDL can be found at `target/idl/sol_xen_miner.json`.
*/
export type SolXenMiner = {
"address": "7wrKrtgkyMUP87D6qEXLWHXWBE1hMTR7sZYNJgv8bP4",
"address": "DdVCjv7fsPPm64HnepYy5MBfh2bNfkd84Rawey9rdt5S",
"metadata": {
"name": "solXenMiner",
"version": "0.1.0-epsilon",
Expand Down
2 changes: 1 addition & 1 deletion target/types/sol_xen_minter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* IDL can be found at `target/idl/sol_xen_minter.json`.
*/
export type SolXenMinter = {
"address": "7A5q3Cw4oN5w1UXfsRTJbxGDXmVhXL2PLhL1Hp7gGCmj",
"address": "5tungisGgk1fmGXxacNT1NkPtZgRwJnJPVMK5kfHqx2m",
"metadata": {
"name": "solXenMinter",
"version": "0.1.0-epsilon",
Expand Down

0 comments on commit 665e010

Please sign in to comment.