Skip to content

Commit

Permalink
added github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
lbelyaev committed May 28, 2024
1 parent 620a646 commit 0054775
Show file tree
Hide file tree
Showing 22 changed files with 134 additions and 53 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Release

permissions:
contents: write

on:
push:
tags:
- v[0-9]+.*

jobs:
create-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: taiki-e/create-gh-release-action@v1
with:
# (optional) Path to changelog.
changelog: CHANGELOG.md
# (required) GitHub token for creating GitHub Releases.
token: ${{ secrets.GITHUB_TOKEN }}

upload-assets:
needs: create-release
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: taiki-e/upload-rust-binary-action@v1
with:
# (required) Comma-separated list of binary names (non-extension portion of filename) to build and upload.
# Note that glob pattern is not supported yet.
bin: ...
# (optional) Target triple, default is host triple.
# This is optional but it is recommended that this always be set to
# clarify which target you are building for if macOS is included in
# the matrix because GitHub Actions changed the default architecture
# of macos-latest since macos-14.
target: ${{ matrix.target }}
# (optional) On which platform to distribute the `.tar.gz` file.
# [default value: unix]
# [possible values: all, unix, windows, none]
tar: unix
# (optional) On which platform to distribute the `.zip` file.
# [default value: windows]
# [possible values: all, unix, windows, none]
zip: windows
# (required) GitHub token for uploading assets to GitHub Releases.
token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ url = "https://api.apr.dev"

[provider]
# cluster = "http://69.10.34.226:8899"
# cluster = "devnet"
cluster = "localnet"
cluster = "devnet"
# cluster = "localnet"
wallet = "~/.config/solana/id.json"

