Skip to content
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
8 changes: 8 additions & 0 deletions Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ v06-create-dao = "yarn run tsx scripts/v0.6/createDao.ts"
v06-provide-liquidity = "yarn run tsx scripts/v0.6/provideLiquidity.ts"
v06-collect-meteora-damm-fees = "yarn run tsx scripts/v0.6/collectMeteoraDammFees.ts"
v07-collect-meteora-damm-fees = "yarn run tsx scripts/v0.7/collectMeteoraDammFees.ts"
v07-launch-template = "yarn run tsx scripts/v0.7/launchTemplate.ts"
v07-start-launch = "yarn run tsx scripts/v0.7/startLaunch.ts"
v07-complete-launch = "yarn run tsx scripts/v0.7/completeLaunch.ts"
v07-claim-all-launch = "yarn run tsx scripts/v0.7/claimAllLaunch.ts"
v07-approve-points-based = "yarn run tsx scripts/v0.7/pointsBased/approveWithPointsWeightedPhase.ts"
v07-close-launch = "yarn run tsx scripts/v0.7/closeLaunch.ts"
v07-initialize-performance-package = "yarn run tsx scripts/v0.7/initializePerformancePackage.ts"
v07-claim-launch-additional-tokens = "yarn run tsx scripts/v0.7/claimLaunchAdditionalTokens.ts"

[test]
startup_wait = 5000
Expand Down
6 changes: 6 additions & 0 deletions scripts/assets/RNGR/RNGR.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "Ranger",
"symbol": "RNGR",
"description": "Futarchy ownership token of Ranger",
"image": "https://raw.githubusercontent.com/metaDAOproject/programs/refs/heads/develop/scripts/assets/RNGR/RNGR.png"
}
Binary file added scripts/assets/RNGR/RNGR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 23 additions & 20 deletions scripts/v0.7/claimAllLaunch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ dotenv.config();
const provider = anchor.AnchorProvider.env();
const payer = provider.wallet["payer"];

const launchAddr = new PublicKey(
"9kx7UDFzFt7e2V4pFtawnupKKvRR3EhV7P1Pxmc5XCQj",
);
const launchAddr = new PublicKey("111111111111111111111111111111111");

const launchpad: LaunchpadClient = LaunchpadClient.createClient({ provider });

Expand Down Expand Up @@ -54,32 +52,37 @@ async function main() {
const tx = new Transaction();

// Add compute budget instruction to handle multiple claims
tx.add(ComputeBudgetProgram.setComputeUnitLimit({ units: 1_000_000 }));
// tx.add(ComputeBudgetProgram.setComputeUnitLimit({ units: 1_000_000 }));

// Add claim instructions for each record in the batch
for (const record of batch) {
const claimIx = await launchpad
.claimIx(launchAddr, launch.baseMint, record.account.funder)
.transaction();
if (!record.account.isTokensClaimed) {
const claimIx = await launchpad
.claimIx(launchAddr, launch.baseMint, record.account.funder)
.transaction();

tx.add(claimIx);
tx.add(claimIx);
}
}

await sendAndConfirmTransaction(tx, `Claim batch ${i / batchSize + 1}`);

for (const record of batch) {
const refundIx = await launchpad
.refundIx({
launch: launchAddr,
funder: record.account.funder,
quoteMint: launch.baseMint,
})
.transaction();

tx.add(refundIx);
if (!record.account.isUsdcRefunded) {
const refundIx = await launchpad
.refundIx({
launch: launchAddr,
funder: record.account.funder,
quoteMint: launch.quoteMint,
})
.transaction();

tx.add(refundIx);
}
}

await sendAndConfirmTransaction(tx, `Refund batch ${i / batchSize + 1}`);
await sendAndConfirmTransaction(
tx,
`Claim and refund batch ${i / batchSize + 1}`,
);
}

console.log("All claims processed successfully!");
Expand Down
39 changes: 39 additions & 0 deletions scripts/v0.7/claimLaunchAdditionalTokens.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import * as anchor from "@coral-xyz/anchor";
import { LaunchpadClient } from "@metadaoproject/futarchy/v0.7";
import { PublicKey } from "@solana/web3.js";

const provider = anchor.AnchorProvider.env();
const payer = provider.wallet["payer"];

const launchpad: LaunchpadClient = LaunchpadClient.createClient({ provider });

const launch = new PublicKey("HUM66D4uRnWTFHm3fJkA2rvQWqpHnJZWgRUt5QNxWF6E");

export const closeLaunch = async () => {
console.log(
`Claiming additional token allocation for launch at address: ${launch.toBase58()}`,
);

const launchAccount = await launchpad.fetchLaunch(launch);

console.log(
`Additional tokens recipient: ${launchAccount.additionalTokensRecipient.toBase58()}`,
);
console.log(
`Additional tokens amount: ${launchAccount.additionalTokensAmount.toString()}`,
);

const txSignature = await launchpad
.claimAdditionalTokenAllocationIx({
launch,
baseMint: launchAccount.baseMint,
additionalTokensRecipient: launchAccount.additionalTokensRecipient,
})
.rpc();

console.log(
`Additional token allocation claimed successfully: ${txSignature}`,
);
};

