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

Devnet deployment #33

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 23 additions & 21 deletions Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,41 @@
resolution = true
skip-lint = false

[programs.localnet]
[programs.devnet]
access_control = "Bcyv2YYSNBC7VqurTbM1VGmbuACKUPMQuKSsXQ17YsYB"
accountant = "GqJdQ9KkCg31EG6GfuPgiEpSCSYvEEXW41DA9YDaXbY2"
deposit_limit = "DERtm15fgAGFpJWqERMNCptQ6DKdP7NJtcejiPtTLovW"
faucet = "BALc31n5uFfE8SxJd2iRF9dk49i5ww8p5dZJAQHuDMai"
strategy_program = "EDA9ee5UKzdqrHgSd5v64bNnbCae1t7NJfUpvS7DZod"
tokenized_vault = "8eDcyX8Z8yZXBQsuatwxDC1qzGbuUbP7wGERDBQoPmBH"
access_control = "BDoMP91kwyaV4Y2dCFJS6dRSGenBQXNkcUfJk1Tw8bpW"
accountant = "49pfysnCNyz6HrKsTUaKtyp8DPcXQadjkS5qBJPJKEnJ"
deposit_limit = "HZekas7DsEfpg6JvU9wsGNUSy9E3fu9TGeVerMdvDBwc"
faucet = "GUrM139EUwYkoEWebecqiTLJrvut4mDdHGTu9d87tgQC"
tokenized_vault = "HdQsT53sANBQmPb6xWRaZXUzAXydLteNsJW1Y6kJDbMm"

[registry]
url = "https://api.apr.dev"

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

[scripts]
demo = "yarn run demo"
init_vault = "yarn run init_vault"
set_roles = "yarn run set_roles"
whitelist = "yarn run whitelist"
update_deposit_limit = "yarn run update-deposit-limit"
dev_test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/integration/vault.ts"
init_faucet = "yarn run init_faucet"
process_report = "yarn run process_report"
init_trade_fi = "yarn run init_trade_fi"
underlying_mint = "yarn run underlying_mint"
init_trade_fi = "yarn run init_trade_fi"
init_vault = "yarn run init_vault"
initialize = "yarn run initialize"
test = "yarn run ts-mocha -r dotenv/config -p ./tsconfig.json -t 2000000 --require './tests/integration/setups/globalSetup.ts' --recursive --reporter mocha-qase-reporter 'tests/integration/**/*.test.ts'"
dev_test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/integration/vault.ts"
process_report = "yarn run process_report"
set_roles = "yarn run set_roles"
shutdown_vault = "yarn run shutdown_vault"

[[test.genesis]]
address = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
program = "mpl_token_metadata.so"
test = "yarn run ts-mocha -r dotenv/config -p ./tsconfig.json -t 2000000 --require './tests/integration/setups/globalSetup.ts' --recursive --reporter mocha-qase-reporter 'tests/integration/**/*.test.ts'"
underlying_mint = "yarn run underlying_mint"
update_deposit_limit = "yarn run update-deposit-limit"
whitelist = "yarn run whitelist"

[test]
startup_wait = 10000
startup_wait = 10000
shutdown_wait = 2000
upgradeable = false

[[test.genesis]]
address = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
program = "mpl_token_metadata.so"
32 changes: 22 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,40 +41,48 @@ Deploy the compiled program to the Solana testnet or mainnet:

`sudo anchor deploy`

**Step 4: Set Roles**


**Step 4: Initilize Porgrams**

Run the predefined anchor run initialize script to initilize your program:

`sudo anchor run initialize`

**Step 5: Set Roles**

Run the predefined set_roles script to configure roles in your program:

`sudo anchor run set_roles`

**Step 5: Mint the Underlying Token**
**Step 6: Mint the Underlying Token**

Initialize the minting process for the underlying token by running:

`sudo anchor run underlying_mint`