[scripts]
Expand Down
6 changes: 3 additions & 3 deletions admin/init_minter.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ async function main() {
], TOKEN_METADATA_PROGRAM_ID);
const createAccounts = {
admin: provider.wallet.publicKey,
// metadata: metadataAddress,
metadata: metadataAddress,
tokenProgram: TOKEN_PROGRAM_ID,
};
const metadata = {
name: "solXEN (epsilon)",
symbol: "solXENe2",
name: "solXEN (eta)",
symbol: "solXENeta",
uri: "",
decimals: 9,
};
Expand Down
6 changes: 3 additions & 3 deletions admin/init_minter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ async function main() {

const createAccounts = {
admin: provider.wallet.publicKey,
// metadata: metadataAddress,
metadata: metadataAddress,
tokenProgram: TOKEN_PROGRAM_ID,
};

const metadata = {
name: "solXEN (epsilon)",
symbol: "solXENe2",
name: "solXEN",
symbol: "solXEN",
uri: "",
decimals: 9,
}
Expand Down
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 @@ -22,7 +22,7 @@ use dotenv::dotenv;
use std::thread;
use std::time::Duration;

const MINERS: &str = "CFRDmC2xPN7K2D8GadHKpcwSAC5YvPzPjbjYA6v439oi,7vQ9pG7MUjkswNkL96XiiYbz3swM9dkqgMEAbgDaLggi,DpLx72BXVhZN6hkA6LKKres3EUKvK36mmh5JaKyaVSYU,7u5D7qPHGZHXQ3nQTeZu5eFKtKGKQWKhJCdM1B3T4Ly4";
const MINERS: &str = "HzkjK2uP2osHaNm5MrNsMWYWFpsh4WyVBwUD6V6ezbTQ,R9NafUx9yS6HZzG5TSP61DyG6YwFMyniZAwsVPYPorK,27kyMxWVXCiYJ29zff2evkMu6naoDGkt8DSfnwWBMsLL,8GSbYKvNHx9fW7gTGQVTa8MT2euRnpniiwDC7XDPSA78";

#[derive(BorshSerialize, Debug)]
pub struct EthAccount {
Expand Down
4 changes: 2 additions & 2 deletions app/sol-xen-multiminer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ use std::time::Duration;
use solana_sdk::clock::Slot;
use solana_sdk::signature::Keypair;

const MINERS: &str = "CFRDmC2xPN7K2D8GadHKpcwSAC5YvPzPjbjYA6v439oi,7vQ9pG7MUjkswNkL96XiiYbz3swM9dkqgMEAbgDaLggi,DpLx72BXVhZN6hkA6LKKres3EUKvK36mmh5JaKyaVSYU,7u5D7qPHGZHXQ3nQTeZu5eFKtKGKQWKhJCdM1B3T4Ly4";
const MINERS: &str = "HzkjK2uP2osHaNm5MrNsMWYWFpsh4WyVBwUD6V6ezbTQ,R9NafUx9yS6HZzG5TSP61DyG6YwFMyniZAwsVPYPorK,27kyMxWVXCiYJ29zff2evkMu6naoDGkt8DSfnwWBMsLL,8GSbYKvNHx9fW7gTGQVTa8MT2euRnpniiwDC7XDPSA78";

const MINTER: &str = "3fpRvJQx7WP44ijejJrxAYexP71nC6R7xuysnNmpUP9o";
const MINTER: &str = "FmwhDsuBtK3DqFXYnZRfho4Qd2Mty1t4khvNrpPveNao";

const MAX_MINERS: u8 = 4;

Expand Down
4 changes: 2 additions & 2 deletions client/listener.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import dotenv from "dotenv";
import {SolXen} from '../target/types/sol_xen';
import {SolXenMiner} from '../target/types/sol_xen_miner';
import {AnchorProvider, setProvider, Program, web3, workspace} from '@coral-xyz/anchor';
//import { debug } from 'debug';
import pkg from 'debug';
Expand All @@ -23,7 +23,7 @@ async function main() {
null as any,
)
setProvider(provider);
const program = workspace.SolXen as Program<SolXen>;
const program = workspace.SolXenMiner as Program<SolXenMiner>;

let listener: number;

Expand Down
2 changes: 1 addition & 1 deletion client/multiminer.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ async function main() {
process.exit(1);
}
}
const minersStr = process.env.MINERS || 'CFRDmC2xPN7K2D8GadHKpcwSAC5YvPzPjbjYA6v439oi,7vQ9pG7MUjkswNkL96XiiYbz3swM9dkqgMEAbgDaLggi,DpLx72BXVhZN6hkA6LKKres3EUKvK36mmh5JaKyaVSYU,7u5D7qPHGZHXQ3nQTeZu5eFKtKGKQWKhJCdM1B3T4Ly4';
const minersStr = process.env.MINERS || 'HzkjK2uP2osHaNm5MrNsMWYWFpsh4WyVBwUD6V6ezbTQ,R9NafUx9yS6HZzG5TSP61DyG6YwFMyniZAwsVPYPorK,27kyMxWVXCiYJ29zff2evkMu6naoDGkt8DSfnwWBMsLL,8GSbYKvNHx9fW7gTGQVTa8MT2euRnpniiwDC7XDPSA78';
const miners = minersStr.split(',').map(s => new web3.PublicKey(s));
// SETUP SOLANA ENVIRONMENT
const network = process.env.ANCHOR_PROVIDER_URL || 'localnet';
Expand Down
2 changes: 1 addition & 1 deletion client/multiminer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ async function main() {
}
}

const minersStr = process.env.MINERS || 'CFRDmC2xPN7K2D8GadHKpcwSAC5YvPzPjbjYA6v439oi,7vQ9pG7MUjkswNkL96XiiYbz3swM9dkqgMEAbgDaLggi,DpLx72BXVhZN6hkA6LKKres3EUKvK36mmh5JaKyaVSYU,7u5D7qPHGZHXQ3nQTeZu5eFKtKGKQWKhJCdM1B3T4Ly4';
const minersStr = process.env.MINERS || 'HzkjK2uP2osHaNm5MrNsMWYWFpsh4WyVBwUD6V6ezbTQ,R9NafUx9yS6HZzG5TSP61DyG6YwFMyniZAwsVPYPorK,27kyMxWVXCiYJ29zff2evkMu6naoDGkt8DSfnwWBMsLL,8GSbYKvNHx9fW7gTGQVTa8MT2euRnpniiwDC7XDPSA78';

const miners = minersStr.split(',').map(s => new web3.PublicKey(s));

Expand Down
39 changes: 24 additions & 15 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@

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

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

nohup solana-test-validator &
# devnet
url="https://api.devnet.solana.com"

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

# nohup solana-test-validator &

solana config set --url "$url"

Expand All @@ -17,8 +24,10 @@ miners=''

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

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

timestamp=$(date +%s)