closeLaunch().catch(console.error);
8 changes: 3 additions & 5 deletions scripts/v0.7/closeLaunch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ const payer = provider.wallet["payer"];

const launchpad: LaunchpadClient = LaunchpadClient.createClient({ provider });

export const closeLaunch = async () => {
const mintKp = new PublicKey("PRVT6TB7uss3FrUd2D9xs2zqDBsa3GbMJMwCQsgmeta");

const [launch] = getLaunchAddr(undefined, mintKp);
const launch = new PublicKey("111111111111111111111111111111111");

console.log(`Closing launch at address: ${launch.toString()}`);
export const closeLaunch = async () => {
console.log(`Closing launch at address: ${launch.toBase58()}`);

await launchpad.closeLaunchIx({ launch }).rpc();

Expand Down
30 changes: 15 additions & 15 deletions scripts/v0.7/completeLaunch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,29 @@ import {
} from "@solana/web3.js";
import { createLookupTableForTransaction } from "../utils/utils.js";

const LAUNCH_TO_COMPLETE: PublicKey | undefined = new PublicKey(
"111111111111111111111111111111111",
);

const provider = anchor.AnchorProvider.env();
const payer = provider.wallet["payer"];

const launchpad: LaunchpadClient = LaunchpadClient.createClient({ provider });

const BID_WALL_FEE_RECIPIENT: PublicKey | undefined = undefined;

export const completeLaunch = async () => {
if (BID_WALL_FEE_RECIPIENT === undefined) {
if (LAUNCH_TO_COMPLETE === undefined) {
throw new Error(
"BID_WALL_FEE_RECIPIENT is not set. Please set it in the script.",
"LAUNCH_TO_COMPLETE is not set. Please set it in the script.",
);
}

const mintKp = new PublicKey("PRVT6TB7uss3FrUd2D9xs2zqDBsa3GbMJMwCQsgmeta");

const [launch] = getLaunchAddr(undefined, mintKp);
let launchAccount = await launchpad.fetchLaunch(LAUNCH_TO_COMPLETE);

const tx = await launchpad
.completeLaunchIx({
launch,
baseMint: mintKp,
launch: LAUNCH_TO_COMPLETE,
baseMint: launchAccount.baseMint,
launchAuthority: payer.publicKey,
feeRecipient: BID_WALL_FEE_RECIPIENT,
})
.transaction();

Expand All @@ -51,20 +50,21 @@ export const completeLaunch = async () => {
const vtx = new VersionedTransaction(message);
vtx.sign([payer]);

const completeTxHash = await provider.connection.sendTransaction(vtx, {
skipPreflight: true,
});
const completeTxHash = await provider.connection.sendTransaction(vtx);

console.log(`Complete launch transaction sent: ${completeTxHash}`);

console.log("Launch completed successfully!");

console.log("Setting up performance package...");

// Refresh launch account to get the updated base mint
launchAccount = await launchpad.fetchLaunch(LAUNCH_TO_COMPLETE);

const initializePerformancePackageTxHash = await launchpad
.initializePerformancePackageIx({
launch,
baseMint: mintKp,
launch: LAUNCH_TO_COMPLETE,
baseMint: launchAccount.baseMint,
payer: payer.publicKey,
})
.rpc();
Expand Down
40 changes: 40 additions & 0 deletions scripts/v0.7/initializePerformancePackage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import * as anchor from "@coral-xyz/anchor";
import { LaunchpadClient } from "@metadaoproject/futarchy/v0.7";
import { PublicKey } from "@solana/web3.js";

const LAUNCH_TO_COMPLETE: PublicKey | undefined = new PublicKey(
"111111111111111111111111111111111",
);

const provider = anchor.AnchorProvider.env();
const payer = provider.wallet["payer"];

const launchpad: LaunchpadClient = LaunchpadClient.createClient({ provider });

export const completeLaunch = async () => {
if (LAUNCH_TO_COMPLETE === undefined) {
throw new Error(
"LAUNCH_TO_COMPLETE is not set. Please set it in the script.",
);
}

const launchAccount = await launchpad.fetchLaunch(LAUNCH_TO_COMPLETE);

console.log("Setting up performance package...");

const initializePerformancePackageTxHash = await launchpad
.initializePerformancePackageIx({
launch: LAUNCH_TO_COMPLETE,
baseMint: launchAccount.baseMint,
payer: payer.publicKey,
})
.rpc();

console.log(
`Initialize performance package transaction sent: ${initializePerformancePackageTxHash}`,
);

console.log("Performance package set up successfully!");
};

completeLaunch().catch(console.error);
115 changes: 115 additions & 0 deletions scripts/v0.7/launchRNGR.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import * as anchor from "@coral-xyz/anchor";
import {
LaunchpadClient,
getLaunchAddr,
getLaunchSignerAddr,
} from "@metadaoproject/futarchy/v0.7";
import { PublicKey, SystemProgram, Transaction } from "@solana/web3.js";
import BN from "bn.js";
import * as token from "@solana/spl-token";

const provider = anchor.AnchorProvider.env();
const payer = provider.wallet["payer"];

const LAUNCH_AUTHORITY = payer.publicKey;

const TEAM_ADDRESS = new PublicKey(
"CHQXGzhweUQ4wrWCta6koL4iQGZNdWQuJmGHxHpRzjBq",
); // Ranger team address

// Launch details
const MIN_GOAL = 6_000_000; // 6M USDC

const SPENDING_MEMBERS = [
new PublicKey("BXDKN7Bb9s5TPUJksT1HfGgDpYvEGnPwagostU79hAM5"),
new PublicKey("5aaFjteWwEeDPZ69j8BmqsGS1KviqzG4V8CMedCkbkhe"),
];
const SPENDING_LIMIT = 250_000; // 250k USDC

const PERFORMANCE_PACKAGE_GRANTEE = TEAM_ADDRESS;
const PERFORMANCE_PACKAGE_TOKEN_AMOUNT = 7_600_000; // 7.6M RNGR
const PERFORMANCE_PACKAGE_UNLOCK_MONTHS = 18; // 18 months

// Additional carveout details
const ADDITIONAL_CARVEOUT = 5_125_000; // 5.125M RNGR
const ADDITIONAL_CARVEOUT_RECIPIENT = new PublicKey(
"6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf",
); // MetaDAO operational multisig vault

const TOKEN_SEED = "S6Bc84f7fzY6eviV";
const TOKEN_NAME = "Ranger";
const TOKEN_SYMBOL = "RNGR";
const TOKEN_URI =
"https://raw.githubusercontent.com/metaDAOproject/programs/refs/heads/develop/scripts/assets/RNGR/RNGR.json";

const secondsPerDay = 86_400;
const numberOfDays = 4;
const launchDurationSeconds = secondsPerDay * numberOfDays; // 4 days

const launchpad: LaunchpadClient = LaunchpadClient.createClient({ provider });

export const launch = async () => {
const lamports = await provider.connection.getMinimumBalanceForRentExemption(
token.MINT_SIZE,
);

const TOKEN = await PublicKey.createWithSeed(
payer.publicKey,
TOKEN_SEED,
token.TOKEN_PROGRAM_ID,
);
console.log("Token address:", TOKEN.toBase58());

const [launch] = getLaunchAddr(undefined, TOKEN);
const [launchSigner] = getLaunchSignerAddr(undefined, launch);

const tx = new Transaction().add(
SystemProgram.createAccountWithSeed({
fromPubkey: payer.publicKey,
newAccountPubkey: TOKEN,
basePubkey: payer.publicKey,
seed: TOKEN_SEED,
lamports: lamports,
space: token.MINT_SIZE,
programId: token.TOKEN_PROGRAM_ID,
}),
token.createInitializeMint2Instruction(TOKEN, 6, launchSigner, null),
);
tx.recentBlockhash = (
await provider.connection.getLatestBlockhash()
).blockhash;
tx.feePayer = payer.publicKey;
tx.sign(payer);

const txHash = await provider.connection.sendRawTransaction(tx.serialize());
await provider.connection.confirmTransaction(txHash, "confirmed");

const launchIx = await launchpad
.initializeLaunchIx({
tokenName: TOKEN_NAME,
tokenSymbol: TOKEN_SYMBOL,
tokenUri: TOKEN_URI,
minimumRaiseAmount: new BN(MIN_GOAL * 10 ** 6),
baseMint: TOKEN,
monthlySpendingLimitAmount: new BN(SPENDING_LIMIT * 10 ** 6),
monthlySpendingLimitMembers: SPENDING_MEMBERS,
performancePackageGrantee: PERFORMANCE_PACKAGE_GRANTEE,
performancePackageTokenAmount: new BN(
PERFORMANCE_PACKAGE_TOKEN_AMOUNT * 10 ** 6,
),
monthsUntilInsidersCanUnlock: PERFORMANCE_PACKAGE_UNLOCK_MONTHS,
secondsForLaunch: launchDurationSeconds,
teamAddress: TEAM_ADDRESS,
additionalTokensAmount: ADDITIONAL_CARVEOUT
? new BN(ADDITIONAL_CARVEOUT * 10 ** 6)
: undefined,
additionalTokensRecipient: ADDITIONAL_CARVEOUT_RECIPIENT,
launchAuthority: LAUNCH_AUTHORITY,
})
.rpc();

console.log("Launch initialized", launchIx);
// await launchpad.startLaunchIx({ launch }).rpc();
};

launch().catch(console.error);
Loading
Loading