diff --git a/.env.dev b/.env.dev index 42dd95f..4f7097b 100644 --- a/.env.dev +++ b/.env.dev @@ -10,9 +10,21 @@ USDKY="op://Solana Dev/Solana Program Keys/program-keypair-2" USDP="op://Solana Dev/Solana Program Keys/program-keypair-3" XO="op://Solana Dev/Solana Program Keys/solana-earner-delta-keypair" +# -------------------------- +# Dawn +DAWN_EXT_PROGRAM_KEYPAIR="op://Solana Dev/Solana Program Keys/solana-earner-theta-keypair" +DAWN_EXT_MINT_KEYPAIR="op://Solana Dev/Solana Program Keys/dawn-usd" +DAWN_EXT_NAME="USD.tel" +DAWN_EXT_SYMBOL="USD.tel" +DAWN_EXT_URI="https://green-obedient-albatross-155.mypinata.cloud/ipfs/bafkreidyksiobibqsfzjefjlz3nkshgnkk2gangdjio6idx4f7gcvrejrm" + +# -------------------------- +# Live deployment +# -> THESE VARIABLES ARE USED BY THE SCRIPTS +# # Create token mint variables -EXT_MINT_KEYPAIR="" -EXT_PROGRAM_KEYPAIR="op://Solana Dev/Solana Program Keys/program-keypair-3" -EXT_NAME="extUSD" -EXT_SYMBOL="extUSD" -EXT_URI="https://green-obedient-albatross-155.mypinata.cloud/ipfs/bafkreiafre7cvdk7p6aa2d5r7c46g7kj3c5xltibptnjaxlyay2xt7uqbm" +EXT_PROGRAM_KEYPAIR="op://Solana Dev/Solana Program Keys/solana-earner-theta-keypair" +EXT_MINT_KEYPAIR="op://Solana Dev/Solana Program Keys/dawn-usd" +EXT_NAME="USD.tel" +EXT_SYMBOL="USD.tel" +EXT_URI="https://green-obedient-albatross-155.mypinata.cloud/ipfs/bafkreidyksiobibqsfzjefjlz3nkshgnkk2gangdjio6idx4f7gcvrejrm" diff --git a/services/cli/deploy.ts b/services/cli/deploy.ts index 3b1d7c2..7fd424f 100644 --- a/services/cli/deploy.ts +++ b/services/cli/deploy.ts @@ -27,8 +27,8 @@ const opts: shell.ExecOptions & { async: false } = { program .command("deploy-program") - .option("-t, --type ", "Yield type", "scaled-ui") - .option("-e, --extension ", "Extension program ID", "USDK") + .requiredOption("-t, --type ", "Yield type") // no-yield, scaled-ui + .requiredOption("-e, --extension ", "Extension program ID") // e.g. USDK .option("-c, --computePrice ", "Compute price", "300000") .action(({ type, extension, computePrice }) => { const [pid] = keysFromEnv([extension]); @@ -62,17 +62,21 @@ const opts: shell.ExecOptions & { async: false } = { program .command("set-idl") - .option("-t, --type ", "Yield type", "scaled-ui") - .option("-e, --extension ", "Extension program ID", "USDKY") - .option("-i, --init", "Extension program ID", false) + .requiredOption("-t, --type ", "Yield type") // e.g. scaled-ui + .requiredOption("-e, --extension ", "Extension program ID") // e.g. USDKy + .option("--skip-build", "Skip building the program", false) // if deployment was done immediately before, rebuilding is not required. + .option("-i, --init", "Upload IDL for the first time", false) // indicates if the data account to store the IDL is created in this transaction. .option("-s, --swapProgram", "Update swap program", false) - .action(({ type, extension, init, swapProgram }) => { + .action(({ type, extension, skipBuild, init, swapProgram }) => { const [pid] = keysFromEnv([extension]); const pubkey = swapProgram ? EXT_SWAP_PID : pid.publicKey.toBase58(); - console.log(`Building and initializing IDL for extension ${pubkey}`); + if (!skipBuild) { + console.log(`Building IDL for extension ${pubkey}`); + buildProgram(pubkey, type, false, swapProgram); + } - buildProgram(pubkey, type, false, swapProgram); + console.log(`Uploading IDL for extension ${pubkey}`); if (swapProgram) { postSwapIDL(); @@ -80,6 +84,8 @@ const opts: shell.ExecOptions & { async: false } = { } postIDL(pubkey, init); + + console.log("IDL successfully uploaded") }); program @@ -582,7 +588,15 @@ function setProgramID(pid: string) { } function keysFromEnv(keys: string[]) { - return keys.map((key) => - Keypair.fromSecretKey(Buffer.from(JSON.parse(process.env[key]!))), - ); + const foundKeys = keys.map((key) => { + const val = process.env[key]; + if (val === undefined) { + console.error(`environment variable ${key} must be set`); + process.exit(1); + } + + return Keypair.fromSecretKey(Buffer.from(JSON.parse(val))) + }); + + return foundKeys; } diff --git a/services/cli/main.ts b/services/cli/main.ts index 136ecd2..a400513 100644 --- a/services/cli/main.ts +++ b/services/cli/main.ts @@ -85,6 +85,8 @@ const mints: { [key: string]: string } = { "xoUSDq85Rjsb6SbUwJyreFgeWQvxdkT7R3c3g7s6p5Y", extUkDFf3HLekkxbcZ3XRUizMjbxMJgKBay3p9xGVmg: "usdsfJbX78ktZUnoRC7dwvvQz7xH3WdkpGne76gdUia", + mextzNVPUbLbvyBwqBqnC5J1SSwjDLjjR4yppf6EBzc: + "dawn7ZUF7h7anFuEsDdAU1Y3HYwikwqNMAENZsQJdNL" }; const M_MINT = new PublicKey("mzerojk9tg56ebsrEAhfkyc9VgKjTW2zDqp6C5mhjzH");