**Step 5.1: Capture the Mint Public Key**
**Step 6.1: Capture the Mint Public Key**

After running the above command, capture the Underlying Token Mint Public Key from the output (e.g., "4dCLhR7U8PzwXau6qfjr73tKgp5SD42aLbyo3XQNzY4V"). You will use this public key in later steps.
After running the above command, capture the Underlying Token Mint Public Key from the output (e.g., "CWduyZkkj34f5YntKwD7NjkHaRt7kfiScopgEqu9RR6W"). You will use this public key in later steps.

----------------------------------------------------------------------------------------

****Vault Initialization****

**Step 6: Update the create_default_vault_with_strategy.ts File**
**Step 7: Update the create_default_vault_with_strategy.ts File**

Edit the file create_default_vault_with_strategy.ts:
Replace the underlying_mint on line 29 with the public key you captured in Step 5.1.
Set the index to 0 in the same file.
~~Set the index to 0 in the same file.~~

**Step 7: Initialize the Vault**
**Step 7.1: Initialize the Vault**

Run the initialization script for the default vault:
`sudo anchor run init_vault`

**Step 8: Update the Index in the Script**
~~ ** Step 8: Update the Index in the Script ** ~~

Go back to the create_default_vault_with_strategy.ts file and update the index to 1.
~~Go back to the create_default_vault_with_strategy.ts file and update the index to 1.~~

**Step 9: Initialize the Vault Again**

Expand All @@ -90,12 +98,14 @@ Run the initialization script once more:

Edit the file create_vault_with_trade_fi_strategy.ts:
Replace the underlying_mint on line 29 with the public key from Step 5.1.
Set the index to 2.
~~Set the index to 2.~~

**Step 11: Initialize TradeFi**

Run the initialization script for the TradeFi strategy:

Note: update the depositPeriodEnds and lockPeriodEnds fields at line #161 and #163.

`sudo anchor run init_trade_fi`

----------------------------------------------------------------------------------------
Expand All @@ -104,6 +114,8 @@ Run the initialization script for the TradeFi strategy:

**Step 12: Initialize the Faucet**

Note: Replace the underlying_mint on line 24 with the public key you captured in Step 5.1.

Run the faucet initialization script:

`sudo anchor run init_faucet`
Expand Down
2 changes: 1 addition & 1 deletion programs/access_control/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub mod state;

use crate::instructions::*;

declare_id!("BDoMP91kwyaV4Y2dCFJS6dRSGenBQXNkcUfJk1Tw8bpW");
declare_id!("Bcyv2YYSNBC7VqurTbM1VGmbuACKUPMQuKSsXQ17YsYB");