Expand Down Expand Up @@ -141,15 +150,15 @@ sed -i 's/const MINERS: \&str = "\(.*\)";/const MINERS: \&str = "'$miners'";/' .
sed -i 's/const MINERS: \&str = "\(.*\)";/const MINERS: \&str = "'$miners'";/' ./app/sol-xen-multiminer/src/main.rs
sed -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
# 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 "Pausing for 5s"
# sleep 5
echo "Compiling and Running NodeJS multiminer"

tsc 1>/dev/null
Expand All @@ -159,13 +168,13 @@ sed -i "s/runner.ts/runner.js/" ./client/multiminer.js
sed -i "s/autominter.ts/autominter.js/" ./client/multiminer.js
sed -i "s/multiminer/multiminer.js/" ./client/runner.js

node ./client/multiminer.js mine --address 0x6B889Dcfad1a6ddf7dE3bC9417F5F51128efc964 -r 10 -f 1 -d 1 -a 10
# 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
# 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



Expand Down
4 changes: 2 additions & 2 deletions programs/sol-xen-miner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use anchor_lang::{
use sha3::{Digest, Keccak256};
use ethaddr::Address;

declare_id!("7u5D7qPHGZHXQ3nQTeZu5eFKtKGKQWKhJCdM1B3T4Ly4");
declare_id!("8GSbYKvNHx9fW7gTGQVTa8MT2euRnpniiwDC7XDPSA78");

const MAX_HASHES: u8 = 72;
const HASH_PATTERN: &str = "420";
Expand All @@ -13,7 +13,7 @@ const SUPERHASH_X: u16 = 250;
const AMP_START: u16 = 300;
const AMP_CYCLE_SLOTS: u64 = 5_000;

const START_SLOT: u64 = 171737;
const START_SLOT: u64 = 301877078;

// TODO: lock to a specifig admin key
// const ADMIN_KEY: &str = "somesecretadminkey";
Expand Down
19 changes: 9 additions & 10 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!("3fpRvJQx7WP44ijejJrxAYexP71nC6R7xuysnNmpUP9o");
declare_id!("FmwhDsuBtK3DqFXYnZRfho4Qd2Mty1t4khvNrpPveNao");

const START_SLOT: u64 = 171737;
const START_SLOT: u64 = 301877078;

// TODO: lock to a specifig admin key
// const ADMIN_KEY: &str = "somesecretadminkey";
Expand All @@ -20,9 +20,8 @@ const START_SLOT: u64 = 171737;
pub mod sol_xen_minter {
use super::*;

pub fn create_mint(_ctx: Context<InitTokenMint>, _metadata: InitTokenParams) -> Result<()> {

/*
pub fn create_mint(ctx: Context<InitTokenMint>, metadata: InitTokenParams) -> Result<()> {

let seeds = &["mint".as_bytes(), &[ctx.bumps.mint_account]];
let signer = [&seeds[..]];

Expand Down Expand Up @@ -57,7 +56,7 @@ pub mod sol_xen_minter {
true,
None,
)?;
*/

Ok(())
}

Expand Down Expand Up @@ -96,7 +95,7 @@ pub mod sol_xen_minter {

require!(kind < 4, SolXenError::BadParam);

let comma_delimited = "CFRDmC2xPN7K2D8GadHKpcwSAC5YvPzPjbjYA6v439oi,7vQ9pG7MUjkswNkL96XiiYbz3swM9dkqgMEAbgDaLggi,DpLx72BXVhZN6hkA6LKKres3EUKvK36mmh5JaKyaVSYU,7u5D7qPHGZHXQ3nQTeZu5eFKtKGKQWKhJCdM1B3T4Ly4";
let comma_delimited = "HzkjK2uP2osHaNm5MrNsMWYWFpsh4WyVBwUD6V6ezbTQ,R9NafUx9yS6HZzG5TSP61DyG6YwFMyniZAwsVPYPorK,27kyMxWVXCiYJ29zff2evkMu6naoDGkt8DSfnwWBMsLL,8GSbYKvNHx9fW7gTGQVTa8MT2euRnpniiwDC7XDPSA78";

let miners: Vec<Pubkey> = comma_delimited
.split(',')
Expand Down Expand Up @@ -175,10 +174,10 @@ pub struct InitTokenMint<'info> {
)]
pub mint_account: Box<Account<'info, Mint>>,
/// CHECK: Address validated using constraint
// #[account(mut)]
// pub metadata: UncheckedAccount<'info>,
#[account(mut)]
pub metadata: UncheckedAccount<'info>,
pub token_program: Program<'info, Token>,
// pub token_metadata_program: Program<'info, Metadata>,
pub token_metadata_program: Program<'info, Metadata>,
pub system_program: Program<'info, System>,
pub rent: Sysvar<'info, Rent>,
}
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
@@ -1,5 +1,5 @@
{
"address": "CFRDmC2xPN7K2D8GadHKpcwSAC5YvPzPjbjYA6v439oi",
"address": "HzkjK2uP2osHaNm5MrNsMWYWFpsh4WyVBwUD6V6ezbTQ",
"metadata": {
"name": "sol_xen_miner",
"version": "0.1.0-epsilon",
Expand Down
2 changes: 1 addition & 1 deletion target/idl/sol_xen_miner_1.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"address": "7vQ9pG7MUjkswNkL96XiiYbz3swM9dkqgMEAbgDaLggi",
"address": "R9NafUx9yS6HZzG5TSP61DyG6YwFMyniZAwsVPYPorK",
"metadata": {
"name": "sol_xen_miner",
"version": "0.1.0-epsilon",
Expand Down
2 changes: 1 addition & 1 deletion target/idl/sol_xen_miner_2.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"address": "DpLx72BXVhZN6hkA6LKKres3EUKvK36mmh5JaKyaVSYU",
"address": "27kyMxWVXCiYJ29zff2evkMu6naoDGkt8DSfnwWBMsLL",
"metadata": {
"name": "sol_xen_miner",
"version": "0.1.0-epsilon",
Expand Down
2 changes: 1 addition & 1 deletion target/idl/sol_xen_miner_3.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"address": "7u5D7qPHGZHXQ3nQTeZu5eFKtKGKQWKhJCdM1B3T4Ly4",
"address": "8GSbYKvNHx9fW7gTGQVTa8MT2euRnpniiwDC7XDPSA78",
"metadata": {
"name": "sol_xen_miner",
"version": "0.1.0-epsilon",
Expand Down
12 changes: 10 additions & 2 deletions target/idl/sol_xen_minter.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"address": "3fpRvJQx7WP44ijejJrxAYexP71nC6R7xuysnNmpUP9o",
"address": "FmwhDsuBtK3DqFXYnZRfho4Qd2Mty1t4khvNrpPveNao",
"metadata": {
"name": "sol_xen_minter",
"version": "0.1.0-epsilon",
Expand Down Expand Up @@ -42,10 +42,18 @@
]
}
},
{
"name": "metadata",
"writable": true
},
{
"name": "token_program",
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
},
{
"name": "token_metadata_program",
"address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
},
{
"name": "system_program",
"address": "11111111111111111111111111111111"
Expand All @@ -57,7 +65,7 @@
],
"args": [
{
"name": "_metadata",
"name": "metadata",
"type": {
"defined": {
"name": "InitTokenParams"
Expand Down
2 changes: 1 addition & 1 deletion target/types/sol_xen_miner_0.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": "CFRDmC2xPN7K2D8GadHKpcwSAC5YvPzPjbjYA6v439oi",
"address": "HzkjK2uP2osHaNm5MrNsMWYWFpsh4WyVBwUD6V6ezbTQ",
"metadata": {
"name": "solXenMiner",
"version": "0.1.0-epsilon",
Expand Down
2 changes: 1 addition & 1 deletion target/types/sol_xen_miner_1.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": "7vQ9pG7MUjkswNkL96XiiYbz3swM9dkqgMEAbgDaLggi",
"address": "R9NafUx9yS6HZzG5TSP61DyG6YwFMyniZAwsVPYPorK",
"metadata": {
"name": "solXenMiner",
"version": "0.1.0-epsilon",
Expand Down
2 changes: 1 addition & 1 deletion target/types/sol_xen_miner_2.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": "DpLx72BXVhZN6hkA6LKKres3EUKvK36mmh5JaKyaVSYU",
"address": "27kyMxWVXCiYJ29zff2evkMu6naoDGkt8DSfnwWBMsLL",
"metadata": {
"name": "solXenMiner",
"version": "0.1.0-epsilon",
Expand Down
Loading

0 comments on commit 0054775

Please sign in to comment.