#[program]
pub mod access_control {
Expand Down
2 changes: 1 addition & 1 deletion programs/accountant/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub mod utils;
use crate::instructions::*;
use crate::state::*;

declare_id!("49pfysnCNyz6HrKsTUaKtyp8DPcXQadjkS5qBJPJKEnJ");
declare_id!("GqJdQ9KkCg31EG6GfuPgiEpSCSYvEEXW41DA9YDaXbY2");

#[derive(Accounts)]
pub struct RegAcc<'info> {
Expand Down
2 changes: 1 addition & 1 deletion programs/deposit_limit/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anchor_lang::prelude::*;

declare_id!("HZekas7DsEfpg6JvU9wsGNUSy9E3fu9TGeVerMdvDBwc");
declare_id!("DERtm15fgAGFpJWqERMNCptQ6DKdP7NJtcejiPtTLovW");

#[program]
pub mod deposit_limit {
Expand Down
2 changes: 1 addition & 1 deletion programs/faucet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub mod error;

pub use instructions::*;

declare_id!("GUrM139EUwYkoEWebecqiTLJrvut4mDdHGTu9d87tgQC");
declare_id!("BALc31n5uFfE8SxJd2iRF9dk49i5ww8p5dZJAQHuDMai");

#[program]
pub mod faucet {
Expand Down
2 changes: 1 addition & 1 deletion programs/strategy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub use constants::*;
pub use instructions::*;
pub use state::*;

declare_id!("EDA9ee5UKzdqrHgSd5v64bNnbCae1t7NJfUpvS7DZod");
declare_id!("AVjatxXi6aRfjxdCbzqffGqmiaJLWXuKFAbkA6FeKymW");

// we need to define a trait for the strategies
// they aren't defined otherwise, because we work with unchecked accounts
Expand Down
2 changes: 1 addition & 1 deletion programs/tokenized_vault/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use anchor_lang::prelude::*;
pub use state::{SharesConfig, VaultConfig};
pub use instructions::*;

declare_id!("8eDcyX8Z8yZXBQsuatwxDC1qzGbuUbP7wGERDBQoPmBH");
declare_id!("HdQsT53sANBQmPb6xWRaZXUzAXydLteNsJW1Y6kJDbMm");

#[program]
pub mod tokenized_vault {
Expand Down
2 changes: 1 addition & 1 deletion scripts/create_default_vault_with_strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async function main() {
const strategyProgram = anchor.workspace.Strategy as Program<Strategy>;
const accountantProgram = anchor.workspace.Accountant as Program<Accountant>;

const underlyingMint = new anchor.web3.PublicKey("6ktEi4XgXUfMhia2DYC6o8yBRUFfbLnuMRRuhxyt8ajV");
const underlyingMint = new anchor.web3.PublicKey("CWduyZkkj34f5YntKwD7NjkHaRt7kfiScopgEqu9RR6W");
console.log("Underlying token mint public key:", underlyingMint.toBase58());

const accountant = anchor.web3.PublicKey.findProgramAddressSync(
Expand Down
6 changes: 3 additions & 3 deletions scripts/create_vault_with_trade_fi_strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async function main() {
const strategyProgram = anchor.workspace.Strategy as Program<Strategy>;
const accountantProgram = anchor.workspace.Accountant as Program<Accountant>;

const underlyingMint = new anchor.web3.PublicKey("6ktEi4XgXUfMhia2DYC6o8yBRUFfbLnuMRRuhxyt8ajV");
const underlyingMint = new anchor.web3.PublicKey("CWduyZkkj34f5YntKwD7NjkHaRt7kfiScopgEqu9RR6W");
console.log("Underlying token mint public key:", underlyingMint.toBase58());

const accountant = anchor.web3.PublicKey.findProgramAddressSync(
Expand Down Expand Up @@ -156,9 +156,9 @@ async function main() {
const strategyConfig = new TradeFintechConfig({
depositLimit: new BN(1000),
// deposit ends in 1 minute, epoch time in seconds
depositPeriodEnds: new BN(Date.now() / 1000 + 60 * 30),
depositPeriodEnds: new BN(1732147199),//Date.now() / 1000 + 60 * 30),
// lock period ends in 2 minute
lockPeriodEnds: new BN(Date.now() / 1000 + 2 * 60 * 30),
lockPeriodEnds: new BN(1732233599),//Date.now() / 1000 + 2 * 60 * 30),
performanceFee: new BN(1),
feeManager: admin.publicKey
});
Expand Down
2 changes: 1 addition & 1 deletion scripts/init_faucet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async function main() {
let faucetProgram: Program<Faucet> = anchor.workspace.Faucet;
console.log("Faucet program ID:", faucetProgram.programId.toBase58());

const underlyingMint = new anchor.web3.PublicKey("gMiieh8f3j6VVRaSKqxa2iiznqXCNkY6ocr65YCY7i1");
const underlyingMint = new anchor.web3.PublicKey("CWduyZkkj34f5YntKwD7NjkHaRt7kfiScopgEqu9RR6W");

const faucetData = anchor.web3.PublicKey.findProgramAddressSync(
[Buffer.from("data")],
Expand Down
Loading