diff --git a/CLAUDE.md b/CLAUDE.md index e8de76b8b..13a1b7caf 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -40,8 +40,10 @@ programs/ # Solana programs (Anchor) ├── mint_governor/ # Delegated minting authority management └── damm_v2_cpi/ # Meteora AMM CPI wrapper -sdk/ # TypeScript client library -├── src/v0.3/ - v0.7/ # Versioned SDKs (backward compatible) +sdk/ # TypeScript client library (@metadaoproject/programs) +├── src// # One module per program (futarchy, launchpad, conditional_vault, ...) +│ ├── v0.X/ # Each program is independently versioned +│ └── index.ts # Re-exports the latest version └── package.json tests/ # TypeScript tests (bankrun + mocha) @@ -180,7 +182,7 @@ Always append new error variants to the **end** of `#[error_code]` enums. Anchor ### Adding New Instructions 1. Add instruction to Rust program in `programs/[program]/src/instructions/` -2. Update client methods in SDK (`sdk/src/v0.7/`) +2. Update client methods in the corresponding SDK module at the program's current version (e.g. `sdk/src/futarchy/v0.6/`, `sdk/src/launchpad/v0.7/`) 3. Add unit tests in `tests/[program]/unit/` ### Testing with Bankrun @@ -249,17 +251,29 @@ When designing instructions that involve Squads CPIs, check whether either patte ## SDK Usage -```typescript -// Import versioned clients -import { FutarchyClient, ConditionalVaultClient } from "@metadaoproject/futarchy/v0.7"; +The SDK is published as `@metadaoproject/programs` and is organized **per program**, with each program independently versioned. There is no single SDK-wide version anymore — futarchy is at v0.6, launchpad is at v0.7, conditional_vault is at v0.4, etc. -// Key utilities in sdk/src/v0.7/ -// - constants.ts: Program IDs, MAINNET_USDC, SQUADS_PROGRAM_ID -// - PDA derivation: getDaoAddr, getProposalAddr, etc. -// - PriceMath.getAmmPrice for price calculations +```typescript +// Top-level imports resolve to the latest version of each program (preferred) +import { + FutarchyClient, + LaunchpadClient, + ConditionalVaultClient, + MAINNET_USDC, +} from "@metadaoproject/programs"; + +// Or import from a specific program module +import { FutarchyClient } from "@metadaoproject/programs/futarchy"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad"; + +// Or pin to a specific version (only when reading historical accounts or +// interacting with an older deployed program) +import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; ``` -**Important:** Always use SDK v0.7 imports (`@metadaoproject/futarchy/v0.7`) for new code. Do not use older SDK versions (v0.3-v0.6). +Each program module exports a `Client` class (constructed via `Client.createClient({ provider })`), PDA helpers, and generated Anchor types. Shared utilities (`constants.ts`, top-level `pda.ts`, `AmmMath`) are exported from the package root. + +**Important:** Always use top-level or per-program imports for new code. Only reach for a versioned subpath (e.g. `@metadaoproject/programs/futarchy/v0.6`) when you specifically need an older program version. See `sdk/README.md` for the full layout. ## Key External Dependencies diff --git a/package.json b/package.json index 20afedfc2..cda3e841c 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "scripts": { "lint:fix": "prettier */*{.js,.ts} \"*/**/*{.js,.ts}\" -w", "lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check", + "typecheck": "tsc --noEmit", "setup-metric-market": "tsx --tsconfig tsconfig.json scripts/setupMetricMarket.ts", "launch-init": "NODE_OPTIONS=\"--no-deprecation\" tsx --tsconfig tsconfig.json scripts/launchInit.ts", "launch-start": "NODE_OPTIONS=\"--no-deprecation\" tsx --tsconfig tsconfig.json scripts/launchStart.ts", @@ -24,7 +25,7 @@ "dependencies": { "@coral-xyz/anchor": "=0.29.0", "@inquirer/prompts": "^7.3.3", - "@metadaoproject/futarchy": "./sdk", + "@metadaoproject/programs": "./sdk", "@metaplex-foundation/mpl-token-metadata": "^3.2.0", "@metaplex-foundation/umi": "^0.9.1", "@metaplex-foundation/umi-bundle-defaults": "^0.9.1", @@ -68,7 +69,7 @@ "ts-mocha": "^10.0.0", "ts-node": "^10.9.2", "tsx": "^4.7.1", - "typescript": "^4.3.5", + "typescript": "5.9.3", "typescript-eslint": "^8.43.0" }, "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e", diff --git a/rebuild.sh b/rebuild.sh index 8fe5fdcbd..953ae8e22 100755 --- a/rebuild.sh +++ b/rebuild.sh @@ -3,8 +3,9 @@ set -e anchor build cd sdk +yarn install yarn build-local cd .. yarn install --force yarn lint:fix -echo "✅ SDK types synced successfully" \ No newline at end of file +echo "✅ rebuild complete" \ No newline at end of file diff --git a/scripts/setupFutarchyAmm.ts b/scripts/setupFutarchyAmm.ts index 0554c455c..eb0138491 100644 --- a/scripts/setupFutarchyAmm.ts +++ b/scripts/setupFutarchyAmm.ts @@ -1,5 +1,7 @@ +// @ts-nocheck +// Legacy script import * as anchor from "@coral-xyz/anchor"; -import { AutocratClient, getDaoAddr } from "@metadaoproject/futarchy/v0.6"; +import { AutocratClient, getDaoAddr } from "@metadaoproject/programs/v0.6"; import { Keypair, PublicKey } from "@solana/web3.js"; import BN from "bn.js"; import * as token from "@solana/spl-token"; diff --git a/scripts/v0.3/crankTwap.ts b/scripts/v0.3/crankTwap.ts index 229dcbefb..eba1ee94d 100644 --- a/scripts/v0.3/crankTwap.ts +++ b/scripts/v0.3/crankTwap.ts @@ -1,5 +1,6 @@ import * as anchor from "@coral-xyz/anchor"; -import { AmmClient, AutocratClient } from "@metadaoproject/futarchy/v0.3"; +import { AmmClient } from "@metadaoproject/programs/amm/v0.3"; +import { AutocratClient } from "@metadaoproject/programs/autocrat/v0.3"; import { PublicKey } from "@solana/web3.js"; const proposal1 = new PublicKey("Dssb1oTTqKjWJTe8QVrStFXxcMZfd7LTSpTRbuHuNdnW"); diff --git a/scripts/v0.3/finalizeProposal.ts b/scripts/v0.3/finalizeProposal.ts index 828d89d8b..c3f22a64b 100644 --- a/scripts/v0.3/finalizeProposal.ts +++ b/scripts/v0.3/finalizeProposal.ts @@ -1,5 +1,5 @@ import * as anchor from "@coral-xyz/anchor"; -import { AutocratClient } from "@metadaoproject/futarchy/v0.3"; +import { AutocratClient } from "@metadaoproject/programs/autocrat/v0.3"; const { PublicKey } = anchor.web3; diff --git a/scripts/v0.3/initializeDao.ts b/scripts/v0.3/initializeDao.ts index d5711ea8c..3c1a94650 100644 --- a/scripts/v0.3/initializeDao.ts +++ b/scripts/v0.3/initializeDao.ts @@ -1,5 +1,5 @@ import * as anchor from "@coral-xyz/anchor"; -import { AutocratClient } from "@metadaoproject/futarchy/v0.3"; +import { AutocratClient } from "@metadaoproject/programs/autocrat/v0.3"; import { DEAN_DEVNET, DEVNET_DARK, diff --git a/scripts/v0.3/initializeProposal.ts b/scripts/v0.3/initializeProposal.ts index c67606205..6358c36c3 100644 --- a/scripts/v0.3/initializeProposal.ts +++ b/scripts/v0.3/initializeProposal.ts @@ -2,7 +2,7 @@ import * as anchor from "@coral-xyz/anchor"; import { MEMO_PROGRAM_ID } from "@solana/spl-memo"; import * as token from "@solana/spl-token"; import { LAMPORTS_PER_SOL } from "@solana/web3.js"; -import { AutocratClient } from "@metadaoproject/futarchy/v0.3"; +import { AutocratClient } from "@metadaoproject/programs/autocrat/v0.3"; const { PublicKey } = anchor.web3; diff --git a/scripts/v0.3/initializeVault.ts b/scripts/v0.3/initializeVault.ts index 8a6ea4ff2..de578e1d4 100644 --- a/scripts/v0.3/initializeVault.ts +++ b/scripts/v0.3/initializeVault.ts @@ -8,7 +8,7 @@ import { getVaultAddr, getVaultFinalizeMintAddr, getVaultRevertMintAddr, -} from "@metadaoproject/futarchy/v0.3"; +} from "@metadaoproject/programs/conditional_vault/v0.3"; const CONDITIONAL_VAULT_PROGRAM_ID = new PublicKey( "4nCk4qKJSJf8pzJadMnr9LubA6Y7Zw3EacsVqH1TwVXH", diff --git a/scripts/v0.3/main.ts b/scripts/v0.3/main.ts index 04436a530..ecc80852f 100644 --- a/scripts/v0.3/main.ts +++ b/scripts/v0.3/main.ts @@ -1,3 +1,5 @@ +// @ts-nocheck +// Legacy script import * as anchor from "@coral-xyz/anchor"; import * as token from "@solana/spl-token"; const { BN, Program } = anchor; diff --git a/scripts/v0.3/uploadMetadata.ts b/scripts/v0.3/uploadMetadata.ts index c96703255..7595de907 100644 --- a/scripts/v0.3/uploadMetadata.ts +++ b/scripts/v0.3/uploadMetadata.ts @@ -1,9 +1,7 @@ import { PublicKey } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; -import { - AutocratClient, - ConditionalVaultClient, -} from "@metadaoproject/futarchy/v0.3"; +import { ConditionalVaultClient } from "@metadaoproject/programs/conditional_vault/v0.3"; +import { AutocratClient } from "@metadaoproject/programs/autocrat/v0.3"; const provider = anchor.AnchorProvider.env(); diff --git a/scripts/v0.4/claimAllLaunch.ts b/scripts/v0.4/claimAllLaunch.ts index 71e93b104..0c34db005 100644 --- a/scripts/v0.4/claimAllLaunch.ts +++ b/scripts/v0.4/claimAllLaunch.ts @@ -5,7 +5,8 @@ import { PublicKey, } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; -import { AutocratClient, LaunchpadClient } from "@metadaoproject/futarchy/v0.4"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.4"; +import { AutocratClient } from "@metadaoproject/programs/autocrat/v0.4"; import { homedir } from "os"; import { join } from "path"; import { input } from "@inquirer/prompts"; diff --git a/scripts/v0.4/finalizeLaunch.ts b/scripts/v0.4/finalizeLaunch.ts index c136683b3..245d9fa6d 100644 --- a/scripts/v0.4/finalizeLaunch.ts +++ b/scripts/v0.4/finalizeLaunch.ts @@ -5,7 +5,7 @@ import { PublicKey, } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; -import { LaunchpadClient } from "@metadaoproject/futarchy/v0.4"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.4"; import { homedir } from "os"; import { join } from "path"; import { input } from "@inquirer/prompts"; diff --git a/scripts/v0.4/initializeDao.ts b/scripts/v0.4/initializeDao.ts index 4b9a91371..b86072286 100644 --- a/scripts/v0.4/initializeDao.ts +++ b/scripts/v0.4/initializeDao.ts @@ -1,6 +1,6 @@ import * as anchor from "@coral-xyz/anchor"; import { Keypair } from "@solana/web3.js"; -import { AutocratClient } from "@metadaoproject/futarchy/v0.4"; +import { AutocratClient } from "@metadaoproject/programs/autocrat/v0.4"; import * as token from "@solana/spl-token"; import { BN } from "bn.js"; diff --git a/scripts/v0.4/initializeLaunch.ts b/scripts/v0.4/initializeLaunch.ts index 439559645..2baf32fb0 100644 --- a/scripts/v0.4/initializeLaunch.ts +++ b/scripts/v0.4/initializeLaunch.ts @@ -5,7 +5,7 @@ import { getLaunchAddr, getLaunchSignerAddr, LaunchpadClient, -} from "@metadaoproject/futarchy/v0.4"; +} from "@metadaoproject/programs/launchpad/v0.4"; import { BN } from "bn.js"; import { homedir } from "os"; import { join } from "path"; diff --git a/scripts/v0.4/initializeMetricMarket.ts b/scripts/v0.4/initializeMetricMarket.ts index 2a6179c7f..aff33bbd3 100644 --- a/scripts/v0.4/initializeMetricMarket.ts +++ b/scripts/v0.4/initializeMetricMarket.ts @@ -2,19 +2,17 @@ import * as token from "@solana/spl-token"; import { PublicKey, Transaction } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; import { - AmmClient, ConditionalVault, ConditionalVaultClient, - getAmmAddr, getDownAndUpMintAddrs, - getEventAuthorityAddr, getFailAndPassMintAddrs, getQuestionAddr, getVaultAddr, - MAINNET_USDC, -} from "@metadaoproject/futarchy/v0.4"; -import { sha256 } from "@metadaoproject/futarchy"; -import { Question, Amm } from "@metadaoproject/futarchy/v0.4"; +} from "@metadaoproject/programs/conditional_vault/v0.4"; +import { sha256 } from "@metadaoproject/programs"; +import { Question } from "@metadaoproject/programs/conditional_vault/v0.4"; +import { Amm, AmmClient, getAmmAddr } from "@metadaoproject/programs/amm/v0.4"; +import { MAINNET_USDC } from "@metadaoproject/programs/"; import { BN } from "bn.js"; import { homedir } from "os"; import { join } from "path"; diff --git a/scripts/v0.4/initializeProposal.ts b/scripts/v0.4/initializeProposal.ts index 546761b02..e0dabff53 100644 --- a/scripts/v0.4/initializeProposal.ts +++ b/scripts/v0.4/initializeProposal.ts @@ -3,10 +3,10 @@ import { PublicKey } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; import { AutocratClient, - AUTOCRAT_PROGRAM_ID, AutocratIDL, - PriceMath, -} from "@metadaoproject/futarchy/v0.4"; +} from "@metadaoproject/programs/autocrat/v0.4"; +import { PriceMath } from "@metadaoproject/programs"; +import { AUTOCRAT_V0_4_PROGRAM_ID } from "@metadaoproject/programs"; async function main() { // Initialize clients @@ -61,7 +61,7 @@ async function main() { const autocrat = new anchor.Program( AutocratIDL, - AUTOCRAT_PROGRAM_ID, + AUTOCRAT_V0_4_PROGRAM_ID, provider, ); diff --git a/scripts/v0.4/startLaunch.ts b/scripts/v0.4/startLaunch.ts index d64f1ae18..5c432a65d 100644 --- a/scripts/v0.4/startLaunch.ts +++ b/scripts/v0.4/startLaunch.ts @@ -1,6 +1,6 @@ import { Keypair, PublicKey, Transaction } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; -import { getLaunchAddr, LaunchpadClient } from "@metadaoproject/futarchy/v0.4"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.4"; import { homedir } from "os"; import { join } from "path"; import fs from "fs"; diff --git a/scripts/v0.4/uploadMetadata.ts b/scripts/v0.4/uploadMetadata.ts index 1f98c9dce..cbe525bd1 100644 --- a/scripts/v0.4/uploadMetadata.ts +++ b/scripts/v0.4/uploadMetadata.ts @@ -1,9 +1,7 @@ import { ComputeBudgetProgram, PublicKey, Transaction } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; -import { - AutocratClient, - ConditionalVaultClient, -} from "@metadaoproject/futarchy/v0.4"; +import { ConditionalVaultClient } from "@metadaoproject/programs/conditional_vault/v0.4"; +import { AutocratClient } from "@metadaoproject/programs/autocrat/v0.4"; const provider = anchor.AnchorProvider.env(); const autocrat: AutocratClient = AutocratClient.createClient({ provider }); diff --git a/scripts/v0.5/assignPermissionlessAccount.ts b/scripts/v0.5/assignPermissionlessAccount.ts index 2e2f68e75..3d1b81144 100644 --- a/scripts/v0.5/assignPermissionlessAccount.ts +++ b/scripts/v0.5/assignPermissionlessAccount.ts @@ -1,9 +1,7 @@ import * as anchor from "@coral-xyz/anchor"; import { SystemProgram, Transaction } from "@solana/web3.js"; -import { - AutocratClient, - PERMISSIONLESS_ACCOUNT, -} from "@metadaoproject/futarchy/v0.5"; +import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/programs"; +import { AutocratClient } from "@metadaoproject/programs/autocrat/v0.5"; async function main() { const provider = anchor.AnchorProvider.env(); diff --git a/scripts/v0.5/claimAllLaunch.ts b/scripts/v0.5/claimAllLaunch.ts index 2b29246f8..76253c06f 100644 --- a/scripts/v0.5/claimAllLaunch.ts +++ b/scripts/v0.5/claimAllLaunch.ts @@ -5,7 +5,8 @@ import { PublicKey, } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; -import { AutocratClient, LaunchpadClient } from "@metadaoproject/futarchy/v0.4"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.4"; +import { AutocratClient } from "@metadaoproject/programs/autocrat/v0.4"; import dotenv from "dotenv"; dotenv.config(); diff --git a/scripts/v0.5/executeProposal.ts b/scripts/v0.5/executeProposal.ts index 580440290..279482691 100644 --- a/scripts/v0.5/executeProposal.ts +++ b/scripts/v0.5/executeProposal.ts @@ -1,12 +1,9 @@ import * as anchor from "@coral-xyz/anchor"; import { - AutocratClient, - getDaoAddr, - DEVNET_USDC, - MAINNET_USDC, - SQUADS_PROGRAM_CONFIG_TREASURY, PERMISSIONLESS_ACCOUNT, -} from "@metadaoproject/futarchy/v0.5"; + DEVNET_SQUADS_PROGRAM_CONFIG_TREASURY, +} from "@metadaoproject/programs"; +import { AutocratClient } from "@metadaoproject/programs/autocrat/v0.5"; import { Keypair, PublicKey, @@ -16,7 +13,6 @@ import { } from "@solana/web3.js"; import BN from "bn.js"; import * as multisig from "@sqds/multisig"; -import { DEVNET_SQUADS_PROGRAM_CONFIG_TREASURY } from "../../sdk/src/v0.5/constants.js"; import * as token from "@solana/spl-token"; const EXISTING_TOKEN = new PublicKey( diff --git a/scripts/v0.5/finalizeLaunch.ts b/scripts/v0.5/finalizeLaunch.ts index 16af3d345..a57989731 100644 --- a/scripts/v0.5/finalizeLaunch.ts +++ b/scripts/v0.5/finalizeLaunch.ts @@ -6,7 +6,7 @@ import { VersionedTransaction, } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; -import { LaunchpadClient } from "@metadaoproject/futarchy/v0.5"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.5"; import dotenv from "dotenv"; import { createLookupTableForTransaction } from "../utils/utils.js"; @@ -53,7 +53,7 @@ async function sendAndConfirmTransaction(tx: Transaction, label: string) { const completeLaunchLut = await createLookupTableForTransaction( tx, payer, - provider, + provider.connection, ); console.log("Complete launch lookup table:", completeLaunchLut); diff --git a/scripts/v0.5/initializeDao.ts b/scripts/v0.5/initializeDao.ts index 126970a32..1a6bba95b 100644 --- a/scripts/v0.5/initializeDao.ts +++ b/scripts/v0.5/initializeDao.ts @@ -1,11 +1,14 @@ import * as anchor from "@coral-xyz/anchor"; import { - AutocratClient, - getDaoAddr, DEVNET_USDC, MAINNET_USDC, SQUADS_PROGRAM_CONFIG_TREASURY, -} from "@metadaoproject/futarchy/v0.5"; + DEVNET_SQUADS_PROGRAM_CONFIG_TREASURY, +} from "@metadaoproject/programs"; +import { + AutocratClient, + getDaoAddr, +} from "@metadaoproject/programs/autocrat/v0.5"; import { Keypair, PublicKey, @@ -15,7 +18,6 @@ import { } from "@solana/web3.js"; import BN from "bn.js"; import * as multisig from "@sqds/multisig"; -import { DEVNET_SQUADS_PROGRAM_CONFIG_TREASURY } from "../../sdk/src/v0.5/constants.js"; import * as token from "@solana/spl-token"; const EXISTING_TOKEN = new PublicKey( diff --git a/scripts/v0.5/initializeLaunch.ts b/scripts/v0.5/initializeLaunch.ts index 5d4671e5e..374ac8afc 100644 --- a/scripts/v0.5/initializeLaunch.ts +++ b/scripts/v0.5/initializeLaunch.ts @@ -4,7 +4,7 @@ import { getLaunchAddr, getLaunchSignerAddr, LaunchpadClient, -} from "@metadaoproject/futarchy/v0.5"; +} from "@metadaoproject/programs/launchpad/v0.5"; import { BN } from "bn.js"; import { USDC } from "../consts.js"; import { diff --git a/scripts/v0.5/initializeProposal.ts b/scripts/v0.5/initializeProposal.ts index 752abf69c..9c9bce875 100644 --- a/scripts/v0.5/initializeProposal.ts +++ b/scripts/v0.5/initializeProposal.ts @@ -1,11 +1,13 @@ +import { ConditionalVaultClient } from "@metadaoproject/programs/conditional_vault/v0.4"; +import { AmmClient } from "@metadaoproject/programs/amm/v0.5"; import { - AmmClient, - AUTOCRAT_PROGRAM_ID, AutocratClient, - ConditionalVaultClient, getProposalAddr, +} from "@metadaoproject/programs/autocrat/v0.5"; +import { + AUTOCRAT_V0_5_PROGRAM_ID, InstructionUtils, -} from "@metadaoproject/futarchy/v0.5"; +} from "@metadaoproject/programs"; import { LAMPORTS_PER_SOL, Message, @@ -134,7 +136,7 @@ async function main() { console.log("minQuoteLiquidity", minQuoteLiquidity.toString()); const [metaDaoProposal] = getProposalAddr( - AUTOCRAT_PROGRAM_ID, + AUTOCRAT_V0_5_PROGRAM_ID, SQUADS_PROPOSAL_PDA, ); diff --git a/scripts/v0.5/migrateMeta.ts b/scripts/v0.5/migrateMeta.ts index 0c25e42dd..086b0cc8f 100644 --- a/scripts/v0.5/migrateMeta.ts +++ b/scripts/v0.5/migrateMeta.ts @@ -17,14 +17,16 @@ import { AuthorityType, } from "@solana/spl-token"; import { - AutocratClient, - getDaoAddr, getMetadataAddr, SQUADS_PROGRAM_CONFIG_TREASURY, MAINNET_USDC, DEVNET_USDC, USDC_DECIMALS, -} from "@metadaoproject/futarchy/v0.5"; +} from "@metadaoproject/programs"; +import { + AutocratClient, + getDaoAddr, +} from "@metadaoproject/programs/autocrat/v0.5"; import { BN } from "bn.js"; import { assert } from "chai"; import * as multisig from "@sqds/multisig"; diff --git a/scripts/v0.5/recoverProposalFunds.ts b/scripts/v0.5/recoverProposalFunds.ts index a9019b566..705662680 100644 --- a/scripts/v0.5/recoverProposalFunds.ts +++ b/scripts/v0.5/recoverProposalFunds.ts @@ -1,10 +1,10 @@ +import { AUTOCRAT_V0_5_PROGRAM_ID } from "@metadaoproject/programs"; import { - AmmClient, - AUTOCRAT_PROGRAM_ID, AutocratClient, - ConditionalVaultClient, getProposalAddr, -} from "@metadaoproject/futarchy/v0.5"; +} from "@metadaoproject/programs/autocrat/v0.5"; +import { AmmClient } from "@metadaoproject/programs/amm/v0.5"; +import { ConditionalVaultClient } from "@metadaoproject/programs/conditional_vault/v0.4"; import { PublicKey } from "@solana/web3.js"; import { BN } from "bn.js"; import * as anchor from "@coral-xyz/anchor"; @@ -26,7 +26,7 @@ async function main() { const dao = await autocratClient.getDao(DAO_KEY); const [metaDaoProposal] = getProposalAddr( - AUTOCRAT_PROGRAM_ID, + AUTOCRAT_V0_5_PROGRAM_ID, SQUADS_PROPOSAL_PDA, ); diff --git a/scripts/v0.5/squads/executeProposal.ts b/scripts/v0.5/squads/executeProposal.ts index 2f3aadc73..8aa768bfb 100644 --- a/scripts/v0.5/squads/executeProposal.ts +++ b/scripts/v0.5/squads/executeProposal.ts @@ -1,7 +1,7 @@ import { PublicKey, Transaction } from "@solana/web3.js"; import * as multisig from "@sqds/multisig"; import * as anchor from "@coral-xyz/anchor"; -import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/futarchy/v0.5"; +import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/programs/"; import { getSquadsPdasFromDao } from "../../utils/squads.js"; const provider = anchor.AnchorProvider.env(); diff --git a/scripts/v0.5/squads/initalizeTransferProposal.ts b/scripts/v0.5/squads/initalizeTransferProposal.ts index f43ca5e8e..f8c7af72d 100644 --- a/scripts/v0.5/squads/initalizeTransferProposal.ts +++ b/scripts/v0.5/squads/initalizeTransferProposal.ts @@ -1,14 +1,14 @@ import { PublicKey, Transaction, TransactionMessage } from "@solana/web3.js"; import * as multisig from "@sqds/multisig"; import * as anchor from "@coral-xyz/anchor"; -import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/futarchy/v0.5"; +import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/programs"; import { createTransferInstruction, getAssociatedTokenAddressSync, createAssociatedTokenAccountIdempotentInstruction, } from "@solana/spl-token"; -import { getSquadsPdasFromDao } from "../utils/squads.js"; -import { USDC } from "../consts.js"; +import { getSquadsPdasFromDao } from "../../utils/squads.js"; +import { USDC } from "../../consts.js"; // we want transfer and config authority removal out the gate diff --git a/scripts/v0.5/squads/removeSpendingLimit.ts b/scripts/v0.5/squads/removeSpendingLimit.ts index a4cac30d9..1f9558d15 100644 --- a/scripts/v0.5/squads/removeSpendingLimit.ts +++ b/scripts/v0.5/squads/removeSpendingLimit.ts @@ -1,8 +1,8 @@ import { PublicKey, Transaction, TransactionMessage } from "@solana/web3.js"; import * as multisig from "@sqds/multisig"; import * as anchor from "@coral-xyz/anchor"; -import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/futarchy/v0.5"; -import { getSquadsPdasFromDao } from "../utils/squads.js"; +import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/programs"; +import { getSquadsPdasFromDao } from "../../utils/squads.js"; const provider = anchor.AnchorProvider.env(); const payer = provider.wallet["payer"]; diff --git a/scripts/v0.5/squads/updateSpendingLimit.ts b/scripts/v0.5/squads/updateSpendingLimit.ts index b92fa1ed3..b5cd59bf8 100644 --- a/scripts/v0.5/squads/updateSpendingLimit.ts +++ b/scripts/v0.5/squads/updateSpendingLimit.ts @@ -2,9 +2,9 @@ import { PublicKey, Transaction, TransactionMessage } from "@solana/web3.js"; import * as multisig from "@sqds/multisig"; import * as anchor from "@coral-xyz/anchor"; import { getAssociatedTokenAddress } from "@solana/spl-token"; -import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/futarchy/v0.5"; -import { getSquadsPdasFromDao } from "../utils/squads.js"; -import { USDC } from "../consts.js"; +import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/programs"; +import { getSquadsPdasFromDao } from "../../utils/squads.js"; +import { USDC } from "../../consts.js"; const provider = anchor.AnchorProvider.env(); const payer = provider.wallet["payer"]; diff --git a/scripts/v0.5/squads/useSpendingLimit.ts b/scripts/v0.5/squads/useSpendingLimit.ts index 3d929e99d..d83579086 100644 --- a/scripts/v0.5/squads/useSpendingLimit.ts +++ b/scripts/v0.5/squads/useSpendingLimit.ts @@ -5,8 +5,8 @@ import { createAssociatedTokenAccountIdempotentInstruction, getAssociatedTokenAddressSync, } from "@solana/spl-token"; -import { USDC } from "../consts.js"; -import { getSquadsPdasFromDao } from "../utils/squads.js"; +import { USDC } from "../../consts.js"; +import { getSquadsPdasFromDao } from "../../utils/squads.js"; const provider = anchor.AnchorProvider.env(); const payer = provider.wallet["payer"]; diff --git a/scripts/v0.5/startLaunch.ts b/scripts/v0.5/startLaunch.ts index afc12e0fe..6deb23e21 100644 --- a/scripts/v0.5/startLaunch.ts +++ b/scripts/v0.5/startLaunch.ts @@ -1,6 +1,6 @@ import { Keypair, PublicKey, Transaction } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; -import { LaunchpadClient } from "@metadaoproject/futarchy/v0.5"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.5"; import dotenv from "dotenv"; diff --git a/scripts/v0.6/burnPerformancePackage.ts b/scripts/v0.6/burnPerformancePackage.ts index aa1168bc5..597970fa5 100644 --- a/scripts/v0.6/burnPerformancePackage.ts +++ b/scripts/v0.6/burnPerformancePackage.ts @@ -1,10 +1,10 @@ import * as anchor from "@coral-xyz/anchor"; import * as multisig from "@sqds/multisig"; +import { PriceBasedPerformancePackageClient } from "@metadaoproject/programs/price_based_performance_package/v0.6"; import { - PRICE_BASED_PERFORMANCE_PACKAGE_PROGRAM_ID, - PriceBasedPerformancePackageClient, METADAO_MULTISIG_VAULT, -} from "@metadaoproject/futarchy/v0.7"; + PRICE_BASED_PERFORMANCE_PACKAGE_PROGRAM_ID, +} from "@metadaoproject/programs"; import { PublicKey, TransactionMessage } from "@solana/web3.js"; // Set the performance package address before running the script diff --git a/scripts/v0.6/claimAllLaunch.ts b/scripts/v0.6/claimAllLaunch.ts index 676814652..4865d04b3 100644 --- a/scripts/v0.6/claimAllLaunch.ts +++ b/scripts/v0.6/claimAllLaunch.ts @@ -5,7 +5,7 @@ import { PublicKey, } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; -import { LaunchpadClient } from "@metadaoproject/futarchy/v0.6"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.6"; import dotenv from "dotenv"; dotenv.config(); diff --git a/scripts/v0.6/collectMeteoraDammFees.ts b/scripts/v0.6/collectMeteoraDammFees.ts index df9128a40..a04755f1a 100644 --- a/scripts/v0.6/collectMeteoraDammFees.ts +++ b/scripts/v0.6/collectMeteoraDammFees.ts @@ -1,11 +1,11 @@ import * as anchor from "@coral-xyz/anchor"; import * as multisig from "@sqds/multisig"; import { - CONDITIONAL_VAULT_PROGRAM_ID, - FUTARCHY_PROGRAM_ID, - FutarchyClient, - MAINNET_METEORA_CONFIG as V0_6_MAINNET_METEORA_CONFIG, -} from "@metadaoproject/futarchy/v0.6"; + CONDITIONAL_VAULT_V0_4_PROGRAM_ID, + FUTARCHY_V0_6_PROGRAM_ID, + LAUNCHPAD_V0_6_MAINNET_METEORA_CONFIG as V0_6_MAINNET_METEORA_CONFIG, +} from "@metadaoproject/programs"; +import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; import { PublicKey } from "@solana/web3.js"; const provider = anchor.AnchorProvider.env(); @@ -15,8 +15,8 @@ const payer = provider.wallet["payer"]; const futarchy: FutarchyClient = new FutarchyClient( provider, - FUTARCHY_PROGRAM_ID, - CONDITIONAL_VAULT_PROGRAM_ID, + FUTARCHY_V0_6_PROGRAM_ID, + CONDITIONAL_VAULT_V0_4_PROGRAM_ID, [], ); diff --git a/scripts/v0.6/createDao.ts b/scripts/v0.6/createDao.ts index b9bfafdeb..d474c69dd 100644 --- a/scripts/v0.6/createDao.ts +++ b/scripts/v0.6/createDao.ts @@ -2,12 +2,14 @@ import * as anchor from "@coral-xyz/anchor"; import { FutarchyClient, getDaoAddr, +} from "@metadaoproject/programs/futarchy/v0.6"; +import { MAINNET_USDC, SQUADS_PROGRAM_CONFIG_TREASURY, DEVNET_SQUADS_PROGRAM_CONFIG_TREASURY, DEVNET_USDC, PriceMath, -} from "@metadaoproject/futarchy/v0.6"; +} from "@metadaoproject/programs"; import { PublicKey } from "@solana/web3.js"; import BN from "bn.js"; import * as token from "@solana/spl-token"; diff --git a/scripts/v0.6/dumpDaos.ts b/scripts/v0.6/dumpDaos.ts index 33bb5d55c..6bc54e479 100644 --- a/scripts/v0.6/dumpDaos.ts +++ b/scripts/v0.6/dumpDaos.ts @@ -1,6 +1,6 @@ import { PublicKey } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; -import { FutarchyClient } from "@metadaoproject/futarchy/v0.6"; +import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; import dotenv from "dotenv"; import * as fs from "fs"; import * as path from "path"; diff --git a/scripts/v0.6/dumpDaosProposals.ts b/scripts/v0.6/dumpDaosProposals.ts index d3ee3995d..a2c5e1b19 100644 --- a/scripts/v0.6/dumpDaosProposals.ts +++ b/scripts/v0.6/dumpDaosProposals.ts @@ -1,11 +1,6 @@ -import { - ComputeBudgetProgram, - Keypair, - Transaction, - PublicKey, -} from "@solana/web3.js"; +import { PublicKey } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; -import { LaunchpadClient, FutarchyClient } from "@metadaoproject/futarchy/v0.6"; +import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; import dotenv from "dotenv"; import * as fs from "fs"; import * as path from "path"; @@ -83,10 +78,10 @@ async function main() { console.log( `Proposal discriminator (base58): ${bs58.encode(proposalDiscriminator)}`, ); - console.log(`Program ID: ${futarchy.autocrat.programId.toBase58()}\n`); + console.log(`Program ID: ${futarchy.futarchy.programId.toBase58()}\n`); const daoAccounts = await provider.connection.getProgramAccounts( - futarchy.autocrat.programId, + futarchy.futarchy.programId, { filters: [ { @@ -105,7 +100,7 @@ async function main() { } const proposalAccounts = await provider.connection.getProgramAccounts( - futarchy.autocrat.programId, + futarchy.futarchy.programId, { filters: [ { diff --git a/scripts/v0.6/executeGeneralProposal.ts b/scripts/v0.6/executeGeneralProposal.ts index 47c128d71..1abd10285 100644 --- a/scripts/v0.6/executeGeneralProposal.ts +++ b/scripts/v0.6/executeGeneralProposal.ts @@ -1,10 +1,8 @@ import { PublicKey, Transaction } from "@solana/web3.js"; import * as multisig from "@sqds/multisig"; import * as anchor from "@coral-xyz/anchor"; -import { - PERMISSIONLESS_ACCOUNT, - FutarchyClient, -} from "@metadaoproject/futarchy/v0.6"; +import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; +import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/programs"; const provider = anchor.AnchorProvider.env(); const payer = provider.wallet["payer"]; diff --git a/scripts/v0.6/executeProposal.ts b/scripts/v0.6/executeProposal.ts index b20599c9f..b46ab5e96 100644 --- a/scripts/v0.6/executeProposal.ts +++ b/scripts/v0.6/executeProposal.ts @@ -1,5 +1,5 @@ import * as anchor from "@coral-xyz/anchor"; -import { FutarchyClient } from "@metadaoproject/futarchy/v0.6"; +import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; import { PublicKey, Transaction } from "@solana/web3.js"; import * as multisig from "@sqds/multisig"; @@ -39,7 +39,7 @@ const executeSpendingLimit = async () => { isSigner: false, })); - const executeIx = await futarchy.autocrat.methods + const executeIx = await futarchy.futarchy.methods .executeSpendingLimitChange() .accounts({ proposal: PROPOSAL, diff --git a/scripts/v0.6/finalizeLaunch.ts b/scripts/v0.6/finalizeLaunch.ts index 5bb4253cd..a28d4cac9 100644 --- a/scripts/v0.6/finalizeLaunch.ts +++ b/scripts/v0.6/finalizeLaunch.ts @@ -1,5 +1,8 @@ import * as anchor from "@coral-xyz/anchor"; -import { LaunchpadClient, getLaunchAddr } from "@metadaoproject/futarchy/v0.6"; +import { + LaunchpadClient, + getLaunchAddr, +} from "@metadaoproject/programs/launchpad/v0.6"; import { PublicKey, TransactionMessage, diff --git a/scripts/v0.6/finalizeProposal.ts b/scripts/v0.6/finalizeProposal.ts index 0719dad15..46f7ffa42 100644 --- a/scripts/v0.6/finalizeProposal.ts +++ b/scripts/v0.6/finalizeProposal.ts @@ -1,5 +1,5 @@ import * as anchor from "@coral-xyz/anchor"; -import { FutarchyClient } from "@metadaoproject/futarchy/v0.6"; +import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; import { PublicKey, Transaction } from "@solana/web3.js"; import { BN } from "@coral-xyz/anchor"; diff --git a/scripts/v0.6/initializeDao.ts b/scripts/v0.6/initializeDao.ts index 682f478bd..715047315 100644 --- a/scripts/v0.6/initializeDao.ts +++ b/scripts/v0.6/initializeDao.ts @@ -2,10 +2,7 @@ import * as anchor from "@coral-xyz/anchor"; import { FutarchyClient, getDaoAddr, - DEVNET_USDC, - MAINNET_USDC, - SQUADS_PROGRAM_CONFIG_TREASURY, -} from "@metadaoproject/futarchy/v0.6"; +} from "@metadaoproject/programs/futarchy/v0.6"; import { Keypair, PublicKey, @@ -15,7 +12,7 @@ import { } from "@solana/web3.js"; import BN from "bn.js"; import * as multisig from "@sqds/multisig"; -import { DEVNET_SQUADS_PROGRAM_CONFIG_TREASURY } from "@metadaoproject/futarchy/v0.6"; +import { DEVNET_SQUADS_PROGRAM_CONFIG_TREASURY } from "@metadaoproject/programs"; import * as token from "@solana/spl-token"; // DAO DETAILS @@ -92,6 +89,8 @@ export const initializeDao = async () => { initialSpendingLimit: null, baseToStake: new BN(0), secondsPerProposal: 60 * 60 * 24 * 3, + teamAddress: PublicKey.default, + teamSponsoredPassThresholdBps: 0, }, }) .rpc(); diff --git a/scripts/v0.6/launch.ts b/scripts/v0.6/launch.ts index 73da2feb8..9feaa7b84 100644 --- a/scripts/v0.6/launch.ts +++ b/scripts/v0.6/launch.ts @@ -3,7 +3,7 @@ import { LaunchpadClient, getLaunchAddr, getLaunchSignerAddr, -} from "@metadaoproject/futarchy/v0.6"; +} from "@metadaoproject/programs/launchpad/v0.6"; import { PublicKey, SystemProgram, Transaction } from "@solana/web3.js"; import BN from "bn.js"; import * as token from "@solana/spl-token"; @@ -78,6 +78,7 @@ export const launch = async () => { performancePackageTokenAmount: new BN(10), monthsUntilInsidersCanUnlock: 18, secondsForLaunch: fourDays, + teamAddress: PublicKey.default, }) .rpc(); diff --git a/scripts/v0.6/launchLoyal.ts b/scripts/v0.6/launchLoyal.ts index 0e12b2cc0..ce3777d4f 100644 --- a/scripts/v0.6/launchLoyal.ts +++ b/scripts/v0.6/launchLoyal.ts @@ -3,7 +3,7 @@ import { LaunchpadClient, getLaunchAddr, getLaunchSignerAddr, -} from "@metadaoproject/futarchy/v0.6"; +} from "@metadaoproject/programs/launchpad/v0.6"; import { PublicKey, SystemProgram, Transaction } from "@solana/web3.js"; import BN from "bn.js"; import * as token from "@solana/spl-token"; @@ -85,6 +85,7 @@ export const launch = async () => { ), monthsUntilInsidersCanUnlock: PERFORMANCE_PACKAGE_UNLOCK_TIME, secondsForLaunch: fourDays, + teamAddress: PublicKey.default, }) .rpc(); diff --git a/scripts/v0.6/launchPaystream.ts b/scripts/v0.6/launchPaystream.ts index 09167cb9c..0c17ea44b 100644 --- a/scripts/v0.6/launchPaystream.ts +++ b/scripts/v0.6/launchPaystream.ts @@ -3,7 +3,7 @@ import { LaunchpadClient, getLaunchAddr, getLaunchSignerAddr, -} from "@metadaoproject/futarchy/v0.6"; +} from "@metadaoproject/programs/launchpad/v0.6"; import { PublicKey, SystemProgram, Transaction } from "@solana/web3.js"; import BN from "bn.js"; import * as token from "@solana/spl-token"; @@ -86,6 +86,7 @@ export const launch = async () => { ), monthsUntilInsidersCanUnlock: PERFORMANCE_PACKAGE_UNLOCK_TIME, secondsForLaunch: fourDays, + teamAddress: PublicKey.default, }) .rpc(); diff --git a/scripts/v0.6/launchSOLO.ts b/scripts/v0.6/launchSOLO.ts index 0ec11ec52..9240d83d6 100644 --- a/scripts/v0.6/launchSOLO.ts +++ b/scripts/v0.6/launchSOLO.ts @@ -3,7 +3,7 @@ import { LaunchpadClient, getLaunchAddr, getLaunchSignerAddr, -} from "@metadaoproject/futarchy/v0.6"; +} from "@metadaoproject/programs/launchpad/v0.6"; import { PublicKey, SystemProgram, Transaction } from "@solana/web3.js"; import BN from "bn.js"; import * as token from "@solana/spl-token"; @@ -85,6 +85,7 @@ export const launch = async () => { ), monthsUntilInsidersCanUnlock: PERFORMANCE_PACKAGE_UNLOCK_TIME, secondsForLaunch: fourDays, + teamAddress: PublicKey.default, }) .rpc(); diff --git a/scripts/v0.6/launchZKLSOL.ts b/scripts/v0.6/launchZKLSOL.ts index 118bfbb12..352bae72a 100644 --- a/scripts/v0.6/launchZKLSOL.ts +++ b/scripts/v0.6/launchZKLSOL.ts @@ -3,7 +3,7 @@ import { LaunchpadClient, getLaunchAddr, getLaunchSignerAddr, -} from "@metadaoproject/futarchy/v0.6"; +} from "@metadaoproject/programs/launchpad/v0.6"; import { PublicKey, SystemProgram, Transaction } from "@solana/web3.js"; import BN from "bn.js"; import * as token from "@solana/spl-token"; @@ -85,6 +85,7 @@ export const launch = async () => { ), monthsUntilInsidersCanUnlock: PERFORMANCE_PACKAGE_UNLOCK_TIME, secondsForLaunch: fourDays, + teamAddress: PublicKey.default, }) .rpc(); diff --git a/scripts/v0.6/migrateDaos.ts b/scripts/v0.6/migrateDaos.ts index 427b3f7a1..ce578031b 100644 --- a/scripts/v0.6/migrateDaos.ts +++ b/scripts/v0.6/migrateDaos.ts @@ -6,7 +6,7 @@ import { TransactionMessage, } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; -import { FutarchyClient } from "@metadaoproject/futarchy/v0.6"; +import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; import dotenv from "dotenv"; import bs58 from "bs58"; diff --git a/scripts/v0.6/provideLiquidity.ts b/scripts/v0.6/provideLiquidity.ts index df2c82247..2e340302a 100644 --- a/scripts/v0.6/provideLiquidity.ts +++ b/scripts/v0.6/provideLiquidity.ts @@ -1,9 +1,6 @@ import * as anchor from "@coral-xyz/anchor"; -import { - FutarchyClient, - MAINNET_USDC, - DEVNET_USDC, -} from "@metadaoproject/futarchy/v0.6"; +import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; +import { MAINNET_USDC, DEVNET_USDC } from "@metadaoproject/programs"; import { PublicKey } from "@solana/web3.js"; import BN from "bn.js"; import * as token from "@solana/spl-token"; diff --git a/scripts/v0.6/returnFunds.ts b/scripts/v0.6/returnFunds.ts index e232e2262..73cf3968d 100644 --- a/scripts/v0.6/returnFunds.ts +++ b/scripts/v0.6/returnFunds.ts @@ -1,14 +1,7 @@ import * as anchor from "@coral-xyz/anchor"; import * as multisig from "@sqds/multisig"; -import { - CONDITIONAL_VAULT_PROGRAM_ID, - FUTARCHY_PROGRAM_ID, - FutarchyClient, - LaunchpadClient, - MAINNET_USDC, - METADAO_MULTISIG_VAULT, - MAINNET_METEORA_CONFIG as V0_6_MAINNET_METEORA_CONFIG, -} from "@metadaoproject/futarchy/v0.6"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.6"; +import { MAINNET_USDC, METADAO_MULTISIG_VAULT } from "@metadaoproject/programs"; import { PublicKey, TransactionMessage } from "@solana/web3.js"; import { getAssociatedTokenAddressSync } from "@solana/spl-token"; import { BN } from "bn.js"; diff --git a/scripts/v0.7/burnPerformancePackage.ts b/scripts/v0.7/burnPerformancePackage.ts index aa1168bc5..f813d991b 100644 --- a/scripts/v0.7/burnPerformancePackage.ts +++ b/scripts/v0.7/burnPerformancePackage.ts @@ -4,7 +4,7 @@ import { PRICE_BASED_PERFORMANCE_PACKAGE_PROGRAM_ID, PriceBasedPerformancePackageClient, METADAO_MULTISIG_VAULT, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { PublicKey, TransactionMessage } from "@solana/web3.js"; // Set the performance package address before running the script diff --git a/scripts/v0.7/claimAllLaunch.ts b/scripts/v0.7/claimAllLaunch.ts index 5e11dba3c..de8d5c30c 100644 --- a/scripts/v0.7/claimAllLaunch.ts +++ b/scripts/v0.7/claimAllLaunch.ts @@ -5,7 +5,7 @@ import { PublicKey, } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; -import { LaunchpadClient } from "@metadaoproject/futarchy/v0.7"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; import dotenv from "dotenv"; dotenv.config(); diff --git a/scripts/v0.7/claimLaunchAdditionalTokens.ts b/scripts/v0.7/claimLaunchAdditionalTokens.ts index e29090f45..e9f3cd87b 100644 --- a/scripts/v0.7/claimLaunchAdditionalTokens.ts +++ b/scripts/v0.7/claimLaunchAdditionalTokens.ts @@ -1,5 +1,5 @@ import * as anchor from "@coral-xyz/anchor"; -import { LaunchpadClient } from "@metadaoproject/futarchy/v0.7"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; import { PublicKey } from "@solana/web3.js"; const provider = anchor.AnchorProvider.env(); diff --git a/scripts/v0.7/closeLaunch.ts b/scripts/v0.7/closeLaunch.ts index 6d985a770..3ed7730a7 100644 --- a/scripts/v0.7/closeLaunch.ts +++ b/scripts/v0.7/closeLaunch.ts @@ -1,5 +1,5 @@ import * as anchor from "@coral-xyz/anchor"; -import { LaunchpadClient, getLaunchAddr } from "@metadaoproject/futarchy/v0.7"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; import { PublicKey } from "@solana/web3.js"; const provider = anchor.AnchorProvider.env(); diff --git a/scripts/v0.7/collectAllFees.ts b/scripts/v0.7/collectAllFees.ts index aba7c880d..82704c1f8 100644 --- a/scripts/v0.7/collectAllFees.ts +++ b/scripts/v0.7/collectAllFees.ts @@ -1,13 +1,13 @@ import * as anchor from "@coral-xyz/anchor"; import * as multisig from "@sqds/multisig"; +import { BidWallClient } from "@metadaoproject/programs/bid_wall/v0.7"; +import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; import { - CONDITIONAL_VAULT_PROGRAM_ID, - FUTARCHY_PROGRAM_ID, - FutarchyClient, - MAINNET_METEORA_CONFIG, - BidWallClient, - BID_WALL_PROGRAM_ID, -} from "@metadaoproject/futarchy/v0.7"; + LAUNCHPAD_V0_7_MAINNET_METEORA_CONFIG, + CONDITIONAL_VAULT_V0_4_PROGRAM_ID, + FUTARCHY_V0_6_PROGRAM_ID, + BID_WALL_V0_7_PROGRAM_ID, +} from "@metadaoproject/programs"; import { PublicKey } from "@solana/web3.js"; import { getAssociatedTokenAddressSync, @@ -28,14 +28,14 @@ const payer = provider.wallet["payer"]; const futarchy: FutarchyClient = new FutarchyClient( provider, - FUTARCHY_PROGRAM_ID, - CONDITIONAL_VAULT_PROGRAM_ID, + FUTARCHY_V0_6_PROGRAM_ID, + CONDITIONAL_VAULT_V0_4_PROGRAM_ID, [], ); const bidWallClient: BidWallClient = BidWallClient.createClient({ provider, - bidWallProgramId: BID_WALL_PROGRAM_ID, + bidWallProgramId: BID_WALL_V0_7_PROGRAM_ID, }); interface FeeCollectionResult { @@ -53,7 +53,7 @@ interface FeeCollectionResult { const collectAllFees = async () => { // Fetch all DAOs console.log("[1] Fetching all DAOs..."); - const allDaos = await futarchy.autocrat.account.dao.all(); + const allDaos = await futarchy.futarchy.account.dao.all(); console.log(`Found ${allDaos.length} DAOs`); // Fetch all bid walls @@ -153,7 +153,7 @@ const collectAllFees = async () => { quoteMint: dao.account.quoteMint, transactionIndex: BigInt(squadsMultisigAccount.transactionIndex.toString()) + 1n, - meteoraConfig: MAINNET_METEORA_CONFIG, + meteoraConfig: LAUNCHPAD_V0_7_MAINNET_METEORA_CONFIG, }) .preInstructions([createBaseAtaIx, createQuoteAtaIx]) .rpc(); diff --git a/scripts/v0.7/collectFees.ts b/scripts/v0.7/collectFees.ts index 723a8b6ac..f185ff0e0 100644 --- a/scripts/v0.7/collectFees.ts +++ b/scripts/v0.7/collectFees.ts @@ -1,13 +1,12 @@ import * as anchor from "@coral-xyz/anchor"; import * as multisig from "@sqds/multisig"; +import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; import { - CONDITIONAL_VAULT_PROGRAM_ID, - FUTARCHY_PROGRAM_ID, - FutarchyClient, - FEE_RECIPIENT, -} from "@metadaoproject/futarchy/v0.7"; + CONDITIONAL_VAULT_V0_4_PROGRAM_ID, + FUTARCHY_V0_6_PROGRAM_ID, + METADAO_MULTISIG_VAULT, +} from "@metadaoproject/programs"; import { PublicKey, TransactionMessage } from "@solana/web3.js"; -import { getAssociatedTokenAddressSync } from "@solana/spl-token"; // Set the DAO address before running the script const dao = new PublicKey(""); @@ -19,8 +18,8 @@ const payer = provider.wallet["payer"]; const futarchy: FutarchyClient = new FutarchyClient( provider, - FUTARCHY_PROGRAM_ID, - CONDITIONAL_VAULT_PROGRAM_ID, + FUTARCHY_V0_6_PROGRAM_ID, + CONDITIONAL_VAULT_V0_4_PROGRAM_ID, [], ); @@ -28,7 +27,7 @@ const futarchy: FutarchyClient = new FutarchyClient( const metadaoSquadsMultisig = new PublicKey( "8N3Tvc6B1wEVKVC6iD4s6eyaCNqX2ovj2xze2q3Q9DWH", ); -const metadaoSquadsMultisigVault = FEE_RECIPIENT; +const metadaoSquadsMultisigVault = METADAO_MULTISIG_VAULT; export const collectFees = async () => { const daoAccount = await futarchy.fetchDao(dao); @@ -41,27 +40,12 @@ export const collectFees = async () => { metadaoSquadsMultisig, ); - // We want to receive the fees in the Metadao DAO's multisig vault - const feeRecipientBaseTokenAccount = getAssociatedTokenAddressSync( - daoAccount.baseMint, - metadaoSquadsMultisigVault, - true, - ); - - const feeRecipientQuoteTokenAccount = getAssociatedTokenAddressSync( - daoAccount.quoteMint, - metadaoSquadsMultisigVault, - true, - ); - // Prepare transaction message const collectFeesIx = await futarchy .collectFeesIx({ dao, baseMint: daoAccount.baseMint, quoteMint: daoAccount.quoteMint, - baseTokenAccount: feeRecipientBaseTokenAccount, - quoteTokenAccount: feeRecipientQuoteTokenAccount, }) .instruction(); diff --git a/scripts/v0.7/collectLpFees.ts b/scripts/v0.7/collectLpFees.ts deleted file mode 100644 index c96210d1e..000000000 --- a/scripts/v0.7/collectLpFees.ts +++ /dev/null @@ -1,110 +0,0 @@ -import * as anchor from "@coral-xyz/anchor"; -import * as multisig from "@sqds/multisig"; -import { - CONDITIONAL_VAULT_PROGRAM_ID, - FUTARCHY_PROGRAM_ID, - FutarchyClient, - FEE_RECIPIENT, -} from "@metadaoproject/futarchy/v0.7"; -import { PublicKey, TransactionMessage } from "@solana/web3.js"; -import { getAssociatedTokenAddressSync } from "@solana/spl-token"; -import { BN } from "@coral-xyz/anchor"; - -// Set the DAO address before running the script -const dao = new PublicKey(""); - -// Set the target K before running the script -const initialBaseReserves = new BN(0); -const initialQuoteReserves = new BN(0); -const targetK = new BN(initialBaseReserves.mul(initialQuoteReserves)); - -const provider = anchor.AnchorProvider.env(); - -// Payer MUST be the non-Squads signer - tSTp6B6kE9o6ZaTmHm2ZwnJBBtgd3x112tapxFhmBEQ -const payer = provider.wallet["payer"]; - -const futarchy: FutarchyClient = new FutarchyClient( - provider, - FUTARCHY_PROGRAM_ID, - CONDITIONAL_VAULT_PROGRAM_ID, - [], -); - -// We need both the multisig and vault addresses for the Metadao DAO -const metadaoSquadsMultisig = new PublicKey( - "8N3Tvc6B1wEVKVC6iD4s6eyaCNqX2ovj2xze2q3Q9DWH", -); -const metadaoSquadsMultisigVault = FEE_RECIPIENT; - -// This should only be run once per DAO/AMM -// It's meant to be a one-off operation that reduces liquidity to a target K (the inital pool's liquidity) and collect it as "fees" -// We're using this because we didn't track LP fee collection in the pool state, nor did we exclude those fees from liquidity -export const collectLpFees = async () => { - if (targetK.isZero()) { - throw new Error( - "Target K is zero. Please set initial base and quote reserves before running the script.", - ); - } - - const daoAccount = await futarchy.fetchDao(dao); - - // We call the collect fees instruction from Metadao DAO's multisig account - // It's the only one that can call the collect fees instruction - const metaDaoSquadsMultisigAccount = - await multisig.accounts.Multisig.fromAccountAddress( - anchor.getProvider().connection, - metadaoSquadsMultisig, - ); - - // We want to receive the fees in the Metadao DAO's multisig vault - const feeRecipientBaseTokenAccount = getAssociatedTokenAddressSync( - daoAccount.baseMint, - metadaoSquadsMultisigVault, - true, - ); - - const feeRecipientQuoteTokenAccount = getAssociatedTokenAddressSync( - daoAccount.quoteMint, - metadaoSquadsMultisigVault, - true, - ); - - // Prepare transaction message - const collectLpFeesIx = await futarchy - .collectLpFeesIx({ - dao, - baseMint: daoAccount.baseMint, - quoteMint: daoAccount.quoteMint, - baseTokenAccount: feeRecipientBaseTokenAccount, - quoteTokenAccount: feeRecipientQuoteTokenAccount, - targetK: targetK, - }) - .instruction(); - - const transactionMessage = new TransactionMessage({ - instructions: [collectLpFeesIx], - payerKey: metadaoSquadsMultisigVault, - recentBlockhash: (await provider.connection.getLatestBlockhash()).blockhash, - }); - - // Create vault transaction - const vaultTxCreateSignature = await multisig.rpc.vaultTransactionCreate({ - connection: anchor.getProvider().connection, - creator: payer.publicKey, - feePayer: payer.publicKey, - ephemeralSigners: 0, - multisigPda: metadaoSquadsMultisig, - transactionIndex: - BigInt(metaDaoSquadsMultisigAccount.transactionIndex.toString()) + 1n, - vaultIndex: 0, - transactionMessage, - }); - - console.log( - "Vault collect fees transaction create signature:", - vaultTxCreateSignature, - ); - console.log("Go ahead and execute the transaction through Squads."); -}; - -collectLpFees().catch(console.error); diff --git a/scripts/v0.7/collectMeteoraDammFees.ts b/scripts/v0.7/collectMeteoraDammFees.ts index ad00aaeea..2049a3bcd 100644 --- a/scripts/v0.7/collectMeteoraDammFees.ts +++ b/scripts/v0.7/collectMeteoraDammFees.ts @@ -1,11 +1,12 @@ import * as anchor from "@coral-xyz/anchor"; import * as multisig from "@sqds/multisig"; import { - CONDITIONAL_VAULT_PROGRAM_ID, - FUTARCHY_PROGRAM_ID, - FutarchyClient, - MAINNET_METEORA_CONFIG as V0_7_MAINNET_METEORA_CONFIG, -} from "@metadaoproject/futarchy/v0.7"; + CONDITIONAL_VAULT_V0_4_PROGRAM_ID, + FUTARCHY_V0_6_PROGRAM_ID, + LAUNCHPAD_V0_7_MAINNET_METEORA_CONFIG, +} from "@metadaoproject/programs"; +import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; + import { PublicKey } from "@solana/web3.js"; const provider = anchor.AnchorProvider.env(); @@ -15,8 +16,8 @@ const payer = provider.wallet["payer"]; const futarchy: FutarchyClient = new FutarchyClient( provider, - FUTARCHY_PROGRAM_ID, - CONDITIONAL_VAULT_PROGRAM_ID, + FUTARCHY_V0_6_PROGRAM_ID, + CONDITIONAL_VAULT_V0_4_PROGRAM_ID, [], ); @@ -39,7 +40,7 @@ export const collectMeteoraDammFees = async () => { quoteMint: daoAccount.quoteMint, transactionIndex: BigInt(squadsMultisigAccount.transactionIndex.toString()) + 1n, - meteoraConfig: V0_7_MAINNET_METEORA_CONFIG, + meteoraConfig: LAUNCHPAD_V0_7_MAINNET_METEORA_CONFIG, }) .signers([payer]) .rpc(); diff --git a/scripts/v0.7/completeLaunch.ts b/scripts/v0.7/completeLaunch.ts index a471513a0..677c4c2d7 100644 --- a/scripts/v0.7/completeLaunch.ts +++ b/scripts/v0.7/completeLaunch.ts @@ -1,5 +1,5 @@ import * as anchor from "@coral-xyz/anchor"; -import { LaunchpadClient, getLaunchAddr } from "@metadaoproject/futarchy/v0.7"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; import { PublicKey, TransactionMessage, diff --git a/scripts/v0.7/dumpDaos.ts b/scripts/v0.7/dumpDaos.ts index 64bebc6a3..44c697b1a 100644 --- a/scripts/v0.7/dumpDaos.ts +++ b/scripts/v0.7/dumpDaos.ts @@ -1,6 +1,6 @@ import { PublicKey } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; -import { FutarchyClient } from "@metadaoproject/futarchy/v0.7"; +import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; import dotenv from "dotenv"; import * as fs from "fs"; import * as path from "path"; diff --git a/scripts/v0.7/dumpLaunches.ts b/scripts/v0.7/dumpLaunches.ts index 4dbac8902..49ccaed04 100644 --- a/scripts/v0.7/dumpLaunches.ts +++ b/scripts/v0.7/dumpLaunches.ts @@ -1,6 +1,6 @@ import { PublicKey } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; -import { LaunchpadClient } from "@metadaoproject/futarchy/v0.7"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; import dotenv from "dotenv"; import * as fs from "fs"; import * as path from "path"; diff --git a/scripts/v0.7/dumpLaunchesAndFundingRecords.ts b/scripts/v0.7/dumpLaunchesAndFundingRecords.ts index 81db03e50..68f7b8675 100644 --- a/scripts/v0.7/dumpLaunchesAndFundingRecords.ts +++ b/scripts/v0.7/dumpLaunchesAndFundingRecords.ts @@ -1,6 +1,6 @@ import { PublicKey } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; -import { LaunchpadClient } from "@metadaoproject/futarchy/v0.7"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; import dotenv from "dotenv"; import * as fs from "fs"; import * as path from "path"; diff --git a/scripts/v0.7/extendLaunch.ts b/scripts/v0.7/extendLaunch.ts index 8d94cfa46..f22e8310f 100644 --- a/scripts/v0.7/extendLaunch.ts +++ b/scripts/v0.7/extendLaunch.ts @@ -1,9 +1,7 @@ import * as anchor from "@coral-xyz/anchor"; import * as multisig from "@sqds/multisig"; -import { - LaunchpadClient, - METADAO_MULTISIG_VAULT, -} from "@metadaoproject/futarchy/v0.7"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; +import { METADAO_MULTISIG_VAULT } from "@metadaoproject/programs"; import { PublicKey, Transaction, TransactionMessage } from "@solana/web3.js"; // Set the launch address before running the script diff --git a/scripts/v0.7/hurupay/setupLaunch.ts b/scripts/v0.7/hurupay/setupLaunch.ts index 730d96dc2..001ea793b 100644 --- a/scripts/v0.7/hurupay/setupLaunch.ts +++ b/scripts/v0.7/hurupay/setupLaunch.ts @@ -3,7 +3,7 @@ import { LaunchpadClient, getLaunchAddr, getLaunchSignerAddr, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs/launchpad/v0.7"; import { ComputeBudgetProgram, PublicKey, @@ -110,6 +110,7 @@ export const launch = async () => { : undefined, additionalTokensRecipient: ADDITIONAL_CARVEOUT_RECIPIENT, launchAuthority: LAUNCH_AUTHORITY, + hasBidWall: false, }) .instruction(); diff --git a/scripts/v0.7/initializePerformancePackage.ts b/scripts/v0.7/initializePerformancePackage.ts index b1faf5a02..74dda58af 100644 --- a/scripts/v0.7/initializePerformancePackage.ts +++ b/scripts/v0.7/initializePerformancePackage.ts @@ -1,5 +1,5 @@ import * as anchor from "@coral-xyz/anchor"; -import { LaunchpadClient } from "@metadaoproject/futarchy/v0.7"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; import { PublicKey } from "@solana/web3.js"; const LAUNCH_TO_COMPLETE: PublicKey | undefined = new PublicKey( diff --git a/scripts/v0.7/launchP2P.ts b/scripts/v0.7/launchP2P.ts index 5713e5021..b93ba510b 100644 --- a/scripts/v0.7/launchP2P.ts +++ b/scripts/v0.7/launchP2P.ts @@ -3,7 +3,7 @@ import { LaunchpadClient, getLaunchAddr, getLaunchSignerAddr, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs/launchpad/v0.7"; import { ComputeBudgetProgram, PublicKey, @@ -107,6 +107,7 @@ export const launch = async () => { : undefined, additionalTokensRecipient: ADDITIONAL_CARVEOUT_RECIPIENT, launchAuthority: LAUNCH_AUTHORITY, + hasBidWall: false, }) .instruction(); diff --git a/scripts/v0.7/launchRNGR.ts b/scripts/v0.7/launchRNGR.ts index 5c0381ee3..129779085 100644 --- a/scripts/v0.7/launchRNGR.ts +++ b/scripts/v0.7/launchRNGR.ts @@ -3,7 +3,7 @@ import { LaunchpadClient, getLaunchAddr, getLaunchSignerAddr, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs/launchpad/v0.7"; import { PublicKey, SystemProgram, Transaction } from "@solana/web3.js"; import BN from "bn.js"; import * as token from "@solana/spl-token"; @@ -105,6 +105,7 @@ export const launch = async () => { : undefined, additionalTokensRecipient: ADDITIONAL_CARVEOUT_RECIPIENT, launchAuthority: LAUNCH_AUTHORITY, + hasBidWall: true, }) .rpc(); diff --git a/scripts/v0.7/launchTemplate.ts b/scripts/v0.7/launchTemplate.ts index e72ca5358..2c2193f0c 100644 --- a/scripts/v0.7/launchTemplate.ts +++ b/scripts/v0.7/launchTemplate.ts @@ -3,7 +3,7 @@ import { LaunchpadClient, getLaunchAddr, getLaunchSignerAddr, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs/launchpad/v0.7"; import { PublicKey, SystemProgram, Transaction } from "@solana/web3.js"; import BN from "bn.js"; import * as token from "@solana/spl-token"; @@ -95,6 +95,7 @@ export const launch = async () => { : undefined, additionalTokensRecipient: ADDITIONAL_CARVEOUT_RECIPIENT, launchAuthority: LAUNCH_AUTHORITY, + hasBidWall: false, }) .instruction(); diff --git a/scripts/v0.7/pointsBased/approveWithPointsWeightedPhase.ts b/scripts/v0.7/pointsBased/approveWithPointsWeightedPhase.ts index 667b806b4..ca0611622 100644 --- a/scripts/v0.7/pointsBased/approveWithPointsWeightedPhase.ts +++ b/scripts/v0.7/pointsBased/approveWithPointsWeightedPhase.ts @@ -8,7 +8,7 @@ import { PublicKey, } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; -import { LaunchpadClient } from "@metadaoproject/futarchy/v0.7"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; import dotenv from "dotenv"; import fs from "fs"; import path from "path"; diff --git a/scripts/v0.7/removeProposal.ts b/scripts/v0.7/removeProposal.ts index 1c48e80d1..7adfd6b35 100644 --- a/scripts/v0.7/removeProposal.ts +++ b/scripts/v0.7/removeProposal.ts @@ -1,9 +1,9 @@ import * as anchor from "@coral-xyz/anchor"; +import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; import { - CONDITIONAL_VAULT_PROGRAM_ID, - FUTARCHY_PROGRAM_ID, - FutarchyClient, -} from "@metadaoproject/futarchy/v0.7"; + FUTARCHY_V0_6_PROGRAM_ID, + CONDITIONAL_VAULT_V0_4_PROGRAM_ID, +} from "@metadaoproject/programs"; import { PublicKey } from "@solana/web3.js"; // Set the proposal address before running the script @@ -16,8 +16,8 @@ const payer = provider.wallet["payer"]; const futarchy: FutarchyClient = new FutarchyClient( provider, - FUTARCHY_PROGRAM_ID, - CONDITIONAL_VAULT_PROGRAM_ID, + FUTARCHY_V0_6_PROGRAM_ID, + CONDITIONAL_VAULT_V0_4_PROGRAM_ID, [], ); @@ -29,7 +29,7 @@ export const removeProposal = async () => { console.log(`DAO: ${proposalAccount.dao.toBase58()}`); console.log(`Current state: ${JSON.stringify(proposalAccount.state)}`); - const tx = await futarchy.autocrat.methods + const tx = await futarchy.futarchy.methods .adminRemoveProposal() .accounts({ proposal, diff --git a/scripts/v0.7/resizeDaos.ts b/scripts/v0.7/resizeDaos.ts index 73f829f5a..d11ceb4f3 100644 --- a/scripts/v0.7/resizeDaos.ts +++ b/scripts/v0.7/resizeDaos.ts @@ -6,7 +6,7 @@ import { TransactionMessage, } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; -import { FutarchyClient } from "@metadaoproject/futarchy/v0.7"; +import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; import dotenv from "dotenv"; import bs58 from "bs58"; diff --git a/scripts/v0.7/resizeLaunches.ts b/scripts/v0.7/resizeLaunches.ts index 9014b7715..38cf0d841 100644 --- a/scripts/v0.7/resizeLaunches.ts +++ b/scripts/v0.7/resizeLaunches.ts @@ -6,7 +6,7 @@ import { TransactionMessage, } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; -import { LaunchpadClient } from "@metadaoproject/futarchy/v0.7"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; import dotenv from "dotenv"; import bs58 from "bs58"; diff --git a/scripts/v0.7/resizeLaunchesAndFundingRecords.ts b/scripts/v0.7/resizeLaunchesAndFundingRecords.ts index 927926703..e6582afc7 100644 --- a/scripts/v0.7/resizeLaunchesAndFundingRecords.ts +++ b/scripts/v0.7/resizeLaunchesAndFundingRecords.ts @@ -6,7 +6,7 @@ import { TransactionMessage, } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; -import { LaunchpadClient } from "@metadaoproject/futarchy/v0.7"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; import dotenv from "dotenv"; import bs58 from "bs58"; diff --git a/scripts/v0.7/startLaunch.ts b/scripts/v0.7/startLaunch.ts index e898dcd8d..9ebf9dd61 100644 --- a/scripts/v0.7/startLaunch.ts +++ b/scripts/v0.7/startLaunch.ts @@ -1,6 +1,6 @@ import { Keypair, PublicKey, Transaction } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; -import { LaunchpadClient } from "@metadaoproject/futarchy/v0.7"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; import dotenv from "dotenv"; diff --git a/sdk/README.md b/sdk/README.md new file mode 100644 index 000000000..231d84760 --- /dev/null +++ b/sdk/README.md @@ -0,0 +1,90 @@ +# @metadaoproject/programs + +TypeScript SDK for the [MetaDAO Futarchy Protocol](https://github.com/metaDAOproject/programs) — a suite of Solana programs for market-driven governance, conditional markets, and token launches. + +## Installation + +```bash +yarn add @metadaoproject/programs +# or +npm install @metadaoproject/programs +# or +bun add @metadaoproject/programs +``` + +## Layout + +The SDK is organized by program. Each program lives in its own module and is internally split into versioned subpaths (`v0.3`, `v0.4`, ...). The top-level module re-exports the **latest** version. + +``` +@metadaoproject/programs +├── amm (re-exports v0.5) +├── autocrat (re-exports v0.5) +├── bid_wall (re-exports v0.7) +├── conditional_vault (re-exports v0.4) +├── futarchy (re-exports v0.6) +├── launchpad (re-exports v0.7, also exposes v0.6 events) +├── liquidation (re-exports v0.7) +├── mint_governor (re-exports v0.7) +├── performance_package_v2 (re-exports v0.7) +├── price_based_performance_package (re-exports v0.6) +└── shared_liquidity_manager (re-exports v0.5) +``` + +Each versioned subpath exports: + +- A `Client` class (e.g. `FutarchyClient`, `LaunchpadClient`, `ConditionalVaultClient`) — the main entry point for building instructions and fetching accounts. +- PDA derivation helpers (`getDaoAddr`, `getProposalAddr`, `getLaunchAddr`, ...). +- Generated Anchor types (accounts, args, IDL). + +The package root also exports shared utilities: program IDs and constants (`MAINNET_USDC`, `SQUADS_PROGRAM_ID`, ...), top-level PDA helpers (`getEventAuthorityAddr`, `getMetadataAddr`), and price math (`AmmMath`). + +## Usage + +### Default (latest version) imports + +```ts +import { + FutarchyClient, + LaunchpadClient, + MAINNET_USDC, +} from "@metadaoproject/programs"; +``` + +### Per-program imports + +```ts +import { FutarchyClient } from "@metadaoproject/programs/futarchy"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad"; +``` + +### Pinning to a specific version + +```ts +import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; +import { ConditionalVaultClient } from "@metadaoproject/programs/conditional_vault/v0.4"; +``` + +### Creating a client + +All clients follow the same construction pattern via a static `createClient` factory and accept an Anchor `AnchorProvider`. Program IDs default to mainnet; pass overrides for devnet or local testing. + +```ts +import { AnchorProvider } from "@coral-xyz/anchor"; +import { FutarchyClient } from "@metadaoproject/programs/futarchy"; + +const provider = AnchorProvider.env(); +const futarchy = FutarchyClient.createClient({ provider }); + +const dao = await futarchy.fetchDao(daoAddress); +``` + +## Versioning + +Programs are versioned independently (e.g. futarchy is at v0.6 while launchpad is at v0.7). Older versions remain available under their versioned subpaths so historical accounts can still be read and integrations can migrate at their own pace. New code should use the default (latest) imports. + +See [the main repo README](https://github.com/metaDAOproject/programs/blob/develop/README.md) for the on-chain program IDs deployed to mainnet. + +## License + +BSL-1.0 \ No newline at end of file diff --git a/sdk/package.json b/sdk/package.json index 337591d80..dfa0ec17a 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -1,41 +1,53 @@ { - "name": "@metadaoproject/futarchy", - "version": "0.7.4-alpha.3", + "name": "@metadaoproject/programs", + "version": "0.1.0-alpha.1", "type": "module", "main": "dist/index.js", "module": "dist/index.js", "types": "dist/index.d.ts", + "exports": { + ".": "./dist/index.js", + "./amm": "./dist/amm/index.js", + "./autocrat": "./dist/autocrat/index.js", + "./bid_wall": "./dist/bid_wall/index.js", + "./conditional_vault": "./dist/conditional_vault/index.js", + "./futarchy": "./dist/futarchy/index.js", + "./launchpad": "./dist/launchpad/index.js", + "./liquidation": "./dist/liquidation/index.js", + "./mint_governor": "./dist/mint_governor/index.js", + "./performance_package_v2": "./dist/performance_package_v2/index.js", + "./price_based_performance_package": "./dist/price_based_performance_package/index.js", + "./shared_liquidity_manager": "./dist/shared_liquidity_manager/index.js", + "./amm/*": "./dist/amm/*/index.js", + "./autocrat/*": "./dist/autocrat/*/index.js", + "./bid_wall/*": "./dist/bid_wall/*/index.js", + "./conditional_vault/*": "./dist/conditional_vault/*/index.js", + "./futarchy/*": "./dist/futarchy/*/index.js", + "./launchpad/*": "./dist/launchpad/*/index.js", + "./liquidation/*": "./dist/liquidation/*/index.js", + "./mint_governor/*": "./dist/mint_governor/*/index.js", + "./performance_package_v2/*": "./dist/performance_package_v2/*/index.js", + "./price_based_performance_package/*": "./dist/price_based_performance_package/*/index.js", + "./shared_liquidity_manager/*": "./dist/shared_liquidity_manager/*/index.js" + }, "license": "BSL-1.0", "files": [ "/dist" ], - "exports": { - ".": "./dist/index.js", - "./v0.3": "./dist/v0.3/index.js", - "./v0.4": "./dist/v0.4/index.js", - "./v0.5": "./dist/v0.5/index.js", - "./v0.6": "./dist/v0.6/index.js", - "./v0.7": "./dist/v0.7/index.js" - }, "scripts": { "lint:fix": "prettier */*.js \"*/**/*{.js,.ts}\" -w", "lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check", "build": "tsc", - "build-local": "rm -rf ./dist && cp ../target/types/* ./src/v0.7/types && yarn tsc", + "build-local": "rm -rf ./dist && ./sync-types.sh && yarn tsc", "prepublishOnly": "yarn lint:fix && yarn build" }, "dependencies": { "@coral-xyz/anchor": "^0.29.0", - "@metaplex-foundation/umi": "^0.9.2", - "@metaplex-foundation/umi-bundle-defaults": "^0.9.2", - "@metaplex-foundation/umi-uploader-bundlr": "^0.9.2", "@noble/hashes": "^1.4.0", "@solana/spl-token": "^0.3.7", "@solana/web3.js": "^1.76.0", "@sqds/multisig": "^2.1.4", - "bn.js": "^5.2.1", - "decimal.js": "^10.4.3", - "esbuild": "^0.17.15" + "bn.js": "^5.2.1" }, "devDependencies": { "@types/bn.js": "^5.1.0", @@ -47,7 +59,7 @@ "solana-bankrun": "^0.2.0", "spl-token-bankrun": "0.2.3", "ts-mocha": "^10.0.0", - "typescript": "^5.5.5" + "typescript": "5.9.3" }, "resolutions": { "error-ex": "=1.3.2", diff --git a/sdk/free-account.json b/sdk/permissionless-account.json similarity index 100% rename from sdk/free-account.json rename to sdk/permissionless-account.json diff --git a/sdk/src/amm/index.ts b/sdk/src/amm/index.ts new file mode 100644 index 000000000..6ef9c15e5 --- /dev/null +++ b/sdk/src/amm/index.ts @@ -0,0 +1 @@ +export * from "./v0.5/index.js"; diff --git a/sdk/src/v0.3/AmmClient.ts b/sdk/src/amm/v0.3/AmmClient.ts similarity index 90% rename from sdk/src/v0.3/AmmClient.ts rename to sdk/src/amm/v0.3/AmmClient.ts index ce8ef147b..1e933ef20 100644 --- a/sdk/src/v0.3/AmmClient.ts +++ b/sdk/src/amm/v0.3/AmmClient.ts @@ -4,16 +4,17 @@ import { AddressLookupTableAccount, Keypair, PublicKey } from "@solana/web3.js"; import { Amm as AmmIDLType, IDL as AmmIDL } from "./types/amm.js"; import BN from "bn.js"; -import { AMM_PROGRAM_ID } from "./constants.js"; -import { AmmAccount, LowercaseKeys } from "./types/index.js"; -import { getAmmLpMintAddr, getAmmAddr } from "./utils/pda.js"; +import { AMM_V0_3_PROGRAM_ID } from "../../constants.js"; +import { Amm } from "./types/index.js"; +import { LowercaseKeys } from "../../utils.js"; +import { getAmmLpMintAddr, getAmmAddr } from "./pda.js"; import { MintLayout, unpackMint, getAssociatedTokenAddressSync, createAssociatedTokenAccountIdempotentInstruction, } from "@solana/spl-token"; -import { AmmMath, PriceMath } from "./utils/ammMath.js"; +import { AmmMath, PriceMath } from "../../priceMath.js"; export type SwapType = LowercaseKeys["SwapType"]>; @@ -44,7 +45,7 @@ export class AmmClient { const luts: AddressLookupTableAccount[] = []; - return new AmmClient(provider, programId || AMM_PROGRAM_ID, luts); + return new AmmClient(provider, programId || AMM_V0_3_PROGRAM_ID, luts); } getProgramId(): PublicKey { @@ -161,9 +162,6 @@ export class AmmClient { ); } - // console.log(quoteAmountCasted?.toString()); - // console.log(baseAmountCasted?.toString()) - return await this.addLiquidityIx( amm, storedAmm.baseMint, @@ -174,10 +172,6 @@ export class AmmClient { ).rpc(); } - // quoteAmount == undefined ? undefined : new BN(quoteAmount); - // let baseAmountCasted: BN | undefined = - // baseAmount == undefined ? undefined : new BN(baseAmount); - let sim = AmmMath.simulateAddLiquidity( storedAmm.baseAmount, storedAmm.quoteAmount, @@ -330,7 +324,6 @@ export class AmmClient { vaultAtaQuote: getAssociatedTokenAddressSync(quoteMint, amm, true), }) .preInstructions([ - // create the receiving token account if it doesn't exist createAssociatedTokenAccountIdempotentInstruction( payer, getAssociatedTokenAddressSync(receivingToken, user), @@ -350,16 +343,7 @@ export class AmmClient { }); } - // getter functions - - // async getLTWAP(ammAddr: PublicKey): Promise { - // const amm = await this.program.account.amm.fetch(ammAddr); - // return amm.twapLastObservationUq64X32 - // .div(new BN(2).pow(new BN(32))) - // .toNumber(); - // } - - async getAmm(amm: PublicKey): Promise { + async getAmm(amm: PublicKey): Promise { return await this.program.account.amm.fetch(amm); } diff --git a/sdk/src/amm/v0.3/index.ts b/sdk/src/amm/v0.3/index.ts new file mode 100644 index 000000000..cf8af7f89 --- /dev/null +++ b/sdk/src/amm/v0.3/index.ts @@ -0,0 +1,3 @@ +export * from "./types/index.js"; +export * from "./pda.js"; +export * from "./AmmClient.js"; diff --git a/sdk/src/amm/v0.3/pda.ts b/sdk/src/amm/v0.3/pda.ts new file mode 100644 index 000000000..6fdba69a8 --- /dev/null +++ b/sdk/src/amm/v0.3/pda.ts @@ -0,0 +1,28 @@ +import { PublicKey } from "@solana/web3.js"; +import { utils } from "@coral-xyz/anchor"; +import { AMM_V0_3_PROGRAM_ID } from "../../constants.js"; + +export const getAmmAddr = ( + programId: PublicKey = AMM_V0_3_PROGRAM_ID, + baseMint: PublicKey, + quoteMint: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [ + utils.bytes.utf8.encode("amm__"), + baseMint.toBuffer(), + quoteMint.toBuffer(), + ], + programId, + ); +}; + +export const getAmmLpMintAddr = ( + programId: PublicKey = AMM_V0_3_PROGRAM_ID, + amm: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [utils.bytes.utf8.encode("amm_lp_mint"), amm.toBuffer()], + programId, + ); +}; diff --git a/sdk/src/v0.3/types/amm.ts b/sdk/src/amm/v0.3/types/amm.ts similarity index 100% rename from sdk/src/v0.3/types/amm.ts rename to sdk/src/amm/v0.3/types/amm.ts diff --git a/sdk/src/amm/v0.3/types/index.ts b/sdk/src/amm/v0.3/types/index.ts new file mode 100644 index 000000000..66251d5f8 --- /dev/null +++ b/sdk/src/amm/v0.3/types/index.ts @@ -0,0 +1,6 @@ +import { Amm as AmmProgram, IDL as AmmIDL } from "./amm.js"; +export { AmmProgram, AmmIDL }; + +import type { IdlAccounts } from "@coral-xyz/anchor"; + +export type Amm = IdlAccounts["amm"]; diff --git a/sdk/src/v0.4/AmmClient.ts b/sdk/src/amm/v0.4/AmmClient.ts similarity index 96% rename from sdk/src/v0.4/AmmClient.ts rename to sdk/src/amm/v0.4/AmmClient.ts index 62b540cbf..9fa792143 100644 --- a/sdk/src/v0.4/AmmClient.ts +++ b/sdk/src/amm/v0.4/AmmClient.ts @@ -9,17 +9,17 @@ import { import { Amm as AmmIDLType, IDL as AmmIDL } from "./types/amm.js"; import BN from "bn.js"; -import { AMM_PROGRAM_ID } from "./constants.js"; -import { Amm, LowercaseKeys } from "./types/index.js"; -import { getAmmLpMintAddr, getAmmAddr } from "./utils/pda.js"; -// import { MethodsBuilder } from "@coral-xyz/anchor/dist/cjs/program/namespace/methods"; +import { AMM_V0_4_PROGRAM_ID } from "../../constants.js"; +import { Amm } from "./types/index.js"; +import { LowercaseKeys } from "../../utils.js"; +import { getAmmLpMintAddr, getAmmAddr } from "./pda.js"; import { MintLayout, unpackMint, getAssociatedTokenAddressSync, createAssociatedTokenAccountIdempotentInstruction, } from "@solana/spl-token"; -import { AmmMath, PriceMath } from "./utils/priceMath.js"; +import { AmmMath, PriceMath } from "../../priceMath.js"; export type SwapType = LowercaseKeys["SwapType"]>; @@ -50,7 +50,7 @@ export class AmmClient { const luts: AddressLookupTableAccount[] = []; - return new AmmClient(provider, programId || AMM_PROGRAM_ID, luts); + return new AmmClient(provider, programId || AMM_V0_4_PROGRAM_ID, luts); } getProgramId(): PublicKey { diff --git a/sdk/src/amm/v0.4/index.ts b/sdk/src/amm/v0.4/index.ts new file mode 100644 index 000000000..cf8af7f89 --- /dev/null +++ b/sdk/src/amm/v0.4/index.ts @@ -0,0 +1,3 @@ +export * from "./types/index.js"; +export * from "./pda.js"; +export * from "./AmmClient.js"; diff --git a/sdk/src/amm/v0.4/pda.ts b/sdk/src/amm/v0.4/pda.ts new file mode 100644 index 000000000..9d6abcd19 --- /dev/null +++ b/sdk/src/amm/v0.4/pda.ts @@ -0,0 +1,28 @@ +import { PublicKey } from "@solana/web3.js"; +import { utils } from "@coral-xyz/anchor"; +import { AMM_V0_4_PROGRAM_ID } from "../../constants.js"; + +export const getAmmAddr = ( + programId: PublicKey = AMM_V0_4_PROGRAM_ID, + baseMint: PublicKey, + quoteMint: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [ + utils.bytes.utf8.encode("amm__"), + baseMint.toBuffer(), + quoteMint.toBuffer(), + ], + programId, + ); +}; + +export const getAmmLpMintAddr = ( + programId: PublicKey = AMM_V0_4_PROGRAM_ID, + amm: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [utils.bytes.utf8.encode("amm_lp_mint"), amm.toBuffer()], + programId, + ); +}; diff --git a/sdk/src/v0.4/types/amm.ts b/sdk/src/amm/v0.4/types/amm.ts similarity index 100% rename from sdk/src/v0.4/types/amm.ts rename to sdk/src/amm/v0.4/types/amm.ts diff --git a/sdk/src/amm/v0.4/types/index.ts b/sdk/src/amm/v0.4/types/index.ts new file mode 100644 index 000000000..5313bb6dd --- /dev/null +++ b/sdk/src/amm/v0.4/types/index.ts @@ -0,0 +1,19 @@ +import { Amm as AmmProgram, IDL as AmmIDL } from "./amm.js"; +export { AmmProgram, AmmIDL }; + +import type { IdlAccounts, IdlEvents } from "@coral-xyz/anchor"; + +export type Amm = IdlAccounts["amm"]; + +export type SwapEvent = IdlEvents["SwapEvent"]; +export type AddLiquidityEvent = IdlEvents["AddLiquidityEvent"]; +export type RemoveLiquidityEvent = + IdlEvents["RemoveLiquidityEvent"]; +export type CreateAmmEvent = IdlEvents["CreateAmmEvent"]; +export type CrankThatTwapEvent = IdlEvents["CrankThatTwapEvent"]; +export type AmmEvent = + | SwapEvent + | AddLiquidityEvent + | RemoveLiquidityEvent + | CreateAmmEvent + | CrankThatTwapEvent; diff --git a/sdk/src/v0.5/AmmClient.ts b/sdk/src/amm/v0.5/AmmClient.ts similarity index 96% rename from sdk/src/v0.5/AmmClient.ts rename to sdk/src/amm/v0.5/AmmClient.ts index 62b540cbf..55217368f 100644 --- a/sdk/src/v0.5/AmmClient.ts +++ b/sdk/src/amm/v0.5/AmmClient.ts @@ -9,17 +9,17 @@ import { import { Amm as AmmIDLType, IDL as AmmIDL } from "./types/amm.js"; import BN from "bn.js"; -import { AMM_PROGRAM_ID } from "./constants.js"; -import { Amm, LowercaseKeys } from "./types/index.js"; -import { getAmmLpMintAddr, getAmmAddr } from "./utils/pda.js"; -// import { MethodsBuilder } from "@coral-xyz/anchor/dist/cjs/program/namespace/methods"; +import { AMM_V0_5_PROGRAM_ID } from "../../constants.js"; +import { Amm } from "./types/index.js"; +import { LowercaseKeys } from "../../utils.js"; +import { getAmmLpMintAddr, getAmmAddr } from "./pda.js"; import { MintLayout, unpackMint, getAssociatedTokenAddressSync, createAssociatedTokenAccountIdempotentInstruction, } from "@solana/spl-token"; -import { AmmMath, PriceMath } from "./utils/priceMath.js"; +import { AmmMath, PriceMath } from "../../priceMath.js"; export type SwapType = LowercaseKeys["SwapType"]>; @@ -50,7 +50,7 @@ export class AmmClient { const luts: AddressLookupTableAccount[] = []; - return new AmmClient(provider, programId || AMM_PROGRAM_ID, luts); + return new AmmClient(provider, programId || AMM_V0_5_PROGRAM_ID, luts); } getProgramId(): PublicKey { diff --git a/sdk/src/amm/v0.5/index.ts b/sdk/src/amm/v0.5/index.ts new file mode 100644 index 000000000..97359d824 --- /dev/null +++ b/sdk/src/amm/v0.5/index.ts @@ -0,0 +1,4 @@ +export * from "./types/index.js"; +export * from "./pda.js"; +export * from "./AmmClient.js"; +export * from "./priceMath.js"; diff --git a/sdk/src/amm/v0.5/pda.ts b/sdk/src/amm/v0.5/pda.ts new file mode 100644 index 000000000..24f861c6b --- /dev/null +++ b/sdk/src/amm/v0.5/pda.ts @@ -0,0 +1,28 @@ +import { PublicKey } from "@solana/web3.js"; +import { utils } from "@coral-xyz/anchor"; +import { AMM_V0_5_PROGRAM_ID } from "../../constants.js"; + +export const getAmmAddr = ( + programId: PublicKey = AMM_V0_5_PROGRAM_ID, + baseMint: PublicKey, + quoteMint: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [ + utils.bytes.utf8.encode("amm__"), + baseMint.toBuffer(), + quoteMint.toBuffer(), + ], + programId, + ); +}; + +export const getAmmLpMintAddr = ( + programId: PublicKey = AMM_V0_5_PROGRAM_ID, + amm: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [utils.bytes.utf8.encode("amm_lp_mint"), amm.toBuffer()], + programId, + ); +}; diff --git a/sdk/src/amm/v0.5/priceMath.ts b/sdk/src/amm/v0.5/priceMath.ts new file mode 100644 index 000000000..4e78b1f0d --- /dev/null +++ b/sdk/src/amm/v0.5/priceMath.ts @@ -0,0 +1,57 @@ +import BN from "bn.js"; +import { PriceMath } from "../../priceMath.js"; +import { SwapType } from "./AmmClient.js"; + +export type SwapSimulation = { + expectedOut: BN; + newBaseReserves: BN; + newQuoteReserves: BN; + minExpectedOut?: BN; +}; + +// Only applies to legacy v0.4/v0.5 AMMs (1% fee, simple x*y=k). +// The v0.6+ on-DAO conditional AMM uses different mechanics. +export function simulateSwap( + inputAmount: BN, + swapType: SwapType, + baseReserves: BN, + quoteReserves: BN, + slippageBps?: BN, +): SwapSimulation { + let inputReserves: BN; + let outputReserves: BN; + if (swapType.buy) { + inputReserves = quoteReserves; + outputReserves = baseReserves; + } else { + inputReserves = baseReserves; + outputReserves = quoteReserves; + } + + const expectedOut = PriceMath.simulateSwapInner( + inputAmount, + inputReserves, + outputReserves, + ); + + const minExpectedOut = slippageBps + ? PriceMath.subtractSlippage(expectedOut, slippageBps) + : undefined; + + let newBaseReserves: BN; + let newQuoteReserves: BN; + if (swapType.buy) { + newBaseReserves = baseReserves.sub(expectedOut); + newQuoteReserves = quoteReserves.add(inputAmount); + } else { + newBaseReserves = baseReserves.add(inputAmount); + newQuoteReserves = quoteReserves.sub(expectedOut); + } + + return { + expectedOut, + newBaseReserves, + newQuoteReserves, + minExpectedOut, + }; +} diff --git a/sdk/src/v0.5/types/amm.ts b/sdk/src/amm/v0.5/types/amm.ts similarity index 100% rename from sdk/src/v0.5/types/amm.ts rename to sdk/src/amm/v0.5/types/amm.ts diff --git a/sdk/src/amm/v0.5/types/index.ts b/sdk/src/amm/v0.5/types/index.ts new file mode 100644 index 000000000..5313bb6dd --- /dev/null +++ b/sdk/src/amm/v0.5/types/index.ts @@ -0,0 +1,19 @@ +import { Amm as AmmProgram, IDL as AmmIDL } from "./amm.js"; +export { AmmProgram, AmmIDL }; + +import type { IdlAccounts, IdlEvents } from "@coral-xyz/anchor"; + +export type Amm = IdlAccounts["amm"]; + +export type SwapEvent = IdlEvents["SwapEvent"]; +export type AddLiquidityEvent = IdlEvents["AddLiquidityEvent"]; +export type RemoveLiquidityEvent = + IdlEvents["RemoveLiquidityEvent"]; +export type CreateAmmEvent = IdlEvents["CreateAmmEvent"]; +export type CrankThatTwapEvent = IdlEvents["CrankThatTwapEvent"]; +export type AmmEvent = + | SwapEvent + | AddLiquidityEvent + | RemoveLiquidityEvent + | CreateAmmEvent + | CrankThatTwapEvent; diff --git a/sdk/src/autocrat/index.ts b/sdk/src/autocrat/index.ts new file mode 100644 index 000000000..6ef9c15e5 --- /dev/null +++ b/sdk/src/autocrat/index.ts @@ -0,0 +1 @@ +export * from "./v0.5/index.js"; diff --git a/sdk/src/v0.3/AutocratClient.ts b/sdk/src/autocrat/v0.3/AutocratClient.ts similarity index 93% rename from sdk/src/v0.3/AutocratClient.ts rename to sdk/src/autocrat/v0.3/AutocratClient.ts index 8f63b1992..ad058f541 100644 --- a/sdk/src/v0.3/AutocratClient.ts +++ b/sdk/src/autocrat/v0.3/AutocratClient.ts @@ -1,47 +1,49 @@ -import { AnchorProvider, IdlTypes, Program } from "@coral-xyz/anchor"; +import { AnchorProvider, Program } from "@coral-xyz/anchor"; import { AccountMeta, AddressLookupTableAccount, ComputeBudgetProgram, - Connection, Keypair, PublicKey, Transaction, TransactionInstruction, } from "@solana/web3.js"; -import { PriceMath } from "./utils/ammMath.js"; -import { ProposalInstruction, InitializeDaoParams } from "./types/index.js"; - -import { Autocrat, IDL as AutocratIDL } from "./types/autocrat.js"; +import { PriceMath } from "../../priceMath.js"; +import { + Autocrat as AutocratIDLType, + IDL as AutocratIDL, +} from "./types/autocrat.js"; +import { + Dao, + InitializeDaoParams, + Proposal, + ProposalInstruction, +} from "./types/index.js"; import BN from "bn.js"; import { - AMM_PROGRAM_ID, - AUTOCRAT_PROGRAM_ID, - CONDITIONAL_VAULT_PROGRAM_ID, + AMM_V0_3_PROGRAM_ID, + AUTOCRAT_V0_3_PROGRAM_ID, + CONDITIONAL_VAULT_V0_3_PROGRAM_ID, MAINNET_USDC, USDC_DECIMALS, -} from "./constants.js"; +} from "../../constants.js"; +import { InstructionUtils } from "../../utils.js"; +import { DEFAULT_CU_PRICE, MaxCUs } from "./cu.js"; +import { getDaoTreasuryAddr, getProposalAddr } from "./pda.js"; +import { getAmmAddr, getAmmLpMintAddr } from "../../amm/v0.3/pda.js"; import { - DEFAULT_CU_PRICE, - InstructionUtils, - MaxCUs, - getAmmAddr, - getAmmLpMintAddr, - getDaoTreasuryAddr, - getProposalAddr, getVaultAddr, getVaultFinalizeMintAddr, getVaultRevertMintAddr, -} from "./utils/index.js"; -import { ConditionalVaultClient } from "./ConditionalVaultClient.js"; -import { AmmClient } from "./AmmClient.js"; +} from "../../conditional_vault/v0.3/pda.js"; +import { ConditionalVaultClient } from "../../conditional_vault/v0.3/index.js"; +import { AmmClient } from "../../amm/v0.3/index.js"; import { createAssociatedTokenAccountIdempotentInstruction, getAssociatedTokenAddressSync, unpackMint, } from "@solana/spl-token"; -import { DaoAccount, Proposal } from "./types/index.js"; export type CreateClientParams = { provider: AnchorProvider; @@ -57,7 +59,7 @@ export type ProposalVaults = { export class AutocratClient { public readonly provider: AnchorProvider; - public readonly autocrat: Program; + public readonly autocrat: Program; public readonly vaultClient: ConditionalVaultClient; public readonly ammClient: AmmClient; public readonly luts: AddressLookupTableAccount[]; @@ -70,7 +72,7 @@ export class AutocratClient { luts: AddressLookupTableAccount[], ) { this.provider = provider; - this.autocrat = new Program( + this.autocrat = new Program( AutocratIDL, autocratProgramId, provider, @@ -97,9 +99,9 @@ export class AutocratClient { return new AutocratClient( provider, - autocratProgramId || AUTOCRAT_PROGRAM_ID, - conditionalVaultProgramId || CONDITIONAL_VAULT_PROGRAM_ID, - ammProgramId || AMM_PROGRAM_ID, + autocratProgramId || AUTOCRAT_V0_3_PROGRAM_ID, + conditionalVaultProgramId || CONDITIONAL_VAULT_V0_3_PROGRAM_ID, + ammProgramId || AMM_V0_3_PROGRAM_ID, luts, ); } @@ -108,7 +110,7 @@ export class AutocratClient { return this.autocrat.account.proposal.fetch(proposal); } - async getDao(dao: PublicKey): Promise { + async getDao(dao: PublicKey): Promise { return this.autocrat.account.dao.fetch(dao); } @@ -130,7 +132,6 @@ export class AutocratClient { failLp: PublicKey; } { let vaultProgramId = this.vaultClient.vaultProgram.programId; - const [daoTreasury] = getDaoTreasuryAddr(this.autocrat.programId, dao); const [baseVault] = getVaultAddr( this.vaultClient.vaultProgram.programId, proposal, @@ -204,10 +205,6 @@ export class AutocratClient { USDC_DECIMALS, ); - // console.log( - // PriceMath.getHumanPrice(scaledPrice, tokenDecimals, USDC_DECIMALS) - // ); - await this.initializeDaoIx( daoKeypair, tokenMint, @@ -602,8 +599,6 @@ export class AutocratClient { usdc: PublicKey, proposer: PublicKey, ) { - let vaultProgramId = this.vaultClient.vaultProgram.programId; - const [daoTreasury] = getDaoTreasuryAddr(this.autocrat.programId, dao); const { baseVault, quoteVault, passAmm, failAmm } = this.getProposalPdas( proposal, @@ -662,7 +657,6 @@ export class AutocratClient { .accounts({ proposal, dao, - // daoTreasury, }) .remainingAccounts( instruction.accounts diff --git a/sdk/src/v0.3/utils/cu.ts b/sdk/src/autocrat/v0.3/cu.ts similarity index 100% rename from sdk/src/v0.3/utils/cu.ts rename to sdk/src/autocrat/v0.3/cu.ts diff --git a/sdk/src/autocrat/v0.3/index.ts b/sdk/src/autocrat/v0.3/index.ts new file mode 100644 index 000000000..aae73865c --- /dev/null +++ b/sdk/src/autocrat/v0.3/index.ts @@ -0,0 +1,4 @@ +export * from "./types/index.js"; +export * from "./pda.js"; +export * from "./cu.js"; +export * from "./AutocratClient.js"; diff --git a/sdk/src/autocrat/v0.3/pda.ts b/sdk/src/autocrat/v0.3/pda.ts new file mode 100644 index 000000000..1b1f01bc7 --- /dev/null +++ b/sdk/src/autocrat/v0.3/pda.ts @@ -0,0 +1,26 @@ +import { PublicKey } from "@solana/web3.js"; +import { utils } from "@coral-xyz/anchor"; +import BN from "bn.js"; +import { AUTOCRAT_V0_3_PROGRAM_ID } from "../../constants.js"; + +export const getDaoTreasuryAddr = ( + programId: PublicKey = AUTOCRAT_V0_3_PROGRAM_ID, + dao: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync([dao.toBuffer()], programId); +}; + +export const getProposalAddr = ( + programId: PublicKey = AUTOCRAT_V0_3_PROGRAM_ID, + proposer: PublicKey, + nonce: BN, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [ + utils.bytes.utf8.encode("proposal"), + proposer.toBuffer(), + nonce.toArrayLike(Buffer, "le", 8), + ], + programId, + ); +}; diff --git a/sdk/src/v0.3/types/autocrat.ts b/sdk/src/autocrat/v0.3/types/autocrat.ts similarity index 100% rename from sdk/src/v0.3/types/autocrat.ts rename to sdk/src/autocrat/v0.3/types/autocrat.ts diff --git a/sdk/src/autocrat/v0.3/types/index.ts b/sdk/src/autocrat/v0.3/types/index.ts new file mode 100644 index 000000000..57d628b56 --- /dev/null +++ b/sdk/src/autocrat/v0.3/types/index.ts @@ -0,0 +1,13 @@ +import { Autocrat as AutocratProgram, IDL as AutocratIDL } from "./autocrat.js"; +export { AutocratProgram, AutocratIDL }; + +import type { IdlAccounts, IdlTypes } from "@coral-xyz/anchor"; + +export type InitializeDaoParams = + IdlTypes["InitializeDaoParams"]; +export type UpdateDaoParams = IdlTypes["UpdateDaoParams"]; +export type ProposalInstruction = + IdlTypes["ProposalInstruction"]; + +export type Dao = IdlAccounts["dao"]; +export type Proposal = IdlAccounts["proposal"]; diff --git a/sdk/src/v0.4/AutocratClient.ts b/sdk/src/autocrat/v0.4/AutocratClient.ts similarity index 96% rename from sdk/src/v0.4/AutocratClient.ts rename to sdk/src/autocrat/v0.4/AutocratClient.ts index 76b2e5298..3ab6384c2 100644 --- a/sdk/src/v0.4/AutocratClient.ts +++ b/sdk/src/autocrat/v0.4/AutocratClient.ts @@ -10,38 +10,30 @@ import { Transaction, TransactionInstruction, } from "@solana/web3.js"; -import { PriceMath } from "./utils/priceMath.js"; +import { PriceMath } from "../../priceMath.js"; import { ProposalInstruction, InitializeDaoParams } from "./types/index.js"; import { Autocrat, IDL as AutocratIDL } from "./types/autocrat.js"; -import { - ConditionalVault, - IDL as ConditionalVaultIDL, -} from "./types/conditional_vault.js"; import BN from "bn.js"; import { - AMM_PROGRAM_ID, - AUTOCRAT_PROGRAM_ID, - CONDITIONAL_VAULT_PROGRAM_ID, + AMM_V0_4_PROGRAM_ID, + AUTOCRAT_V0_4_PROGRAM_ID, + CONDITIONAL_VAULT_V0_4_PROGRAM_ID, MAINNET_USDC, USDC_DECIMALS, -} from "./constants.js"; +} from "../../constants.js"; +import { InstructionUtils } from "../../utils.js"; +import { getAmmAddr, getAmmLpMintAddr } from "../../amm/v0.4/pda.js"; import { - DEFAULT_CU_PRICE, - InstructionUtils, - MaxCUs, - getAmmAddr, - getAmmLpMintAddr, getConditionalTokenMintAddr, - getDaoTreasuryAddr, - getEventAuthorityAddr, - getProposalAddr, getQuestionAddr, getVaultAddr, -} from "./utils/index.js"; -import { ConditionalVaultClient } from "./ConditionalVaultClient.js"; -import { AmmClient } from "./AmmClient.js"; +} from "../../conditional_vault/v0.4/pda.js"; +import { getDaoTreasuryAddr, getProposalAddr } from "./pda.js"; +import { getEventAuthorityAddr } from "../../pda.js"; +import { ConditionalVaultClient } from "../../conditional_vault/v0.4/ConditionalVaultClient.js"; +import { AmmClient } from "../../amm/v0.4/AmmClient.js"; import { createAssociatedTokenAccountIdempotentInstruction, getAssociatedTokenAddressSync, @@ -104,9 +96,9 @@ export class AutocratClient { return new AutocratClient( provider, - autocratProgramId || AUTOCRAT_PROGRAM_ID, - conditionalVaultProgramId || CONDITIONAL_VAULT_PROGRAM_ID, - ammProgramId || AMM_PROGRAM_ID, + autocratProgramId || AUTOCRAT_V0_4_PROGRAM_ID, + conditionalVaultProgramId || CONDITIONAL_VAULT_V0_4_PROGRAM_ID, + ammProgramId || AMM_V0_4_PROGRAM_ID, luts, ); } @@ -279,10 +271,10 @@ export class AutocratClient { ) .postInstructions([ ComputeBudgetProgram.setComputeUnitLimit({ - units: MaxCUs.initializeDao, + units: 40_000, }), ComputeBudgetProgram.setComputeUnitPrice({ - microLamports: DEFAULT_CU_PRICE, + microLamports: 1, }), ]) .rpc({ maxRetries: 5 }); diff --git a/sdk/src/autocrat/v0.4/index.ts b/sdk/src/autocrat/v0.4/index.ts new file mode 100644 index 000000000..6e8fd3617 --- /dev/null +++ b/sdk/src/autocrat/v0.4/index.ts @@ -0,0 +1,3 @@ +export * from "./types/index.js"; +export * from "./pda.js"; +export * from "./AutocratClient.js"; diff --git a/sdk/src/autocrat/v0.4/pda.ts b/sdk/src/autocrat/v0.4/pda.ts new file mode 100644 index 000000000..07e8ed636 --- /dev/null +++ b/sdk/src/autocrat/v0.4/pda.ts @@ -0,0 +1,26 @@ +import { PublicKey } from "@solana/web3.js"; +import { utils } from "@coral-xyz/anchor"; +import BN from "bn.js"; +import { AUTOCRAT_V0_4_PROGRAM_ID } from "../../constants.js"; + +export const getDaoTreasuryAddr = ( + programId: PublicKey = AUTOCRAT_V0_4_PROGRAM_ID, + dao: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync([dao.toBuffer()], programId); +}; + +export const getProposalAddr = ( + programId: PublicKey = AUTOCRAT_V0_4_PROGRAM_ID, + proposer: PublicKey, + nonce: BN, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [ + utils.bytes.utf8.encode("proposal"), + proposer.toBuffer(), + nonce.toArrayLike(Buffer, "le", 8), + ], + programId, + ); +}; diff --git a/sdk/src/v0.4/types/autocrat.ts b/sdk/src/autocrat/v0.4/types/autocrat.ts similarity index 100% rename from sdk/src/v0.4/types/autocrat.ts rename to sdk/src/autocrat/v0.4/types/autocrat.ts diff --git a/sdk/src/autocrat/v0.4/types/index.ts b/sdk/src/autocrat/v0.4/types/index.ts new file mode 100644 index 000000000..8cc574a57 --- /dev/null +++ b/sdk/src/autocrat/v0.4/types/index.ts @@ -0,0 +1,29 @@ +import { Autocrat as AutocratProgram, IDL as AutocratIDL } from "./autocrat.js"; +export { AutocratProgram, AutocratIDL }; + +import type { IdlAccounts, IdlTypes, IdlEvents } from "@coral-xyz/anchor"; + +export type InitializeDaoParams = + IdlTypes["InitializeDaoParams"]; +export type UpdateDaoParams = IdlTypes["UpdateDaoParams"]; +export type ProposalInstruction = + IdlTypes["ProposalInstruction"]; + +export type Dao = IdlAccounts["dao"]; +export type Proposal = IdlAccounts["proposal"]; + +export type InitializeDaoEvent = + IdlEvents["InitializeDaoEvent"]; +export type UpdateDaoEvent = IdlEvents["UpdateDaoEvent"]; +export type InitializeProposalEvent = + IdlEvents["InitializeProposalEvent"]; +export type FinalizeProposalEvent = + IdlEvents["FinalizeProposalEvent"]; +export type ExecuteProposalEvent = + IdlEvents["ExecuteProposalEvent"]; +export type AutocratEvent = + | InitializeDaoEvent + | UpdateDaoEvent + | InitializeProposalEvent + | FinalizeProposalEvent + | ExecuteProposalEvent; diff --git a/sdk/src/v0.5/AutocratClient.ts b/sdk/src/autocrat/v0.5/AutocratClient.ts similarity index 95% rename from sdk/src/v0.5/AutocratClient.ts rename to sdk/src/autocrat/v0.5/AutocratClient.ts index f05795e1f..bcc93140d 100644 --- a/sdk/src/v0.5/AutocratClient.ts +++ b/sdk/src/autocrat/v0.5/AutocratClient.ts @@ -13,38 +13,29 @@ import { import { InitializeDaoParams, UpdateDaoParams } from "./types/index.js"; import { Autocrat, IDL as AutocratIDL } from "./types/autocrat.js"; -import { - ConditionalVault, - IDL as ConditionalVaultIDL, -} from "./types/conditional_vault.js"; import BN from "bn.js"; import { - AMM_PROGRAM_ID, - AUTOCRAT_PROGRAM_ID, - CONDITIONAL_VAULT_PROGRAM_ID, + AMM_V0_5_PROGRAM_ID, + AUTOCRAT_V0_5_PROGRAM_ID, + CONDITIONAL_VAULT_V0_4_PROGRAM_ID, MAINNET_USDC, SQUADS_PROGRAM_CONFIG, SQUADS_PROGRAM_CONFIG_TREASURY, SQUADS_PROGRAM_ID, USDC_DECIMALS, -} from "./constants.js"; +} from "../../constants.js"; +import { InstructionUtils } from "../../utils.js"; +import { getAmmAddr, getAmmLpMintAddr } from "../../amm/v0.5/pda.js"; import { - DEFAULT_CU_PRICE, - InstructionUtils, - MaxCUs, - getAmmAddr, - getAmmLpMintAddr, getConditionalTokenMintAddr, - getDaoAddr, - getDaoTreasuryAddr, - getEventAuthorityAddr, - getProposalAddr, getQuestionAddr, getVaultAddr, -} from "./utils/index.js"; -import { ConditionalVaultClient } from "./ConditionalVaultClient.js"; -import { AmmClient } from "./AmmClient.js"; +} from "../../conditional_vault/v0.4/pda.js"; +import { getDaoAddr, getDaoTreasuryAddr, getProposalAddr } from "./pda.js"; +import { getEventAuthorityAddr } from "../../pda.js"; +import { ConditionalVaultClient } from "../../conditional_vault/v0.4/ConditionalVaultClient.js"; +import { AmmClient } from "../../amm/v0.5/AmmClient.js"; import { createAssociatedTokenAccountIdempotentInstruction, getAssociatedTokenAddressSync, @@ -109,9 +100,9 @@ export class AutocratClient { return new AutocratClient( provider, - autocratProgramId || AUTOCRAT_PROGRAM_ID, - conditionalVaultProgramId || CONDITIONAL_VAULT_PROGRAM_ID, - ammProgramId || AMM_PROGRAM_ID, + autocratProgramId || AUTOCRAT_V0_5_PROGRAM_ID, + conditionalVaultProgramId || CONDITIONAL_VAULT_V0_4_PROGRAM_ID, + ammProgramId || AMM_V0_5_PROGRAM_ID, luts, ); } diff --git a/sdk/src/autocrat/v0.5/index.ts b/sdk/src/autocrat/v0.5/index.ts new file mode 100644 index 000000000..6e8fd3617 --- /dev/null +++ b/sdk/src/autocrat/v0.5/index.ts @@ -0,0 +1,3 @@ +export * from "./types/index.js"; +export * from "./pda.js"; +export * from "./AutocratClient.js"; diff --git a/sdk/src/autocrat/v0.5/pda.ts b/sdk/src/autocrat/v0.5/pda.ts new file mode 100644 index 000000000..3ad8c896f --- /dev/null +++ b/sdk/src/autocrat/v0.5/pda.ts @@ -0,0 +1,40 @@ +import { PublicKey } from "@solana/web3.js"; +import { utils } from "@coral-xyz/anchor"; +import BN from "bn.js"; +import { AUTOCRAT_V0_5_PROGRAM_ID } from "../../constants.js"; + +export const getDaoAddr = ({ + nonce, + daoCreator, + programId = AUTOCRAT_V0_5_PROGRAM_ID, +}: { + nonce: BN; + daoCreator: PublicKey; + programId?: PublicKey; +}): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [ + Buffer.from("dao"), + daoCreator.toBuffer(), + nonce.toArrayLike(Buffer, "le", 8), + ], + programId, + ); +}; + +export const getDaoTreasuryAddr = ( + programId: PublicKey = AUTOCRAT_V0_5_PROGRAM_ID, + dao: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync([dao.toBuffer()], programId); +}; + +export const getProposalAddr = ( + programId: PublicKey = AUTOCRAT_V0_5_PROGRAM_ID, + squadsProposal: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [utils.bytes.utf8.encode("proposal"), squadsProposal.toBuffer()], + programId, + ); +}; diff --git a/sdk/src/v0.5/types/autocrat.ts b/sdk/src/autocrat/v0.5/types/autocrat.ts similarity index 100% rename from sdk/src/v0.5/types/autocrat.ts rename to sdk/src/autocrat/v0.5/types/autocrat.ts diff --git a/sdk/src/autocrat/v0.5/types/index.ts b/sdk/src/autocrat/v0.5/types/index.ts new file mode 100644 index 000000000..68306d748 --- /dev/null +++ b/sdk/src/autocrat/v0.5/types/index.ts @@ -0,0 +1,27 @@ +import { Autocrat as AutocratProgram, IDL as AutocratIDL } from "./autocrat.js"; +export { AutocratProgram, AutocratIDL }; + +import type { IdlAccounts, IdlTypes, IdlEvents } from "@coral-xyz/anchor"; + +export type InitializeDaoParams = + IdlTypes["InitializeDaoParams"]; +export type UpdateDaoParams = IdlTypes["UpdateDaoParams"]; + +export type Dao = IdlAccounts["dao"]; +export type Proposal = IdlAccounts["proposal"]; + +export type InitializeDaoEvent = + IdlEvents["InitializeDaoEvent"]; +export type UpdateDaoEvent = IdlEvents["UpdateDaoEvent"]; +export type InitializeProposalEvent = + IdlEvents["InitializeProposalEvent"]; +export type FinalizeProposalEvent = + IdlEvents["FinalizeProposalEvent"]; +export type ExecuteProposalEvent = + IdlEvents["ExecuteProposalEvent"]; +export type AutocratEvent = + | InitializeDaoEvent + | UpdateDaoEvent + | InitializeProposalEvent + | FinalizeProposalEvent + | ExecuteProposalEvent; diff --git a/sdk/src/bid_wall/index.ts b/sdk/src/bid_wall/index.ts new file mode 100644 index 000000000..6b187d27b --- /dev/null +++ b/sdk/src/bid_wall/index.ts @@ -0,0 +1 @@ +export * from "./v0.7/index.js"; diff --git a/sdk/src/v0.7/BidWallClient.ts b/sdk/src/bid_wall/v0.7/BidWallClient.ts similarity index 95% rename from sdk/src/v0.7/BidWallClient.ts rename to sdk/src/bid_wall/v0.7/BidWallClient.ts index 7652baf70..da56f78ee 100644 --- a/sdk/src/v0.7/BidWallClient.ts +++ b/sdk/src/bid_wall/v0.7/BidWallClient.ts @@ -2,17 +2,18 @@ import { AnchorProvider, Program } from "@coral-xyz/anchor"; import { AccountInfo, PublicKey, SystemProgram } from "@solana/web3.js"; import { MAINNET_USDC, - BID_WALL_PROGRAM_ID, + BID_WALL_V0_7_PROGRAM_ID, METADAO_MULTISIG_VAULT, -} from "../v0.7/constants.js"; -import { BidWallProgram, BidWallIDL, BidWall } from "../v0.7/types/index.js"; +} from "../../constants.js"; +import { BidWallProgram, BidWallIDL, BidWall } from "./types/index.js"; import BN from "bn.js"; import { ASSOCIATED_TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID, } from "@solana/spl-token"; -import { getBidWallAddr, getEventAuthorityAddr } from "../v0.7/utils/pda.js"; +import { getBidWallAddr } from "./pda.js"; +import { getEventAuthorityAddr } from "../../pda.js"; export type CreateBidWallClientParams = { provider: AnchorProvider; @@ -39,7 +40,10 @@ export class BidWallClient { ): BidWallClient { let { provider, bidWallProgramId } = createBidWallClientParams; - return new BidWallClient(provider, bidWallProgramId || BID_WALL_PROGRAM_ID); + return new BidWallClient( + provider, + bidWallProgramId || BID_WALL_V0_7_PROGRAM_ID, + ); } async fetchBidWall(bidWall: PublicKey): Promise { diff --git a/sdk/src/bid_wall/v0.7/index.ts b/sdk/src/bid_wall/v0.7/index.ts new file mode 100644 index 000000000..c0cf6aaff --- /dev/null +++ b/sdk/src/bid_wall/v0.7/index.ts @@ -0,0 +1,3 @@ +export * from "./types/index.js"; +export * from "./pda.js"; +export * from "./BidWallClient.js"; diff --git a/sdk/src/bid_wall/v0.7/pda.ts b/sdk/src/bid_wall/v0.7/pda.ts new file mode 100644 index 000000000..a599a3d90 --- /dev/null +++ b/sdk/src/bid_wall/v0.7/pda.ts @@ -0,0 +1,25 @@ +import { BN } from "@coral-xyz/anchor"; +import { PublicKey } from "@solana/web3.js"; +import { BID_WALL_V0_7_PROGRAM_ID } from "../../constants.js"; + +export const getBidWallAddr = ({ + programId = BID_WALL_V0_7_PROGRAM_ID, + baseMint, + creator, + nonce, +}: { + programId?: PublicKey; + baseMint: PublicKey; + creator: PublicKey; + nonce: BN; +}) => { + return PublicKey.findProgramAddressSync( + [ + Buffer.from("bid_wall"), + baseMint.toBuffer(), + creator.toBuffer(), + nonce.toArrayLike(Buffer, "le", 8), + ], + programId, + ); +}; diff --git a/sdk/src/v0.7/types/bid_wall.ts b/sdk/src/bid_wall/v0.7/types/bid_wall.ts similarity index 100% rename from sdk/src/v0.7/types/bid_wall.ts rename to sdk/src/bid_wall/v0.7/types/bid_wall.ts diff --git a/sdk/src/bid_wall/v0.7/types/index.ts b/sdk/src/bid_wall/v0.7/types/index.ts new file mode 100644 index 000000000..4403d9092 --- /dev/null +++ b/sdk/src/bid_wall/v0.7/types/index.ts @@ -0,0 +1,24 @@ +import { IdlAccounts, IdlEvents } from "@coral-xyz/anchor"; + +import { BidWall as BidWallProgram, IDL as BidWallIDL } from "./bid_wall.js"; + +export { BidWallProgram, BidWallIDL }; + +export type BidWall = IdlAccounts["bidWall"]; + +export type BidWallInitializedEvent = + IdlEvents["BidWallInitializedEvent"]; +export type BidWallTokensSoldEvent = + IdlEvents["BidWallTokensSoldEvent"]; +export type BidWallFeesCollectedEvent = + IdlEvents["BidWallFeesCollectedEvent"]; +export type BidWallClosedEvent = + IdlEvents["BidWallClosedEvent"]; +export type BidWallCanceledEvent = + IdlEvents["BidWallCanceledEvent"]; +export type BidWallEvent = + | BidWallInitializedEvent + | BidWallTokensSoldEvent + | BidWallFeesCollectedEvent + | BidWallClosedEvent + | BidWallCanceledEvent; diff --git a/sdk/src/conditional_vault/index.ts b/sdk/src/conditional_vault/index.ts new file mode 100644 index 000000000..e5bb29172 --- /dev/null +++ b/sdk/src/conditional_vault/index.ts @@ -0,0 +1 @@ +export * from "./v0.4/index.js"; diff --git a/sdk/src/v0.3/ConditionalVaultClient.ts b/sdk/src/conditional_vault/v0.3/ConditionalVaultClient.ts similarity index 92% rename from sdk/src/v0.3/ConditionalVaultClient.ts rename to sdk/src/conditional_vault/v0.3/ConditionalVaultClient.ts index ca27bef91..c87043c75 100644 --- a/sdk/src/v0.3/ConditionalVaultClient.ts +++ b/sdk/src/conditional_vault/v0.3/ConditionalVaultClient.ts @@ -2,24 +2,23 @@ import { AnchorProvider, Program } from "@coral-xyz/anchor"; import { AddressLookupTableAccount, Keypair, PublicKey } from "@solana/web3.js"; import { - ConditionalVault, + ConditionalVault as ConditionalVaultIDLType, IDL as ConditionalVaultIDL, } from "./types/conditional_vault.js"; import BN from "bn.js"; import { - CONDITIONAL_VAULT_PROGRAM_ID, + CONDITIONAL_VAULT_V0_3_PROGRAM_ID, MPL_TOKEN_METADATA_PROGRAM_ID, -} from "./constants.js"; +} from "../../constants.js"; +import { getMetadataAddr } from "../../pda.js"; import { - getMetadataAddr, getVaultAddr, getVaultFinalizeMintAddr, getVaultRevertMintAddr, -} from "./utils/index.js"; +} from "./pda.js"; import { createAssociatedTokenAccountIdempotentInstruction, - createAssociatedTokenAccountInstruction, getAssociatedTokenAddressSync, } from "@solana/spl-token"; @@ -30,7 +29,7 @@ export type CreateVaultClientParams = { export class ConditionalVaultClient { public readonly provider: AnchorProvider; - public readonly vaultProgram: Program; + public readonly vaultProgram: Program; public readonly luts: AddressLookupTableAccount[]; constructor( @@ -39,7 +38,7 @@ export class ConditionalVaultClient { luts: AddressLookupTableAccount[], ) { this.provider = provider; - this.vaultProgram = new Program( + this.vaultProgram = new Program( ConditionalVaultIDL, conditionalVaultProgramId, provider, @@ -56,7 +55,7 @@ export class ConditionalVaultClient { return new ConditionalVaultClient( provider, - conditionalVaultProgramId || CONDITIONAL_VAULT_PROGRAM_ID, + conditionalVaultProgramId || CONDITIONAL_VAULT_V0_3_PROGRAM_ID, luts, ); } @@ -72,18 +71,12 @@ export class ConditionalVaultClient { ) { const storedVault = await this.getVault(vault); - return ( - this.mintConditionalTokensIx( - vault, - storedVault.underlyingTokenMint, - new BN(uiAmount).mul(new BN(10).pow(new BN(storedVault.decimals))), - user, - ) - // .preInstructions([ - // createAssociatedTokenAccountIdempotentInstruction(this.provider.publicKey, ) - // ]) - .rpc() - ); + return this.mintConditionalTokensIx( + vault, + storedVault.underlyingTokenMint, + new BN(uiAmount).mul(new BN(10).pow(new BN(storedVault.decimals))), + user, + ).rpc(); } mintConditionalTokensIx( diff --git a/sdk/src/conditional_vault/v0.3/index.ts b/sdk/src/conditional_vault/v0.3/index.ts new file mode 100644 index 000000000..1aa6810cf --- /dev/null +++ b/sdk/src/conditional_vault/v0.3/index.ts @@ -0,0 +1,8 @@ +// Note: v0.3's vault PDA is derived from a (settlementAuthority, mint) pair and +// has binary pass/fail mints (`getVaultFinalizeMintAddr`/`getVaultRevertMintAddr`). +// v0.4+ replaced this with a multi-outcome `Question` model where the vault is +// derived from (question, mint) and conditional tokens are addressed by index. +// The two are not interchangeable. +export * from "./types/index.js"; +export * from "./pda.js"; +export * from "./ConditionalVaultClient.js"; diff --git a/sdk/src/conditional_vault/v0.3/pda.ts b/sdk/src/conditional_vault/v0.3/pda.ts new file mode 100644 index 000000000..e93bec9af --- /dev/null +++ b/sdk/src/conditional_vault/v0.3/pda.ts @@ -0,0 +1,43 @@ +import { PublicKey } from "@solana/web3.js"; +import { utils } from "@coral-xyz/anchor"; +import { CONDITIONAL_VAULT_V0_3_PROGRAM_ID } from "../../constants.js"; + +export const getVaultAddr = ( + programId: PublicKey = CONDITIONAL_VAULT_V0_3_PROGRAM_ID, + settlementAuthority: PublicKey, + underlyingTokenMint: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [ + utils.bytes.utf8.encode("conditional_vault"), + settlementAuthority.toBuffer(), + underlyingTokenMint.toBuffer(), + ], + programId, + ); +}; + +export const getVaultFinalizeMintAddr = ( + programId: PublicKey = CONDITIONAL_VAULT_V0_3_PROGRAM_ID, + vault: PublicKey, +): [PublicKey, number] => { + return getVaultMintAddr(programId, vault, "conditional_on_finalize_mint"); +}; + +export const getVaultRevertMintAddr = ( + programId: PublicKey = CONDITIONAL_VAULT_V0_3_PROGRAM_ID, + vault: PublicKey, +): [PublicKey, number] => { + return getVaultMintAddr(programId, vault, "conditional_on_revert_mint"); +}; + +const getVaultMintAddr = ( + programId: PublicKey, + vault: PublicKey, + seed: string, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [utils.bytes.utf8.encode(seed), vault.toBuffer()], + programId, + ); +}; diff --git a/sdk/src/v0.3/types/conditional_vault.ts b/sdk/src/conditional_vault/v0.3/types/conditional_vault.ts similarity index 100% rename from sdk/src/v0.3/types/conditional_vault.ts rename to sdk/src/conditional_vault/v0.3/types/conditional_vault.ts diff --git a/sdk/src/conditional_vault/v0.3/types/index.ts b/sdk/src/conditional_vault/v0.3/types/index.ts new file mode 100644 index 000000000..17d3471ab --- /dev/null +++ b/sdk/src/conditional_vault/v0.3/types/index.ts @@ -0,0 +1,10 @@ +import { + ConditionalVault as ConditionalVaultProgram, + IDL as ConditionalVaultIDL, +} from "./conditional_vault.js"; +export { ConditionalVaultProgram, ConditionalVaultIDL }; + +import type { IdlAccounts } from "@coral-xyz/anchor"; + +export type ConditionalVault = + IdlAccounts["conditionalVault"]; diff --git a/sdk/src/v0.5/ConditionalVaultClient.ts b/sdk/src/conditional_vault/v0.4/ConditionalVaultClient.ts similarity index 96% rename from sdk/src/v0.5/ConditionalVaultClient.ts rename to sdk/src/conditional_vault/v0.4/ConditionalVaultClient.ts index 047e0a46f..a0d8c9c12 100644 --- a/sdk/src/v0.5/ConditionalVaultClient.ts +++ b/sdk/src/conditional_vault/v0.4/ConditionalVaultClient.ts @@ -1,30 +1,23 @@ -import { AnchorProvider, Program, utils } from "@coral-xyz/anchor"; -import { - AccountInfo, - AddressLookupTableAccount, - Keypair, - PublicKey, - SystemProgram, -} from "@solana/web3.js"; +import { AnchorProvider, Program } from "@coral-xyz/anchor"; +import { AccountInfo, Keypair, PublicKey } from "@solana/web3.js"; import { ConditionalVaultProgram, ConditionalVaultIDL } from "./types/index.js"; import BN from "bn.js"; import { - CONDITIONAL_VAULT_PROGRAM_ID, + CONDITIONAL_VAULT_V0_4_PROGRAM_ID, MPL_TOKEN_METADATA_PROGRAM_ID, -} from "./constants.js"; +} from "../../constants.js"; +import { getMetadataAddr } from "../../pda.js"; import { getQuestionAddr, - getMetadataAddr, getVaultAddr, getConditionalTokenMintAddr, -} from "./utils/index.js"; +} from "./pda.js"; + import { createAssociatedTokenAccountIdempotentInstruction, - createAssociatedTokenAccountInstruction, getAssociatedTokenAddressSync, - TOKEN_PROGRAM_ID, } from "@solana/spl-token"; import { ConditionalVault, Question } from "./types/index.js"; @@ -53,7 +46,7 @@ export class ConditionalVaultClient { return new ConditionalVaultClient( provider, - conditionalVaultProgramId || CONDITIONAL_VAULT_PROGRAM_ID, + conditionalVaultProgramId || CONDITIONAL_VAULT_V0_4_PROGRAM_ID, ); } diff --git a/sdk/src/conditional_vault/v0.4/index.ts b/sdk/src/conditional_vault/v0.4/index.ts new file mode 100644 index 000000000..1918f77d1 --- /dev/null +++ b/sdk/src/conditional_vault/v0.4/index.ts @@ -0,0 +1,3 @@ +export * from "./ConditionalVaultClient.js"; +export * from "./types/index.js"; +export * from "./pda.js"; diff --git a/sdk/src/conditional_vault/v0.4/pda.ts b/sdk/src/conditional_vault/v0.4/pda.ts new file mode 100644 index 000000000..2e52277b2 --- /dev/null +++ b/sdk/src/conditional_vault/v0.4/pda.ts @@ -0,0 +1,74 @@ +import { PublicKey } from "@solana/web3.js"; +import { utils } from "@coral-xyz/anchor"; +import BN from "bn.js"; + +export const getQuestionAddr = ( + programId: PublicKey, + questionId: Uint8Array, + oracle: PublicKey, + numOutcomes: number, +) => { + if (questionId.length != 32) { + throw new Error("questionId must be 32 bytes"); + } + + return PublicKey.findProgramAddressSync( + [ + utils.bytes.utf8.encode("question"), + Buffer.from(questionId), + oracle.toBuffer(), + new BN(numOutcomes).toArrayLike(Buffer, "le", 1), + ], + programId, + ); +}; + +export const getVaultAddr = ( + programId: PublicKey, + question: PublicKey, + underlyingTokenMint: PublicKey, +) => { + return PublicKey.findProgramAddressSync( + [ + utils.bytes.utf8.encode("conditional_vault"), + question.toBuffer(), + underlyingTokenMint.toBuffer(), + ], + programId, + ); +}; + +export const getConditionalTokenMintAddr = ( + programId: PublicKey, + vault: PublicKey, + index: number, +) => { + return PublicKey.findProgramAddressSync( + [ + utils.bytes.utf8.encode("conditional_token"), + vault.toBuffer(), + new BN(index).toArrayLike(Buffer, "le", 1), + ], + programId, + ); +}; + +export const getDownAndUpMintAddrs = ( + programId: PublicKey, + vault: PublicKey, +): { down: PublicKey; up: PublicKey } => { + return { + down: getConditionalTokenMintAddr(programId, vault, 0)[0], + up: getConditionalTokenMintAddr(programId, vault, 1)[0], + }; +}; + +export const getFailAndPassMintAddrs = ( + programId: PublicKey, + vault: PublicKey, +): { fail: PublicKey; pass: PublicKey } => { + return { + fail: getConditionalTokenMintAddr(programId, vault, 0)[0], + pass: getConditionalTokenMintAddr(programId, vault, 1)[0], + }; +}; diff --git a/sdk/src/v0.7/types/conditional_vault.ts b/sdk/src/conditional_vault/v0.4/types/conditional_vault.ts similarity index 100% rename from sdk/src/v0.7/types/conditional_vault.ts rename to sdk/src/conditional_vault/v0.4/types/conditional_vault.ts diff --git a/sdk/src/conditional_vault/v0.4/types/index.ts b/sdk/src/conditional_vault/v0.4/types/index.ts new file mode 100644 index 000000000..b308696ed --- /dev/null +++ b/sdk/src/conditional_vault/v0.4/types/index.ts @@ -0,0 +1,34 @@ +import { + ConditionalVault as ConditionalVaultProgram, + IDL as ConditionalVaultIDL, +} from "./conditional_vault.js"; +export { ConditionalVaultProgram, ConditionalVaultIDL }; + +import type { IdlAccounts, IdlEvents } from "@coral-xyz/anchor"; + +export type Question = IdlAccounts["question"]; +export type ConditionalVault = + IdlAccounts["conditionalVault"]; + +export type AddMetadataToConditionalTokensEvent = + IdlEvents["AddMetadataToConditionalTokensEvent"]; +export type InitializeConditionalVaultEvent = + IdlEvents["InitializeConditionalVaultEvent"]; +export type InitializeQuestionEvent = + IdlEvents["InitializeQuestionEvent"]; +export type MergeTokensEvent = + IdlEvents["MergeTokensEvent"]; +export type RedeemTokensEvent = + IdlEvents["RedeemTokensEvent"]; +export type ResolveQuestionEvent = + IdlEvents["ResolveQuestionEvent"]; +export type SplitTokensEvent = + IdlEvents["SplitTokensEvent"]; +export type ConditionalVaultEvent = + | AddMetadataToConditionalTokensEvent + | InitializeConditionalVaultEvent + | InitializeQuestionEvent + | MergeTokensEvent + | RedeemTokensEvent + | ResolveQuestionEvent + | SplitTokensEvent; diff --git a/sdk/src/v0.7/constants.ts b/sdk/src/constants.ts similarity index 70% rename from sdk/src/v0.7/constants.ts rename to sdk/src/constants.ts index bf3e2322d..8701b71bc 100644 --- a/sdk/src/v0.7/constants.ts +++ b/sdk/src/constants.ts @@ -2,16 +2,46 @@ import { Keypair, PublicKey } from "@solana/web3.js"; import * as anchor from "@coral-xyz/anchor"; import { BN } from "bn.js"; -export const FUTARCHY_PROGRAM_ID = new PublicKey( - "FUTARELBfJfQ8RDGhg1wdhddq1odMAJUePHFuBYfUxKq", +export const AUTOCRAT_V0_3_PROGRAM_ID = new PublicKey( + "autoQP9RmUNkzzKRXsMkWicDVZ3h29vvyMDcAYjCxxg", +); +export const AMM_V0_3_PROGRAM_ID = new PublicKey( + "AMM5G2nxuKUwCLRYTW7qqEwuoqCtNSjtbipwEmm2g8bH", +); +export const CONDITIONAL_VAULT_V0_3_PROGRAM_ID = new PublicKey( + "VAU1T7S5UuEHmMvXtXMVmpEoQtZ2ya7eRb7gcN47wDp", +); + +export const AUTOCRAT_V0_4_PROGRAM_ID = new PublicKey( + "autowMzCbM29YXMgVG3T62Hkgo7RcyrvgQQkd54fDQL", +); +export const AMM_V0_4_PROGRAM_ID = new PublicKey( + "AMMyu265tkBpRW21iGQxKGLaves3gKm2JcMUqfXNSpqD", +); +export const LAUNCHPAD_V0_4_PROGRAM_ID = new PublicKey( + "AfJJJ5UqxhBKoE3grkKAZZsoXDE9kncbMKvqSHGsCNrE", +); + +export const AUTOCRAT_V0_5_PROGRAM_ID = new PublicKey( + "auToUr3CQza3D4qreT6Std2MTomfzvrEeCC5qh7ivW5", +); +export const LAUNCHPAD_V0_5_PROGRAM_ID = new PublicKey( + "mooNhciQJi1LqHDmse2JPic2NqG2PXCanbE3ZYzP3qA", ); -export const AMM_PROGRAM_ID = new PublicKey( +export const AMM_V0_5_PROGRAM_ID = new PublicKey( "AMMJdEiCCa8mdugg6JPF7gFirmmxisTfDJoSNSUi5zDJ", ); -export const CONDITIONAL_VAULT_PROGRAM_ID = new PublicKey( + +export const FUTARCHY_V0_6_PROGRAM_ID = new PublicKey( + "FUTARELBfJfQ8RDGhg1wdhddq1odMAJUePHFuBYfUxKq", +); +export const CONDITIONAL_VAULT_V0_4_PROGRAM_ID = new PublicKey( "VLTX1ishMBbcX3rdBWGssxawAo1Q2X2qxYFYqiGodVg", ); -export const LAUNCHPAD_PROGRAM_ID = new PublicKey( +export const LAUNCHPAD_V0_6_PROGRAM_ID = new PublicKey( + "MooNyh4CBUYEKyXVnjGYQ8mEiJDpGvJMdvrZx1iGeHV", +); +export const LAUNCHPAD_V0_7_PROGRAM_ID = new PublicKey( "moontUzsdepotRGe5xsfip7vLPTJnVuafqdUWexVnPM", ); export const SHARED_LIQUIDITY_MANAGER_PROGRAM_ID = new PublicKey( @@ -20,16 +50,16 @@ export const SHARED_LIQUIDITY_MANAGER_PROGRAM_ID = new PublicKey( export const PRICE_BASED_PERFORMANCE_PACKAGE_PROGRAM_ID = new PublicKey( "pbPPQH7jyKoSLu8QYs3rSY3YkDRXEBojKbTgnUg7NDS", ); -export const BID_WALL_PROGRAM_ID = new PublicKey( +export const BID_WALL_V0_7_PROGRAM_ID = new PublicKey( "WALL8ucBuUyL46QYxwYJjidaFYhdvxUFrgvBxPshERx", ); -export const MINT_GOVERNOR_PROGRAM_ID = new PublicKey( +export const MINT_GOVERNOR_V0_7_PROGRAM_ID = new PublicKey( "gvnr27cVeyW3AVf3acL7VCJ5WjGAphytnsgcK1feHyH", ); export const PERFORMANCE_PACKAGE_V2_PROGRAM_ID = new PublicKey( "pPV2pfrxnmstSb9j7kEeCLny5BGj6SNwCWGd6xbGGzz", ); -export const LIQUIDATION_PROGRAM_ID = new PublicKey( +export const LIQUIDATION_V0_7_PROGRAM_ID = new PublicKey( "LiQnowFbFQdYyZhF4pUbpsrZCjxRTQ1upKJxZ2VXjde", ); @@ -46,7 +76,7 @@ export const DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID = new PublicKey( ); export const META_MINT = new PublicKey( - "3gN1WVEJwSHNWjo7hr87DgZp6zkf8kWgAJD29DmfE2Gr", + "METAwkXcqyXKy1AtsSgJ8JiUHwGCafnZL38n3vYmeta", ); export const MAINNET_USDC = new PublicKey( "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", @@ -117,7 +147,11 @@ export const SQUADS_PROGRAM_CONFIG_TREASURY_DEVNET = new PublicKey( "HM5y4mz3Bt9JY9mr1hkyhnvqxSH4H2u2451j7Hc2dtvK", ); -export const MAINNET_METEORA_CONFIG = new PublicKey( +export const LAUNCHPAD_V0_6_MAINNET_METEORA_CONFIG = new PublicKey( + "Asv1KQqeop9e4FFvTzEBZhwtTjuWHXPq5thUGtQrzzA3", +); + +export const LAUNCHPAD_V0_7_MAINNET_METEORA_CONFIG = new PublicKey( "FaA6RM9enPh1tU9Y8LiGCq715JubLc49WGcYTdNvDfsc", ); diff --git a/sdk/src/futarchy/index.ts b/sdk/src/futarchy/index.ts new file mode 100644 index 000000000..f77abe821 --- /dev/null +++ b/sdk/src/futarchy/index.ts @@ -0,0 +1 @@ +export * from "./v0.6/index.js"; diff --git a/sdk/src/v0.7/FutarchyClient.ts b/sdk/src/futarchy/v0.6/FutarchyClient.ts similarity index 91% rename from sdk/src/v0.7/FutarchyClient.ts rename to sdk/src/futarchy/v0.6/FutarchyClient.ts index 10d9f6aee..125843dff 100644 --- a/sdk/src/v0.7/FutarchyClient.ts +++ b/sdk/src/futarchy/v0.6/FutarchyClient.ts @@ -1,73 +1,69 @@ -import { AnchorProvider, IdlTypes, Program } from "@coral-xyz/anchor"; +import { AnchorProvider, Program } from "@coral-xyz/anchor"; import { AccountInfo, - AccountMeta, AddressLookupTableAccount, ComputeBudgetProgram, - Connection, - Keypair, PublicKey, SystemProgram, Transaction, TransactionInstruction, + TransactionMessage, } from "@solana/web3.js"; -import { InitializeDaoParams, UpdateDaoParams } from "./types/index.js"; - -// import { Autocrat, IDL as AutocratIDL } from "./types/autocrat.js"; -import { Futarchy, IDL as FutarchyIDL } from "./types/futarchy.js"; import { - ConditionalVault, - IDL as ConditionalVaultIDL, -} from "./types/conditional_vault.js"; - + createAssociatedTokenAccountIdempotentInstruction, + createTransferInstruction, + getAssociatedTokenAddressSync, + TOKEN_PROGRAM_ID, +} from "@solana/spl-token"; +import { sha256 } from "@noble/hashes/sha256"; import BN from "bn.js"; +import * as multisig from "@sqds/multisig"; + import { - AMM_PROGRAM_ID, - FUTARCHY_PROGRAM_ID, - CONDITIONAL_VAULT_PROGRAM_ID, + FUTARCHY_V0_6_PROGRAM_ID, + CONDITIONAL_VAULT_V0_4_PROGRAM_ID, MAINNET_USDC, PERMISSIONLESS_ACCOUNT, SQUADS_PROGRAM_CONFIG, SQUADS_PROGRAM_CONFIG_TREASURY, SQUADS_PROGRAM_ID, - USDC_DECIMALS, - SHARED_LIQUIDITY_MANAGER_PROGRAM_ID, - MAINNET_METEORA_CONFIG, + LAUNCHPAD_V0_7_MAINNET_METEORA_CONFIG, METADAO_MULTISIG_VAULT, DAMM_V2_PROGRAM_ID, - LAUNCHPAD_PROGRAM_ID, + LAUNCHPAD_V0_7_PROGRAM_ID, DAMM_V2_POOL_AUTHORITY, -} from "./constants.js"; +} from "../../constants.js"; +import { getEventAuthorityAddr } from "../../pda.js"; +import { InstructionUtils } from "../../utils.js"; + +import { + Dao, + Proposal, + InitializeDaoParams, + UpdateDaoParams, +} from "./types/index.js"; +import { Futarchy, IDL as FutarchyIDL } from "./types/futarchy.js"; +import { + Futarchy as v0_6_0_futarchy, + IDL as v0_6_0_futarchyIDL, +} from "./types/v0.6.0-futarchy.js"; import { - DEFAULT_CU_PRICE, - InstructionUtils, - MaxCUs, - getConditionalTokenMintAddr, getDaoAddr, - getEventAuthorityAddr, getProposalAddr, getProposalAddrV2, + getStakeAddr, +} from "./pda.js"; + +import { getQuestionAddr, getVaultAddr, -} from "./utils/index.js"; -import { ConditionalVaultClient } from "./ConditionalVaultClient.js"; -import { - createAssociatedTokenAccountIdempotentInstruction, - createTransferInstruction, - getAssociatedTokenAddressSync, - unpackMint, - TOKEN_PROGRAM_ID, -} from "@solana/spl-token"; -import { sha256 } from "@noble/hashes/sha256"; -import { Dao, Proposal } from "./types/index.js"; - -import * as multisig from "@sqds/multisig"; -import { TransactionMessage } from "@solana/web3.js"; -import { getStakeAddr } from "./utils/index.js"; + getConditionalTokenMintAddr, +} from "../../conditional_vault/v0.4/index.js"; +import { ConditionalVaultClient } from "../../conditional_vault/v0.4/index.js"; export type CreateClientParams = { provider: AnchorProvider; - autocratProgramId?: PublicKey; + futarchyProgramId?: PublicKey; conditionalVaultProgramId?: PublicKey; }; @@ -78,20 +74,26 @@ export type ProposalVaults = { export class FutarchyClient { public readonly provider: AnchorProvider; - public readonly autocrat: Program; + public readonly futarchy: Program; + public readonly v0_6_0_futarchy: Program; public readonly vaultClient: ConditionalVaultClient; public readonly luts: AddressLookupTableAccount[]; constructor( provider: AnchorProvider, - autocratProgramId: PublicKey, + futarchyProgramId: PublicKey, conditionalVaultProgramId: PublicKey, luts: AddressLookupTableAccount[], ) { this.provider = provider; - this.autocrat = new Program( + this.futarchy = new Program( FutarchyIDL, - autocratProgramId, + futarchyProgramId, + provider, + ); + this.v0_6_0_futarchy = new Program( + v0_6_0_futarchyIDL, + futarchyProgramId, provider, ); this.vaultClient = ConditionalVaultClient.createClient({ @@ -102,49 +104,49 @@ export class FutarchyClient { } public static createClient( - createAutocratClientParams: CreateClientParams, + createFutarchyClientParams: CreateClientParams, ): FutarchyClient { - let { provider, autocratProgramId, conditionalVaultProgramId } = - createAutocratClientParams; + let { provider, futarchyProgramId, conditionalVaultProgramId } = + createFutarchyClientParams; const luts: AddressLookupTableAccount[] = []; return new FutarchyClient( provider, - autocratProgramId || FUTARCHY_PROGRAM_ID, - conditionalVaultProgramId || CONDITIONAL_VAULT_PROGRAM_ID, + futarchyProgramId || FUTARCHY_V0_6_PROGRAM_ID, + conditionalVaultProgramId || CONDITIONAL_VAULT_V0_4_PROGRAM_ID, luts, ); } getProgramId(): PublicKey { - return this.autocrat.programId; + return this.futarchy.programId; } async getProposal(proposal: PublicKey): Promise { - return this.autocrat.account.proposal.fetch(proposal); + return this.futarchy.account.proposal.fetch(proposal); } async getDao(dao: PublicKey): Promise { - return this.autocrat.account.dao.fetch(dao); + return this.futarchy.account.dao.fetch(dao); } async fetchProposal(proposal: PublicKey): Promise { - return this.autocrat.account.proposal.fetchNullable(proposal); + return this.futarchy.account.proposal.fetchNullable(proposal); } async fetchDao(dao: PublicKey): Promise { - return this.autocrat.account.dao.fetchNullable(dao); + return this.futarchy.account.dao.fetchNullable(dao); } async deserializeProposal( accountInfo: AccountInfo, ): Promise { - return this.autocrat.coder.accounts.decode("proposal", accountInfo.data); + return this.futarchy.coder.accounts.decode("proposal", accountInfo.data); } async deserializeDao(accountInfo: AccountInfo): Promise { - return this.autocrat.coder.accounts.decode("dao", accountInfo.data); + return this.futarchy.coder.accounts.decode("dao", accountInfo.data); } getProposalPdas( @@ -255,7 +257,7 @@ export class FutarchyClient { createKey: dao, })[0]; - return this.autocrat.methods.initializeDao(params).accounts({ + return this.futarchy.methods.initializeDao(params).accounts({ dao, baseMint, quoteMint, @@ -298,7 +300,7 @@ export class FutarchyClient { const squadsMultisig = multisig.getMultisigPda({ createKey: dao })[0]; - return this.autocrat.methods + return this.futarchy.methods .launchProposal() .accounts({ proposal, @@ -355,7 +357,7 @@ export class FutarchyClient { minOutputAmount?: BN; trader?: PublicKey; }) { - return this.autocrat.methods + return this.futarchy.methods .spotSwap({ swapType: swapType === "buy" ? { buy: {} } : { sell: {} }, inputAmount, @@ -417,7 +419,7 @@ export class FutarchyClient { this.getProgramId(), )[0]; - return this.autocrat.methods + return this.futarchy.methods .provideLiquidity({ quoteAmount, maxBaseAmount, @@ -512,7 +514,7 @@ export class FutarchyClient { ); } - return this.autocrat.methods + return this.futarchy.methods .conditionalSwap({ market: market == "pass" ? { pass: {} } : { fail: {} }, swapType: swapType == "buy" ? { buy: {} } : { sell: {} }, @@ -630,7 +632,7 @@ export class FutarchyClient { ): Promise { const storedDao = await this.getDao(dao); - let [proposal] = getProposalAddr(this.autocrat.programId, squadsProposal); + let [proposal] = getProposalAddr(this.futarchy.programId, squadsProposal); await this.vaultClient.initializeQuestion( sha256(`Will ${proposal} pass?/FAIL/PASS`), @@ -678,7 +680,7 @@ export class FutarchyClient { question: PublicKey, proposer: PublicKey = this.provider.publicKey, ) { - let [proposal] = getProposalAddr(this.autocrat.programId, squadsProposal); + let [proposal] = getProposalAddr(this.futarchy.programId, squadsProposal); const { baseVault, quoteVault, @@ -695,7 +697,7 @@ export class FutarchyClient { const squadsMultisig = multisig.getMultisigPda({ createKey: dao })[0]; - return this.autocrat.methods + return this.futarchy.methods .initializeProposal() .accounts({ question, @@ -795,7 +797,7 @@ export class FutarchyClient { const [vaultEventAuthority] = getEventAuthorityAddr(vaultProgramId); - return this.autocrat.methods + return this.futarchy.methods .finalizeProposal() .accounts({ proposal, @@ -857,7 +859,7 @@ export class FutarchyClient { index: 0, })[0]; - return this.autocrat.methods.updateDao(params).accounts({ + return this.futarchy.methods.updateDao(params).accounts({ dao, squadsMultisigVault, }); @@ -878,9 +880,13 @@ export class FutarchyClient { staker?: PublicKey; payer?: PublicKey; }) { - const stakeAccount = getStakeAddr(FUTARCHY_PROGRAM_ID, proposal, staker)[0]; + const stakeAccount = getStakeAddr( + FUTARCHY_V0_6_PROGRAM_ID, + proposal, + staker, + )[0]; - return this.autocrat.methods + return this.futarchy.methods .stakeToProposal({ amount }) .accounts({ proposal, @@ -930,9 +936,13 @@ export class FutarchyClient { amount: BN; staker?: PublicKey; }) { - const stakeAccount = getStakeAddr(FUTARCHY_PROGRAM_ID, proposal, staker)[0]; + const stakeAccount = getStakeAddr( + FUTARCHY_V0_6_PROGRAM_ID, + proposal, + staker, + )[0]; - return this.autocrat.methods.unstakeFromProposal({ amount }).accounts({ + return this.futarchy.methods.unstakeFromProposal({ amount }).accounts({ proposal, dao, stakerBaseAccount: getAssociatedTokenAddressSync(baseMint, staker, true), @@ -969,7 +979,7 @@ export class FutarchyClient { true, ); - return this.autocrat.methods.collectFees().accounts({ + return this.futarchy.methods.collectFees().accounts({ dao, admin: this.provider.publicKey, ammBaseVault: getAssociatedTokenAddressSync(baseMint, dao, true), @@ -988,7 +998,7 @@ export class FutarchyClient { dao: PublicKey; teamAddress?: PublicKey; }) { - return this.autocrat.methods.sponsorProposal().accounts({ + return this.futarchy.methods.sponsorProposal().accounts({ proposal, dao, teamAddress, @@ -1000,7 +1010,7 @@ export class FutarchyClient { baseMint, quoteMint = MAINNET_USDC, transactionIndex, - meteoraConfig = MAINNET_METEORA_CONFIG, + meteoraConfig = LAUNCHPAD_V0_7_MAINNET_METEORA_CONFIG, admin = this.provider.publicKey, }: { dao: PublicKey; @@ -1060,7 +1070,7 @@ export class FutarchyClient { const [positionNftMint] = PublicKey.findProgramAddressSync( [Buffer.from("position_nft_mint"), baseMint.toBuffer()], - LAUNCHPAD_PROGRAM_ID, + LAUNCHPAD_V0_7_PROGRAM_ID, ); const [positionNftAccount] = PublicKey.findProgramAddressSync( @@ -1085,7 +1095,7 @@ export class FutarchyClient { const [dammV2EventAuthority] = getEventAuthorityAddr(DAMM_V2_PROGRAM_ID); - return this.autocrat.methods.collectMeteoraDammFees().accounts({ + return this.futarchy.methods.collectMeteoraDammFees().accounts({ dao, admin, squadsMultisig: multisigPda, @@ -1195,7 +1205,7 @@ export class FutarchyClient { rentPayer: payer, }); - return this.autocrat.methods + return this.futarchy.methods .initiateVaultSpendOptimisticProposal({ amount }) .accounts({ squadsMultisig: multisigPda, @@ -1232,7 +1242,7 @@ export class FutarchyClient { }) { const multisigPda = multisig.getMultisigPda({ createKey: dao })[0]; - return this.autocrat.methods.finalizeOptimisticProposal().accounts({ + return this.futarchy.methods.finalizeOptimisticProposal().accounts({ squadsMultisig: multisigPda, squadsProposal, dao, diff --git a/sdk/src/futarchy/v0.6/index.ts b/sdk/src/futarchy/v0.6/index.ts new file mode 100644 index 000000000..d4b5169bb --- /dev/null +++ b/sdk/src/futarchy/v0.6/index.ts @@ -0,0 +1,3 @@ +export * from "./types/index.js"; +export * from "./pda.js"; +export * from "./FutarchyClient.js"; diff --git a/sdk/src/futarchy/v0.6/pda.ts b/sdk/src/futarchy/v0.6/pda.ts new file mode 100644 index 000000000..000e43861 --- /dev/null +++ b/sdk/src/futarchy/v0.6/pda.ts @@ -0,0 +1,54 @@ +import { BN, utils } from "@coral-xyz/anchor"; +import { PublicKey } from "@solana/web3.js"; + +import { FUTARCHY_V0_6_PROGRAM_ID } from "../../constants.js"; + +export const getDaoAddr = ({ + nonce, + daoCreator, + programId = FUTARCHY_V0_6_PROGRAM_ID, +}: { + nonce: BN; + daoCreator: PublicKey; + programId?: PublicKey; +}): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [ + Buffer.from("dao"), + daoCreator.toBuffer(), + nonce.toArrayLike(Buffer, "le", 8), + ], + programId, + ); +}; + +export const getProposalAddr = ( + programId: PublicKey = FUTARCHY_V0_6_PROGRAM_ID, + squadsProposal: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [utils.bytes.utf8.encode("proposal"), squadsProposal.toBuffer()], + programId, + ); +}; + +export const getProposalAddrV2 = ({ + programId = FUTARCHY_V0_6_PROGRAM_ID, + squadsProposal, +}: { + programId?: PublicKey; + squadsProposal: PublicKey; +}): [PublicKey, number] => { + return getProposalAddr(programId, squadsProposal); +}; + +export const getStakeAddr = ( + programId: PublicKey = FUTARCHY_V0_6_PROGRAM_ID, + draftProposal: PublicKey, + staker: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [Buffer.from("stake"), draftProposal.toBuffer(), staker.toBuffer()], + programId, + ); +}; diff --git a/sdk/src/v0.7/types/futarchy.ts b/sdk/src/futarchy/v0.6/types/futarchy.ts similarity index 100% rename from sdk/src/v0.7/types/futarchy.ts rename to sdk/src/futarchy/v0.6/types/futarchy.ts diff --git a/sdk/src/futarchy/v0.6/types/index.ts b/sdk/src/futarchy/v0.6/types/index.ts new file mode 100644 index 000000000..7738fb8f3 --- /dev/null +++ b/sdk/src/futarchy/v0.6/types/index.ts @@ -0,0 +1,100 @@ +import { Futarchy as FutarchyProgram, IDL as FutarchyIDL } from "./futarchy.js"; +export { FutarchyProgram, FutarchyIDL }; + +import { + Futarchy as v0_6_0_Futarchy, + IDL as v0_6_0_FutarchyIDL, +} from "./v0.6.0-futarchy.js"; +export { v0_6_0_Futarchy, v0_6_0_FutarchyIDL }; + +export { LowercaseKeys } from "../../../utils.js"; + +import type { IdlAccounts, IdlTypes, IdlEvents } from "@coral-xyz/anchor"; + +export type InitializeDaoParams = + IdlTypes["InitializeDaoParams"]; +export type UpdateDaoParams = IdlTypes["UpdateDaoParams"]; + +export type Dao = IdlAccounts["dao"]; +export type Proposal = IdlAccounts["proposal"]; + +export type CollectFeesEvent = IdlEvents["CollectFeesEvent"]; +export type InitializeDaoEvent = + IdlEvents["InitializeDaoEvent"]; +export type UpdateDaoEvent = IdlEvents["UpdateDaoEvent"]; +export type InitializeProposalEvent = + IdlEvents["InitializeProposalEvent"]; +export type StakeToProposalEvent = + IdlEvents["StakeToProposalEvent"]; +export type UnstakeFromProposalEvent = + IdlEvents["UnstakeFromProposalEvent"]; +export type LaunchProposalEvent = + IdlEvents["LaunchProposalEvent"]; +export type FinalizeProposalEvent = + IdlEvents["FinalizeProposalEvent"]; +export type SpotSwapEvent = IdlEvents["SpotSwapEvent"]; +export type ConditionalSwapEvent = + IdlEvents["ConditionalSwapEvent"]; +export type ProvideLiquidityEvent = + IdlEvents["ProvideLiquidityEvent"]; +export type WithdrawLiquidityEvent = + IdlEvents["WithdrawLiquidityEvent"]; +export type SponsorProposalEvent = + IdlEvents["SponsorProposalEvent"]; +export type InitiateVaultSpendOptimisticProposalEvent = + IdlEvents["InitiateVaultSpendOptimisticProposalEvent"]; +export type FinalizeOptimisticProposalEvent = + IdlEvents["FinalizeOptimisticProposalEvent"]; +export type FutarchyEvent = + | CollectFeesEvent + | InitializeDaoEvent + | UpdateDaoEvent + | InitializeProposalEvent + | StakeToProposalEvent + | UnstakeFromProposalEvent + | LaunchProposalEvent + | FinalizeProposalEvent + | SpotSwapEvent + | ConditionalSwapEvent + | ProvideLiquidityEvent + | WithdrawLiquidityEvent + | SponsorProposalEvent + | InitiateVaultSpendOptimisticProposalEvent + | FinalizeOptimisticProposalEvent; + +export type v0_6_0_CollectFeesEvent = + IdlEvents["CollectFeesEvent"]; +export type v0_6_0_InitializeDaoEvent = + IdlEvents["InitializeDaoEvent"]; +export type v0_6_0_UpdateDaoEvent = + IdlEvents["UpdateDaoEvent"]; +export type v0_6_0_InitializeProposalEvent = + IdlEvents["InitializeProposalEvent"]; +export type v0_6_0_StakeToProposalEvent = + IdlEvents["StakeToProposalEvent"]; +export type v0_6_0_UnstakeFromProposalEvent = + IdlEvents["UnstakeFromProposalEvent"]; +export type v0_6_0_LaunchProposalEvent = + IdlEvents["LaunchProposalEvent"]; +export type v0_6_0_FinalizeProposalEvent = + IdlEvents["FinalizeProposalEvent"]; +export type v0_6_0_SpotSwapEvent = IdlEvents["SpotSwapEvent"]; +export type v0_6_0_ConditionalSwapEvent = + IdlEvents["ConditionalSwapEvent"]; +export type v0_6_0_ProvideLiquidityEvent = + IdlEvents["ProvideLiquidityEvent"]; +export type v0_6_0_WithdrawLiquidityEvent = + IdlEvents["WithdrawLiquidityEvent"]; +export type v0_6_0_FutarchyEvent = + | v0_6_0_CollectFeesEvent + | v0_6_0_InitializeDaoEvent + | v0_6_0_UpdateDaoEvent + | v0_6_0_InitializeProposalEvent + | v0_6_0_StakeToProposalEvent + | v0_6_0_UnstakeFromProposalEvent + | v0_6_0_LaunchProposalEvent + | v0_6_0_FinalizeProposalEvent + | v0_6_0_SpotSwapEvent + | v0_6_0_ConditionalSwapEvent + | v0_6_0_ProvideLiquidityEvent + | v0_6_0_WithdrawLiquidityEvent; diff --git a/sdk/src/v0.6/types/v0.6.0-futarchy.ts b/sdk/src/futarchy/v0.6/types/v0.6.0-futarchy.ts similarity index 100% rename from sdk/src/v0.6/types/v0.6.0-futarchy.ts rename to sdk/src/futarchy/v0.6/types/v0.6.0-futarchy.ts diff --git a/sdk/src/index.ts b/sdk/src/index.ts index bfa636c79..bd08c833a 100644 --- a/sdk/src/index.ts +++ b/sdk/src/index.ts @@ -1 +1,17 @@ +// Default exports for latest versions of programs +export * from "./bid_wall/index.js"; +export * from "./conditional_vault/index.js"; +export * from "./futarchy/index.js"; +export * from "./launchpad/index.js"; +export * from "./liquidation/index.js"; +export * from "./mint_governor/index.js"; +export * from "./performance_package_v2/index.js"; +export * from "./price_based_performance_package/index.js"; + +// Shared exports +export * from "./utils.js"; +export * from "./constants.js"; +export * from "./pda.js"; +export * from "./priceMath.js"; + export { sha256 } from "@noble/hashes/sha256"; diff --git a/sdk/src/launchpad/index.ts b/sdk/src/launchpad/index.ts new file mode 100644 index 000000000..41f4ed086 --- /dev/null +++ b/sdk/src/launchpad/index.ts @@ -0,0 +1,14 @@ +export * from "./v0.7/index.js"; + +export { + v0_6_0_Launchpad, + v0_6_0_LaunchpadIDL, + v0_6_0_LaunchClaimEvent, + v0_6_0_LaunchCompletedEvent, + v0_6_0_LaunchFundedEvent, + v0_6_0_LaunchInitializedEvent, + v0_6_0_LaunchRefundedEvent, + v0_6_0_LaunchStartedEvent, + v0_6_0_LaunchCloseEvent, + v0_6_0_LaunchpadEvent, +} from "./v0.6/index.js"; diff --git a/sdk/src/v0.4/LaunchpadClient.ts b/sdk/src/launchpad/v0.4/LaunchpadClient.ts similarity index 96% rename from sdk/src/v0.4/LaunchpadClient.ts rename to sdk/src/launchpad/v0.4/LaunchpadClient.ts index 70160abb3..e8e71dab6 100644 --- a/sdk/src/v0.4/LaunchpadClient.ts +++ b/sdk/src/launchpad/v0.4/LaunchpadClient.ts @@ -7,7 +7,7 @@ import { } from "@solana/web3.js"; import { Launchpad, IDL as LaunchpadIDL } from "./types/launchpad.js"; import { - LAUNCHPAD_PROGRAM_ID, + LAUNCHPAD_V0_4_PROGRAM_ID, RAYDIUM_AUTHORITY, LOW_FEE_RAYDIUM_CONFIG, RAYDIUM_CP_SWAP_PROGRAM_ID, @@ -19,25 +19,24 @@ import { MPL_TOKEN_METADATA_PROGRAM_ID, MAINNET_USDC, DEVNET_USDC, -} from "./constants.js"; +} from "../../constants.js"; import { createAssociatedTokenAccountIdempotentInstruction, getAssociatedTokenAddressSync, } from "@solana/spl-token"; -import { BN } from "@coral-xyz/anchor"; +import BN from "bn.js"; import { FundingRecord, Launch } from "./types/index.js"; import { - getDaoTreasuryAddr, - getEventAuthorityAddr, getFundingRecordAddr, getLaunchAddr, getLaunchDaoAddr, getLaunchSignerAddr, getLiquidityPoolAddr, - getMetadataAddr, getRaydiumCpmmLpMintAddr, -} from "./utils/pda.js"; -import { AutocratClient } from "./AutocratClient.js"; +} from "./pda.js"; +import { getDaoTreasuryAddr } from "../../autocrat/v0.4/pda.js"; +import { getEventAuthorityAddr, getMetadataAddr } from "../../pda.js"; +import { AutocratClient } from "../../autocrat/v0.4/AutocratClient.js"; import * as anchor from "@coral-xyz/anchor"; export type CreateLaunchpadClientParams = { @@ -57,7 +56,7 @@ export class LaunchpadClient { this.provider = params.provider; this.launchpad = new Program( LaunchpadIDL, - params.launchpadProgramId || LAUNCHPAD_PROGRAM_ID, + params.launchpadProgramId || LAUNCHPAD_V0_4_PROGRAM_ID, this.provider, ); this.autocratClient = AutocratClient.createClient({ diff --git a/sdk/src/launchpad/v0.4/index.ts b/sdk/src/launchpad/v0.4/index.ts new file mode 100644 index 000000000..b5b9717d0 --- /dev/null +++ b/sdk/src/launchpad/v0.4/index.ts @@ -0,0 +1,3 @@ +export * from "./types/index.js"; +export * from "./pda.js"; +export * from "./LaunchpadClient.js"; diff --git a/sdk/src/launchpad/v0.4/pda.ts b/sdk/src/launchpad/v0.4/pda.ts new file mode 100644 index 000000000..3e5b9a370 --- /dev/null +++ b/sdk/src/launchpad/v0.4/pda.ts @@ -0,0 +1,71 @@ +import { PublicKey } from "@solana/web3.js"; +import { utils } from "@coral-xyz/anchor"; +import { + LAUNCHPAD_V0_4_PROGRAM_ID, + RAYDIUM_CP_SWAP_PROGRAM_ID, + DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID, +} from "../../constants.js"; + +export function getLaunchAddr( + programId: PublicKey = LAUNCHPAD_V0_4_PROGRAM_ID, + tokenMint: PublicKey, +): [PublicKey, number] { + return PublicKey.findProgramAddressSync( + [Buffer.from("launch"), tokenMint.toBuffer()], + programId, + ); +} + +export const getLaunchSignerAddr = ( + programId: PublicKey = LAUNCHPAD_V0_4_PROGRAM_ID, + launch: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [Buffer.from("launch_signer"), launch.toBuffer()], + programId, + ); +}; + +export const getFundingRecordAddr = ( + programId: PublicKey = LAUNCHPAD_V0_4_PROGRAM_ID, + launch: PublicKey, + funder: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [Buffer.from("funding_record"), launch.toBuffer(), funder.toBuffer()], + programId, + ); +}; + +export const getLaunchDaoAddr = ( + programId: PublicKey = LAUNCHPAD_V0_4_PROGRAM_ID, + launch: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [Buffer.from("launch_dao"), launch.toBuffer()], + programId, + ); +}; + +export const getLiquidityPoolAddr = ( + programId: PublicKey = LAUNCHPAD_V0_4_PROGRAM_ID, + dao: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [Buffer.from("pool_state"), dao.toBuffer()], + programId, + ); +}; + +export const getRaydiumCpmmLpMintAddr = ( + poolState: PublicKey, + isDevnet: boolean, +): [PublicKey, number] => { + const programId = isDevnet + ? DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID + : RAYDIUM_CP_SWAP_PROGRAM_ID; + return PublicKey.findProgramAddressSync( + [Buffer.from("pool_lp_mint"), poolState.toBuffer()], + programId, + ); +}; diff --git a/sdk/src/launchpad/v0.4/types/index.ts b/sdk/src/launchpad/v0.4/types/index.ts new file mode 100644 index 000000000..8ee0e3354 --- /dev/null +++ b/sdk/src/launchpad/v0.4/types/index.ts @@ -0,0 +1,29 @@ +import { + Launchpad as LaunchpadProgram, + IDL as LaunchpadIDL, +} from "./launchpad.js"; +export { LaunchpadProgram, LaunchpadIDL }; + +import type { IdlAccounts, IdlEvents } from "@coral-xyz/anchor"; + +export type Launch = IdlAccounts["launch"]; +export type FundingRecord = IdlAccounts["fundingRecord"]; + +export type LaunchClaimEvent = IdlEvents["LaunchClaimEvent"]; +export type LaunchCompletedEvent = + IdlEvents["LaunchCompletedEvent"]; +export type LaunchFundedEvent = + IdlEvents["LaunchFundedEvent"]; +export type LaunchInitializedEvent = + IdlEvents["LaunchInitializedEvent"]; +export type LaunchRefundedEvent = + IdlEvents["LaunchRefundedEvent"]; +export type LaunchStartedEvent = + IdlEvents["LaunchStartedEvent"]; +export type LaunchpadEvent = + | LaunchClaimEvent + | LaunchCompletedEvent + | LaunchFundedEvent + | LaunchInitializedEvent + | LaunchRefundedEvent + | LaunchStartedEvent; diff --git a/sdk/src/v0.4/types/launchpad.ts b/sdk/src/launchpad/v0.4/types/launchpad.ts similarity index 100% rename from sdk/src/v0.4/types/launchpad.ts rename to sdk/src/launchpad/v0.4/types/launchpad.ts diff --git a/sdk/src/v0.5/LaunchpadClient.ts b/sdk/src/launchpad/v0.5/LaunchpadClient.ts similarity index 96% rename from sdk/src/v0.5/LaunchpadClient.ts rename to sdk/src/launchpad/v0.5/LaunchpadClient.ts index af27d1816..f21a25ef9 100644 --- a/sdk/src/v0.5/LaunchpadClient.ts +++ b/sdk/src/launchpad/v0.5/LaunchpadClient.ts @@ -7,7 +7,7 @@ import { } from "@solana/web3.js"; import { Launchpad, IDL as LaunchpadIDL } from "./types/launchpad.js"; import { - LAUNCHPAD_PROGRAM_ID, + LAUNCHPAD_V0_5_PROGRAM_ID, RAYDIUM_AUTHORITY, LOW_FEE_RAYDIUM_CONFIG, RAYDIUM_CP_SWAP_PROGRAM_ID, @@ -23,7 +23,7 @@ import { SQUADS_PROGRAM_CONFIG, SQUADS_PROGRAM_CONFIG_TREASURY, DEVNET_SQUADS_PROGRAM_CONFIG_TREASURY, -} from "./constants.js"; +} from "../../constants.js"; import { createAssociatedTokenAccountIdempotentInstruction, getAssociatedTokenAddressSync, @@ -31,17 +31,15 @@ import { import BN from "bn.js"; import { FundingRecord, Launch } from "./types/index.js"; import { - getDaoAddr, - getDaoTreasuryAddr, - getEventAuthorityAddr, getFundingRecordAddr, getLaunchAddr, getLaunchSignerAddr, getLiquidityPoolAddr, - getMetadataAddr, getRaydiumCpmmLpMintAddr, -} from "./utils/pda.js"; -import { AutocratClient } from "./AutocratClient.js"; +} from "./pda.js"; +import { getDaoAddr, getDaoTreasuryAddr } from "../../autocrat/v0.5/pda.js"; +import { getEventAuthorityAddr, getMetadataAddr } from "../../pda.js"; +import { AutocratClient } from "../../autocrat/v0.5/AutocratClient.js"; import * as anchor from "@coral-xyz/anchor"; import * as multisig from "@sqds/multisig"; @@ -62,7 +60,7 @@ export class LaunchpadClient { this.provider = params.provider; this.launchpad = new Program( LaunchpadIDL, - params.launchpadProgramId || LAUNCHPAD_PROGRAM_ID, + params.launchpadProgramId || LAUNCHPAD_V0_5_PROGRAM_ID, this.provider, ); this.autocratClient = AutocratClient.createClient({ diff --git a/sdk/src/launchpad/v0.5/index.ts b/sdk/src/launchpad/v0.5/index.ts new file mode 100644 index 000000000..b5b9717d0 --- /dev/null +++ b/sdk/src/launchpad/v0.5/index.ts @@ -0,0 +1,3 @@ +export * from "./types/index.js"; +export * from "./pda.js"; +export * from "./LaunchpadClient.js"; diff --git a/sdk/src/launchpad/v0.5/pda.ts b/sdk/src/launchpad/v0.5/pda.ts new file mode 100644 index 000000000..589e277c3 --- /dev/null +++ b/sdk/src/launchpad/v0.5/pda.ts @@ -0,0 +1,61 @@ +import { PublicKey } from "@solana/web3.js"; +import { utils } from "@coral-xyz/anchor"; +import { + LAUNCHPAD_V0_5_PROGRAM_ID, + RAYDIUM_CP_SWAP_PROGRAM_ID, + DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID, +} from "../../constants.js"; + +export function getLaunchAddr( + programId: PublicKey = LAUNCHPAD_V0_5_PROGRAM_ID, + tokenMint: PublicKey, +): [PublicKey, number] { + return PublicKey.findProgramAddressSync( + [Buffer.from("launch"), tokenMint.toBuffer()], + programId, + ); +} + +export const getLaunchSignerAddr = ( + programId: PublicKey = LAUNCHPAD_V0_5_PROGRAM_ID, + launch: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [Buffer.from("launch_signer"), launch.toBuffer()], + programId, + ); +}; + +export const getFundingRecordAddr = ( + programId: PublicKey = LAUNCHPAD_V0_5_PROGRAM_ID, + launch: PublicKey, + funder: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [Buffer.from("funding_record"), launch.toBuffer(), funder.toBuffer()], + programId, + ); +}; + +export const getLiquidityPoolAddr = ( + programId: PublicKey = LAUNCHPAD_V0_5_PROGRAM_ID, + dao: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [Buffer.from("pool_state"), dao.toBuffer()], + programId, + ); +}; + +export const getRaydiumCpmmLpMintAddr = ( + poolState: PublicKey, + isDevnet: boolean, +): [PublicKey, number] => { + const programId = isDevnet + ? DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID + : RAYDIUM_CP_SWAP_PROGRAM_ID; + return PublicKey.findProgramAddressSync( + [Buffer.from("pool_lp_mint"), poolState.toBuffer()], + programId, + ); +}; diff --git a/sdk/src/launchpad/v0.5/types/index.ts b/sdk/src/launchpad/v0.5/types/index.ts new file mode 100644 index 000000000..8ee0e3354 --- /dev/null +++ b/sdk/src/launchpad/v0.5/types/index.ts @@ -0,0 +1,29 @@ +import { + Launchpad as LaunchpadProgram, + IDL as LaunchpadIDL, +} from "./launchpad.js"; +export { LaunchpadProgram, LaunchpadIDL }; + +import type { IdlAccounts, IdlEvents } from "@coral-xyz/anchor"; + +export type Launch = IdlAccounts["launch"]; +export type FundingRecord = IdlAccounts["fundingRecord"]; + +export type LaunchClaimEvent = IdlEvents["LaunchClaimEvent"]; +export type LaunchCompletedEvent = + IdlEvents["LaunchCompletedEvent"]; +export type LaunchFundedEvent = + IdlEvents["LaunchFundedEvent"]; +export type LaunchInitializedEvent = + IdlEvents["LaunchInitializedEvent"]; +export type LaunchRefundedEvent = + IdlEvents["LaunchRefundedEvent"]; +export type LaunchStartedEvent = + IdlEvents["LaunchStartedEvent"]; +export type LaunchpadEvent = + | LaunchClaimEvent + | LaunchCompletedEvent + | LaunchFundedEvent + | LaunchInitializedEvent + | LaunchRefundedEvent + | LaunchStartedEvent; diff --git a/sdk/src/v0.5/types/launchpad.ts b/sdk/src/launchpad/v0.5/types/launchpad.ts similarity index 100% rename from sdk/src/v0.5/types/launchpad.ts rename to sdk/src/launchpad/v0.5/types/launchpad.ts diff --git a/sdk/src/v0.6/LaunchpadClient.ts b/sdk/src/launchpad/v0.6/LaunchpadClient.ts similarity index 94% rename from sdk/src/v0.6/LaunchpadClient.ts rename to sdk/src/launchpad/v0.6/LaunchpadClient.ts index 77097f3ce..173b66e49 100644 --- a/sdk/src/v0.6/LaunchpadClient.ts +++ b/sdk/src/launchpad/v0.6/LaunchpadClient.ts @@ -1,35 +1,21 @@ import { AnchorProvider, Program } from "@coral-xyz/anchor"; -import { - PublicKey, - Keypair, - AccountInfo, - ComputeBudgetProgram, -} from "@solana/web3.js"; +import { PublicKey, AccountInfo, ComputeBudgetProgram } from "@solana/web3.js"; import { Launchpad, IDL as LaunchpadIDL } from "./types/launchpad.js"; import { Launchpad as v0_6_0_launchpad, IDL as v0_6_0_launchpadIDL, } from "./types/v0.6.0-launchpad.js"; import { - LAUNCHPAD_PROGRAM_ID, - RAYDIUM_AUTHORITY, - LOW_FEE_RAYDIUM_CONFIG, - RAYDIUM_CP_SWAP_PROGRAM_ID, - RAYDIUM_CREATE_POOL_FEE_RECEIVE, - DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID, - DEVNET_RAYDIUM_AUTHORITY, - DEVNET_LOW_FEE_RAYDIUM_CONFIG, - DEVNET_RAYDIUM_CREATE_POOL_FEE_RECEIVE, + LAUNCHPAD_V0_6_PROGRAM_ID, MPL_TOKEN_METADATA_PROGRAM_ID, MAINNET_USDC, - DEVNET_USDC, SQUADS_PROGRAM_ID, SQUADS_PROGRAM_CONFIG, SQUADS_PROGRAM_CONFIG_TREASURY, DAMM_V2_PROGRAM_ID, SQUADS_PROGRAM_CONFIG_TREASURY_DEVNET, - MAINNET_METEORA_CONFIG, -} from "./constants.js"; + LAUNCHPAD_V0_6_MAINNET_METEORA_CONFIG, +} from "../../constants.js"; import { createAssociatedTokenAccountIdempotentInstruction, getAssociatedTokenAddressSync, @@ -38,18 +24,18 @@ import { import BN from "bn.js"; import { FundingRecord, Launch } from "./types/index.js"; import { - getDaoAddr, - getEventAuthorityAddr, getFundingRecordAddr, getLaunchAddr, getLaunchSignerAddr, - getMetadataAddr, +} from "./pda.js"; +import { getEventAuthorityAddr, getMetadataAddr } from "../../pda.js"; +import { FutarchyClient, getDaoAddr } from "../../futarchy/v0.6/index.js"; +import { + PriceBasedPerformancePackageClient, getPerformancePackageAddr, -} from "./utils/pda.js"; -import { FutarchyClient } from "./FutarchyClient.js"; -import * as anchor from "@coral-xyz/anchor"; +} from "../../price_based_performance_package/v0.6/index.js"; + import * as multisig from "@sqds/multisig"; -import { PriceBasedPerformancePackageClient } from "./PriceBasedPerformancePackageClient.js"; export type CreateLaunchpadClientParams = { provider: AnchorProvider; @@ -71,12 +57,12 @@ export class LaunchpadClient { this.provider = params.provider; this.launchpad = new Program( LaunchpadIDL, - params.launchpadProgramId || LAUNCHPAD_PROGRAM_ID, + params.launchpadProgramId || LAUNCHPAD_V0_6_PROGRAM_ID, this.provider, ); this.v0_6_0_launchpad = new Program( v0_6_0_launchpadIDL, - params.launchpadProgramId || LAUNCHPAD_PROGRAM_ID, + params.launchpadProgramId || LAUNCHPAD_V0_6_PROGRAM_ID, this.provider, ); this.futarchyClient = FutarchyClient.createClient({ @@ -283,7 +269,7 @@ export class LaunchpadClient { finalRaiseAmount, launchAuthority, isDevnet = false, - meteoraConfig = MAINNET_METEORA_CONFIG, + meteoraConfig = LAUNCHPAD_V0_6_MAINNET_METEORA_CONFIG, }: { launch: PublicKey; quoteMint?: PublicKey; @@ -356,7 +342,7 @@ export class LaunchpadClient { const [positionNftMint] = PublicKey.findProgramAddressSync( [Buffer.from("position_nft_mint"), baseMint.toBuffer()], - LAUNCHPAD_PROGRAM_ID, + LAUNCHPAD_V0_6_PROGRAM_ID, ); const [positionNftAccount] = PublicKey.findProgramAddressSync( @@ -411,7 +397,7 @@ export class LaunchpadClient { const [poolCreatorAuthority] = PublicKey.findProgramAddressSync( [Buffer.from("damm_pool_creator_authority")], - LAUNCHPAD_PROGRAM_ID, + LAUNCHPAD_V0_6_PROGRAM_ID, ); const [dammV2EventAuthority] = getEventAuthorityAddr(DAMM_V2_PROGRAM_ID); diff --git a/sdk/src/launchpad/v0.6/index.ts b/sdk/src/launchpad/v0.6/index.ts new file mode 100644 index 000000000..b5b9717d0 --- /dev/null +++ b/sdk/src/launchpad/v0.6/index.ts @@ -0,0 +1,3 @@ +export * from "./types/index.js"; +export * from "./pda.js"; +export * from "./LaunchpadClient.js"; diff --git a/sdk/src/launchpad/v0.6/pda.ts b/sdk/src/launchpad/v0.6/pda.ts new file mode 100644 index 000000000..8c1f6bce9 --- /dev/null +++ b/sdk/src/launchpad/v0.6/pda.ts @@ -0,0 +1,60 @@ +import { PublicKey } from "@solana/web3.js"; +import { + LAUNCHPAD_V0_6_PROGRAM_ID, + RAYDIUM_CP_SWAP_PROGRAM_ID, + DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID, +} from "../../constants.js"; + +export function getLaunchAddr( + programId: PublicKey = LAUNCHPAD_V0_6_PROGRAM_ID, + tokenMint: PublicKey, +): [PublicKey, number] { + return PublicKey.findProgramAddressSync( + [Buffer.from("launch"), tokenMint.toBuffer()], + programId, + ); +} + +export const getLaunchSignerAddr = ( + programId: PublicKey = LAUNCHPAD_V0_6_PROGRAM_ID, + launch: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [Buffer.from("launch_signer"), launch.toBuffer()], + programId, + ); +}; + +export const getFundingRecordAddr = ( + programId: PublicKey = LAUNCHPAD_V0_6_PROGRAM_ID, + launch: PublicKey, + funder: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [Buffer.from("funding_record"), launch.toBuffer(), funder.toBuffer()], + programId, + ); +}; + +export const getLiquidityPoolAddr = ( + programId: PublicKey = LAUNCHPAD_V0_6_PROGRAM_ID, + dao: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [Buffer.from("pool_state"), dao.toBuffer()], + programId, + ); +}; + +export const getRaydiumCpmmLpMintAddr = ( + poolState: PublicKey, + isDevnet: boolean, +): [PublicKey, number] => { + const programId = isDevnet + ? DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID + : RAYDIUM_CP_SWAP_PROGRAM_ID; + return PublicKey.findProgramAddressSync( + [Buffer.from("pool_lp_mint"), poolState.toBuffer()], + programId, + ); +}; diff --git a/sdk/src/launchpad/v0.6/types/index.ts b/sdk/src/launchpad/v0.6/types/index.ts new file mode 100644 index 000000000..2e0337f75 --- /dev/null +++ b/sdk/src/launchpad/v0.6/types/index.ts @@ -0,0 +1,59 @@ +import { IdlAccounts, IdlEvents } from "@coral-xyz/anchor"; +import { + Launchpad as LaunchpadProgram, + IDL as LaunchpadIDL, +} from "./launchpad.js"; +export { LaunchpadProgram, LaunchpadIDL }; + +import { + Launchpad as v0_6_0_Launchpad, + IDL as v0_6_0_LaunchpadIDL, +} from "./v0.6.0-launchpad.js"; +export { v0_6_0_Launchpad, v0_6_0_LaunchpadIDL }; + +export type Launch = IdlAccounts["launch"]; +export type FundingRecord = IdlAccounts["fundingRecord"]; + +export type LaunchClaimEvent = IdlEvents["LaunchClaimEvent"]; +export type LaunchCompletedEvent = + IdlEvents["LaunchCompletedEvent"]; +export type LaunchFundedEvent = + IdlEvents["LaunchFundedEvent"]; +export type LaunchInitializedEvent = + IdlEvents["LaunchInitializedEvent"]; +export type LaunchRefundedEvent = + IdlEvents["LaunchRefundedEvent"]; +export type LaunchStartedEvent = + IdlEvents["LaunchStartedEvent"]; +export type LaunchCloseEvent = IdlEvents["LaunchCloseEvent"]; +export type LaunchpadEvent = + | LaunchClaimEvent + | LaunchCompletedEvent + | LaunchFundedEvent + | LaunchInitializedEvent + | LaunchRefundedEvent + | LaunchStartedEvent + | LaunchCloseEvent; + +export type v0_6_0_LaunchClaimEvent = + IdlEvents["LaunchClaimEvent"]; +export type v0_6_0_LaunchCompletedEvent = + IdlEvents["LaunchCompletedEvent"]; +export type v0_6_0_LaunchFundedEvent = + IdlEvents["LaunchFundedEvent"]; +export type v0_6_0_LaunchInitializedEvent = + IdlEvents["LaunchInitializedEvent"]; +export type v0_6_0_LaunchRefundedEvent = + IdlEvents["LaunchRefundedEvent"]; +export type v0_6_0_LaunchStartedEvent = + IdlEvents["LaunchStartedEvent"]; +export type v0_6_0_LaunchCloseEvent = + IdlEvents["LaunchCloseEvent"]; +export type v0_6_0_LaunchpadEvent = + | v0_6_0_LaunchClaimEvent + | v0_6_0_LaunchCompletedEvent + | v0_6_0_LaunchFundedEvent + | v0_6_0_LaunchInitializedEvent + | v0_6_0_LaunchRefundedEvent + | v0_6_0_LaunchStartedEvent + | v0_6_0_LaunchCloseEvent; diff --git a/sdk/src/v0.7/types/launchpad.ts b/sdk/src/launchpad/v0.6/types/launchpad.ts similarity index 100% rename from sdk/src/v0.7/types/launchpad.ts rename to sdk/src/launchpad/v0.6/types/launchpad.ts diff --git a/sdk/src/v0.6/types/v0.6.0-launchpad.ts b/sdk/src/launchpad/v0.6/types/v0.6.0-launchpad.ts similarity index 100% rename from sdk/src/v0.6/types/v0.6.0-launchpad.ts rename to sdk/src/launchpad/v0.6/types/v0.6.0-launchpad.ts diff --git a/sdk/src/v0.7/LaunchpadClient.ts b/sdk/src/launchpad/v0.7/LaunchpadClient.ts similarity index 94% rename from sdk/src/v0.7/LaunchpadClient.ts rename to sdk/src/launchpad/v0.7/LaunchpadClient.ts index 70c31f45c..c2f4910ad 100644 --- a/sdk/src/v0.7/LaunchpadClient.ts +++ b/sdk/src/launchpad/v0.7/LaunchpadClient.ts @@ -1,7 +1,6 @@ import { AnchorProvider, Program } from "@coral-xyz/anchor"; import { PublicKey, - Keypair, AccountInfo, ComputeBudgetProgram, SystemProgram, @@ -11,26 +10,17 @@ import { IDL as LaunchpadIDL, } from "./types/launchpad_v7.js"; import { - LAUNCHPAD_PROGRAM_ID, - RAYDIUM_AUTHORITY, - LOW_FEE_RAYDIUM_CONFIG, - RAYDIUM_CP_SWAP_PROGRAM_ID, - RAYDIUM_CREATE_POOL_FEE_RECEIVE, - DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID, - DEVNET_RAYDIUM_AUTHORITY, - DEVNET_LOW_FEE_RAYDIUM_CONFIG, - DEVNET_RAYDIUM_CREATE_POOL_FEE_RECEIVE, + LAUNCHPAD_V0_7_PROGRAM_ID, MPL_TOKEN_METADATA_PROGRAM_ID, MAINNET_USDC, - DEVNET_USDC, SQUADS_PROGRAM_ID, SQUADS_PROGRAM_CONFIG, SQUADS_PROGRAM_CONFIG_TREASURY, DAMM_V2_PROGRAM_ID, SQUADS_PROGRAM_CONFIG_TREASURY_DEVNET, - MAINNET_METEORA_CONFIG, + LAUNCHPAD_V0_7_MAINNET_METEORA_CONFIG, METADAO_MULTISIG_VAULT, -} from "./constants.js"; +} from "../../constants.js"; import { ASSOCIATED_TOKEN_PROGRAM_ID, createAssociatedTokenAccountIdempotentInstruction, @@ -41,24 +31,24 @@ import { import BN from "bn.js"; import { FundingRecord, Launch } from "./types/index.js"; import { - getDaoAddr, - getEventAuthorityAddr, getFundingRecordAddr, getLaunchAddr, getLaunchSignerAddr, - getMetadataAddr, - getPerformancePackageAddr, -} from "./utils/pda.js"; -import { FutarchyClient } from "./FutarchyClient.js"; -import * as anchor from "@coral-xyz/anchor"; +} from "./pda.js"; +import { getEventAuthorityAddr, getMetadataAddr } from "../../pda.js"; + +import { FutarchyClient, getDaoAddr } from "../../futarchy/v0.6/index.js"; import * as multisig from "@sqds/multisig"; -import { PriceBasedPerformancePackageClient } from "./PriceBasedPerformancePackageClient.js"; -import { BidWallClient } from "./BidWallClient.js"; +import { + PriceBasedPerformancePackageClient, + getPerformancePackageAddr, +} from "../../price_based_performance_package/v0.6/index.js"; +import { BidWallClient } from "../../bid_wall/v0.7/index.js"; export type CreateLaunchpadClientParams = { provider: AnchorProvider; launchpadProgramId?: PublicKey; - autocratProgramId?: PublicKey; + futarchyProgramId?: PublicKey; conditionalVaultProgramId?: PublicKey; priceBasedUnlockProgramId?: PublicKey; bidWallProgramId?: PublicKey; @@ -67,7 +57,7 @@ export type CreateLaunchpadClientParams = { export class LaunchpadClient { public launchpad: Program; public provider: AnchorProvider; - public autocratClient: FutarchyClient; + public futarchyClient: FutarchyClient; public priceBasedUnlock: PriceBasedPerformancePackageClient; public bidWall: BidWallClient; @@ -75,12 +65,12 @@ export class LaunchpadClient { this.provider = params.provider; this.launchpad = new Program( LaunchpadIDL, - params.launchpadProgramId || LAUNCHPAD_PROGRAM_ID, + params.launchpadProgramId || LAUNCHPAD_V0_7_PROGRAM_ID, this.provider, ); - this.autocratClient = FutarchyClient.createClient({ + this.futarchyClient = FutarchyClient.createClient({ provider: this.provider, - autocratProgramId: params.autocratProgramId, + futarchyProgramId: params.futarchyProgramId, conditionalVaultProgramId: params.conditionalVaultProgramId, }); this.priceBasedUnlock = PriceBasedPerformancePackageClient.createClient({ @@ -297,7 +287,7 @@ export class LaunchpadClient { baseMint, launchAuthority, isDevnet = false, - meteoraConfig = MAINNET_METEORA_CONFIG, + meteoraConfig = LAUNCHPAD_V0_7_MAINNET_METEORA_CONFIG, feeRecipient = METADAO_MULTISIG_VAULT, }: { launch: PublicKey; @@ -328,7 +318,7 @@ export class LaunchpadClient { }); const [futarchyEventAuthority] = getEventAuthorityAddr( - this.autocratClient.getProgramId(), + this.futarchyClient.getProgramId(), ); const [tokenMetadata] = getMetadataAddr(baseMint); @@ -352,7 +342,7 @@ export class LaunchpadClient { const [ammPosition] = PublicKey.findProgramAddressSync( [Buffer.from("amm_position"), dao.toBuffer(), multisigVault.toBuffer()], - this.autocratClient.getProgramId(), + this.futarchyClient.getProgramId(), ); const [performancePackage] = getPerformancePackageAddr({ @@ -371,7 +361,7 @@ export class LaunchpadClient { const [positionNftMint] = PublicKey.findProgramAddressSync( [Buffer.from("position_nft_mint"), baseMint.toBuffer()], - LAUNCHPAD_PROGRAM_ID, + LAUNCHPAD_V0_7_PROGRAM_ID, ); const [positionNftAccount] = PublicKey.findProgramAddressSync( @@ -426,7 +416,7 @@ export class LaunchpadClient { const [poolCreatorAuthority] = PublicKey.findProgramAddressSync( [Buffer.from("damm_pool_creator_authority")], - LAUNCHPAD_PROGRAM_ID, + LAUNCHPAD_V0_7_PROGRAM_ID, ); const [dammV2EventAuthority] = getEventAuthorityAddr(DAMM_V2_PROGRAM_ID); @@ -467,7 +457,7 @@ export class LaunchpadClient { true, ), staticAccounts: { - futarchyProgram: this.autocratClient.getProgramId(), + futarchyProgram: this.futarchyClient.getProgramId(), tokenMetadataProgram: MPL_TOKEN_METADATA_PROGRAM_ID, futarchyEventAuthority, squadsProgram: SQUADS_PROGRAM_ID, diff --git a/sdk/src/launchpad/v0.7/index.ts b/sdk/src/launchpad/v0.7/index.ts new file mode 100644 index 000000000..b5b9717d0 --- /dev/null +++ b/sdk/src/launchpad/v0.7/index.ts @@ -0,0 +1,3 @@ +export * from "./types/index.js"; +export * from "./pda.js"; +export * from "./LaunchpadClient.js"; diff --git a/sdk/src/launchpad/v0.7/pda.ts b/sdk/src/launchpad/v0.7/pda.ts new file mode 100644 index 000000000..b931cc1fb --- /dev/null +++ b/sdk/src/launchpad/v0.7/pda.ts @@ -0,0 +1,33 @@ +import { PublicKey } from "@solana/web3.js"; +import { LAUNCHPAD_V0_7_PROGRAM_ID } from "../../constants.js"; + +export function getLaunchAddr( + programId: PublicKey = LAUNCHPAD_V0_7_PROGRAM_ID, + tokenMint: PublicKey, +): [PublicKey, number] { + return PublicKey.findProgramAddressSync( + [Buffer.from("launch"), tokenMint.toBuffer()], + programId, + ); +} + +export const getLaunchSignerAddr = ( + programId: PublicKey = LAUNCHPAD_V0_7_PROGRAM_ID, + launch: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [Buffer.from("launch_signer"), launch.toBuffer()], + programId, + ); +}; + +export const getFundingRecordAddr = ( + programId: PublicKey = LAUNCHPAD_V0_7_PROGRAM_ID, + launch: PublicKey, + funder: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [Buffer.from("funding_record"), launch.toBuffer(), funder.toBuffer()], + programId, + ); +}; diff --git a/sdk/src/launchpad/v0.7/types/index.ts b/sdk/src/launchpad/v0.7/types/index.ts new file mode 100644 index 000000000..7e63bbfc3 --- /dev/null +++ b/sdk/src/launchpad/v0.7/types/index.ts @@ -0,0 +1,40 @@ +import type { IdlAccounts, IdlEvents } from "@coral-xyz/anchor"; + +import { + LaunchpadV7 as LaunchpadProgram, + IDL as LaunchpadIDL, +} from "./launchpad_v7.js"; +export { LaunchpadProgram, LaunchpadIDL }; + +export type Launch = IdlAccounts["launch"]; +export type FundingRecord = IdlAccounts["fundingRecord"]; + +export type LaunchClaimEvent = IdlEvents["LaunchClaimEvent"]; +export type LaunchCompletedEvent = + IdlEvents["LaunchCompletedEvent"]; +export type LaunchFundedEvent = + IdlEvents["LaunchFundedEvent"]; +export type LaunchInitializedEvent = + IdlEvents["LaunchInitializedEvent"]; +export type LaunchRefundedEvent = + IdlEvents["LaunchRefundedEvent"]; +export type LaunchStartedEvent = + IdlEvents["LaunchStartedEvent"]; +export type LaunchCloseEvent = IdlEvents["LaunchCloseEvent"]; +export type FundingRecordApprovalSetEvent = + IdlEvents["FundingRecordApprovalSetEvent"]; +export type LaunchClaimAdditionalTokenAllocationEvent = + IdlEvents["LaunchClaimAdditionalTokenAllocationEvent"]; +export type LaunchPerformancePackageInitializedEvent = + IdlEvents["LaunchPerformancePackageInitializedEvent"]; +export type LaunchpadEvent = + | LaunchClaimEvent + | LaunchCompletedEvent + | LaunchFundedEvent + | LaunchInitializedEvent + | LaunchRefundedEvent + | LaunchStartedEvent + | LaunchCloseEvent + | FundingRecordApprovalSetEvent + | LaunchClaimAdditionalTokenAllocationEvent + | LaunchPerformancePackageInitializedEvent; diff --git a/sdk/src/v0.7/types/launchpad_v7.ts b/sdk/src/launchpad/v0.7/types/launchpad_v7.ts similarity index 100% rename from sdk/src/v0.7/types/launchpad_v7.ts rename to sdk/src/launchpad/v0.7/types/launchpad_v7.ts diff --git a/sdk/src/liquidation/index.ts b/sdk/src/liquidation/index.ts new file mode 100644 index 000000000..6b187d27b --- /dev/null +++ b/sdk/src/liquidation/index.ts @@ -0,0 +1 @@ +export * from "./v0.7/index.js"; diff --git a/sdk/src/v0.7/LiquidationClient.ts b/sdk/src/liquidation/v0.7/LiquidationClient.ts similarity index 96% rename from sdk/src/v0.7/LiquidationClient.ts rename to sdk/src/liquidation/v0.7/LiquidationClient.ts index 1c0724330..68f1c5db7 100644 --- a/sdk/src/v0.7/LiquidationClient.ts +++ b/sdk/src/liquidation/v0.7/LiquidationClient.ts @@ -6,18 +6,15 @@ import { getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID, } from "@solana/spl-token"; -import { LIQUIDATION_PROGRAM_ID } from "../v0.7/constants.js"; +import { LIQUIDATION_V0_7_PROGRAM_ID } from "../../constants.js"; import { LiquidationProgram, LiquidationIDL, LiquidationAccount, RefundRecordAccount, -} from "../v0.7/types/index.js"; -import { - getLiquidationAddr, - getRefundRecordAddr, - getEventAuthorityAddr, -} from "../v0.7/utils/pda.js"; +} from "./types/index.js"; +import { getLiquidationAddr, getRefundRecordAddr } from "./pda.js"; +import { getEventAuthorityAddr } from "../../pda.js"; export type CreateLiquidationClientParams = { provider: AnchorProvider; @@ -46,7 +43,7 @@ export class LiquidationClient { return new LiquidationClient( provider, - liquidationProgramId || LIQUIDATION_PROGRAM_ID, + liquidationProgramId || LIQUIDATION_V0_7_PROGRAM_ID, ); } diff --git a/sdk/src/liquidation/v0.7/index.ts b/sdk/src/liquidation/v0.7/index.ts new file mode 100644 index 000000000..92572d404 --- /dev/null +++ b/sdk/src/liquidation/v0.7/index.ts @@ -0,0 +1,3 @@ +export * from "./types/index.js"; +export * from "./pda.js"; +export * from "./LiquidationClient.js"; diff --git a/sdk/src/liquidation/v0.7/pda.ts b/sdk/src/liquidation/v0.7/pda.ts new file mode 100644 index 000000000..4a885352b --- /dev/null +++ b/sdk/src/liquidation/v0.7/pda.ts @@ -0,0 +1,43 @@ +import { PublicKey } from "@solana/web3.js"; +import { LIQUIDATION_V0_7_PROGRAM_ID } from "../../constants.js"; + +export const getLiquidationAddr = ({ + programId = LIQUIDATION_V0_7_PROGRAM_ID, + baseMint, + quoteMint, + createKey, +}: { + programId?: PublicKey; + baseMint: PublicKey; + quoteMint: PublicKey; + createKey: PublicKey; +}) => { + return PublicKey.findProgramAddressSync( + [ + Buffer.from("liquidation"), + baseMint.toBuffer(), + quoteMint.toBuffer(), + createKey.toBuffer(), + ], + programId, + ); +}; + +export const getRefundRecordAddr = ({ + programId = LIQUIDATION_V0_7_PROGRAM_ID, + liquidation, + recipient, +}: { + programId?: PublicKey; + liquidation: PublicKey; + recipient: PublicKey; +}) => { + return PublicKey.findProgramAddressSync( + [ + Buffer.from("refund_record"), + liquidation.toBuffer(), + recipient.toBuffer(), + ], + programId, + ); +}; diff --git a/sdk/src/liquidation/v0.7/types/index.ts b/sdk/src/liquidation/v0.7/types/index.ts new file mode 100644 index 000000000..65cd7e412 --- /dev/null +++ b/sdk/src/liquidation/v0.7/types/index.ts @@ -0,0 +1,12 @@ +import { IdlAccounts } from "@coral-xyz/anchor"; + +import { + Liquidation as LiquidationProgram, + IDL as LiquidationIDL, +} from "./liquidation.js"; + +export { LiquidationProgram, LiquidationIDL }; + +export type LiquidationAccount = IdlAccounts["liquidation"]; +export type RefundRecordAccount = + IdlAccounts["refundRecord"]; diff --git a/sdk/src/v0.7/types/liquidation.ts b/sdk/src/liquidation/v0.7/types/liquidation.ts similarity index 100% rename from sdk/src/v0.7/types/liquidation.ts rename to sdk/src/liquidation/v0.7/types/liquidation.ts diff --git a/sdk/src/mint_governor/index.ts b/sdk/src/mint_governor/index.ts new file mode 100644 index 000000000..6b187d27b --- /dev/null +++ b/sdk/src/mint_governor/index.ts @@ -0,0 +1 @@ +export * from "./v0.7/index.js"; diff --git a/sdk/src/v0.7/MintGovernorClient.ts b/sdk/src/mint_governor/v0.7/MintGovernorClient.ts similarity index 96% rename from sdk/src/v0.7/MintGovernorClient.ts rename to sdk/src/mint_governor/v0.7/MintGovernorClient.ts index b23689866..78f070135 100644 --- a/sdk/src/v0.7/MintGovernorClient.ts +++ b/sdk/src/mint_governor/v0.7/MintGovernorClient.ts @@ -1,8 +1,8 @@ import { AnchorProvider, Program } from "@coral-xyz/anchor"; import { AccountInfo, PublicKey } from "@solana/web3.js"; import { TOKEN_PROGRAM_ID } from "@solana/spl-token"; -import { MINT_GOVERNOR_PROGRAM_ID } from "./constants.js"; -import { getMintGovernorAddr, getMintAuthorityAddr } from "./utils/pda.js"; +import { MINT_GOVERNOR_V0_7_PROGRAM_ID } from "../../constants.js"; +import { getMintGovernorAddr, getMintAuthorityAddr } from "./pda.js"; import BN from "bn.js"; import { MintGovernor as MintGovernorProgram, @@ -39,7 +39,7 @@ export class MintGovernorClient { const { provider, programId } = params; return new MintGovernorClient( provider, - programId || MINT_GOVERNOR_PROGRAM_ID, + programId || MINT_GOVERNOR_V0_7_PROGRAM_ID, ); } diff --git a/sdk/src/mint_governor/v0.7/index.ts b/sdk/src/mint_governor/v0.7/index.ts new file mode 100644 index 000000000..ad86e24c4 --- /dev/null +++ b/sdk/src/mint_governor/v0.7/index.ts @@ -0,0 +1,3 @@ +export * from "./types/index.js"; +export * from "./pda.js"; +export * from "./MintGovernorClient.js"; diff --git a/sdk/src/mint_governor/v0.7/pda.ts b/sdk/src/mint_governor/v0.7/pda.ts new file mode 100644 index 000000000..9bc4247af --- /dev/null +++ b/sdk/src/mint_governor/v0.7/pda.ts @@ -0,0 +1,36 @@ +import { PublicKey } from "@solana/web3.js"; +import { MINT_GOVERNOR_V0_7_PROGRAM_ID } from "../../constants.js"; + +export const getMintGovernorAddr = ({ + programId = MINT_GOVERNOR_V0_7_PROGRAM_ID, + mint, + createKey, +}: { + programId?: PublicKey; + mint: PublicKey; + createKey: PublicKey; +}) => { + return PublicKey.findProgramAddressSync( + [Buffer.from("mint_governor"), mint.toBuffer(), createKey.toBuffer()], + programId, + ); +}; + +export const getMintAuthorityAddr = ({ + programId = MINT_GOVERNOR_V0_7_PROGRAM_ID, + mintGovernor, + authorizedMinter, +}: { + programId?: PublicKey; + mintGovernor: PublicKey; + authorizedMinter: PublicKey; +}) => { + return PublicKey.findProgramAddressSync( + [ + Buffer.from("mint_authority"), + mintGovernor.toBuffer(), + authorizedMinter.toBuffer(), + ], + programId, + ); +}; diff --git a/sdk/src/mint_governor/v0.7/types/index.ts b/sdk/src/mint_governor/v0.7/types/index.ts new file mode 100644 index 000000000..ce730c722 --- /dev/null +++ b/sdk/src/mint_governor/v0.7/types/index.ts @@ -0,0 +1,37 @@ +import { IdlAccounts, IdlEvents } from "@coral-xyz/anchor"; +import { + MintGovernor as MintGovernorProgram, + IDL as MintGovernorIDL, +} from "./mint_governor.js"; +export { MintGovernorProgram, MintGovernorIDL }; + +export type MintGovernorAccount = + IdlAccounts["mintGovernor"]; +export type MintAuthorityAccount = + IdlAccounts["mintAuthority"]; + +export type MintGovernorInitializedEvent = + IdlEvents["MintGovernorInitializedEvent"]; +export type MintAuthorityTransferredEvent = + IdlEvents["MintAuthorityTransferredEvent"]; +export type MintAuthorityAddedEvent = + IdlEvents["MintAuthorityAddedEvent"]; +export type TokensMintedEvent = + IdlEvents["TokensMintedEvent"]; +export type MintAuthorityUpdatedEvent = + IdlEvents["MintAuthorityUpdatedEvent"]; +export type MintAuthorityRemovedEvent = + IdlEvents["MintAuthorityRemovedEvent"]; +export type MintGovernorAdminUpdatedEvent = + IdlEvents["MintGovernorAdminUpdatedEvent"]; +export type MintAuthorityReclaimedEvent = + IdlEvents["MintAuthorityReclaimedEvent"]; +export type MintGovernorEvent = + | MintGovernorInitializedEvent + | MintAuthorityTransferredEvent + | MintAuthorityAddedEvent + | TokensMintedEvent + | MintAuthorityUpdatedEvent + | MintAuthorityRemovedEvent + | MintGovernorAdminUpdatedEvent + | MintAuthorityReclaimedEvent; diff --git a/sdk/src/v0.7/types/mint_governor.ts b/sdk/src/mint_governor/v0.7/types/mint_governor.ts similarity index 100% rename from sdk/src/v0.7/types/mint_governor.ts rename to sdk/src/mint_governor/v0.7/types/mint_governor.ts diff --git a/sdk/src/pda.ts b/sdk/src/pda.ts new file mode 100644 index 000000000..cdbf9c0ae --- /dev/null +++ b/sdk/src/pda.ts @@ -0,0 +1,22 @@ +import { PublicKey } from "@solana/web3.js"; +import { utils } from "@coral-xyz/anchor"; + +import { MPL_TOKEN_METADATA_PROGRAM_ID } from "./constants.js"; + +export const getEventAuthorityAddr = (programId: PublicKey) => { + return PublicKey.findProgramAddressSync( + [Buffer.from("__event_authority")], + programId, + ); +}; + +export const getMetadataAddr = (mint: PublicKey) => { + return PublicKey.findProgramAddressSync( + [ + utils.bytes.utf8.encode("metadata"), + MPL_TOKEN_METADATA_PROGRAM_ID.toBuffer(), + mint.toBuffer(), + ], + MPL_TOKEN_METADATA_PROGRAM_ID, + ); +}; diff --git a/sdk/src/performance_package_v2/index.ts b/sdk/src/performance_package_v2/index.ts new file mode 100644 index 000000000..6b187d27b --- /dev/null +++ b/sdk/src/performance_package_v2/index.ts @@ -0,0 +1 @@ +export * from "./v0.7/index.js"; diff --git a/sdk/src/v0.7/PerformancePackageV2Client.ts b/sdk/src/performance_package_v2/v0.7/PerformancePackageV2Client.ts similarity index 96% rename from sdk/src/v0.7/PerformancePackageV2Client.ts rename to sdk/src/performance_package_v2/v0.7/PerformancePackageV2Client.ts index 597b38eb5..d70bed07c 100644 --- a/sdk/src/v0.7/PerformancePackageV2Client.ts +++ b/sdk/src/performance_package_v2/v0.7/PerformancePackageV2Client.ts @@ -7,13 +7,10 @@ import { import BN from "bn.js"; import { PERFORMANCE_PACKAGE_V2_PROGRAM_ID, - MINT_GOVERNOR_PROGRAM_ID, -} from "./constants.js"; -import { - getPerformancePackageV2Addr, - getChangeRequestV2Addr, - getEventAuthorityAddr, -} from "./utils/pda.js"; + MINT_GOVERNOR_V0_7_PROGRAM_ID, +} from "../../constants.js"; +import { getPerformancePackageV2Addr, getChangeRequestV2Addr } from "./pda.js"; +import { getEventAuthorityAddr } from "../../pda.js"; import { PerformancePackageV2 as PerformancePackageV2Program, IDL as PerformancePackageV2IDL, @@ -194,7 +191,7 @@ export class PerformancePackageV2Client { const recipientAta = getAssociatedTokenAddressSync(mint, recipient, true); const [mintGovernorEventAuthority] = getEventAuthorityAddr( - MINT_GOVERNOR_PROGRAM_ID, + MINT_GOVERNOR_V0_7_PROGRAM_ID, ); const builder = this.program.methods.completeUnlock().accounts({ @@ -205,7 +202,7 @@ export class PerformancePackageV2Client { recipientAta, signer, tokenProgram: TOKEN_PROGRAM_ID, - mintGovernorProgram: MINT_GOVERNOR_PROGRAM_ID, + mintGovernorProgram: MINT_GOVERNOR_V0_7_PROGRAM_ID, mintGovernorEventAuthority, }); diff --git a/sdk/src/performance_package_v2/v0.7/index.ts b/sdk/src/performance_package_v2/v0.7/index.ts new file mode 100644 index 000000000..b1540d6ca --- /dev/null +++ b/sdk/src/performance_package_v2/v0.7/index.ts @@ -0,0 +1,3 @@ +export * from "./types/index.js"; +export * from "./pda.js"; +export * from "./PerformancePackageV2Client.js"; diff --git a/sdk/src/performance_package_v2/v0.7/pda.ts b/sdk/src/performance_package_v2/v0.7/pda.ts new file mode 100644 index 000000000..b5caa64ce --- /dev/null +++ b/sdk/src/performance_package_v2/v0.7/pda.ts @@ -0,0 +1,37 @@ +import { PublicKey } from "@solana/web3.js"; +import { PERFORMANCE_PACKAGE_V2_PROGRAM_ID } from "../../constants.js"; + +export const getPerformancePackageV2Addr = ({ + programId = PERFORMANCE_PACKAGE_V2_PROGRAM_ID, + createKey, +}: { + programId?: PublicKey; + createKey: PublicKey; +}) => { + return PublicKey.findProgramAddressSync( + [Buffer.from("performance_package"), createKey.toBuffer()], + programId, + ); +}; + +export const getChangeRequestV2Addr = ({ + programId = PERFORMANCE_PACKAGE_V2_PROGRAM_ID, + performancePackage, + proposer, + pdaNonce, +}: { + programId?: PublicKey; + performancePackage: PublicKey; + proposer: PublicKey; + pdaNonce: number; +}) => { + return PublicKey.findProgramAddressSync( + [ + Buffer.from("change_request"), + performancePackage.toBuffer(), + proposer.toBuffer(), + Buffer.from(new Uint8Array(new Uint32Array([pdaNonce]).buffer)), + ], + programId, + ); +}; diff --git a/sdk/src/performance_package_v2/v0.7/types/index.ts b/sdk/src/performance_package_v2/v0.7/types/index.ts new file mode 100644 index 000000000..e6c7d5bd6 --- /dev/null +++ b/sdk/src/performance_package_v2/v0.7/types/index.ts @@ -0,0 +1,19 @@ +import { IdlAccounts, IdlTypes } from "@coral-xyz/anchor"; +import { + PerformancePackageV2 as PerformancePackageV2Program, + IDL as PerformancePackageV2IDL, +} from "./performance_package_v2.js"; +export { PerformancePackageV2Program, PerformancePackageV2IDL }; + +export type PerformancePackageV2Account = + IdlAccounts["performancePackage"]; +export type PerformancePackageV2ChangeRequestAccount = + IdlAccounts["changeRequest"]; +export type PerformancePackageV2OracleReader = + IdlTypes["OracleReader"]; +export type PerformancePackageV2RewardFunction = + IdlTypes["RewardFunction"]; +export type PerformancePackageV2PackageStatus = + IdlTypes["PackageStatus"]; +export type PerformancePackageV2ThresholdTranche = + IdlTypes["ThresholdTranche"]; diff --git a/sdk/src/v0.7/types/performance_package_v2.ts b/sdk/src/performance_package_v2/v0.7/types/performance_package_v2.ts similarity index 100% rename from sdk/src/v0.7/types/performance_package_v2.ts rename to sdk/src/performance_package_v2/v0.7/types/performance_package_v2.ts diff --git a/sdk/src/v0.3/utils/ammMath.ts b/sdk/src/priceMath.ts similarity index 74% rename from sdk/src/v0.3/utils/ammMath.ts rename to sdk/src/priceMath.ts index a6e542711..29ada287d 100644 --- a/sdk/src/v0.3/utils/ammMath.ts +++ b/sdk/src/priceMath.ts @@ -1,6 +1,4 @@ import BN from "bn.js"; -import { AmmAccount } from "../types/index.js"; -import { SwapType } from "../AmmClient.js"; const BN_TEN = new BN(10); const PRICE_SCALE = BN_TEN.pow(new BN(12)); @@ -14,13 +12,6 @@ export type AddLiquiditySimulation = { maxBaseAmount?: BN; }; -export type SwapSimulation = { - expectedOut: BN; - newBaseReserves: BN; - newQuoteReserves: BN; - minExpectedOut?: BN; -}; - export type RemoveLiquiditySimulation = { expectedBaseOut: BN; expectedQuoteOut: BN; @@ -69,14 +60,21 @@ export class AmmMath { baseDecimals: number, quoteDecimals: number, ): number { - let decimalScalar = BN_TEN.pow(new BN(quoteDecimals - baseDecimals).abs()); - - let price1e12 = + const decimalScalar = BN_TEN.pow( + new BN(quoteDecimals - baseDecimals).abs(), + ); + const price1e12 = quoteDecimals > baseDecimals ? ammPrice.div(decimalScalar) : ammPrice.mul(decimalScalar); - return price1e12.toNumber() / 1e12; + // in case the BN is too large to cast to number, we try + try { + return price1e12.toNumber() / 1e12; + } catch (e) { + // BN tried to cast into number larger than 53 bits so we do division via BN methods first, then cast to number + return price1e12.div(new BN(1e12)).toNumber(); + } } public static getAmmPrice( @@ -101,7 +99,6 @@ export class AmmMath { quoteDecimals: number, ...prices: number[] ): BN[] { - // Map through each price, scaling it using the scalePrice method return prices.map((price) => this.getAmmPrice(price, baseDecimals, quoteDecimals), ); @@ -109,7 +106,6 @@ export class AmmMath { public static scale(number: number, decimals: number): BN { return new BN(number * 10 ** decimals); - // return new BN(number).mul(new BN(10).pow(new BN(decimals))); } public static addSlippage(chainAmount: BN, slippageBps: BN): BN { @@ -120,10 +116,21 @@ export class AmmMath { return chainAmount.mul(new BN(10_000).sub(slippageBps)).divn(10_000); } - public static getTwap(amm: AmmAccount): BN { - return amm.oracle.aggregator.div( - amm.oracle.lastUpdatedSlot.sub(amm.createdAtSlot), - ); + public static simulateSwapInner( + inputAmount: BN, + inputReserves: BN, + outputReserves: BN, + ): BN { + if (inputReserves.eqn(0) || outputReserves.eqn(0)) { + throw new Error("reserves must be non-zero"); + } + + let inputAmountWithFee: BN = inputAmount.muln(990); + + let numerator: BN = inputAmountWithFee.mul(outputReserves); + let denominator: BN = inputReserves.muln(1000).add(inputAmountWithFee); + + return numerator.div(denominator); } public static simulateAddLiquidity( @@ -170,54 +177,6 @@ export class AmmMath { }; } - public static simulateSwap( - inputAmount: BN, - swapType: SwapType, - baseReserves: BN, - quoteReserves: BN, - slippageBps?: BN, - ): SwapSimulation { - if (baseReserves.eqn(0) || quoteReserves.eqn(0)) { - throw new Error("reserves must be non-zero"); - } - - let inputReserves, outputReserves: BN; - if (swapType.buy) { - inputReserves = quoteReserves; - outputReserves = baseReserves; - } else { - inputReserves = baseReserves; - outputReserves = quoteReserves; - } - - let inputAmountWithFee: BN = inputAmount.muln(990); - - let numerator: BN = inputAmountWithFee.mul(outputReserves); - let denominator: BN = inputReserves.muln(1000).add(inputAmountWithFee); - - let expectedOut = numerator.div(denominator); - let minExpectedOut; - if (slippageBps) { - minExpectedOut = AmmMath.subtractSlippage(expectedOut, slippageBps); - } - - let newBaseReserves, newQuoteReserves: BN; - if (swapType.buy) { - newBaseReserves = baseReserves.sub(expectedOut); - newQuoteReserves = quoteReserves.add(inputAmount); - } else { - newBaseReserves = baseReserves.add(inputAmount); - newQuoteReserves = quoteReserves.sub(expectedOut); - } - - return { - expectedOut, - newBaseReserves, - newQuoteReserves, - minExpectedOut, - }; - } - public static simulateRemoveLiquidity( lpTokensToBurn: BN, baseReserves: BN, @@ -245,5 +204,4 @@ export class AmmMath { } } -// Add backwards compatibility alias export { AmmMath as PriceMath }; diff --git a/sdk/src/price_based_performance_package/index.ts b/sdk/src/price_based_performance_package/index.ts new file mode 100644 index 000000000..f77abe821 --- /dev/null +++ b/sdk/src/price_based_performance_package/index.ts @@ -0,0 +1 @@ +export * from "./v0.6/index.js"; diff --git a/sdk/src/v0.7/PriceBasedPerformancePackageClient.ts b/sdk/src/price_based_performance_package/v0.6/PriceBasedPerformancePackageClient.ts similarity index 96% rename from sdk/src/v0.7/PriceBasedPerformancePackageClient.ts rename to sdk/src/price_based_performance_package/v0.6/PriceBasedPerformancePackageClient.ts index 116319323..389150a27 100644 --- a/sdk/src/v0.7/PriceBasedPerformancePackageClient.ts +++ b/sdk/src/price_based_performance_package/v0.6/PriceBasedPerformancePackageClient.ts @@ -14,14 +14,11 @@ import { PriceBasedPerformancePackage, IDL as PriceBasedPerformancePackageIDL, } from "./types/price_based_performance_package.js"; -import { PRICE_BASED_PERFORMANCE_PACKAGE_PROGRAM_ID } from "./constants.js"; +import { PRICE_BASED_PERFORMANCE_PACKAGE_PROGRAM_ID } from "../../constants.js"; import BN from "bn.js"; // import { OracleConfig } from "./types/index.js"; -import { - getChangeRequestAddr, - getEventAuthorityAddr, - getPerformancePackageAddr, -} from "./utils/pda.js"; +import { getChangeRequestAddr, getPerformancePackageAddr } from "./pda.js"; +import { getEventAuthorityAddr } from "../../pda.js"; import { InitializePerformancePackageParams } from "./types/index.js"; export type CreatePriceBasedPerformancePackageClientParams = { diff --git a/sdk/src/price_based_performance_package/v0.6/index.ts b/sdk/src/price_based_performance_package/v0.6/index.ts new file mode 100644 index 000000000..4b649117c --- /dev/null +++ b/sdk/src/price_based_performance_package/v0.6/index.ts @@ -0,0 +1,3 @@ +export * from "./types/index.js"; +export * from "./pda.js"; +export * from "./PriceBasedPerformancePackageClient.js"; diff --git a/sdk/src/price_based_performance_package/v0.6/pda.ts b/sdk/src/price_based_performance_package/v0.6/pda.ts new file mode 100644 index 000000000..910b8577d --- /dev/null +++ b/sdk/src/price_based_performance_package/v0.6/pda.ts @@ -0,0 +1,38 @@ +import { PublicKey } from "@solana/web3.js"; + +import { PRICE_BASED_PERFORMANCE_PACKAGE_PROGRAM_ID } from "../../constants.js"; + +export const getPerformancePackageAddr = ({ + programId = PRICE_BASED_PERFORMANCE_PACKAGE_PROGRAM_ID, + createKey, +}: { + programId?: PublicKey; + createKey: PublicKey; +}) => { + return PublicKey.findProgramAddressSync( + [Buffer.from("performance_package"), createKey.toBuffer()], + programId, + ); +}; + +export const getChangeRequestAddr = ({ + programId = PRICE_BASED_PERFORMANCE_PACKAGE_PROGRAM_ID, + performancePackage, + proposer, + pdaNonce, +}: { + programId?: PublicKey; + performancePackage: PublicKey; + proposer: PublicKey; + pdaNonce: number; +}) => { + return PublicKey.findProgramAddressSync( + [ + Buffer.from("change_request"), + performancePackage.toBuffer(), + proposer.toBuffer(), + Buffer.from(new Uint8Array(new Uint32Array([pdaNonce]).buffer)), + ], + programId, + ); +}; diff --git a/sdk/src/price_based_performance_package/v0.6/types/index.ts b/sdk/src/price_based_performance_package/v0.6/types/index.ts new file mode 100644 index 000000000..25186353e --- /dev/null +++ b/sdk/src/price_based_performance_package/v0.6/types/index.ts @@ -0,0 +1,35 @@ +import { IdlAccounts, IdlEvents, IdlTypes } from "@coral-xyz/anchor"; + +import { + PriceBasedPerformancePackage as PriceBasedPerformancePackageProgram, + IDL as PriceBasedPerformancePackageIDL, +} from "./price_based_performance_package.js"; +export { PriceBasedPerformancePackageProgram, PriceBasedPerformancePackageIDL }; + +export type InitializePerformancePackageParams = + IdlTypes["InitializePerformancePackageParams"]; +export type PerformancePackage = + IdlAccounts["performancePackage"]; +export type OracleConfig = + IdlTypes["OracleConfig"]; +export type Tranche = IdlTypes["Tranche"]; + +export type PerformancePackageInitializedEvent = + IdlEvents["PerformancePackageInitialized"]; +export type UnlockStartedEvent = + IdlEvents["UnlockStarted"]; +export type UnlockCompletedEvent = + IdlEvents["UnlockCompleted"]; +export type ChangeProposedEvent = + IdlEvents["ChangeProposed"]; +export type ChangeExecutedEvent = + IdlEvents["ChangeExecuted"]; +export type PerformancePackageAuthorityChangedEvent = + IdlEvents["PerformancePackageAuthorityChanged"]; +export type PriceBasedPerformancePackageEvent = + | PerformancePackageInitializedEvent + | UnlockStartedEvent + | UnlockCompletedEvent + | ChangeProposedEvent + | ChangeExecutedEvent + | PerformancePackageAuthorityChangedEvent; diff --git a/sdk/src/v0.7/types/price_based_performance_package.ts b/sdk/src/price_based_performance_package/v0.6/types/price_based_performance_package.ts similarity index 100% rename from sdk/src/v0.7/types/price_based_performance_package.ts rename to sdk/src/price_based_performance_package/v0.6/types/price_based_performance_package.ts diff --git a/sdk/src/shared_liquidity_manager/index.ts b/sdk/src/shared_liquidity_manager/index.ts new file mode 100644 index 000000000..6ef9c15e5 --- /dev/null +++ b/sdk/src/shared_liquidity_manager/index.ts @@ -0,0 +1 @@ +export * from "./v0.5/index.js"; diff --git a/sdk/src/v0.5/SharedLiquidityManagerClient.ts b/sdk/src/shared_liquidity_manager/v0.5/SharedLiquidityManagerClient.ts similarity index 97% rename from sdk/src/v0.5/SharedLiquidityManagerClient.ts rename to sdk/src/shared_liquidity_manager/v0.5/SharedLiquidityManagerClient.ts index d1715dbf9..367075bd1 100644 --- a/sdk/src/v0.5/SharedLiquidityManagerClient.ts +++ b/sdk/src/shared_liquidity_manager/v0.5/SharedLiquidityManagerClient.ts @@ -29,27 +29,29 @@ import { SHARED_LIQUIDITY_MANAGER_PROGRAM_ID, RAYDIUM_CP_SWAP_PROGRAM_ID, RAYDIUM_AUTHORITY, - CONDITIONAL_VAULT_PROGRAM_ID, - AMM_PROGRAM_ID, - AUTOCRAT_PROGRAM_ID, + CONDITIONAL_VAULT_V0_4_PROGRAM_ID, + AMM_V0_5_PROGRAM_ID, + AUTOCRAT_V0_5_PROGRAM_ID, LOW_FEE_RAYDIUM_CONFIG, RAYDIUM_CREATE_POOL_FEE_RECEIVE, -} from "./constants.js"; +} from "../../constants.js"; import { getSharedLiquidityPoolAddr, getRaydiumCpmmPoolVaultAddr, getRaydiumCpmmLpMintAddr, - getEventAuthorityAddr, - getDaoTreasuryAddr, - getProposalAddr, getRaydiumCpmmObservationStateAddr, getSharedLiquidityPoolSignerAddr, getSpotPoolAddr, getDraftProposalAddr, getStakeRecordAddr, getSlPoolPositionAddr, -} from "./utils/pda.js"; -import { AutocratClient } from "./AutocratClient.js"; +} from "./pda.js"; +import { getEventAuthorityAddr } from "../../pda.js"; +import { + getDaoTreasuryAddr, + getProposalAddr, +} from "../../autocrat/v0.5/pda.js"; +import { AutocratClient } from "../../autocrat/v0.5/AutocratClient.js"; export type CreateSharedLiquidityManagerClientParams = { provider: AnchorProvider; @@ -463,7 +465,7 @@ export class SharedLiquidityManagerClient { // quoteVault, // true // ), - // conditionalVaultProgram: CONDITIONAL_VAULT_PROGRAM_ID, + // conditionalVaultProgram: CONDITIONAL_VAULT_v0_4_PROGRAM_ID, // passBaseMint, // failBaseMint, // passQuoteMint, @@ -489,7 +491,7 @@ export class SharedLiquidityManagerClient { // true // ), // vaultEventAuthority: getEventAuthorityAddr( - // CONDITIONAL_VAULT_PROGRAM_ID + // CONDITIONAL_VAULT_v0_4_PROGRAM_ID // )[0], // }, // amm: { @@ -542,9 +544,9 @@ export class SharedLiquidityManagerClient { // eventAuthority: getEventAuthorityAddr(AMM_PROGRAM_ID)[0], // slPoolSigner, // }, - // autocratEventAuthority: getEventAuthorityAddr(AUTOCRAT_PROGRAM_ID)[0], + // autocratEventAuthority: getEventAuthorityAddr(AUTOCRAT_V0_5_PROGRAM_ID)[0], // dao, - // autocratProgram: AUTOCRAT_PROGRAM_ID, + // autocratProgram: AUTOCRAT_V0_5_PROGRAM_ID, // systemProgram: SystemProgram.programId, // }); // } @@ -788,7 +790,7 @@ export class SharedLiquidityManagerClient { // quoteVault, // true // ), - // conditionalVaultProgram: CONDITIONAL_VAULT_PROGRAM_ID, + // conditionalVaultProgram: CONDITIONAL_VAULT_v0_4_PROGRAM_ID, // passBaseMint, // failBaseMint, // passQuoteMint, @@ -814,7 +816,7 @@ export class SharedLiquidityManagerClient { // true // ), // vaultEventAuthority: getEventAuthorityAddr( - // CONDITIONAL_VAULT_PROGRAM_ID + // CONDITIONAL_VAULT_v0_4_PROGRAM_ID // )[0], // tokenProgram: TOKEN_PROGRAM_ID, // slPoolSigner, diff --git a/sdk/src/shared_liquidity_manager/v0.5/index.ts b/sdk/src/shared_liquidity_manager/v0.5/index.ts new file mode 100644 index 000000000..e79f94bbc --- /dev/null +++ b/sdk/src/shared_liquidity_manager/v0.5/index.ts @@ -0,0 +1,3 @@ +export * from "./types/index.js"; +export * from "./pda.js"; +export * from "./SharedLiquidityManagerClient.js"; diff --git a/sdk/src/shared_liquidity_manager/v0.5/pda.ts b/sdk/src/shared_liquidity_manager/v0.5/pda.ts new file mode 100644 index 000000000..a53de20d6 --- /dev/null +++ b/sdk/src/shared_liquidity_manager/v0.5/pda.ts @@ -0,0 +1,126 @@ +import { PublicKey } from "@solana/web3.js"; +import { utils } from "@coral-xyz/anchor"; +import BN from "bn.js"; +import { + SHARED_LIQUIDITY_MANAGER_PROGRAM_ID, + RAYDIUM_CP_SWAP_PROGRAM_ID, + DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID, +} from "../../constants.js"; + +export const getSharedLiquidityPoolAddr = ( + programId: PublicKey = SHARED_LIQUIDITY_MANAGER_PROGRAM_ID, + dao: PublicKey, + creator: PublicKey, + proposalStakeRateThresholdBps: number, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [ + Buffer.from("sl_pool"), + dao.toBuffer(), + creator.toBuffer(), + new BN(proposalStakeRateThresholdBps).toArrayLike(Buffer, "le", 2), + ], + programId, + ); +}; + +export const getSlPoolPositionAddr = ( + programId: PublicKey = SHARED_LIQUIDITY_MANAGER_PROGRAM_ID, + slPool: PublicKey, + user: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [Buffer.from("sl_pool_position"), slPool.toBuffer(), user.toBuffer()], + programId, + ); +}; + +export const getSharedLiquidityPoolSignerAddr = ( + programId: PublicKey = SHARED_LIQUIDITY_MANAGER_PROGRAM_ID, + slPool: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [Buffer.from("sl_pool_signer"), slPool.toBuffer()], + programId, + ); +}; + +export const getSpotPoolAddr = ( + programId: PublicKey = SHARED_LIQUIDITY_MANAGER_PROGRAM_ID, + slPool: PublicKey, + index: number, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [ + utils.bytes.utf8.encode("spot_pool"), + slPool.toBuffer(), + new BN(index).toArrayLike(Buffer, "le", 4), + ], + programId, + ); +}; + +export const getDraftProposalAddr = ( + programId: PublicKey = SHARED_LIQUIDITY_MANAGER_PROGRAM_ID, + nonce: BN, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [Buffer.from("draft_proposal"), nonce.toArrayLike(Buffer, "le", 8)], + programId, + ); +}; + +export const getStakeRecordAddr = ( + programId: PublicKey = SHARED_LIQUIDITY_MANAGER_PROGRAM_ID, + draftProposal: PublicKey, + staker: PublicKey, +): [PublicKey, number] => { + return PublicKey.findProgramAddressSync( + [Buffer.from("stake_record"), draftProposal.toBuffer(), staker.toBuffer()], + programId, + ); +}; + +export const getRaydiumCpmmPoolVaultAddr = ( + poolState: PublicKey, + token: PublicKey, + isDevnet: boolean, +): [PublicKey, number] => { + const programId = isDevnet + ? DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID + : RAYDIUM_CP_SWAP_PROGRAM_ID; + return PublicKey.findProgramAddressSync( + [ + utils.bytes.utf8.encode("pool_vault"), + poolState.toBuffer(), + token.toBuffer(), + ], + programId, + ); +}; + +export const getRaydiumCpmmObservationStateAddr = ( + poolState: PublicKey, + isDevnet: boolean, +): [PublicKey, number] => { + const programId = isDevnet + ? DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID + : RAYDIUM_CP_SWAP_PROGRAM_ID; + return PublicKey.findProgramAddressSync( + [utils.bytes.utf8.encode("observation"), poolState.toBuffer()], + programId, + ); +}; + +export const getRaydiumCpmmLpMintAddr = ( + poolState: PublicKey, + isDevnet: boolean, +): [PublicKey, number] => { + const programId = isDevnet + ? DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID + : RAYDIUM_CP_SWAP_PROGRAM_ID; + return PublicKey.findProgramAddressSync( + [Buffer.from("pool_lp_mint"), poolState.toBuffer()], + programId, + ); +}; diff --git a/sdk/src/shared_liquidity_manager/v0.5/types/index.ts b/sdk/src/shared_liquidity_manager/v0.5/types/index.ts new file mode 100644 index 000000000..8a508c696 --- /dev/null +++ b/sdk/src/shared_liquidity_manager/v0.5/types/index.ts @@ -0,0 +1,5 @@ +import { + SharedLiquidityManager as SharedLiquidityManagerProgram, + IDL as SharedLiquidityManagerIDL, +} from "./shared_liquidity_manager.js"; +export { SharedLiquidityManagerProgram, SharedLiquidityManagerIDL }; diff --git a/sdk/src/v0.5/types/shared_liquidity_manager.ts b/sdk/src/shared_liquidity_manager/v0.5/types/shared_liquidity_manager.ts similarity index 100% rename from sdk/src/v0.5/types/shared_liquidity_manager.ts rename to sdk/src/shared_liquidity_manager/v0.5/types/shared_liquidity_manager.ts diff --git a/sdk/src/v0.5/utils/instruction.ts b/sdk/src/utils.ts similarity index 83% rename from sdk/src/v0.5/utils/instruction.ts rename to sdk/src/utils.ts index f18e48834..2b3348db6 100644 --- a/sdk/src/v0.5/utils/instruction.ts +++ b/sdk/src/utils.ts @@ -1,6 +1,9 @@ -import * as anchor from "@coral-xyz/anchor"; import { TransactionInstruction } from "@solana/web3.js"; +export type LowercaseKeys = { + [K in keyof T as Lowercase]: T[K]; +}; + export class InstructionUtils { public static async getInstructions( ...methodBuilders: any[] diff --git a/sdk/src/v0.3/FutarchyClient.ts b/sdk/src/v0.3/FutarchyClient.ts deleted file mode 100644 index e30f7a7db..000000000 --- a/sdk/src/v0.3/FutarchyClient.ts +++ /dev/null @@ -1,146 +0,0 @@ -import { AnchorProvider } from "@coral-xyz/anchor"; -import { PublicKey, Transaction } from "@solana/web3.js"; -import BN from "bn.js"; -import { AmmClient, SwapType } from "./AmmClient.js"; -import { AutocratClient } from "./AutocratClient.js"; -import { ConditionalVaultClient } from "./ConditionalVaultClient.js"; -import { - getAmmAddr, - getVaultAddr, - getVaultFinalizeMintAddr, - getVaultRevertMintAddr, -} from "./utils/pda.js"; - -export class FutarchyClient { - public readonly provider: AnchorProvider; - public readonly ammClient: AmmClient; - public readonly autocratClient: AutocratClient; - public readonly conditionalVaultClient: ConditionalVaultClient; - - constructor(provider: AnchorProvider) { - this.provider = provider; - this.ammClient = AmmClient.createClient({ provider }); - this.autocratClient = AutocratClient.createClient({ provider }); - this.conditionalVaultClient = ConditionalVaultClient.createClient({ - provider, - }); - } - - public static createClient({ - provider, - }: { - provider: AnchorProvider; - }): FutarchyClient { - return new FutarchyClient(provider); - } - - public async createMintAndSwapTx({ - proposal, - inputAmount, - quoteMint, - baseMint, - user, - payer, - swapType, - outcome, - conditionalAmount, - }: { - proposal: PublicKey; - inputAmount: BN; - quoteMint: PublicKey; - baseMint: PublicKey; - user: PublicKey; - payer: PublicKey; - swapType: SwapType; - outcome: "pass" | "fail"; - conditionalAmount?: BN; - }): Promise { - const [baseVault] = getVaultAddr( - this.conditionalVaultClient.vaultProgram.programId, - proposal, - baseMint, - ); - const [quoteVault] = getVaultAddr( - this.conditionalVaultClient.vaultProgram.programId, - proposal, - quoteMint, - ); - - const [underlyingVault, underlyingTokenMint] = swapType.buy - ? [quoteVault, quoteMint] - : [baseVault, baseMint]; - - let mintTx: Transaction | undefined; - - // Check to see if we need to mint conditional tokens - // If conditionalAmount is not passed we will mint all of the input amount - // If conditionalAmount is passed we will mint the difference between the input amount and the conditional amount - if ( - !conditionalAmount || - (conditionalAmount && conditionalAmount.lt(inputAmount)) - ) { - const mintAmount = conditionalAmount - ? inputAmount.sub(conditionalAmount) - : inputAmount; - - mintTx = await this.conditionalVaultClient - .mintConditionalTokensIx( - underlyingVault, - underlyingTokenMint, - mintAmount, - user, - payer, - ) - .transaction(); - } - - const [pUSDC] = getVaultFinalizeMintAddr( - this.conditionalVaultClient.vaultProgram.programId, - quoteVault, - ); - const [pTOKE] = getVaultFinalizeMintAddr( - this.conditionalVaultClient.vaultProgram.programId, - baseVault, - ); - - const [fUSDC] = getVaultRevertMintAddr( - this.conditionalVaultClient.vaultProgram.programId, - quoteVault, - ); - const [fTOKE] = getVaultRevertMintAddr( - this.conditionalVaultClient.vaultProgram.programId, - baseVault, - ); - - const [passMarket] = getAmmAddr( - this.ammClient.program.programId, - pTOKE, - pUSDC, - ); - const [failMarket] = getAmmAddr( - this.ammClient.program.programId, - fTOKE, - fUSDC, - ); - - const [market, ammBaseMint, ammQuoteMint] = - outcome === "pass" - ? [passMarket, pTOKE, pUSDC] - : [failMarket, fTOKE, fUSDC]; - - const swapTx = await this.ammClient - .swapIx( - market, - ammBaseMint, - ammQuoteMint, - swapType, - inputAmount, - new BN(0), - user, - payer, - ) - .transaction(); - - return mintTx ? new Transaction().add(mintTx, swapTx) : swapTx; - } -} diff --git a/sdk/src/v0.3/constants.ts b/sdk/src/v0.3/constants.ts deleted file mode 100644 index 6797d5afd..000000000 --- a/sdk/src/v0.3/constants.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { PublicKey } from "@solana/web3.js"; - -export const AUTOCRAT_PROGRAM_ID = new PublicKey( - "autoQP9RmUNkzzKRXsMkWicDVZ3h29vvyMDcAYjCxxg", -); -export const AMM_PROGRAM_ID = new PublicKey( - "AMM5G2nxuKUwCLRYTW7qqEwuoqCtNSjtbipwEmm2g8bH", -); -export const CONDITIONAL_VAULT_PROGRAM_ID = new PublicKey( - "VAU1T7S5UuEHmMvXtXMVmpEoQtZ2ya7eRb7gcN47wDp", -); - -export const MPL_TOKEN_METADATA_PROGRAM_ID = new PublicKey( - "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s", -); - -export const META_MINT = new PublicKey( - "3gN1WVEJwSHNWjo7hr87DgZp6zkf8kWgAJD29DmfE2Gr", -); -export const MAINNET_USDC = new PublicKey( - "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", -); - -export const USDC_DECIMALS = 6; - -export const AUTOCRAT_LUTS: PublicKey[] = []; diff --git a/sdk/src/v0.3/index.ts b/sdk/src/v0.3/index.ts deleted file mode 100644 index 0eb16f622..000000000 --- a/sdk/src/v0.3/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from "./types/index.js"; -export * from "./utils/index.js"; -export * from "./constants.js"; -export * from "./AmmClient.js"; -export * from "./AutocratClient.js"; -export * from "./ConditionalVaultClient.js"; -export * from "./FutarchyClient.js"; diff --git a/sdk/src/v0.3/types/autocrat_migrator.ts b/sdk/src/v0.3/types/autocrat_migrator.ts deleted file mode 100644 index 676d2df3d..000000000 --- a/sdk/src/v0.3/types/autocrat_migrator.ts +++ /dev/null @@ -1,237 +0,0 @@ -export type AutocratMigrator = { - version: "0.1.0"; - name: "autocrat_migrator"; - instructions: [ - { - name: "multiTransfer2"; - accounts: [ - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "authority"; - isMut: true; - isSigner: true; - }, - { - name: "from0"; - isMut: true; - isSigner: false; - }, - { - name: "to0"; - isMut: true; - isSigner: false; - }, - { - name: "from1"; - isMut: true; - isSigner: false; - }, - { - name: "to1"; - isMut: true; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "lamportReceiver"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "multiTransfer4"; - accounts: [ - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "authority"; - isMut: true; - isSigner: true; - }, - { - name: "from0"; - isMut: true; - isSigner: false; - }, - { - name: "to0"; - isMut: true; - isSigner: false; - }, - { - name: "from1"; - isMut: true; - isSigner: false; - }, - { - name: "to1"; - isMut: true; - isSigner: false; - }, - { - name: "from2"; - isMut: true; - isSigner: false; - }, - { - name: "to2"; - isMut: true; - isSigner: false; - }, - { - name: "from3"; - isMut: true; - isSigner: false; - }, - { - name: "to3"; - isMut: true; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "lamportReceiver"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - ]; -}; - -export const IDL: AutocratMigrator = { - version: "0.1.0", - name: "autocrat_migrator", - instructions: [ - { - name: "multiTransfer2", - accounts: [ - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "authority", - isMut: true, - isSigner: true, - }, - { - name: "from0", - isMut: true, - isSigner: false, - }, - { - name: "to0", - isMut: true, - isSigner: false, - }, - { - name: "from1", - isMut: true, - isSigner: false, - }, - { - name: "to1", - isMut: true, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "lamportReceiver", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - { - name: "multiTransfer4", - accounts: [ - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "authority", - isMut: true, - isSigner: true, - }, - { - name: "from0", - isMut: true, - isSigner: false, - }, - { - name: "to0", - isMut: true, - isSigner: false, - }, - { - name: "from1", - isMut: true, - isSigner: false, - }, - { - name: "to1", - isMut: true, - isSigner: false, - }, - { - name: "from2", - isMut: true, - isSigner: false, - }, - { - name: "to2", - isMut: true, - isSigner: false, - }, - { - name: "from3", - isMut: true, - isSigner: false, - }, - { - name: "to3", - isMut: true, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "lamportReceiver", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - ], -}; diff --git a/sdk/src/v0.3/types/index.ts b/sdk/src/v0.3/types/index.ts deleted file mode 100644 index a372237a8..000000000 --- a/sdk/src/v0.3/types/index.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Autocrat } from "./autocrat.js"; -export { Autocrat, IDL as AutocratIDL } from "./autocrat.js"; - -import { Amm } from "./amm.js"; -export { Amm, IDL as AmmIDL } from "./amm.js"; - -import { ConditionalVault } from "./conditional_vault.js"; -export { - ConditionalVault, - IDL as ConditionalVaultIDL, -} from "./conditional_vault.js"; - -export { LowercaseKeys } from "./utils.js"; - -import type { IdlAccounts, IdlTypes } from "@coral-xyz/anchor"; -import { PublicKey } from "@solana/web3.js"; - -export type InitializeDaoParams = IdlTypes["InitializeDaoParams"]; -export type UpdateDaoParams = IdlTypes["UpdateDaoParams"]; -export type ProposalInstruction = IdlTypes["ProposalInstruction"]; - -export type Proposal = IdlAccounts["proposal"]; -export type ProposalWrapper = { - account: Proposal; - publicKey: PublicKey; -}; - -export type DaoAccount = IdlAccounts["dao"]; -export type ProposalAccount = IdlAccounts["proposal"]; - -export type AmmAccount = IdlAccounts["amm"]; - -export type ConditionalVaultAccount = - IdlAccounts["conditionalVault"]; diff --git a/sdk/src/v0.3/types/optimistic_timelock.ts b/sdk/src/v0.3/types/optimistic_timelock.ts deleted file mode 100644 index fa1f43135..000000000 --- a/sdk/src/v0.3/types/optimistic_timelock.ts +++ /dev/null @@ -1,1023 +0,0 @@ -export type OptimisticTimelock = { - version: "0.3.0"; - name: "optimistic_timelock"; - instructions: [ - { - name: "createTimelock"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: false; - }, - { - name: "timelock"; - isMut: true; - isSigner: true; - }, - ]; - args: [ - { - name: "authority"; - type: "publicKey"; - }, - { - name: "delayInSlots"; - type: "u64"; - }, - { - name: "enqueuers"; - type: { - vec: "publicKey"; - }; - }, - { - name: "enqueuerCooldownSlots"; - type: "u64"; - }, - ]; - }, - { - name: "setDelayInSlots"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "delayInSlots"; - type: "u64"; - }, - ]; - }, - { - name: "setAuthority"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "authority"; - type: "publicKey"; - }, - ]; - }, - { - name: "setOptimisticProposerCooldownSlots"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "cooldownSlots"; - type: "u64"; - }, - ]; - }, - { - name: "addOptimisticProposer"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "enqueuer"; - type: "publicKey"; - }, - ]; - }, - { - name: "removeOptimisticProposer"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "optimisticProposer"; - type: "publicKey"; - }, - ]; - }, - { - name: "createTransactionBatch"; - accounts: [ - { - name: "transactionBatchAuthority"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: false; - isSigner: false; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: true; - }, - ]; - args: []; - }, - { - name: "addTransaction"; - accounts: [ - { - name: "transactionBatchAuthority"; - isMut: false; - isSigner: true; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "programId"; - type: "publicKey"; - }, - { - name: "accounts"; - type: { - vec: { - defined: "TransactionAccount"; - }; - }; - }, - { - name: "data"; - type: "bytes"; - }, - ]; - }, - { - name: "sealTransactionBatch"; - accounts: [ - { - name: "transactionBatchAuthority"; - isMut: false; - isSigner: true; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "enqueueTransactionBatch"; - accounts: [ - { - name: "authority"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "cancelTransactionBatch"; - accounts: [ - { - name: "authority"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "executeTransactionBatch"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: false; - }, - { - name: "timelock"; - isMut: false; - isSigner: false; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - ]; - accounts: [ - { - name: "timelock"; - type: { - kind: "struct"; - fields: [ - { - name: "authority"; - type: "publicKey"; - }, - { - name: "signerBump"; - type: "u8"; - }, - { - name: "delayInSlots"; - type: "u64"; - }, - { - name: "optimisticProposers"; - type: { - vec: { - defined: "OptimisticProposer"; - }; - }; - }, - { - name: "optimisticProposerCooldownSlots"; - docs: [ - "The cooldown period for enqueuers to prevent spamming the timelock.", - ]; - type: "u64"; - }, - ]; - }; - }, - { - name: "transactionBatch"; - type: { - kind: "struct"; - fields: [ - { - name: "status"; - type: { - defined: "TransactionBatchStatus"; - }; - }, - { - name: "transactions"; - type: { - vec: { - defined: "Transaction"; - }; - }; - }, - { - name: "timelock"; - type: "publicKey"; - }, - { - name: "enqueuedSlot"; - type: "u64"; - }, - { - name: "transactionBatchAuthority"; - type: "publicKey"; - }, - { - name: "enqueuerType"; - type: { - defined: "AuthorityType"; - }; - }, - ]; - }; - }, - ]; - types: [ - { - name: "OptimisticProposer"; - type: { - kind: "struct"; - fields: [ - { - name: "pubkey"; - type: "publicKey"; - }, - { - name: "lastSlotEnqueued"; - type: "u64"; - }, - ]; - }; - }, - { - name: "Transaction"; - type: { - kind: "struct"; - fields: [ - { - name: "programId"; - type: "publicKey"; - }, - { - name: "accounts"; - type: { - vec: { - defined: "TransactionAccount"; - }; - }; - }, - { - name: "data"; - type: "bytes"; - }, - { - name: "didExecute"; - type: "bool"; - }, - ]; - }; - }, - { - name: "TransactionAccount"; - type: { - kind: "struct"; - fields: [ - { - name: "pubkey"; - type: "publicKey"; - }, - { - name: "isSigner"; - type: "bool"; - }, - { - name: "isWritable"; - type: "bool"; - }, - ]; - }; - }, - { - name: "AuthorityType"; - type: { - kind: "enum"; - variants: [ - { - name: "OptimisticProposer"; - }, - { - name: "TimelockAuthority"; - }, - ]; - }; - }, - { - name: "TransactionBatchStatus"; - type: { - kind: "enum"; - variants: [ - { - name: "Created"; - }, - { - name: "Sealed"; - }, - { - name: "Enqueued"; - }, - { - name: "Cancelled"; - }, - { - name: "Executed"; - }, - ]; - }; - }, - ]; - errors: [ - { - code: 6000; - name: "NotReady"; - msg: "This transaction is not yet ready to be executed"; - }, - { - code: 6001; - name: "CannotAddTransactions"; - msg: "Can only add instructions when transaction batch status is `Created`"; - }, - { - code: 6002; - name: "CannotSealTransactionBatch"; - msg: "Can only seal the transaction batch when status is `Created`"; - }, - { - code: 6003; - name: "CannotEnqueueTransactionBatch"; - msg: "Can only enqueue the timelock running once the status is `Sealed`"; - }, - { - code: 6004; - name: "CannotCancelTimelock"; - msg: "Can only cancel the transactions if the status `Enqueued`"; - }, - { - code: 6005; - name: "CanOnlyCancelDuringTimelockPeriod"; - msg: "Can only cancel the transactions during the timelock period"; - }, - { - code: 6006; - name: "CannotExecuteTransactions"; - msg: "Can only execute the transactions if the status is `Enqueued`"; - }, - { - code: 6007; - name: "NoAuthority"; - msg: "The signer is neither the timelock authority nor an optimistic proposer"; - }, - { - code: 6008; - name: "InsufficientPermissions"; - msg: "Optimistic proposers can't cancel transaction batches enqueued by the timelock authority"; - }, - { - code: 6009; - name: "OptimisticProposerCooldown"; - msg: "This optimistic proposer is still in its cooldown period"; - }, - ]; -}; - -export const IDL: OptimisticTimelock = { - version: "0.3.0", - name: "optimistic_timelock", - instructions: [ - { - name: "createTimelock", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: false, - }, - { - name: "timelock", - isMut: true, - isSigner: true, - }, - ], - args: [ - { - name: "authority", - type: "publicKey", - }, - { - name: "delayInSlots", - type: "u64", - }, - { - name: "enqueuers", - type: { - vec: "publicKey", - }, - }, - { - name: "enqueuerCooldownSlots", - type: "u64", - }, - ], - }, - { - name: "setDelayInSlots", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "delayInSlots", - type: "u64", - }, - ], - }, - { - name: "setAuthority", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "authority", - type: "publicKey", - }, - ], - }, - { - name: "setOptimisticProposerCooldownSlots", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "cooldownSlots", - type: "u64", - }, - ], - }, - { - name: "addOptimisticProposer", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "enqueuer", - type: "publicKey", - }, - ], - }, - { - name: "removeOptimisticProposer", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "optimisticProposer", - type: "publicKey", - }, - ], - }, - { - name: "createTransactionBatch", - accounts: [ - { - name: "transactionBatchAuthority", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: false, - isSigner: false, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: true, - }, - ], - args: [], - }, - { - name: "addTransaction", - accounts: [ - { - name: "transactionBatchAuthority", - isMut: false, - isSigner: true, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "programId", - type: "publicKey", - }, - { - name: "accounts", - type: { - vec: { - defined: "TransactionAccount", - }, - }, - }, - { - name: "data", - type: "bytes", - }, - ], - }, - { - name: "sealTransactionBatch", - accounts: [ - { - name: "transactionBatchAuthority", - isMut: false, - isSigner: true, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - { - name: "enqueueTransactionBatch", - accounts: [ - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - { - name: "cancelTransactionBatch", - accounts: [ - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - { - name: "executeTransactionBatch", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: false, - }, - { - name: "timelock", - isMut: false, - isSigner: false, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "timelock", - type: { - kind: "struct", - fields: [ - { - name: "authority", - type: "publicKey", - }, - { - name: "signerBump", - type: "u8", - }, - { - name: "delayInSlots", - type: "u64", - }, - { - name: "optimisticProposers", - type: { - vec: { - defined: "OptimisticProposer", - }, - }, - }, - { - name: "optimisticProposerCooldownSlots", - docs: [ - "The cooldown period for enqueuers to prevent spamming the timelock.", - ], - type: "u64", - }, - ], - }, - }, - { - name: "transactionBatch", - type: { - kind: "struct", - fields: [ - { - name: "status", - type: { - defined: "TransactionBatchStatus", - }, - }, - { - name: "transactions", - type: { - vec: { - defined: "Transaction", - }, - }, - }, - { - name: "timelock", - type: "publicKey", - }, - { - name: "enqueuedSlot", - type: "u64", - }, - { - name: "transactionBatchAuthority", - type: "publicKey", - }, - { - name: "enqueuerType", - type: { - defined: "AuthorityType", - }, - }, - ], - }, - }, - ], - types: [ - { - name: "OptimisticProposer", - type: { - kind: "struct", - fields: [ - { - name: "pubkey", - type: "publicKey", - }, - { - name: "lastSlotEnqueued", - type: "u64", - }, - ], - }, - }, - { - name: "Transaction", - type: { - kind: "struct", - fields: [ - { - name: "programId", - type: "publicKey", - }, - { - name: "accounts", - type: { - vec: { - defined: "TransactionAccount", - }, - }, - }, - { - name: "data", - type: "bytes", - }, - { - name: "didExecute", - type: "bool", - }, - ], - }, - }, - { - name: "TransactionAccount", - type: { - kind: "struct", - fields: [ - { - name: "pubkey", - type: "publicKey", - }, - { - name: "isSigner", - type: "bool", - }, - { - name: "isWritable", - type: "bool", - }, - ], - }, - }, - { - name: "AuthorityType", - type: { - kind: "enum", - variants: [ - { - name: "OptimisticProposer", - }, - { - name: "TimelockAuthority", - }, - ], - }, - }, - { - name: "TransactionBatchStatus", - type: { - kind: "enum", - variants: [ - { - name: "Created", - }, - { - name: "Sealed", - }, - { - name: "Enqueued", - }, - { - name: "Cancelled", - }, - { - name: "Executed", - }, - ], - }, - }, - ], - errors: [ - { - code: 6000, - name: "NotReady", - msg: "This transaction is not yet ready to be executed", - }, - { - code: 6001, - name: "CannotAddTransactions", - msg: "Can only add instructions when transaction batch status is `Created`", - }, - { - code: 6002, - name: "CannotSealTransactionBatch", - msg: "Can only seal the transaction batch when status is `Created`", - }, - { - code: 6003, - name: "CannotEnqueueTransactionBatch", - msg: "Can only enqueue the timelock running once the status is `Sealed`", - }, - { - code: 6004, - name: "CannotCancelTimelock", - msg: "Can only cancel the transactions if the status `Enqueued`", - }, - { - code: 6005, - name: "CanOnlyCancelDuringTimelockPeriod", - msg: "Can only cancel the transactions during the timelock period", - }, - { - code: 6006, - name: "CannotExecuteTransactions", - msg: "Can only execute the transactions if the status is `Enqueued`", - }, - { - code: 6007, - name: "NoAuthority", - msg: "The signer is neither the timelock authority nor an optimistic proposer", - }, - { - code: 6008, - name: "InsufficientPermissions", - msg: "Optimistic proposers can't cancel transaction batches enqueued by the timelock authority", - }, - { - code: 6009, - name: "OptimisticProposerCooldown", - msg: "This optimistic proposer is still in its cooldown period", - }, - ], -}; diff --git a/sdk/src/v0.3/types/utils.ts b/sdk/src/v0.3/types/utils.ts deleted file mode 100644 index c878debe7..000000000 --- a/sdk/src/v0.3/types/utils.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type LowercaseKeys = { - [K in keyof T as Lowercase]: T[K]; -}; diff --git a/sdk/src/v0.3/utils/filters.ts b/sdk/src/v0.3/utils/filters.ts deleted file mode 100644 index aee93f618..000000000 --- a/sdk/src/v0.3/utils/filters.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { GetProgramAccountsFilter, PublicKey } from "@solana/web3.js"; - -export const filterPositionsByUser = ( - userAddr: PublicKey, -): GetProgramAccountsFilter => ({ - memcmp: { - offset: 8, // discriminator - bytes: userAddr.toBase58(), - }, -}); - -export const filterPositionsByAmm = ( - ammAddr: PublicKey, -): GetProgramAccountsFilter => ({ - memcmp: { - offset: - 8 + // discriminator - 32, // user address - bytes: ammAddr.toBase58(), - }, -}); diff --git a/sdk/src/v0.3/utils/index.ts b/sdk/src/v0.3/utils/index.ts deleted file mode 100644 index 05fc38b9a..000000000 --- a/sdk/src/v0.3/utils/index.ts +++ /dev/null @@ -1,40 +0,0 @@ -export * from "./filters.js"; -export * from "./pda.js"; -export * from "./ammMath.js"; -export * from "./metadata.js"; -export * from "./cu.js"; -export * from "./instruction.js"; - -import { AccountMeta, ComputeBudgetProgram, PublicKey } from "@solana/web3.js"; - -export enum PriorityFeeTier { - NORMAL = 35, - HIGH = 3571, - TURBO = 357142, -} - -export const addComputeUnits = (num_units: number = 1_400_000) => - ComputeBudgetProgram.setComputeUnitLimit({ - units: num_units, - }); - -export const addPriorityFee = (pf: number) => - ComputeBudgetProgram.setComputeUnitPrice({ - microLamports: pf, - }); - -export const pubkeyToAccountInfo = ( - pubkey: PublicKey, - isWritable: boolean, - isSigner = false, -): AccountMeta => { - return { - pubkey: pubkey, - isSigner: isSigner, - isWritable: isWritable, - }; -}; - -export async function sleep(ms: number) { - return new Promise((resolve) => setTimeout(resolve, ms)); -} diff --git a/sdk/src/v0.3/utils/instruction.ts b/sdk/src/v0.3/utils/instruction.ts deleted file mode 100644 index f18e48834..000000000 --- a/sdk/src/v0.3/utils/instruction.ts +++ /dev/null @@ -1,16 +0,0 @@ -import * as anchor from "@coral-xyz/anchor"; -import { TransactionInstruction } from "@solana/web3.js"; - -export class InstructionUtils { - public static async getInstructions( - ...methodBuilders: any[] - ): Promise { - let instructions: TransactionInstruction[] = []; - - for (const methodBuilder of methodBuilders) { - instructions.push(...(await methodBuilder.transaction()).instructions); - } - - return instructions; - } -} diff --git a/sdk/src/v0.3/utils/metadata.ts b/sdk/src/v0.3/utils/metadata.ts deleted file mode 100644 index ef17bbdb8..000000000 --- a/sdk/src/v0.3/utils/metadata.ts +++ /dev/null @@ -1,35 +0,0 @@ -import BN from "bn.js"; -import { createUmi } from "@metaplex-foundation/umi-bundle-defaults"; -import { Connection } from "@solana/web3.js"; -import { bundlrUploader } from "@metaplex-foundation/umi-uploader-bundlr"; -import { UmiPlugin } from "@metaplex-foundation/umi"; - -export const assetImageMap: Record = { - fMETA: "https://arweave.net/tGxvOjMZw7B0qHsdCcIMO57oH5g5OaItOZdXo3BXKz8", - fUSDC: "https://arweave.net/DpvxeAyVbaoivhIVCLjdf566k2SwVn0YVBL0sTOezWk", - pMETA: "https://arweave.net/iuqi7PRRESdDxj1oRyk2WzR90_zdFcmZsuWicv3XGfs", - pUSDC: "https://arweave.net/e4IO7F59F_RKCiuB--_ABPot7Qh1yFsGkWzVhcXuKDU", -}; - -// Upload some JSON, returning its URL -export const uploadConditionalTokenMetadataJson = async ( - connection: Connection, - identityPlugin: UmiPlugin, - proposalNumber: number, - symbol: string, - // proposal: BN, - // conditionalToken: string, - // image: string -): Promise => { - // use bundlr, targeting arweave - const umi = createUmi(connection); - umi.use(bundlrUploader()); - umi.use(identityPlugin); - - return umi.uploader.uploadJson({ - name: `Proposal ${proposalNumber}: ${symbol}`, - image: assetImageMap[symbol], - symbol, - description: "A conditional token for use in futarchy.", - }); -}; diff --git a/sdk/src/v0.3/utils/pda.ts b/sdk/src/v0.3/utils/pda.ts deleted file mode 100644 index 6bf18aff2..000000000 --- a/sdk/src/v0.3/utils/pda.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { AccountMeta, PublicKey } from "@solana/web3.js"; -import { utils } from "@coral-xyz/anchor"; -import { - ASSOCIATED_TOKEN_PROGRAM_ID, - TOKEN_PROGRAM_ID, -} from "@solana/spl-token"; -import BN from "bn.js"; -import { - fromWeb3JsPublicKey, - toWeb3JsPublicKey, -} from "@metaplex-foundation/umi-web3js-adapters"; -import { MPL_TOKEN_METADATA_PROGRAM_ID } from "../constants.js"; - -export const getVaultAddr = ( - programId: PublicKey, - settlementAuthority: PublicKey, - underlyingTokenMint: PublicKey, -) => { - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("conditional_vault"), - settlementAuthority.toBuffer(), - underlyingTokenMint.toBuffer(), - ], - programId, - ); -}; - -export const getVaultFinalizeMintAddr = ( - programId: PublicKey, - vault: PublicKey, -) => { - return getVaultMintAddr(programId, vault, "conditional_on_finalize_mint"); -}; - -export const getMetadataAddr = (mint: PublicKey) => { - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("metadata"), - MPL_TOKEN_METADATA_PROGRAM_ID.toBuffer(), - mint.toBuffer(), - ], - MPL_TOKEN_METADATA_PROGRAM_ID, - ); -}; - -export const getVaultRevertMintAddr = ( - programId: PublicKey, - vault: PublicKey, -) => { - return getVaultMintAddr(programId, vault, "conditional_on_revert_mint"); -}; - -const getVaultMintAddr = ( - programId: PublicKey, - vault: PublicKey, - seed: string, -) => { - return PublicKey.findProgramAddressSync( - [utils.bytes.utf8.encode(seed), vault.toBuffer()], - programId, - ); -}; - -export const getDaoTreasuryAddr = ( - programId: PublicKey, - dao: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync([dao.toBuffer()], programId); -}; - -export const getProposalAddr = ( - programId: PublicKey, - proposer: PublicKey, - nonce: BN, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("proposal"), - proposer.toBuffer(), - nonce.toArrayLike(Buffer, "le", 8), - ], - programId, - ); -}; - -export const getAmmAddr = ( - programId: PublicKey, - baseMint: PublicKey, - quoteMint: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("amm__"), - baseMint.toBuffer(), - quoteMint.toBuffer(), - ], - programId, - ); -}; - -export const getAmmLpMintAddr = ( - programId: PublicKey, - amm: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [utils.bytes.utf8.encode("amm_lp_mint"), amm.toBuffer()], - programId, - ); -}; diff --git a/sdk/src/v0.4/ConditionalVaultClient.ts b/sdk/src/v0.4/ConditionalVaultClient.ts deleted file mode 100644 index 047e0a46f..000000000 --- a/sdk/src/v0.4/ConditionalVaultClient.ts +++ /dev/null @@ -1,475 +0,0 @@ -import { AnchorProvider, Program, utils } from "@coral-xyz/anchor"; -import { - AccountInfo, - AddressLookupTableAccount, - Keypair, - PublicKey, - SystemProgram, -} from "@solana/web3.js"; - -import { ConditionalVaultProgram, ConditionalVaultIDL } from "./types/index.js"; - -import BN from "bn.js"; -import { - CONDITIONAL_VAULT_PROGRAM_ID, - MPL_TOKEN_METADATA_PROGRAM_ID, -} from "./constants.js"; -import { - getQuestionAddr, - getMetadataAddr, - getVaultAddr, - getConditionalTokenMintAddr, -} from "./utils/index.js"; -import { - createAssociatedTokenAccountIdempotentInstruction, - createAssociatedTokenAccountInstruction, - getAssociatedTokenAddressSync, - TOKEN_PROGRAM_ID, -} from "@solana/spl-token"; -import { ConditionalVault, Question } from "./types/index.js"; - -export type CreateVaultClientParams = { - provider: AnchorProvider; - conditionalVaultProgramId?: PublicKey; -}; - -export class ConditionalVaultClient { - public readonly provider: AnchorProvider; - public readonly vaultProgram: Program; - - constructor(provider: AnchorProvider, conditionalVaultProgramId: PublicKey) { - this.provider = provider; - this.vaultProgram = new Program( - ConditionalVaultIDL, - conditionalVaultProgramId, - provider, - ); - } - - public static createClient( - createVaultClientParams: CreateVaultClientParams, - ): ConditionalVaultClient { - let { provider, conditionalVaultProgramId } = createVaultClientParams; - - return new ConditionalVaultClient( - provider, - conditionalVaultProgramId || CONDITIONAL_VAULT_PROGRAM_ID, - ); - } - - async fetchQuestion(question: PublicKey): Promise { - return this.vaultProgram.account.question.fetchNullable(question); - } - - async fetchVault(vault: PublicKey): Promise { - return this.vaultProgram.account.conditionalVault.fetchNullable(vault); - } - - async deserializeQuestion( - accountInfo: AccountInfo, - ): Promise { - return this.vaultProgram.coder.accounts.decode( - "question", - accountInfo.data, - ); - } - - async deserializeVault( - accountInfo: AccountInfo, - ): Promise { - return this.vaultProgram.coder.accounts.decode( - "conditionalVault", - accountInfo.data, - ); - } - - initializeQuestionIx( - questionId: Uint8Array, - oracle: PublicKey, - numOutcomes: number, - ) { - const [question] = getQuestionAddr( - this.vaultProgram.programId, - questionId, - oracle, - numOutcomes, - ); - - return this.vaultProgram.methods - .initializeQuestion({ - questionId: Array.from(questionId), - oracle, - numOutcomes, - }) - .accounts({ - question, - }); - } - - async initializeQuestion( - questionId: Uint8Array, - oracle: PublicKey, - numOutcomes: number, - ): Promise { - const [question] = getQuestionAddr( - this.vaultProgram.programId, - questionId, - oracle, - numOutcomes, - ); - - await this.initializeQuestionIx(questionId, oracle, numOutcomes).rpc(); - - return question; - } - - initializeVaultIx( - question: PublicKey, - underlyingTokenMint: PublicKey, - numOutcomes: number, - payer: PublicKey = this.provider.publicKey, - ) { - const [vault] = getVaultAddr( - this.vaultProgram.programId, - question, - underlyingTokenMint, - ); - - let conditionalTokenMintAddrs = []; - for (let i = 0; i < numOutcomes; i++) { - const [conditionalTokenMint] = getConditionalTokenMintAddr( - this.vaultProgram.programId, - vault, - i, - ); - conditionalTokenMintAddrs.push(conditionalTokenMint); - } - - const vaultUnderlyingTokenAccount = getAssociatedTokenAddressSync( - underlyingTokenMint, - vault, - true, - ); - - return this.vaultProgram.methods - .initializeConditionalVault() - .accounts({ - vault, - question, - underlyingTokenMint, - vaultUnderlyingTokenAccount, - }) - .preInstructions([ - createAssociatedTokenAccountIdempotentInstruction( - payer, - vaultUnderlyingTokenAccount, - vault, - underlyingTokenMint, - ), - ]) - .remainingAccounts( - conditionalTokenMintAddrs.map((conditionalTokenMint) => { - return { - pubkey: conditionalTokenMint, - isWritable: true, - isSigner: false, - }; - }), - ); - } - - // TODO remove `numOucomes` - - async initializeVault( - question: PublicKey, - underlyingTokenMint: PublicKey, - numOutcomes: number, - ): Promise { - const [vault] = getVaultAddr( - this.vaultProgram.programId, - question, - underlyingTokenMint, - ); - - await this.initializeVaultIx( - question, - underlyingTokenMint, - numOutcomes, - ).rpc(); - - return vault; - } - - resolveQuestionIx( - question: PublicKey, - oracle: Keypair, - payoutNumerators: number[], - ) { - return this.vaultProgram.methods - .resolveQuestion({ - payoutNumerators, - }) - .accounts({ - question, - oracle: oracle.publicKey, - }) - .signers([oracle]); - } - - getConditionalTokenMints(vault: PublicKey, numOutcomes: number): PublicKey[] { - let conditionalTokenMintAddrs = []; - for (let i = 0; i < numOutcomes; i++) { - const [conditionalTokenMint] = getConditionalTokenMintAddr( - this.vaultProgram.programId, - vault, - i, - ); - conditionalTokenMintAddrs.push(conditionalTokenMint); - } - return conditionalTokenMintAddrs; - } - - getRemainingAccounts( - conditionalTokenMints: PublicKey[], - userConditionalAccounts: PublicKey[], - ) { - return conditionalTokenMints - .concat(userConditionalAccounts) - .map((account) => ({ - pubkey: account, - isWritable: true, - isSigner: false, - })); - } - - // Helper method to get conditional token accounts and instructions - getConditionalTokenAccountsAndInstructions( - vault: PublicKey, - numOutcomes: number, - user: PublicKey = this.provider.publicKey, - payer: PublicKey = this.provider.publicKey, - ) { - const conditionalTokenMintAddrs = this.getConditionalTokenMints( - vault, - numOutcomes, - ); - const userConditionalAccounts = conditionalTokenMintAddrs.map((mint) => - getAssociatedTokenAddressSync(mint, user, true), - ); - - const preInstructions = conditionalTokenMintAddrs.map((mint) => - createAssociatedTokenAccountIdempotentInstruction( - payer, - getAssociatedTokenAddressSync(mint, user, true), - user, - mint, - ), - ); - - const remainingAccounts = this.getRemainingAccounts( - conditionalTokenMintAddrs, - userConditionalAccounts, - ); - - return { userConditionalAccounts, preInstructions, remainingAccounts }; - } - - splitTokensIx( - question: PublicKey, - vault: PublicKey, - underlyingTokenMint: PublicKey, - amount: BN, - numOutcomes: number, - user: PublicKey = this.provider.publicKey, - payer: PublicKey = this.provider.publicKey, - ) { - const { preInstructions, remainingAccounts } = - this.getConditionalTokenAccountsAndInstructions( - vault, - numOutcomes, - user, - payer, - ); - - return this.vaultProgram.methods - .splitTokens(amount) - .accounts({ - question, - authority: user, - vault, - vaultUnderlyingTokenAccount: getAssociatedTokenAddressSync( - underlyingTokenMint, - vault, - true, - ), - userUnderlyingTokenAccount: getAssociatedTokenAddressSync( - underlyingTokenMint, - user, - true, - ), - }) - .preInstructions(preInstructions) - .remainingAccounts(remainingAccounts); - } - - mergeTokensIx( - question: PublicKey, - vault: PublicKey, - underlyingTokenMint: PublicKey, - amount: BN, - numOutcomes: number, - user: PublicKey = this.provider.publicKey, - payer: PublicKey = this.provider.publicKey, - ) { - let conditionalTokenMintAddrs = this.getConditionalTokenMints( - vault, - numOutcomes, - ); - - let userConditionalAccounts = []; - for (let conditionalTokenMint of conditionalTokenMintAddrs) { - userConditionalAccounts.push( - getAssociatedTokenAddressSync(conditionalTokenMint, user, true), - ); - } - - let ix = this.vaultProgram.methods - .mergeTokens(amount) - .accounts({ - question, - authority: user, - vault, - vaultUnderlyingTokenAccount: getAssociatedTokenAddressSync( - underlyingTokenMint, - vault, - true, - ), - userUnderlyingTokenAccount: getAssociatedTokenAddressSync( - underlyingTokenMint, - user, - true, - ), - }) - .preInstructions( - conditionalTokenMintAddrs.map((conditionalTokenMint) => { - return createAssociatedTokenAccountIdempotentInstruction( - payer, - getAssociatedTokenAddressSync(conditionalTokenMint, user, true), - user, - conditionalTokenMint, - ); - }), - ) - .remainingAccounts( - conditionalTokenMintAddrs - .concat(userConditionalAccounts) - .map((conditionalTokenMint) => { - return { - pubkey: conditionalTokenMint, - isWritable: true, - isSigner: false, - }; - }), - ); - - return ix; - } - - redeemTokensIx( - question: PublicKey, - vault: PublicKey, - underlyingTokenMint: PublicKey, - numOutcomes: number, - user: PublicKey = this.provider.publicKey, - payer: PublicKey = this.provider.publicKey, - ) { - let conditionalTokenMintAddrs = []; - for (let i = 0; i < numOutcomes; i++) { - const [conditionalTokenMint] = getConditionalTokenMintAddr( - this.vaultProgram.programId, - vault, - i, - ); - conditionalTokenMintAddrs.push(conditionalTokenMint); - } - - let userConditionalAccounts = []; - for (let conditionalTokenMint of conditionalTokenMintAddrs) { - userConditionalAccounts.push( - getAssociatedTokenAddressSync(conditionalTokenMint, user, true), - ); - } - - let ix = this.vaultProgram.methods - .redeemTokens() - .accounts({ - question, - authority: user, - vault, - vaultUnderlyingTokenAccount: getAssociatedTokenAddressSync( - underlyingTokenMint, - vault, - true, - ), - userUnderlyingTokenAccount: getAssociatedTokenAddressSync( - underlyingTokenMint, - user, - true, - ), - }) - .preInstructions( - conditionalTokenMintAddrs.map((conditionalTokenMint) => { - return createAssociatedTokenAccountIdempotentInstruction( - payer, - getAssociatedTokenAddressSync(conditionalTokenMint, user, true), - user, - conditionalTokenMint, - ); - }), - ) - .remainingAccounts( - conditionalTokenMintAddrs - .concat(userConditionalAccounts) - .map((conditionalTokenMint) => { - return { - pubkey: conditionalTokenMint, - isWritable: true, - isSigner: false, - }; - }), - ); - - return ix; - } - - addMetadataToConditionalTokensIx( - vault: PublicKey, - index: number, - name: string, - symbol: string, - uri: string, - payer: PublicKey = this.provider.publicKey, - ) { - const [conditionalTokenMint] = getConditionalTokenMintAddr( - this.vaultProgram.programId, - vault, - index, - ); - - const [conditionalTokenMetadata] = getMetadataAddr(conditionalTokenMint); - - return this.vaultProgram.methods - .addMetadataToConditionalTokens({ - name, - symbol, - uri, - }) - .accounts({ - payer, - vault, - conditionalTokenMint, - conditionalTokenMetadata, - tokenMetadataProgram: MPL_TOKEN_METADATA_PROGRAM_ID, - }); - } -} diff --git a/sdk/src/v0.4/constants.ts b/sdk/src/v0.4/constants.ts deleted file mode 100644 index e5df61f7d..000000000 --- a/sdk/src/v0.4/constants.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { PublicKey } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; -import { BN } from "bn.js"; - -export const AUTOCRAT_PROGRAM_ID = new PublicKey( - "autowMzCbM29YXMgVG3T62Hkgo7RcyrvgQQkd54fDQL", -); -export const AMM_PROGRAM_ID = new PublicKey( - "AMMyu265tkBpRW21iGQxKGLaves3gKm2JcMUqfXNSpqD", -); -export const CONDITIONAL_VAULT_PROGRAM_ID = new PublicKey( - "VLTX1ishMBbcX3rdBWGssxawAo1Q2X2qxYFYqiGodVg", -); - -export const MPL_TOKEN_METADATA_PROGRAM_ID = new PublicKey( - "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s", -); - -export const RAYDIUM_CP_SWAP_PROGRAM_ID = new PublicKey( - "CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C", -); - -export const DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID = new PublicKey( - "CPMDWBwJDtYax9qW7AyRuVC19Cc4L4Vcy4n2BHAbHkCW", -); - -export const META_MINT = new PublicKey( - "3gN1WVEJwSHNWjo7hr87DgZp6zkf8kWgAJD29DmfE2Gr", -); -export const MAINNET_USDC = new PublicKey( - "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", -); - -export const DEVNET_USDC = new PublicKey( - "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU", -); - -export const USDC_DECIMALS = 6; - -export const AUTOCRAT_LUTS: PublicKey[] = []; - -export const LAUNCHPAD_PROGRAM_ID = new PublicKey( - "AfJJJ5UqxhBKoE3grkKAZZsoXDE9kncbMKvqSHGsCNrE", -); - -export const RAYDIUM_AUTHORITY = PublicKey.findProgramAddressSync( - [anchor.utils.bytes.utf8.encode("vault_and_lp_mint_auth_seed")], - RAYDIUM_CP_SWAP_PROGRAM_ID, -)[0]; - -export const DEVNET_RAYDIUM_AUTHORITY = PublicKey.findProgramAddressSync( - [anchor.utils.bytes.utf8.encode("vault_and_lp_mint_auth_seed")], - DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID, -)[0]; - -export const LOW_FEE_RAYDIUM_CONFIG = new PublicKey( - "D4FPEruKEHrG5TenZ2mpDGEfu1iUvTiqBxvpU8HLBvC2", -); - -export const DEVNET_LOW_FEE_RAYDIUM_CONFIG = PublicKey.findProgramAddressSync( - [ - anchor.utils.bytes.utf8.encode("amm_config"), - new BN(0).toArrayLike(Buffer, "be", 2), - ], - DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID, -)[0]; - -export const RAYDIUM_CREATE_POOL_FEE_RECEIVE = new PublicKey( - "DNXgeM9EiiaAbaWvwjHj9fQQLAX5ZsfHyvmYUNRAdNC8", -); - -export const DEVNET_RAYDIUM_CREATE_POOL_FEE_RECEIVE = new PublicKey( - "G11FKBRaAkHAKuLCgLM6K6NUc9rTjPAznRCjZifrTQe2", -); diff --git a/sdk/src/v0.4/index.ts b/sdk/src/v0.4/index.ts deleted file mode 100644 index 06af1cf6c..000000000 --- a/sdk/src/v0.4/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from "./types/index.js"; -export * from "./utils/index.js"; -export * from "./constants.js"; -export * from "./AmmClient.js"; -export * from "./AutocratClient.js"; -export * from "./ConditionalVaultClient.js"; -export * from "./LaunchpadClient.js"; diff --git a/sdk/src/v0.4/types/autocrat_migrator.ts b/sdk/src/v0.4/types/autocrat_migrator.ts deleted file mode 100644 index 676d2df3d..000000000 --- a/sdk/src/v0.4/types/autocrat_migrator.ts +++ /dev/null @@ -1,237 +0,0 @@ -export type AutocratMigrator = { - version: "0.1.0"; - name: "autocrat_migrator"; - instructions: [ - { - name: "multiTransfer2"; - accounts: [ - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "authority"; - isMut: true; - isSigner: true; - }, - { - name: "from0"; - isMut: true; - isSigner: false; - }, - { - name: "to0"; - isMut: true; - isSigner: false; - }, - { - name: "from1"; - isMut: true; - isSigner: false; - }, - { - name: "to1"; - isMut: true; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "lamportReceiver"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "multiTransfer4"; - accounts: [ - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "authority"; - isMut: true; - isSigner: true; - }, - { - name: "from0"; - isMut: true; - isSigner: false; - }, - { - name: "to0"; - isMut: true; - isSigner: false; - }, - { - name: "from1"; - isMut: true; - isSigner: false; - }, - { - name: "to1"; - isMut: true; - isSigner: false; - }, - { - name: "from2"; - isMut: true; - isSigner: false; - }, - { - name: "to2"; - isMut: true; - isSigner: false; - }, - { - name: "from3"; - isMut: true; - isSigner: false; - }, - { - name: "to3"; - isMut: true; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "lamportReceiver"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - ]; -}; - -export const IDL: AutocratMigrator = { - version: "0.1.0", - name: "autocrat_migrator", - instructions: [ - { - name: "multiTransfer2", - accounts: [ - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "authority", - isMut: true, - isSigner: true, - }, - { - name: "from0", - isMut: true, - isSigner: false, - }, - { - name: "to0", - isMut: true, - isSigner: false, - }, - { - name: "from1", - isMut: true, - isSigner: false, - }, - { - name: "to1", - isMut: true, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "lamportReceiver", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - { - name: "multiTransfer4", - accounts: [ - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "authority", - isMut: true, - isSigner: true, - }, - { - name: "from0", - isMut: true, - isSigner: false, - }, - { - name: "to0", - isMut: true, - isSigner: false, - }, - { - name: "from1", - isMut: true, - isSigner: false, - }, - { - name: "to1", - isMut: true, - isSigner: false, - }, - { - name: "from2", - isMut: true, - isSigner: false, - }, - { - name: "to2", - isMut: true, - isSigner: false, - }, - { - name: "from3", - isMut: true, - isSigner: false, - }, - { - name: "to3", - isMut: true, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "lamportReceiver", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - ], -}; diff --git a/sdk/src/v0.4/types/conditional_vault.ts b/sdk/src/v0.4/types/conditional_vault.ts deleted file mode 100644 index a0174c7f1..000000000 --- a/sdk/src/v0.4/types/conditional_vault.ts +++ /dev/null @@ -1,1839 +0,0 @@ -export type ConditionalVault = { - version: "0.4.0"; - name: "conditional_vault"; - instructions: [ - { - name: "initializeQuestion"; - accounts: [ - { - name: "question"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "InitializeQuestionArgs"; - }; - }, - ]; - }, - { - name: "resolveQuestion"; - accounts: [ - { - name: "question"; - isMut: true; - isSigner: false; - }, - { - name: "oracle"; - isMut: false; - isSigner: true; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "ResolveQuestionArgs"; - }; - }, - ]; - }, - { - name: "initializeConditionalVault"; - accounts: [ - { - name: "vault"; - isMut: true; - isSigner: false; - }, - { - name: "question"; - isMut: false; - isSigner: false; - }, - { - name: "underlyingTokenMint"; - isMut: false; - isSigner: false; - }, - { - name: "vaultUnderlyingTokenAccount"; - isMut: false; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "splitTokens"; - accounts: [ - { - name: "question"; - isMut: false; - isSigner: false; - }, - { - name: "vault"; - isMut: true; - isSigner: false; - }, - { - name: "vaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "authority"; - isMut: false; - isSigner: true; - }, - { - name: "userUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "amount"; - type: "u64"; - }, - ]; - }, - { - name: "mergeTokens"; - accounts: [ - { - name: "question"; - isMut: false; - isSigner: false; - }, - { - name: "vault"; - isMut: true; - isSigner: false; - }, - { - name: "vaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "authority"; - isMut: false; - isSigner: true; - }, - { - name: "userUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "amount"; - type: "u64"; - }, - ]; - }, - { - name: "redeemTokens"; - accounts: [ - { - name: "question"; - isMut: false; - isSigner: false; - }, - { - name: "vault"; - isMut: true; - isSigner: false; - }, - { - name: "vaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "authority"; - isMut: false; - isSigner: true; - }, - { - name: "userUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "addMetadataToConditionalTokens"; - accounts: [ - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "vault"; - isMut: true; - isSigner: false; - }, - { - name: "conditionalTokenMint"; - isMut: true; - isSigner: false; - }, - { - name: "conditionalTokenMetadata"; - isMut: true; - isSigner: false; - }, - { - name: "tokenMetadataProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "rent"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "AddMetadataToConditionalTokensArgs"; - }; - }, - ]; - }, - ]; - accounts: [ - { - name: "conditionalVault"; - type: { - kind: "struct"; - fields: [ - { - name: "question"; - type: "publicKey"; - }, - { - name: "underlyingTokenMint"; - type: "publicKey"; - }, - { - name: "underlyingTokenAccount"; - type: "publicKey"; - }, - { - name: "conditionalTokenMints"; - type: { - vec: "publicKey"; - }; - }, - { - name: "pdaBump"; - type: "u8"; - }, - { - name: "decimals"; - type: "u8"; - }, - { - name: "seqNum"; - type: "u64"; - }, - ]; - }; - }, - { - name: "question"; - docs: [ - "Questions represent statements about future events.", - "", - "These statements include:", - '- "Will this proposal pass?"', - '- "Who, if anyone, will be hired?"', - '- "How effective will the grant committee deem this grant?"', - "", - 'Questions have 2 or more possible outcomes. For a question like "will this', - 'proposal pass," the outcomes are "yes" and "no." For a question like "who', - 'will be hired," the outcomes could be "Alice," "Bob," and "neither."', - "", - 'Outcomes resolve to a number between 0 and 1. Binary questions like "will', - 'this proposal pass" have outcomes that resolve to exactly 0 or 1. You can', - 'also have questions with scalar outcomes. For example, the question "how', - 'effective will the grant committee deem this grant" could have two outcomes:', - '"ineffective" and "effective." If the grant committee deems the grant 70%', - 'effective, the "effective" outcome would resolve to 0.7 and the "ineffective"', - "outcome would resolve to 0.3.", - "", - "Once resolved, the sum of all outcome resolutions is exactly 1.", - ]; - type: { - kind: "struct"; - fields: [ - { - name: "questionId"; - type: { - array: ["u8", 32]; - }; - }, - { - name: "oracle"; - type: "publicKey"; - }, - { - name: "payoutNumerators"; - type: { - vec: "u32"; - }; - }, - { - name: "payoutDenominator"; - type: "u32"; - }, - ]; - }; - }, - ]; - types: [ - { - name: "CommonFields"; - type: { - kind: "struct"; - fields: [ - { - name: "slot"; - type: "u64"; - }, - { - name: "unixTimestamp"; - type: "i64"; - }, - ]; - }; - }, - { - name: "AddMetadataToConditionalTokensArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "name"; - type: "string"; - }, - { - name: "symbol"; - type: "string"; - }, - { - name: "uri"; - type: "string"; - }, - ]; - }; - }, - { - name: "InitializeQuestionArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "questionId"; - type: { - array: ["u8", 32]; - }; - }, - { - name: "oracle"; - type: "publicKey"; - }, - { - name: "numOutcomes"; - type: "u8"; - }, - ]; - }; - }, - { - name: "ResolveQuestionArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "payoutNumerators"; - type: { - vec: "u32"; - }; - }, - ]; - }; - }, - { - name: "VaultStatus"; - type: { - kind: "enum"; - variants: [ - { - name: "Active"; - }, - { - name: "Finalized"; - }, - { - name: "Reverted"; - }, - ]; - }; - }, - ]; - events: [ - { - name: "AddMetadataToConditionalTokensEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "vault"; - type: "publicKey"; - index: false; - }, - { - name: "conditionalTokenMint"; - type: "publicKey"; - index: false; - }, - { - name: "conditionalTokenMetadata"; - type: "publicKey"; - index: false; - }, - { - name: "name"; - type: "string"; - index: false; - }, - { - name: "symbol"; - type: "string"; - index: false; - }, - { - name: "uri"; - type: "string"; - index: false; - }, - { - name: "seqNum"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "InitializeConditionalVaultEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "vault"; - type: "publicKey"; - index: false; - }, - { - name: "question"; - type: "publicKey"; - index: false; - }, - { - name: "underlyingTokenMint"; - type: "publicKey"; - index: false; - }, - { - name: "vaultUnderlyingTokenAccount"; - type: "publicKey"; - index: false; - }, - { - name: "conditionalTokenMints"; - type: { - vec: "publicKey"; - }; - index: false; - }, - { - name: "pdaBump"; - type: "u8"; - index: false; - }, - { - name: "seqNum"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "InitializeQuestionEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "questionId"; - type: { - array: ["u8", 32]; - }; - index: false; - }, - { - name: "oracle"; - type: "publicKey"; - index: false; - }, - { - name: "numOutcomes"; - type: "u8"; - index: false; - }, - { - name: "question"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "MergeTokensEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "user"; - type: "publicKey"; - index: false; - }, - { - name: "vault"; - type: "publicKey"; - index: false; - }, - { - name: "amount"; - type: "u64"; - index: false; - }, - { - name: "postUserUnderlyingBalance"; - type: "u64"; - index: false; - }, - { - name: "postVaultUnderlyingBalance"; - type: "u64"; - index: false; - }, - { - name: "postUserConditionalTokenBalances"; - type: { - vec: "u64"; - }; - index: false; - }, - { - name: "postConditionalTokenSupplies"; - type: { - vec: "u64"; - }; - index: false; - }, - { - name: "seqNum"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "RedeemTokensEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "user"; - type: "publicKey"; - index: false; - }, - { - name: "vault"; - type: "publicKey"; - index: false; - }, - { - name: "amount"; - type: "u64"; - index: false; - }, - { - name: "postUserUnderlyingBalance"; - type: "u64"; - index: false; - }, - { - name: "postVaultUnderlyingBalance"; - type: "u64"; - index: false; - }, - { - name: "postConditionalTokenSupplies"; - type: { - vec: "u64"; - }; - index: false; - }, - { - name: "seqNum"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "ResolveQuestionEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "question"; - type: "publicKey"; - index: false; - }, - { - name: "payoutNumerators"; - type: { - vec: "u32"; - }; - index: false; - }, - ]; - }, - { - name: "SplitTokensEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "user"; - type: "publicKey"; - index: false; - }, - { - name: "vault"; - type: "publicKey"; - index: false; - }, - { - name: "amount"; - type: "u64"; - index: false; - }, - { - name: "postUserUnderlyingBalance"; - type: "u64"; - index: false; - }, - { - name: "postVaultUnderlyingBalance"; - type: "u64"; - index: false; - }, - { - name: "postUserConditionalTokenBalances"; - type: { - vec: "u64"; - }; - index: false; - }, - { - name: "postConditionalTokenSupplies"; - type: { - vec: "u64"; - }; - index: false; - }, - { - name: "seqNum"; - type: "u64"; - index: false; - }, - ]; - }, - ]; - errors: [ - { - code: 6000; - name: "AssertFailed"; - msg: "An assertion failed"; - }, - { - code: 6001; - name: "InsufficientUnderlyingTokens"; - msg: "Insufficient underlying token balance to mint this amount of conditional tokens"; - }, - { - code: 6002; - name: "InsufficientConditionalTokens"; - msg: "Insufficient conditional token balance to merge this `amount`"; - }, - { - code: 6003; - name: "InvalidVaultUnderlyingTokenAccount"; - msg: "This `vault_underlying_token_account` is not this vault's `underlying_token_account`"; - }, - { - code: 6004; - name: "InvalidConditionalTokenMint"; - msg: "This conditional token mint is not this vault's conditional token mint"; - }, - { - code: 6005; - name: "CantRedeemConditionalTokens"; - msg: "Question needs to be resolved before users can redeem conditional tokens for underlying tokens"; - }, - { - code: 6006; - name: "InsufficientNumConditions"; - msg: "Questions need 2 or more conditions"; - }, - { - code: 6007; - name: "InvalidNumPayoutNumerators"; - msg: "Invalid number of payout numerators"; - }, - { - code: 6008; - name: "InvalidConditionals"; - msg: "Client needs to pass in the list of conditional mints for a vault followed by the user's token accounts for those tokens"; - }, - { - code: 6009; - name: "ConditionalMintMismatch"; - msg: "Conditional mint not in vault"; - }, - { - code: 6010; - name: "BadConditionalMint"; - msg: "Unable to deserialize a conditional token mint"; - }, - { - code: 6011; - name: "BadConditionalTokenAccount"; - msg: "Unable to deserialize a conditional token account"; - }, - { - code: 6012; - name: "ConditionalTokenMintMismatch"; - msg: "User conditional token account mint does not match conditional mint"; - }, - { - code: 6013; - name: "PayoutZero"; - msg: "Payouts must sum to 1 or more"; - }, - { - code: 6014; - name: "QuestionAlreadyResolved"; - msg: "Question already resolved"; - }, - { - code: 6015; - name: "ConditionalTokenMetadataAlreadySet"; - msg: "Conditional token metadata already set"; - }, - ]; -}; - -export const IDL: ConditionalVault = { - version: "0.4.0", - name: "conditional_vault", - instructions: [ - { - name: "initializeQuestion", - accounts: [ - { - name: "question", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "InitializeQuestionArgs", - }, - }, - ], - }, - { - name: "resolveQuestion", - accounts: [ - { - name: "question", - isMut: true, - isSigner: false, - }, - { - name: "oracle", - isMut: false, - isSigner: true, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "ResolveQuestionArgs", - }, - }, - ], - }, - { - name: "initializeConditionalVault", - accounts: [ - { - name: "vault", - isMut: true, - isSigner: false, - }, - { - name: "question", - isMut: false, - isSigner: false, - }, - { - name: "underlyingTokenMint", - isMut: false, - isSigner: false, - }, - { - name: "vaultUnderlyingTokenAccount", - isMut: false, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "splitTokens", - accounts: [ - { - name: "question", - isMut: false, - isSigner: false, - }, - { - name: "vault", - isMut: true, - isSigner: false, - }, - { - name: "vaultUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "userUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "amount", - type: "u64", - }, - ], - }, - { - name: "mergeTokens", - accounts: [ - { - name: "question", - isMut: false, - isSigner: false, - }, - { - name: "vault", - isMut: true, - isSigner: false, - }, - { - name: "vaultUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "userUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "amount", - type: "u64", - }, - ], - }, - { - name: "redeemTokens", - accounts: [ - { - name: "question", - isMut: false, - isSigner: false, - }, - { - name: "vault", - isMut: true, - isSigner: false, - }, - { - name: "vaultUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "userUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "addMetadataToConditionalTokens", - accounts: [ - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "vault", - isMut: true, - isSigner: false, - }, - { - name: "conditionalTokenMint", - isMut: true, - isSigner: false, - }, - { - name: "conditionalTokenMetadata", - isMut: true, - isSigner: false, - }, - { - name: "tokenMetadataProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "rent", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "AddMetadataToConditionalTokensArgs", - }, - }, - ], - }, - ], - accounts: [ - { - name: "conditionalVault", - type: { - kind: "struct", - fields: [ - { - name: "question", - type: "publicKey", - }, - { - name: "underlyingTokenMint", - type: "publicKey", - }, - { - name: "underlyingTokenAccount", - type: "publicKey", - }, - { - name: "conditionalTokenMints", - type: { - vec: "publicKey", - }, - }, - { - name: "pdaBump", - type: "u8", - }, - { - name: "decimals", - type: "u8", - }, - { - name: "seqNum", - type: "u64", - }, - ], - }, - }, - { - name: "question", - docs: [ - "Questions represent statements about future events.", - "", - "These statements include:", - '- "Will this proposal pass?"', - '- "Who, if anyone, will be hired?"', - '- "How effective will the grant committee deem this grant?"', - "", - 'Questions have 2 or more possible outcomes. For a question like "will this', - 'proposal pass," the outcomes are "yes" and "no." For a question like "who', - 'will be hired," the outcomes could be "Alice," "Bob," and "neither."', - "", - 'Outcomes resolve to a number between 0 and 1. Binary questions like "will', - 'this proposal pass" have outcomes that resolve to exactly 0 or 1. You can', - 'also have questions with scalar outcomes. For example, the question "how', - 'effective will the grant committee deem this grant" could have two outcomes:', - '"ineffective" and "effective." If the grant committee deems the grant 70%', - 'effective, the "effective" outcome would resolve to 0.7 and the "ineffective"', - "outcome would resolve to 0.3.", - "", - "Once resolved, the sum of all outcome resolutions is exactly 1.", - ], - type: { - kind: "struct", - fields: [ - { - name: "questionId", - type: { - array: ["u8", 32], - }, - }, - { - name: "oracle", - type: "publicKey", - }, - { - name: "payoutNumerators", - type: { - vec: "u32", - }, - }, - { - name: "payoutDenominator", - type: "u32", - }, - ], - }, - }, - ], - types: [ - { - name: "CommonFields", - type: { - kind: "struct", - fields: [ - { - name: "slot", - type: "u64", - }, - { - name: "unixTimestamp", - type: "i64", - }, - ], - }, - }, - { - name: "AddMetadataToConditionalTokensArgs", - type: { - kind: "struct", - fields: [ - { - name: "name", - type: "string", - }, - { - name: "symbol", - type: "string", - }, - { - name: "uri", - type: "string", - }, - ], - }, - }, - { - name: "InitializeQuestionArgs", - type: { - kind: "struct", - fields: [ - { - name: "questionId", - type: { - array: ["u8", 32], - }, - }, - { - name: "oracle", - type: "publicKey", - }, - { - name: "numOutcomes", - type: "u8", - }, - ], - }, - }, - { - name: "ResolveQuestionArgs", - type: { - kind: "struct", - fields: [ - { - name: "payoutNumerators", - type: { - vec: "u32", - }, - }, - ], - }, - }, - { - name: "VaultStatus", - type: { - kind: "enum", - variants: [ - { - name: "Active", - }, - { - name: "Finalized", - }, - { - name: "Reverted", - }, - ], - }, - }, - ], - events: [ - { - name: "AddMetadataToConditionalTokensEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "vault", - type: "publicKey", - index: false, - }, - { - name: "conditionalTokenMint", - type: "publicKey", - index: false, - }, - { - name: "conditionalTokenMetadata", - type: "publicKey", - index: false, - }, - { - name: "name", - type: "string", - index: false, - }, - { - name: "symbol", - type: "string", - index: false, - }, - { - name: "uri", - type: "string", - index: false, - }, - { - name: "seqNum", - type: "u64", - index: false, - }, - ], - }, - { - name: "InitializeConditionalVaultEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "vault", - type: "publicKey", - index: false, - }, - { - name: "question", - type: "publicKey", - index: false, - }, - { - name: "underlyingTokenMint", - type: "publicKey", - index: false, - }, - { - name: "vaultUnderlyingTokenAccount", - type: "publicKey", - index: false, - }, - { - name: "conditionalTokenMints", - type: { - vec: "publicKey", - }, - index: false, - }, - { - name: "pdaBump", - type: "u8", - index: false, - }, - { - name: "seqNum", - type: "u64", - index: false, - }, - ], - }, - { - name: "InitializeQuestionEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "questionId", - type: { - array: ["u8", 32], - }, - index: false, - }, - { - name: "oracle", - type: "publicKey", - index: false, - }, - { - name: "numOutcomes", - type: "u8", - index: false, - }, - { - name: "question", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "MergeTokensEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "user", - type: "publicKey", - index: false, - }, - { - name: "vault", - type: "publicKey", - index: false, - }, - { - name: "amount", - type: "u64", - index: false, - }, - { - name: "postUserUnderlyingBalance", - type: "u64", - index: false, - }, - { - name: "postVaultUnderlyingBalance", - type: "u64", - index: false, - }, - { - name: "postUserConditionalTokenBalances", - type: { - vec: "u64", - }, - index: false, - }, - { - name: "postConditionalTokenSupplies", - type: { - vec: "u64", - }, - index: false, - }, - { - name: "seqNum", - type: "u64", - index: false, - }, - ], - }, - { - name: "RedeemTokensEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "user", - type: "publicKey", - index: false, - }, - { - name: "vault", - type: "publicKey", - index: false, - }, - { - name: "amount", - type: "u64", - index: false, - }, - { - name: "postUserUnderlyingBalance", - type: "u64", - index: false, - }, - { - name: "postVaultUnderlyingBalance", - type: "u64", - index: false, - }, - { - name: "postConditionalTokenSupplies", - type: { - vec: "u64", - }, - index: false, - }, - { - name: "seqNum", - type: "u64", - index: false, - }, - ], - }, - { - name: "ResolveQuestionEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "question", - type: "publicKey", - index: false, - }, - { - name: "payoutNumerators", - type: { - vec: "u32", - }, - index: false, - }, - ], - }, - { - name: "SplitTokensEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "user", - type: "publicKey", - index: false, - }, - { - name: "vault", - type: "publicKey", - index: false, - }, - { - name: "amount", - type: "u64", - index: false, - }, - { - name: "postUserUnderlyingBalance", - type: "u64", - index: false, - }, - { - name: "postVaultUnderlyingBalance", - type: "u64", - index: false, - }, - { - name: "postUserConditionalTokenBalances", - type: { - vec: "u64", - }, - index: false, - }, - { - name: "postConditionalTokenSupplies", - type: { - vec: "u64", - }, - index: false, - }, - { - name: "seqNum", - type: "u64", - index: false, - }, - ], - }, - ], - errors: [ - { - code: 6000, - name: "AssertFailed", - msg: "An assertion failed", - }, - { - code: 6001, - name: "InsufficientUnderlyingTokens", - msg: "Insufficient underlying token balance to mint this amount of conditional tokens", - }, - { - code: 6002, - name: "InsufficientConditionalTokens", - msg: "Insufficient conditional token balance to merge this `amount`", - }, - { - code: 6003, - name: "InvalidVaultUnderlyingTokenAccount", - msg: "This `vault_underlying_token_account` is not this vault's `underlying_token_account`", - }, - { - code: 6004, - name: "InvalidConditionalTokenMint", - msg: "This conditional token mint is not this vault's conditional token mint", - }, - { - code: 6005, - name: "CantRedeemConditionalTokens", - msg: "Question needs to be resolved before users can redeem conditional tokens for underlying tokens", - }, - { - code: 6006, - name: "InsufficientNumConditions", - msg: "Questions need 2 or more conditions", - }, - { - code: 6007, - name: "InvalidNumPayoutNumerators", - msg: "Invalid number of payout numerators", - }, - { - code: 6008, - name: "InvalidConditionals", - msg: "Client needs to pass in the list of conditional mints for a vault followed by the user's token accounts for those tokens", - }, - { - code: 6009, - name: "ConditionalMintMismatch", - msg: "Conditional mint not in vault", - }, - { - code: 6010, - name: "BadConditionalMint", - msg: "Unable to deserialize a conditional token mint", - }, - { - code: 6011, - name: "BadConditionalTokenAccount", - msg: "Unable to deserialize a conditional token account", - }, - { - code: 6012, - name: "ConditionalTokenMintMismatch", - msg: "User conditional token account mint does not match conditional mint", - }, - { - code: 6013, - name: "PayoutZero", - msg: "Payouts must sum to 1 or more", - }, - { - code: 6014, - name: "QuestionAlreadyResolved", - msg: "Question already resolved", - }, - { - code: 6015, - name: "ConditionalTokenMetadataAlreadySet", - msg: "Conditional token metadata already set", - }, - ], -}; diff --git a/sdk/src/v0.4/types/index.ts b/sdk/src/v0.4/types/index.ts deleted file mode 100644 index dd2c33f34..000000000 --- a/sdk/src/v0.4/types/index.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { Autocrat as AutocratProgram, IDL as AutocratIDL } from "./autocrat.js"; -export { AutocratProgram, AutocratIDL }; - -import { Amm as AmmProgram, IDL as AmmIDL } from "./amm.js"; -export { AmmProgram, AmmIDL }; - -import { - Launchpad as LaunchpadProgram, - IDL as LaunchpadIDL, -} from "./launchpad.js"; -export { LaunchpadProgram, LaunchpadIDL }; - -import { - ConditionalVault as ConditionalVaultProgram, - IDL as ConditionalVaultIDL, -} from "./conditional_vault.js"; -export { ConditionalVaultProgram, ConditionalVaultIDL }; - -export { LowercaseKeys } from "./utils.js"; - -import type { IdlAccounts, IdlTypes, IdlEvents } from "@coral-xyz/anchor"; -import { PublicKey } from "@solana/web3.js"; - -export type Question = IdlAccounts["question"]; -export type ConditionalVault = - IdlAccounts["conditionalVault"]; - -export type InitializeDaoParams = - IdlTypes["InitializeDaoParams"]; -export type UpdateDaoParams = IdlTypes["UpdateDaoParams"]; -export type ProposalInstruction = - IdlTypes["ProposalInstruction"]; - -export type Dao = IdlAccounts["dao"]; -export type Proposal = IdlAccounts["proposal"]; -export type Amm = IdlAccounts["amm"]; -export type Launch = IdlAccounts["launch"]; -export type FundingRecord = IdlAccounts["fundingRecord"]; - -export type SwapEvent = IdlEvents["SwapEvent"]; -export type AddLiquidityEvent = IdlEvents["AddLiquidityEvent"]; -export type RemoveLiquidityEvent = - IdlEvents["RemoveLiquidityEvent"]; -export type CreateAmmEvent = IdlEvents["CreateAmmEvent"]; -export type CrankThatTwapEvent = IdlEvents["CrankThatTwapEvent"]; -export type AmmEvent = - | SwapEvent - | AddLiquidityEvent - | RemoveLiquidityEvent - | CreateAmmEvent - | CrankThatTwapEvent; - -export type AddMetadataToConditionalTokensEvent = - IdlEvents["AddMetadataToConditionalTokensEvent"]; -export type InitializeConditionalVaultEvent = - IdlEvents["InitializeConditionalVaultEvent"]; -export type InitializeQuestionEvent = - IdlEvents["InitializeQuestionEvent"]; -export type MergeTokensEvent = - IdlEvents["MergeTokensEvent"]; -export type RedeemTokensEvent = - IdlEvents["RedeemTokensEvent"]; -export type ResolveQuestionEvent = - IdlEvents["ResolveQuestionEvent"]; -export type SplitTokensEvent = - IdlEvents["SplitTokensEvent"]; -export type ConditionalVaultEvent = - | AddMetadataToConditionalTokensEvent - | InitializeConditionalVaultEvent - | InitializeQuestionEvent - | MergeTokensEvent - | RedeemTokensEvent - | ResolveQuestionEvent - | SplitTokensEvent; - -export type LaunchClaimEvent = IdlEvents["LaunchClaimEvent"]; -export type LaunchCompletedEvent = - IdlEvents["LaunchCompletedEvent"]; -export type LaunchFundedEvent = - IdlEvents["LaunchFundedEvent"]; -export type LaunchInitializedEvent = - IdlEvents["LaunchInitializedEvent"]; -export type LaunchRefundedEvent = - IdlEvents["LaunchRefundedEvent"]; -export type LaunchStartedEvent = - IdlEvents["LaunchStartedEvent"]; -export type LaunchpadEvent = - | LaunchClaimEvent - | LaunchCompletedEvent - | LaunchFundedEvent - | LaunchInitializedEvent - | LaunchRefundedEvent - | LaunchStartedEvent; - -export type InitializeDaoEvent = - IdlEvents["InitializeDaoEvent"]; -export type UpdateDaoEvent = IdlEvents["UpdateDaoEvent"]; -export type InitializeProposalEvent = - IdlEvents["InitializeProposalEvent"]; -export type FinalizeProposalEvent = - IdlEvents["FinalizeProposalEvent"]; -export type ExecuteProposalEvent = - IdlEvents["ExecuteProposalEvent"]; -export type AutocratEvent = - | InitializeDaoEvent - | UpdateDaoEvent - | InitializeProposalEvent - | FinalizeProposalEvent - | ExecuteProposalEvent; diff --git a/sdk/src/v0.4/types/optimistic_timelock.ts b/sdk/src/v0.4/types/optimistic_timelock.ts deleted file mode 100644 index fa1f43135..000000000 --- a/sdk/src/v0.4/types/optimistic_timelock.ts +++ /dev/null @@ -1,1023 +0,0 @@ -export type OptimisticTimelock = { - version: "0.3.0"; - name: "optimistic_timelock"; - instructions: [ - { - name: "createTimelock"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: false; - }, - { - name: "timelock"; - isMut: true; - isSigner: true; - }, - ]; - args: [ - { - name: "authority"; - type: "publicKey"; - }, - { - name: "delayInSlots"; - type: "u64"; - }, - { - name: "enqueuers"; - type: { - vec: "publicKey"; - }; - }, - { - name: "enqueuerCooldownSlots"; - type: "u64"; - }, - ]; - }, - { - name: "setDelayInSlots"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "delayInSlots"; - type: "u64"; - }, - ]; - }, - { - name: "setAuthority"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "authority"; - type: "publicKey"; - }, - ]; - }, - { - name: "setOptimisticProposerCooldownSlots"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "cooldownSlots"; - type: "u64"; - }, - ]; - }, - { - name: "addOptimisticProposer"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "enqueuer"; - type: "publicKey"; - }, - ]; - }, - { - name: "removeOptimisticProposer"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "optimisticProposer"; - type: "publicKey"; - }, - ]; - }, - { - name: "createTransactionBatch"; - accounts: [ - { - name: "transactionBatchAuthority"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: false; - isSigner: false; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: true; - }, - ]; - args: []; - }, - { - name: "addTransaction"; - accounts: [ - { - name: "transactionBatchAuthority"; - isMut: false; - isSigner: true; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "programId"; - type: "publicKey"; - }, - { - name: "accounts"; - type: { - vec: { - defined: "TransactionAccount"; - }; - }; - }, - { - name: "data"; - type: "bytes"; - }, - ]; - }, - { - name: "sealTransactionBatch"; - accounts: [ - { - name: "transactionBatchAuthority"; - isMut: false; - isSigner: true; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "enqueueTransactionBatch"; - accounts: [ - { - name: "authority"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "cancelTransactionBatch"; - accounts: [ - { - name: "authority"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "executeTransactionBatch"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: false; - }, - { - name: "timelock"; - isMut: false; - isSigner: false; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - ]; - accounts: [ - { - name: "timelock"; - type: { - kind: "struct"; - fields: [ - { - name: "authority"; - type: "publicKey"; - }, - { - name: "signerBump"; - type: "u8"; - }, - { - name: "delayInSlots"; - type: "u64"; - }, - { - name: "optimisticProposers"; - type: { - vec: { - defined: "OptimisticProposer"; - }; - }; - }, - { - name: "optimisticProposerCooldownSlots"; - docs: [ - "The cooldown period for enqueuers to prevent spamming the timelock.", - ]; - type: "u64"; - }, - ]; - }; - }, - { - name: "transactionBatch"; - type: { - kind: "struct"; - fields: [ - { - name: "status"; - type: { - defined: "TransactionBatchStatus"; - }; - }, - { - name: "transactions"; - type: { - vec: { - defined: "Transaction"; - }; - }; - }, - { - name: "timelock"; - type: "publicKey"; - }, - { - name: "enqueuedSlot"; - type: "u64"; - }, - { - name: "transactionBatchAuthority"; - type: "publicKey"; - }, - { - name: "enqueuerType"; - type: { - defined: "AuthorityType"; - }; - }, - ]; - }; - }, - ]; - types: [ - { - name: "OptimisticProposer"; - type: { - kind: "struct"; - fields: [ - { - name: "pubkey"; - type: "publicKey"; - }, - { - name: "lastSlotEnqueued"; - type: "u64"; - }, - ]; - }; - }, - { - name: "Transaction"; - type: { - kind: "struct"; - fields: [ - { - name: "programId"; - type: "publicKey"; - }, - { - name: "accounts"; - type: { - vec: { - defined: "TransactionAccount"; - }; - }; - }, - { - name: "data"; - type: "bytes"; - }, - { - name: "didExecute"; - type: "bool"; - }, - ]; - }; - }, - { - name: "TransactionAccount"; - type: { - kind: "struct"; - fields: [ - { - name: "pubkey"; - type: "publicKey"; - }, - { - name: "isSigner"; - type: "bool"; - }, - { - name: "isWritable"; - type: "bool"; - }, - ]; - }; - }, - { - name: "AuthorityType"; - type: { - kind: "enum"; - variants: [ - { - name: "OptimisticProposer"; - }, - { - name: "TimelockAuthority"; - }, - ]; - }; - }, - { - name: "TransactionBatchStatus"; - type: { - kind: "enum"; - variants: [ - { - name: "Created"; - }, - { - name: "Sealed"; - }, - { - name: "Enqueued"; - }, - { - name: "Cancelled"; - }, - { - name: "Executed"; - }, - ]; - }; - }, - ]; - errors: [ - { - code: 6000; - name: "NotReady"; - msg: "This transaction is not yet ready to be executed"; - }, - { - code: 6001; - name: "CannotAddTransactions"; - msg: "Can only add instructions when transaction batch status is `Created`"; - }, - { - code: 6002; - name: "CannotSealTransactionBatch"; - msg: "Can only seal the transaction batch when status is `Created`"; - }, - { - code: 6003; - name: "CannotEnqueueTransactionBatch"; - msg: "Can only enqueue the timelock running once the status is `Sealed`"; - }, - { - code: 6004; - name: "CannotCancelTimelock"; - msg: "Can only cancel the transactions if the status `Enqueued`"; - }, - { - code: 6005; - name: "CanOnlyCancelDuringTimelockPeriod"; - msg: "Can only cancel the transactions during the timelock period"; - }, - { - code: 6006; - name: "CannotExecuteTransactions"; - msg: "Can only execute the transactions if the status is `Enqueued`"; - }, - { - code: 6007; - name: "NoAuthority"; - msg: "The signer is neither the timelock authority nor an optimistic proposer"; - }, - { - code: 6008; - name: "InsufficientPermissions"; - msg: "Optimistic proposers can't cancel transaction batches enqueued by the timelock authority"; - }, - { - code: 6009; - name: "OptimisticProposerCooldown"; - msg: "This optimistic proposer is still in its cooldown period"; - }, - ]; -}; - -export const IDL: OptimisticTimelock = { - version: "0.3.0", - name: "optimistic_timelock", - instructions: [ - { - name: "createTimelock", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: false, - }, - { - name: "timelock", - isMut: true, - isSigner: true, - }, - ], - args: [ - { - name: "authority", - type: "publicKey", - }, - { - name: "delayInSlots", - type: "u64", - }, - { - name: "enqueuers", - type: { - vec: "publicKey", - }, - }, - { - name: "enqueuerCooldownSlots", - type: "u64", - }, - ], - }, - { - name: "setDelayInSlots", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "delayInSlots", - type: "u64", - }, - ], - }, - { - name: "setAuthority", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "authority", - type: "publicKey", - }, - ], - }, - { - name: "setOptimisticProposerCooldownSlots", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "cooldownSlots", - type: "u64", - }, - ], - }, - { - name: "addOptimisticProposer", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "enqueuer", - type: "publicKey", - }, - ], - }, - { - name: "removeOptimisticProposer", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "optimisticProposer", - type: "publicKey", - }, - ], - }, - { - name: "createTransactionBatch", - accounts: [ - { - name: "transactionBatchAuthority", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: false, - isSigner: false, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: true, - }, - ], - args: [], - }, - { - name: "addTransaction", - accounts: [ - { - name: "transactionBatchAuthority", - isMut: false, - isSigner: true, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "programId", - type: "publicKey", - }, - { - name: "accounts", - type: { - vec: { - defined: "TransactionAccount", - }, - }, - }, - { - name: "data", - type: "bytes", - }, - ], - }, - { - name: "sealTransactionBatch", - accounts: [ - { - name: "transactionBatchAuthority", - isMut: false, - isSigner: true, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - { - name: "enqueueTransactionBatch", - accounts: [ - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - { - name: "cancelTransactionBatch", - accounts: [ - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - { - name: "executeTransactionBatch", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: false, - }, - { - name: "timelock", - isMut: false, - isSigner: false, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "timelock", - type: { - kind: "struct", - fields: [ - { - name: "authority", - type: "publicKey", - }, - { - name: "signerBump", - type: "u8", - }, - { - name: "delayInSlots", - type: "u64", - }, - { - name: "optimisticProposers", - type: { - vec: { - defined: "OptimisticProposer", - }, - }, - }, - { - name: "optimisticProposerCooldownSlots", - docs: [ - "The cooldown period for enqueuers to prevent spamming the timelock.", - ], - type: "u64", - }, - ], - }, - }, - { - name: "transactionBatch", - type: { - kind: "struct", - fields: [ - { - name: "status", - type: { - defined: "TransactionBatchStatus", - }, - }, - { - name: "transactions", - type: { - vec: { - defined: "Transaction", - }, - }, - }, - { - name: "timelock", - type: "publicKey", - }, - { - name: "enqueuedSlot", - type: "u64", - }, - { - name: "transactionBatchAuthority", - type: "publicKey", - }, - { - name: "enqueuerType", - type: { - defined: "AuthorityType", - }, - }, - ], - }, - }, - ], - types: [ - { - name: "OptimisticProposer", - type: { - kind: "struct", - fields: [ - { - name: "pubkey", - type: "publicKey", - }, - { - name: "lastSlotEnqueued", - type: "u64", - }, - ], - }, - }, - { - name: "Transaction", - type: { - kind: "struct", - fields: [ - { - name: "programId", - type: "publicKey", - }, - { - name: "accounts", - type: { - vec: { - defined: "TransactionAccount", - }, - }, - }, - { - name: "data", - type: "bytes", - }, - { - name: "didExecute", - type: "bool", - }, - ], - }, - }, - { - name: "TransactionAccount", - type: { - kind: "struct", - fields: [ - { - name: "pubkey", - type: "publicKey", - }, - { - name: "isSigner", - type: "bool", - }, - { - name: "isWritable", - type: "bool", - }, - ], - }, - }, - { - name: "AuthorityType", - type: { - kind: "enum", - variants: [ - { - name: "OptimisticProposer", - }, - { - name: "TimelockAuthority", - }, - ], - }, - }, - { - name: "TransactionBatchStatus", - type: { - kind: "enum", - variants: [ - { - name: "Created", - }, - { - name: "Sealed", - }, - { - name: "Enqueued", - }, - { - name: "Cancelled", - }, - { - name: "Executed", - }, - ], - }, - }, - ], - errors: [ - { - code: 6000, - name: "NotReady", - msg: "This transaction is not yet ready to be executed", - }, - { - code: 6001, - name: "CannotAddTransactions", - msg: "Can only add instructions when transaction batch status is `Created`", - }, - { - code: 6002, - name: "CannotSealTransactionBatch", - msg: "Can only seal the transaction batch when status is `Created`", - }, - { - code: 6003, - name: "CannotEnqueueTransactionBatch", - msg: "Can only enqueue the timelock running once the status is `Sealed`", - }, - { - code: 6004, - name: "CannotCancelTimelock", - msg: "Can only cancel the transactions if the status `Enqueued`", - }, - { - code: 6005, - name: "CanOnlyCancelDuringTimelockPeriod", - msg: "Can only cancel the transactions during the timelock period", - }, - { - code: 6006, - name: "CannotExecuteTransactions", - msg: "Can only execute the transactions if the status is `Enqueued`", - }, - { - code: 6007, - name: "NoAuthority", - msg: "The signer is neither the timelock authority nor an optimistic proposer", - }, - { - code: 6008, - name: "InsufficientPermissions", - msg: "Optimistic proposers can't cancel transaction batches enqueued by the timelock authority", - }, - { - code: 6009, - name: "OptimisticProposerCooldown", - msg: "This optimistic proposer is still in its cooldown period", - }, - ], -}; diff --git a/sdk/src/v0.4/types/shared_liquidity_manager.ts b/sdk/src/v0.4/types/shared_liquidity_manager.ts deleted file mode 100644 index 2de55461b..000000000 --- a/sdk/src/v0.4/types/shared_liquidity_manager.ts +++ /dev/null @@ -1,3529 +0,0 @@ -export type SharedLiquidityManager = { - version: "0.1.0"; - name: "shared_liquidity_manager"; - docs: ["TODO:", "- add unstake", "- add unit tests"]; - instructions: [ - { - name: "initializeSharedLiquidityPool"; - accounts: [ - { - name: "slPool"; - isMut: true; - isSigner: false; - }, - { - name: "dao"; - isMut: false; - isSigner: false; - }, - { - name: "creator"; - isMut: true; - isSigner: true; - }, - { - name: "creatorSlPoolPosition"; - isMut: true; - isSigner: false; - }, - { - name: "baseMint"; - isMut: false; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "slPoolSpotLpVault"; - isMut: true; - isSigner: false; - }, - { - name: "creatorQuoteTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "creatorBaseTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "creatorLpAccount"; - isMut: true; - isSigner: false; - docs: ["so Raydium will create it"]; - }, - { - name: "raydiumInitPoolStatic"; - accounts: [ - { - name: "raydiumAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "createPoolFee"; - isMut: true; - isSigner: false; - }, - { - name: "ammConfig"; - isMut: true; - isSigner: false; - }, - { - name: "cpSwapProgram"; - isMut: false; - isSigner: false; - }, - { - name: "rent"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - ]; - }, - { - name: "spotPool"; - isMut: true; - isSigner: false; - }, - { - name: "spotPoolLpMint"; - isMut: true; - isSigner: false; - }, - { - name: "spotPoolBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "spotPoolQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "spotPoolObservationState"; - isMut: true; - isSigner: false; - }, - { - name: "slPoolSigner"; - isMut: false; - isSigner: false; - }, - { - name: "slPoolBaseVault"; - isMut: false; - isSigner: false; - }, - { - name: "slPoolQuoteVault"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "cpSwapProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "InitializeSharedLiquidityPoolParams"; - }; - }, - ]; - }, - { - name: "initializeDraftProposal"; - accounts: [ - { - name: "draftProposal"; - isMut: true; - isSigner: false; - }, - { - name: "sharedLiquidityPool"; - isMut: false; - isSigner: false; - }, - { - name: "baseMint"; - isMut: false; - isSigner: false; - }, - { - name: "stakedTokenVault"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "InitializeDraftProposalParams"; - }; - }, - ]; - }, - { - name: "stakeToDraftProposal"; - accounts: [ - { - name: "draftProposal"; - isMut: true; - isSigner: false; - }, - { - name: "staker"; - isMut: false; - isSigner: true; - }, - { - name: "stakerTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "stakedTokenVault"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "stakeRecord"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "StakeToDraftProposalParams"; - }; - }, - ]; - }, - { - name: "unstakeFromDraftProposal"; - accounts: [ - { - name: "draftProposal"; - isMut: true; - isSigner: false; - }, - { - name: "staker"; - isMut: false; - isSigner: true; - }, - { - name: "stakerTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "stakedTokenVault"; - isMut: true; - isSigner: false; - }, - { - name: "stakeRecord"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "UnstakeFromDraftProposalParams"; - }; - }, - ]; - }, - { - name: "depositSharedLiquidity"; - accounts: [ - { - name: "slPool"; - isMut: true; - isSigner: false; - }, - { - name: "activeSpotPool"; - isMut: true; - isSigner: false; - }, - { - name: "slPoolSpotLpVault"; - isMut: true; - isSigner: false; - }, - { - name: "userQuoteTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userBaseTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "spotPoolBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "spotPoolQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "baseMint"; - isMut: false; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "spotPoolLpMint"; - isMut: true; - isSigner: false; - }, - { - name: "userLpTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userSlPoolPosition"; - isMut: true; - isSigner: false; - }, - { - name: "user"; - isMut: false; - isSigner: true; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "raydiumAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram2022"; - isMut: false; - isSigner: false; - }, - { - name: "cpSwapProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "DepositSharedLiquidityParams"; - }; - }, - ]; - }, - { - name: "withdrawSharedLiquidity"; - accounts: [ - { - name: "slPool"; - isMut: true; - isSigner: false; - }, - { - name: "slPoolSigner"; - isMut: false; - isSigner: false; - }, - { - name: "activeSpotPool"; - isMut: true; - isSigner: false; - }, - { - name: "slPoolSpotLpVault"; - isMut: true; - isSigner: false; - }, - { - name: "userQuoteTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userBaseTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "spotPoolBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "spotPoolQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "baseMint"; - isMut: false; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "spotPoolLpMint"; - isMut: true; - isSigner: false; - }, - { - name: "userLpTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userSlPoolPosition"; - isMut: true; - isSigner: false; - }, - { - name: "user"; - isMut: true; - isSigner: true; - }, - { - name: "feeReceiver"; - isMut: false; - isSigner: false; - }, - { - name: "raydiumAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram2022"; - isMut: false; - isSigner: false; - }, - { - name: "cpSwapProgram"; - isMut: false; - isSigner: false; - }, - { - name: "memoProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "WithdrawSharedLiquidityParams"; - }; - }, - ]; - }, - { - name: "initializeProposalWithLiquidity"; - accounts: [ - { - name: "sharedLiquidityPool"; - isMut: true; - isSigner: false; - }, - { - name: "proposalCreator"; - isMut: false; - isSigner: true; - }, - { - name: "proposal"; - isMut: true; - isSigner: false; - }, - { - name: "slPoolBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "slPoolQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "slPoolSpotLpVault"; - isMut: true; - isSigner: false; - }, - { - name: "baseMint"; - isMut: false; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "raydium"; - accounts: [ - { - name: "spotPool"; - isMut: true; - isSigner: false; - }, - { - name: "spotPoolBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "spotPoolQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "lpMint"; - isMut: true; - isSigner: false; - }, - { - name: "raydiumAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram2022"; - isMut: false; - isSigner: false; - }, - { - name: "cpSwapProgram"; - isMut: false; - isSigner: false; - }, - { - name: "memoProgram"; - isMut: false; - isSigner: false; - }, - ]; - }, - { - name: "conditionalVault"; - accounts: [ - { - name: "question"; - isMut: true; - isSigner: false; - }, - { - name: "baseVault"; - isMut: true; - isSigner: false; - }, - { - name: "quoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "baseVaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "quoteVaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "conditionalVaultProgram"; - isMut: false; - isSigner: false; - }, - { - name: "passBaseMint"; - isMut: true; - isSigner: false; - }, - { - name: "failBaseMint"; - isMut: true; - isSigner: false; - }, - { - name: "passQuoteMint"; - isMut: true; - isSigner: false; - }, - { - name: "failQuoteMint"; - isMut: true; - isSigner: false; - }, - { - name: "slPoolPassBaseVault"; - isMut: true; - isSigner: true; - }, - { - name: "slPoolFailBaseVault"; - isMut: true; - isSigner: true; - }, - { - name: "slPoolPassQuoteVault"; - isMut: true; - isSigner: true; - }, - { - name: "slPoolFailQuoteVault"; - isMut: true; - isSigner: true; - }, - { - name: "vaultEventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "slPoolSigner"; - isMut: true; - isSigner: false; - }, - ]; - }, - { - name: "amm"; - accounts: [ - { - name: "passAmm"; - isMut: true; - isSigner: false; - }, - { - name: "failAmm"; - isMut: true; - isSigner: false; - }, - { - name: "passLpMint"; - isMut: true; - isSigner: false; - }, - { - name: "failLpMint"; - isMut: true; - isSigner: false; - }, - { - name: "slPoolPassLpAccount"; - isMut: true; - isSigner: false; - }, - { - name: "slPoolFailLpAccount"; - isMut: true; - isSigner: false; - }, - { - name: "passAmmVaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "passAmmVaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "failAmmVaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "failAmmVaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "proposal"; - isMut: true; - isSigner: false; - }, - { - name: "proposalPassLpVault"; - isMut: true; - isSigner: false; - }, - { - name: "proposalFailLpVault"; - isMut: true; - isSigner: false; - }, - { - name: "ammProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "slPoolSigner"; - isMut: false; - isSigner: false; - }, - ]; - }, - { - name: "draftProposal"; - isMut: true; - isSigner: false; - }, - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "autocratProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "autocratEventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "InitializeProposalWithLiquidityParams"; - }; - }, - ]; - }, - { - name: "removeProposalLiquidity"; - accounts: [ - { - name: "slPool"; - isMut: true; - isSigner: false; - }, - { - name: "proposal"; - isMut: false; - isSigner: false; - }, - { - name: "slPoolBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "slPoolQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "slPoolSpotLpVault"; - isMut: true; - isSigner: false; - }, - { - name: "baseMint"; - isMut: false; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "raydiumInitPoolStatic"; - accounts: [ - { - name: "raydiumAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "createPoolFee"; - isMut: true; - isSigner: false; - }, - { - name: "ammConfig"; - isMut: true; - isSigner: false; - }, - { - name: "cpSwapProgram"; - isMut: false; - isSigner: false; - }, - { - name: "rent"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - ]; - }, - { - name: "raydium"; - accounts: [ - { - name: "activeSpotPool"; - isMut: true; - isSigner: false; - }, - { - name: "activeSpotPoolLpMint"; - isMut: true; - isSigner: false; - }, - { - name: "activeSpotPoolBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "activeSpotPoolQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram2022"; - isMut: false; - isSigner: false; - }, - { - name: "cpSwapProgram"; - isMut: false; - isSigner: false; - }, - { - name: "memoProgram"; - isMut: false; - isSigner: false; - }, - { - name: "nextSpotPool"; - isMut: true; - isSigner: false; - }, - { - name: "nextSpotPoolLpMint"; - isMut: true; - isSigner: false; - }, - { - name: "nextSpotPoolBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "nextSpotPoolQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "nextSpotPoolObservationState"; - isMut: true; - isSigner: false; - }, - { - name: "slPoolNextSpotLpVault"; - isMut: true; - isSigner: false; - }, - { - name: "slPool"; - isMut: false; - isSigner: false; - }, - { - name: "slPoolSigner"; - isMut: false; - isSigner: false; - }, - { - name: "baseMint"; - isMut: false; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - ]; - }, - { - name: "conditionalVault"; - accounts: [ - { - name: "question"; - isMut: true; - isSigner: false; - }, - { - name: "baseVault"; - isMut: true; - isSigner: false; - }, - { - name: "quoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "baseVaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "quoteVaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "conditionalVaultProgram"; - isMut: false; - isSigner: false; - }, - { - name: "passBaseMint"; - isMut: true; - isSigner: false; - }, - { - name: "failBaseMint"; - isMut: true; - isSigner: false; - }, - { - name: "passQuoteMint"; - isMut: true; - isSigner: false; - }, - { - name: "failQuoteMint"; - isMut: true; - isSigner: false; - }, - { - name: "slPoolPassBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "slPoolFailBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "slPoolPassQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "slPoolFailQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "vaultEventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "slPoolSigner"; - isMut: true; - isSigner: false; - }, - ]; - }, - { - name: "ammm"; - accounts: [ - { - name: "passAmm"; - isMut: true; - isSigner: false; - }, - { - name: "failAmm"; - isMut: true; - isSigner: false; - }, - { - name: "passLpMint"; - isMut: true; - isSigner: false; - }, - { - name: "failLpMint"; - isMut: true; - isSigner: false; - }, - { - name: "slPoolPassLpAccount"; - isMut: true; - isSigner: false; - }, - { - name: "slPoolFailLpAccount"; - isMut: true; - isSigner: false; - }, - { - name: "passAmmVaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "passAmmVaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "failAmmVaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "failAmmVaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "ammProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "slPoolSigner"; - isMut: false; - isSigner: false; - }, - ]; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - ]; - accounts: [ - { - name: "draftProposal"; - type: { - kind: "struct"; - fields: [ - { - name: "sharedLiquidityPool"; - type: "publicKey"; - }, - { - name: "baseMint"; - type: "publicKey"; - }, - { - name: "instruction"; - type: { - defined: "ProposalInstruction"; - }; - }, - { - name: "status"; - type: { - defined: "DraftProposalStatus"; - }; - }, - { - name: "stakedTokenAmount"; - docs: [ - "The amount of tokens that have been staked on this draft proposal", - ]; - type: "u64"; - }, - { - name: "stakedTokenVault"; - docs: ["The vault that holds the staked tokens"]; - type: "publicKey"; - }, - { - name: "nonce"; - docs: ["The nonce used to create this draft proposal PDA"]; - type: "u64"; - }, - { - name: "pdaBump"; - type: "u8"; - }, - ]; - }; - }, - { - name: "liquidityPosition"; - type: { - kind: "struct"; - fields: [ - { - name: "owner"; - docs: ["The owner of this position"]; - type: "publicKey"; - }, - { - name: "pool"; - docs: ["The shared liquidity pool this position belongs to"]; - type: "publicKey"; - }, - { - name: "underlyingSpotLpShares"; - docs: [ - "The amount of underlying spot LP shares this position represents", - ]; - type: "u64"; - }, - { - name: "bump"; - docs: ["The PDA bump"]; - type: "u8"; - }, - ]; - }; - }, - { - name: "sharedLiquidityPool"; - type: { - kind: "struct"; - fields: [ - { - name: "pdaBump"; - docs: ["The PDA bump."]; - type: "u8"; - }, - { - name: "dao"; - docs: ["The DAO."]; - type: "publicKey"; - }, - { - name: "baseMint"; - docs: ["The base mint."]; - type: "publicKey"; - }, - { - name: "quoteMint"; - docs: ["The quote mint."]; - type: "publicKey"; - }, - { - name: "slPoolSigner"; - docs: [ - "The signer of this pool, used because Raydium pools need a SOL payer and this PDA can't hold SOL.", - ]; - type: "publicKey"; - }, - { - name: "slPoolSignerBump"; - docs: ["The pda bump of the signer."]; - type: "u8"; - }, - { - name: "slPoolBaseVault"; - docs: [ - "Holds the base tokens for the shared liquidity pool when it's moving liquidity around.", - ]; - type: "publicKey"; - }, - { - name: "slPoolQuoteVault"; - docs: [ - "Holds the quote tokens for the shared liquidity pool when it's moving liquidity around.", - ]; - type: "publicKey"; - }, - { - name: "slPoolSpotLpVault"; - docs: ["Holds the LP tokens for the shared liquidity pool."]; - type: "publicKey"; - }, - { - name: "activeProposal"; - docs: ["The proposal that's using liquidity from this pool."]; - type: { - option: "publicKey"; - }; - }, - { - name: "proposalStakeRateThresholdBps"; - docs: [ - "The percentage of a token's supply, in basis points, that needs to be", - "staked to a draft proposal before it can be initialized.", - ]; - type: "u16"; - }, - { - name: "seqNum"; - docs: [ - "The sequence number of this shared liquidity pool. Useful for sorting events.", - ]; - type: "u64"; - }, - { - name: "activeSpotPool"; - docs: [ - "The current Raydium spot pool. Changes when a proposal is removed.", - ]; - type: "publicKey"; - }, - { - name: "activeSpotPoolIndex"; - docs: [ - "The index of the current Raydium spot pool. Starts at 0 and increments by 1 for each new spot pool.", - ]; - type: "u32"; - }, - { - name: "isBaseToken0"; - docs: [ - "Whether the base token is token0 in the current Raydium spot pool (otherwise it's token1).", - ]; - type: "bool"; - }, - ]; - }; - }, - { - name: "stakeRecord"; - type: { - kind: "struct"; - fields: [ - { - name: "staker"; - type: "publicKey"; - }, - { - name: "amount"; - type: "u64"; - }, - ]; - }; - }, - ]; - types: [ - { - name: "DepositSharedLiquidityParams"; - type: { - kind: "struct"; - fields: [ - { - name: "lpTokenAmount"; - docs: ["The amount of LP tokens to mint"]; - type: "u64"; - }, - { - name: "maxQuoteTokenAmount"; - docs: ["The maximum amount of quote tokens to deposit"]; - type: "u64"; - }, - { - name: "maxBaseTokenAmount"; - docs: ["The maximum amount of base tokens to deposit"]; - type: "u64"; - }, - ]; - }; - }, - { - name: "InitializeDraftProposalParams"; - type: { - kind: "struct"; - fields: [ - { - name: "instruction"; - type: { - defined: "ProposalInstruction"; - }; - }, - { - name: "draftProposalNonce"; - docs: [ - "The nonce for the draft proposal, not used for anything aside from the PDA", - ]; - type: "u64"; - }, - ]; - }; - }, - { - name: "InitializeProposalWithLiquidityParams"; - type: { - kind: "struct"; - fields: [ - { - name: "nonce"; - type: "u64"; - }, - ]; - }; - }, - { - name: "InitializeSharedLiquidityPoolParams"; - type: { - kind: "struct"; - fields: [ - { - name: "baseAmount"; - type: "u64"; - }, - { - name: "quoteAmount"; - type: "u64"; - }, - { - name: "proposalStakeRateThresholdBps"; - type: "u16"; - }, - ]; - }; - }, - { - name: "StakeToDraftProposalParams"; - type: { - kind: "struct"; - fields: [ - { - name: "amount"; - type: "u64"; - }, - ]; - }; - }, - { - name: "UnstakeFromDraftProposalParams"; - type: { - kind: "struct"; - fields: [ - { - name: "amount"; - type: "u64"; - }, - ]; - }; - }, - { - name: "WithdrawSharedLiquidityParams"; - type: { - kind: "struct"; - fields: [ - { - name: "lpTokenAmount"; - docs: ["The amount of LP tokens to withdraw"]; - type: "u64"; - }, - { - name: "minimumToken0Amount"; - docs: ["The minimum amount of token0 to receive"]; - type: "u64"; - }, - { - name: "minimumToken1Amount"; - docs: ["The minimum amount of token1 to receive"]; - type: "u64"; - }, - ]; - }; - }, - { - name: "ProposalAccount"; - type: { - kind: "struct"; - fields: [ - { - name: "pubkey"; - type: "publicKey"; - }, - { - name: "isSigner"; - type: "bool"; - }, - { - name: "isWritable"; - type: "bool"; - }, - ]; - }; - }, - { - name: "ProposalInstruction"; - type: { - kind: "struct"; - fields: [ - { - name: "programId"; - type: "publicKey"; - }, - { - name: "accounts"; - type: { - vec: { - defined: "ProposalAccount"; - }; - }; - }, - { - name: "data"; - type: "bytes"; - }, - ]; - }; - }, - { - name: "DraftProposalStatus"; - type: { - kind: "enum"; - variants: [ - { - name: "Draft"; - }, - { - name: "Initialized"; - }, - ]; - }; - }, - ]; - errors: [ - { - code: 6000; - name: "InsufficientStake"; - msg: "Insufficient stake amount"; - }, - { - code: 6001; - name: "ProposalNotFinalized"; - msg: "Proposal is not finalized"; - }, - { - code: 6002; - name: "NoLpTokensToRemove"; - msg: "No LP tokens to remove from AMM"; - }, - { - code: 6003; - name: "NoTokensFromAmm"; - msg: "No tokens received from AMM removal"; - }, - { - code: 6004; - name: "InsufficientReservesReturned"; - msg: "Insufficient reserves returned to spot AMM (less than 99.5%)"; - }, - { - code: 6005; - name: "PoolInUse"; - msg: "Pool is currently being used by an active proposal"; - }, - { - code: 6006; - name: "InsufficientLpShares"; - msg: "User does not have enough LP shares to withdraw"; - }, - { - code: 6007; - name: "SlippageExceeded"; - msg: "Slippage exceeded minimum token amounts"; - }, - { - code: 6008; - name: "NoLpTokensInPool"; - msg: "No LP tokens in pool's LP token account"; - }, - { - code: 6009; - name: "NotEnoughLpTokens"; - msg: "Not enough LP tokens to provide liquidity to proposal"; - }, - { - code: 6010; - name: "InsufficientFunds"; - msg: "Insufficient funds"; - }, - { - code: 6011; - name: "NoActiveProposal"; - msg: "No active proposal"; - }, - { - code: 6012; - name: "ProposalNotInDraftStatus"; - msg: "Proposal is not in draft status"; - }, - { - code: 6013; - name: "ProposalAlreadyActive"; - msg: "Proposal already active"; - }, - { - code: 6014; - name: "AmmAlreadyHasLiquidity"; - msg: "AMM already has liquidity"; - }, - { - code: 6015; - name: "QuestionAlreadyResolved"; - msg: "Question already resolved"; - }, - ]; -}; - -export const IDL: SharedLiquidityManager = { - version: "0.1.0", - name: "shared_liquidity_manager", - docs: ["TODO:", "- add unstake", "- add unit tests"], - instructions: [ - { - name: "initializeSharedLiquidityPool", - accounts: [ - { - name: "slPool", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: false, - isSigner: false, - }, - { - name: "creator", - isMut: true, - isSigner: true, - }, - { - name: "creatorSlPoolPosition", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "slPoolSpotLpVault", - isMut: true, - isSigner: false, - }, - { - name: "creatorQuoteTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "creatorBaseTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "creatorLpAccount", - isMut: true, - isSigner: false, - docs: ["so Raydium will create it"], - }, - { - name: "raydiumInitPoolStatic", - accounts: [ - { - name: "raydiumAuthority", - isMut: false, - isSigner: false, - }, - { - name: "createPoolFee", - isMut: true, - isSigner: false, - }, - { - name: "ammConfig", - isMut: true, - isSigner: false, - }, - { - name: "cpSwapProgram", - isMut: false, - isSigner: false, - }, - { - name: "rent", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - ], - }, - { - name: "spotPool", - isMut: true, - isSigner: false, - }, - { - name: "spotPoolLpMint", - isMut: true, - isSigner: false, - }, - { - name: "spotPoolBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "spotPoolQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "spotPoolObservationState", - isMut: true, - isSigner: false, - }, - { - name: "slPoolSigner", - isMut: false, - isSigner: false, - }, - { - name: "slPoolBaseVault", - isMut: false, - isSigner: false, - }, - { - name: "slPoolQuoteVault", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "cpSwapProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "InitializeSharedLiquidityPoolParams", - }, - }, - ], - }, - { - name: "initializeDraftProposal", - accounts: [ - { - name: "draftProposal", - isMut: true, - isSigner: false, - }, - { - name: "sharedLiquidityPool", - isMut: false, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "stakedTokenVault", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "InitializeDraftProposalParams", - }, - }, - ], - }, - { - name: "stakeToDraftProposal", - accounts: [ - { - name: "draftProposal", - isMut: true, - isSigner: false, - }, - { - name: "staker", - isMut: false, - isSigner: true, - }, - { - name: "stakerTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "stakedTokenVault", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "stakeRecord", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "StakeToDraftProposalParams", - }, - }, - ], - }, - { - name: "unstakeFromDraftProposal", - accounts: [ - { - name: "draftProposal", - isMut: true, - isSigner: false, - }, - { - name: "staker", - isMut: false, - isSigner: true, - }, - { - name: "stakerTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "stakedTokenVault", - isMut: true, - isSigner: false, - }, - { - name: "stakeRecord", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "UnstakeFromDraftProposalParams", - }, - }, - ], - }, - { - name: "depositSharedLiquidity", - accounts: [ - { - name: "slPool", - isMut: true, - isSigner: false, - }, - { - name: "activeSpotPool", - isMut: true, - isSigner: false, - }, - { - name: "slPoolSpotLpVault", - isMut: true, - isSigner: false, - }, - { - name: "userQuoteTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "userBaseTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "spotPoolBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "spotPoolQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "spotPoolLpMint", - isMut: true, - isSigner: false, - }, - { - name: "userLpTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "userSlPoolPosition", - isMut: true, - isSigner: false, - }, - { - name: "user", - isMut: false, - isSigner: true, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "raydiumAuthority", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram2022", - isMut: false, - isSigner: false, - }, - { - name: "cpSwapProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "DepositSharedLiquidityParams", - }, - }, - ], - }, - { - name: "withdrawSharedLiquidity", - accounts: [ - { - name: "slPool", - isMut: true, - isSigner: false, - }, - { - name: "slPoolSigner", - isMut: false, - isSigner: false, - }, - { - name: "activeSpotPool", - isMut: true, - isSigner: false, - }, - { - name: "slPoolSpotLpVault", - isMut: true, - isSigner: false, - }, - { - name: "userQuoteTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "userBaseTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "spotPoolBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "spotPoolQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "spotPoolLpMint", - isMut: true, - isSigner: false, - }, - { - name: "userLpTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "userSlPoolPosition", - isMut: true, - isSigner: false, - }, - { - name: "user", - isMut: true, - isSigner: true, - }, - { - name: "feeReceiver", - isMut: false, - isSigner: false, - }, - { - name: "raydiumAuthority", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram2022", - isMut: false, - isSigner: false, - }, - { - name: "cpSwapProgram", - isMut: false, - isSigner: false, - }, - { - name: "memoProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "WithdrawSharedLiquidityParams", - }, - }, - ], - }, - { - name: "initializeProposalWithLiquidity", - accounts: [ - { - name: "sharedLiquidityPool", - isMut: true, - isSigner: false, - }, - { - name: "proposalCreator", - isMut: false, - isSigner: true, - }, - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "slPoolBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "slPoolQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "slPoolSpotLpVault", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "raydium", - accounts: [ - { - name: "spotPool", - isMut: true, - isSigner: false, - }, - { - name: "spotPoolBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "spotPoolQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "lpMint", - isMut: true, - isSigner: false, - }, - { - name: "raydiumAuthority", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram2022", - isMut: false, - isSigner: false, - }, - { - name: "cpSwapProgram", - isMut: false, - isSigner: false, - }, - { - name: "memoProgram", - isMut: false, - isSigner: false, - }, - ], - }, - { - name: "conditionalVault", - accounts: [ - { - name: "question", - isMut: true, - isSigner: false, - }, - { - name: "baseVault", - isMut: true, - isSigner: false, - }, - { - name: "quoteVault", - isMut: true, - isSigner: false, - }, - { - name: "baseVaultUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "quoteVaultUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "conditionalVaultProgram", - isMut: false, - isSigner: false, - }, - { - name: "passBaseMint", - isMut: true, - isSigner: false, - }, - { - name: "failBaseMint", - isMut: true, - isSigner: false, - }, - { - name: "passQuoteMint", - isMut: true, - isSigner: false, - }, - { - name: "failQuoteMint", - isMut: true, - isSigner: false, - }, - { - name: "slPoolPassBaseVault", - isMut: true, - isSigner: true, - }, - { - name: "slPoolFailBaseVault", - isMut: true, - isSigner: true, - }, - { - name: "slPoolPassQuoteVault", - isMut: true, - isSigner: true, - }, - { - name: "slPoolFailQuoteVault", - isMut: true, - isSigner: true, - }, - { - name: "vaultEventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "slPoolSigner", - isMut: true, - isSigner: false, - }, - ], - }, - { - name: "amm", - accounts: [ - { - name: "passAmm", - isMut: true, - isSigner: false, - }, - { - name: "failAmm", - isMut: true, - isSigner: false, - }, - { - name: "passLpMint", - isMut: true, - isSigner: false, - }, - { - name: "failLpMint", - isMut: true, - isSigner: false, - }, - { - name: "slPoolPassLpAccount", - isMut: true, - isSigner: false, - }, - { - name: "slPoolFailLpAccount", - isMut: true, - isSigner: false, - }, - { - name: "passAmmVaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "passAmmVaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "failAmmVaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "failAmmVaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "proposalPassLpVault", - isMut: true, - isSigner: false, - }, - { - name: "proposalFailLpVault", - isMut: true, - isSigner: false, - }, - { - name: "ammProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "slPoolSigner", - isMut: false, - isSigner: false, - }, - ], - }, - { - name: "draftProposal", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "autocratProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "autocratEventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "InitializeProposalWithLiquidityParams", - }, - }, - ], - }, - { - name: "removeProposalLiquidity", - accounts: [ - { - name: "slPool", - isMut: true, - isSigner: false, - }, - { - name: "proposal", - isMut: false, - isSigner: false, - }, - { - name: "slPoolBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "slPoolQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "slPoolSpotLpVault", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "raydiumInitPoolStatic", - accounts: [ - { - name: "raydiumAuthority", - isMut: false, - isSigner: false, - }, - { - name: "createPoolFee", - isMut: true, - isSigner: false, - }, - { - name: "ammConfig", - isMut: true, - isSigner: false, - }, - { - name: "cpSwapProgram", - isMut: false, - isSigner: false, - }, - { - name: "rent", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - ], - }, - { - name: "raydium", - accounts: [ - { - name: "activeSpotPool", - isMut: true, - isSigner: false, - }, - { - name: "activeSpotPoolLpMint", - isMut: true, - isSigner: false, - }, - { - name: "activeSpotPoolBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "activeSpotPoolQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram2022", - isMut: false, - isSigner: false, - }, - { - name: "cpSwapProgram", - isMut: false, - isSigner: false, - }, - { - name: "memoProgram", - isMut: false, - isSigner: false, - }, - { - name: "nextSpotPool", - isMut: true, - isSigner: false, - }, - { - name: "nextSpotPoolLpMint", - isMut: true, - isSigner: false, - }, - { - name: "nextSpotPoolBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "nextSpotPoolQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "nextSpotPoolObservationState", - isMut: true, - isSigner: false, - }, - { - name: "slPoolNextSpotLpVault", - isMut: true, - isSigner: false, - }, - { - name: "slPool", - isMut: false, - isSigner: false, - }, - { - name: "slPoolSigner", - isMut: false, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - ], - }, - { - name: "conditionalVault", - accounts: [ - { - name: "question", - isMut: true, - isSigner: false, - }, - { - name: "baseVault", - isMut: true, - isSigner: false, - }, - { - name: "quoteVault", - isMut: true, - isSigner: false, - }, - { - name: "baseVaultUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "quoteVaultUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "conditionalVaultProgram", - isMut: false, - isSigner: false, - }, - { - name: "passBaseMint", - isMut: true, - isSigner: false, - }, - { - name: "failBaseMint", - isMut: true, - isSigner: false, - }, - { - name: "passQuoteMint", - isMut: true, - isSigner: false, - }, - { - name: "failQuoteMint", - isMut: true, - isSigner: false, - }, - { - name: "slPoolPassBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "slPoolFailBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "slPoolPassQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "slPoolFailQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "vaultEventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "slPoolSigner", - isMut: true, - isSigner: false, - }, - ], - }, - { - name: "ammm", - accounts: [ - { - name: "passAmm", - isMut: true, - isSigner: false, - }, - { - name: "failAmm", - isMut: true, - isSigner: false, - }, - { - name: "passLpMint", - isMut: true, - isSigner: false, - }, - { - name: "failLpMint", - isMut: true, - isSigner: false, - }, - { - name: "slPoolPassLpAccount", - isMut: true, - isSigner: false, - }, - { - name: "slPoolFailLpAccount", - isMut: true, - isSigner: false, - }, - { - name: "passAmmVaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "passAmmVaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "failAmmVaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "failAmmVaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "ammProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "slPoolSigner", - isMut: false, - isSigner: false, - }, - ], - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "draftProposal", - type: { - kind: "struct", - fields: [ - { - name: "sharedLiquidityPool", - type: "publicKey", - }, - { - name: "baseMint", - type: "publicKey", - }, - { - name: "instruction", - type: { - defined: "ProposalInstruction", - }, - }, - { - name: "status", - type: { - defined: "DraftProposalStatus", - }, - }, - { - name: "stakedTokenAmount", - docs: [ - "The amount of tokens that have been staked on this draft proposal", - ], - type: "u64", - }, - { - name: "stakedTokenVault", - docs: ["The vault that holds the staked tokens"], - type: "publicKey", - }, - { - name: "nonce", - docs: ["The nonce used to create this draft proposal PDA"], - type: "u64", - }, - { - name: "pdaBump", - type: "u8", - }, - ], - }, - }, - { - name: "liquidityPosition", - type: { - kind: "struct", - fields: [ - { - name: "owner", - docs: ["The owner of this position"], - type: "publicKey", - }, - { - name: "pool", - docs: ["The shared liquidity pool this position belongs to"], - type: "publicKey", - }, - { - name: "underlyingSpotLpShares", - docs: [ - "The amount of underlying spot LP shares this position represents", - ], - type: "u64", - }, - { - name: "bump", - docs: ["The PDA bump"], - type: "u8", - }, - ], - }, - }, - { - name: "sharedLiquidityPool", - type: { - kind: "struct", - fields: [ - { - name: "pdaBump", - docs: ["The PDA bump."], - type: "u8", - }, - { - name: "dao", - docs: ["The DAO."], - type: "publicKey", - }, - { - name: "baseMint", - docs: ["The base mint."], - type: "publicKey", - }, - { - name: "quoteMint", - docs: ["The quote mint."], - type: "publicKey", - }, - { - name: "slPoolSigner", - docs: [ - "The signer of this pool, used because Raydium pools need a SOL payer and this PDA can't hold SOL.", - ], - type: "publicKey", - }, - { - name: "slPoolSignerBump", - docs: ["The pda bump of the signer."], - type: "u8", - }, - { - name: "slPoolBaseVault", - docs: [ - "Holds the base tokens for the shared liquidity pool when it's moving liquidity around.", - ], - type: "publicKey", - }, - { - name: "slPoolQuoteVault", - docs: [ - "Holds the quote tokens for the shared liquidity pool when it's moving liquidity around.", - ], - type: "publicKey", - }, - { - name: "slPoolSpotLpVault", - docs: ["Holds the LP tokens for the shared liquidity pool."], - type: "publicKey", - }, - { - name: "activeProposal", - docs: ["The proposal that's using liquidity from this pool."], - type: { - option: "publicKey", - }, - }, - { - name: "proposalStakeRateThresholdBps", - docs: [ - "The percentage of a token's supply, in basis points, that needs to be", - "staked to a draft proposal before it can be initialized.", - ], - type: "u16", - }, - { - name: "seqNum", - docs: [ - "The sequence number of this shared liquidity pool. Useful for sorting events.", - ], - type: "u64", - }, - { - name: "activeSpotPool", - docs: [ - "The current Raydium spot pool. Changes when a proposal is removed.", - ], - type: "publicKey", - }, - { - name: "activeSpotPoolIndex", - docs: [ - "The index of the current Raydium spot pool. Starts at 0 and increments by 1 for each new spot pool.", - ], - type: "u32", - }, - { - name: "isBaseToken0", - docs: [ - "Whether the base token is token0 in the current Raydium spot pool (otherwise it's token1).", - ], - type: "bool", - }, - ], - }, - }, - { - name: "stakeRecord", - type: { - kind: "struct", - fields: [ - { - name: "staker", - type: "publicKey", - }, - { - name: "amount", - type: "u64", - }, - ], - }, - }, - ], - types: [ - { - name: "DepositSharedLiquidityParams", - type: { - kind: "struct", - fields: [ - { - name: "lpTokenAmount", - docs: ["The amount of LP tokens to mint"], - type: "u64", - }, - { - name: "maxQuoteTokenAmount", - docs: ["The maximum amount of quote tokens to deposit"], - type: "u64", - }, - { - name: "maxBaseTokenAmount", - docs: ["The maximum amount of base tokens to deposit"], - type: "u64", - }, - ], - }, - }, - { - name: "InitializeDraftProposalParams", - type: { - kind: "struct", - fields: [ - { - name: "instruction", - type: { - defined: "ProposalInstruction", - }, - }, - { - name: "draftProposalNonce", - docs: [ - "The nonce for the draft proposal, not used for anything aside from the PDA", - ], - type: "u64", - }, - ], - }, - }, - { - name: "InitializeProposalWithLiquidityParams", - type: { - kind: "struct", - fields: [ - { - name: "nonce", - type: "u64", - }, - ], - }, - }, - { - name: "InitializeSharedLiquidityPoolParams", - type: { - kind: "struct", - fields: [ - { - name: "baseAmount", - type: "u64", - }, - { - name: "quoteAmount", - type: "u64", - }, - { - name: "proposalStakeRateThresholdBps", - type: "u16", - }, - ], - }, - }, - { - name: "StakeToDraftProposalParams", - type: { - kind: "struct", - fields: [ - { - name: "amount", - type: "u64", - }, - ], - }, - }, - { - name: "UnstakeFromDraftProposalParams", - type: { - kind: "struct", - fields: [ - { - name: "amount", - type: "u64", - }, - ], - }, - }, - { - name: "WithdrawSharedLiquidityParams", - type: { - kind: "struct", - fields: [ - { - name: "lpTokenAmount", - docs: ["The amount of LP tokens to withdraw"], - type: "u64", - }, - { - name: "minimumToken0Amount", - docs: ["The minimum amount of token0 to receive"], - type: "u64", - }, - { - name: "minimumToken1Amount", - docs: ["The minimum amount of token1 to receive"], - type: "u64", - }, - ], - }, - }, - { - name: "ProposalAccount", - type: { - kind: "struct", - fields: [ - { - name: "pubkey", - type: "publicKey", - }, - { - name: "isSigner", - type: "bool", - }, - { - name: "isWritable", - type: "bool", - }, - ], - }, - }, - { - name: "ProposalInstruction", - type: { - kind: "struct", - fields: [ - { - name: "programId", - type: "publicKey", - }, - { - name: "accounts", - type: { - vec: { - defined: "ProposalAccount", - }, - }, - }, - { - name: "data", - type: "bytes", - }, - ], - }, - }, - { - name: "DraftProposalStatus", - type: { - kind: "enum", - variants: [ - { - name: "Draft", - }, - { - name: "Initialized", - }, - ], - }, - }, - ], - errors: [ - { - code: 6000, - name: "InsufficientStake", - msg: "Insufficient stake amount", - }, - { - code: 6001, - name: "ProposalNotFinalized", - msg: "Proposal is not finalized", - }, - { - code: 6002, - name: "NoLpTokensToRemove", - msg: "No LP tokens to remove from AMM", - }, - { - code: 6003, - name: "NoTokensFromAmm", - msg: "No tokens received from AMM removal", - }, - { - code: 6004, - name: "InsufficientReservesReturned", - msg: "Insufficient reserves returned to spot AMM (less than 99.5%)", - }, - { - code: 6005, - name: "PoolInUse", - msg: "Pool is currently being used by an active proposal", - }, - { - code: 6006, - name: "InsufficientLpShares", - msg: "User does not have enough LP shares to withdraw", - }, - { - code: 6007, - name: "SlippageExceeded", - msg: "Slippage exceeded minimum token amounts", - }, - { - code: 6008, - name: "NoLpTokensInPool", - msg: "No LP tokens in pool's LP token account", - }, - { - code: 6009, - name: "NotEnoughLpTokens", - msg: "Not enough LP tokens to provide liquidity to proposal", - }, - { - code: 6010, - name: "InsufficientFunds", - msg: "Insufficient funds", - }, - { - code: 6011, - name: "NoActiveProposal", - msg: "No active proposal", - }, - { - code: 6012, - name: "ProposalNotInDraftStatus", - msg: "Proposal is not in draft status", - }, - { - code: 6013, - name: "ProposalAlreadyActive", - msg: "Proposal already active", - }, - { - code: 6014, - name: "AmmAlreadyHasLiquidity", - msg: "AMM already has liquidity", - }, - { - code: 6015, - name: "QuestionAlreadyResolved", - msg: "Question already resolved", - }, - ], -}; diff --git a/sdk/src/v0.4/types/utils.ts b/sdk/src/v0.4/types/utils.ts deleted file mode 100644 index c878debe7..000000000 --- a/sdk/src/v0.4/types/utils.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type LowercaseKeys = { - [K in keyof T as Lowercase]: T[K]; -}; diff --git a/sdk/src/v0.4/utils/cu.ts b/sdk/src/v0.4/utils/cu.ts deleted file mode 100644 index b55cbac95..000000000 --- a/sdk/src/v0.4/utils/cu.ts +++ /dev/null @@ -1,11 +0,0 @@ -export const MaxCUs = { - initializeDao: 40_000, - createIdempotent: 25_000, - initializeConditionalVault: 45_000, - mintConditionalTokens: 35_000, - initializeAmm: 120_000, - addLiquidity: 120_000, - initializeProposal: 60_000, -}; - -export const DEFAULT_CU_PRICE = 1; diff --git a/sdk/src/v0.4/utils/filters.ts b/sdk/src/v0.4/utils/filters.ts deleted file mode 100644 index aee93f618..000000000 --- a/sdk/src/v0.4/utils/filters.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { GetProgramAccountsFilter, PublicKey } from "@solana/web3.js"; - -export const filterPositionsByUser = ( - userAddr: PublicKey, -): GetProgramAccountsFilter => ({ - memcmp: { - offset: 8, // discriminator - bytes: userAddr.toBase58(), - }, -}); - -export const filterPositionsByAmm = ( - ammAddr: PublicKey, -): GetProgramAccountsFilter => ({ - memcmp: { - offset: - 8 + // discriminator - 32, // user address - bytes: ammAddr.toBase58(), - }, -}); diff --git a/sdk/src/v0.4/utils/index.ts b/sdk/src/v0.4/utils/index.ts deleted file mode 100644 index ee7438b0a..000000000 --- a/sdk/src/v0.4/utils/index.ts +++ /dev/null @@ -1,40 +0,0 @@ -export * from "./filters.js"; -export * from "./pda.js"; -export * from "./priceMath.js"; -export * from "./metadata.js"; -export * from "./cu.js"; -export * from "./instruction.js"; - -import { AccountMeta, ComputeBudgetProgram, PublicKey } from "@solana/web3.js"; - -export enum PriorityFeeTier { - NORMAL = 35, - HIGH = 3571, - TURBO = 357142, -} - -export const addComputeUnits = (num_units: number = 1_400_000) => - ComputeBudgetProgram.setComputeUnitLimit({ - units: num_units, - }); - -export const addPriorityFee = (pf: number) => - ComputeBudgetProgram.setComputeUnitPrice({ - microLamports: pf, - }); - -export const pubkeyToAccountInfo = ( - pubkey: PublicKey, - isWritable: boolean, - isSigner = false, -): AccountMeta => { - return { - pubkey: pubkey, - isSigner: isSigner, - isWritable: isWritable, - }; -}; - -export async function sleep(ms: number) { - return new Promise((resolve) => setTimeout(resolve, ms)); -} diff --git a/sdk/src/v0.4/utils/instruction.ts b/sdk/src/v0.4/utils/instruction.ts deleted file mode 100644 index f18e48834..000000000 --- a/sdk/src/v0.4/utils/instruction.ts +++ /dev/null @@ -1,16 +0,0 @@ -import * as anchor from "@coral-xyz/anchor"; -import { TransactionInstruction } from "@solana/web3.js"; - -export class InstructionUtils { - public static async getInstructions( - ...methodBuilders: any[] - ): Promise { - let instructions: TransactionInstruction[] = []; - - for (const methodBuilder of methodBuilders) { - instructions.push(...(await methodBuilder.transaction()).instructions); - } - - return instructions; - } -} diff --git a/sdk/src/v0.4/utils/metadata.ts b/sdk/src/v0.4/utils/metadata.ts deleted file mode 100644 index ef17bbdb8..000000000 --- a/sdk/src/v0.4/utils/metadata.ts +++ /dev/null @@ -1,35 +0,0 @@ -import BN from "bn.js"; -import { createUmi } from "@metaplex-foundation/umi-bundle-defaults"; -import { Connection } from "@solana/web3.js"; -import { bundlrUploader } from "@metaplex-foundation/umi-uploader-bundlr"; -import { UmiPlugin } from "@metaplex-foundation/umi"; - -export const assetImageMap: Record = { - fMETA: "https://arweave.net/tGxvOjMZw7B0qHsdCcIMO57oH5g5OaItOZdXo3BXKz8", - fUSDC: "https://arweave.net/DpvxeAyVbaoivhIVCLjdf566k2SwVn0YVBL0sTOezWk", - pMETA: "https://arweave.net/iuqi7PRRESdDxj1oRyk2WzR90_zdFcmZsuWicv3XGfs", - pUSDC: "https://arweave.net/e4IO7F59F_RKCiuB--_ABPot7Qh1yFsGkWzVhcXuKDU", -}; - -// Upload some JSON, returning its URL -export const uploadConditionalTokenMetadataJson = async ( - connection: Connection, - identityPlugin: UmiPlugin, - proposalNumber: number, - symbol: string, - // proposal: BN, - // conditionalToken: string, - // image: string -): Promise => { - // use bundlr, targeting arweave - const umi = createUmi(connection); - umi.use(bundlrUploader()); - umi.use(identityPlugin); - - return umi.uploader.uploadJson({ - name: `Proposal ${proposalNumber}: ${symbol}`, - image: assetImageMap[symbol], - symbol, - description: "A conditional token for use in futarchy.", - }); -}; diff --git a/sdk/src/v0.4/utils/pda.ts b/sdk/src/v0.4/utils/pda.ts deleted file mode 100644 index 4563db747..000000000 --- a/sdk/src/v0.4/utils/pda.ts +++ /dev/null @@ -1,217 +0,0 @@ -import { AccountMeta, PublicKey } from "@solana/web3.js"; -import { utils } from "@coral-xyz/anchor"; -import { - ASSOCIATED_TOKEN_PROGRAM_ID, - TOKEN_PROGRAM_ID, -} from "@solana/spl-token"; -import BN from "bn.js"; -import { - fromWeb3JsPublicKey, - toWeb3JsPublicKey, -} from "@metaplex-foundation/umi-web3js-adapters"; -import { - DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID, - MPL_TOKEN_METADATA_PROGRAM_ID, - RAYDIUM_CP_SWAP_PROGRAM_ID, -} from "../constants.js"; -import { LAUNCHPAD_PROGRAM_ID } from "../constants.js"; - -export const getEventAuthorityAddr = (programId: PublicKey) => { - return PublicKey.findProgramAddressSync( - [Buffer.from("__event_authority")], - programId, - ); -}; - -export const getQuestionAddr = ( - programId: PublicKey, - questionId: Uint8Array, - oracle: PublicKey, - numOutcomes: number, -) => { - if (questionId.length != 32) { - throw new Error("questionId must be 32 bytes"); - } - - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("question"), - Buffer.from(questionId), - oracle.toBuffer(), - new BN(numOutcomes).toArrayLike(Buffer, "le", 1), - ], - programId, - ); -}; - -export const getVaultAddr = ( - programId: PublicKey, - question: PublicKey, - underlyingTokenMint: PublicKey, -) => { - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("conditional_vault"), - question.toBuffer(), - underlyingTokenMint.toBuffer(), - ], - programId, - ); -}; - -export const getConditionalTokenMintAddr = ( - programId: PublicKey, - vault: PublicKey, - index: number, -) => { - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("conditional_token"), - vault.toBuffer(), - new BN(index).toArrayLike(Buffer, "le", 1), - ], - programId, - ); -}; - -export const getDownAndUpMintAddrs = ( - programId: PublicKey, - vault: PublicKey, -): { down: PublicKey; up: PublicKey } => { - return { - down: getConditionalTokenMintAddr(programId, vault, 0)[0], - up: getConditionalTokenMintAddr(programId, vault, 1)[0], - }; -}; - -export const getFailAndPassMintAddrs = ( - programId: PublicKey, - vault: PublicKey, -): { fail: PublicKey; pass: PublicKey } => { - return { - fail: getConditionalTokenMintAddr(programId, vault, 0)[0], - pass: getConditionalTokenMintAddr(programId, vault, 1)[0], - }; -}; - -export const getMetadataAddr = (mint: PublicKey) => { - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("metadata"), - MPL_TOKEN_METADATA_PROGRAM_ID.toBuffer(), - mint.toBuffer(), - ], - MPL_TOKEN_METADATA_PROGRAM_ID, - ); -}; - -export const getDaoTreasuryAddr = ( - programId: PublicKey, - dao: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync([dao.toBuffer()], programId); -}; - -export const getProposalAddr = ( - programId: PublicKey, - proposer: PublicKey, - nonce: BN, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("proposal"), - proposer.toBuffer(), - nonce.toArrayLike(Buffer, "le", 8), - ], - programId, - ); -}; - -export const getAmmAddr = ( - programId: PublicKey, - baseMint: PublicKey, - quoteMint: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("amm__"), - baseMint.toBuffer(), - quoteMint.toBuffer(), - ], - programId, - ); -}; - -export const getAmmLpMintAddr = ( - programId: PublicKey, - amm: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [utils.bytes.utf8.encode("amm_lp_mint"), amm.toBuffer()], - programId, - ); -}; - -export function getLaunchAddr( - programId: PublicKey = LAUNCHPAD_PROGRAM_ID, - tokenMint: PublicKey, -): [PublicKey, number] { - return PublicKey.findProgramAddressSync( - [Buffer.from("launch"), tokenMint.toBuffer()], - programId, - ); -} - -export const getLaunchSignerAddr = ( - programId: PublicKey = LAUNCHPAD_PROGRAM_ID, - launch: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [Buffer.from("launch_signer"), launch.toBuffer()], - programId, - ); -}; - -export const getFundingRecordAddr = ( - programId: PublicKey = LAUNCHPAD_PROGRAM_ID, - launch: PublicKey, - funder: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [Buffer.from("funding_record"), launch.toBuffer(), funder.toBuffer()], - programId, - ); -}; - -export const getLaunchDaoAddr = ( - programId: PublicKey = LAUNCHPAD_PROGRAM_ID, - launch: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [Buffer.from("launch_dao"), launch.toBuffer()], - programId, - ); -}; - -export const getLiquidityPoolAddr = ( - programId: PublicKey = LAUNCHPAD_PROGRAM_ID, - dao: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [Buffer.from("pool_state"), dao.toBuffer()], - programId, - ); -}; - -export const getRaydiumCpmmLpMintAddr = ( - poolState: PublicKey, - isDevnet: boolean, -): [PublicKey, number] => { - const programId = isDevnet - ? DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID - : RAYDIUM_CP_SWAP_PROGRAM_ID; - return PublicKey.findProgramAddressSync( - [Buffer.from("pool_lp_mint"), poolState.toBuffer()], - programId, - ); -}; diff --git a/sdk/src/v0.4/utils/priceMath.ts b/sdk/src/v0.4/utils/priceMath.ts deleted file mode 100644 index ee8615205..000000000 --- a/sdk/src/v0.4/utils/priceMath.ts +++ /dev/null @@ -1,198 +0,0 @@ -import BN from "bn.js"; -import { Amm } from "../types/index.js"; -import { SwapType } from "../AmmClient.js"; -import { AmmMath as V3AmmMath } from "../../v0.3/utils/ammMath.js"; - -const BN_TEN = new BN(10); -const PRICE_SCALE = BN_TEN.pow(new BN(12)); -const PRICE_SCALE_NUMBER = 1e12; - -export type AddLiquiditySimulation = { - baseAmount: BN; - quoteAmount: BN; - expectedLpTokens: BN; - minLpTokens?: BN; - maxBaseAmount?: BN; -}; - -export type SwapSimulation = { - expectedOut: BN; - newBaseReserves: BN; - newQuoteReserves: BN; - minExpectedOut?: BN; -}; - -export type RemoveLiquiditySimulation = { - expectedBaseOut: BN; - expectedQuoteOut: BN; - minBaseOut?: BN; - minQuoteOut?: BN; -}; - -export class AmmMath { - // Re-export common methods from v0.3 - public static getHumanPriceFromReserves = V3AmmMath.getHumanPriceFromReserves; - public static getAmmPriceFromReserves = V3AmmMath.getAmmPriceFromReserves; - public static getChainAmount = V3AmmMath.getChainAmount; - public static getHumanAmount = V3AmmMath.getHumanAmount; - public static getAmmPrice = V3AmmMath.getAmmPrice; - public static getAmmPrices = V3AmmMath.getAmmPrices; - public static scale = V3AmmMath.scale; - public static addSlippage = V3AmmMath.addSlippage; - public static subtractSlippage = V3AmmMath.subtractSlippage; - public static simulateAddLiquidity = V3AmmMath.simulateAddLiquidity; - public static simulateRemoveLiquidity = V3AmmMath.simulateRemoveLiquidity; - - public static getHumanPrice( - ammPrice: BN, - baseDecimals: number, - quoteDecimals: number, - ): number { - const decimalScalar = BN_TEN.pow( - new BN(quoteDecimals - baseDecimals).abs(), - ); - const price1e12 = - quoteDecimals > baseDecimals - ? ammPrice.div(decimalScalar) - : ammPrice.mul(decimalScalar); - - // in case the BN is too large to cast to number, we try - try { - return price1e12.toNumber() / 1e12; - } catch (e) { - // BN tried to cast into number larger than 53 bits so we we do division via BN methods first, then cast to number(so it is smaller before the cast) - return price1e12.div(new BN(1e12)).toNumber(); - } - } - - public static getTwap(amm: Amm): BN { - return amm.oracle.aggregator.div( - amm.oracle.lastUpdatedSlot.sub(amm.createdAtSlot), - ); - } - - public static simulateSwapInner( - inputAmount: BN, - inputReserves: BN, - outputReserves: BN, - ): BN { - if (inputReserves.eqn(0) || outputReserves.eqn(0)) { - throw new Error("reserves must be non-zero"); - } - - let inputAmountWithFee: BN = inputAmount.muln(990); - - let numerator: BN = inputAmountWithFee.mul(outputReserves); - let denominator: BN = inputReserves.muln(1000).add(inputAmountWithFee); - - return numerator.div(denominator); - } - - public static simulateSwap( - inputAmount: BN, - swapType: SwapType, - baseReserves: BN, - quoteReserves: BN, - slippageBps?: BN, - ): SwapSimulation { - let inputReserves: BN, outputReserves: BN; - if (swapType.buy) { - inputReserves = quoteReserves; - outputReserves = baseReserves; - } else { - inputReserves = baseReserves; - outputReserves = quoteReserves; - } - - let expectedOut = this.simulateSwapInner( - inputAmount, - inputReserves, - outputReserves, - ); - - let minExpectedOut; - if (slippageBps) { - minExpectedOut = AmmMath.subtractSlippage(expectedOut, slippageBps); - } - - let newBaseReserves: BN, newQuoteReserves: BN; - if (swapType.buy) { - newBaseReserves = baseReserves.sub(expectedOut); - newQuoteReserves = quoteReserves.add(inputAmount); - } else { - newBaseReserves = baseReserves.add(inputAmount); - newQuoteReserves = quoteReserves.sub(expectedOut); - } - - return { - expectedOut, - newBaseReserves, - newQuoteReserves, - minExpectedOut, - }; - } - - /** - * Calculates the optimal swap amount and mergeable tokens without using square roots. - * @param userBalanceIn BN – Tokens that a user wants to dispose of. - * @param ammReserveIn BN – Amount of tokens in the AMM of the token that the user wants to dispose of. - * @param ammReserveOut BN – Amount of tokens in the AMM of the token that the user wants to receive. - * @returns An object containing the optimal swap amount, expected quote received, and expected mergeable tokens. - */ - - public static calculateOptimalSwapForMerge( - userBalanceIn: BN, - ammReserveIn: BN, - ammReserveOut: BN, - slippageBps: BN, - ): { - optimalSwapAmount: BN; - userInAfterSwap: BN; - expectedOut: BN; - minimumExpectedOut: BN; - } { - // essentially, we want to calculate the swap amount so that the remaining user balance = received token amount - - // solve this system of equations for swapAmount, outputAmount (we only care about swap amount tho) - // (baseReserve + swapAmount) * (quoteReserve - outputAmount) = baseReserve * quoteReserve - // baseAmount - swapAmount = outputAmount - - //solve equation - // (baseReserve + .99*swapAmount) * (quoteReserve - (userTokens - swapAmount)) = baseReserve * quoteReserve - // multiplying out the left hand side and subtracting baseReserve * quoteReserve from both sides yields the following: - // baseReserve*quoteReserve - baseReserve*userTokens + baseReserve*swapAmount + .99*swapAmount*quoteReserve - .99*swapAmount*userTokens + .99*swapAmount^2 = baseReserve*quoteReserve - // .99*swapAmount^2 + baseReserve*swapAmount + .99*swapAmount*quoteReserve - baseReserve*userTokens - .99*swapAmount*userTokens = 0 - // in the quadratic equation, a = .99, b = (baseReserve + .99*quoteReserve - .99*userTokens), c = -baseReserve*userTokens - // x = (-b + sqrt(b^2 - 4ac)) / 2a - - let a = 0.99; - let b = - Number(ammReserveIn) + - 0.99 * Number(ammReserveOut) - - 0.99 * Number(userBalanceIn); - let c = -Number(ammReserveIn) * Number(userBalanceIn); - - let x = (-b + Math.sqrt(b ** 2 - 4 * a * c)) / (2 * a); - //this should mathematically return a positive number assuming userBalanceIn, ammReserveIn, and ammReserveOut are all positive (which they should be) - // -b + Math.sqrt(b ** 2 - 4 * a * c) > 0 because -4*a*c > 0 and sqrt(b**2 + positive number) > b - - const swapAmount = x; - - let expectedOut = this.simulateSwapInner( - new BN(swapAmount), - ammReserveIn, - ammReserveOut, - ); - let minimumExpectedOut = - Number(expectedOut) - (Number(expectedOut) * Number(slippageBps)) / 10000; - return { - optimalSwapAmount: new BN(swapAmount), - userInAfterSwap: new BN(Number(userBalanceIn) - swapAmount), - expectedOut: expectedOut, - minimumExpectedOut: new BN(minimumExpectedOut), - }; - } -} - -// Add backwards compatibility alias -export { AmmMath as PriceMath }; diff --git a/sdk/src/v0.5/constants.ts b/sdk/src/v0.5/constants.ts deleted file mode 100644 index c7ed18ec2..000000000 --- a/sdk/src/v0.5/constants.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { Keypair, PublicKey } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; -import { BN } from "bn.js"; - -export const AUTOCRAT_PROGRAM_ID = new PublicKey( - "auToUr3CQza3D4qreT6Std2MTomfzvrEeCC5qh7ivW5", -); -export const AMM_PROGRAM_ID = new PublicKey( - "AMMJdEiCCa8mdugg6JPF7gFirmmxisTfDJoSNSUi5zDJ", -); -export const CONDITIONAL_VAULT_PROGRAM_ID = new PublicKey( - "VLTX1ishMBbcX3rdBWGssxawAo1Q2X2qxYFYqiGodVg", -); -export const LAUNCHPAD_PROGRAM_ID = new PublicKey( - "mooNhciQJi1LqHDmse2JPic2NqG2PXCanbE3ZYzP3qA", -); -export const SHARED_LIQUIDITY_MANAGER_PROGRAM_ID = new PublicKey( - "EoJc1PYxZbnCjszampLcwJGYcB5Md47jM4oSQacRtD4d", -); - -export const MPL_TOKEN_METADATA_PROGRAM_ID = new PublicKey( - "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s", -); - -export const RAYDIUM_CP_SWAP_PROGRAM_ID = new PublicKey( - "CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C", -); - -export const DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID = new PublicKey( - "CPMDWBwJDtYax9qW7AyRuVC19Cc4L4Vcy4n2BHAbHkCW", -); - -export const META_MINT = new PublicKey( - "3gN1WVEJwSHNWjo7hr87DgZp6zkf8kWgAJD29DmfE2Gr", -); -export const MAINNET_USDC = new PublicKey( - "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", -); - -export const DEVNET_USDC = new PublicKey( - "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU", -); - -export const USDC_DECIMALS = 6; - -export const AUTOCRAT_LUTS: PublicKey[] = []; - -export const RAYDIUM_AUTHORITY = PublicKey.findProgramAddressSync( - [anchor.utils.bytes.utf8.encode("vault_and_lp_mint_auth_seed")], - RAYDIUM_CP_SWAP_PROGRAM_ID, -)[0]; - -export const DEVNET_RAYDIUM_AUTHORITY = PublicKey.findProgramAddressSync( - [anchor.utils.bytes.utf8.encode("vault_and_lp_mint_auth_seed")], - DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID, -)[0]; - -export const LOW_FEE_RAYDIUM_CONFIG = new PublicKey( - "D4FPEruKEHrG5TenZ2mpDGEfu1iUvTiqBxvpU8HLBvC2", -); - -export const DEVNET_LOW_FEE_RAYDIUM_CONFIG = PublicKey.findProgramAddressSync( - [ - anchor.utils.bytes.utf8.encode("amm_config"), - new BN(0).toArrayLike(Buffer, "be", 2), - ], - DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID, -)[0]; - -export const RAYDIUM_CREATE_POOL_FEE_RECEIVE = new PublicKey( - "DNXgeM9EiiaAbaWvwjHj9fQQLAX5ZsfHyvmYUNRAdNC8", -); - -export const DEVNET_RAYDIUM_CREATE_POOL_FEE_RECEIVE = new PublicKey( - "G11FKBRaAkHAKuLCgLM6K6NUc9rTjPAznRCjZifrTQe2", -); - -export const SQUADS_PROGRAM_CONFIG = new PublicKey( - "BSTq9w3kZwNwpBXJEvTZz2G9ZTNyKBvoSeXMvwb4cNZr", -); - -export const SQUADS_PROGRAM_ID = new PublicKey( - "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf", -); - -export const SQUADS_PROGRAM_CONFIG_TREASURY = new PublicKey( - "5DH2e3cJmFpyi6mk65EGFediunm4ui6BiKNUNrhWtD1b", -); - -export const DEVNET_SQUADS_PROGRAM_CONFIG_TREASURY = new PublicKey( - "HM5y4mz3Bt9JY9mr1hkyhnvqxSH4H2u2451j7Hc2dtvK", -); - -export const PERMISSIONLESS_ACCOUNT = Keypair.fromSecretKey( - Uint8Array.from([ - 249, 158, 188, 171, 243, 143, 1, 48, 87, 243, 209, 153, 144, 106, 23, 88, - 161, 209, 65, 217, 199, 121, 0, 250, 3, 203, 133, 138, 141, 112, 243, 38, - 198, 205, 120, 222, 160, 224, 151, 190, 84, 254, 127, 178, 224, 195, 130, - 243, 145, 73, 20, 91, 9, 69, 222, 184, 23, 1, 2, 196, 202, 206, 153, 192, - ]), -); diff --git a/sdk/src/v0.5/index.ts b/sdk/src/v0.5/index.ts deleted file mode 100644 index 32591eead..000000000 --- a/sdk/src/v0.5/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -export * from "./types/index.js"; -export * from "./utils/index.js"; -export * from "./constants.js"; -export * from "./AmmClient.js"; -export * from "./AutocratClient.js"; -export * from "./ConditionalVaultClient.js"; -export * from "./LaunchpadClient.js"; -export * from "./SharedLiquidityManagerClient.js"; diff --git a/sdk/src/v0.5/types/autocrat_migrator.ts b/sdk/src/v0.5/types/autocrat_migrator.ts deleted file mode 100644 index 676d2df3d..000000000 --- a/sdk/src/v0.5/types/autocrat_migrator.ts +++ /dev/null @@ -1,237 +0,0 @@ -export type AutocratMigrator = { - version: "0.1.0"; - name: "autocrat_migrator"; - instructions: [ - { - name: "multiTransfer2"; - accounts: [ - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "authority"; - isMut: true; - isSigner: true; - }, - { - name: "from0"; - isMut: true; - isSigner: false; - }, - { - name: "to0"; - isMut: true; - isSigner: false; - }, - { - name: "from1"; - isMut: true; - isSigner: false; - }, - { - name: "to1"; - isMut: true; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "lamportReceiver"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "multiTransfer4"; - accounts: [ - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "authority"; - isMut: true; - isSigner: true; - }, - { - name: "from0"; - isMut: true; - isSigner: false; - }, - { - name: "to0"; - isMut: true; - isSigner: false; - }, - { - name: "from1"; - isMut: true; - isSigner: false; - }, - { - name: "to1"; - isMut: true; - isSigner: false; - }, - { - name: "from2"; - isMut: true; - isSigner: false; - }, - { - name: "to2"; - isMut: true; - isSigner: false; - }, - { - name: "from3"; - isMut: true; - isSigner: false; - }, - { - name: "to3"; - isMut: true; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "lamportReceiver"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - ]; -}; - -export const IDL: AutocratMigrator = { - version: "0.1.0", - name: "autocrat_migrator", - instructions: [ - { - name: "multiTransfer2", - accounts: [ - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "authority", - isMut: true, - isSigner: true, - }, - { - name: "from0", - isMut: true, - isSigner: false, - }, - { - name: "to0", - isMut: true, - isSigner: false, - }, - { - name: "from1", - isMut: true, - isSigner: false, - }, - { - name: "to1", - isMut: true, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "lamportReceiver", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - { - name: "multiTransfer4", - accounts: [ - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "authority", - isMut: true, - isSigner: true, - }, - { - name: "from0", - isMut: true, - isSigner: false, - }, - { - name: "to0", - isMut: true, - isSigner: false, - }, - { - name: "from1", - isMut: true, - isSigner: false, - }, - { - name: "to1", - isMut: true, - isSigner: false, - }, - { - name: "from2", - isMut: true, - isSigner: false, - }, - { - name: "to2", - isMut: true, - isSigner: false, - }, - { - name: "from3", - isMut: true, - isSigner: false, - }, - { - name: "to3", - isMut: true, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "lamportReceiver", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - ], -}; diff --git a/sdk/src/v0.5/types/conditional_vault.ts b/sdk/src/v0.5/types/conditional_vault.ts deleted file mode 100644 index 27c245b79..000000000 --- a/sdk/src/v0.5/types/conditional_vault.ts +++ /dev/null @@ -1,1849 +0,0 @@ -export type ConditionalVault = { - version: "0.4.0"; - name: "conditional_vault"; - instructions: [ - { - name: "initializeQuestion"; - accounts: [ - { - name: "question"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "InitializeQuestionArgs"; - }; - }, - ]; - }, - { - name: "resolveQuestion"; - accounts: [ - { - name: "question"; - isMut: true; - isSigner: false; - }, - { - name: "oracle"; - isMut: false; - isSigner: true; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "ResolveQuestionArgs"; - }; - }, - ]; - }, - { - name: "initializeConditionalVault"; - accounts: [ - { - name: "vault"; - isMut: true; - isSigner: false; - }, - { - name: "question"; - isMut: false; - isSigner: false; - }, - { - name: "underlyingTokenMint"; - isMut: false; - isSigner: false; - }, - { - name: "vaultUnderlyingTokenAccount"; - isMut: false; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "splitTokens"; - accounts: [ - { - name: "question"; - isMut: false; - isSigner: false; - }, - { - name: "vault"; - isMut: true; - isSigner: false; - }, - { - name: "vaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "authority"; - isMut: false; - isSigner: true; - }, - { - name: "userUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "amount"; - type: "u64"; - }, - ]; - }, - { - name: "mergeTokens"; - accounts: [ - { - name: "question"; - isMut: false; - isSigner: false; - }, - { - name: "vault"; - isMut: true; - isSigner: false; - }, - { - name: "vaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "authority"; - isMut: false; - isSigner: true; - }, - { - name: "userUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "amount"; - type: "u64"; - }, - ]; - }, - { - name: "redeemTokens"; - accounts: [ - { - name: "question"; - isMut: false; - isSigner: false; - }, - { - name: "vault"; - isMut: true; - isSigner: false; - }, - { - name: "vaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "authority"; - isMut: false; - isSigner: true; - }, - { - name: "userUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "addMetadataToConditionalTokens"; - accounts: [ - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "vault"; - isMut: true; - isSigner: false; - }, - { - name: "conditionalTokenMint"; - isMut: true; - isSigner: false; - }, - { - name: "conditionalTokenMetadata"; - isMut: true; - isSigner: false; - }, - { - name: "tokenMetadataProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "rent"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "AddMetadataToConditionalTokensArgs"; - }; - }, - ]; - }, - ]; - accounts: [ - { - name: "conditionalVault"; - type: { - kind: "struct"; - fields: [ - { - name: "question"; - type: "publicKey"; - }, - { - name: "underlyingTokenMint"; - type: "publicKey"; - }, - { - name: "underlyingTokenAccount"; - type: "publicKey"; - }, - { - name: "conditionalTokenMints"; - type: { - vec: "publicKey"; - }; - }, - { - name: "pdaBump"; - type: "u8"; - }, - { - name: "decimals"; - type: "u8"; - }, - { - name: "seqNum"; - type: "u64"; - }, - ]; - }; - }, - { - name: "question"; - docs: [ - "Questions represent statements about future events.", - "", - "These statements include:", - '- "Will this proposal pass?"', - '- "Who, if anyone, will be hired?"', - '- "How effective will the grant committee deem this grant?"', - "", - 'Questions have 2 or more possible outcomes. For a question like "will this', - 'proposal pass," the outcomes are "yes" and "no." For a question like "who', - 'will be hired," the outcomes could be "Alice," "Bob," and "neither."', - "", - 'Outcomes resolve to a number between 0 and 1. Binary questions like "will', - 'this proposal pass" have outcomes that resolve to exactly 0 or 1. You can', - 'also have questions with scalar outcomes. For example, the question "how', - 'effective will the grant committee deem this grant" could have two outcomes:', - '"ineffective" and "effective." If the grant committee deems the grant 70%', - 'effective, the "effective" outcome would resolve to 0.7 and the "ineffective"', - "outcome would resolve to 0.3.", - "", - "Once resolved, the sum of all outcome resolutions is exactly 1.", - ]; - type: { - kind: "struct"; - fields: [ - { - name: "questionId"; - type: { - array: ["u8", 32]; - }; - }, - { - name: "oracle"; - type: "publicKey"; - }, - { - name: "payoutNumerators"; - type: { - vec: "u32"; - }; - }, - { - name: "payoutDenominator"; - type: "u32"; - }, - ]; - }; - }, - ]; - types: [ - { - name: "CommonFields"; - type: { - kind: "struct"; - fields: [ - { - name: "slot"; - type: "u64"; - }, - { - name: "unixTimestamp"; - type: "i64"; - }, - ]; - }; - }, - { - name: "AddMetadataToConditionalTokensArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "name"; - type: "string"; - }, - { - name: "symbol"; - type: "string"; - }, - { - name: "uri"; - type: "string"; - }, - ]; - }; - }, - { - name: "InitializeQuestionArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "questionId"; - type: { - array: ["u8", 32]; - }; - }, - { - name: "oracle"; - type: "publicKey"; - }, - { - name: "numOutcomes"; - type: "u8"; - }, - ]; - }; - }, - { - name: "ResolveQuestionArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "payoutNumerators"; - type: { - vec: "u32"; - }; - }, - ]; - }; - }, - { - name: "VaultStatus"; - type: { - kind: "enum"; - variants: [ - { - name: "Active"; - }, - { - name: "Finalized"; - }, - { - name: "Reverted"; - }, - ]; - }; - }, - ]; - events: [ - { - name: "AddMetadataToConditionalTokensEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "vault"; - type: "publicKey"; - index: false; - }, - { - name: "conditionalTokenMint"; - type: "publicKey"; - index: false; - }, - { - name: "conditionalTokenMetadata"; - type: "publicKey"; - index: false; - }, - { - name: "name"; - type: "string"; - index: false; - }, - { - name: "symbol"; - type: "string"; - index: false; - }, - { - name: "uri"; - type: "string"; - index: false; - }, - { - name: "seqNum"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "InitializeConditionalVaultEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "vault"; - type: "publicKey"; - index: false; - }, - { - name: "question"; - type: "publicKey"; - index: false; - }, - { - name: "underlyingTokenMint"; - type: "publicKey"; - index: false; - }, - { - name: "vaultUnderlyingTokenAccount"; - type: "publicKey"; - index: false; - }, - { - name: "conditionalTokenMints"; - type: { - vec: "publicKey"; - }; - index: false; - }, - { - name: "pdaBump"; - type: "u8"; - index: false; - }, - { - name: "seqNum"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "InitializeQuestionEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "questionId"; - type: { - array: ["u8", 32]; - }; - index: false; - }, - { - name: "oracle"; - type: "publicKey"; - index: false; - }, - { - name: "numOutcomes"; - type: "u8"; - index: false; - }, - { - name: "question"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "MergeTokensEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "user"; - type: "publicKey"; - index: false; - }, - { - name: "vault"; - type: "publicKey"; - index: false; - }, - { - name: "amount"; - type: "u64"; - index: false; - }, - { - name: "postUserUnderlyingBalance"; - type: "u64"; - index: false; - }, - { - name: "postVaultUnderlyingBalance"; - type: "u64"; - index: false; - }, - { - name: "postUserConditionalTokenBalances"; - type: { - vec: "u64"; - }; - index: false; - }, - { - name: "postConditionalTokenSupplies"; - type: { - vec: "u64"; - }; - index: false; - }, - { - name: "seqNum"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "RedeemTokensEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "user"; - type: "publicKey"; - index: false; - }, - { - name: "vault"; - type: "publicKey"; - index: false; - }, - { - name: "amount"; - type: "u64"; - index: false; - }, - { - name: "postUserUnderlyingBalance"; - type: "u64"; - index: false; - }, - { - name: "postVaultUnderlyingBalance"; - type: "u64"; - index: false; - }, - { - name: "postConditionalTokenSupplies"; - type: { - vec: "u64"; - }; - index: false; - }, - { - name: "seqNum"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "ResolveQuestionEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "question"; - type: "publicKey"; - index: false; - }, - { - name: "payoutNumerators"; - type: { - vec: "u32"; - }; - index: false; - }, - ]; - }, - { - name: "SplitTokensEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "user"; - type: "publicKey"; - index: false; - }, - { - name: "vault"; - type: "publicKey"; - index: false; - }, - { - name: "amount"; - type: "u64"; - index: false; - }, - { - name: "postUserUnderlyingBalance"; - type: "u64"; - index: false; - }, - { - name: "postVaultUnderlyingBalance"; - type: "u64"; - index: false; - }, - { - name: "postUserConditionalTokenBalances"; - type: { - vec: "u64"; - }; - index: false; - }, - { - name: "postConditionalTokenSupplies"; - type: { - vec: "u64"; - }; - index: false; - }, - { - name: "seqNum"; - type: "u64"; - index: false; - }, - ]; - }, - ]; - errors: [ - { - code: 6000; - name: "AssertFailed"; - msg: "An assertion failed"; - }, - { - code: 6001; - name: "InsufficientUnderlyingTokens"; - msg: "Insufficient underlying token balance to mint this amount of conditional tokens"; - }, - { - code: 6002; - name: "InsufficientConditionalTokens"; - msg: "Insufficient conditional token balance to merge this `amount`"; - }, - { - code: 6003; - name: "InvalidVaultUnderlyingTokenAccount"; - msg: "This `vault_underlying_token_account` is not this vault's `underlying_token_account`"; - }, - { - code: 6004; - name: "InvalidConditionalTokenMint"; - msg: "This conditional token mint is not this vault's conditional token mint"; - }, - { - code: 6005; - name: "CantRedeemConditionalTokens"; - msg: "Question needs to be resolved before users can redeem conditional tokens for underlying tokens"; - }, - { - code: 6006; - name: "InsufficientNumConditions"; - msg: "Questions need 2 or more conditions"; - }, - { - code: 6007; - name: "InvalidNumPayoutNumerators"; - msg: "Invalid number of payout numerators"; - }, - { - code: 6008; - name: "InvalidConditionals"; - msg: "Client needs to pass in the list of conditional mints for a vault followed by the user's token accounts for those tokens"; - }, - { - code: 6009; - name: "ConditionalMintMismatch"; - msg: "Conditional mint not in vault"; - }, - { - code: 6010; - name: "BadConditionalMint"; - msg: "Unable to deserialize a conditional token mint"; - }, - { - code: 6011; - name: "BadConditionalTokenAccount"; - msg: "Unable to deserialize a conditional token account"; - }, - { - code: 6012; - name: "ConditionalTokenMintMismatch"; - msg: "User conditional token account mint does not match conditional mint"; - }, - { - code: 6013; - name: "PayoutZero"; - msg: "Payouts must sum to 1 or more"; - }, - { - code: 6014; - name: "QuestionAlreadyResolved"; - msg: "Question already resolved"; - }, - { - code: 6015; - name: "ConditionalTokenMetadataAlreadySet"; - msg: "Conditional token metadata already set"; - }, - { - code: 6016; - name: "UnauthorizedConditionalTokenAccount"; - msg: "Conditional token account is not owned by the authority"; - }, - ]; -}; - -export const IDL: ConditionalVault = { - version: "0.4.0", - name: "conditional_vault", - instructions: [ - { - name: "initializeQuestion", - accounts: [ - { - name: "question", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "InitializeQuestionArgs", - }, - }, - ], - }, - { - name: "resolveQuestion", - accounts: [ - { - name: "question", - isMut: true, - isSigner: false, - }, - { - name: "oracle", - isMut: false, - isSigner: true, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "ResolveQuestionArgs", - }, - }, - ], - }, - { - name: "initializeConditionalVault", - accounts: [ - { - name: "vault", - isMut: true, - isSigner: false, - }, - { - name: "question", - isMut: false, - isSigner: false, - }, - { - name: "underlyingTokenMint", - isMut: false, - isSigner: false, - }, - { - name: "vaultUnderlyingTokenAccount", - isMut: false, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "splitTokens", - accounts: [ - { - name: "question", - isMut: false, - isSigner: false, - }, - { - name: "vault", - isMut: true, - isSigner: false, - }, - { - name: "vaultUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "userUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "amount", - type: "u64", - }, - ], - }, - { - name: "mergeTokens", - accounts: [ - { - name: "question", - isMut: false, - isSigner: false, - }, - { - name: "vault", - isMut: true, - isSigner: false, - }, - { - name: "vaultUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "userUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "amount", - type: "u64", - }, - ], - }, - { - name: "redeemTokens", - accounts: [ - { - name: "question", - isMut: false, - isSigner: false, - }, - { - name: "vault", - isMut: true, - isSigner: false, - }, - { - name: "vaultUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "userUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "addMetadataToConditionalTokens", - accounts: [ - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "vault", - isMut: true, - isSigner: false, - }, - { - name: "conditionalTokenMint", - isMut: true, - isSigner: false, - }, - { - name: "conditionalTokenMetadata", - isMut: true, - isSigner: false, - }, - { - name: "tokenMetadataProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "rent", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "AddMetadataToConditionalTokensArgs", - }, - }, - ], - }, - ], - accounts: [ - { - name: "conditionalVault", - type: { - kind: "struct", - fields: [ - { - name: "question", - type: "publicKey", - }, - { - name: "underlyingTokenMint", - type: "publicKey", - }, - { - name: "underlyingTokenAccount", - type: "publicKey", - }, - { - name: "conditionalTokenMints", - type: { - vec: "publicKey", - }, - }, - { - name: "pdaBump", - type: "u8", - }, - { - name: "decimals", - type: "u8", - }, - { - name: "seqNum", - type: "u64", - }, - ], - }, - }, - { - name: "question", - docs: [ - "Questions represent statements about future events.", - "", - "These statements include:", - '- "Will this proposal pass?"', - '- "Who, if anyone, will be hired?"', - '- "How effective will the grant committee deem this grant?"', - "", - 'Questions have 2 or more possible outcomes. For a question like "will this', - 'proposal pass," the outcomes are "yes" and "no." For a question like "who', - 'will be hired," the outcomes could be "Alice," "Bob," and "neither."', - "", - 'Outcomes resolve to a number between 0 and 1. Binary questions like "will', - 'this proposal pass" have outcomes that resolve to exactly 0 or 1. You can', - 'also have questions with scalar outcomes. For example, the question "how', - 'effective will the grant committee deem this grant" could have two outcomes:', - '"ineffective" and "effective." If the grant committee deems the grant 70%', - 'effective, the "effective" outcome would resolve to 0.7 and the "ineffective"', - "outcome would resolve to 0.3.", - "", - "Once resolved, the sum of all outcome resolutions is exactly 1.", - ], - type: { - kind: "struct", - fields: [ - { - name: "questionId", - type: { - array: ["u8", 32], - }, - }, - { - name: "oracle", - type: "publicKey", - }, - { - name: "payoutNumerators", - type: { - vec: "u32", - }, - }, - { - name: "payoutDenominator", - type: "u32", - }, - ], - }, - }, - ], - types: [ - { - name: "CommonFields", - type: { - kind: "struct", - fields: [ - { - name: "slot", - type: "u64", - }, - { - name: "unixTimestamp", - type: "i64", - }, - ], - }, - }, - { - name: "AddMetadataToConditionalTokensArgs", - type: { - kind: "struct", - fields: [ - { - name: "name", - type: "string", - }, - { - name: "symbol", - type: "string", - }, - { - name: "uri", - type: "string", - }, - ], - }, - }, - { - name: "InitializeQuestionArgs", - type: { - kind: "struct", - fields: [ - { - name: "questionId", - type: { - array: ["u8", 32], - }, - }, - { - name: "oracle", - type: "publicKey", - }, - { - name: "numOutcomes", - type: "u8", - }, - ], - }, - }, - { - name: "ResolveQuestionArgs", - type: { - kind: "struct", - fields: [ - { - name: "payoutNumerators", - type: { - vec: "u32", - }, - }, - ], - }, - }, - { - name: "VaultStatus", - type: { - kind: "enum", - variants: [ - { - name: "Active", - }, - { - name: "Finalized", - }, - { - name: "Reverted", - }, - ], - }, - }, - ], - events: [ - { - name: "AddMetadataToConditionalTokensEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "vault", - type: "publicKey", - index: false, - }, - { - name: "conditionalTokenMint", - type: "publicKey", - index: false, - }, - { - name: "conditionalTokenMetadata", - type: "publicKey", - index: false, - }, - { - name: "name", - type: "string", - index: false, - }, - { - name: "symbol", - type: "string", - index: false, - }, - { - name: "uri", - type: "string", - index: false, - }, - { - name: "seqNum", - type: "u64", - index: false, - }, - ], - }, - { - name: "InitializeConditionalVaultEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "vault", - type: "publicKey", - index: false, - }, - { - name: "question", - type: "publicKey", - index: false, - }, - { - name: "underlyingTokenMint", - type: "publicKey", - index: false, - }, - { - name: "vaultUnderlyingTokenAccount", - type: "publicKey", - index: false, - }, - { - name: "conditionalTokenMints", - type: { - vec: "publicKey", - }, - index: false, - }, - { - name: "pdaBump", - type: "u8", - index: false, - }, - { - name: "seqNum", - type: "u64", - index: false, - }, - ], - }, - { - name: "InitializeQuestionEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "questionId", - type: { - array: ["u8", 32], - }, - index: false, - }, - { - name: "oracle", - type: "publicKey", - index: false, - }, - { - name: "numOutcomes", - type: "u8", - index: false, - }, - { - name: "question", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "MergeTokensEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "user", - type: "publicKey", - index: false, - }, - { - name: "vault", - type: "publicKey", - index: false, - }, - { - name: "amount", - type: "u64", - index: false, - }, - { - name: "postUserUnderlyingBalance", - type: "u64", - index: false, - }, - { - name: "postVaultUnderlyingBalance", - type: "u64", - index: false, - }, - { - name: "postUserConditionalTokenBalances", - type: { - vec: "u64", - }, - index: false, - }, - { - name: "postConditionalTokenSupplies", - type: { - vec: "u64", - }, - index: false, - }, - { - name: "seqNum", - type: "u64", - index: false, - }, - ], - }, - { - name: "RedeemTokensEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "user", - type: "publicKey", - index: false, - }, - { - name: "vault", - type: "publicKey", - index: false, - }, - { - name: "amount", - type: "u64", - index: false, - }, - { - name: "postUserUnderlyingBalance", - type: "u64", - index: false, - }, - { - name: "postVaultUnderlyingBalance", - type: "u64", - index: false, - }, - { - name: "postConditionalTokenSupplies", - type: { - vec: "u64", - }, - index: false, - }, - { - name: "seqNum", - type: "u64", - index: false, - }, - ], - }, - { - name: "ResolveQuestionEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "question", - type: "publicKey", - index: false, - }, - { - name: "payoutNumerators", - type: { - vec: "u32", - }, - index: false, - }, - ], - }, - { - name: "SplitTokensEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "user", - type: "publicKey", - index: false, - }, - { - name: "vault", - type: "publicKey", - index: false, - }, - { - name: "amount", - type: "u64", - index: false, - }, - { - name: "postUserUnderlyingBalance", - type: "u64", - index: false, - }, - { - name: "postVaultUnderlyingBalance", - type: "u64", - index: false, - }, - { - name: "postUserConditionalTokenBalances", - type: { - vec: "u64", - }, - index: false, - }, - { - name: "postConditionalTokenSupplies", - type: { - vec: "u64", - }, - index: false, - }, - { - name: "seqNum", - type: "u64", - index: false, - }, - ], - }, - ], - errors: [ - { - code: 6000, - name: "AssertFailed", - msg: "An assertion failed", - }, - { - code: 6001, - name: "InsufficientUnderlyingTokens", - msg: "Insufficient underlying token balance to mint this amount of conditional tokens", - }, - { - code: 6002, - name: "InsufficientConditionalTokens", - msg: "Insufficient conditional token balance to merge this `amount`", - }, - { - code: 6003, - name: "InvalidVaultUnderlyingTokenAccount", - msg: "This `vault_underlying_token_account` is not this vault's `underlying_token_account`", - }, - { - code: 6004, - name: "InvalidConditionalTokenMint", - msg: "This conditional token mint is not this vault's conditional token mint", - }, - { - code: 6005, - name: "CantRedeemConditionalTokens", - msg: "Question needs to be resolved before users can redeem conditional tokens for underlying tokens", - }, - { - code: 6006, - name: "InsufficientNumConditions", - msg: "Questions need 2 or more conditions", - }, - { - code: 6007, - name: "InvalidNumPayoutNumerators", - msg: "Invalid number of payout numerators", - }, - { - code: 6008, - name: "InvalidConditionals", - msg: "Client needs to pass in the list of conditional mints for a vault followed by the user's token accounts for those tokens", - }, - { - code: 6009, - name: "ConditionalMintMismatch", - msg: "Conditional mint not in vault", - }, - { - code: 6010, - name: "BadConditionalMint", - msg: "Unable to deserialize a conditional token mint", - }, - { - code: 6011, - name: "BadConditionalTokenAccount", - msg: "Unable to deserialize a conditional token account", - }, - { - code: 6012, - name: "ConditionalTokenMintMismatch", - msg: "User conditional token account mint does not match conditional mint", - }, - { - code: 6013, - name: "PayoutZero", - msg: "Payouts must sum to 1 or more", - }, - { - code: 6014, - name: "QuestionAlreadyResolved", - msg: "Question already resolved", - }, - { - code: 6015, - name: "ConditionalTokenMetadataAlreadySet", - msg: "Conditional token metadata already set", - }, - { - code: 6016, - name: "UnauthorizedConditionalTokenAccount", - msg: "Conditional token account is not owned by the authority", - }, - ], -}; diff --git a/sdk/src/v0.5/types/futarchy_amm.ts b/sdk/src/v0.5/types/futarchy_amm.ts deleted file mode 100644 index c1aef0d19..000000000 --- a/sdk/src/v0.5/types/futarchy_amm.ts +++ /dev/null @@ -1,1663 +0,0 @@ -export type FutarchyAmm = { - version: "0.4.1"; - name: "futarchy_amm"; - instructions: [ - { - name: "createAmm"; - accounts: [ - { - name: "user"; - isMut: true; - isSigner: true; - }, - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "lpMint"; - isMut: true; - isSigner: false; - }, - { - name: "baseMint"; - isMut: false; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "vaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "CreateAmmArgs"; - }; - }, - ]; - }, - { - name: "addLiquidity"; - accounts: [ - { - name: "user"; - isMut: true; - isSigner: true; - }, - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "lpMint"; - isMut: true; - isSigner: false; - }, - { - name: "userLpAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userBaseAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "AddLiquidityArgs"; - }; - }, - ]; - }, - { - name: "removeLiquidity"; - accounts: [ - { - name: "user"; - isMut: true; - isSigner: true; - }, - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "lpMint"; - isMut: true; - isSigner: false; - }, - { - name: "userLpAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userBaseAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "RemoveLiquidityArgs"; - }; - }, - ]; - }, - { - name: "swap"; - accounts: [ - { - name: "user"; - isMut: true; - isSigner: true; - }, - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "userBaseAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "SwapArgs"; - }; - }, - ]; - }, - { - name: "crankThatTwap"; - accounts: [ - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - ]; - accounts: [ - { - name: "amm"; - type: { - kind: "struct"; - fields: [ - { - name: "bump"; - type: "u8"; - }, - { - name: "createdAtSlot"; - type: "u64"; - }, - { - name: "lpMint"; - type: "publicKey"; - }, - { - name: "baseMint"; - type: "publicKey"; - }, - { - name: "quoteMint"; - type: "publicKey"; - }, - { - name: "baseMintDecimals"; - type: "u8"; - }, - { - name: "quoteMintDecimals"; - type: "u8"; - }, - { - name: "baseAmount"; - type: "u64"; - }, - { - name: "quoteAmount"; - type: "u64"; - }, - { - name: "oracle"; - type: { - defined: "TwapOracle"; - }; - }, - { - name: "seqNum"; - type: "u64"; - }, - { - name: "vaultAtaBase"; - type: "publicKey"; - }, - { - name: "vaultAtaQuote"; - type: "publicKey"; - }, - ]; - }; - }, - ]; - types: [ - { - name: "CommonFields"; - type: { - kind: "struct"; - fields: [ - { - name: "slot"; - type: "u64"; - }, - { - name: "unixTimestamp"; - type: "i64"; - }, - { - name: "user"; - type: "publicKey"; - }, - { - name: "amm"; - type: "publicKey"; - }, - { - name: "postBaseReserves"; - type: "u64"; - }, - { - name: "postQuoteReserves"; - type: "u64"; - }, - { - name: "oracleLastPrice"; - type: "u128"; - }, - { - name: "oracleLastObservation"; - type: "u128"; - }, - { - name: "oracleAggregator"; - type: "u128"; - }, - { - name: "seqNum"; - type: "u64"; - }, - ]; - }; - }, - { - name: "AddLiquidityArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "quoteAmount"; - docs: ["How much quote token you will deposit to the pool"]; - type: "u64"; - }, - { - name: "maxBaseAmount"; - docs: ["The maximum base token you will deposit to the pool"]; - type: "u64"; - }, - { - name: "minLpTokens"; - docs: ["The minimum LP token you will get back"]; - type: "u64"; - }, - ]; - }; - }, - { - name: "CreateAmmArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "twapInitialObservation"; - type: "u128"; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; - }, - { - name: "twapStartDelaySlots"; - type: "u64"; - }, - ]; - }; - }, - { - name: "RemoveLiquidityArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "lpTokensToBurn"; - type: "u64"; - }, - { - name: "minQuoteAmount"; - type: "u64"; - }, - { - name: "minBaseAmount"; - type: "u64"; - }, - ]; - }; - }, - { - name: "SwapArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "swapType"; - type: { - defined: "SwapType"; - }; - }, - { - name: "inputAmount"; - type: "u64"; - }, - { - name: "outputAmountMin"; - type: "u64"; - }, - ]; - }; - }, - { - name: "TwapOracle"; - type: { - kind: "struct"; - fields: [ - { - name: "lastUpdatedSlot"; - type: "u64"; - }, - { - name: "lastPrice"; - docs: [ - "A price is the number of quote units per base unit multiplied by 1e12.", - "You cannot simply divide by 1e12 to get a price you can display in the UI", - "because the base and quote decimals may be different. Instead, do:", - "ui_price = (price * (10**(base_decimals - quote_decimals))) / 1e12", - ]; - type: "u128"; - }, - { - name: "lastObservation"; - docs: [ - "If we did a raw TWAP over prices, someone could push the TWAP heavily with", - "a few extremely large outliers. So we use observations, which can only move", - "by `max_observation_change_per_update` per update.", - ]; - type: "u128"; - }, - { - name: "aggregator"; - docs: [ - "Running sum of slots_per_last_update * last_observation.", - "", - "Assuming latest observations are as big as possible (u64::MAX * 1e12),", - "we can store 18 million slots worth of observations, which turns out to", - "be ~85 days worth of slots.", - "", - "Assuming that latest observations are 100x smaller than they could theoretically", - "be, we can store 8500 days (23 years) worth of them. Even this is a very", - "very conservative assumption - META/USDC prices should be between 1e9 and", - "1e15, which would overflow after 1e15 years worth of slots.", - "", - "So in the case of an overflow, the aggregator rolls back to 0. It's the", - "client's responsibility to sanity check the assets or to handle an", - "aggregator at T2 being smaller than an aggregator at T1.", - ]; - type: "u128"; - }, - { - name: "maxObservationChangePerUpdate"; - docs: ["The most that an observation can change per update."]; - type: "u128"; - }, - { - name: "initialObservation"; - docs: ["What the initial `latest_observation` is set to."]; - type: "u128"; - }, - { - name: "startDelaySlots"; - docs: [ - "Number of slots after amm.created_at_slot to start recording TWAP", - ]; - type: "u64"; - }, - ]; - }; - }, - { - name: "SwapType"; - type: { - kind: "enum"; - variants: [ - { - name: "Buy"; - }, - { - name: "Sell"; - }, - ]; - }; - }, - ]; - events: [ - { - name: "SwapEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "inputAmount"; - type: "u64"; - index: false; - }, - { - name: "outputAmount"; - type: "u64"; - index: false; - }, - { - name: "swapType"; - type: { - defined: "SwapType"; - }; - index: false; - }, - ]; - }, - { - name: "AddLiquidityEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "quoteAmount"; - type: "u64"; - index: false; - }, - { - name: "maxBaseAmount"; - type: "u64"; - index: false; - }, - { - name: "minLpTokens"; - type: "u64"; - index: false; - }, - { - name: "baseAmount"; - type: "u64"; - index: false; - }, - { - name: "lpTokensMinted"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "RemoveLiquidityEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "lpTokensBurned"; - type: "u64"; - index: false; - }, - { - name: "minQuoteAmount"; - type: "u64"; - index: false; - }, - { - name: "minBaseAmount"; - type: "u64"; - index: false; - }, - { - name: "baseAmount"; - type: "u64"; - index: false; - }, - { - name: "quoteAmount"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "CreateAmmEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "twapInitialObservation"; - type: "u128"; - index: false; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; - index: false; - }, - { - name: "lpMint"; - type: "publicKey"; - index: false; - }, - { - name: "baseMint"; - type: "publicKey"; - index: false; - }, - { - name: "quoteMint"; - type: "publicKey"; - index: false; - }, - { - name: "vaultAtaBase"; - type: "publicKey"; - index: false; - }, - { - name: "vaultAtaQuote"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "CrankThatTwapEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - ]; - }, - ]; - errors: [ - { - code: 6000; - name: "AssertFailed"; - msg: "An assertion failed"; - }, - { - code: 6001; - name: "NoSlotsPassed"; - msg: "Can't get a TWAP before some observations have been stored"; - }, - { - code: 6002; - name: "NoReserves"; - msg: "Can't swap through a pool without token reserves on either side"; - }, - { - code: 6003; - name: "InputAmountOverflow"; - msg: "Input token amount is too large for a swap, causes overflow"; - }, - { - code: 6004; - name: "AddLiquidityCalculationError"; - msg: "Add liquidity calculation error"; - }, - { - code: 6005; - name: "DecimalScaleError"; - msg: "Error in decimal scale conversion"; - }, - { - code: 6006; - name: "SameTokenMints"; - msg: "You can't create an AMM pool where the token mints are the same"; - }, - { - code: 6007; - name: "SwapSlippageExceeded"; - msg: "A user wouldn't have gotten back their `output_amount_min`, reverting"; - }, - { - code: 6008; - name: "InsufficientBalance"; - msg: "The user had insufficient balance to do this"; - }, - { - code: 6009; - name: "ZeroLiquidityRemove"; - msg: "Must remove a non-zero amount of liquidity"; - }, - { - code: 6010; - name: "ZeroLiquidityToAdd"; - msg: "Cannot add liquidity with 0 tokens on either side"; - }, - { - code: 6011; - name: "ZeroMinLpTokens"; - msg: "Must specify a non-zero `min_lp_tokens` when adding to an existing pool"; - }, - { - code: 6012; - name: "AddLiquiditySlippageExceeded"; - msg: "LP wouldn't have gotten back `lp_token_min`"; - }, - { - code: 6013; - name: "AddLiquidityMaxBaseExceeded"; - msg: "LP would have spent more than `max_base_amount`"; - }, - { - code: 6014; - name: "InsufficientQuoteAmount"; - msg: "`quote_amount` must be greater than 100000000 when initializing a pool"; - }, - { - code: 6015; - name: "ZeroSwapAmount"; - msg: "Users must swap a non-zero amount"; - }, - { - code: 6016; - name: "ConstantProductInvariantFailed"; - msg: "K should always be increasing"; - }, - { - code: 6017; - name: "CastingOverflow"; - msg: "Casting has caused an overflow"; - }, - ]; -}; - -export const IDL: FutarchyAmm = { - version: "0.4.1", - name: "futarchy_amm", - instructions: [ - { - name: "createAmm", - accounts: [ - { - name: "user", - isMut: true, - isSigner: true, - }, - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "lpMint", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "vaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "CreateAmmArgs", - }, - }, - ], - }, - { - name: "addLiquidity", - accounts: [ - { - name: "user", - isMut: true, - isSigner: true, - }, - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "lpMint", - isMut: true, - isSigner: false, - }, - { - name: "userLpAccount", - isMut: true, - isSigner: false, - }, - { - name: "userBaseAccount", - isMut: true, - isSigner: false, - }, - { - name: "userQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "AddLiquidityArgs", - }, - }, - ], - }, - { - name: "removeLiquidity", - accounts: [ - { - name: "user", - isMut: true, - isSigner: true, - }, - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "lpMint", - isMut: true, - isSigner: false, - }, - { - name: "userLpAccount", - isMut: true, - isSigner: false, - }, - { - name: "userBaseAccount", - isMut: true, - isSigner: false, - }, - { - name: "userQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "RemoveLiquidityArgs", - }, - }, - ], - }, - { - name: "swap", - accounts: [ - { - name: "user", - isMut: true, - isSigner: true, - }, - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "userBaseAccount", - isMut: true, - isSigner: false, - }, - { - name: "userQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "SwapArgs", - }, - }, - ], - }, - { - name: "crankThatTwap", - accounts: [ - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "amm", - type: { - kind: "struct", - fields: [ - { - name: "bump", - type: "u8", - }, - { - name: "createdAtSlot", - type: "u64", - }, - { - name: "lpMint", - type: "publicKey", - }, - { - name: "baseMint", - type: "publicKey", - }, - { - name: "quoteMint", - type: "publicKey", - }, - { - name: "baseMintDecimals", - type: "u8", - }, - { - name: "quoteMintDecimals", - type: "u8", - }, - { - name: "baseAmount", - type: "u64", - }, - { - name: "quoteAmount", - type: "u64", - }, - { - name: "oracle", - type: { - defined: "TwapOracle", - }, - }, - { - name: "seqNum", - type: "u64", - }, - { - name: "vaultAtaBase", - type: "publicKey", - }, - { - name: "vaultAtaQuote", - type: "publicKey", - }, - ], - }, - }, - ], - types: [ - { - name: "CommonFields", - type: { - kind: "struct", - fields: [ - { - name: "slot", - type: "u64", - }, - { - name: "unixTimestamp", - type: "i64", - }, - { - name: "user", - type: "publicKey", - }, - { - name: "amm", - type: "publicKey", - }, - { - name: "postBaseReserves", - type: "u64", - }, - { - name: "postQuoteReserves", - type: "u64", - }, - { - name: "oracleLastPrice", - type: "u128", - }, - { - name: "oracleLastObservation", - type: "u128", - }, - { - name: "oracleAggregator", - type: "u128", - }, - { - name: "seqNum", - type: "u64", - }, - ], - }, - }, - { - name: "AddLiquidityArgs", - type: { - kind: "struct", - fields: [ - { - name: "quoteAmount", - docs: ["How much quote token you will deposit to the pool"], - type: "u64", - }, - { - name: "maxBaseAmount", - docs: ["The maximum base token you will deposit to the pool"], - type: "u64", - }, - { - name: "minLpTokens", - docs: ["The minimum LP token you will get back"], - type: "u64", - }, - ], - }, - }, - { - name: "CreateAmmArgs", - type: { - kind: "struct", - fields: [ - { - name: "twapInitialObservation", - type: "u128", - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - }, - { - name: "twapStartDelaySlots", - type: "u64", - }, - ], - }, - }, - { - name: "RemoveLiquidityArgs", - type: { - kind: "struct", - fields: [ - { - name: "lpTokensToBurn", - type: "u64", - }, - { - name: "minQuoteAmount", - type: "u64", - }, - { - name: "minBaseAmount", - type: "u64", - }, - ], - }, - }, - { - name: "SwapArgs", - type: { - kind: "struct", - fields: [ - { - name: "swapType", - type: { - defined: "SwapType", - }, - }, - { - name: "inputAmount", - type: "u64", - }, - { - name: "outputAmountMin", - type: "u64", - }, - ], - }, - }, - { - name: "TwapOracle", - type: { - kind: "struct", - fields: [ - { - name: "lastUpdatedSlot", - type: "u64", - }, - { - name: "lastPrice", - docs: [ - "A price is the number of quote units per base unit multiplied by 1e12.", - "You cannot simply divide by 1e12 to get a price you can display in the UI", - "because the base and quote decimals may be different. Instead, do:", - "ui_price = (price * (10**(base_decimals - quote_decimals))) / 1e12", - ], - type: "u128", - }, - { - name: "lastObservation", - docs: [ - "If we did a raw TWAP over prices, someone could push the TWAP heavily with", - "a few extremely large outliers. So we use observations, which can only move", - "by `max_observation_change_per_update` per update.", - ], - type: "u128", - }, - { - name: "aggregator", - docs: [ - "Running sum of slots_per_last_update * last_observation.", - "", - "Assuming latest observations are as big as possible (u64::MAX * 1e12),", - "we can store 18 million slots worth of observations, which turns out to", - "be ~85 days worth of slots.", - "", - "Assuming that latest observations are 100x smaller than they could theoretically", - "be, we can store 8500 days (23 years) worth of them. Even this is a very", - "very conservative assumption - META/USDC prices should be between 1e9 and", - "1e15, which would overflow after 1e15 years worth of slots.", - "", - "So in the case of an overflow, the aggregator rolls back to 0. It's the", - "client's responsibility to sanity check the assets or to handle an", - "aggregator at T2 being smaller than an aggregator at T1.", - ], - type: "u128", - }, - { - name: "maxObservationChangePerUpdate", - docs: ["The most that an observation can change per update."], - type: "u128", - }, - { - name: "initialObservation", - docs: ["What the initial `latest_observation` is set to."], - type: "u128", - }, - { - name: "startDelaySlots", - docs: [ - "Number of slots after amm.created_at_slot to start recording TWAP", - ], - type: "u64", - }, - ], - }, - }, - { - name: "SwapType", - type: { - kind: "enum", - variants: [ - { - name: "Buy", - }, - { - name: "Sell", - }, - ], - }, - }, - ], - events: [ - { - name: "SwapEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "inputAmount", - type: "u64", - index: false, - }, - { - name: "outputAmount", - type: "u64", - index: false, - }, - { - name: "swapType", - type: { - defined: "SwapType", - }, - index: false, - }, - ], - }, - { - name: "AddLiquidityEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "quoteAmount", - type: "u64", - index: false, - }, - { - name: "maxBaseAmount", - type: "u64", - index: false, - }, - { - name: "minLpTokens", - type: "u64", - index: false, - }, - { - name: "baseAmount", - type: "u64", - index: false, - }, - { - name: "lpTokensMinted", - type: "u64", - index: false, - }, - ], - }, - { - name: "RemoveLiquidityEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "lpTokensBurned", - type: "u64", - index: false, - }, - { - name: "minQuoteAmount", - type: "u64", - index: false, - }, - { - name: "minBaseAmount", - type: "u64", - index: false, - }, - { - name: "baseAmount", - type: "u64", - index: false, - }, - { - name: "quoteAmount", - type: "u64", - index: false, - }, - ], - }, - { - name: "CreateAmmEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "twapInitialObservation", - type: "u128", - index: false, - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - index: false, - }, - { - name: "lpMint", - type: "publicKey", - index: false, - }, - { - name: "baseMint", - type: "publicKey", - index: false, - }, - { - name: "quoteMint", - type: "publicKey", - index: false, - }, - { - name: "vaultAtaBase", - type: "publicKey", - index: false, - }, - { - name: "vaultAtaQuote", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "CrankThatTwapEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - ], - }, - ], - errors: [ - { - code: 6000, - name: "AssertFailed", - msg: "An assertion failed", - }, - { - code: 6001, - name: "NoSlotsPassed", - msg: "Can't get a TWAP before some observations have been stored", - }, - { - code: 6002, - name: "NoReserves", - msg: "Can't swap through a pool without token reserves on either side", - }, - { - code: 6003, - name: "InputAmountOverflow", - msg: "Input token amount is too large for a swap, causes overflow", - }, - { - code: 6004, - name: "AddLiquidityCalculationError", - msg: "Add liquidity calculation error", - }, - { - code: 6005, - name: "DecimalScaleError", - msg: "Error in decimal scale conversion", - }, - { - code: 6006, - name: "SameTokenMints", - msg: "You can't create an AMM pool where the token mints are the same", - }, - { - code: 6007, - name: "SwapSlippageExceeded", - msg: "A user wouldn't have gotten back their `output_amount_min`, reverting", - }, - { - code: 6008, - name: "InsufficientBalance", - msg: "The user had insufficient balance to do this", - }, - { - code: 6009, - name: "ZeroLiquidityRemove", - msg: "Must remove a non-zero amount of liquidity", - }, - { - code: 6010, - name: "ZeroLiquidityToAdd", - msg: "Cannot add liquidity with 0 tokens on either side", - }, - { - code: 6011, - name: "ZeroMinLpTokens", - msg: "Must specify a non-zero `min_lp_tokens` when adding to an existing pool", - }, - { - code: 6012, - name: "AddLiquiditySlippageExceeded", - msg: "LP wouldn't have gotten back `lp_token_min`", - }, - { - code: 6013, - name: "AddLiquidityMaxBaseExceeded", - msg: "LP would have spent more than `max_base_amount`", - }, - { - code: 6014, - name: "InsufficientQuoteAmount", - msg: "`quote_amount` must be greater than 100000000 when initializing a pool", - }, - { - code: 6015, - name: "ZeroSwapAmount", - msg: "Users must swap a non-zero amount", - }, - { - code: 6016, - name: "ConstantProductInvariantFailed", - msg: "K should always be increasing", - }, - { - code: 6017, - name: "CastingOverflow", - msg: "Casting has caused an overflow", - }, - ], -}; diff --git a/sdk/src/v0.5/types/index.ts b/sdk/src/v0.5/types/index.ts deleted file mode 100644 index 279f482f5..000000000 --- a/sdk/src/v0.5/types/index.ts +++ /dev/null @@ -1,117 +0,0 @@ -import { Autocrat as AutocratProgram, IDL as AutocratIDL } from "./autocrat.js"; -export { AutocratProgram, AutocratIDL }; - -import { Amm as AmmProgram, IDL as AmmIDL } from "./amm.js"; -export { AmmProgram, AmmIDL }; - -import { - Launchpad as LaunchpadProgram, - IDL as LaunchpadIDL, -} from "./launchpad.js"; -export { LaunchpadProgram, LaunchpadIDL }; - -import { - ConditionalVault as ConditionalVaultProgram, - IDL as ConditionalVaultIDL, -} from "./conditional_vault.js"; -export { ConditionalVaultProgram, ConditionalVaultIDL }; - -import { - SharedLiquidityManager as SharedLiquidityManagerProgram, - IDL as SharedLiquidityManagerIDL, -} from "./shared_liquidity_manager.js"; -export { SharedLiquidityManagerProgram, SharedLiquidityManagerIDL }; - -export { LowercaseKeys } from "./utils.js"; - -import type { IdlAccounts, IdlTypes, IdlEvents } from "@coral-xyz/anchor"; -import { PublicKey } from "@solana/web3.js"; - -export type Question = IdlAccounts["question"]; -export type ConditionalVault = - IdlAccounts["conditionalVault"]; - -export type InitializeDaoParams = - IdlTypes["InitializeDaoParams"]; -export type UpdateDaoParams = IdlTypes["UpdateDaoParams"]; - -export type Dao = IdlAccounts["dao"]; -export type Proposal = IdlAccounts["proposal"]; -export type Amm = IdlAccounts["amm"]; -export type Launch = IdlAccounts["launch"]; -export type FundingRecord = IdlAccounts["fundingRecord"]; -// export type SharedLiquidityPool = -// IdlAccounts["sharedLiquidityPool"]; -// export type SharedLiquidityPoolPosition = -// IdlAccounts["liquidityPosition"]; - -export type SwapEvent = IdlEvents["SwapEvent"]; -export type AddLiquidityEvent = IdlEvents["AddLiquidityEvent"]; -export type RemoveLiquidityEvent = - IdlEvents["RemoveLiquidityEvent"]; -export type CreateAmmEvent = IdlEvents["CreateAmmEvent"]; -export type CrankThatTwapEvent = IdlEvents["CrankThatTwapEvent"]; -export type AmmEvent = - | SwapEvent - | AddLiquidityEvent - | RemoveLiquidityEvent - | CreateAmmEvent - | CrankThatTwapEvent; - -export type AddMetadataToConditionalTokensEvent = - IdlEvents["AddMetadataToConditionalTokensEvent"]; -export type InitializeConditionalVaultEvent = - IdlEvents["InitializeConditionalVaultEvent"]; -export type InitializeQuestionEvent = - IdlEvents["InitializeQuestionEvent"]; -export type MergeTokensEvent = - IdlEvents["MergeTokensEvent"]; -export type RedeemTokensEvent = - IdlEvents["RedeemTokensEvent"]; -export type ResolveQuestionEvent = - IdlEvents["ResolveQuestionEvent"]; -export type SplitTokensEvent = - IdlEvents["SplitTokensEvent"]; -export type ConditionalVaultEvent = - | AddMetadataToConditionalTokensEvent - | InitializeConditionalVaultEvent - | InitializeQuestionEvent - | MergeTokensEvent - | RedeemTokensEvent - | ResolveQuestionEvent - | SplitTokensEvent; - -export type LaunchClaimEvent = IdlEvents["LaunchClaimEvent"]; -export type LaunchCompletedEvent = - IdlEvents["LaunchCompletedEvent"]; -export type LaunchFundedEvent = - IdlEvents["LaunchFundedEvent"]; -export type LaunchInitializedEvent = - IdlEvents["LaunchInitializedEvent"]; -export type LaunchRefundedEvent = - IdlEvents["LaunchRefundedEvent"]; -export type LaunchStartedEvent = - IdlEvents["LaunchStartedEvent"]; -export type LaunchpadEvent = - | LaunchClaimEvent - | LaunchCompletedEvent - | LaunchFundedEvent - | LaunchInitializedEvent - | LaunchRefundedEvent - | LaunchStartedEvent; - -export type InitializeDaoEvent = - IdlEvents["InitializeDaoEvent"]; -export type UpdateDaoEvent = IdlEvents["UpdateDaoEvent"]; -export type InitializeProposalEvent = - IdlEvents["InitializeProposalEvent"]; -export type FinalizeProposalEvent = - IdlEvents["FinalizeProposalEvent"]; -export type ExecuteProposalEvent = - IdlEvents["ExecuteProposalEvent"]; -export type AutocratEvent = - | InitializeDaoEvent - | UpdateDaoEvent - | InitializeProposalEvent - | FinalizeProposalEvent - | ExecuteProposalEvent; diff --git a/sdk/src/v0.5/types/optimistic_timelock.ts b/sdk/src/v0.5/types/optimistic_timelock.ts deleted file mode 100644 index fa1f43135..000000000 --- a/sdk/src/v0.5/types/optimistic_timelock.ts +++ /dev/null @@ -1,1023 +0,0 @@ -export type OptimisticTimelock = { - version: "0.3.0"; - name: "optimistic_timelock"; - instructions: [ - { - name: "createTimelock"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: false; - }, - { - name: "timelock"; - isMut: true; - isSigner: true; - }, - ]; - args: [ - { - name: "authority"; - type: "publicKey"; - }, - { - name: "delayInSlots"; - type: "u64"; - }, - { - name: "enqueuers"; - type: { - vec: "publicKey"; - }; - }, - { - name: "enqueuerCooldownSlots"; - type: "u64"; - }, - ]; - }, - { - name: "setDelayInSlots"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "delayInSlots"; - type: "u64"; - }, - ]; - }, - { - name: "setAuthority"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "authority"; - type: "publicKey"; - }, - ]; - }, - { - name: "setOptimisticProposerCooldownSlots"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "cooldownSlots"; - type: "u64"; - }, - ]; - }, - { - name: "addOptimisticProposer"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "enqueuer"; - type: "publicKey"; - }, - ]; - }, - { - name: "removeOptimisticProposer"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "optimisticProposer"; - type: "publicKey"; - }, - ]; - }, - { - name: "createTransactionBatch"; - accounts: [ - { - name: "transactionBatchAuthority"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: false; - isSigner: false; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: true; - }, - ]; - args: []; - }, - { - name: "addTransaction"; - accounts: [ - { - name: "transactionBatchAuthority"; - isMut: false; - isSigner: true; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "programId"; - type: "publicKey"; - }, - { - name: "accounts"; - type: { - vec: { - defined: "TransactionAccount"; - }; - }; - }, - { - name: "data"; - type: "bytes"; - }, - ]; - }, - { - name: "sealTransactionBatch"; - accounts: [ - { - name: "transactionBatchAuthority"; - isMut: false; - isSigner: true; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "enqueueTransactionBatch"; - accounts: [ - { - name: "authority"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "cancelTransactionBatch"; - accounts: [ - { - name: "authority"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "executeTransactionBatch"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: false; - }, - { - name: "timelock"; - isMut: false; - isSigner: false; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - ]; - accounts: [ - { - name: "timelock"; - type: { - kind: "struct"; - fields: [ - { - name: "authority"; - type: "publicKey"; - }, - { - name: "signerBump"; - type: "u8"; - }, - { - name: "delayInSlots"; - type: "u64"; - }, - { - name: "optimisticProposers"; - type: { - vec: { - defined: "OptimisticProposer"; - }; - }; - }, - { - name: "optimisticProposerCooldownSlots"; - docs: [ - "The cooldown period for enqueuers to prevent spamming the timelock.", - ]; - type: "u64"; - }, - ]; - }; - }, - { - name: "transactionBatch"; - type: { - kind: "struct"; - fields: [ - { - name: "status"; - type: { - defined: "TransactionBatchStatus"; - }; - }, - { - name: "transactions"; - type: { - vec: { - defined: "Transaction"; - }; - }; - }, - { - name: "timelock"; - type: "publicKey"; - }, - { - name: "enqueuedSlot"; - type: "u64"; - }, - { - name: "transactionBatchAuthority"; - type: "publicKey"; - }, - { - name: "enqueuerType"; - type: { - defined: "AuthorityType"; - }; - }, - ]; - }; - }, - ]; - types: [ - { - name: "OptimisticProposer"; - type: { - kind: "struct"; - fields: [ - { - name: "pubkey"; - type: "publicKey"; - }, - { - name: "lastSlotEnqueued"; - type: "u64"; - }, - ]; - }; - }, - { - name: "Transaction"; - type: { - kind: "struct"; - fields: [ - { - name: "programId"; - type: "publicKey"; - }, - { - name: "accounts"; - type: { - vec: { - defined: "TransactionAccount"; - }; - }; - }, - { - name: "data"; - type: "bytes"; - }, - { - name: "didExecute"; - type: "bool"; - }, - ]; - }; - }, - { - name: "TransactionAccount"; - type: { - kind: "struct"; - fields: [ - { - name: "pubkey"; - type: "publicKey"; - }, - { - name: "isSigner"; - type: "bool"; - }, - { - name: "isWritable"; - type: "bool"; - }, - ]; - }; - }, - { - name: "AuthorityType"; - type: { - kind: "enum"; - variants: [ - { - name: "OptimisticProposer"; - }, - { - name: "TimelockAuthority"; - }, - ]; - }; - }, - { - name: "TransactionBatchStatus"; - type: { - kind: "enum"; - variants: [ - { - name: "Created"; - }, - { - name: "Sealed"; - }, - { - name: "Enqueued"; - }, - { - name: "Cancelled"; - }, - { - name: "Executed"; - }, - ]; - }; - }, - ]; - errors: [ - { - code: 6000; - name: "NotReady"; - msg: "This transaction is not yet ready to be executed"; - }, - { - code: 6001; - name: "CannotAddTransactions"; - msg: "Can only add instructions when transaction batch status is `Created`"; - }, - { - code: 6002; - name: "CannotSealTransactionBatch"; - msg: "Can only seal the transaction batch when status is `Created`"; - }, - { - code: 6003; - name: "CannotEnqueueTransactionBatch"; - msg: "Can only enqueue the timelock running once the status is `Sealed`"; - }, - { - code: 6004; - name: "CannotCancelTimelock"; - msg: "Can only cancel the transactions if the status `Enqueued`"; - }, - { - code: 6005; - name: "CanOnlyCancelDuringTimelockPeriod"; - msg: "Can only cancel the transactions during the timelock period"; - }, - { - code: 6006; - name: "CannotExecuteTransactions"; - msg: "Can only execute the transactions if the status is `Enqueued`"; - }, - { - code: 6007; - name: "NoAuthority"; - msg: "The signer is neither the timelock authority nor an optimistic proposer"; - }, - { - code: 6008; - name: "InsufficientPermissions"; - msg: "Optimistic proposers can't cancel transaction batches enqueued by the timelock authority"; - }, - { - code: 6009; - name: "OptimisticProposerCooldown"; - msg: "This optimistic proposer is still in its cooldown period"; - }, - ]; -}; - -export const IDL: OptimisticTimelock = { - version: "0.3.0", - name: "optimistic_timelock", - instructions: [ - { - name: "createTimelock", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: false, - }, - { - name: "timelock", - isMut: true, - isSigner: true, - }, - ], - args: [ - { - name: "authority", - type: "publicKey", - }, - { - name: "delayInSlots", - type: "u64", - }, - { - name: "enqueuers", - type: { - vec: "publicKey", - }, - }, - { - name: "enqueuerCooldownSlots", - type: "u64", - }, - ], - }, - { - name: "setDelayInSlots", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "delayInSlots", - type: "u64", - }, - ], - }, - { - name: "setAuthority", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "authority", - type: "publicKey", - }, - ], - }, - { - name: "setOptimisticProposerCooldownSlots", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "cooldownSlots", - type: "u64", - }, - ], - }, - { - name: "addOptimisticProposer", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "enqueuer", - type: "publicKey", - }, - ], - }, - { - name: "removeOptimisticProposer", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "optimisticProposer", - type: "publicKey", - }, - ], - }, - { - name: "createTransactionBatch", - accounts: [ - { - name: "transactionBatchAuthority", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: false, - isSigner: false, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: true, - }, - ], - args: [], - }, - { - name: "addTransaction", - accounts: [ - { - name: "transactionBatchAuthority", - isMut: false, - isSigner: true, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "programId", - type: "publicKey", - }, - { - name: "accounts", - type: { - vec: { - defined: "TransactionAccount", - }, - }, - }, - { - name: "data", - type: "bytes", - }, - ], - }, - { - name: "sealTransactionBatch", - accounts: [ - { - name: "transactionBatchAuthority", - isMut: false, - isSigner: true, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - { - name: "enqueueTransactionBatch", - accounts: [ - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - { - name: "cancelTransactionBatch", - accounts: [ - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - { - name: "executeTransactionBatch", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: false, - }, - { - name: "timelock", - isMut: false, - isSigner: false, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "timelock", - type: { - kind: "struct", - fields: [ - { - name: "authority", - type: "publicKey", - }, - { - name: "signerBump", - type: "u8", - }, - { - name: "delayInSlots", - type: "u64", - }, - { - name: "optimisticProposers", - type: { - vec: { - defined: "OptimisticProposer", - }, - }, - }, - { - name: "optimisticProposerCooldownSlots", - docs: [ - "The cooldown period for enqueuers to prevent spamming the timelock.", - ], - type: "u64", - }, - ], - }, - }, - { - name: "transactionBatch", - type: { - kind: "struct", - fields: [ - { - name: "status", - type: { - defined: "TransactionBatchStatus", - }, - }, - { - name: "transactions", - type: { - vec: { - defined: "Transaction", - }, - }, - }, - { - name: "timelock", - type: "publicKey", - }, - { - name: "enqueuedSlot", - type: "u64", - }, - { - name: "transactionBatchAuthority", - type: "publicKey", - }, - { - name: "enqueuerType", - type: { - defined: "AuthorityType", - }, - }, - ], - }, - }, - ], - types: [ - { - name: "OptimisticProposer", - type: { - kind: "struct", - fields: [ - { - name: "pubkey", - type: "publicKey", - }, - { - name: "lastSlotEnqueued", - type: "u64", - }, - ], - }, - }, - { - name: "Transaction", - type: { - kind: "struct", - fields: [ - { - name: "programId", - type: "publicKey", - }, - { - name: "accounts", - type: { - vec: { - defined: "TransactionAccount", - }, - }, - }, - { - name: "data", - type: "bytes", - }, - { - name: "didExecute", - type: "bool", - }, - ], - }, - }, - { - name: "TransactionAccount", - type: { - kind: "struct", - fields: [ - { - name: "pubkey", - type: "publicKey", - }, - { - name: "isSigner", - type: "bool", - }, - { - name: "isWritable", - type: "bool", - }, - ], - }, - }, - { - name: "AuthorityType", - type: { - kind: "enum", - variants: [ - { - name: "OptimisticProposer", - }, - { - name: "TimelockAuthority", - }, - ], - }, - }, - { - name: "TransactionBatchStatus", - type: { - kind: "enum", - variants: [ - { - name: "Created", - }, - { - name: "Sealed", - }, - { - name: "Enqueued", - }, - { - name: "Cancelled", - }, - { - name: "Executed", - }, - ], - }, - }, - ], - errors: [ - { - code: 6000, - name: "NotReady", - msg: "This transaction is not yet ready to be executed", - }, - { - code: 6001, - name: "CannotAddTransactions", - msg: "Can only add instructions when transaction batch status is `Created`", - }, - { - code: 6002, - name: "CannotSealTransactionBatch", - msg: "Can only seal the transaction batch when status is `Created`", - }, - { - code: 6003, - name: "CannotEnqueueTransactionBatch", - msg: "Can only enqueue the timelock running once the status is `Sealed`", - }, - { - code: 6004, - name: "CannotCancelTimelock", - msg: "Can only cancel the transactions if the status `Enqueued`", - }, - { - code: 6005, - name: "CanOnlyCancelDuringTimelockPeriod", - msg: "Can only cancel the transactions during the timelock period", - }, - { - code: 6006, - name: "CannotExecuteTransactions", - msg: "Can only execute the transactions if the status is `Enqueued`", - }, - { - code: 6007, - name: "NoAuthority", - msg: "The signer is neither the timelock authority nor an optimistic proposer", - }, - { - code: 6008, - name: "InsufficientPermissions", - msg: "Optimistic proposers can't cancel transaction batches enqueued by the timelock authority", - }, - { - code: 6009, - name: "OptimisticProposerCooldown", - msg: "This optimistic proposer is still in its cooldown period", - }, - ], -}; diff --git a/sdk/src/v0.5/types/utils.ts b/sdk/src/v0.5/types/utils.ts deleted file mode 100644 index c878debe7..000000000 --- a/sdk/src/v0.5/types/utils.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type LowercaseKeys = { - [K in keyof T as Lowercase]: T[K]; -}; diff --git a/sdk/src/v0.5/utils/cu.ts b/sdk/src/v0.5/utils/cu.ts deleted file mode 100644 index b55cbac95..000000000 --- a/sdk/src/v0.5/utils/cu.ts +++ /dev/null @@ -1,11 +0,0 @@ -export const MaxCUs = { - initializeDao: 40_000, - createIdempotent: 25_000, - initializeConditionalVault: 45_000, - mintConditionalTokens: 35_000, - initializeAmm: 120_000, - addLiquidity: 120_000, - initializeProposal: 60_000, -}; - -export const DEFAULT_CU_PRICE = 1; diff --git a/sdk/src/v0.5/utils/filters.ts b/sdk/src/v0.5/utils/filters.ts deleted file mode 100644 index aee93f618..000000000 --- a/sdk/src/v0.5/utils/filters.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { GetProgramAccountsFilter, PublicKey } from "@solana/web3.js"; - -export const filterPositionsByUser = ( - userAddr: PublicKey, -): GetProgramAccountsFilter => ({ - memcmp: { - offset: 8, // discriminator - bytes: userAddr.toBase58(), - }, -}); - -export const filterPositionsByAmm = ( - ammAddr: PublicKey, -): GetProgramAccountsFilter => ({ - memcmp: { - offset: - 8 + // discriminator - 32, // user address - bytes: ammAddr.toBase58(), - }, -}); diff --git a/sdk/src/v0.5/utils/index.ts b/sdk/src/v0.5/utils/index.ts deleted file mode 100644 index ee7438b0a..000000000 --- a/sdk/src/v0.5/utils/index.ts +++ /dev/null @@ -1,40 +0,0 @@ -export * from "./filters.js"; -export * from "./pda.js"; -export * from "./priceMath.js"; -export * from "./metadata.js"; -export * from "./cu.js"; -export * from "./instruction.js"; - -import { AccountMeta, ComputeBudgetProgram, PublicKey } from "@solana/web3.js"; - -export enum PriorityFeeTier { - NORMAL = 35, - HIGH = 3571, - TURBO = 357142, -} - -export const addComputeUnits = (num_units: number = 1_400_000) => - ComputeBudgetProgram.setComputeUnitLimit({ - units: num_units, - }); - -export const addPriorityFee = (pf: number) => - ComputeBudgetProgram.setComputeUnitPrice({ - microLamports: pf, - }); - -export const pubkeyToAccountInfo = ( - pubkey: PublicKey, - isWritable: boolean, - isSigner = false, -): AccountMeta => { - return { - pubkey: pubkey, - isSigner: isSigner, - isWritable: isWritable, - }; -}; - -export async function sleep(ms: number) { - return new Promise((resolve) => setTimeout(resolve, ms)); -} diff --git a/sdk/src/v0.5/utils/metadata.ts b/sdk/src/v0.5/utils/metadata.ts deleted file mode 100644 index ef17bbdb8..000000000 --- a/sdk/src/v0.5/utils/metadata.ts +++ /dev/null @@ -1,35 +0,0 @@ -import BN from "bn.js"; -import { createUmi } from "@metaplex-foundation/umi-bundle-defaults"; -import { Connection } from "@solana/web3.js"; -import { bundlrUploader } from "@metaplex-foundation/umi-uploader-bundlr"; -import { UmiPlugin } from "@metaplex-foundation/umi"; - -export const assetImageMap: Record = { - fMETA: "https://arweave.net/tGxvOjMZw7B0qHsdCcIMO57oH5g5OaItOZdXo3BXKz8", - fUSDC: "https://arweave.net/DpvxeAyVbaoivhIVCLjdf566k2SwVn0YVBL0sTOezWk", - pMETA: "https://arweave.net/iuqi7PRRESdDxj1oRyk2WzR90_zdFcmZsuWicv3XGfs", - pUSDC: "https://arweave.net/e4IO7F59F_RKCiuB--_ABPot7Qh1yFsGkWzVhcXuKDU", -}; - -// Upload some JSON, returning its URL -export const uploadConditionalTokenMetadataJson = async ( - connection: Connection, - identityPlugin: UmiPlugin, - proposalNumber: number, - symbol: string, - // proposal: BN, - // conditionalToken: string, - // image: string -): Promise => { - // use bundlr, targeting arweave - const umi = createUmi(connection); - umi.use(bundlrUploader()); - umi.use(identityPlugin); - - return umi.uploader.uploadJson({ - name: `Proposal ${proposalNumber}: ${symbol}`, - image: assetImageMap[symbol], - symbol, - description: "A conditional token for use in futarchy.", - }); -}; diff --git a/sdk/src/v0.5/utils/pda.ts b/sdk/src/v0.5/utils/pda.ts deleted file mode 100644 index ba9fe7284..000000000 --- a/sdk/src/v0.5/utils/pda.ts +++ /dev/null @@ -1,327 +0,0 @@ -import { AccountMeta, PublicKey } from "@solana/web3.js"; -import { utils } from "@coral-xyz/anchor"; -import { - ASSOCIATED_TOKEN_PROGRAM_ID, - TOKEN_PROGRAM_ID, -} from "@solana/spl-token"; -import BN from "bn.js"; -import { - fromWeb3JsPublicKey, - toWeb3JsPublicKey, -} from "@metaplex-foundation/umi-web3js-adapters"; -import { - DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID, - MPL_TOKEN_METADATA_PROGRAM_ID, - RAYDIUM_CP_SWAP_PROGRAM_ID, - SHARED_LIQUIDITY_MANAGER_PROGRAM_ID, -} from "../constants.js"; -import { LAUNCHPAD_PROGRAM_ID, AUTOCRAT_PROGRAM_ID } from "../constants.js"; - -export const getEventAuthorityAddr = (programId: PublicKey) => { - return PublicKey.findProgramAddressSync( - [Buffer.from("__event_authority")], - programId, - ); -}; - -export const getQuestionAddr = ( - programId: PublicKey, - questionId: Uint8Array, - oracle: PublicKey, - numOutcomes: number, -) => { - if (questionId.length != 32) { - throw new Error("questionId must be 32 bytes"); - } - - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("question"), - Buffer.from(questionId), - oracle.toBuffer(), - new BN(numOutcomes).toArrayLike(Buffer, "le", 1), - ], - programId, - ); -}; - -export const getVaultAddr = ( - programId: PublicKey, - question: PublicKey, - underlyingTokenMint: PublicKey, -) => { - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("conditional_vault"), - question.toBuffer(), - underlyingTokenMint.toBuffer(), - ], - programId, - ); -}; - -export const getConditionalTokenMintAddr = ( - programId: PublicKey, - vault: PublicKey, - index: number, -) => { - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("conditional_token"), - vault.toBuffer(), - new BN(index).toArrayLike(Buffer, "le", 1), - ], - programId, - ); -}; - -export const getDownAndUpMintAddrs = ( - programId: PublicKey, - vault: PublicKey, -): { down: PublicKey; up: PublicKey } => { - return { - down: getConditionalTokenMintAddr(programId, vault, 0)[0], - up: getConditionalTokenMintAddr(programId, vault, 1)[0], - }; -}; - -export const getFailAndPassMintAddrs = ( - programId: PublicKey, - vault: PublicKey, -): { fail: PublicKey; pass: PublicKey } => { - return { - fail: getConditionalTokenMintAddr(programId, vault, 0)[0], - pass: getConditionalTokenMintAddr(programId, vault, 1)[0], - }; -}; - -export const getMetadataAddr = (mint: PublicKey) => { - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("metadata"), - MPL_TOKEN_METADATA_PROGRAM_ID.toBuffer(), - mint.toBuffer(), - ], - MPL_TOKEN_METADATA_PROGRAM_ID, - ); -}; - -export const getDaoAddr = ({ - nonce, - daoCreator, - programId = AUTOCRAT_PROGRAM_ID, -}: { - nonce: BN; - daoCreator: PublicKey; - programId?: PublicKey; -}): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [ - Buffer.from("dao"), - daoCreator.toBuffer(), - nonce.toArrayLike(Buffer, "le", 8), - ], - programId, - ); -}; - -export const getDaoTreasuryAddr = ( - programId: PublicKey, - dao: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync([dao.toBuffer()], programId); -}; - -export const getProposalAddr = ( - programId: PublicKey, - squadsProposal: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [utils.bytes.utf8.encode("proposal"), squadsProposal.toBuffer()], - programId, - ); -}; - -export const getAmmAddr = ( - programId: PublicKey, - baseMint: PublicKey, - quoteMint: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("amm__"), - baseMint.toBuffer(), - quoteMint.toBuffer(), - ], - programId, - ); -}; - -export const getAmmLpMintAddr = ( - programId: PublicKey, - amm: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [utils.bytes.utf8.encode("amm_lp_mint"), amm.toBuffer()], - programId, - ); -}; - -export function getLaunchAddr( - programId: PublicKey = LAUNCHPAD_PROGRAM_ID, - tokenMint: PublicKey, -): [PublicKey, number] { - return PublicKey.findProgramAddressSync( - [Buffer.from("launch"), tokenMint.toBuffer()], - programId, - ); -} - -export const getLaunchSignerAddr = ( - programId: PublicKey = LAUNCHPAD_PROGRAM_ID, - launch: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [Buffer.from("launch_signer"), launch.toBuffer()], - programId, - ); -}; - -export const getFundingRecordAddr = ( - programId: PublicKey = LAUNCHPAD_PROGRAM_ID, - launch: PublicKey, - funder: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [Buffer.from("funding_record"), launch.toBuffer(), funder.toBuffer()], - programId, - ); -}; - -export const getLiquidityPoolAddr = ( - programId: PublicKey = LAUNCHPAD_PROGRAM_ID, - dao: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [Buffer.from("pool_state"), dao.toBuffer()], - programId, - ); -}; - -export const getSharedLiquidityPoolAddr = ( - programId: PublicKey = SHARED_LIQUIDITY_MANAGER_PROGRAM_ID, - dao: PublicKey, - creator: PublicKey, - proposalStakeRateThresholdBps: number, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [ - Buffer.from("sl_pool"), - dao.toBuffer(), - creator.toBuffer(), - new BN(proposalStakeRateThresholdBps).toArrayLike(Buffer, "le", 2), - ], - programId, - ); -}; - -export const getSlPoolPositionAddr = ( - programId: PublicKey = SHARED_LIQUIDITY_MANAGER_PROGRAM_ID, - slPool: PublicKey, - user: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [Buffer.from("sl_pool_position"), slPool.toBuffer(), user.toBuffer()], - programId, - ); -}; - -export const getRaydiumCpmmLpMintAddr = ( - poolState: PublicKey, - isDevnet: boolean, -): [PublicKey, number] => { - const programId = isDevnet - ? DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID - : RAYDIUM_CP_SWAP_PROGRAM_ID; - return PublicKey.findProgramAddressSync( - [Buffer.from("pool_lp_mint"), poolState.toBuffer()], - programId, - ); -}; - -export const getRaydiumCpmmPoolVaultAddr = ( - poolState: PublicKey, - token: PublicKey, - isDevnet: boolean, -): [PublicKey, number] => { - const programId = isDevnet - ? DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID - : RAYDIUM_CP_SWAP_PROGRAM_ID; - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("pool_vault"), - poolState.toBuffer(), - token.toBuffer(), - ], - programId, - ); -}; - -export const getRaydiumCpmmObservationStateAddr = ( - poolState: PublicKey, - isDevnet: boolean, -): [PublicKey, number] => { - const programId = isDevnet - ? DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID - : RAYDIUM_CP_SWAP_PROGRAM_ID; - return PublicKey.findProgramAddressSync( - [utils.bytes.utf8.encode("observation"), poolState.toBuffer()], - programId, - ); -}; - -export const getSharedLiquidityPoolSignerAddr = ( - programId: PublicKey = SHARED_LIQUIDITY_MANAGER_PROGRAM_ID, - slPool: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [Buffer.from("sl_pool_signer"), slPool.toBuffer()], - programId, - ); -}; - -export const getSpotPoolAddr = ( - programId: PublicKey = SHARED_LIQUIDITY_MANAGER_PROGRAM_ID, - slPool: PublicKey, - index: number, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("spot_pool"), - slPool.toBuffer(), - new BN(index).toArrayLike(Buffer, "le", 4), - ], - programId, - ); -}; - -export const getDraftProposalAddr = ( - programId: PublicKey = SHARED_LIQUIDITY_MANAGER_PROGRAM_ID, - nonce: BN, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [Buffer.from("draft_proposal"), nonce.toArrayLike(Buffer, "le", 8)], - programId, - ); -}; - -export const getStakeRecordAddr = ( - programId: PublicKey = SHARED_LIQUIDITY_MANAGER_PROGRAM_ID, - draftProposal: PublicKey, - staker: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [Buffer.from("stake_record"), draftProposal.toBuffer(), staker.toBuffer()], - programId, - ); -}; diff --git a/sdk/src/v0.5/utils/priceMath.ts b/sdk/src/v0.5/utils/priceMath.ts deleted file mode 100644 index ee8615205..000000000 --- a/sdk/src/v0.5/utils/priceMath.ts +++ /dev/null @@ -1,198 +0,0 @@ -import BN from "bn.js"; -import { Amm } from "../types/index.js"; -import { SwapType } from "../AmmClient.js"; -import { AmmMath as V3AmmMath } from "../../v0.3/utils/ammMath.js"; - -const BN_TEN = new BN(10); -const PRICE_SCALE = BN_TEN.pow(new BN(12)); -const PRICE_SCALE_NUMBER = 1e12; - -export type AddLiquiditySimulation = { - baseAmount: BN; - quoteAmount: BN; - expectedLpTokens: BN; - minLpTokens?: BN; - maxBaseAmount?: BN; -}; - -export type SwapSimulation = { - expectedOut: BN; - newBaseReserves: BN; - newQuoteReserves: BN; - minExpectedOut?: BN; -}; - -export type RemoveLiquiditySimulation = { - expectedBaseOut: BN; - expectedQuoteOut: BN; - minBaseOut?: BN; - minQuoteOut?: BN; -}; - -export class AmmMath { - // Re-export common methods from v0.3 - public static getHumanPriceFromReserves = V3AmmMath.getHumanPriceFromReserves; - public static getAmmPriceFromReserves = V3AmmMath.getAmmPriceFromReserves; - public static getChainAmount = V3AmmMath.getChainAmount; - public static getHumanAmount = V3AmmMath.getHumanAmount; - public static getAmmPrice = V3AmmMath.getAmmPrice; - public static getAmmPrices = V3AmmMath.getAmmPrices; - public static scale = V3AmmMath.scale; - public static addSlippage = V3AmmMath.addSlippage; - public static subtractSlippage = V3AmmMath.subtractSlippage; - public static simulateAddLiquidity = V3AmmMath.simulateAddLiquidity; - public static simulateRemoveLiquidity = V3AmmMath.simulateRemoveLiquidity; - - public static getHumanPrice( - ammPrice: BN, - baseDecimals: number, - quoteDecimals: number, - ): number { - const decimalScalar = BN_TEN.pow( - new BN(quoteDecimals - baseDecimals).abs(), - ); - const price1e12 = - quoteDecimals > baseDecimals - ? ammPrice.div(decimalScalar) - : ammPrice.mul(decimalScalar); - - // in case the BN is too large to cast to number, we try - try { - return price1e12.toNumber() / 1e12; - } catch (e) { - // BN tried to cast into number larger than 53 bits so we we do division via BN methods first, then cast to number(so it is smaller before the cast) - return price1e12.div(new BN(1e12)).toNumber(); - } - } - - public static getTwap(amm: Amm): BN { - return amm.oracle.aggregator.div( - amm.oracle.lastUpdatedSlot.sub(amm.createdAtSlot), - ); - } - - public static simulateSwapInner( - inputAmount: BN, - inputReserves: BN, - outputReserves: BN, - ): BN { - if (inputReserves.eqn(0) || outputReserves.eqn(0)) { - throw new Error("reserves must be non-zero"); - } - - let inputAmountWithFee: BN = inputAmount.muln(990); - - let numerator: BN = inputAmountWithFee.mul(outputReserves); - let denominator: BN = inputReserves.muln(1000).add(inputAmountWithFee); - - return numerator.div(denominator); - } - - public static simulateSwap( - inputAmount: BN, - swapType: SwapType, - baseReserves: BN, - quoteReserves: BN, - slippageBps?: BN, - ): SwapSimulation { - let inputReserves: BN, outputReserves: BN; - if (swapType.buy) { - inputReserves = quoteReserves; - outputReserves = baseReserves; - } else { - inputReserves = baseReserves; - outputReserves = quoteReserves; - } - - let expectedOut = this.simulateSwapInner( - inputAmount, - inputReserves, - outputReserves, - ); - - let minExpectedOut; - if (slippageBps) { - minExpectedOut = AmmMath.subtractSlippage(expectedOut, slippageBps); - } - - let newBaseReserves: BN, newQuoteReserves: BN; - if (swapType.buy) { - newBaseReserves = baseReserves.sub(expectedOut); - newQuoteReserves = quoteReserves.add(inputAmount); - } else { - newBaseReserves = baseReserves.add(inputAmount); - newQuoteReserves = quoteReserves.sub(expectedOut); - } - - return { - expectedOut, - newBaseReserves, - newQuoteReserves, - minExpectedOut, - }; - } - - /** - * Calculates the optimal swap amount and mergeable tokens without using square roots. - * @param userBalanceIn BN – Tokens that a user wants to dispose of. - * @param ammReserveIn BN – Amount of tokens in the AMM of the token that the user wants to dispose of. - * @param ammReserveOut BN – Amount of tokens in the AMM of the token that the user wants to receive. - * @returns An object containing the optimal swap amount, expected quote received, and expected mergeable tokens. - */ - - public static calculateOptimalSwapForMerge( - userBalanceIn: BN, - ammReserveIn: BN, - ammReserveOut: BN, - slippageBps: BN, - ): { - optimalSwapAmount: BN; - userInAfterSwap: BN; - expectedOut: BN; - minimumExpectedOut: BN; - } { - // essentially, we want to calculate the swap amount so that the remaining user balance = received token amount - - // solve this system of equations for swapAmount, outputAmount (we only care about swap amount tho) - // (baseReserve + swapAmount) * (quoteReserve - outputAmount) = baseReserve * quoteReserve - // baseAmount - swapAmount = outputAmount - - //solve equation - // (baseReserve + .99*swapAmount) * (quoteReserve - (userTokens - swapAmount)) = baseReserve * quoteReserve - // multiplying out the left hand side and subtracting baseReserve * quoteReserve from both sides yields the following: - // baseReserve*quoteReserve - baseReserve*userTokens + baseReserve*swapAmount + .99*swapAmount*quoteReserve - .99*swapAmount*userTokens + .99*swapAmount^2 = baseReserve*quoteReserve - // .99*swapAmount^2 + baseReserve*swapAmount + .99*swapAmount*quoteReserve - baseReserve*userTokens - .99*swapAmount*userTokens = 0 - // in the quadratic equation, a = .99, b = (baseReserve + .99*quoteReserve - .99*userTokens), c = -baseReserve*userTokens - // x = (-b + sqrt(b^2 - 4ac)) / 2a - - let a = 0.99; - let b = - Number(ammReserveIn) + - 0.99 * Number(ammReserveOut) - - 0.99 * Number(userBalanceIn); - let c = -Number(ammReserveIn) * Number(userBalanceIn); - - let x = (-b + Math.sqrt(b ** 2 - 4 * a * c)) / (2 * a); - //this should mathematically return a positive number assuming userBalanceIn, ammReserveIn, and ammReserveOut are all positive (which they should be) - // -b + Math.sqrt(b ** 2 - 4 * a * c) > 0 because -4*a*c > 0 and sqrt(b**2 + positive number) > b - - const swapAmount = x; - - let expectedOut = this.simulateSwapInner( - new BN(swapAmount), - ammReserveIn, - ammReserveOut, - ); - let minimumExpectedOut = - Number(expectedOut) - (Number(expectedOut) * Number(slippageBps)) / 10000; - return { - optimalSwapAmount: new BN(swapAmount), - userInAfterSwap: new BN(Number(userBalanceIn) - swapAmount), - expectedOut: expectedOut, - minimumExpectedOut: new BN(minimumExpectedOut), - }; - } -} - -// Add backwards compatibility alias -export { AmmMath as PriceMath }; diff --git a/sdk/src/v0.6/ConditionalVaultClient.ts b/sdk/src/v0.6/ConditionalVaultClient.ts deleted file mode 100644 index 047e0a46f..000000000 --- a/sdk/src/v0.6/ConditionalVaultClient.ts +++ /dev/null @@ -1,475 +0,0 @@ -import { AnchorProvider, Program, utils } from "@coral-xyz/anchor"; -import { - AccountInfo, - AddressLookupTableAccount, - Keypair, - PublicKey, - SystemProgram, -} from "@solana/web3.js"; - -import { ConditionalVaultProgram, ConditionalVaultIDL } from "./types/index.js"; - -import BN from "bn.js"; -import { - CONDITIONAL_VAULT_PROGRAM_ID, - MPL_TOKEN_METADATA_PROGRAM_ID, -} from "./constants.js"; -import { - getQuestionAddr, - getMetadataAddr, - getVaultAddr, - getConditionalTokenMintAddr, -} from "./utils/index.js"; -import { - createAssociatedTokenAccountIdempotentInstruction, - createAssociatedTokenAccountInstruction, - getAssociatedTokenAddressSync, - TOKEN_PROGRAM_ID, -} from "@solana/spl-token"; -import { ConditionalVault, Question } from "./types/index.js"; - -export type CreateVaultClientParams = { - provider: AnchorProvider; - conditionalVaultProgramId?: PublicKey; -}; - -export class ConditionalVaultClient { - public readonly provider: AnchorProvider; - public readonly vaultProgram: Program; - - constructor(provider: AnchorProvider, conditionalVaultProgramId: PublicKey) { - this.provider = provider; - this.vaultProgram = new Program( - ConditionalVaultIDL, - conditionalVaultProgramId, - provider, - ); - } - - public static createClient( - createVaultClientParams: CreateVaultClientParams, - ): ConditionalVaultClient { - let { provider, conditionalVaultProgramId } = createVaultClientParams; - - return new ConditionalVaultClient( - provider, - conditionalVaultProgramId || CONDITIONAL_VAULT_PROGRAM_ID, - ); - } - - async fetchQuestion(question: PublicKey): Promise { - return this.vaultProgram.account.question.fetchNullable(question); - } - - async fetchVault(vault: PublicKey): Promise { - return this.vaultProgram.account.conditionalVault.fetchNullable(vault); - } - - async deserializeQuestion( - accountInfo: AccountInfo, - ): Promise { - return this.vaultProgram.coder.accounts.decode( - "question", - accountInfo.data, - ); - } - - async deserializeVault( - accountInfo: AccountInfo, - ): Promise { - return this.vaultProgram.coder.accounts.decode( - "conditionalVault", - accountInfo.data, - ); - } - - initializeQuestionIx( - questionId: Uint8Array, - oracle: PublicKey, - numOutcomes: number, - ) { - const [question] = getQuestionAddr( - this.vaultProgram.programId, - questionId, - oracle, - numOutcomes, - ); - - return this.vaultProgram.methods - .initializeQuestion({ - questionId: Array.from(questionId), - oracle, - numOutcomes, - }) - .accounts({ - question, - }); - } - - async initializeQuestion( - questionId: Uint8Array, - oracle: PublicKey, - numOutcomes: number, - ): Promise { - const [question] = getQuestionAddr( - this.vaultProgram.programId, - questionId, - oracle, - numOutcomes, - ); - - await this.initializeQuestionIx(questionId, oracle, numOutcomes).rpc(); - - return question; - } - - initializeVaultIx( - question: PublicKey, - underlyingTokenMint: PublicKey, - numOutcomes: number, - payer: PublicKey = this.provider.publicKey, - ) { - const [vault] = getVaultAddr( - this.vaultProgram.programId, - question, - underlyingTokenMint, - ); - - let conditionalTokenMintAddrs = []; - for (let i = 0; i < numOutcomes; i++) { - const [conditionalTokenMint] = getConditionalTokenMintAddr( - this.vaultProgram.programId, - vault, - i, - ); - conditionalTokenMintAddrs.push(conditionalTokenMint); - } - - const vaultUnderlyingTokenAccount = getAssociatedTokenAddressSync( - underlyingTokenMint, - vault, - true, - ); - - return this.vaultProgram.methods - .initializeConditionalVault() - .accounts({ - vault, - question, - underlyingTokenMint, - vaultUnderlyingTokenAccount, - }) - .preInstructions([ - createAssociatedTokenAccountIdempotentInstruction( - payer, - vaultUnderlyingTokenAccount, - vault, - underlyingTokenMint, - ), - ]) - .remainingAccounts( - conditionalTokenMintAddrs.map((conditionalTokenMint) => { - return { - pubkey: conditionalTokenMint, - isWritable: true, - isSigner: false, - }; - }), - ); - } - - // TODO remove `numOucomes` - - async initializeVault( - question: PublicKey, - underlyingTokenMint: PublicKey, - numOutcomes: number, - ): Promise { - const [vault] = getVaultAddr( - this.vaultProgram.programId, - question, - underlyingTokenMint, - ); - - await this.initializeVaultIx( - question, - underlyingTokenMint, - numOutcomes, - ).rpc(); - - return vault; - } - - resolveQuestionIx( - question: PublicKey, - oracle: Keypair, - payoutNumerators: number[], - ) { - return this.vaultProgram.methods - .resolveQuestion({ - payoutNumerators, - }) - .accounts({ - question, - oracle: oracle.publicKey, - }) - .signers([oracle]); - } - - getConditionalTokenMints(vault: PublicKey, numOutcomes: number): PublicKey[] { - let conditionalTokenMintAddrs = []; - for (let i = 0; i < numOutcomes; i++) { - const [conditionalTokenMint] = getConditionalTokenMintAddr( - this.vaultProgram.programId, - vault, - i, - ); - conditionalTokenMintAddrs.push(conditionalTokenMint); - } - return conditionalTokenMintAddrs; - } - - getRemainingAccounts( - conditionalTokenMints: PublicKey[], - userConditionalAccounts: PublicKey[], - ) { - return conditionalTokenMints - .concat(userConditionalAccounts) - .map((account) => ({ - pubkey: account, - isWritable: true, - isSigner: false, - })); - } - - // Helper method to get conditional token accounts and instructions - getConditionalTokenAccountsAndInstructions( - vault: PublicKey, - numOutcomes: number, - user: PublicKey = this.provider.publicKey, - payer: PublicKey = this.provider.publicKey, - ) { - const conditionalTokenMintAddrs = this.getConditionalTokenMints( - vault, - numOutcomes, - ); - const userConditionalAccounts = conditionalTokenMintAddrs.map((mint) => - getAssociatedTokenAddressSync(mint, user, true), - ); - - const preInstructions = conditionalTokenMintAddrs.map((mint) => - createAssociatedTokenAccountIdempotentInstruction( - payer, - getAssociatedTokenAddressSync(mint, user, true), - user, - mint, - ), - ); - - const remainingAccounts = this.getRemainingAccounts( - conditionalTokenMintAddrs, - userConditionalAccounts, - ); - - return { userConditionalAccounts, preInstructions, remainingAccounts }; - } - - splitTokensIx( - question: PublicKey, - vault: PublicKey, - underlyingTokenMint: PublicKey, - amount: BN, - numOutcomes: number, - user: PublicKey = this.provider.publicKey, - payer: PublicKey = this.provider.publicKey, - ) { - const { preInstructions, remainingAccounts } = - this.getConditionalTokenAccountsAndInstructions( - vault, - numOutcomes, - user, - payer, - ); - - return this.vaultProgram.methods - .splitTokens(amount) - .accounts({ - question, - authority: user, - vault, - vaultUnderlyingTokenAccount: getAssociatedTokenAddressSync( - underlyingTokenMint, - vault, - true, - ), - userUnderlyingTokenAccount: getAssociatedTokenAddressSync( - underlyingTokenMint, - user, - true, - ), - }) - .preInstructions(preInstructions) - .remainingAccounts(remainingAccounts); - } - - mergeTokensIx( - question: PublicKey, - vault: PublicKey, - underlyingTokenMint: PublicKey, - amount: BN, - numOutcomes: number, - user: PublicKey = this.provider.publicKey, - payer: PublicKey = this.provider.publicKey, - ) { - let conditionalTokenMintAddrs = this.getConditionalTokenMints( - vault, - numOutcomes, - ); - - let userConditionalAccounts = []; - for (let conditionalTokenMint of conditionalTokenMintAddrs) { - userConditionalAccounts.push( - getAssociatedTokenAddressSync(conditionalTokenMint, user, true), - ); - } - - let ix = this.vaultProgram.methods - .mergeTokens(amount) - .accounts({ - question, - authority: user, - vault, - vaultUnderlyingTokenAccount: getAssociatedTokenAddressSync( - underlyingTokenMint, - vault, - true, - ), - userUnderlyingTokenAccount: getAssociatedTokenAddressSync( - underlyingTokenMint, - user, - true, - ), - }) - .preInstructions( - conditionalTokenMintAddrs.map((conditionalTokenMint) => { - return createAssociatedTokenAccountIdempotentInstruction( - payer, - getAssociatedTokenAddressSync(conditionalTokenMint, user, true), - user, - conditionalTokenMint, - ); - }), - ) - .remainingAccounts( - conditionalTokenMintAddrs - .concat(userConditionalAccounts) - .map((conditionalTokenMint) => { - return { - pubkey: conditionalTokenMint, - isWritable: true, - isSigner: false, - }; - }), - ); - - return ix; - } - - redeemTokensIx( - question: PublicKey, - vault: PublicKey, - underlyingTokenMint: PublicKey, - numOutcomes: number, - user: PublicKey = this.provider.publicKey, - payer: PublicKey = this.provider.publicKey, - ) { - let conditionalTokenMintAddrs = []; - for (let i = 0; i < numOutcomes; i++) { - const [conditionalTokenMint] = getConditionalTokenMintAddr( - this.vaultProgram.programId, - vault, - i, - ); - conditionalTokenMintAddrs.push(conditionalTokenMint); - } - - let userConditionalAccounts = []; - for (let conditionalTokenMint of conditionalTokenMintAddrs) { - userConditionalAccounts.push( - getAssociatedTokenAddressSync(conditionalTokenMint, user, true), - ); - } - - let ix = this.vaultProgram.methods - .redeemTokens() - .accounts({ - question, - authority: user, - vault, - vaultUnderlyingTokenAccount: getAssociatedTokenAddressSync( - underlyingTokenMint, - vault, - true, - ), - userUnderlyingTokenAccount: getAssociatedTokenAddressSync( - underlyingTokenMint, - user, - true, - ), - }) - .preInstructions( - conditionalTokenMintAddrs.map((conditionalTokenMint) => { - return createAssociatedTokenAccountIdempotentInstruction( - payer, - getAssociatedTokenAddressSync(conditionalTokenMint, user, true), - user, - conditionalTokenMint, - ); - }), - ) - .remainingAccounts( - conditionalTokenMintAddrs - .concat(userConditionalAccounts) - .map((conditionalTokenMint) => { - return { - pubkey: conditionalTokenMint, - isWritable: true, - isSigner: false, - }; - }), - ); - - return ix; - } - - addMetadataToConditionalTokensIx( - vault: PublicKey, - index: number, - name: string, - symbol: string, - uri: string, - payer: PublicKey = this.provider.publicKey, - ) { - const [conditionalTokenMint] = getConditionalTokenMintAddr( - this.vaultProgram.programId, - vault, - index, - ); - - const [conditionalTokenMetadata] = getMetadataAddr(conditionalTokenMint); - - return this.vaultProgram.methods - .addMetadataToConditionalTokens({ - name, - symbol, - uri, - }) - .accounts({ - payer, - vault, - conditionalTokenMint, - conditionalTokenMetadata, - tokenMetadataProgram: MPL_TOKEN_METADATA_PROGRAM_ID, - }); - } -} diff --git a/sdk/src/v0.6/FutarchyClient.ts b/sdk/src/v0.6/FutarchyClient.ts deleted file mode 100644 index dce78b1dc..000000000 --- a/sdk/src/v0.6/FutarchyClient.ts +++ /dev/null @@ -1,1130 +0,0 @@ -import { AnchorProvider, IdlTypes, Program } from "@coral-xyz/anchor"; -import { - AccountInfo, - AccountMeta, - AddressLookupTableAccount, - ComputeBudgetProgram, - Connection, - Keypair, - PublicKey, - SystemProgram, - Transaction, - TransactionInstruction, -} from "@solana/web3.js"; -import { InitializeDaoParams, UpdateDaoParams } from "./types/index.js"; - -// import { Autocrat, IDL as AutocratIDL } from "./types/autocrat.js"; -import { Futarchy, IDL as FutarchyIDL } from "./types/futarchy.js"; -import { - Futarchy as v0_6_0_futarchy, - IDL as v0_6_0_futarchyIDL, -} from "./types/v0.6.0-futarchy.js"; -import { - ConditionalVault, - IDL as ConditionalVaultIDL, -} from "./types/conditional_vault.js"; - -import BN from "bn.js"; -import { - AMM_PROGRAM_ID, - FUTARCHY_PROGRAM_ID, - CONDITIONAL_VAULT_PROGRAM_ID, - MAINNET_USDC, - PERMISSIONLESS_ACCOUNT, - SQUADS_PROGRAM_CONFIG, - SQUADS_PROGRAM_CONFIG_TREASURY, - SQUADS_PROGRAM_ID, - USDC_DECIMALS, - SHARED_LIQUIDITY_MANAGER_PROGRAM_ID, - DAMM_V2_PROGRAM_ID, - DAMM_V2_POOL_AUTHORITY, - MAINNET_METEORA_CONFIG, - LAUNCHPAD_PROGRAM_ID, - METADAO_MULTISIG_VAULT, -} from "./constants.js"; -import { - DEFAULT_CU_PRICE, - InstructionUtils, - MaxCUs, - getConditionalTokenMintAddr, - getDaoAddr, - getEventAuthorityAddr, - getProposalAddr, - getProposalAddrV2, - getQuestionAddr, - getVaultAddr, -} from "./utils/index.js"; -import { ConditionalVaultClient } from "./ConditionalVaultClient.js"; -import { - createAssociatedTokenAccountIdempotentInstruction, - getAssociatedTokenAddressSync, - unpackMint, - TOKEN_PROGRAM_ID, - ASSOCIATED_TOKEN_PROGRAM_ID, -} from "@solana/spl-token"; -import { sha256 } from "@noble/hashes/sha256"; -import { Dao, Proposal } from "./types/index.js"; - -import * as multisig from "@sqds/multisig"; -import { TransactionMessage } from "@solana/web3.js"; -import { getStakeAddr } from "./utils/index.js"; - -export type CreateClientParams = { - provider: AnchorProvider; - futarchyProgramId?: PublicKey; - conditionalVaultProgramId?: PublicKey; -}; - -export type ProposalVaults = { - baseVault: PublicKey; - quoteVault: PublicKey; -}; - -export class FutarchyClient { - public readonly provider: AnchorProvider; - public readonly futarchy: Program; - // useful for parsing old events - public readonly v0_6_0_futarchy: Program; - public readonly vaultClient: ConditionalVaultClient; - public readonly luts: AddressLookupTableAccount[]; - - constructor( - provider: AnchorProvider, - futarchyProgramId: PublicKey, - conditionalVaultProgramId: PublicKey, - luts: AddressLookupTableAccount[], - ) { - this.provider = provider; - this.futarchy = new Program( - FutarchyIDL, - futarchyProgramId, - provider, - ); - this.v0_6_0_futarchy = new Program( - v0_6_0_futarchyIDL, - futarchyProgramId, - provider, - ); - this.vaultClient = ConditionalVaultClient.createClient({ - provider, - conditionalVaultProgramId, - }); - this.luts = luts; - } - - public static createClient(params: CreateClientParams): FutarchyClient { - let { - provider, - futarchyProgramId: autocratProgramId, - conditionalVaultProgramId, - } = params; - - const luts: AddressLookupTableAccount[] = []; - - return new FutarchyClient( - provider, - autocratProgramId || FUTARCHY_PROGRAM_ID, - conditionalVaultProgramId || CONDITIONAL_VAULT_PROGRAM_ID, - luts, - ); - } - - getProgramId(): PublicKey { - return this.futarchy.programId; - } - - async getProposal(proposal: PublicKey): Promise { - return this.futarchy.account.proposal.fetch(proposal); - } - - async getDao(dao: PublicKey): Promise { - return this.futarchy.account.dao.fetch(dao); - } - - async fetchProposal(proposal: PublicKey): Promise { - return this.futarchy.account.proposal.fetchNullable(proposal); - } - - async fetchDao(dao: PublicKey): Promise { - return this.futarchy.account.dao.fetchNullable(dao); - } - - async deserializeProposal( - accountInfo: AccountInfo, - ): Promise { - return this.futarchy.coder.accounts.decode("proposal", accountInfo.data); - } - - async deserializeDao(accountInfo: AccountInfo): Promise { - return this.futarchy.coder.accounts.decode("dao", accountInfo.data); - } - - getProposalPdas( - proposal: PublicKey, - baseMint: PublicKey, - quoteMint: PublicKey, - dao: PublicKey, - ): { - question: PublicKey; - baseVault: PublicKey; - quoteVault: PublicKey; - passBaseMint: PublicKey; - passQuoteMint: PublicKey; - failBaseMint: PublicKey; - failQuoteMint: PublicKey; - } { - let vaultProgramId = this.vaultClient.vaultProgram.programId; - const [question] = getQuestionAddr( - vaultProgramId, - sha256(`Will ${proposal} pass?/FAIL/PASS`), - proposal, - 2, - ); - const [baseVault] = getVaultAddr( - this.vaultClient.vaultProgram.programId, - question, - baseMint, - ); - const [quoteVault] = getVaultAddr( - this.vaultClient.vaultProgram.programId, - question, - quoteMint, - ); - - const [failBaseMint] = getConditionalTokenMintAddr( - vaultProgramId, - baseVault, - 0, - ); - const [failQuoteMint] = getConditionalTokenMintAddr( - vaultProgramId, - quoteVault, - 0, - ); - - const [passBaseMint] = getConditionalTokenMintAddr( - vaultProgramId, - baseVault, - 1, - ); - const [passQuoteMint] = getConditionalTokenMintAddr( - vaultProgramId, - quoteVault, - 1, - ); - - return { - question, - baseVault, - quoteVault, - passBaseMint, - passQuoteMint, - failBaseMint, - failQuoteMint, - }; - } - - initializeDaoIx({ - baseMint, - params, - provideLiquidity = false, - quoteMint = MAINNET_USDC, - squadsProgramConfigTreasury = SQUADS_PROGRAM_CONFIG_TREASURY, - }: { - baseMint: PublicKey; - params: InitializeDaoParams; - provideLiquidity?: boolean; - quoteMint?: PublicKey; - squadsProgramConfigTreasury?: PublicKey; - }) { - const [dao] = getDaoAddr({ - nonce: params.nonce, - daoCreator: this.provider.publicKey, - }); - const multisigPda = multisig.getMultisigPda({ createKey: dao })[0]; - const squadsMultisigVault = multisig.getVaultPda({ - multisigPda, - index: 0, - })[0]; - - let daoCreatorBaseAccount = null; - let daoCreatorQuoteAccount = null; - if (provideLiquidity) { - daoCreatorBaseAccount = getAssociatedTokenAddressSync( - baseMint, - this.provider.publicKey, - true, - ); - daoCreatorQuoteAccount = getAssociatedTokenAddressSync( - quoteMint, - this.provider.publicKey, - true, - ); - } - - const spendingLimit = multisig.getSpendingLimitPda({ - multisigPda, - createKey: dao, - })[0]; - - return this.futarchy.methods.initializeDao(params).accounts({ - dao, - baseMint, - quoteMint, - squadsMultisig: multisigPda, - squadsMultisigVault, - squadsProgramConfig: SQUADS_PROGRAM_CONFIG, - squadsProgramConfigTreasury, - squadsProgram: SQUADS_PROGRAM_ID, - spendingLimit, - futarchyAmmBaseVault: getAssociatedTokenAddressSync(baseMint, dao, true), - futarchyAmmQuoteVault: getAssociatedTokenAddressSync( - quoteMint, - dao, - true, - ), - }); - } - - launchProposalIx({ - proposal, - dao, - baseMint, - quoteMint, - }: { - proposal: PublicKey; - dao: PublicKey; - baseMint: PublicKey; - quoteMint: PublicKey; - }) { - const { - baseVault, - quoteVault, - passBaseMint, - passQuoteMint, - failBaseMint, - failQuoteMint, - } = this.getProposalPdas(proposal, baseMint, quoteMint, dao); - - return this.futarchy.methods - .launchProposal() - .accounts({ - proposal, - dao, - baseVault, - quoteVault, - passBaseMint, - passQuoteMint, - failBaseMint, - failQuoteMint, - ammPassBaseVault: getAssociatedTokenAddressSync( - passBaseMint, - dao, - true, - ), - ammPassQuoteVault: getAssociatedTokenAddressSync( - passQuoteMint, - dao, - true, - ), - ammFailBaseVault: getAssociatedTokenAddressSync( - failBaseMint, - dao, - true, - ), - ammFailQuoteVault: getAssociatedTokenAddressSync( - failQuoteMint, - dao, - true, - ), - payer: this.provider.publicKey, - }) - .preInstructions([ - ComputeBudgetProgram.setComputeUnitLimit({ units: 300_000 }), - ]); - } - - spotSwapIx({ - dao, - baseMint, - quoteMint = MAINNET_USDC, - swapType, - inputAmount, - minOutputAmount = new BN(0), - trader = this.provider.publicKey, - }: { - dao: PublicKey; - baseMint: PublicKey; - quoteMint?: PublicKey; - swapType: "buy" | "sell"; - inputAmount: BN; - minOutputAmount?: BN; - trader?: PublicKey; - }) { - return this.futarchy.methods - .spotSwap({ - swapType: swapType === "buy" ? { buy: {} } : { sell: {} }, - inputAmount, - minOutputAmount, - }) - .accounts({ - dao, - userBaseAccount: getAssociatedTokenAddressSync(baseMint, trader, true), - userQuoteAccount: getAssociatedTokenAddressSync( - quoteMint, - trader, - true, - ), - ammBaseVault: getAssociatedTokenAddressSync(baseMint, dao, true), - ammQuoteVault: getAssociatedTokenAddressSync(quoteMint, dao, true), - user: trader, - }) - .preInstructions([ - createAssociatedTokenAccountIdempotentInstruction( - this.provider.publicKey, - getAssociatedTokenAddressSync(baseMint, trader, true), - trader, - baseMint, - ), - createAssociatedTokenAccountIdempotentInstruction( - this.provider.publicKey, - getAssociatedTokenAddressSync(quoteMint, trader, true), - trader, - quoteMint, - ), - ]); - } - - provideLiquidityIx({ - dao, - baseMint, - quoteMint, - quoteAmount, - maxBaseAmount, - minLiquidity = new BN(0), - positionAuthority = this.provider.publicKey, - liquidityProvider = this.provider.publicKey, - }: { - dao: PublicKey; - baseMint: PublicKey; - quoteMint: PublicKey; - quoteAmount: BN; - maxBaseAmount: BN; - minLiquidity?: BN; - positionAuthority?: PublicKey; - liquidityProvider?: PublicKey; - }) { - const ammPosition = PublicKey.findProgramAddressSync( - [ - Buffer.from("amm_position"), - dao.toBuffer(), - positionAuthority.toBuffer(), - ], - this.getProgramId(), - )[0]; - - return this.futarchy.methods - .provideLiquidity({ - quoteAmount, - maxBaseAmount, - minLiquidity, - positionAuthority, - }) - .accounts({ - dao, - liquidityProvider, - liquidityProviderBaseAccount: getAssociatedTokenAddressSync( - baseMint, - liquidityProvider, - true, - ), - liquidityProviderQuoteAccount: getAssociatedTokenAddressSync( - quoteMint, - liquidityProvider, - true, - ), - payer: this.provider.publicKey, - systemProgram: SystemProgram.programId, - ammBaseVault: getAssociatedTokenAddressSync(baseMint, dao, true), - ammQuoteVault: getAssociatedTokenAddressSync(quoteMint, dao, true), - ammPosition, - }) - .preInstructions([ - createAssociatedTokenAccountIdempotentInstruction( - this.provider.publicKey, - getAssociatedTokenAddressSync(baseMint, liquidityProvider, true), - liquidityProvider, - baseMint, - ), - createAssociatedTokenAccountIdempotentInstruction( - this.provider.publicKey, - getAssociatedTokenAddressSync(quoteMint, liquidityProvider, true), - liquidityProvider, - quoteMint, - ), - ]); - } - - conditionalSwapIx({ - dao, - trader = this.provider.publicKey, - payer = this.provider.publicKey, - baseMint, - quoteMint = MAINNET_USDC, - proposal, - market, - swapType, - inputAmount, - minOutputAmount, - }: { - dao: PublicKey; - trader?: PublicKey; - payer?: PublicKey; - baseMint: PublicKey; - quoteMint?: PublicKey; - proposal: PublicKey; - market: "pass" | "fail"; - swapType: "buy" | "sell"; - inputAmount: BN; - minOutputAmount: BN; - }) { - const { - passBaseMint, - passQuoteMint, - failBaseMint, - failQuoteMint, - baseVault, - quoteVault, - question, - } = this.getProposalPdas(proposal, baseMint, quoteMint, dao); - - let inputMint: PublicKey, outputMint: PublicKey; - - if (market == "pass" && swapType == "buy") { - inputMint = passQuoteMint; - outputMint = passBaseMint; - } else if (market == "pass" && swapType == "sell") { - inputMint = passBaseMint; - outputMint = passQuoteMint; - } else if (market == "fail" && swapType == "buy") { - inputMint = failQuoteMint; - outputMint = failBaseMint; - } else if (market == "fail" && swapType == "sell") { - inputMint = failBaseMint; - outputMint = failQuoteMint; - } else { - throw new Error( - "Either `market` or `swapType` is incorrectly configured", - ); - } - - return this.futarchy.methods - .conditionalSwap({ - market: market == "pass" ? { pass: {} } : { fail: {} }, - swapType: swapType == "buy" ? { buy: {} } : { sell: {} }, - inputAmount, - minOutputAmount, - }) - .accounts({ - dao, - proposal, - ammBaseVault: getAssociatedTokenAddressSync(baseMint, dao, true), - ammQuoteVault: getAssociatedTokenAddressSync(quoteMint, dao, true), - ammPassBaseVault: getAssociatedTokenAddressSync( - passBaseMint, - dao, - true, - ), - ammPassQuoteVault: getAssociatedTokenAddressSync( - passQuoteMint, - dao, - true, - ), - ammFailBaseVault: getAssociatedTokenAddressSync( - failBaseMint, - dao, - true, - ), - ammFailQuoteVault: getAssociatedTokenAddressSync( - failQuoteMint, - dao, - true, - ), - baseVault, - quoteVault, - userInputAccount: getAssociatedTokenAddressSync( - inputMint, - trader, - true, - ), - userOutputAccount: getAssociatedTokenAddressSync( - outputMint, - trader, - true, - ), - baseVaultUnderlyingTokenAccount: getAssociatedTokenAddressSync( - baseMint, - baseVault, - true, - ), - quoteVaultUnderlyingTokenAccount: getAssociatedTokenAddressSync( - quoteMint, - quoteVault, - true, - ), - passBaseMint, - failBaseMint, - passQuoteMint, - failQuoteMint, - conditionalVaultProgram: this.vaultClient.vaultProgram.programId, - vaultEventAuthority: getEventAuthorityAddr( - this.vaultClient.vaultProgram.programId, - )[0], - question, - }) - .preInstructions([ - createAssociatedTokenAccountIdempotentInstruction( - payer, - getAssociatedTokenAddressSync(outputMint, trader, true), - trader, - outputMint, - ), - ]); - } - - squadsProposalCreateTx({ - dao, - instructions, - transactionIndex, - payer = this.provider.publicKey, - }: { - dao: PublicKey; - instructions: TransactionInstruction[]; - transactionIndex: bigint; - payer?: PublicKey; - }): { tx: Transaction; squadsProposal: PublicKey } { - const multisigPda = multisig.getMultisigPda({ createKey: dao })[0]; - - const transactionMessage = new TransactionMessage({ - payerKey: payer, - recentBlockhash: "", // this doesn't get used - instructions, - }); - - const vaultTxCreate = multisig.instructions.vaultTransactionCreate({ - multisigPda, - transactionIndex, - creator: PERMISSIONLESS_ACCOUNT.publicKey, - rentPayer: payer, - vaultIndex: 0, - ephemeralSigners: 0, - transactionMessage, - }); - - const proposalCreate = multisig.instructions.proposalCreate({ - multisigPda, - transactionIndex, - creator: PERMISSIONLESS_ACCOUNT.publicKey, - rentPayer: payer, - }); - - const [squadsProposal] = multisig.getProposalPda({ - multisigPda, - transactionIndex: transactionIndex, - }); - - const tx = new Transaction().add(vaultTxCreate, proposalCreate); - - return { tx, squadsProposal }; - } - - async initializeProposal( - dao: PublicKey, - squadsProposal: PublicKey, - ): Promise { - const storedDao = await this.getDao(dao); - - let [proposal] = getProposalAddr(this.futarchy.programId, squadsProposal); - - await this.vaultClient.initializeQuestion( - sha256(`Will ${proposal} pass?/FAIL/PASS`), - proposal, - 2, - ); - - const { question } = this.getProposalPdas( - proposal, - storedDao.baseMint, - storedDao.quoteMint, - dao, - ); - - // it's important that these happen in a single atomic transaction - await this.vaultClient - .initializeVaultIx(question, storedDao.baseMint, 2) - .postInstructions( - await InstructionUtils.getInstructions( - this.vaultClient.initializeVaultIx(question, storedDao.quoteMint, 2), - ), - ) - .rpc(); - - await this.initializeProposalIx( - squadsProposal, - dao, - storedDao.baseMint, - storedDao.quoteMint, - question, - ) - .preInstructions([ - ComputeBudgetProgram.setComputeUnitLimit({ units: 300_000 }), - ]) - .rpc(); - - return proposal; - } - - initializeProposalIx( - squadsProposal: PublicKey, - dao: PublicKey, - baseMint: PublicKey, - quoteMint: PublicKey, - question: PublicKey, - proposer: PublicKey = this.provider.publicKey, - ) { - let [proposal] = getProposalAddr(this.futarchy.programId, squadsProposal); - const { - baseVault, - quoteVault, - passBaseMint, - passQuoteMint, - failBaseMint, - failQuoteMint, - } = this.getProposalPdas(proposal, baseMint, quoteMint, dao); - - let [futarchyAmm] = PublicKey.findProgramAddressSync( - [Buffer.from("futarchy_amm")], - this.getProgramId(), - ); - - return this.futarchy.methods - .initializeProposal() - .accounts({ - question, - proposal, - squadsProposal, - dao, - baseVault, - quoteVault, - proposer, - }) - .preInstructions([ - createAssociatedTokenAccountIdempotentInstruction( - this.provider.publicKey, - getAssociatedTokenAddressSync(passBaseMint, futarchyAmm, true), - futarchyAmm, - passBaseMint, - ), - createAssociatedTokenAccountIdempotentInstruction( - this.provider.publicKey, - getAssociatedTokenAddressSync(passQuoteMint, futarchyAmm, true), - futarchyAmm, - passQuoteMint, - ), - createAssociatedTokenAccountIdempotentInstruction( - this.provider.publicKey, - getAssociatedTokenAddressSync(failBaseMint, futarchyAmm, true), - futarchyAmm, - failBaseMint, - ), - createAssociatedTokenAccountIdempotentInstruction( - this.provider.publicKey, - getAssociatedTokenAddressSync(failQuoteMint, futarchyAmm, true), - futarchyAmm, - failQuoteMint, - ), - ]); - } - - async finalizeProposal(proposal: PublicKey) { - let storedProposal = await this.getProposal(proposal); - let storedDao = await this.getDao(storedProposal.dao); - - return this.finalizeProposalIx( - proposal, - storedProposal.squadsProposal, - storedProposal.dao, - storedDao.baseMint, - storedDao.quoteMint, - ).rpc(); - } - - finalizeProposalIxV2({ - squadsProposal, - dao, - baseMint, - quoteMint = MAINNET_USDC, - }: { - squadsProposal: PublicKey; - dao: PublicKey; - baseMint: PublicKey; - quoteMint?: PublicKey; - }) { - const [proposal] = getProposalAddrV2({ squadsProposal }); - - return this.finalizeProposalIx( - proposal, - squadsProposal, - dao, - baseMint, - quoteMint, - ); - } - - /** - * @deprecated use `finalizeProposalIxV2` instead - */ - finalizeProposalIx( - proposal: PublicKey, - squadsProposal: PublicKey, - dao: PublicKey, - daoToken: PublicKey, - usdc: PublicKey, - ) { - let vaultProgramId = this.vaultClient.vaultProgram.programId; - const multisigPda = multisig.getMultisigPda({ createKey: dao })[0]; - - const { - question, - quoteVault, - passBaseMint, - passQuoteMint, - failBaseMint, - failQuoteMint, - baseVault, - } = this.getProposalPdas(proposal, daoToken, usdc, dao); - - const [vaultEventAuthority] = getEventAuthorityAddr(vaultProgramId); - - return this.futarchy.methods - .finalizeProposal() - .accounts({ - proposal, - dao, - squadsProposal, - squadsMultisig: multisigPda, - squadsMultisigProgram: SQUADS_PROGRAM_ID, - quoteVault, - question, - quoteVaultUnderlyingTokenAccount: getAssociatedTokenAddressSync( - usdc, - quoteVault, - true, - ), - passQuoteMint, - failQuoteMint, - passBaseMint, - failBaseMint, - ammPassQuoteVault: getAssociatedTokenAddressSync( - passQuoteMint, - dao, - true, - ), - ammFailQuoteVault: getAssociatedTokenAddressSync( - failQuoteMint, - dao, - true, - ), - ammQuoteVault: getAssociatedTokenAddressSync(usdc, dao, true), - ammPassBaseVault: getAssociatedTokenAddressSync( - passBaseMint, - dao, - true, - ), - ammFailBaseVault: getAssociatedTokenAddressSync( - failBaseMint, - dao, - true, - ), - ammBaseVault: getAssociatedTokenAddressSync(daoToken, dao, true), - baseVault, - baseVaultUnderlyingTokenAccount: getAssociatedTokenAddressSync( - daoToken, - baseVault, - true, - ), - vaultProgram: this.vaultClient.vaultProgram.programId, - vaultEventAuthority, - }) - .preInstructions([ - ComputeBudgetProgram.setComputeUnitLimit({ units: 300_000 }), - ]); - } - - updateDaoIx({ dao, params }: { dao: PublicKey; params: UpdateDaoParams }) { - const multisigPda = multisig.getMultisigPda({ createKey: dao })[0]; - const squadsMultisigVault = multisig.getVaultPda({ - multisigPda, - index: 0, - })[0]; - - return this.futarchy.methods.updateDao(params).accounts({ - dao, - squadsMultisigVault, - }); - } - - stakeToProposalIx({ - proposal, - dao, - baseMint, - amount, - staker = this.provider.publicKey, - payer = this.provider.publicKey, - }: { - proposal: PublicKey; - dao: PublicKey; - baseMint: PublicKey; - amount: BN; - staker?: PublicKey; - payer?: PublicKey; - }) { - const stakeAccount = getStakeAddr(FUTARCHY_PROGRAM_ID, proposal, staker)[0]; - - return this.futarchy.methods - .stakeToProposal({ amount }) - .accounts({ - proposal, - dao, - stakerBaseAccount: getAssociatedTokenAddressSync( - baseMint, - staker, - true, - ), - proposalBaseAccount: getAssociatedTokenAddressSync( - baseMint, - proposal, - true, - ), - stakeAccount, - staker, - payer, - tokenProgram: TOKEN_PROGRAM_ID, - associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID, - systemProgram: SystemProgram.programId, - }) - .preInstructions([ - createAssociatedTokenAccountIdempotentInstruction( - payer, - getAssociatedTokenAddressSync(baseMint, staker, true), - staker, - baseMint, - ), - createAssociatedTokenAccountIdempotentInstruction( - payer, - getAssociatedTokenAddressSync(baseMint, proposal, true), - proposal, - baseMint, - ), - ]); - } - - unstakeFromProposalIx({ - proposal, - dao, - baseMint, - amount, - staker = this.provider.publicKey, - }: { - proposal: PublicKey; - dao: PublicKey; - baseMint: PublicKey; - amount: BN; - staker?: PublicKey; - }) { - const stakeAccount = getStakeAddr(FUTARCHY_PROGRAM_ID, proposal, staker)[0]; - - return this.futarchy.methods.unstakeFromProposal({ amount }).accounts({ - proposal, - dao, - stakerBaseAccount: getAssociatedTokenAddressSync(baseMint, staker, true), - proposalBaseAccount: getAssociatedTokenAddressSync( - baseMint, - proposal, - true, - ), - stakeAccount, - staker, - tokenProgram: TOKEN_PROGRAM_ID, - associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID, - }); - } - - collectFeesIx({ - dao, - baseMint, - quoteMint, - baseTokenAccount = getAssociatedTokenAddressSync( - baseMint, - METADAO_MULTISIG_VAULT, - true, - ), - quoteTokenAccount = getAssociatedTokenAddressSync( - quoteMint, - METADAO_MULTISIG_VAULT, - true, - ), - }: { - dao: PublicKey; - baseMint: PublicKey; - quoteMint: PublicKey; - baseTokenAccount?: PublicKey; - quoteTokenAccount?: PublicKey; - }) { - return this.futarchy.methods.collectFees().accounts({ - dao, - admin: this.provider.publicKey, - ammBaseVault: getAssociatedTokenAddressSync(baseMint, dao, true), - ammQuoteVault: getAssociatedTokenAddressSync(quoteMint, dao, true), - baseTokenAccount, - quoteTokenAccount, - }); - } - - sponsorProposalIx({ - proposal, - dao, - teamAddress = this.provider.publicKey, - }: { - proposal: PublicKey; - dao: PublicKey; - teamAddress?: PublicKey; - }) { - return this.futarchy.methods.sponsorProposal().accounts({ - proposal, - dao, - teamAddress, - }); - } - - collectMeteoraDammFeesIx({ - dao, - baseMint, - quoteMint = MAINNET_USDC, - transactionIndex, - meteoraConfig = MAINNET_METEORA_CONFIG, - admin = this.provider.publicKey, - }: { - dao: PublicKey; - baseMint: PublicKey; - quoteMint?: PublicKey; - transactionIndex: bigint; - meteoraConfig?: PublicKey; - admin?: PublicKey; - }) { - // Squads accounts - const multisigPda = multisig.getMultisigPda({ createKey: dao })[0]; - const squadsMultisigVault = multisig.getVaultPda({ - multisigPda, - index: 0, - })[0]; - const squadsMultisigVaultTransaction = multisig.getTransactionPda({ - multisigPda, - index: transactionIndex, - })[0]; - const squadsMultisigProposal = multisig.getProposalPda({ - multisigPda, - transactionIndex, - })[0]; - - // Token accounts for receiving fees - const baseTokenAccount = getAssociatedTokenAddressSync( - baseMint, - METADAO_MULTISIG_VAULT, - true, - ); - const quoteTokenAccount = getAssociatedTokenAddressSync( - quoteMint, - METADAO_MULTISIG_VAULT, - true, - ); - - // Helper function to sort mints for Meteora pool PDA - const sortMints = ( - mint1: PublicKey, - mint2: PublicKey, - ): [Buffer, Buffer] => { - const buf1 = mint1.toBuffer(); - const buf2 = mint2.toBuffer(); - if (Buffer.compare(buf1, buf2) > 0) { - return [buf1, buf2]; - } - return [buf2, buf1]; - }; - - const [sortedMint1, sortedMint2] = sortMints(baseMint, quoteMint); - - // Meteora DAMM accounts - const [pool] = PublicKey.findProgramAddressSync( - [Buffer.from("pool"), meteoraConfig.toBuffer(), sortedMint1, sortedMint2], - DAMM_V2_PROGRAM_ID, - ); - - const [positionNftMint] = PublicKey.findProgramAddressSync( - [Buffer.from("position_nft_mint"), baseMint.toBuffer()], - LAUNCHPAD_PROGRAM_ID, - ); - - const [positionNftAccount] = PublicKey.findProgramAddressSync( - [Buffer.from("position_nft_account"), positionNftMint.toBuffer()], - DAMM_V2_PROGRAM_ID, - ); - - const [position] = PublicKey.findProgramAddressSync( - [Buffer.from("position"), positionNftMint.toBuffer()], - DAMM_V2_PROGRAM_ID, - ); - - const [tokenAVault] = PublicKey.findProgramAddressSync( - [Buffer.from("token_vault"), baseMint.toBuffer(), pool.toBuffer()], - DAMM_V2_PROGRAM_ID, - ); - - const [tokenBVault] = PublicKey.findProgramAddressSync( - [Buffer.from("token_vault"), quoteMint.toBuffer(), pool.toBuffer()], - DAMM_V2_PROGRAM_ID, - ); - - const [dammV2EventAuthority] = getEventAuthorityAddr(DAMM_V2_PROGRAM_ID); - - return this.futarchy.methods.collectMeteoraDammFees().accounts({ - dao, - admin, - squadsMultisig: multisigPda, - squadsMultisigVault, - squadsMultisigVaultTransaction, - squadsMultisigProposal, - squadsMultisigPermissionlessAccount: PERMISSIONLESS_ACCOUNT.publicKey, - meteoraClaimPositionFeesAccounts: { - dammV2Program: DAMM_V2_PROGRAM_ID, - dammV2EventAuthority, - poolAuthority: DAMM_V2_POOL_AUTHORITY, - pool, - position, - tokenAAccount: baseTokenAccount, - tokenBAccount: quoteTokenAccount, - tokenAVault, - tokenBVault, - tokenAMint: baseMint, - tokenBMint: quoteMint, - positionNftAccount, - owner: squadsMultisigVault, - tokenAProgram: TOKEN_PROGRAM_ID, - tokenBProgram: TOKEN_PROGRAM_ID, - }, - systemProgram: SystemProgram.programId, - tokenProgram: TOKEN_PROGRAM_ID, - squadsProgram: SQUADS_PROGRAM_ID, - }); - } -} diff --git a/sdk/src/v0.6/PriceBasedPerformancePackageClient.ts b/sdk/src/v0.6/PriceBasedPerformancePackageClient.ts deleted file mode 100644 index 116319323..000000000 --- a/sdk/src/v0.6/PriceBasedPerformancePackageClient.ts +++ /dev/null @@ -1,228 +0,0 @@ -import { AnchorProvider, Program } from "@coral-xyz/anchor"; -import { - PublicKey, - Transaction, - TransactionInstruction, - SystemProgram, -} from "@solana/web3.js"; -import { - TOKEN_PROGRAM_ID, - ASSOCIATED_TOKEN_PROGRAM_ID, - getAssociatedTokenAddressSync, -} from "@solana/spl-token"; -import { - PriceBasedPerformancePackage, - IDL as PriceBasedPerformancePackageIDL, -} from "./types/price_based_performance_package.js"; -import { PRICE_BASED_PERFORMANCE_PACKAGE_PROGRAM_ID } from "./constants.js"; -import BN from "bn.js"; -// import { OracleConfig } from "./types/index.js"; -import { - getChangeRequestAddr, - getEventAuthorityAddr, - getPerformancePackageAddr, -} from "./utils/pda.js"; -import { InitializePerformancePackageParams } from "./types/index.js"; - -export type CreatePriceBasedPerformancePackageClientParams = { - provider: AnchorProvider; - priceBasedTokenLockProgramId?: PublicKey; -}; - -export class PriceBasedPerformancePackageClient { - public readonly provider: AnchorProvider; - public readonly program: Program; - public readonly programId: PublicKey; - - constructor( - provider: AnchorProvider, - priceBasedTokenLockProgramId: PublicKey, - ) { - this.provider = provider; - this.programId = priceBasedTokenLockProgramId; - this.program = new Program( - PriceBasedPerformancePackageIDL, - priceBasedTokenLockProgramId, - provider, - ); - } - - public static createClient( - createClientParams: CreatePriceBasedPerformancePackageClientParams, - ): PriceBasedPerformancePackageClient { - let { provider, priceBasedTokenLockProgramId } = createClientParams; - - if (!priceBasedTokenLockProgramId) { - priceBasedTokenLockProgramId = PRICE_BASED_PERFORMANCE_PACKAGE_PROGRAM_ID; - } - - return new PriceBasedPerformancePackageClient( - provider, - priceBasedTokenLockProgramId, - ); - } - - public initializePerformancePackageIx(params: { - params: InitializePerformancePackageParams; - createKey: PublicKey; - tokenMint: PublicKey; - grantor: PublicKey; - grantorTokenAccount?: PublicKey; - }) { - const performancePackage = getPerformancePackageAddr({ - createKey: params.createKey, - })[0]; - - const grantorTokenAccount = - params.grantorTokenAccount ?? - getAssociatedTokenAddressSync(params.tokenMint, params.grantor, true); - - return this.program.methods - .initializePerformancePackage(params.params) - .accounts({ - performancePackage, - createKey: params.createKey, - tokenMint: params.tokenMint, - grantorTokenAccount, - performancePackageTokenVault: getAssociatedTokenAddressSync( - params.tokenMint, - performancePackage, - true, - ), - grantor: params.grantor, - systemProgram: SystemProgram.programId, - tokenProgram: TOKEN_PROGRAM_ID, - associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID, - }); - } - - public startUnlockIx(params: { - performancePackage: PublicKey; - oracleAccount: PublicKey; - recipient: PublicKey; - }) { - return this.program.methods.startUnlock().accounts({ - performancePackage: params.performancePackage, - oracleAccount: params.oracleAccount, - recipient: params.recipient, - }); - } - - public completeUnlockIx(params: { - performancePackage: PublicKey; - oracleAccount: PublicKey; - tokenMint: PublicKey; - tokenRecipient: PublicKey; - }) { - return this.program.methods.completeUnlock().accounts({ - performancePackage: params.performancePackage, - oracleAccount: params.oracleAccount, - performancePackageTokenVault: getAssociatedTokenAddressSync( - params.tokenMint, - params.performancePackage, - true, - ), - tokenMint: params.tokenMint, - recipientTokenAccount: getAssociatedTokenAddressSync( - params.tokenMint, - params.tokenRecipient, - true, - ), - tokenRecipient: params.tokenRecipient, - systemProgram: SystemProgram.programId, - tokenProgram: TOKEN_PROGRAM_ID, - associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID, - }); - } - - public proposeChangeIx(params: { - params: { - changeType: any; - pdaNonce: number; - }; - performancePackage: PublicKey; - proposer: PublicKey; - }) { - const changeRequestAddress = this.getChangeRequestAddress( - params.performancePackage, - params.proposer, - params.params.pdaNonce, - ); - - return this.program.methods.proposeChange(params.params).accounts({ - changeRequest: changeRequestAddress, - performancePackage: params.performancePackage, - proposer: params.proposer, - systemProgram: SystemProgram.programId, - }); - } - - public executeChangeIx(params: { - performancePackage: PublicKey; - changeRequest: PublicKey; - executor: PublicKey; - }) { - return this.program.methods.executeChange().accounts({ - changeRequest: params.changeRequest, - performancePackage: params.performancePackage, - executor: params.executor, - }); - } - - public changePerformancePackageAuthorityIx(params: { - performancePackage: PublicKey; - currentAuthority: PublicKey; - newPerformancePackageAuthority: PublicKey; - }) { - return this.program.methods - .changePerformancePackageAuthority({ - newPerformancePackageAuthority: params.newPerformancePackageAuthority, - }) - .accounts({ - performancePackage: params.performancePackage, - currentAuthority: params.currentAuthority, - }); - } - - public async getPerformancePackage(performancePackageAddress: PublicKey) { - return await this.program.account.performancePackage.fetch( - performancePackageAddress, - ); - } - - public async getChangeRequest(changeRequestAddress: PublicKey) { - return await this.program.account.changeRequest.fetch(changeRequestAddress); - } - - public getChangeRequestAddress( - performancePackage: PublicKey, - proposer: PublicKey, - pdaNonce: number, - ): PublicKey { - const [changeRequestAddress] = getChangeRequestAddr({ - programId: this.programId, - performancePackage, - proposer, - pdaNonce, - }); - return changeRequestAddress; - } - - public getPerformancePackageTokenAccountAddress( - performancePackage: PublicKey, - ): PublicKey { - const [performancePackageTokenAccountAddress] = - PublicKey.findProgramAddressSync( - [ - Buffer.from("performance_package_token_account"), - performancePackage.toBuffer(), - ], - this.programId, - ); - return performancePackageTokenAccountAddress; - } - - public getEventAuthorityAddress(): PublicKey { - return getEventAuthorityAddr(this.programId)[0]; - } -} diff --git a/sdk/src/v0.6/constants.ts b/sdk/src/v0.6/constants.ts deleted file mode 100644 index 9466cb05d..000000000 --- a/sdk/src/v0.6/constants.ts +++ /dev/null @@ -1,123 +0,0 @@ -import { Keypair, PublicKey } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; -import { BN } from "bn.js"; - -export const FUTARCHY_PROGRAM_ID = new PublicKey( - "FUTARELBfJfQ8RDGhg1wdhddq1odMAJUePHFuBYfUxKq", -); -export const AMM_PROGRAM_ID = new PublicKey( - "AMMJdEiCCa8mdugg6JPF7gFirmmxisTfDJoSNSUi5zDJ", -); -export const CONDITIONAL_VAULT_PROGRAM_ID = new PublicKey( - "VLTX1ishMBbcX3rdBWGssxawAo1Q2X2qxYFYqiGodVg", -); -export const LAUNCHPAD_PROGRAM_ID = new PublicKey( - "MooNyh4CBUYEKyXVnjGYQ8mEiJDpGvJMdvrZx1iGeHV", -); -export const SHARED_LIQUIDITY_MANAGER_PROGRAM_ID = new PublicKey( - "EoJc1PYxZbnCjszampLcwJGYcB5Md47jM4oSQacRtD4d", -); -export const PRICE_BASED_PERFORMANCE_PACKAGE_PROGRAM_ID = new PublicKey( - "pbPPQH7jyKoSLu8QYs3rSY3YkDRXEBojKbTgnUg7NDS", -); - -export const MPL_TOKEN_METADATA_PROGRAM_ID = new PublicKey( - "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s", -); - -export const RAYDIUM_CP_SWAP_PROGRAM_ID = new PublicKey( - "CPMMoo8L3F4NbTegBCKVNunggL7H1ZpdTHKxQB5qKP1C", -); - -export const DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID = new PublicKey( - "CPMDWBwJDtYax9qW7AyRuVC19Cc4L4Vcy4n2BHAbHkCW", -); - -export const META_MINT = new PublicKey( - "3gN1WVEJwSHNWjo7hr87DgZp6zkf8kWgAJD29DmfE2Gr", -); -export const MAINNET_USDC = new PublicKey( - "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", -); - -export const DEVNET_USDC = new PublicKey( - "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU", -); -export const DEVNET_SQUADS_PROGRAM_CONFIG_TREASURY = new PublicKey( - "HM5y4mz3Bt9JY9mr1hkyhnvqxSH4H2u2451j7Hc2dtvK", -); - -export const USDC_DECIMALS = 6; - -export const AUTOCRAT_LUTS: PublicKey[] = []; - -export const RAYDIUM_AUTHORITY = PublicKey.findProgramAddressSync( - [anchor.utils.bytes.utf8.encode("vault_and_lp_mint_auth_seed")], - RAYDIUM_CP_SWAP_PROGRAM_ID, -)[0]; - -export const DEVNET_RAYDIUM_AUTHORITY = PublicKey.findProgramAddressSync( - [anchor.utils.bytes.utf8.encode("vault_and_lp_mint_auth_seed")], - DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID, -)[0]; - -export const DAMM_V2_PROGRAM_ID = new PublicKey( - "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG", -); - -export const DAMM_V2_POOL_AUTHORITY = new PublicKey( - "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC", -); - -export const LOW_FEE_RAYDIUM_CONFIG = new PublicKey( - "D4FPEruKEHrG5TenZ2mpDGEfu1iUvTiqBxvpU8HLBvC2", -); - -export const DEVNET_LOW_FEE_RAYDIUM_CONFIG = PublicKey.findProgramAddressSync( - [ - anchor.utils.bytes.utf8.encode("amm_config"), - new BN(0).toArrayLike(Buffer, "be", 2), - ], - DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID, -)[0]; - -export const RAYDIUM_CREATE_POOL_FEE_RECEIVE = new PublicKey( - "DNXgeM9EiiaAbaWvwjHj9fQQLAX5ZsfHyvmYUNRAdNC8", -); - -export const DEVNET_RAYDIUM_CREATE_POOL_FEE_RECEIVE = new PublicKey( - "G11FKBRaAkHAKuLCgLM6K6NUc9rTjPAznRCjZifrTQe2", -); - -export const SQUADS_PROGRAM_CONFIG = new PublicKey( - "BSTq9w3kZwNwpBXJEvTZz2G9ZTNyKBvoSeXMvwb4cNZr", -); - -export const SQUADS_PROGRAM_ID = new PublicKey( - "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf", -); - -export const SQUADS_PROGRAM_CONFIG_TREASURY = new PublicKey( - "5DH2e3cJmFpyi6mk65EGFediunm4ui6BiKNUNrhWtD1b", -); - -export const SQUADS_PROGRAM_CONFIG_TREASURY_DEVNET = new PublicKey( - "HM5y4mz3Bt9JY9mr1hkyhnvqxSH4H2u2451j7Hc2dtvK", -); - -export const MAINNET_METEORA_CONFIG = new PublicKey( - "Asv1KQqeop9e4FFvTzEBZhwtTjuWHXPq5thUGtQrzzA3", -); - -export const METADAO_MULTISIG_VAULT = new PublicKey( - "6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf", -); - -export const PERMISSIONLESS_ACCOUNT = Keypair.fromSecretKey( - Uint8Array.from([ - 249, 158, 188, 171, 243, 143, 1, 48, 87, 243, 209, 153, 144, 106, 23, 88, - 161, 209, 65, 217, 199, 121, 0, 250, 3, 203, 133, 138, 141, 112, 243, 38, - 198, 205, 120, 222, 160, 224, 151, 190, 84, 254, 127, 178, 224, 195, 130, - 243, 145, 73, 20, 91, 9, 69, 222, 184, 23, 1, 2, 196, 202, 206, 153, 192, - ]), -); diff --git a/sdk/src/v0.6/index.ts b/sdk/src/v0.6/index.ts deleted file mode 100644 index 01929e5b2..000000000 --- a/sdk/src/v0.6/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from "./types/index.js"; -export * from "./utils/index.js"; -export * from "./constants.js"; -export * from "./FutarchyClient.js"; -export * from "./ConditionalVaultClient.js"; -export * from "./LaunchpadClient.js"; -export * from "./PriceBasedPerformancePackageClient.js"; diff --git a/sdk/src/v0.6/types/amm.ts b/sdk/src/v0.6/types/amm.ts deleted file mode 100644 index 6d36be8d8..000000000 --- a/sdk/src/v0.6/types/amm.ts +++ /dev/null @@ -1,1663 +0,0 @@ -export type Amm = { - version: "0.5.0"; - name: "amm"; - instructions: [ - { - name: "createAmm"; - accounts: [ - { - name: "user"; - isMut: true; - isSigner: true; - }, - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "lpMint"; - isMut: true; - isSigner: false; - }, - { - name: "baseMint"; - isMut: false; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "vaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "CreateAmmArgs"; - }; - }, - ]; - }, - { - name: "addLiquidity"; - accounts: [ - { - name: "user"; - isMut: true; - isSigner: true; - }, - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "lpMint"; - isMut: true; - isSigner: false; - }, - { - name: "userLpAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userBaseAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "AddLiquidityArgs"; - }; - }, - ]; - }, - { - name: "removeLiquidity"; - accounts: [ - { - name: "user"; - isMut: true; - isSigner: true; - }, - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "lpMint"; - isMut: true; - isSigner: false; - }, - { - name: "userLpAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userBaseAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "RemoveLiquidityArgs"; - }; - }, - ]; - }, - { - name: "swap"; - accounts: [ - { - name: "user"; - isMut: true; - isSigner: true; - }, - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "userBaseAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "SwapArgs"; - }; - }, - ]; - }, - { - name: "crankThatTwap"; - accounts: [ - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - ]; - accounts: [ - { - name: "amm"; - type: { - kind: "struct"; - fields: [ - { - name: "bump"; - type: "u8"; - }, - { - name: "createdAtSlot"; - type: "u64"; - }, - { - name: "lpMint"; - type: "publicKey"; - }, - { - name: "baseMint"; - type: "publicKey"; - }, - { - name: "quoteMint"; - type: "publicKey"; - }, - { - name: "baseMintDecimals"; - type: "u8"; - }, - { - name: "quoteMintDecimals"; - type: "u8"; - }, - { - name: "baseAmount"; - type: "u64"; - }, - { - name: "quoteAmount"; - type: "u64"; - }, - { - name: "oracle"; - type: { - defined: "TwapOracle"; - }; - }, - { - name: "seqNum"; - type: "u64"; - }, - { - name: "vaultAtaBase"; - type: "publicKey"; - }, - { - name: "vaultAtaQuote"; - type: "publicKey"; - }, - ]; - }; - }, - ]; - types: [ - { - name: "CommonFields"; - type: { - kind: "struct"; - fields: [ - { - name: "slot"; - type: "u64"; - }, - { - name: "unixTimestamp"; - type: "i64"; - }, - { - name: "user"; - type: "publicKey"; - }, - { - name: "amm"; - type: "publicKey"; - }, - { - name: "postBaseReserves"; - type: "u64"; - }, - { - name: "postQuoteReserves"; - type: "u64"; - }, - { - name: "oracleLastPrice"; - type: "u128"; - }, - { - name: "oracleLastObservation"; - type: "u128"; - }, - { - name: "oracleAggregator"; - type: "u128"; - }, - { - name: "seqNum"; - type: "u64"; - }, - ]; - }; - }, - { - name: "AddLiquidityArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "quoteAmount"; - docs: ["How much quote token you will deposit to the pool"]; - type: "u64"; - }, - { - name: "maxBaseAmount"; - docs: ["The maximum base token you will deposit to the pool"]; - type: "u64"; - }, - { - name: "minLpTokens"; - docs: ["The minimum LP token you will get back"]; - type: "u64"; - }, - ]; - }; - }, - { - name: "CreateAmmArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "twapInitialObservation"; - type: "u128"; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; - }, - { - name: "twapStartDelaySlots"; - type: "u64"; - }, - ]; - }; - }, - { - name: "RemoveLiquidityArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "lpTokensToBurn"; - type: "u64"; - }, - { - name: "minQuoteAmount"; - type: "u64"; - }, - { - name: "minBaseAmount"; - type: "u64"; - }, - ]; - }; - }, - { - name: "SwapArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "swapType"; - type: { - defined: "SwapType"; - }; - }, - { - name: "inputAmount"; - type: "u64"; - }, - { - name: "outputAmountMin"; - type: "u64"; - }, - ]; - }; - }, - { - name: "TwapOracle"; - type: { - kind: "struct"; - fields: [ - { - name: "lastUpdatedSlot"; - type: "u64"; - }, - { - name: "lastPrice"; - docs: [ - "A price is the number of quote units per base unit multiplied by 1e12.", - "You cannot simply divide by 1e12 to get a price you can display in the UI", - "because the base and quote decimals may be different. Instead, do:", - "ui_price = (price * (10**(base_decimals - quote_decimals))) / 1e12", - ]; - type: "u128"; - }, - { - name: "lastObservation"; - docs: [ - "If we did a raw TWAP over prices, someone could push the TWAP heavily with", - "a few extremely large outliers. So we use observations, which can only move", - "by `max_observation_change_per_update` per update.", - ]; - type: "u128"; - }, - { - name: "aggregator"; - docs: [ - "Running sum of slots_per_last_update * last_observation.", - "", - "Assuming latest observations are as big as possible (u64::MAX * 1e12),", - "we can store 18 million slots worth of observations, which turns out to", - "be ~85 days worth of slots.", - "", - "Assuming that latest observations are 100x smaller than they could theoretically", - "be, we can store 8500 days (23 years) worth of them. Even this is a very", - "very conservative assumption - META/USDC prices should be between 1e9 and", - "1e15, which would overflow after 1e15 years worth of slots.", - "", - "So in the case of an overflow, the aggregator rolls back to 0. It's the", - "client's responsibility to sanity check the assets or to handle an", - "aggregator at T2 being smaller than an aggregator at T1.", - ]; - type: "u128"; - }, - { - name: "maxObservationChangePerUpdate"; - docs: ["The most that an observation can change per update."]; - type: "u128"; - }, - { - name: "initialObservation"; - docs: ["What the initial `latest_observation` is set to."]; - type: "u128"; - }, - { - name: "startDelaySlots"; - docs: [ - "Number of slots after amm.created_at_slot to start recording TWAP", - ]; - type: "u64"; - }, - ]; - }; - }, - { - name: "SwapType"; - type: { - kind: "enum"; - variants: [ - { - name: "Buy"; - }, - { - name: "Sell"; - }, - ]; - }; - }, - ]; - events: [ - { - name: "SwapEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "inputAmount"; - type: "u64"; - index: false; - }, - { - name: "outputAmount"; - type: "u64"; - index: false; - }, - { - name: "swapType"; - type: { - defined: "SwapType"; - }; - index: false; - }, - ]; - }, - { - name: "AddLiquidityEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "quoteAmount"; - type: "u64"; - index: false; - }, - { - name: "maxBaseAmount"; - type: "u64"; - index: false; - }, - { - name: "minLpTokens"; - type: "u64"; - index: false; - }, - { - name: "baseAmount"; - type: "u64"; - index: false; - }, - { - name: "lpTokensMinted"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "RemoveLiquidityEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "lpTokensBurned"; - type: "u64"; - index: false; - }, - { - name: "minQuoteAmount"; - type: "u64"; - index: false; - }, - { - name: "minBaseAmount"; - type: "u64"; - index: false; - }, - { - name: "baseAmount"; - type: "u64"; - index: false; - }, - { - name: "quoteAmount"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "CreateAmmEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "twapInitialObservation"; - type: "u128"; - index: false; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; - index: false; - }, - { - name: "lpMint"; - type: "publicKey"; - index: false; - }, - { - name: "baseMint"; - type: "publicKey"; - index: false; - }, - { - name: "quoteMint"; - type: "publicKey"; - index: false; - }, - { - name: "vaultAtaBase"; - type: "publicKey"; - index: false; - }, - { - name: "vaultAtaQuote"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "CrankThatTwapEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - ]; - }, - ]; - errors: [ - { - code: 6000; - name: "AssertFailed"; - msg: "An assertion failed"; - }, - { - code: 6001; - name: "NoSlotsPassed"; - msg: "Can't get a TWAP before some observations have been stored"; - }, - { - code: 6002; - name: "NoReserves"; - msg: "Can't swap through a pool without token reserves on either side"; - }, - { - code: 6003; - name: "InputAmountOverflow"; - msg: "Input token amount is too large for a swap, causes overflow"; - }, - { - code: 6004; - name: "AddLiquidityCalculationError"; - msg: "Add liquidity calculation error"; - }, - { - code: 6005; - name: "DecimalScaleError"; - msg: "Error in decimal scale conversion"; - }, - { - code: 6006; - name: "SameTokenMints"; - msg: "You can't create an AMM pool where the token mints are the same"; - }, - { - code: 6007; - name: "SwapSlippageExceeded"; - msg: "A user wouldn't have gotten back their `output_amount_min`, reverting"; - }, - { - code: 6008; - name: "InsufficientBalance"; - msg: "The user had insufficient balance to do this"; - }, - { - code: 6009; - name: "ZeroLiquidityRemove"; - msg: "Must remove a non-zero amount of liquidity"; - }, - { - code: 6010; - name: "ZeroLiquidityToAdd"; - msg: "Cannot add liquidity with 0 tokens on either side"; - }, - { - code: 6011; - name: "ZeroMinLpTokens"; - msg: "Must specify a non-zero `min_lp_tokens` when adding to an existing pool"; - }, - { - code: 6012; - name: "AddLiquiditySlippageExceeded"; - msg: "LP wouldn't have gotten back `lp_token_min`"; - }, - { - code: 6013; - name: "AddLiquidityMaxBaseExceeded"; - msg: "LP would have spent more than `max_base_amount`"; - }, - { - code: 6014; - name: "InsufficientQuoteAmount"; - msg: "`quote_amount` must be greater than 100000000 when initializing a pool"; - }, - { - code: 6015; - name: "ZeroSwapAmount"; - msg: "Users must swap a non-zero amount"; - }, - { - code: 6016; - name: "ConstantProductInvariantFailed"; - msg: "K should always be increasing"; - }, - { - code: 6017; - name: "CastingOverflow"; - msg: "Casting has caused an overflow"; - }, - ]; -}; - -export const IDL: Amm = { - version: "0.5.0", - name: "amm", - instructions: [ - { - name: "createAmm", - accounts: [ - { - name: "user", - isMut: true, - isSigner: true, - }, - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "lpMint", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "vaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "CreateAmmArgs", - }, - }, - ], - }, - { - name: "addLiquidity", - accounts: [ - { - name: "user", - isMut: true, - isSigner: true, - }, - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "lpMint", - isMut: true, - isSigner: false, - }, - { - name: "userLpAccount", - isMut: true, - isSigner: false, - }, - { - name: "userBaseAccount", - isMut: true, - isSigner: false, - }, - { - name: "userQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "AddLiquidityArgs", - }, - }, - ], - }, - { - name: "removeLiquidity", - accounts: [ - { - name: "user", - isMut: true, - isSigner: true, - }, - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "lpMint", - isMut: true, - isSigner: false, - }, - { - name: "userLpAccount", - isMut: true, - isSigner: false, - }, - { - name: "userBaseAccount", - isMut: true, - isSigner: false, - }, - { - name: "userQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "RemoveLiquidityArgs", - }, - }, - ], - }, - { - name: "swap", - accounts: [ - { - name: "user", - isMut: true, - isSigner: true, - }, - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "userBaseAccount", - isMut: true, - isSigner: false, - }, - { - name: "userQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "SwapArgs", - }, - }, - ], - }, - { - name: "crankThatTwap", - accounts: [ - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "amm", - type: { - kind: "struct", - fields: [ - { - name: "bump", - type: "u8", - }, - { - name: "createdAtSlot", - type: "u64", - }, - { - name: "lpMint", - type: "publicKey", - }, - { - name: "baseMint", - type: "publicKey", - }, - { - name: "quoteMint", - type: "publicKey", - }, - { - name: "baseMintDecimals", - type: "u8", - }, - { - name: "quoteMintDecimals", - type: "u8", - }, - { - name: "baseAmount", - type: "u64", - }, - { - name: "quoteAmount", - type: "u64", - }, - { - name: "oracle", - type: { - defined: "TwapOracle", - }, - }, - { - name: "seqNum", - type: "u64", - }, - { - name: "vaultAtaBase", - type: "publicKey", - }, - { - name: "vaultAtaQuote", - type: "publicKey", - }, - ], - }, - }, - ], - types: [ - { - name: "CommonFields", - type: { - kind: "struct", - fields: [ - { - name: "slot", - type: "u64", - }, - { - name: "unixTimestamp", - type: "i64", - }, - { - name: "user", - type: "publicKey", - }, - { - name: "amm", - type: "publicKey", - }, - { - name: "postBaseReserves", - type: "u64", - }, - { - name: "postQuoteReserves", - type: "u64", - }, - { - name: "oracleLastPrice", - type: "u128", - }, - { - name: "oracleLastObservation", - type: "u128", - }, - { - name: "oracleAggregator", - type: "u128", - }, - { - name: "seqNum", - type: "u64", - }, - ], - }, - }, - { - name: "AddLiquidityArgs", - type: { - kind: "struct", - fields: [ - { - name: "quoteAmount", - docs: ["How much quote token you will deposit to the pool"], - type: "u64", - }, - { - name: "maxBaseAmount", - docs: ["The maximum base token you will deposit to the pool"], - type: "u64", - }, - { - name: "minLpTokens", - docs: ["The minimum LP token you will get back"], - type: "u64", - }, - ], - }, - }, - { - name: "CreateAmmArgs", - type: { - kind: "struct", - fields: [ - { - name: "twapInitialObservation", - type: "u128", - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - }, - { - name: "twapStartDelaySlots", - type: "u64", - }, - ], - }, - }, - { - name: "RemoveLiquidityArgs", - type: { - kind: "struct", - fields: [ - { - name: "lpTokensToBurn", - type: "u64", - }, - { - name: "minQuoteAmount", - type: "u64", - }, - { - name: "minBaseAmount", - type: "u64", - }, - ], - }, - }, - { - name: "SwapArgs", - type: { - kind: "struct", - fields: [ - { - name: "swapType", - type: { - defined: "SwapType", - }, - }, - { - name: "inputAmount", - type: "u64", - }, - { - name: "outputAmountMin", - type: "u64", - }, - ], - }, - }, - { - name: "TwapOracle", - type: { - kind: "struct", - fields: [ - { - name: "lastUpdatedSlot", - type: "u64", - }, - { - name: "lastPrice", - docs: [ - "A price is the number of quote units per base unit multiplied by 1e12.", - "You cannot simply divide by 1e12 to get a price you can display in the UI", - "because the base and quote decimals may be different. Instead, do:", - "ui_price = (price * (10**(base_decimals - quote_decimals))) / 1e12", - ], - type: "u128", - }, - { - name: "lastObservation", - docs: [ - "If we did a raw TWAP over prices, someone could push the TWAP heavily with", - "a few extremely large outliers. So we use observations, which can only move", - "by `max_observation_change_per_update` per update.", - ], - type: "u128", - }, - { - name: "aggregator", - docs: [ - "Running sum of slots_per_last_update * last_observation.", - "", - "Assuming latest observations are as big as possible (u64::MAX * 1e12),", - "we can store 18 million slots worth of observations, which turns out to", - "be ~85 days worth of slots.", - "", - "Assuming that latest observations are 100x smaller than they could theoretically", - "be, we can store 8500 days (23 years) worth of them. Even this is a very", - "very conservative assumption - META/USDC prices should be between 1e9 and", - "1e15, which would overflow after 1e15 years worth of slots.", - "", - "So in the case of an overflow, the aggregator rolls back to 0. It's the", - "client's responsibility to sanity check the assets or to handle an", - "aggregator at T2 being smaller than an aggregator at T1.", - ], - type: "u128", - }, - { - name: "maxObservationChangePerUpdate", - docs: ["The most that an observation can change per update."], - type: "u128", - }, - { - name: "initialObservation", - docs: ["What the initial `latest_observation` is set to."], - type: "u128", - }, - { - name: "startDelaySlots", - docs: [ - "Number of slots after amm.created_at_slot to start recording TWAP", - ], - type: "u64", - }, - ], - }, - }, - { - name: "SwapType", - type: { - kind: "enum", - variants: [ - { - name: "Buy", - }, - { - name: "Sell", - }, - ], - }, - }, - ], - events: [ - { - name: "SwapEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "inputAmount", - type: "u64", - index: false, - }, - { - name: "outputAmount", - type: "u64", - index: false, - }, - { - name: "swapType", - type: { - defined: "SwapType", - }, - index: false, - }, - ], - }, - { - name: "AddLiquidityEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "quoteAmount", - type: "u64", - index: false, - }, - { - name: "maxBaseAmount", - type: "u64", - index: false, - }, - { - name: "minLpTokens", - type: "u64", - index: false, - }, - { - name: "baseAmount", - type: "u64", - index: false, - }, - { - name: "lpTokensMinted", - type: "u64", - index: false, - }, - ], - }, - { - name: "RemoveLiquidityEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "lpTokensBurned", - type: "u64", - index: false, - }, - { - name: "minQuoteAmount", - type: "u64", - index: false, - }, - { - name: "minBaseAmount", - type: "u64", - index: false, - }, - { - name: "baseAmount", - type: "u64", - index: false, - }, - { - name: "quoteAmount", - type: "u64", - index: false, - }, - ], - }, - { - name: "CreateAmmEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "twapInitialObservation", - type: "u128", - index: false, - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - index: false, - }, - { - name: "lpMint", - type: "publicKey", - index: false, - }, - { - name: "baseMint", - type: "publicKey", - index: false, - }, - { - name: "quoteMint", - type: "publicKey", - index: false, - }, - { - name: "vaultAtaBase", - type: "publicKey", - index: false, - }, - { - name: "vaultAtaQuote", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "CrankThatTwapEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - ], - }, - ], - errors: [ - { - code: 6000, - name: "AssertFailed", - msg: "An assertion failed", - }, - { - code: 6001, - name: "NoSlotsPassed", - msg: "Can't get a TWAP before some observations have been stored", - }, - { - code: 6002, - name: "NoReserves", - msg: "Can't swap through a pool without token reserves on either side", - }, - { - code: 6003, - name: "InputAmountOverflow", - msg: "Input token amount is too large for a swap, causes overflow", - }, - { - code: 6004, - name: "AddLiquidityCalculationError", - msg: "Add liquidity calculation error", - }, - { - code: 6005, - name: "DecimalScaleError", - msg: "Error in decimal scale conversion", - }, - { - code: 6006, - name: "SameTokenMints", - msg: "You can't create an AMM pool where the token mints are the same", - }, - { - code: 6007, - name: "SwapSlippageExceeded", - msg: "A user wouldn't have gotten back their `output_amount_min`, reverting", - }, - { - code: 6008, - name: "InsufficientBalance", - msg: "The user had insufficient balance to do this", - }, - { - code: 6009, - name: "ZeroLiquidityRemove", - msg: "Must remove a non-zero amount of liquidity", - }, - { - code: 6010, - name: "ZeroLiquidityToAdd", - msg: "Cannot add liquidity with 0 tokens on either side", - }, - { - code: 6011, - name: "ZeroMinLpTokens", - msg: "Must specify a non-zero `min_lp_tokens` when adding to an existing pool", - }, - { - code: 6012, - name: "AddLiquiditySlippageExceeded", - msg: "LP wouldn't have gotten back `lp_token_min`", - }, - { - code: 6013, - name: "AddLiquidityMaxBaseExceeded", - msg: "LP would have spent more than `max_base_amount`", - }, - { - code: 6014, - name: "InsufficientQuoteAmount", - msg: "`quote_amount` must be greater than 100000000 when initializing a pool", - }, - { - code: 6015, - name: "ZeroSwapAmount", - msg: "Users must swap a non-zero amount", - }, - { - code: 6016, - name: "ConstantProductInvariantFailed", - msg: "K should always be increasing", - }, - { - code: 6017, - name: "CastingOverflow", - msg: "Casting has caused an overflow", - }, - ], -}; diff --git a/sdk/src/v0.6/types/autocrat.ts b/sdk/src/v0.6/types/autocrat.ts deleted file mode 100644 index a2afb15ee..000000000 --- a/sdk/src/v0.6/types/autocrat.ts +++ /dev/null @@ -1,2377 +0,0 @@ -export type Autocrat = { - version: "0.5.0"; - name: "autocrat"; - instructions: [ - { - name: "initializeDao"; - accounts: [ - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "daoCreator"; - isMut: false; - isSigner: true; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "baseMint"; - isMut: false; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "squadsMultisig"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigVault"; - isMut: false; - isSigner: false; - }, - { - name: "squadsProgram"; - isMut: false; - isSigner: false; - }, - { - name: "squadsProgramConfig"; - isMut: false; - isSigner: false; - }, - { - name: "squadsProgramConfigTreasury"; - isMut: true; - isSigner: false; - }, - { - name: "spendingLimit"; - isMut: true; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "InitializeDaoParams"; - }; - }, - ]; - }, - { - name: "initializeProposal"; - accounts: [ - { - name: "proposal"; - isMut: true; - isSigner: false; - }, - { - name: "squadsProposal"; - isMut: false; - isSigner: false; - }, - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "question"; - isMut: false; - isSigner: false; - }, - { - name: "quoteVault"; - isMut: false; - isSigner: false; - }, - { - name: "baseVault"; - isMut: false; - isSigner: false; - }, - { - name: "passAmm"; - isMut: false; - isSigner: false; - }, - { - name: "passLpMint"; - isMut: false; - isSigner: false; - }, - { - name: "failLpMint"; - isMut: false; - isSigner: false; - }, - { - name: "failAmm"; - isMut: false; - isSigner: false; - }, - { - name: "passLpUserAccount"; - isMut: true; - isSigner: false; - }, - { - name: "failLpUserAccount"; - isMut: true; - isSigner: false; - }, - { - name: "passLpVaultAccount"; - isMut: true; - isSigner: false; - }, - { - name: "failLpVaultAccount"; - isMut: true; - isSigner: false; - }, - { - name: "proposer"; - isMut: false; - isSigner: true; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "InitializeProposalParams"; - }; - }, - ]; - }, - { - name: "finalizeProposal"; - accounts: [ - { - name: "proposal"; - isMut: true; - isSigner: false; - }, - { - name: "squadsProposal"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigProgram"; - isMut: false; - isSigner: false; - }, - { - name: "squadsMultisig"; - isMut: false; - isSigner: false; - }, - { - name: "passAmm"; - isMut: false; - isSigner: false; - }, - { - name: "failAmm"; - isMut: false; - isSigner: false; - }, - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "question"; - isMut: true; - isSigner: false; - }, - { - name: "passLpUserAccount"; - isMut: true; - isSigner: false; - }, - { - name: "failLpUserAccount"; - isMut: true; - isSigner: false; - }, - { - name: "passLpVaultAccount"; - isMut: true; - isSigner: false; - }, - { - name: "failLpVaultAccount"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "vaultProgram"; - isMut: false; - isSigner: false; - }, - { - name: "vaultEventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "updateDao"; - accounts: [ - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigVault"; - isMut: false; - isSigner: true; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "daoParams"; - type: { - defined: "UpdateDaoParams"; - }; - }, - ]; - }, - { - name: "executeSpendingLimitChange"; - accounts: [ - { - name: "proposal"; - isMut: true; - isSigner: false; - }, - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "squadsProposal"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisig"; - isMut: false; - isSigner: false; - }, - { - name: "squadsMultisigProgram"; - isMut: false; - isSigner: false; - }, - { - name: "vaultTransaction"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "upgradeMultisigDao"; - accounts: [ - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisig"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigProgram"; - isMut: false; - isSigner: false; - }, - { - name: "rentPayer"; - isMut: true; - isSigner: true; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "kollan"; - isMut: false; - isSigner: true; - }, - ]; - args: []; - }, - { - name: "fixOmnipairSpendingLimit"; - accounts: [ - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisig"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigProgram"; - isMut: false; - isSigner: false; - }, - { - name: "rentPayer"; - isMut: true; - isSigner: true; - }, - { - name: "kollan"; - isMut: false; - isSigner: true; - }, - { - name: "omnipairSpendingLimit"; - isMut: true; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - ]; - accounts: [ - { - name: "dao"; - type: { - kind: "struct"; - fields: [ - { - name: "nonce"; - docs: ["`nonce` + `dao_creator` are PDA seeds"]; - type: "u64"; - }, - { - name: "daoCreator"; - type: "publicKey"; - }, - { - name: "pdaBump"; - type: "u8"; - }, - { - name: "squadsMultisig"; - type: "publicKey"; - }, - { - name: "squadsMultisigVault"; - type: "publicKey"; - }, - { - name: "baseMint"; - type: "publicKey"; - }, - { - name: "quoteMint"; - type: "publicKey"; - }, - { - name: "proposalCount"; - type: "u32"; - }, - { - name: "passThresholdBps"; - type: "u16"; - }, - { - name: "slotsPerProposal"; - type: "u64"; - }, - { - name: "twapInitialObservation"; - docs: [ - "For manipulation-resistance the TWAP is a time-weighted average observation,", - "where observation tries to approximate price but can only move by", - "`twap_max_observation_change_per_update` per update. Because it can only move", - "a little bit per update, you need to check that it has a good initial observation.", - "Otherwise, an attacker could create a very high initial observation in the pass", - "market and a very low one in the fail market to force the proposal to pass.", - "", - "We recommend setting an initial observation around the spot price of the token,", - "and max observation change per update around 2% the spot price of the token.", - "For example, if the spot price of META is $400, we'd recommend setting an initial", - "observation of 400 (converted into the AMM prices) and a max observation change per", - "update of 8 (also converted into the AMM prices). Observations can be updated once", - "a minute, so 2% allows the proposal market to reach double the spot price or 0", - "in 50 minutes.", - ]; - type: "u128"; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; - }, - { - name: "twapStartDelaySlots"; - docs: [ - "Forces TWAP calculation to start after amm.created_at_slot + twap_start_delay_slots", - ]; - type: "u64"; - }, - { - name: "minQuoteFutarchicLiquidity"; - docs: [ - "As an anti-spam measure and to help liquidity, you need to lock up some liquidity", - "in both futarchic markets in order to create a proposal.", - "", - "For example, for META, we can use a `min_quote_futarchic_liquidity` of", - "5000 * 1_000_000 (5000 USDC) and a `min_base_futarchic_liquidity` of", - "10 * 1_000_000_000 (10 META).", - ]; - type: "u64"; - }, - { - name: "minBaseFutarchicLiquidity"; - type: "u64"; - }, - { - name: "seqNum"; - type: "u64"; - }, - { - name: "initialSpendingLimit"; - type: { - option: { - defined: "InitialSpendingLimit"; - }; - }; - }, - ]; - }; - }, - { - name: "proposal"; - type: { - kind: "struct"; - fields: [ - { - name: "number"; - type: "u32"; - }, - { - name: "proposer"; - type: "publicKey"; - }, - { - name: "descriptionUrl"; - type: "string"; - }, - { - name: "slotEnqueued"; - type: "u64"; - }, - { - name: "state"; - type: { - defined: "ProposalState"; - }; - }, - { - name: "passAmm"; - type: "publicKey"; - }, - { - name: "failAmm"; - type: "publicKey"; - }, - { - name: "baseVault"; - type: "publicKey"; - }, - { - name: "quoteVault"; - type: "publicKey"; - }, - { - name: "dao"; - type: "publicKey"; - }, - { - name: "passLpTokensLocked"; - type: "u64"; - }, - { - name: "failLpTokensLocked"; - type: "u64"; - }, - { - name: "pdaBump"; - type: "u8"; - }, - { - name: "question"; - type: "publicKey"; - }, - { - name: "durationInSlots"; - type: "u64"; - }, - { - name: "squadsProposal"; - type: "publicKey"; - }, - ]; - }; - }, - ]; - types: [ - { - name: "CommonFields"; - type: { - kind: "struct"; - fields: [ - { - name: "slot"; - type: "u64"; - }, - { - name: "unixTimestamp"; - type: "i64"; - }, - ]; - }; - }, - { - name: "InitializeDaoParams"; - type: { - kind: "struct"; - fields: [ - { - name: "twapInitialObservation"; - type: "u128"; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; - }, - { - name: "twapStartDelaySlots"; - type: "u64"; - }, - { - name: "minQuoteFutarchicLiquidity"; - type: "u64"; - }, - { - name: "minBaseFutarchicLiquidity"; - type: "u64"; - }, - { - name: "passThresholdBps"; - type: "u16"; - }, - { - name: "slotsPerProposal"; - type: "u64"; - }, - { - name: "nonce"; - type: "u64"; - }, - { - name: "initialSpendingLimit"; - type: { - option: { - defined: "InitialSpendingLimit"; - }; - }; - }, - ]; - }; - }, - { - name: "InitializeProposalParams"; - type: { - kind: "struct"; - fields: [ - { - name: "descriptionUrl"; - type: "string"; - }, - { - name: "passLpTokensToLock"; - type: "u64"; - }, - { - name: "failLpTokensToLock"; - type: "u64"; - }, - ]; - }; - }, - { - name: "UpdateDaoParams"; - type: { - kind: "struct"; - fields: [ - { - name: "passThresholdBps"; - type: { - option: "u16"; - }; - }, - { - name: "slotsPerProposal"; - type: { - option: "u64"; - }; - }, - { - name: "twapInitialObservation"; - type: { - option: "u128"; - }; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: { - option: "u128"; - }; - }, - { - name: "minQuoteFutarchicLiquidity"; - type: { - option: "u64"; - }; - }, - { - name: "minBaseFutarchicLiquidity"; - type: { - option: "u64"; - }; - }, - ]; - }; - }, - { - name: "InitialSpendingLimit"; - type: { - kind: "struct"; - fields: [ - { - name: "amountPerMonth"; - type: "u64"; - }, - { - name: "members"; - type: { - vec: "publicKey"; - }; - }, - ]; - }; - }, - { - name: "ProposalState"; - type: { - kind: "enum"; - variants: [ - { - name: "Pending"; - }, - { - name: "Passed"; - }, - { - name: "Failed"; - }, - ]; - }; - }, - ]; - events: [ - { - name: "InitializeDaoEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "baseMint"; - type: "publicKey"; - index: false; - }, - { - name: "quoteMint"; - type: "publicKey"; - index: false; - }, - { - name: "passThresholdBps"; - type: "u16"; - index: false; - }, - { - name: "slotsPerProposal"; - type: "u64"; - index: false; - }, - { - name: "twapInitialObservation"; - type: "u128"; - index: false; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; - index: false; - }, - { - name: "minQuoteFutarchicLiquidity"; - type: "u64"; - index: false; - }, - { - name: "minBaseFutarchicLiquidity"; - type: "u64"; - index: false; - }, - { - name: "initialSpendingLimit"; - type: { - option: { - defined: "InitialSpendingLimit"; - }; - }; - index: false; - }, - { - name: "squadsMultisig"; - type: "publicKey"; - index: false; - }, - { - name: "squadsMultisigVault"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "UpdateDaoEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "passThresholdBps"; - type: "u16"; - index: false; - }, - { - name: "slotsPerProposal"; - type: "u64"; - index: false; - }, - { - name: "twapInitialObservation"; - type: "u128"; - index: false; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; - index: false; - }, - { - name: "minQuoteFutarchicLiquidity"; - type: "u64"; - index: false; - }, - { - name: "minBaseFutarchicLiquidity"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "InitializeProposalEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "proposal"; - type: "publicKey"; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "question"; - type: "publicKey"; - index: false; - }, - { - name: "quoteVault"; - type: "publicKey"; - index: false; - }, - { - name: "baseVault"; - type: "publicKey"; - index: false; - }, - { - name: "passAmm"; - type: "publicKey"; - index: false; - }, - { - name: "failAmm"; - type: "publicKey"; - index: false; - }, - { - name: "passLpMint"; - type: "publicKey"; - index: false; - }, - { - name: "failLpMint"; - type: "publicKey"; - index: false; - }, - { - name: "proposer"; - type: "publicKey"; - index: false; - }, - { - name: "number"; - type: "u32"; - index: false; - }, - { - name: "passLpTokensLocked"; - type: "u64"; - index: false; - }, - { - name: "failLpTokensLocked"; - type: "u64"; - index: false; - }, - { - name: "pdaBump"; - type: "u8"; - index: false; - }, - { - name: "durationInSlots"; - type: "u64"; - index: false; - }, - { - name: "squadsProposal"; - type: "publicKey"; - index: false; - }, - { - name: "squadsMultisig"; - type: "publicKey"; - index: false; - }, - { - name: "squadsMultisigVault"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "FinalizeProposalEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "proposal"; - type: "publicKey"; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "passMarketTwap"; - type: "u128"; - index: false; - }, - { - name: "failMarketTwap"; - type: "u128"; - index: false; - }, - { - name: "threshold"; - type: "u128"; - index: false; - }, - { - name: "state"; - type: { - defined: "ProposalState"; - }; - index: false; - }, - { - name: "squadsProposal"; - type: "publicKey"; - index: false; - }, - { - name: "squadsMultisig"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "ExecuteProposalEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "proposal"; - type: "publicKey"; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - ]; - }, - ]; - errors: [ - { - code: 6000; - name: "AmmTooOld"; - msg: "Amms must have been created within 5 minutes (counted in slots) of proposal initialization"; - }, - { - code: 6001; - name: "InvalidInitialObservation"; - msg: "An amm has an `initial_observation` that doesn't match the `dao`'s config"; - }, - { - code: 6002; - name: "InvalidMaxObservationChange"; - msg: "An amm has a `max_observation_change_per_update` that doesn't match the `dao`'s config"; - }, - { - code: 6003; - name: "InvalidStartDelaySlots"; - msg: "An amm has a `start_delay_slots` that doesn't match the `dao`'s config"; - }, - { - code: 6004; - name: "InvalidSettlementAuthority"; - msg: "One of the vaults has an invalid `settlement_authority`"; - }, - { - code: 6005; - name: "ProposalTooYoung"; - msg: "Proposal is too young to be executed or rejected"; - }, - { - code: 6006; - name: "MarketsTooYoung"; - msg: "Markets too young for proposal to be finalized. TWAP might need to be cranked"; - }, - { - code: 6007; - name: "ProposalAlreadyFinalized"; - msg: "This proposal has already been finalized"; - }, - { - code: 6008; - name: "InvalidVaultNonce"; - msg: "A conditional vault has an invalid nonce. A nonce should encode the proposal number"; - }, - { - code: 6009; - name: "ProposalNotPassed"; - msg: "This proposal can't be executed because it isn't in the passed state"; - }, - { - code: 6010; - name: "InsufficientLpTokenBalance"; - msg: "The proposer has fewer pass or fail LP tokens than they requested to lock"; - }, - { - code: 6011; - name: "InsufficientLpTokenLock"; - msg: "The LP tokens passed in have less liquidity than the DAO's `min_quote_futarchic_liquidity` or `min_base_futachic_liquidity`"; - }, - { - code: 6012; - name: "ProposalDurationTooShort"; - msg: "Proposal duration must be longer than TWAP start delay"; - }, - { - code: 6013; - name: "QuestionMustBeBinary"; - msg: "Question must have exactly 2 outcomes for binary futarchy"; - }, - { - code: 6014; - name: "InvalidSquadsProposalStatus"; - msg: "Squads proposal must be in Draft status"; - }, - { - code: 6015; - name: "InvalidTransaction"; - msg: "This Squads transaction should only contain calls to update spending limits"; - }, - ]; -}; - -export const IDL: Autocrat = { - version: "0.5.0", - name: "autocrat", - instructions: [ - { - name: "initializeDao", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "daoCreator", - isMut: false, - isSigner: true, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigVault", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgram", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgramConfig", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgramConfigTreasury", - isMut: true, - isSigner: false, - }, - { - name: "spendingLimit", - isMut: true, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "InitializeDaoParams", - }, - }, - ], - }, - { - name: "initializeProposal", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "squadsProposal", - isMut: false, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "question", - isMut: false, - isSigner: false, - }, - { - name: "quoteVault", - isMut: false, - isSigner: false, - }, - { - name: "baseVault", - isMut: false, - isSigner: false, - }, - { - name: "passAmm", - isMut: false, - isSigner: false, - }, - { - name: "passLpMint", - isMut: false, - isSigner: false, - }, - { - name: "failLpMint", - isMut: false, - isSigner: false, - }, - { - name: "failAmm", - isMut: false, - isSigner: false, - }, - { - name: "passLpUserAccount", - isMut: true, - isSigner: false, - }, - { - name: "failLpUserAccount", - isMut: true, - isSigner: false, - }, - { - name: "passLpVaultAccount", - isMut: true, - isSigner: false, - }, - { - name: "failLpVaultAccount", - isMut: true, - isSigner: false, - }, - { - name: "proposer", - isMut: false, - isSigner: true, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "InitializeProposalParams", - }, - }, - ], - }, - { - name: "finalizeProposal", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "squadsProposal", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigProgram", - isMut: false, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: false, - isSigner: false, - }, - { - name: "passAmm", - isMut: false, - isSigner: false, - }, - { - name: "failAmm", - isMut: false, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "question", - isMut: true, - isSigner: false, - }, - { - name: "passLpUserAccount", - isMut: true, - isSigner: false, - }, - { - name: "failLpUserAccount", - isMut: true, - isSigner: false, - }, - { - name: "passLpVaultAccount", - isMut: true, - isSigner: false, - }, - { - name: "failLpVaultAccount", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "vaultProgram", - isMut: false, - isSigner: false, - }, - { - name: "vaultEventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "updateDao", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigVault", - isMut: false, - isSigner: true, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "daoParams", - type: { - defined: "UpdateDaoParams", - }, - }, - ], - }, - { - name: "executeSpendingLimitChange", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "squadsProposal", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: false, - isSigner: false, - }, - { - name: "squadsMultisigProgram", - isMut: false, - isSigner: false, - }, - { - name: "vaultTransaction", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "upgradeMultisigDao", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigProgram", - isMut: false, - isSigner: false, - }, - { - name: "rentPayer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "kollan", - isMut: false, - isSigner: true, - }, - ], - args: [], - }, - { - name: "fixOmnipairSpendingLimit", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigProgram", - isMut: false, - isSigner: false, - }, - { - name: "rentPayer", - isMut: true, - isSigner: true, - }, - { - name: "kollan", - isMut: false, - isSigner: true, - }, - { - name: "omnipairSpendingLimit", - isMut: true, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "dao", - type: { - kind: "struct", - fields: [ - { - name: "nonce", - docs: ["`nonce` + `dao_creator` are PDA seeds"], - type: "u64", - }, - { - name: "daoCreator", - type: "publicKey", - }, - { - name: "pdaBump", - type: "u8", - }, - { - name: "squadsMultisig", - type: "publicKey", - }, - { - name: "squadsMultisigVault", - type: "publicKey", - }, - { - name: "baseMint", - type: "publicKey", - }, - { - name: "quoteMint", - type: "publicKey", - }, - { - name: "proposalCount", - type: "u32", - }, - { - name: "passThresholdBps", - type: "u16", - }, - { - name: "slotsPerProposal", - type: "u64", - }, - { - name: "twapInitialObservation", - docs: [ - "For manipulation-resistance the TWAP is a time-weighted average observation,", - "where observation tries to approximate price but can only move by", - "`twap_max_observation_change_per_update` per update. Because it can only move", - "a little bit per update, you need to check that it has a good initial observation.", - "Otherwise, an attacker could create a very high initial observation in the pass", - "market and a very low one in the fail market to force the proposal to pass.", - "", - "We recommend setting an initial observation around the spot price of the token,", - "and max observation change per update around 2% the spot price of the token.", - "For example, if the spot price of META is $400, we'd recommend setting an initial", - "observation of 400 (converted into the AMM prices) and a max observation change per", - "update of 8 (also converted into the AMM prices). Observations can be updated once", - "a minute, so 2% allows the proposal market to reach double the spot price or 0", - "in 50 minutes.", - ], - type: "u128", - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - }, - { - name: "twapStartDelaySlots", - docs: [ - "Forces TWAP calculation to start after amm.created_at_slot + twap_start_delay_slots", - ], - type: "u64", - }, - { - name: "minQuoteFutarchicLiquidity", - docs: [ - "As an anti-spam measure and to help liquidity, you need to lock up some liquidity", - "in both futarchic markets in order to create a proposal.", - "", - "For example, for META, we can use a `min_quote_futarchic_liquidity` of", - "5000 * 1_000_000 (5000 USDC) and a `min_base_futarchic_liquidity` of", - "10 * 1_000_000_000 (10 META).", - ], - type: "u64", - }, - { - name: "minBaseFutarchicLiquidity", - type: "u64", - }, - { - name: "seqNum", - type: "u64", - }, - { - name: "initialSpendingLimit", - type: { - option: { - defined: "InitialSpendingLimit", - }, - }, - }, - ], - }, - }, - { - name: "proposal", - type: { - kind: "struct", - fields: [ - { - name: "number", - type: "u32", - }, - { - name: "proposer", - type: "publicKey", - }, - { - name: "descriptionUrl", - type: "string", - }, - { - name: "slotEnqueued", - type: "u64", - }, - { - name: "state", - type: { - defined: "ProposalState", - }, - }, - { - name: "passAmm", - type: "publicKey", - }, - { - name: "failAmm", - type: "publicKey", - }, - { - name: "baseVault", - type: "publicKey", - }, - { - name: "quoteVault", - type: "publicKey", - }, - { - name: "dao", - type: "publicKey", - }, - { - name: "passLpTokensLocked", - type: "u64", - }, - { - name: "failLpTokensLocked", - type: "u64", - }, - { - name: "pdaBump", - type: "u8", - }, - { - name: "question", - type: "publicKey", - }, - { - name: "durationInSlots", - type: "u64", - }, - { - name: "squadsProposal", - type: "publicKey", - }, - ], - }, - }, - ], - types: [ - { - name: "CommonFields", - type: { - kind: "struct", - fields: [ - { - name: "slot", - type: "u64", - }, - { - name: "unixTimestamp", - type: "i64", - }, - ], - }, - }, - { - name: "InitializeDaoParams", - type: { - kind: "struct", - fields: [ - { - name: "twapInitialObservation", - type: "u128", - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - }, - { - name: "twapStartDelaySlots", - type: "u64", - }, - { - name: "minQuoteFutarchicLiquidity", - type: "u64", - }, - { - name: "minBaseFutarchicLiquidity", - type: "u64", - }, - { - name: "passThresholdBps", - type: "u16", - }, - { - name: "slotsPerProposal", - type: "u64", - }, - { - name: "nonce", - type: "u64", - }, - { - name: "initialSpendingLimit", - type: { - option: { - defined: "InitialSpendingLimit", - }, - }, - }, - ], - }, - }, - { - name: "InitializeProposalParams", - type: { - kind: "struct", - fields: [ - { - name: "descriptionUrl", - type: "string", - }, - { - name: "passLpTokensToLock", - type: "u64", - }, - { - name: "failLpTokensToLock", - type: "u64", - }, - ], - }, - }, - { - name: "UpdateDaoParams", - type: { - kind: "struct", - fields: [ - { - name: "passThresholdBps", - type: { - option: "u16", - }, - }, - { - name: "slotsPerProposal", - type: { - option: "u64", - }, - }, - { - name: "twapInitialObservation", - type: { - option: "u128", - }, - }, - { - name: "twapMaxObservationChangePerUpdate", - type: { - option: "u128", - }, - }, - { - name: "minQuoteFutarchicLiquidity", - type: { - option: "u64", - }, - }, - { - name: "minBaseFutarchicLiquidity", - type: { - option: "u64", - }, - }, - ], - }, - }, - { - name: "InitialSpendingLimit", - type: { - kind: "struct", - fields: [ - { - name: "amountPerMonth", - type: "u64", - }, - { - name: "members", - type: { - vec: "publicKey", - }, - }, - ], - }, - }, - { - name: "ProposalState", - type: { - kind: "enum", - variants: [ - { - name: "Pending", - }, - { - name: "Passed", - }, - { - name: "Failed", - }, - ], - }, - }, - ], - events: [ - { - name: "InitializeDaoEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "baseMint", - type: "publicKey", - index: false, - }, - { - name: "quoteMint", - type: "publicKey", - index: false, - }, - { - name: "passThresholdBps", - type: "u16", - index: false, - }, - { - name: "slotsPerProposal", - type: "u64", - index: false, - }, - { - name: "twapInitialObservation", - type: "u128", - index: false, - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - index: false, - }, - { - name: "minQuoteFutarchicLiquidity", - type: "u64", - index: false, - }, - { - name: "minBaseFutarchicLiquidity", - type: "u64", - index: false, - }, - { - name: "initialSpendingLimit", - type: { - option: { - defined: "InitialSpendingLimit", - }, - }, - index: false, - }, - { - name: "squadsMultisig", - type: "publicKey", - index: false, - }, - { - name: "squadsMultisigVault", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "UpdateDaoEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "passThresholdBps", - type: "u16", - index: false, - }, - { - name: "slotsPerProposal", - type: "u64", - index: false, - }, - { - name: "twapInitialObservation", - type: "u128", - index: false, - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - index: false, - }, - { - name: "minQuoteFutarchicLiquidity", - type: "u64", - index: false, - }, - { - name: "minBaseFutarchicLiquidity", - type: "u64", - index: false, - }, - ], - }, - { - name: "InitializeProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "proposal", - type: "publicKey", - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "question", - type: "publicKey", - index: false, - }, - { - name: "quoteVault", - type: "publicKey", - index: false, - }, - { - name: "baseVault", - type: "publicKey", - index: false, - }, - { - name: "passAmm", - type: "publicKey", - index: false, - }, - { - name: "failAmm", - type: "publicKey", - index: false, - }, - { - name: "passLpMint", - type: "publicKey", - index: false, - }, - { - name: "failLpMint", - type: "publicKey", - index: false, - }, - { - name: "proposer", - type: "publicKey", - index: false, - }, - { - name: "number", - type: "u32", - index: false, - }, - { - name: "passLpTokensLocked", - type: "u64", - index: false, - }, - { - name: "failLpTokensLocked", - type: "u64", - index: false, - }, - { - name: "pdaBump", - type: "u8", - index: false, - }, - { - name: "durationInSlots", - type: "u64", - index: false, - }, - { - name: "squadsProposal", - type: "publicKey", - index: false, - }, - { - name: "squadsMultisig", - type: "publicKey", - index: false, - }, - { - name: "squadsMultisigVault", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "FinalizeProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "proposal", - type: "publicKey", - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "passMarketTwap", - type: "u128", - index: false, - }, - { - name: "failMarketTwap", - type: "u128", - index: false, - }, - { - name: "threshold", - type: "u128", - index: false, - }, - { - name: "state", - type: { - defined: "ProposalState", - }, - index: false, - }, - { - name: "squadsProposal", - type: "publicKey", - index: false, - }, - { - name: "squadsMultisig", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "ExecuteProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "proposal", - type: "publicKey", - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - ], - }, - ], - errors: [ - { - code: 6000, - name: "AmmTooOld", - msg: "Amms must have been created within 5 minutes (counted in slots) of proposal initialization", - }, - { - code: 6001, - name: "InvalidInitialObservation", - msg: "An amm has an `initial_observation` that doesn't match the `dao`'s config", - }, - { - code: 6002, - name: "InvalidMaxObservationChange", - msg: "An amm has a `max_observation_change_per_update` that doesn't match the `dao`'s config", - }, - { - code: 6003, - name: "InvalidStartDelaySlots", - msg: "An amm has a `start_delay_slots` that doesn't match the `dao`'s config", - }, - { - code: 6004, - name: "InvalidSettlementAuthority", - msg: "One of the vaults has an invalid `settlement_authority`", - }, - { - code: 6005, - name: "ProposalTooYoung", - msg: "Proposal is too young to be executed or rejected", - }, - { - code: 6006, - name: "MarketsTooYoung", - msg: "Markets too young for proposal to be finalized. TWAP might need to be cranked", - }, - { - code: 6007, - name: "ProposalAlreadyFinalized", - msg: "This proposal has already been finalized", - }, - { - code: 6008, - name: "InvalidVaultNonce", - msg: "A conditional vault has an invalid nonce. A nonce should encode the proposal number", - }, - { - code: 6009, - name: "ProposalNotPassed", - msg: "This proposal can't be executed because it isn't in the passed state", - }, - { - code: 6010, - name: "InsufficientLpTokenBalance", - msg: "The proposer has fewer pass or fail LP tokens than they requested to lock", - }, - { - code: 6011, - name: "InsufficientLpTokenLock", - msg: "The LP tokens passed in have less liquidity than the DAO's `min_quote_futarchic_liquidity` or `min_base_futachic_liquidity`", - }, - { - code: 6012, - name: "ProposalDurationTooShort", - msg: "Proposal duration must be longer than TWAP start delay", - }, - { - code: 6013, - name: "QuestionMustBeBinary", - msg: "Question must have exactly 2 outcomes for binary futarchy", - }, - { - code: 6014, - name: "InvalidSquadsProposalStatus", - msg: "Squads proposal must be in Draft status", - }, - { - code: 6015, - name: "InvalidTransaction", - msg: "This Squads transaction should only contain calls to update spending limits", - }, - ], -}; diff --git a/sdk/src/v0.6/types/autocrat_migrator.ts b/sdk/src/v0.6/types/autocrat_migrator.ts deleted file mode 100644 index 676d2df3d..000000000 --- a/sdk/src/v0.6/types/autocrat_migrator.ts +++ /dev/null @@ -1,237 +0,0 @@ -export type AutocratMigrator = { - version: "0.1.0"; - name: "autocrat_migrator"; - instructions: [ - { - name: "multiTransfer2"; - accounts: [ - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "authority"; - isMut: true; - isSigner: true; - }, - { - name: "from0"; - isMut: true; - isSigner: false; - }, - { - name: "to0"; - isMut: true; - isSigner: false; - }, - { - name: "from1"; - isMut: true; - isSigner: false; - }, - { - name: "to1"; - isMut: true; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "lamportReceiver"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "multiTransfer4"; - accounts: [ - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "authority"; - isMut: true; - isSigner: true; - }, - { - name: "from0"; - isMut: true; - isSigner: false; - }, - { - name: "to0"; - isMut: true; - isSigner: false; - }, - { - name: "from1"; - isMut: true; - isSigner: false; - }, - { - name: "to1"; - isMut: true; - isSigner: false; - }, - { - name: "from2"; - isMut: true; - isSigner: false; - }, - { - name: "to2"; - isMut: true; - isSigner: false; - }, - { - name: "from3"; - isMut: true; - isSigner: false; - }, - { - name: "to3"; - isMut: true; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "lamportReceiver"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - ]; -}; - -export const IDL: AutocratMigrator = { - version: "0.1.0", - name: "autocrat_migrator", - instructions: [ - { - name: "multiTransfer2", - accounts: [ - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "authority", - isMut: true, - isSigner: true, - }, - { - name: "from0", - isMut: true, - isSigner: false, - }, - { - name: "to0", - isMut: true, - isSigner: false, - }, - { - name: "from1", - isMut: true, - isSigner: false, - }, - { - name: "to1", - isMut: true, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "lamportReceiver", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - { - name: "multiTransfer4", - accounts: [ - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "authority", - isMut: true, - isSigner: true, - }, - { - name: "from0", - isMut: true, - isSigner: false, - }, - { - name: "to0", - isMut: true, - isSigner: false, - }, - { - name: "from1", - isMut: true, - isSigner: false, - }, - { - name: "to1", - isMut: true, - isSigner: false, - }, - { - name: "from2", - isMut: true, - isSigner: false, - }, - { - name: "to2", - isMut: true, - isSigner: false, - }, - { - name: "from3", - isMut: true, - isSigner: false, - }, - { - name: "to3", - isMut: true, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "lamportReceiver", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - ], -}; diff --git a/sdk/src/v0.6/types/bid_wall.ts b/sdk/src/v0.6/types/bid_wall.ts deleted file mode 100644 index cbe5015de..000000000 --- a/sdk/src/v0.6/types/bid_wall.ts +++ /dev/null @@ -1,1033 +0,0 @@ -export type BidWall = { - version: "0.6.0"; - name: "bid_wall"; - instructions: [ - { - name: "initializeBidWall"; - accounts: [ - { - name: "bidWall"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "feeRecipient"; - isMut: false; - isSigner: false; - }, - { - name: "creator"; - isMut: false; - isSigner: true; - }, - { - name: "authority"; - isMut: false; - isSigner: false; - }, - { - name: "bidWallQuoteTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "creatorQuoteTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "daoTreasury"; - isMut: false; - isSigner: false; - }, - { - name: "baseMint"; - isMut: false; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "InitializeBidWallArgs"; - }; - }, - ]; - }, - { - name: "closeBidWall"; - accounts: [ - { - name: "bidWall"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "authority"; - isMut: false; - isSigner: false; - }, - { - name: "feeRecipient"; - isMut: false; - isSigner: false; - }, - { - name: "bidWallQuoteTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "authorityQuoteTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "feeRecipientQuoteTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "baseMint"; - isMut: false; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "sellTokens"; - accounts: [ - { - name: "bidWall"; - isMut: true; - isSigner: false; - }, - { - name: "user"; - isMut: true; - isSigner: true; - }, - { - name: "userTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userQuoteTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "bidWallQuoteTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "daoTreasury"; - isMut: false; - isSigner: false; - }, - { - name: "daoTreasuryQuoteTokenAccount"; - isMut: false; - isSigner: false; - }, - { - name: "baseMint"; - isMut: true; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "SellTokensArgs"; - }; - }, - ]; - }, - { - name: "collectFees"; - accounts: [ - { - name: "bidWall"; - isMut: true; - isSigner: false; - }, - { - name: "bidWallQuoteTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "feeRecipient"; - isMut: false; - isSigner: false; - }, - { - name: "feeRecipientQuoteTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "cancelBidWall"; - accounts: [ - { - name: "bidWall"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "authority"; - isMut: false; - isSigner: true; - }, - { - name: "feeRecipient"; - isMut: false; - isSigner: false; - }, - { - name: "bidWallQuoteTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "authorityQuoteTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "feeRecipientQuoteTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "baseMint"; - isMut: false; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - ]; - accounts: [ - { - name: "bidWall"; - type: { - kind: "struct"; - fields: [ - { - name: "nonce"; - docs: ["The nonce of the bid wall."]; - type: "u64"; - }, - { - name: "createdTimestamp"; - docs: ["When the bid wall was created."]; - type: "i64"; - }, - { - name: "feesCollected"; - docs: ["The fees collected by the bid wall."]; - type: "u64"; - }, - { - name: "initialAmmBaseReserves"; - docs: ["The initial base reserves of the Futarchy AMM."]; - type: "u64"; - }, - { - name: "initialAmmQuoteReserves"; - docs: ["The initial quote (USDC) reserves of the Futarchy AMM."]; - type: "u64"; - }, - { - name: "initialDaoTreasuryQuoteAmount"; - docs: ["The initial amount of quote tokens in the DAO treasury."]; - type: "u64"; - }, - { - name: "initialNav"; - docs: [ - "The total raise amount of the launch this bid wall is associated with.", - ]; - type: "u64"; - }, - { - name: "creator"; - docs: ["The authority of the bid wall."]; - type: "publicKey"; - }, - { - name: "authority"; - docs: ["The authority of the bid wall."]; - type: "publicKey"; - }, - { - name: "daoTreasury"; - docs: ["The DAO treasury address."]; - type: "publicKey"; - }, - { - name: "baseMint"; - docs: ["The mint of the token being sold into the bid wall."]; - type: "publicKey"; - }, - { - name: "feeRecipient"; - docs: ["The recipient of the fees collected by the bid wall."]; - type: "publicKey"; - }, - { - name: "durationSeconds"; - docs: [ - "The minimum duration in seconds before the bid wall can be closed.", - ]; - type: "u32"; - }, - { - name: "pdaBump"; - docs: ["The PDA bump."]; - type: "u8"; - }, - ]; - }; - }, - ]; - types: [ - { - name: "InitializeBidWallArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "amount"; - type: "u64"; - }, - { - name: "nonce"; - type: "u64"; - }, - { - name: "initialAmmBaseReserves"; - type: "u64"; - }, - { - name: "initialAmmQuoteReserves"; - type: "u64"; - }, - { - name: "initialNav"; - type: "u64"; - }, - { - name: "initialDaoTreasuryQuoteAmount"; - type: "u64"; - }, - { - name: "durationSeconds"; - type: "u32"; - }, - ]; - }; - }, - { - name: "SellTokensArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "amountIn"; - type: "u64"; - }, - ]; - }; - }, - ]; - errors: [ - { - code: 6000; - name: "BidWallExpired"; - msg: "Bid wall expired"; - }, - { - code: 6001; - name: "BidWallNotExpired"; - msg: "Bid wall not expired"; - }, - { - code: 6002; - name: "FeeRecipientMismatch"; - msg: "Fee recipient mismatch"; - }, - ]; -}; - -export const IDL: BidWall = { - version: "0.6.0", - name: "bid_wall", - instructions: [ - { - name: "initializeBidWall", - accounts: [ - { - name: "bidWall", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "feeRecipient", - isMut: false, - isSigner: false, - }, - { - name: "creator", - isMut: false, - isSigner: true, - }, - { - name: "authority", - isMut: false, - isSigner: false, - }, - { - name: "bidWallQuoteTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "creatorQuoteTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "daoTreasury", - isMut: false, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "InitializeBidWallArgs", - }, - }, - ], - }, - { - name: "closeBidWall", - accounts: [ - { - name: "bidWall", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "authority", - isMut: false, - isSigner: false, - }, - { - name: "feeRecipient", - isMut: false, - isSigner: false, - }, - { - name: "bidWallQuoteTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "authorityQuoteTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "feeRecipientQuoteTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "sellTokens", - accounts: [ - { - name: "bidWall", - isMut: true, - isSigner: false, - }, - { - name: "user", - isMut: true, - isSigner: true, - }, - { - name: "userTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "userQuoteTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "bidWallQuoteTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "daoTreasury", - isMut: false, - isSigner: false, - }, - { - name: "daoTreasuryQuoteTokenAccount", - isMut: false, - isSigner: false, - }, - { - name: "baseMint", - isMut: true, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "SellTokensArgs", - }, - }, - ], - }, - { - name: "collectFees", - accounts: [ - { - name: "bidWall", - isMut: true, - isSigner: false, - }, - { - name: "bidWallQuoteTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "feeRecipient", - isMut: false, - isSigner: false, - }, - { - name: "feeRecipientQuoteTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "cancelBidWall", - accounts: [ - { - name: "bidWall", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "feeRecipient", - isMut: false, - isSigner: false, - }, - { - name: "bidWallQuoteTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "authorityQuoteTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "feeRecipientQuoteTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "bidWall", - type: { - kind: "struct", - fields: [ - { - name: "nonce", - docs: ["The nonce of the bid wall."], - type: "u64", - }, - { - name: "createdTimestamp", - docs: ["When the bid wall was created."], - type: "i64", - }, - { - name: "feesCollected", - docs: ["The fees collected by the bid wall."], - type: "u64", - }, - { - name: "initialAmmBaseReserves", - docs: ["The initial base reserves of the Futarchy AMM."], - type: "u64", - }, - { - name: "initialAmmQuoteReserves", - docs: ["The initial quote (USDC) reserves of the Futarchy AMM."], - type: "u64", - }, - { - name: "initialDaoTreasuryQuoteAmount", - docs: ["The initial amount of quote tokens in the DAO treasury."], - type: "u64", - }, - { - name: "initialNav", - docs: [ - "The total raise amount of the launch this bid wall is associated with.", - ], - type: "u64", - }, - { - name: "creator", - docs: ["The authority of the bid wall."], - type: "publicKey", - }, - { - name: "authority", - docs: ["The authority of the bid wall."], - type: "publicKey", - }, - { - name: "daoTreasury", - docs: ["The DAO treasury address."], - type: "publicKey", - }, - { - name: "baseMint", - docs: ["The mint of the token being sold into the bid wall."], - type: "publicKey", - }, - { - name: "feeRecipient", - docs: ["The recipient of the fees collected by the bid wall."], - type: "publicKey", - }, - { - name: "durationSeconds", - docs: [ - "The minimum duration in seconds before the bid wall can be closed.", - ], - type: "u32", - }, - { - name: "pdaBump", - docs: ["The PDA bump."], - type: "u8", - }, - ], - }, - }, - ], - types: [ - { - name: "InitializeBidWallArgs", - type: { - kind: "struct", - fields: [ - { - name: "amount", - type: "u64", - }, - { - name: "nonce", - type: "u64", - }, - { - name: "initialAmmBaseReserves", - type: "u64", - }, - { - name: "initialAmmQuoteReserves", - type: "u64", - }, - { - name: "initialNav", - type: "u64", - }, - { - name: "initialDaoTreasuryQuoteAmount", - type: "u64", - }, - { - name: "durationSeconds", - type: "u32", - }, - ], - }, - }, - { - name: "SellTokensArgs", - type: { - kind: "struct", - fields: [ - { - name: "amountIn", - type: "u64", - }, - ], - }, - }, - ], - errors: [ - { - code: 6000, - name: "BidWallExpired", - msg: "Bid wall expired", - }, - { - code: 6001, - name: "BidWallNotExpired", - msg: "Bid wall not expired", - }, - { - code: 6002, - name: "FeeRecipientMismatch", - msg: "Fee recipient mismatch", - }, - ], -}; diff --git a/sdk/src/v0.6/types/conditional_vault.ts b/sdk/src/v0.6/types/conditional_vault.ts deleted file mode 100644 index 27c245b79..000000000 --- a/sdk/src/v0.6/types/conditional_vault.ts +++ /dev/null @@ -1,1849 +0,0 @@ -export type ConditionalVault = { - version: "0.4.0"; - name: "conditional_vault"; - instructions: [ - { - name: "initializeQuestion"; - accounts: [ - { - name: "question"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "InitializeQuestionArgs"; - }; - }, - ]; - }, - { - name: "resolveQuestion"; - accounts: [ - { - name: "question"; - isMut: true; - isSigner: false; - }, - { - name: "oracle"; - isMut: false; - isSigner: true; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "ResolveQuestionArgs"; - }; - }, - ]; - }, - { - name: "initializeConditionalVault"; - accounts: [ - { - name: "vault"; - isMut: true; - isSigner: false; - }, - { - name: "question"; - isMut: false; - isSigner: false; - }, - { - name: "underlyingTokenMint"; - isMut: false; - isSigner: false; - }, - { - name: "vaultUnderlyingTokenAccount"; - isMut: false; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "splitTokens"; - accounts: [ - { - name: "question"; - isMut: false; - isSigner: false; - }, - { - name: "vault"; - isMut: true; - isSigner: false; - }, - { - name: "vaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "authority"; - isMut: false; - isSigner: true; - }, - { - name: "userUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "amount"; - type: "u64"; - }, - ]; - }, - { - name: "mergeTokens"; - accounts: [ - { - name: "question"; - isMut: false; - isSigner: false; - }, - { - name: "vault"; - isMut: true; - isSigner: false; - }, - { - name: "vaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "authority"; - isMut: false; - isSigner: true; - }, - { - name: "userUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "amount"; - type: "u64"; - }, - ]; - }, - { - name: "redeemTokens"; - accounts: [ - { - name: "question"; - isMut: false; - isSigner: false; - }, - { - name: "vault"; - isMut: true; - isSigner: false; - }, - { - name: "vaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "authority"; - isMut: false; - isSigner: true; - }, - { - name: "userUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "addMetadataToConditionalTokens"; - accounts: [ - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "vault"; - isMut: true; - isSigner: false; - }, - { - name: "conditionalTokenMint"; - isMut: true; - isSigner: false; - }, - { - name: "conditionalTokenMetadata"; - isMut: true; - isSigner: false; - }, - { - name: "tokenMetadataProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "rent"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "AddMetadataToConditionalTokensArgs"; - }; - }, - ]; - }, - ]; - accounts: [ - { - name: "conditionalVault"; - type: { - kind: "struct"; - fields: [ - { - name: "question"; - type: "publicKey"; - }, - { - name: "underlyingTokenMint"; - type: "publicKey"; - }, - { - name: "underlyingTokenAccount"; - type: "publicKey"; - }, - { - name: "conditionalTokenMints"; - type: { - vec: "publicKey"; - }; - }, - { - name: "pdaBump"; - type: "u8"; - }, - { - name: "decimals"; - type: "u8"; - }, - { - name: "seqNum"; - type: "u64"; - }, - ]; - }; - }, - { - name: "question"; - docs: [ - "Questions represent statements about future events.", - "", - "These statements include:", - '- "Will this proposal pass?"', - '- "Who, if anyone, will be hired?"', - '- "How effective will the grant committee deem this grant?"', - "", - 'Questions have 2 or more possible outcomes. For a question like "will this', - 'proposal pass," the outcomes are "yes" and "no." For a question like "who', - 'will be hired," the outcomes could be "Alice," "Bob," and "neither."', - "", - 'Outcomes resolve to a number between 0 and 1. Binary questions like "will', - 'this proposal pass" have outcomes that resolve to exactly 0 or 1. You can', - 'also have questions with scalar outcomes. For example, the question "how', - 'effective will the grant committee deem this grant" could have two outcomes:', - '"ineffective" and "effective." If the grant committee deems the grant 70%', - 'effective, the "effective" outcome would resolve to 0.7 and the "ineffective"', - "outcome would resolve to 0.3.", - "", - "Once resolved, the sum of all outcome resolutions is exactly 1.", - ]; - type: { - kind: "struct"; - fields: [ - { - name: "questionId"; - type: { - array: ["u8", 32]; - }; - }, - { - name: "oracle"; - type: "publicKey"; - }, - { - name: "payoutNumerators"; - type: { - vec: "u32"; - }; - }, - { - name: "payoutDenominator"; - type: "u32"; - }, - ]; - }; - }, - ]; - types: [ - { - name: "CommonFields"; - type: { - kind: "struct"; - fields: [ - { - name: "slot"; - type: "u64"; - }, - { - name: "unixTimestamp"; - type: "i64"; - }, - ]; - }; - }, - { - name: "AddMetadataToConditionalTokensArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "name"; - type: "string"; - }, - { - name: "symbol"; - type: "string"; - }, - { - name: "uri"; - type: "string"; - }, - ]; - }; - }, - { - name: "InitializeQuestionArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "questionId"; - type: { - array: ["u8", 32]; - }; - }, - { - name: "oracle"; - type: "publicKey"; - }, - { - name: "numOutcomes"; - type: "u8"; - }, - ]; - }; - }, - { - name: "ResolveQuestionArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "payoutNumerators"; - type: { - vec: "u32"; - }; - }, - ]; - }; - }, - { - name: "VaultStatus"; - type: { - kind: "enum"; - variants: [ - { - name: "Active"; - }, - { - name: "Finalized"; - }, - { - name: "Reverted"; - }, - ]; - }; - }, - ]; - events: [ - { - name: "AddMetadataToConditionalTokensEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "vault"; - type: "publicKey"; - index: false; - }, - { - name: "conditionalTokenMint"; - type: "publicKey"; - index: false; - }, - { - name: "conditionalTokenMetadata"; - type: "publicKey"; - index: false; - }, - { - name: "name"; - type: "string"; - index: false; - }, - { - name: "symbol"; - type: "string"; - index: false; - }, - { - name: "uri"; - type: "string"; - index: false; - }, - { - name: "seqNum"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "InitializeConditionalVaultEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "vault"; - type: "publicKey"; - index: false; - }, - { - name: "question"; - type: "publicKey"; - index: false; - }, - { - name: "underlyingTokenMint"; - type: "publicKey"; - index: false; - }, - { - name: "vaultUnderlyingTokenAccount"; - type: "publicKey"; - index: false; - }, - { - name: "conditionalTokenMints"; - type: { - vec: "publicKey"; - }; - index: false; - }, - { - name: "pdaBump"; - type: "u8"; - index: false; - }, - { - name: "seqNum"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "InitializeQuestionEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "questionId"; - type: { - array: ["u8", 32]; - }; - index: false; - }, - { - name: "oracle"; - type: "publicKey"; - index: false; - }, - { - name: "numOutcomes"; - type: "u8"; - index: false; - }, - { - name: "question"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "MergeTokensEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "user"; - type: "publicKey"; - index: false; - }, - { - name: "vault"; - type: "publicKey"; - index: false; - }, - { - name: "amount"; - type: "u64"; - index: false; - }, - { - name: "postUserUnderlyingBalance"; - type: "u64"; - index: false; - }, - { - name: "postVaultUnderlyingBalance"; - type: "u64"; - index: false; - }, - { - name: "postUserConditionalTokenBalances"; - type: { - vec: "u64"; - }; - index: false; - }, - { - name: "postConditionalTokenSupplies"; - type: { - vec: "u64"; - }; - index: false; - }, - { - name: "seqNum"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "RedeemTokensEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "user"; - type: "publicKey"; - index: false; - }, - { - name: "vault"; - type: "publicKey"; - index: false; - }, - { - name: "amount"; - type: "u64"; - index: false; - }, - { - name: "postUserUnderlyingBalance"; - type: "u64"; - index: false; - }, - { - name: "postVaultUnderlyingBalance"; - type: "u64"; - index: false; - }, - { - name: "postConditionalTokenSupplies"; - type: { - vec: "u64"; - }; - index: false; - }, - { - name: "seqNum"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "ResolveQuestionEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "question"; - type: "publicKey"; - index: false; - }, - { - name: "payoutNumerators"; - type: { - vec: "u32"; - }; - index: false; - }, - ]; - }, - { - name: "SplitTokensEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "user"; - type: "publicKey"; - index: false; - }, - { - name: "vault"; - type: "publicKey"; - index: false; - }, - { - name: "amount"; - type: "u64"; - index: false; - }, - { - name: "postUserUnderlyingBalance"; - type: "u64"; - index: false; - }, - { - name: "postVaultUnderlyingBalance"; - type: "u64"; - index: false; - }, - { - name: "postUserConditionalTokenBalances"; - type: { - vec: "u64"; - }; - index: false; - }, - { - name: "postConditionalTokenSupplies"; - type: { - vec: "u64"; - }; - index: false; - }, - { - name: "seqNum"; - type: "u64"; - index: false; - }, - ]; - }, - ]; - errors: [ - { - code: 6000; - name: "AssertFailed"; - msg: "An assertion failed"; - }, - { - code: 6001; - name: "InsufficientUnderlyingTokens"; - msg: "Insufficient underlying token balance to mint this amount of conditional tokens"; - }, - { - code: 6002; - name: "InsufficientConditionalTokens"; - msg: "Insufficient conditional token balance to merge this `amount`"; - }, - { - code: 6003; - name: "InvalidVaultUnderlyingTokenAccount"; - msg: "This `vault_underlying_token_account` is not this vault's `underlying_token_account`"; - }, - { - code: 6004; - name: "InvalidConditionalTokenMint"; - msg: "This conditional token mint is not this vault's conditional token mint"; - }, - { - code: 6005; - name: "CantRedeemConditionalTokens"; - msg: "Question needs to be resolved before users can redeem conditional tokens for underlying tokens"; - }, - { - code: 6006; - name: "InsufficientNumConditions"; - msg: "Questions need 2 or more conditions"; - }, - { - code: 6007; - name: "InvalidNumPayoutNumerators"; - msg: "Invalid number of payout numerators"; - }, - { - code: 6008; - name: "InvalidConditionals"; - msg: "Client needs to pass in the list of conditional mints for a vault followed by the user's token accounts for those tokens"; - }, - { - code: 6009; - name: "ConditionalMintMismatch"; - msg: "Conditional mint not in vault"; - }, - { - code: 6010; - name: "BadConditionalMint"; - msg: "Unable to deserialize a conditional token mint"; - }, - { - code: 6011; - name: "BadConditionalTokenAccount"; - msg: "Unable to deserialize a conditional token account"; - }, - { - code: 6012; - name: "ConditionalTokenMintMismatch"; - msg: "User conditional token account mint does not match conditional mint"; - }, - { - code: 6013; - name: "PayoutZero"; - msg: "Payouts must sum to 1 or more"; - }, - { - code: 6014; - name: "QuestionAlreadyResolved"; - msg: "Question already resolved"; - }, - { - code: 6015; - name: "ConditionalTokenMetadataAlreadySet"; - msg: "Conditional token metadata already set"; - }, - { - code: 6016; - name: "UnauthorizedConditionalTokenAccount"; - msg: "Conditional token account is not owned by the authority"; - }, - ]; -}; - -export const IDL: ConditionalVault = { - version: "0.4.0", - name: "conditional_vault", - instructions: [ - { - name: "initializeQuestion", - accounts: [ - { - name: "question", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "InitializeQuestionArgs", - }, - }, - ], - }, - { - name: "resolveQuestion", - accounts: [ - { - name: "question", - isMut: true, - isSigner: false, - }, - { - name: "oracle", - isMut: false, - isSigner: true, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "ResolveQuestionArgs", - }, - }, - ], - }, - { - name: "initializeConditionalVault", - accounts: [ - { - name: "vault", - isMut: true, - isSigner: false, - }, - { - name: "question", - isMut: false, - isSigner: false, - }, - { - name: "underlyingTokenMint", - isMut: false, - isSigner: false, - }, - { - name: "vaultUnderlyingTokenAccount", - isMut: false, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "splitTokens", - accounts: [ - { - name: "question", - isMut: false, - isSigner: false, - }, - { - name: "vault", - isMut: true, - isSigner: false, - }, - { - name: "vaultUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "userUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "amount", - type: "u64", - }, - ], - }, - { - name: "mergeTokens", - accounts: [ - { - name: "question", - isMut: false, - isSigner: false, - }, - { - name: "vault", - isMut: true, - isSigner: false, - }, - { - name: "vaultUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "userUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "amount", - type: "u64", - }, - ], - }, - { - name: "redeemTokens", - accounts: [ - { - name: "question", - isMut: false, - isSigner: false, - }, - { - name: "vault", - isMut: true, - isSigner: false, - }, - { - name: "vaultUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "userUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "addMetadataToConditionalTokens", - accounts: [ - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "vault", - isMut: true, - isSigner: false, - }, - { - name: "conditionalTokenMint", - isMut: true, - isSigner: false, - }, - { - name: "conditionalTokenMetadata", - isMut: true, - isSigner: false, - }, - { - name: "tokenMetadataProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "rent", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "AddMetadataToConditionalTokensArgs", - }, - }, - ], - }, - ], - accounts: [ - { - name: "conditionalVault", - type: { - kind: "struct", - fields: [ - { - name: "question", - type: "publicKey", - }, - { - name: "underlyingTokenMint", - type: "publicKey", - }, - { - name: "underlyingTokenAccount", - type: "publicKey", - }, - { - name: "conditionalTokenMints", - type: { - vec: "publicKey", - }, - }, - { - name: "pdaBump", - type: "u8", - }, - { - name: "decimals", - type: "u8", - }, - { - name: "seqNum", - type: "u64", - }, - ], - }, - }, - { - name: "question", - docs: [ - "Questions represent statements about future events.", - "", - "These statements include:", - '- "Will this proposal pass?"', - '- "Who, if anyone, will be hired?"', - '- "How effective will the grant committee deem this grant?"', - "", - 'Questions have 2 or more possible outcomes. For a question like "will this', - 'proposal pass," the outcomes are "yes" and "no." For a question like "who', - 'will be hired," the outcomes could be "Alice," "Bob," and "neither."', - "", - 'Outcomes resolve to a number between 0 and 1. Binary questions like "will', - 'this proposal pass" have outcomes that resolve to exactly 0 or 1. You can', - 'also have questions with scalar outcomes. For example, the question "how', - 'effective will the grant committee deem this grant" could have two outcomes:', - '"ineffective" and "effective." If the grant committee deems the grant 70%', - 'effective, the "effective" outcome would resolve to 0.7 and the "ineffective"', - "outcome would resolve to 0.3.", - "", - "Once resolved, the sum of all outcome resolutions is exactly 1.", - ], - type: { - kind: "struct", - fields: [ - { - name: "questionId", - type: { - array: ["u8", 32], - }, - }, - { - name: "oracle", - type: "publicKey", - }, - { - name: "payoutNumerators", - type: { - vec: "u32", - }, - }, - { - name: "payoutDenominator", - type: "u32", - }, - ], - }, - }, - ], - types: [ - { - name: "CommonFields", - type: { - kind: "struct", - fields: [ - { - name: "slot", - type: "u64", - }, - { - name: "unixTimestamp", - type: "i64", - }, - ], - }, - }, - { - name: "AddMetadataToConditionalTokensArgs", - type: { - kind: "struct", - fields: [ - { - name: "name", - type: "string", - }, - { - name: "symbol", - type: "string", - }, - { - name: "uri", - type: "string", - }, - ], - }, - }, - { - name: "InitializeQuestionArgs", - type: { - kind: "struct", - fields: [ - { - name: "questionId", - type: { - array: ["u8", 32], - }, - }, - { - name: "oracle", - type: "publicKey", - }, - { - name: "numOutcomes", - type: "u8", - }, - ], - }, - }, - { - name: "ResolveQuestionArgs", - type: { - kind: "struct", - fields: [ - { - name: "payoutNumerators", - type: { - vec: "u32", - }, - }, - ], - }, - }, - { - name: "VaultStatus", - type: { - kind: "enum", - variants: [ - { - name: "Active", - }, - { - name: "Finalized", - }, - { - name: "Reverted", - }, - ], - }, - }, - ], - events: [ - { - name: "AddMetadataToConditionalTokensEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "vault", - type: "publicKey", - index: false, - }, - { - name: "conditionalTokenMint", - type: "publicKey", - index: false, - }, - { - name: "conditionalTokenMetadata", - type: "publicKey", - index: false, - }, - { - name: "name", - type: "string", - index: false, - }, - { - name: "symbol", - type: "string", - index: false, - }, - { - name: "uri", - type: "string", - index: false, - }, - { - name: "seqNum", - type: "u64", - index: false, - }, - ], - }, - { - name: "InitializeConditionalVaultEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "vault", - type: "publicKey", - index: false, - }, - { - name: "question", - type: "publicKey", - index: false, - }, - { - name: "underlyingTokenMint", - type: "publicKey", - index: false, - }, - { - name: "vaultUnderlyingTokenAccount", - type: "publicKey", - index: false, - }, - { - name: "conditionalTokenMints", - type: { - vec: "publicKey", - }, - index: false, - }, - { - name: "pdaBump", - type: "u8", - index: false, - }, - { - name: "seqNum", - type: "u64", - index: false, - }, - ], - }, - { - name: "InitializeQuestionEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "questionId", - type: { - array: ["u8", 32], - }, - index: false, - }, - { - name: "oracle", - type: "publicKey", - index: false, - }, - { - name: "numOutcomes", - type: "u8", - index: false, - }, - { - name: "question", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "MergeTokensEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "user", - type: "publicKey", - index: false, - }, - { - name: "vault", - type: "publicKey", - index: false, - }, - { - name: "amount", - type: "u64", - index: false, - }, - { - name: "postUserUnderlyingBalance", - type: "u64", - index: false, - }, - { - name: "postVaultUnderlyingBalance", - type: "u64", - index: false, - }, - { - name: "postUserConditionalTokenBalances", - type: { - vec: "u64", - }, - index: false, - }, - { - name: "postConditionalTokenSupplies", - type: { - vec: "u64", - }, - index: false, - }, - { - name: "seqNum", - type: "u64", - index: false, - }, - ], - }, - { - name: "RedeemTokensEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "user", - type: "publicKey", - index: false, - }, - { - name: "vault", - type: "publicKey", - index: false, - }, - { - name: "amount", - type: "u64", - index: false, - }, - { - name: "postUserUnderlyingBalance", - type: "u64", - index: false, - }, - { - name: "postVaultUnderlyingBalance", - type: "u64", - index: false, - }, - { - name: "postConditionalTokenSupplies", - type: { - vec: "u64", - }, - index: false, - }, - { - name: "seqNum", - type: "u64", - index: false, - }, - ], - }, - { - name: "ResolveQuestionEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "question", - type: "publicKey", - index: false, - }, - { - name: "payoutNumerators", - type: { - vec: "u32", - }, - index: false, - }, - ], - }, - { - name: "SplitTokensEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "user", - type: "publicKey", - index: false, - }, - { - name: "vault", - type: "publicKey", - index: false, - }, - { - name: "amount", - type: "u64", - index: false, - }, - { - name: "postUserUnderlyingBalance", - type: "u64", - index: false, - }, - { - name: "postVaultUnderlyingBalance", - type: "u64", - index: false, - }, - { - name: "postUserConditionalTokenBalances", - type: { - vec: "u64", - }, - index: false, - }, - { - name: "postConditionalTokenSupplies", - type: { - vec: "u64", - }, - index: false, - }, - { - name: "seqNum", - type: "u64", - index: false, - }, - ], - }, - ], - errors: [ - { - code: 6000, - name: "AssertFailed", - msg: "An assertion failed", - }, - { - code: 6001, - name: "InsufficientUnderlyingTokens", - msg: "Insufficient underlying token balance to mint this amount of conditional tokens", - }, - { - code: 6002, - name: "InsufficientConditionalTokens", - msg: "Insufficient conditional token balance to merge this `amount`", - }, - { - code: 6003, - name: "InvalidVaultUnderlyingTokenAccount", - msg: "This `vault_underlying_token_account` is not this vault's `underlying_token_account`", - }, - { - code: 6004, - name: "InvalidConditionalTokenMint", - msg: "This conditional token mint is not this vault's conditional token mint", - }, - { - code: 6005, - name: "CantRedeemConditionalTokens", - msg: "Question needs to be resolved before users can redeem conditional tokens for underlying tokens", - }, - { - code: 6006, - name: "InsufficientNumConditions", - msg: "Questions need 2 or more conditions", - }, - { - code: 6007, - name: "InvalidNumPayoutNumerators", - msg: "Invalid number of payout numerators", - }, - { - code: 6008, - name: "InvalidConditionals", - msg: "Client needs to pass in the list of conditional mints for a vault followed by the user's token accounts for those tokens", - }, - { - code: 6009, - name: "ConditionalMintMismatch", - msg: "Conditional mint not in vault", - }, - { - code: 6010, - name: "BadConditionalMint", - msg: "Unable to deserialize a conditional token mint", - }, - { - code: 6011, - name: "BadConditionalTokenAccount", - msg: "Unable to deserialize a conditional token account", - }, - { - code: 6012, - name: "ConditionalTokenMintMismatch", - msg: "User conditional token account mint does not match conditional mint", - }, - { - code: 6013, - name: "PayoutZero", - msg: "Payouts must sum to 1 or more", - }, - { - code: 6014, - name: "QuestionAlreadyResolved", - msg: "Question already resolved", - }, - { - code: 6015, - name: "ConditionalTokenMetadataAlreadySet", - msg: "Conditional token metadata already set", - }, - { - code: 6016, - name: "UnauthorizedConditionalTokenAccount", - msg: "Conditional token account is not owned by the authority", - }, - ], -}; diff --git a/sdk/src/v0.6/types/damm_v2_cpi.ts b/sdk/src/v0.6/types/damm_v2_cpi.ts deleted file mode 100644 index 448829271..000000000 --- a/sdk/src/v0.6/types/damm_v2_cpi.ts +++ /dev/null @@ -1,747 +0,0 @@ -export type DammV2Cpi = { - version: "0.1.0"; - name: "damm_v2_cpi"; - instructions: [ - { - name: "initializePoolWithDynamicConfig"; - accounts: [ - { - name: "creator"; - isMut: false; - isSigner: false; - }, - { - name: "positionNftMint"; - isMut: true; - isSigner: true; - }, - { - name: "positionNftAccount"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - docs: ["Address paying to create the pool. Can be anyone"]; - }, - { - name: "poolCreatorAuthority"; - isMut: false; - isSigner: true; - }, - { - name: "config"; - isMut: false; - isSigner: false; - }, - { - name: "poolAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "pool"; - isMut: true; - isSigner: false; - }, - { - name: "position"; - isMut: true; - isSigner: false; - }, - { - name: "tokenAMint"; - isMut: false; - isSigner: false; - }, - { - name: "tokenBMint"; - isMut: false; - isSigner: false; - }, - { - name: "tokenAVault"; - isMut: true; - isSigner: false; - }, - { - name: "tokenBVault"; - isMut: true; - isSigner: false; - }, - { - name: "payerTokenA"; - isMut: true; - isSigner: false; - }, - { - name: "payerTokenB"; - isMut: true; - isSigner: false; - }, - { - name: "tokenAProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenBProgram"; - isMut: false; - isSigner: false; - }, - { - name: "token2022Program"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "InitializeCustomizablePoolParameters"; - }; - }, - ]; - }, - { - name: "claimPositionFee"; - accounts: [ - { - name: "poolAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "pool"; - isMut: false; - isSigner: false; - }, - { - name: "position"; - isMut: true; - isSigner: false; - }, - { - name: "tokenAAccount"; - isMut: true; - isSigner: false; - docs: ["The user token a account"]; - }, - { - name: "tokenBAccount"; - isMut: true; - isSigner: false; - docs: ["The user token b account"]; - }, - { - name: "tokenAVault"; - isMut: true; - isSigner: false; - docs: ["The vault token account for input token"]; - }, - { - name: "tokenBVault"; - isMut: true; - isSigner: false; - docs: ["The vault token account for output token"]; - }, - { - name: "tokenAMint"; - isMut: false; - isSigner: false; - docs: ["The mint of token a"]; - }, - { - name: "tokenBMint"; - isMut: false; - isSigner: false; - docs: ["The mint of token b"]; - }, - { - name: "positionNftAccount"; - isMut: false; - isSigner: false; - docs: ["The token account for nft"]; - }, - { - name: "owner"; - isMut: false; - isSigner: true; - docs: ["owner of position"]; - }, - { - name: "tokenAProgram"; - isMut: false; - isSigner: false; - docs: ["Token a program"]; - }, - { - name: "tokenBProgram"; - isMut: false; - isSigner: false; - docs: ["Token b program"]; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - ]; - types: [ - { - name: "PoolFeeParameters"; - docs: ["Information regarding fee charges"]; - type: { - kind: "struct"; - fields: [ - { - name: "baseFee"; - docs: ["Base fee"]; - type: { - defined: "BaseFeeParameters"; - }; - }, - { - name: "padding"; - docs: ["padding"]; - type: { - array: ["u8", 3]; - }; - }, - { - name: "dynamicFee"; - docs: ["dynamic fee"]; - type: { - option: { - defined: "DynamicFeeParameters"; - }; - }; - }, - ]; - }; - }, - { - name: "BaseFeeParameters"; - type: { - kind: "struct"; - fields: [ - { - name: "cliffFeeNumerator"; - type: "u64"; - }, - { - name: "numberOfPeriod"; - type: "u16"; - }, - { - name: "periodFrequency"; - type: "u64"; - }, - { - name: "reductionFactor"; - type: "u64"; - }, - { - name: "feeSchedulerMode"; - type: "u8"; - }, - ]; - }; - }, - { - name: "DynamicFeeParameters"; - type: { - kind: "struct"; - fields: [ - { - name: "binStep"; - type: "u16"; - }, - { - name: "binStepU128"; - type: "u128"; - }, - { - name: "filterPeriod"; - type: "u16"; - }, - { - name: "decayPeriod"; - type: "u16"; - }, - { - name: "reductionFactor"; - type: "u16"; - }, - { - name: "maxVolatilityAccumulator"; - type: "u32"; - }, - { - name: "variableFeeControl"; - type: "u32"; - }, - ]; - }; - }, - { - name: "InitializeCustomizablePoolParameters"; - type: { - kind: "struct"; - fields: [ - { - name: "poolFees"; - docs: ["pool fees"]; - type: { - defined: "PoolFeeParameters"; - }; - }, - { - name: "sqrtMinPrice"; - docs: ["sqrt min price"]; - type: "u128"; - }, - { - name: "sqrtMaxPrice"; - docs: ["sqrt max price"]; - type: "u128"; - }, - { - name: "hasAlphaVault"; - docs: ["has alpha vault"]; - type: "bool"; - }, - { - name: "liquidity"; - docs: ["initialize liquidity"]; - type: "u128"; - }, - { - name: "sqrtPrice"; - docs: [ - "The init price of the pool as a sqrt(token_b/token_a) Q64.64 value", - ]; - type: "u128"; - }, - { - name: "activationType"; - docs: ["activation type"]; - type: "u8"; - }, - { - name: "collectFeeMode"; - docs: ["collect fee mode"]; - type: "u8"; - }, - { - name: "activationPoint"; - docs: ["activation point"]; - type: { - option: "u64"; - }; - }, - ]; - }; - }, - ]; -}; - -export const IDL: DammV2Cpi = { - version: "0.1.0", - name: "damm_v2_cpi", - instructions: [ - { - name: "initializePoolWithDynamicConfig", - accounts: [ - { - name: "creator", - isMut: false, - isSigner: false, - }, - { - name: "positionNftMint", - isMut: true, - isSigner: true, - }, - { - name: "positionNftAccount", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - docs: ["Address paying to create the pool. Can be anyone"], - }, - { - name: "poolCreatorAuthority", - isMut: false, - isSigner: true, - }, - { - name: "config", - isMut: false, - isSigner: false, - }, - { - name: "poolAuthority", - isMut: false, - isSigner: false, - }, - { - name: "pool", - isMut: true, - isSigner: false, - }, - { - name: "position", - isMut: true, - isSigner: false, - }, - { - name: "tokenAMint", - isMut: false, - isSigner: false, - }, - { - name: "tokenBMint", - isMut: false, - isSigner: false, - }, - { - name: "tokenAVault", - isMut: true, - isSigner: false, - }, - { - name: "tokenBVault", - isMut: true, - isSigner: false, - }, - { - name: "payerTokenA", - isMut: true, - isSigner: false, - }, - { - name: "payerTokenB", - isMut: true, - isSigner: false, - }, - { - name: "tokenAProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenBProgram", - isMut: false, - isSigner: false, - }, - { - name: "token2022Program", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "InitializeCustomizablePoolParameters", - }, - }, - ], - }, - { - name: "claimPositionFee", - accounts: [ - { - name: "poolAuthority", - isMut: false, - isSigner: false, - }, - { - name: "pool", - isMut: false, - isSigner: false, - }, - { - name: "position", - isMut: true, - isSigner: false, - }, - { - name: "tokenAAccount", - isMut: true, - isSigner: false, - docs: ["The user token a account"], - }, - { - name: "tokenBAccount", - isMut: true, - isSigner: false, - docs: ["The user token b account"], - }, - { - name: "tokenAVault", - isMut: true, - isSigner: false, - docs: ["The vault token account for input token"], - }, - { - name: "tokenBVault", - isMut: true, - isSigner: false, - docs: ["The vault token account for output token"], - }, - { - name: "tokenAMint", - isMut: false, - isSigner: false, - docs: ["The mint of token a"], - }, - { - name: "tokenBMint", - isMut: false, - isSigner: false, - docs: ["The mint of token b"], - }, - { - name: "positionNftAccount", - isMut: false, - isSigner: false, - docs: ["The token account for nft"], - }, - { - name: "owner", - isMut: false, - isSigner: true, - docs: ["owner of position"], - }, - { - name: "tokenAProgram", - isMut: false, - isSigner: false, - docs: ["Token a program"], - }, - { - name: "tokenBProgram", - isMut: false, - isSigner: false, - docs: ["Token b program"], - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - ], - types: [ - { - name: "PoolFeeParameters", - docs: ["Information regarding fee charges"], - type: { - kind: "struct", - fields: [ - { - name: "baseFee", - docs: ["Base fee"], - type: { - defined: "BaseFeeParameters", - }, - }, - { - name: "padding", - docs: ["padding"], - type: { - array: ["u8", 3], - }, - }, - { - name: "dynamicFee", - docs: ["dynamic fee"], - type: { - option: { - defined: "DynamicFeeParameters", - }, - }, - }, - ], - }, - }, - { - name: "BaseFeeParameters", - type: { - kind: "struct", - fields: [ - { - name: "cliffFeeNumerator", - type: "u64", - }, - { - name: "numberOfPeriod", - type: "u16", - }, - { - name: "periodFrequency", - type: "u64", - }, - { - name: "reductionFactor", - type: "u64", - }, - { - name: "feeSchedulerMode", - type: "u8", - }, - ], - }, - }, - { - name: "DynamicFeeParameters", - type: { - kind: "struct", - fields: [ - { - name: "binStep", - type: "u16", - }, - { - name: "binStepU128", - type: "u128", - }, - { - name: "filterPeriod", - type: "u16", - }, - { - name: "decayPeriod", - type: "u16", - }, - { - name: "reductionFactor", - type: "u16", - }, - { - name: "maxVolatilityAccumulator", - type: "u32", - }, - { - name: "variableFeeControl", - type: "u32", - }, - ], - }, - }, - { - name: "InitializeCustomizablePoolParameters", - type: { - kind: "struct", - fields: [ - { - name: "poolFees", - docs: ["pool fees"], - type: { - defined: "PoolFeeParameters", - }, - }, - { - name: "sqrtMinPrice", - docs: ["sqrt min price"], - type: "u128", - }, - { - name: "sqrtMaxPrice", - docs: ["sqrt max price"], - type: "u128", - }, - { - name: "hasAlphaVault", - docs: ["has alpha vault"], - type: "bool", - }, - { - name: "liquidity", - docs: ["initialize liquidity"], - type: "u128", - }, - { - name: "sqrtPrice", - docs: [ - "The init price of the pool as a sqrt(token_b/token_a) Q64.64 value", - ], - type: "u128", - }, - { - name: "activationType", - docs: ["activation type"], - type: "u8", - }, - { - name: "collectFeeMode", - docs: ["collect fee mode"], - type: "u8", - }, - { - name: "activationPoint", - docs: ["activation point"], - type: { - option: "u64", - }, - }, - ], - }, - }, - ], -}; diff --git a/sdk/src/v0.6/types/futarchy.ts b/sdk/src/v0.6/types/futarchy.ts deleted file mode 100644 index 99270d126..000000000 --- a/sdk/src/v0.6/types/futarchy.ts +++ /dev/null @@ -1,6913 +0,0 @@ -export type Futarchy = { - version: "0.6.1"; - name: "futarchy"; - instructions: [ - { - name: "initializeDao"; - accounts: [ - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "daoCreator"; - isMut: false; - isSigner: true; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "baseMint"; - isMut: false; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "squadsMultisig"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigVault"; - isMut: false; - isSigner: false; - }, - { - name: "squadsProgram"; - isMut: false; - isSigner: false; - }, - { - name: "squadsProgramConfig"; - isMut: false; - isSigner: false; - }, - { - name: "squadsProgramConfigTreasury"; - isMut: true; - isSigner: false; - }, - { - name: "spendingLimit"; - isMut: true; - isSigner: false; - }, - { - name: "futarchyAmmBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "futarchyAmmQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "InitializeDaoParams"; - }; - }, - ]; - }, - { - name: "initializeProposal"; - accounts: [ - { - name: "proposal"; - isMut: true; - isSigner: false; - }, - { - name: "squadsProposal"; - isMut: false; - isSigner: false; - }, - { - name: "squadsMultisig"; - isMut: false; - isSigner: false; - }, - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "question"; - isMut: false; - isSigner: false; - }, - { - name: "quoteVault"; - isMut: false; - isSigner: false; - }, - { - name: "baseVault"; - isMut: false; - isSigner: false; - }, - { - name: "proposer"; - isMut: false; - isSigner: true; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "stakeToProposal"; - accounts: [ - { - name: "proposal"; - isMut: true; - isSigner: false; - }, - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "stakerBaseAccount"; - isMut: true; - isSigner: false; - }, - { - name: "proposalBaseAccount"; - isMut: true; - isSigner: false; - }, - { - name: "stakeAccount"; - isMut: true; - isSigner: false; - }, - { - name: "staker"; - isMut: false; - isSigner: true; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "StakeToProposalParams"; - }; - }, - ]; - }, - { - name: "unstakeFromProposal"; - accounts: [ - { - name: "proposal"; - isMut: true; - isSigner: false; - }, - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "stakerBaseAccount"; - isMut: true; - isSigner: false; - }, - { - name: "proposalBaseAccount"; - isMut: true; - isSigner: false; - }, - { - name: "stakeAccount"; - isMut: true; - isSigner: false; - }, - { - name: "staker"; - isMut: false; - isSigner: true; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "UnstakeFromProposalParams"; - }; - }, - ]; - }, - { - name: "launchProposal"; - accounts: [ - { - name: "proposal"; - isMut: true; - isSigner: false; - }, - { - name: "baseVault"; - isMut: false; - isSigner: false; - }, - { - name: "quoteVault"; - isMut: false; - isSigner: false; - }, - { - name: "passBaseMint"; - isMut: false; - isSigner: false; - }, - { - name: "passQuoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "failBaseMint"; - isMut: false; - isSigner: false; - }, - { - name: "failQuoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "ammPassBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "ammPassQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "ammFailBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "ammFailQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisig"; - isMut: false; - isSigner: false; - }, - { - name: "squadsProposal"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "finalizeProposal"; - accounts: [ - { - name: "proposal"; - isMut: true; - isSigner: false; - }, - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "question"; - isMut: true; - isSigner: false; - }, - { - name: "squadsProposal"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisig"; - isMut: false; - isSigner: false; - }, - { - name: "squadsMultisigProgram"; - isMut: false; - isSigner: false; - }, - { - name: "ammPassBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "ammPassQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "ammFailBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "ammFailQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "ammBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "ammQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "vaultProgram"; - isMut: false; - isSigner: false; - }, - { - name: "vaultEventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "quoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "quoteVaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "passQuoteMint"; - isMut: true; - isSigner: false; - }, - { - name: "failQuoteMint"; - isMut: true; - isSigner: false; - }, - { - name: "passBaseMint"; - isMut: true; - isSigner: false; - }, - { - name: "failBaseMint"; - isMut: true; - isSigner: false; - }, - { - name: "baseVault"; - isMut: true; - isSigner: false; - }, - { - name: "baseVaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "updateDao"; - accounts: [ - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigVault"; - isMut: false; - isSigner: true; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "daoParams"; - type: { - defined: "UpdateDaoParams"; - }; - }, - ]; - }, - { - name: "resizeDao"; - accounts: [ - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "spotSwap"; - accounts: [ - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "userBaseAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "ammBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "ammQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "user"; - isMut: false; - isSigner: true; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "SpotSwapParams"; - }; - }, - ]; - }, - { - name: "conditionalSwap"; - accounts: [ - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "ammBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "ammQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "proposal"; - isMut: false; - isSigner: false; - }, - { - name: "ammPassBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "ammPassQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "ammFailBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "ammFailQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "trader"; - isMut: false; - isSigner: true; - }, - { - name: "userInputAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userOutputAccount"; - isMut: true; - isSigner: false; - }, - { - name: "baseVault"; - isMut: true; - isSigner: false; - }, - { - name: "baseVaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "quoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "quoteVaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "passBaseMint"; - isMut: true; - isSigner: false; - }, - { - name: "failBaseMint"; - isMut: true; - isSigner: false; - }, - { - name: "passQuoteMint"; - isMut: true; - isSigner: false; - }, - { - name: "failQuoteMint"; - isMut: true; - isSigner: false; - }, - { - name: "conditionalVaultProgram"; - isMut: false; - isSigner: false; - }, - { - name: "vaultEventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "question"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "ConditionalSwapParams"; - }; - }, - ]; - }, - { - name: "provideLiquidity"; - accounts: [ - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "liquidityProvider"; - isMut: false; - isSigner: true; - }, - { - name: "liquidityProviderBaseAccount"; - isMut: true; - isSigner: false; - }, - { - name: "liquidityProviderQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "ammBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "ammQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "ammPosition"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "ProvideLiquidityParams"; - }; - }, - ]; - }, - { - name: "withdrawLiquidity"; - accounts: [ - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "positionAuthority"; - isMut: false; - isSigner: true; - }, - { - name: "liquidityProviderBaseAccount"; - isMut: true; - isSigner: false; - }, - { - name: "liquidityProviderQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "ammBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "ammQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "ammPosition"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "WithdrawLiquidityParams"; - }; - }, - ]; - }, - { - name: "collectFees"; - accounts: [ - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "admin"; - isMut: false; - isSigner: true; - }, - { - name: "baseTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "quoteTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "ammBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "ammQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "executeSpendingLimitChange"; - accounts: [ - { - name: "proposal"; - isMut: true; - isSigner: false; - }, - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "squadsProposal"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisig"; - isMut: false; - isSigner: false; - }, - { - name: "squadsMultisigProgram"; - isMut: false; - isSigner: false; - }, - { - name: "vaultTransaction"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "sponsorProposal"; - accounts: [ - { - name: "proposal"; - isMut: true; - isSigner: false; - }, - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "teamAddress"; - isMut: false; - isSigner: true; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "collectMeteoraDammFees"; - accounts: [ - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "admin"; - isMut: true; - isSigner: true; - }, - { - name: "squadsMultisig"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigVault"; - isMut: false; - isSigner: false; - }, - { - name: "squadsMultisigVaultTransaction"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigProposal"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigPermissionlessAccount"; - isMut: false; - isSigner: true; - }, - { - name: "meteoraClaimPositionFeesAccounts"; - accounts: [ - { - name: "dammV2Program"; - isMut: false; - isSigner: false; - }, - { - name: "dammV2EventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "poolAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "pool"; - isMut: false; - isSigner: false; - }, - { - name: "position"; - isMut: true; - isSigner: false; - }, - { - name: "tokenAAccount"; - isMut: true; - isSigner: false; - docs: ["Token account of base tokens recipient"]; - }, - { - name: "tokenBAccount"; - isMut: true; - isSigner: false; - docs: ["Token account of quote tokens recipient"]; - }, - { - name: "tokenAVault"; - isMut: true; - isSigner: false; - }, - { - name: "tokenBVault"; - isMut: true; - isSigner: false; - }, - { - name: "tokenAMint"; - isMut: false; - isSigner: false; - }, - { - name: "tokenBMint"; - isMut: false; - isSigner: false; - }, - { - name: "positionNftAccount"; - isMut: false; - isSigner: false; - }, - { - name: "owner"; - isMut: false; - isSigner: false; - }, - { - name: "tokenAProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenBProgram"; - isMut: false; - isSigner: false; - }, - ]; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "squadsProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "initiateVaultSpendOptimisticProposal"; - accounts: [ - { - name: "squadsMultisig"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigVault"; - isMut: false; - isSigner: false; - }, - { - name: "squadsSpendingLimit"; - isMut: false; - isSigner: false; - }, - { - name: "squadsProposal"; - isMut: true; - isSigner: false; - }, - { - name: "squadsVaultTransaction"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigPermissionlessAccount"; - isMut: false; - isSigner: true; - }, - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "daoQuoteVaultAccount"; - isMut: true; - isSigner: false; - }, - { - name: "proposer"; - isMut: true; - isSigner: true; - }, - { - name: "recipient"; - isMut: false; - isSigner: false; - }, - { - name: "recipientQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "squadsProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "InitiateVaultSpendOptimisticProposalParams"; - }; - }, - ]; - }, - { - name: "finalizeOptimisticProposal"; - accounts: [ - { - name: "squadsMultisig"; - isMut: true; - isSigner: false; - }, - { - name: "squadsProposal"; - isMut: true; - isSigner: false; - }, - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "squadsProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "adminApproveExecuteMultisigProposal"; - accounts: [ - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "admin"; - isMut: true; - isSigner: true; - }, - { - name: "squadsMultisig"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigProposal"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigVaultTransaction"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - ]; - accounts: [ - { - name: "ammPosition"; - type: { - kind: "struct"; - fields: [ - { - name: "dao"; - type: "publicKey"; - }, - { - name: "positionAuthority"; - type: "publicKey"; - }, - { - name: "liquidity"; - type: "u128"; - }, - ]; - }; - }, - { - name: "dao"; - type: { - kind: "struct"; - fields: [ - { - name: "amm"; - docs: ["Embedded FutarchyAmm - 1:1 relationship"]; - type: { - defined: "FutarchyAmm"; - }; - }, - { - name: "nonce"; - docs: ["`nonce` + `dao_creator` are PDA seeds"]; - type: "u64"; - }, - { - name: "daoCreator"; - type: "publicKey"; - }, - { - name: "pdaBump"; - type: "u8"; - }, - { - name: "squadsMultisig"; - type: "publicKey"; - }, - { - name: "squadsMultisigVault"; - type: "publicKey"; - }, - { - name: "baseMint"; - type: "publicKey"; - }, - { - name: "quoteMint"; - type: "publicKey"; - }, - { - name: "proposalCount"; - type: "u32"; - }, - { - name: "passThresholdBps"; - type: "u16"; - }, - { - name: "secondsPerProposal"; - type: "u32"; - }, - { - name: "twapInitialObservation"; - docs: [ - "For manipulation-resistance the TWAP is a time-weighted average observation,", - "where observation tries to approximate price but can only move by", - "`twap_max_observation_change_per_update` per update. Because it can only move", - "a little bit per update, you need to check that it has a good initial observation.", - "Otherwise, an attacker could create a very high initial observation in the pass", - "market and a very low one in the fail market to force the proposal to pass.", - "", - "We recommend setting an initial observation around the spot price of the token,", - "and max observation change per update around 2% the spot price of the token.", - "For example, if the spot price of META is $400, we'd recommend setting an initial", - "observation of 400 (converted into the AMM prices) and a max observation change per", - "update of 8 (also converted into the AMM prices). Observations can be updated once", - "a minute, so 2% allows the proposal market to reach double the spot price or 0", - "in 50 minutes.", - ]; - type: "u128"; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; - }, - { - name: "twapStartDelaySeconds"; - docs: [ - "Forces TWAP calculation to start after `twap_start_delay_seconds` seconds", - ]; - type: "u32"; - }, - { - name: "minQuoteFutarchicLiquidity"; - docs: [ - "As an anti-spam measure and to help liquidity, you need to lock up some liquidity", - "in both futarchic markets in order to create a proposal.", - "", - "For example, for META, we can use a `min_quote_futarchic_liquidity` of", - "5000 * 1_000_000 (5000 USDC) and a `min_base_futarchic_liquidity` of", - "10 * 1_000_000_000 (10 META).", - ]; - type: "u64"; - }, - { - name: "minBaseFutarchicLiquidity"; - type: "u64"; - }, - { - name: "baseToStake"; - docs: [ - "Minimum amount of base tokens that must be staked to launch a proposal", - ]; - type: "u64"; - }, - { - name: "seqNum"; - type: "u64"; - }, - { - name: "initialSpendingLimit"; - type: { - option: { - defined: "InitialSpendingLimit"; - }; - }; - }, - { - name: "teamSponsoredPassThresholdBps"; - docs: [ - "The percentage, in basis points, the pass price needs to be above the", - "fail price in order for the proposal to pass for team-sponsored proposals.", - "", - "Can be negative to allow for team-sponsored proposals to pass by default.", - ]; - type: "i16"; - }, - { - name: "teamAddress"; - type: "publicKey"; - }, - { - name: "optimisticProposal"; - type: { - option: { - defined: "OptimisticProposal"; - }; - }; - }, - { - name: "isOptimisticGovernanceEnabled"; - type: "bool"; - }, - ]; - }; - }, - { - name: "oldDao"; - type: { - kind: "struct"; - fields: [ - { - name: "amm"; - docs: ["Embedded FutarchyAmm - 1:1 relationship"]; - type: { - defined: "FutarchyAmm"; - }; - }, - { - name: "nonce"; - docs: ["`nonce` + `dao_creator` are PDA seeds"]; - type: "u64"; - }, - { - name: "daoCreator"; - type: "publicKey"; - }, - { - name: "pdaBump"; - type: "u8"; - }, - { - name: "squadsMultisig"; - type: "publicKey"; - }, - { - name: "squadsMultisigVault"; - type: "publicKey"; - }, - { - name: "baseMint"; - type: "publicKey"; - }, - { - name: "quoteMint"; - type: "publicKey"; - }, - { - name: "proposalCount"; - type: "u32"; - }, - { - name: "passThresholdBps"; - type: "u16"; - }, - { - name: "secondsPerProposal"; - type: "u32"; - }, - { - name: "twapInitialObservation"; - docs: [ - "For manipulation-resistance the TWAP is a time-weighted average observation,", - "where observation tries to approximate price but can only move by", - "`twap_max_observation_change_per_update` per update. Because it can only move", - "a little bit per update, you need to check that it has a good initial observation.", - "Otherwise, an attacker could create a very high initial observation in the pass", - "market and a very low one in the fail market to force the proposal to pass.", - "", - "We recommend setting an initial observation around the spot price of the token,", - "and max observation change per update around 2% the spot price of the token.", - "For example, if the spot price of META is $400, we'd recommend setting an initial", - "observation of 400 (converted into the AMM prices) and a max observation change per", - "update of 8 (also converted into the AMM prices). Observations can be updated once", - "a minute, so 2% allows the proposal market to reach double the spot price or 0", - "in 50 minutes.", - ]; - type: "u128"; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; - }, - { - name: "twapStartDelaySeconds"; - docs: [ - "Forces TWAP calculation to start after `twap_start_delay_seconds` seconds", - ]; - type: "u32"; - }, - { - name: "minQuoteFutarchicLiquidity"; - docs: [ - "As an anti-spam measure and to help liquidity, you need to lock up some liquidity", - "in both futarchic markets in order to create a proposal.", - "", - "For example, for META, we can use a `min_quote_futarchic_liquidity` of", - "5000 * 1_000_000 (5000 USDC) and a `min_base_futarchic_liquidity` of", - "10 * 1_000_000_000 (10 META).", - ]; - type: "u64"; - }, - { - name: "minBaseFutarchicLiquidity"; - type: "u64"; - }, - { - name: "baseToStake"; - docs: [ - "Minimum amount of base tokens that must be staked to launch a proposal", - ]; - type: "u64"; - }, - { - name: "seqNum"; - type: "u64"; - }, - { - name: "initialSpendingLimit"; - type: { - option: { - defined: "InitialSpendingLimit"; - }; - }; - }, - { - name: "teamSponsoredPassThresholdBps"; - docs: [ - "The percentage, in basis points, the pass price needs to be above the", - "fail price in order for the proposal to pass for team-sponsored proposals.", - "", - "Can be negative to allow for team-sponsored proposals to pass by default.", - ]; - type: "i16"; - }, - { - name: "teamAddress"; - type: "publicKey"; - }, - ]; - }; - }, - { - name: "proposal"; - type: { - kind: "struct"; - fields: [ - { - name: "number"; - type: "u32"; - }, - { - name: "proposer"; - type: "publicKey"; - }, - { - name: "timestampEnqueued"; - type: "i64"; - }, - { - name: "state"; - type: { - defined: "ProposalState"; - }; - }, - { - name: "baseVault"; - type: "publicKey"; - }, - { - name: "quoteVault"; - type: "publicKey"; - }, - { - name: "dao"; - type: "publicKey"; - }, - { - name: "pdaBump"; - type: "u8"; - }, - { - name: "question"; - type: "publicKey"; - }, - { - name: "durationInSeconds"; - type: "u32"; - }, - { - name: "squadsProposal"; - type: "publicKey"; - }, - { - name: "passBaseMint"; - type: "publicKey"; - }, - { - name: "passQuoteMint"; - type: "publicKey"; - }, - { - name: "failBaseMint"; - type: "publicKey"; - }, - { - name: "failQuoteMint"; - type: "publicKey"; - }, - { - name: "isTeamSponsored"; - type: "bool"; - }, - ]; - }; - }, - { - name: "stakeAccount"; - type: { - kind: "struct"; - fields: [ - { - name: "proposal"; - type: "publicKey"; - }, - { - name: "staker"; - type: "publicKey"; - }, - { - name: "amount"; - type: "u64"; - }, - { - name: "bump"; - type: "u8"; - }, - ]; - }; - }, - ]; - types: [ - { - name: "CommonFields"; - type: { - kind: "struct"; - fields: [ - { - name: "slot"; - type: "u64"; - }, - { - name: "unixTimestamp"; - type: "i64"; - }, - { - name: "daoSeqNum"; - type: "u64"; - }, - ]; - }; - }, - { - name: "ConditionalSwapParams"; - type: { - kind: "struct"; - fields: [ - { - name: "market"; - type: { - defined: "Market"; - }; - }, - { - name: "swapType"; - type: { - defined: "SwapType"; - }; - }, - { - name: "inputAmount"; - type: "u64"; - }, - { - name: "minOutputAmount"; - type: "u64"; - }, - ]; - }; - }, - { - name: "InitializeDaoParams"; - type: { - kind: "struct"; - fields: [ - { - name: "twapInitialObservation"; - type: "u128"; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; - }, - { - name: "twapStartDelaySeconds"; - type: "u32"; - }, - { - name: "minQuoteFutarchicLiquidity"; - type: "u64"; - }, - { - name: "minBaseFutarchicLiquidity"; - type: "u64"; - }, - { - name: "baseToStake"; - type: "u64"; - }, - { - name: "passThresholdBps"; - type: "u16"; - }, - { - name: "secondsPerProposal"; - type: "u32"; - }, - { - name: "nonce"; - type: "u64"; - }, - { - name: "initialSpendingLimit"; - type: { - option: { - defined: "InitialSpendingLimit"; - }; - }; - }, - { - name: "teamSponsoredPassThresholdBps"; - type: "i16"; - }, - { - name: "teamAddress"; - type: "publicKey"; - }, - ]; - }; - }, - { - name: "InitiateVaultSpendOptimisticProposalParams"; - type: { - kind: "struct"; - fields: [ - { - name: "amount"; - type: "u64"; - }, - ]; - }; - }, - { - name: "ProvideLiquidityParams"; - type: { - kind: "struct"; - fields: [ - { - name: "quoteAmount"; - docs: ["How much quote token you will deposit to the pool"]; - type: "u64"; - }, - { - name: "maxBaseAmount"; - docs: ["The maximum base token you will deposit to the pool"]; - type: "u64"; - }, - { - name: "minLiquidity"; - docs: ["The minimum liquidity you will be assigned"]; - type: "u128"; - }, - { - name: "positionAuthority"; - docs: [ - "The account that will own the LP position, usually the same as the", - "liquidity provider", - ]; - type: "publicKey"; - }, - ]; - }; - }, - { - name: "SpotSwapParams"; - type: { - kind: "struct"; - fields: [ - { - name: "inputAmount"; - type: "u64"; - }, - { - name: "swapType"; - type: { - defined: "SwapType"; - }; - }, - { - name: "minOutputAmount"; - type: "u64"; - }, - ]; - }; - }, - { - name: "StakeToProposalParams"; - type: { - kind: "struct"; - fields: [ - { - name: "amount"; - type: "u64"; - }, - ]; - }; - }, - { - name: "UnstakeFromProposalParams"; - type: { - kind: "struct"; - fields: [ - { - name: "amount"; - type: "u64"; - }, - ]; - }; - }, - { - name: "UpdateDaoParams"; - type: { - kind: "struct"; - fields: [ - { - name: "passThresholdBps"; - type: { - option: "u16"; - }; - }, - { - name: "secondsPerProposal"; - type: { - option: "u32"; - }; - }, - { - name: "twapInitialObservation"; - type: { - option: "u128"; - }; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: { - option: "u128"; - }; - }, - { - name: "twapStartDelaySeconds"; - type: { - option: "u32"; - }; - }, - { - name: "minQuoteFutarchicLiquidity"; - type: { - option: "u64"; - }; - }, - { - name: "minBaseFutarchicLiquidity"; - type: { - option: "u64"; - }; - }, - { - name: "baseToStake"; - type: { - option: "u64"; - }; - }, - { - name: "teamSponsoredPassThresholdBps"; - type: { - option: "i16"; - }; - }, - { - name: "teamAddress"; - type: { - option: "publicKey"; - }; - }, - { - name: "isOptimisticGovernanceEnabled"; - type: { - option: "bool"; - }; - }, - ]; - }; - }, - { - name: "WithdrawLiquidityParams"; - type: { - kind: "struct"; - fields: [ - { - name: "liquidityToWithdraw"; - docs: ["How much liquidity to withdraw"]; - type: "u128"; - }, - { - name: "minBaseAmount"; - docs: ["Minimum base tokens to receive"]; - type: "u64"; - }, - { - name: "minQuoteAmount"; - docs: ["Minimum quote tokens to receive"]; - type: "u64"; - }, - ]; - }; - }, - { - name: "OptimisticProposal"; - type: { - kind: "struct"; - fields: [ - { - name: "squadsProposal"; - docs: [ - "The squads proposal currently enqueued for execution if not challenged by a new proposal.", - ]; - type: "publicKey"; - }, - { - name: "enqueuedTimestamp"; - docs: [ - "The timestamp when the active optimistic squads proposal was enqueued.", - ]; - type: "i64"; - }, - ]; - }; - }, - { - name: "InitialSpendingLimit"; - type: { - kind: "struct"; - fields: [ - { - name: "amountPerMonth"; - type: "u64"; - }, - { - name: "members"; - type: { - vec: "publicKey"; - }; - }, - ]; - }; - }, - { - name: "FutarchyAmm"; - type: { - kind: "struct"; - fields: [ - { - name: "state"; - type: { - defined: "PoolState"; - }; - }, - { - name: "totalLiquidity"; - type: "u128"; - }, - { - name: "baseMint"; - type: "publicKey"; - }, - { - name: "quoteMint"; - type: "publicKey"; - }, - { - name: "ammBaseVault"; - type: "publicKey"; - }, - { - name: "ammQuoteVault"; - type: "publicKey"; - }, - ]; - }; - }, - { - name: "TwapOracle"; - type: { - kind: "struct"; - fields: [ - { - name: "aggregator"; - docs: [ - "Running sum of slots_per_last_update * last_observation.", - "", - "Assuming latest observations are as big as possible (u64::MAX * 1e12),", - "we can store 18 million slots worth of observations, which turns out to", - "be ~85 days worth of slots.", - "", - "Assuming that latest observations are 100x smaller than they could theoretically", - "be, we can store 8500 days (23 years) worth of them. Even this is a very", - "very conservative assumption - META/USDC prices should be between 1e9 and", - "1e15, which would overflow after 1e15 years worth of slots.", - "", - "So in the case of an overflow, the aggregator rolls back to 0. It's the", - "client's responsibility to sanity check the assets or to handle an", - "aggregator at T2 being smaller than an aggregator at T1.", - ]; - type: "u128"; - }, - { - name: "lastUpdatedTimestamp"; - type: "i64"; - }, - { - name: "createdAtTimestamp"; - type: "i64"; - }, - { - name: "lastPrice"; - docs: [ - "A price is the number of quote units per base unit multiplied by 1e12.", - "You cannot simply divide by 1e12 to get a price you can display in the UI", - "because the base and quote decimals may be different. Instead, do:", - "ui_price = (price * (10**(base_decimals - quote_decimals))) / 1e12", - ]; - type: "u128"; - }, - { - name: "lastObservation"; - docs: [ - "If we did a raw TWAP over prices, someone could push the TWAP heavily with", - "a few extremely large outliers. So we use observations, which can only move", - "by `max_observation_change_per_update` per update.", - ]; - type: "u128"; - }, - { - name: "maxObservationChangePerUpdate"; - docs: ["The most that an observation can change per update."]; - type: "u128"; - }, - { - name: "initialObservation"; - docs: ["What the initial `latest_observation` is set to."]; - type: "u128"; - }, - { - name: "startDelaySeconds"; - docs: [ - "Number of seconds after amm.created_at_slot to start recording TWAP", - ]; - type: "u32"; - }, - ]; - }; - }, - { - name: "Pool"; - type: { - kind: "struct"; - fields: [ - { - name: "oracle"; - type: { - defined: "TwapOracle"; - }; - }, - { - name: "quoteReserves"; - type: "u64"; - }, - { - name: "baseReserves"; - type: "u64"; - }, - { - name: "quoteProtocolFeeBalance"; - type: "u64"; - }, - { - name: "baseProtocolFeeBalance"; - type: "u64"; - }, - ]; - }; - }, - { - name: "PoolState"; - type: { - kind: "enum"; - variants: [ - { - name: "Spot"; - fields: [ - { - name: "spot"; - type: { - defined: "Pool"; - }; - }, - ]; - }, - { - name: "Futarchy"; - fields: [ - { - name: "spot"; - type: { - defined: "Pool"; - }; - }, - { - name: "pass"; - type: { - defined: "Pool"; - }; - }, - { - name: "fail"; - type: { - defined: "Pool"; - }; - }, - ]; - }, - ]; - }; - }, - { - name: "Market"; - type: { - kind: "enum"; - variants: [ - { - name: "Spot"; - }, - { - name: "Pass"; - }, - { - name: "Fail"; - }, - ]; - }; - }, - { - name: "SwapType"; - type: { - kind: "enum"; - variants: [ - { - name: "Buy"; - }, - { - name: "Sell"; - }, - ]; - }; - }, - { - name: "Token"; - type: { - kind: "enum"; - variants: [ - { - name: "Base"; - }, - { - name: "Quote"; - }, - ]; - }; - }, - { - name: "ProposalState"; - type: { - kind: "enum"; - variants: [ - { - name: "Draft"; - fields: [ - { - name: "amountStaked"; - type: "u64"; - }, - ]; - }, - { - name: "Pending"; - }, - { - name: "Passed"; - }, - { - name: "Failed"; - }, - ]; - }; - }, - ]; - events: [ - { - name: "CollectFeesEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "baseTokenAccount"; - type: "publicKey"; - index: false; - }, - { - name: "quoteTokenAccount"; - type: "publicKey"; - index: false; - }, - { - name: "ammBaseVault"; - type: "publicKey"; - index: false; - }, - { - name: "ammQuoteVault"; - type: "publicKey"; - index: false; - }, - { - name: "quoteMint"; - type: "publicKey"; - index: false; - }, - { - name: "baseMint"; - type: "publicKey"; - index: false; - }, - { - name: "quoteFeesCollected"; - type: "u64"; - index: false; - }, - { - name: "baseFeesCollected"; - type: "u64"; - index: false; - }, - { - name: "postAmmState"; - type: { - defined: "FutarchyAmm"; - }; - index: false; - }, - ]; - }, - { - name: "InitializeDaoEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "baseMint"; - type: "publicKey"; - index: false; - }, - { - name: "quoteMint"; - type: "publicKey"; - index: false; - }, - { - name: "passThresholdBps"; - type: "u16"; - index: false; - }, - { - name: "secondsPerProposal"; - type: "u32"; - index: false; - }, - { - name: "twapInitialObservation"; - type: "u128"; - index: false; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; - index: false; - }, - { - name: "twapStartDelaySeconds"; - type: "u32"; - index: false; - }, - { - name: "minQuoteFutarchicLiquidity"; - type: "u64"; - index: false; - }, - { - name: "minBaseFutarchicLiquidity"; - type: "u64"; - index: false; - }, - { - name: "baseToStake"; - type: "u64"; - index: false; - }, - { - name: "initialSpendingLimit"; - type: { - option: { - defined: "InitialSpendingLimit"; - }; - }; - index: false; - }, - { - name: "squadsMultisig"; - type: "publicKey"; - index: false; - }, - { - name: "squadsMultisigVault"; - type: "publicKey"; - index: false; - }, - { - name: "teamSponsoredPassThresholdBps"; - type: "i16"; - index: false; - }, - { - name: "teamAddress"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "UpdateDaoEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "passThresholdBps"; - type: "u16"; - index: false; - }, - { - name: "secondsPerProposal"; - type: "u32"; - index: false; - }, - { - name: "twapInitialObservation"; - type: "u128"; - index: false; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; - index: false; - }, - { - name: "twapStartDelaySeconds"; - type: "u32"; - index: false; - }, - { - name: "minQuoteFutarchicLiquidity"; - type: "u64"; - index: false; - }, - { - name: "minBaseFutarchicLiquidity"; - type: "u64"; - index: false; - }, - { - name: "baseToStake"; - type: "u64"; - index: false; - }, - { - name: "teamSponsoredPassThresholdBps"; - type: "i16"; - index: false; - }, - { - name: "teamAddress"; - type: "publicKey"; - index: false; - }, - { - name: "isOptimisticGovernanceEnabled"; - type: "bool"; - index: false; - }, - ]; - }, - { - name: "InitializeProposalEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "proposal"; - type: "publicKey"; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "question"; - type: "publicKey"; - index: false; - }, - { - name: "quoteVault"; - type: "publicKey"; - index: false; - }, - { - name: "baseVault"; - type: "publicKey"; - index: false; - }, - { - name: "proposer"; - type: "publicKey"; - index: false; - }, - { - name: "number"; - type: "u32"; - index: false; - }, - { - name: "pdaBump"; - type: "u8"; - index: false; - }, - { - name: "durationInSeconds"; - type: "u32"; - index: false; - }, - { - name: "squadsProposal"; - type: "publicKey"; - index: false; - }, - { - name: "squadsMultisig"; - type: "publicKey"; - index: false; - }, - { - name: "squadsMultisigVault"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "StakeToProposalEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "proposal"; - type: "publicKey"; - index: false; - }, - { - name: "staker"; - type: "publicKey"; - index: false; - }, - { - name: "amount"; - type: "u64"; - index: false; - }, - { - name: "totalStaked"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "UnstakeFromProposalEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "proposal"; - type: "publicKey"; - index: false; - }, - { - name: "staker"; - type: "publicKey"; - index: false; - }, - { - name: "amount"; - type: "u64"; - index: false; - }, - { - name: "totalStaked"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "LaunchProposalEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "proposal"; - type: "publicKey"; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "timestampEnqueued"; - type: "i64"; - index: false; - }, - { - name: "totalStaked"; - type: "u64"; - index: false; - }, - { - name: "postAmmState"; - type: { - defined: "FutarchyAmm"; - }; - index: false; - }, - ]; - }, - { - name: "FinalizeProposalEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "proposal"; - type: "publicKey"; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "passMarketTwap"; - type: "u128"; - index: false; - }, - { - name: "failMarketTwap"; - type: "u128"; - index: false; - }, - { - name: "threshold"; - type: "u128"; - index: false; - }, - { - name: "state"; - type: { - defined: "ProposalState"; - }; - index: false; - }, - { - name: "squadsProposal"; - type: "publicKey"; - index: false; - }, - { - name: "squadsMultisig"; - type: "publicKey"; - index: false; - }, - { - name: "postAmmState"; - type: { - defined: "FutarchyAmm"; - }; - index: false; - }, - { - name: "isTeamSponsored"; - type: "bool"; - index: false; - }, - ]; - }, - { - name: "SpotSwapEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "user"; - type: "publicKey"; - index: false; - }, - { - name: "swapType"; - type: { - defined: "SwapType"; - }; - index: false; - }, - { - name: "inputAmount"; - type: "u64"; - index: false; - }, - { - name: "outputAmount"; - type: "u64"; - index: false; - }, - { - name: "minOutputAmount"; - type: "u64"; - index: false; - }, - { - name: "postAmmState"; - type: { - defined: "FutarchyAmm"; - }; - index: false; - }, - ]; - }, - { - name: "ConditionalSwapEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "proposal"; - type: "publicKey"; - index: false; - }, - { - name: "trader"; - type: "publicKey"; - index: false; - }, - { - name: "market"; - type: { - defined: "Market"; - }; - index: false; - }, - { - name: "swapType"; - type: { - defined: "SwapType"; - }; - index: false; - }, - { - name: "inputAmount"; - type: "u64"; - index: false; - }, - { - name: "outputAmount"; - type: "u64"; - index: false; - }, - { - name: "minOutputAmount"; - type: "u64"; - index: false; - }, - { - name: "postAmmState"; - type: { - defined: "FutarchyAmm"; - }; - index: false; - }, - ]; - }, - { - name: "ProvideLiquidityEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "liquidityProvider"; - type: "publicKey"; - index: false; - }, - { - name: "positionAuthority"; - type: "publicKey"; - index: false; - }, - { - name: "quoteAmount"; - type: "u64"; - index: false; - }, - { - name: "baseAmount"; - type: "u64"; - index: false; - }, - { - name: "liquidityMinted"; - type: "u128"; - index: false; - }, - { - name: "minLiquidity"; - type: "u128"; - index: false; - }, - { - name: "postAmmState"; - type: { - defined: "FutarchyAmm"; - }; - index: false; - }, - ]; - }, - { - name: "WithdrawLiquidityEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "liquidityProvider"; - type: "publicKey"; - index: false; - }, - { - name: "liquidityWithdrawn"; - type: "u128"; - index: false; - }, - { - name: "minBaseAmount"; - type: "u64"; - index: false; - }, - { - name: "minQuoteAmount"; - type: "u64"; - index: false; - }, - { - name: "baseAmount"; - type: "u64"; - index: false; - }, - { - name: "quoteAmount"; - type: "u64"; - index: false; - }, - { - name: "postAmmState"; - type: { - defined: "FutarchyAmm"; - }; - index: false; - }, - ]; - }, - { - name: "SponsorProposalEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "proposal"; - type: "publicKey"; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "teamAddress"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "CollectMeteoraDammFeesEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "pool"; - type: "publicKey"; - index: false; - }, - { - name: "baseTokenAccount"; - type: "publicKey"; - index: false; - }, - { - name: "quoteTokenAccount"; - type: "publicKey"; - index: false; - }, - { - name: "quoteMint"; - type: "publicKey"; - index: false; - }, - { - name: "baseMint"; - type: "publicKey"; - index: false; - }, - { - name: "quoteFeesCollected"; - type: "u64"; - index: false; - }, - { - name: "baseFeesCollected"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "InitiateVaultSpendOptimisticProposalEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "proposer"; - type: "publicKey"; - index: false; - }, - { - name: "squadsProposal"; - type: "publicKey"; - index: false; - }, - { - name: "squadsMultisig"; - type: "publicKey"; - index: false; - }, - { - name: "squadsMultisigVault"; - type: "publicKey"; - index: false; - }, - { - name: "amount"; - type: "u64"; - index: false; - }, - { - name: "recipient"; - type: "publicKey"; - index: false; - }, - { - name: "daoQuoteVaultAccount"; - type: "publicKey"; - index: false; - }, - { - name: "recipientQuoteAccount"; - type: "publicKey"; - index: false; - }, - { - name: "enqueuedTimestamp"; - type: "i64"; - index: false; - }, - ]; - }, - { - name: "FinalizeOptimisticProposalEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "squadsProposal"; - type: "publicKey"; - index: false; - }, - ]; - }, - ]; - errors: [ - { - code: 6000; - name: "AmmTooOld"; - msg: "Amms must have been created within 5 minutes (counted in slots) of proposal initialization"; - }, - { - code: 6001; - name: "InvalidInitialObservation"; - msg: "An amm has an `initial_observation` that doesn't match the `dao`'s config"; - }, - { - code: 6002; - name: "InvalidMaxObservationChange"; - msg: "An amm has a `max_observation_change_per_update` that doesn't match the `dao`'s config"; - }, - { - code: 6003; - name: "InvalidStartDelaySlots"; - msg: "An amm has a `start_delay_slots` that doesn't match the `dao`'s config"; - }, - { - code: 6004; - name: "InvalidSettlementAuthority"; - msg: "One of the vaults has an invalid `settlement_authority`"; - }, - { - code: 6005; - name: "ProposalTooYoung"; - msg: "Proposal is too young to be executed or rejected"; - }, - { - code: 6006; - name: "MarketsTooYoung"; - msg: "Markets too young for proposal to be finalized. TWAP might need to be cranked"; - }, - { - code: 6007; - name: "ProposalAlreadyFinalized"; - msg: "This proposal has already been finalized"; - }, - { - code: 6008; - name: "InvalidVaultNonce"; - msg: "A conditional vault has an invalid nonce. A nonce should encode the proposal number"; - }, - { - code: 6009; - name: "ProposalNotPassed"; - msg: "This proposal can't be executed because it isn't in the passed state"; - }, - { - code: 6010; - name: "InsufficientLiquidity"; - msg: "More liquidity needs to be in the AMM to launch this proposal"; - }, - { - code: 6011; - name: "ProposalDurationTooShort"; - msg: "Proposal duration must be longer 1 day and longer than 2 times the TWAP start delay"; - }, - { - code: 6012; - name: "PassThresholdTooHigh"; - msg: "Pass threshold must be less than 10%"; - }, - { - code: 6013; - name: "QuestionMustBeBinary"; - msg: "Question must have exactly 2 outcomes for binary futarchy"; - }, - { - code: 6014; - name: "InvalidSquadsProposalStatus"; - msg: "Squads proposal must be in Draft status"; - }, - { - code: 6015; - name: "CastingOverflow"; - msg: "Casting overflow. If you're seeing this, please report this"; - }, - { - code: 6016; - name: "InsufficientBalance"; - msg: "Insufficient balance"; - }, - { - code: 6017; - name: "ZeroLiquidityRemove"; - msg: "Cannot remove zero liquidity"; - }, - { - code: 6018; - name: "SwapSlippageExceeded"; - msg: "Swap slippage exceeded"; - }, - { - code: 6019; - name: "AssertFailed"; - msg: "Assert failed"; - }, - { - code: 6020; - name: "InvalidAdmin"; - msg: "Invalid admin"; - }, - { - code: 6021; - name: "ProposalNotInDraftState"; - msg: "Proposal is not in draft state"; - }, - { - code: 6022; - name: "InsufficientTokenBalance"; - msg: "Insufficient token balance"; - }, - { - code: 6023; - name: "InvalidAmount"; - msg: "Invalid amount"; - }, - { - code: 6024; - name: "InsufficientStakeToLaunch"; - msg: "Insufficient stake to launch proposal"; - }, - { - code: 6025; - name: "StakerNotFound"; - msg: "Staker not found in proposal"; - }, - { - code: 6026; - name: "PoolNotInSpotState"; - msg: "Pool must be in spot state"; - }, - { - code: 6027; - name: "InvalidDaoCreateLiquidity"; - msg: "If you're providing liquidity, you must provide both base and quote token accounts"; - }, - { - code: 6028; - name: "InvalidStakeAccount"; - msg: "Invalid stake account"; - }, - { - code: 6029; - name: "InvariantViolated"; - msg: "An invariant was violated. You should get in contact with the MetaDAO team if you see this"; - }, - { - code: 6030; - name: "ProposalNotActive"; - msg: "Proposal needs to be active to perform a conditional swap"; - }, - { - code: 6031; - name: "InvalidTransaction"; - msg: "This Squads transaction should only contain calls to update spending limits"; - }, - { - code: 6032; - name: "ProposalAlreadySponsored"; - msg: "Proposal has already been sponsored"; - }, - { - code: 6033; - name: "InvalidTeamSponsoredPassThreshold"; - msg: "Team sponsored pass threshold must be between -10% and 10%"; - }, - { - code: 6034; - name: "InvalidTargetK"; - msg: "Target K must be greater than the current K"; - }, - { - code: 6035; - name: "InvalidTransactionMessage"; - msg: "Failed to compile transaction message for Squads vault transaction"; - }, - { - code: 6036; - name: "InvalidRecipient"; - msg: "Invalid recipient"; - }, - { - code: 6037; - name: "OptimisticGovernanceDisabled"; - msg: "Optimistic governance is disabled"; - }, - { - code: 6038; - name: "ActiveOptimisticProposalAlreadyEnqueued"; - msg: "An active optimistic proposal is already enqueued"; - }, - { - code: 6039; - name: "NoActiveOptimisticProposal"; - msg: "No active optimistic proposal"; - }, - { - code: 6040; - name: "OptimisticProposalAlreadyPassed"; - msg: "Optimistic proposal has already passed"; - }, - { - code: 6041; - name: "CannotSponsorOptimisticProposalChallenge"; - msg: "Team cannot sponsor a challenge to an optimistic proposal"; - }, - { - code: 6042; - name: "InvalidSpendingLimitMint"; - msg: "Invalid spending limit mint. Must be the same as the DAO's quote mint"; - }, - ]; -}; - -export const IDL: Futarchy = { - version: "0.6.1", - name: "futarchy", - instructions: [ - { - name: "initializeDao", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "daoCreator", - isMut: false, - isSigner: true, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigVault", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgram", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgramConfig", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgramConfigTreasury", - isMut: true, - isSigner: false, - }, - { - name: "spendingLimit", - isMut: true, - isSigner: false, - }, - { - name: "futarchyAmmBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "futarchyAmmQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "InitializeDaoParams", - }, - }, - ], - }, - { - name: "initializeProposal", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "squadsProposal", - isMut: false, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: false, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "question", - isMut: false, - isSigner: false, - }, - { - name: "quoteVault", - isMut: false, - isSigner: false, - }, - { - name: "baseVault", - isMut: false, - isSigner: false, - }, - { - name: "proposer", - isMut: false, - isSigner: true, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "stakeToProposal", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "stakerBaseAccount", - isMut: true, - isSigner: false, - }, - { - name: "proposalBaseAccount", - isMut: true, - isSigner: false, - }, - { - name: "stakeAccount", - isMut: true, - isSigner: false, - }, - { - name: "staker", - isMut: false, - isSigner: true, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "StakeToProposalParams", - }, - }, - ], - }, - { - name: "unstakeFromProposal", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "stakerBaseAccount", - isMut: true, - isSigner: false, - }, - { - name: "proposalBaseAccount", - isMut: true, - isSigner: false, - }, - { - name: "stakeAccount", - isMut: true, - isSigner: false, - }, - { - name: "staker", - isMut: false, - isSigner: true, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "UnstakeFromProposalParams", - }, - }, - ], - }, - { - name: "launchProposal", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "baseVault", - isMut: false, - isSigner: false, - }, - { - name: "quoteVault", - isMut: false, - isSigner: false, - }, - { - name: "passBaseMint", - isMut: false, - isSigner: false, - }, - { - name: "passQuoteMint", - isMut: false, - isSigner: false, - }, - { - name: "failBaseMint", - isMut: false, - isSigner: false, - }, - { - name: "failQuoteMint", - isMut: false, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "ammPassBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "ammPassQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "ammFailBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "ammFailQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: false, - isSigner: false, - }, - { - name: "squadsProposal", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "finalizeProposal", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "question", - isMut: true, - isSigner: false, - }, - { - name: "squadsProposal", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: false, - isSigner: false, - }, - { - name: "squadsMultisigProgram", - isMut: false, - isSigner: false, - }, - { - name: "ammPassBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "ammPassQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "ammFailBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "ammFailQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "ammBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "ammQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "vaultProgram", - isMut: false, - isSigner: false, - }, - { - name: "vaultEventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "quoteVault", - isMut: true, - isSigner: false, - }, - { - name: "quoteVaultUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "passQuoteMint", - isMut: true, - isSigner: false, - }, - { - name: "failQuoteMint", - isMut: true, - isSigner: false, - }, - { - name: "passBaseMint", - isMut: true, - isSigner: false, - }, - { - name: "failBaseMint", - isMut: true, - isSigner: false, - }, - { - name: "baseVault", - isMut: true, - isSigner: false, - }, - { - name: "baseVaultUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "updateDao", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigVault", - isMut: false, - isSigner: true, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "daoParams", - type: { - defined: "UpdateDaoParams", - }, - }, - ], - }, - { - name: "resizeDao", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "spotSwap", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "userBaseAccount", - isMut: true, - isSigner: false, - }, - { - name: "userQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "ammBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "ammQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "user", - isMut: false, - isSigner: true, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "SpotSwapParams", - }, - }, - ], - }, - { - name: "conditionalSwap", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "ammBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "ammQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "proposal", - isMut: false, - isSigner: false, - }, - { - name: "ammPassBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "ammPassQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "ammFailBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "ammFailQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "trader", - isMut: false, - isSigner: true, - }, - { - name: "userInputAccount", - isMut: true, - isSigner: false, - }, - { - name: "userOutputAccount", - isMut: true, - isSigner: false, - }, - { - name: "baseVault", - isMut: true, - isSigner: false, - }, - { - name: "baseVaultUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "quoteVault", - isMut: true, - isSigner: false, - }, - { - name: "quoteVaultUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "passBaseMint", - isMut: true, - isSigner: false, - }, - { - name: "failBaseMint", - isMut: true, - isSigner: false, - }, - { - name: "passQuoteMint", - isMut: true, - isSigner: false, - }, - { - name: "failQuoteMint", - isMut: true, - isSigner: false, - }, - { - name: "conditionalVaultProgram", - isMut: false, - isSigner: false, - }, - { - name: "vaultEventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "question", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "ConditionalSwapParams", - }, - }, - ], - }, - { - name: "provideLiquidity", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "liquidityProvider", - isMut: false, - isSigner: true, - }, - { - name: "liquidityProviderBaseAccount", - isMut: true, - isSigner: false, - }, - { - name: "liquidityProviderQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "ammBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "ammQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "ammPosition", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "ProvideLiquidityParams", - }, - }, - ], - }, - { - name: "withdrawLiquidity", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "positionAuthority", - isMut: false, - isSigner: true, - }, - { - name: "liquidityProviderBaseAccount", - isMut: true, - isSigner: false, - }, - { - name: "liquidityProviderQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "ammBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "ammQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "ammPosition", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "WithdrawLiquidityParams", - }, - }, - ], - }, - { - name: "collectFees", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "admin", - isMut: false, - isSigner: true, - }, - { - name: "baseTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "quoteTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "ammBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "ammQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "executeSpendingLimitChange", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "squadsProposal", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: false, - isSigner: false, - }, - { - name: "squadsMultisigProgram", - isMut: false, - isSigner: false, - }, - { - name: "vaultTransaction", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "sponsorProposal", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "teamAddress", - isMut: false, - isSigner: true, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "collectMeteoraDammFees", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "admin", - isMut: true, - isSigner: true, - }, - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigVault", - isMut: false, - isSigner: false, - }, - { - name: "squadsMultisigVaultTransaction", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigProposal", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigPermissionlessAccount", - isMut: false, - isSigner: true, - }, - { - name: "meteoraClaimPositionFeesAccounts", - accounts: [ - { - name: "dammV2Program", - isMut: false, - isSigner: false, - }, - { - name: "dammV2EventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "poolAuthority", - isMut: false, - isSigner: false, - }, - { - name: "pool", - isMut: false, - isSigner: false, - }, - { - name: "position", - isMut: true, - isSigner: false, - }, - { - name: "tokenAAccount", - isMut: true, - isSigner: false, - docs: ["Token account of base tokens recipient"], - }, - { - name: "tokenBAccount", - isMut: true, - isSigner: false, - docs: ["Token account of quote tokens recipient"], - }, - { - name: "tokenAVault", - isMut: true, - isSigner: false, - }, - { - name: "tokenBVault", - isMut: true, - isSigner: false, - }, - { - name: "tokenAMint", - isMut: false, - isSigner: false, - }, - { - name: "tokenBMint", - isMut: false, - isSigner: false, - }, - { - name: "positionNftAccount", - isMut: false, - isSigner: false, - }, - { - name: "owner", - isMut: false, - isSigner: false, - }, - { - name: "tokenAProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenBProgram", - isMut: false, - isSigner: false, - }, - ], - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "initiateVaultSpendOptimisticProposal", - accounts: [ - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigVault", - isMut: false, - isSigner: false, - }, - { - name: "squadsSpendingLimit", - isMut: false, - isSigner: false, - }, - { - name: "squadsProposal", - isMut: true, - isSigner: false, - }, - { - name: "squadsVaultTransaction", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigPermissionlessAccount", - isMut: false, - isSigner: true, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "daoQuoteVaultAccount", - isMut: true, - isSigner: false, - }, - { - name: "proposer", - isMut: true, - isSigner: true, - }, - { - name: "recipient", - isMut: false, - isSigner: false, - }, - { - name: "recipientQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "InitiateVaultSpendOptimisticProposalParams", - }, - }, - ], - }, - { - name: "finalizeOptimisticProposal", - accounts: [ - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "squadsProposal", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "squadsProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "adminApproveExecuteMultisigProposal", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "admin", - isMut: true, - isSigner: true, - }, - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigProposal", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigVaultTransaction", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "ammPosition", - type: { - kind: "struct", - fields: [ - { - name: "dao", - type: "publicKey", - }, - { - name: "positionAuthority", - type: "publicKey", - }, - { - name: "liquidity", - type: "u128", - }, - ], - }, - }, - { - name: "dao", - type: { - kind: "struct", - fields: [ - { - name: "amm", - docs: ["Embedded FutarchyAmm - 1:1 relationship"], - type: { - defined: "FutarchyAmm", - }, - }, - { - name: "nonce", - docs: ["`nonce` + `dao_creator` are PDA seeds"], - type: "u64", - }, - { - name: "daoCreator", - type: "publicKey", - }, - { - name: "pdaBump", - type: "u8", - }, - { - name: "squadsMultisig", - type: "publicKey", - }, - { - name: "squadsMultisigVault", - type: "publicKey", - }, - { - name: "baseMint", - type: "publicKey", - }, - { - name: "quoteMint", - type: "publicKey", - }, - { - name: "proposalCount", - type: "u32", - }, - { - name: "passThresholdBps", - type: "u16", - }, - { - name: "secondsPerProposal", - type: "u32", - }, - { - name: "twapInitialObservation", - docs: [ - "For manipulation-resistance the TWAP is a time-weighted average observation,", - "where observation tries to approximate price but can only move by", - "`twap_max_observation_change_per_update` per update. Because it can only move", - "a little bit per update, you need to check that it has a good initial observation.", - "Otherwise, an attacker could create a very high initial observation in the pass", - "market and a very low one in the fail market to force the proposal to pass.", - "", - "We recommend setting an initial observation around the spot price of the token,", - "and max observation change per update around 2% the spot price of the token.", - "For example, if the spot price of META is $400, we'd recommend setting an initial", - "observation of 400 (converted into the AMM prices) and a max observation change per", - "update of 8 (also converted into the AMM prices). Observations can be updated once", - "a minute, so 2% allows the proposal market to reach double the spot price or 0", - "in 50 minutes.", - ], - type: "u128", - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - }, - { - name: "twapStartDelaySeconds", - docs: [ - "Forces TWAP calculation to start after `twap_start_delay_seconds` seconds", - ], - type: "u32", - }, - { - name: "minQuoteFutarchicLiquidity", - docs: [ - "As an anti-spam measure and to help liquidity, you need to lock up some liquidity", - "in both futarchic markets in order to create a proposal.", - "", - "For example, for META, we can use a `min_quote_futarchic_liquidity` of", - "5000 * 1_000_000 (5000 USDC) and a `min_base_futarchic_liquidity` of", - "10 * 1_000_000_000 (10 META).", - ], - type: "u64", - }, - { - name: "minBaseFutarchicLiquidity", - type: "u64", - }, - { - name: "baseToStake", - docs: [ - "Minimum amount of base tokens that must be staked to launch a proposal", - ], - type: "u64", - }, - { - name: "seqNum", - type: "u64", - }, - { - name: "initialSpendingLimit", - type: { - option: { - defined: "InitialSpendingLimit", - }, - }, - }, - { - name: "teamSponsoredPassThresholdBps", - docs: [ - "The percentage, in basis points, the pass price needs to be above the", - "fail price in order for the proposal to pass for team-sponsored proposals.", - "", - "Can be negative to allow for team-sponsored proposals to pass by default.", - ], - type: "i16", - }, - { - name: "teamAddress", - type: "publicKey", - }, - { - name: "optimisticProposal", - type: { - option: { - defined: "OptimisticProposal", - }, - }, - }, - { - name: "isOptimisticGovernanceEnabled", - type: "bool", - }, - ], - }, - }, - { - name: "oldDao", - type: { - kind: "struct", - fields: [ - { - name: "amm", - docs: ["Embedded FutarchyAmm - 1:1 relationship"], - type: { - defined: "FutarchyAmm", - }, - }, - { - name: "nonce", - docs: ["`nonce` + `dao_creator` are PDA seeds"], - type: "u64", - }, - { - name: "daoCreator", - type: "publicKey", - }, - { - name: "pdaBump", - type: "u8", - }, - { - name: "squadsMultisig", - type: "publicKey", - }, - { - name: "squadsMultisigVault", - type: "publicKey", - }, - { - name: "baseMint", - type: "publicKey", - }, - { - name: "quoteMint", - type: "publicKey", - }, - { - name: "proposalCount", - type: "u32", - }, - { - name: "passThresholdBps", - type: "u16", - }, - { - name: "secondsPerProposal", - type: "u32", - }, - { - name: "twapInitialObservation", - docs: [ - "For manipulation-resistance the TWAP is a time-weighted average observation,", - "where observation tries to approximate price but can only move by", - "`twap_max_observation_change_per_update` per update. Because it can only move", - "a little bit per update, you need to check that it has a good initial observation.", - "Otherwise, an attacker could create a very high initial observation in the pass", - "market and a very low one in the fail market to force the proposal to pass.", - "", - "We recommend setting an initial observation around the spot price of the token,", - "and max observation change per update around 2% the spot price of the token.", - "For example, if the spot price of META is $400, we'd recommend setting an initial", - "observation of 400 (converted into the AMM prices) and a max observation change per", - "update of 8 (also converted into the AMM prices). Observations can be updated once", - "a minute, so 2% allows the proposal market to reach double the spot price or 0", - "in 50 minutes.", - ], - type: "u128", - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - }, - { - name: "twapStartDelaySeconds", - docs: [ - "Forces TWAP calculation to start after `twap_start_delay_seconds` seconds", - ], - type: "u32", - }, - { - name: "minQuoteFutarchicLiquidity", - docs: [ - "As an anti-spam measure and to help liquidity, you need to lock up some liquidity", - "in both futarchic markets in order to create a proposal.", - "", - "For example, for META, we can use a `min_quote_futarchic_liquidity` of", - "5000 * 1_000_000 (5000 USDC) and a `min_base_futarchic_liquidity` of", - "10 * 1_000_000_000 (10 META).", - ], - type: "u64", - }, - { - name: "minBaseFutarchicLiquidity", - type: "u64", - }, - { - name: "baseToStake", - docs: [ - "Minimum amount of base tokens that must be staked to launch a proposal", - ], - type: "u64", - }, - { - name: "seqNum", - type: "u64", - }, - { - name: "initialSpendingLimit", - type: { - option: { - defined: "InitialSpendingLimit", - }, - }, - }, - { - name: "teamSponsoredPassThresholdBps", - docs: [ - "The percentage, in basis points, the pass price needs to be above the", - "fail price in order for the proposal to pass for team-sponsored proposals.", - "", - "Can be negative to allow for team-sponsored proposals to pass by default.", - ], - type: "i16", - }, - { - name: "teamAddress", - type: "publicKey", - }, - ], - }, - }, - { - name: "proposal", - type: { - kind: "struct", - fields: [ - { - name: "number", - type: "u32", - }, - { - name: "proposer", - type: "publicKey", - }, - { - name: "timestampEnqueued", - type: "i64", - }, - { - name: "state", - type: { - defined: "ProposalState", - }, - }, - { - name: "baseVault", - type: "publicKey", - }, - { - name: "quoteVault", - type: "publicKey", - }, - { - name: "dao", - type: "publicKey", - }, - { - name: "pdaBump", - type: "u8", - }, - { - name: "question", - type: "publicKey", - }, - { - name: "durationInSeconds", - type: "u32", - }, - { - name: "squadsProposal", - type: "publicKey", - }, - { - name: "passBaseMint", - type: "publicKey", - }, - { - name: "passQuoteMint", - type: "publicKey", - }, - { - name: "failBaseMint", - type: "publicKey", - }, - { - name: "failQuoteMint", - type: "publicKey", - }, - { - name: "isTeamSponsored", - type: "bool", - }, - ], - }, - }, - { - name: "stakeAccount", - type: { - kind: "struct", - fields: [ - { - name: "proposal", - type: "publicKey", - }, - { - name: "staker", - type: "publicKey", - }, - { - name: "amount", - type: "u64", - }, - { - name: "bump", - type: "u8", - }, - ], - }, - }, - ], - types: [ - { - name: "CommonFields", - type: { - kind: "struct", - fields: [ - { - name: "slot", - type: "u64", - }, - { - name: "unixTimestamp", - type: "i64", - }, - { - name: "daoSeqNum", - type: "u64", - }, - ], - }, - }, - { - name: "ConditionalSwapParams", - type: { - kind: "struct", - fields: [ - { - name: "market", - type: { - defined: "Market", - }, - }, - { - name: "swapType", - type: { - defined: "SwapType", - }, - }, - { - name: "inputAmount", - type: "u64", - }, - { - name: "minOutputAmount", - type: "u64", - }, - ], - }, - }, - { - name: "InitializeDaoParams", - type: { - kind: "struct", - fields: [ - { - name: "twapInitialObservation", - type: "u128", - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - }, - { - name: "twapStartDelaySeconds", - type: "u32", - }, - { - name: "minQuoteFutarchicLiquidity", - type: "u64", - }, - { - name: "minBaseFutarchicLiquidity", - type: "u64", - }, - { - name: "baseToStake", - type: "u64", - }, - { - name: "passThresholdBps", - type: "u16", - }, - { - name: "secondsPerProposal", - type: "u32", - }, - { - name: "nonce", - type: "u64", - }, - { - name: "initialSpendingLimit", - type: { - option: { - defined: "InitialSpendingLimit", - }, - }, - }, - { - name: "teamSponsoredPassThresholdBps", - type: "i16", - }, - { - name: "teamAddress", - type: "publicKey", - }, - ], - }, - }, - { - name: "InitiateVaultSpendOptimisticProposalParams", - type: { - kind: "struct", - fields: [ - { - name: "amount", - type: "u64", - }, - ], - }, - }, - { - name: "ProvideLiquidityParams", - type: { - kind: "struct", - fields: [ - { - name: "quoteAmount", - docs: ["How much quote token you will deposit to the pool"], - type: "u64", - }, - { - name: "maxBaseAmount", - docs: ["The maximum base token you will deposit to the pool"], - type: "u64", - }, - { - name: "minLiquidity", - docs: ["The minimum liquidity you will be assigned"], - type: "u128", - }, - { - name: "positionAuthority", - docs: [ - "The account that will own the LP position, usually the same as the", - "liquidity provider", - ], - type: "publicKey", - }, - ], - }, - }, - { - name: "SpotSwapParams", - type: { - kind: "struct", - fields: [ - { - name: "inputAmount", - type: "u64", - }, - { - name: "swapType", - type: { - defined: "SwapType", - }, - }, - { - name: "minOutputAmount", - type: "u64", - }, - ], - }, - }, - { - name: "StakeToProposalParams", - type: { - kind: "struct", - fields: [ - { - name: "amount", - type: "u64", - }, - ], - }, - }, - { - name: "UnstakeFromProposalParams", - type: { - kind: "struct", - fields: [ - { - name: "amount", - type: "u64", - }, - ], - }, - }, - { - name: "UpdateDaoParams", - type: { - kind: "struct", - fields: [ - { - name: "passThresholdBps", - type: { - option: "u16", - }, - }, - { - name: "secondsPerProposal", - type: { - option: "u32", - }, - }, - { - name: "twapInitialObservation", - type: { - option: "u128", - }, - }, - { - name: "twapMaxObservationChangePerUpdate", - type: { - option: "u128", - }, - }, - { - name: "twapStartDelaySeconds", - type: { - option: "u32", - }, - }, - { - name: "minQuoteFutarchicLiquidity", - type: { - option: "u64", - }, - }, - { - name: "minBaseFutarchicLiquidity", - type: { - option: "u64", - }, - }, - { - name: "baseToStake", - type: { - option: "u64", - }, - }, - { - name: "teamSponsoredPassThresholdBps", - type: { - option: "i16", - }, - }, - { - name: "teamAddress", - type: { - option: "publicKey", - }, - }, - { - name: "isOptimisticGovernanceEnabled", - type: { - option: "bool", - }, - }, - ], - }, - }, - { - name: "WithdrawLiquidityParams", - type: { - kind: "struct", - fields: [ - { - name: "liquidityToWithdraw", - docs: ["How much liquidity to withdraw"], - type: "u128", - }, - { - name: "minBaseAmount", - docs: ["Minimum base tokens to receive"], - type: "u64", - }, - { - name: "minQuoteAmount", - docs: ["Minimum quote tokens to receive"], - type: "u64", - }, - ], - }, - }, - { - name: "OptimisticProposal", - type: { - kind: "struct", - fields: [ - { - name: "squadsProposal", - docs: [ - "The squads proposal currently enqueued for execution if not challenged by a new proposal.", - ], - type: "publicKey", - }, - { - name: "enqueuedTimestamp", - docs: [ - "The timestamp when the active optimistic squads proposal was enqueued.", - ], - type: "i64", - }, - ], - }, - }, - { - name: "InitialSpendingLimit", - type: { - kind: "struct", - fields: [ - { - name: "amountPerMonth", - type: "u64", - }, - { - name: "members", - type: { - vec: "publicKey", - }, - }, - ], - }, - }, - { - name: "FutarchyAmm", - type: { - kind: "struct", - fields: [ - { - name: "state", - type: { - defined: "PoolState", - }, - }, - { - name: "totalLiquidity", - type: "u128", - }, - { - name: "baseMint", - type: "publicKey", - }, - { - name: "quoteMint", - type: "publicKey", - }, - { - name: "ammBaseVault", - type: "publicKey", - }, - { - name: "ammQuoteVault", - type: "publicKey", - }, - ], - }, - }, - { - name: "TwapOracle", - type: { - kind: "struct", - fields: [ - { - name: "aggregator", - docs: [ - "Running sum of slots_per_last_update * last_observation.", - "", - "Assuming latest observations are as big as possible (u64::MAX * 1e12),", - "we can store 18 million slots worth of observations, which turns out to", - "be ~85 days worth of slots.", - "", - "Assuming that latest observations are 100x smaller than they could theoretically", - "be, we can store 8500 days (23 years) worth of them. Even this is a very", - "very conservative assumption - META/USDC prices should be between 1e9 and", - "1e15, which would overflow after 1e15 years worth of slots.", - "", - "So in the case of an overflow, the aggregator rolls back to 0. It's the", - "client's responsibility to sanity check the assets or to handle an", - "aggregator at T2 being smaller than an aggregator at T1.", - ], - type: "u128", - }, - { - name: "lastUpdatedTimestamp", - type: "i64", - }, - { - name: "createdAtTimestamp", - type: "i64", - }, - { - name: "lastPrice", - docs: [ - "A price is the number of quote units per base unit multiplied by 1e12.", - "You cannot simply divide by 1e12 to get a price you can display in the UI", - "because the base and quote decimals may be different. Instead, do:", - "ui_price = (price * (10**(base_decimals - quote_decimals))) / 1e12", - ], - type: "u128", - }, - { - name: "lastObservation", - docs: [ - "If we did a raw TWAP over prices, someone could push the TWAP heavily with", - "a few extremely large outliers. So we use observations, which can only move", - "by `max_observation_change_per_update` per update.", - ], - type: "u128", - }, - { - name: "maxObservationChangePerUpdate", - docs: ["The most that an observation can change per update."], - type: "u128", - }, - { - name: "initialObservation", - docs: ["What the initial `latest_observation` is set to."], - type: "u128", - }, - { - name: "startDelaySeconds", - docs: [ - "Number of seconds after amm.created_at_slot to start recording TWAP", - ], - type: "u32", - }, - ], - }, - }, - { - name: "Pool", - type: { - kind: "struct", - fields: [ - { - name: "oracle", - type: { - defined: "TwapOracle", - }, - }, - { - name: "quoteReserves", - type: "u64", - }, - { - name: "baseReserves", - type: "u64", - }, - { - name: "quoteProtocolFeeBalance", - type: "u64", - }, - { - name: "baseProtocolFeeBalance", - type: "u64", - }, - ], - }, - }, - { - name: "PoolState", - type: { - kind: "enum", - variants: [ - { - name: "Spot", - fields: [ - { - name: "spot", - type: { - defined: "Pool", - }, - }, - ], - }, - { - name: "Futarchy", - fields: [ - { - name: "spot", - type: { - defined: "Pool", - }, - }, - { - name: "pass", - type: { - defined: "Pool", - }, - }, - { - name: "fail", - type: { - defined: "Pool", - }, - }, - ], - }, - ], - }, - }, - { - name: "Market", - type: { - kind: "enum", - variants: [ - { - name: "Spot", - }, - { - name: "Pass", - }, - { - name: "Fail", - }, - ], - }, - }, - { - name: "SwapType", - type: { - kind: "enum", - variants: [ - { - name: "Buy", - }, - { - name: "Sell", - }, - ], - }, - }, - { - name: "Token", - type: { - kind: "enum", - variants: [ - { - name: "Base", - }, - { - name: "Quote", - }, - ], - }, - }, - { - name: "ProposalState", - type: { - kind: "enum", - variants: [ - { - name: "Draft", - fields: [ - { - name: "amountStaked", - type: "u64", - }, - ], - }, - { - name: "Pending", - }, - { - name: "Passed", - }, - { - name: "Failed", - }, - ], - }, - }, - ], - events: [ - { - name: "CollectFeesEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "baseTokenAccount", - type: "publicKey", - index: false, - }, - { - name: "quoteTokenAccount", - type: "publicKey", - index: false, - }, - { - name: "ammBaseVault", - type: "publicKey", - index: false, - }, - { - name: "ammQuoteVault", - type: "publicKey", - index: false, - }, - { - name: "quoteMint", - type: "publicKey", - index: false, - }, - { - name: "baseMint", - type: "publicKey", - index: false, - }, - { - name: "quoteFeesCollected", - type: "u64", - index: false, - }, - { - name: "baseFeesCollected", - type: "u64", - index: false, - }, - { - name: "postAmmState", - type: { - defined: "FutarchyAmm", - }, - index: false, - }, - ], - }, - { - name: "InitializeDaoEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "baseMint", - type: "publicKey", - index: false, - }, - { - name: "quoteMint", - type: "publicKey", - index: false, - }, - { - name: "passThresholdBps", - type: "u16", - index: false, - }, - { - name: "secondsPerProposal", - type: "u32", - index: false, - }, - { - name: "twapInitialObservation", - type: "u128", - index: false, - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - index: false, - }, - { - name: "twapStartDelaySeconds", - type: "u32", - index: false, - }, - { - name: "minQuoteFutarchicLiquidity", - type: "u64", - index: false, - }, - { - name: "minBaseFutarchicLiquidity", - type: "u64", - index: false, - }, - { - name: "baseToStake", - type: "u64", - index: false, - }, - { - name: "initialSpendingLimit", - type: { - option: { - defined: "InitialSpendingLimit", - }, - }, - index: false, - }, - { - name: "squadsMultisig", - type: "publicKey", - index: false, - }, - { - name: "squadsMultisigVault", - type: "publicKey", - index: false, - }, - { - name: "teamSponsoredPassThresholdBps", - type: "i16", - index: false, - }, - { - name: "teamAddress", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "UpdateDaoEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "passThresholdBps", - type: "u16", - index: false, - }, - { - name: "secondsPerProposal", - type: "u32", - index: false, - }, - { - name: "twapInitialObservation", - type: "u128", - index: false, - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - index: false, - }, - { - name: "twapStartDelaySeconds", - type: "u32", - index: false, - }, - { - name: "minQuoteFutarchicLiquidity", - type: "u64", - index: false, - }, - { - name: "minBaseFutarchicLiquidity", - type: "u64", - index: false, - }, - { - name: "baseToStake", - type: "u64", - index: false, - }, - { - name: "teamSponsoredPassThresholdBps", - type: "i16", - index: false, - }, - { - name: "teamAddress", - type: "publicKey", - index: false, - }, - { - name: "isOptimisticGovernanceEnabled", - type: "bool", - index: false, - }, - ], - }, - { - name: "InitializeProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "proposal", - type: "publicKey", - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "question", - type: "publicKey", - index: false, - }, - { - name: "quoteVault", - type: "publicKey", - index: false, - }, - { - name: "baseVault", - type: "publicKey", - index: false, - }, - { - name: "proposer", - type: "publicKey", - index: false, - }, - { - name: "number", - type: "u32", - index: false, - }, - { - name: "pdaBump", - type: "u8", - index: false, - }, - { - name: "durationInSeconds", - type: "u32", - index: false, - }, - { - name: "squadsProposal", - type: "publicKey", - index: false, - }, - { - name: "squadsMultisig", - type: "publicKey", - index: false, - }, - { - name: "squadsMultisigVault", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "StakeToProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "proposal", - type: "publicKey", - index: false, - }, - { - name: "staker", - type: "publicKey", - index: false, - }, - { - name: "amount", - type: "u64", - index: false, - }, - { - name: "totalStaked", - type: "u64", - index: false, - }, - ], - }, - { - name: "UnstakeFromProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "proposal", - type: "publicKey", - index: false, - }, - { - name: "staker", - type: "publicKey", - index: false, - }, - { - name: "amount", - type: "u64", - index: false, - }, - { - name: "totalStaked", - type: "u64", - index: false, - }, - ], - }, - { - name: "LaunchProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "proposal", - type: "publicKey", - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "timestampEnqueued", - type: "i64", - index: false, - }, - { - name: "totalStaked", - type: "u64", - index: false, - }, - { - name: "postAmmState", - type: { - defined: "FutarchyAmm", - }, - index: false, - }, - ], - }, - { - name: "FinalizeProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "proposal", - type: "publicKey", - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "passMarketTwap", - type: "u128", - index: false, - }, - { - name: "failMarketTwap", - type: "u128", - index: false, - }, - { - name: "threshold", - type: "u128", - index: false, - }, - { - name: "state", - type: { - defined: "ProposalState", - }, - index: false, - }, - { - name: "squadsProposal", - type: "publicKey", - index: false, - }, - { - name: "squadsMultisig", - type: "publicKey", - index: false, - }, - { - name: "postAmmState", - type: { - defined: "FutarchyAmm", - }, - index: false, - }, - { - name: "isTeamSponsored", - type: "bool", - index: false, - }, - ], - }, - { - name: "SpotSwapEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "user", - type: "publicKey", - index: false, - }, - { - name: "swapType", - type: { - defined: "SwapType", - }, - index: false, - }, - { - name: "inputAmount", - type: "u64", - index: false, - }, - { - name: "outputAmount", - type: "u64", - index: false, - }, - { - name: "minOutputAmount", - type: "u64", - index: false, - }, - { - name: "postAmmState", - type: { - defined: "FutarchyAmm", - }, - index: false, - }, - ], - }, - { - name: "ConditionalSwapEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "proposal", - type: "publicKey", - index: false, - }, - { - name: "trader", - type: "publicKey", - index: false, - }, - { - name: "market", - type: { - defined: "Market", - }, - index: false, - }, - { - name: "swapType", - type: { - defined: "SwapType", - }, - index: false, - }, - { - name: "inputAmount", - type: "u64", - index: false, - }, - { - name: "outputAmount", - type: "u64", - index: false, - }, - { - name: "minOutputAmount", - type: "u64", - index: false, - }, - { - name: "postAmmState", - type: { - defined: "FutarchyAmm", - }, - index: false, - }, - ], - }, - { - name: "ProvideLiquidityEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "liquidityProvider", - type: "publicKey", - index: false, - }, - { - name: "positionAuthority", - type: "publicKey", - index: false, - }, - { - name: "quoteAmount", - type: "u64", - index: false, - }, - { - name: "baseAmount", - type: "u64", - index: false, - }, - { - name: "liquidityMinted", - type: "u128", - index: false, - }, - { - name: "minLiquidity", - type: "u128", - index: false, - }, - { - name: "postAmmState", - type: { - defined: "FutarchyAmm", - }, - index: false, - }, - ], - }, - { - name: "WithdrawLiquidityEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "liquidityProvider", - type: "publicKey", - index: false, - }, - { - name: "liquidityWithdrawn", - type: "u128", - index: false, - }, - { - name: "minBaseAmount", - type: "u64", - index: false, - }, - { - name: "minQuoteAmount", - type: "u64", - index: false, - }, - { - name: "baseAmount", - type: "u64", - index: false, - }, - { - name: "quoteAmount", - type: "u64", - index: false, - }, - { - name: "postAmmState", - type: { - defined: "FutarchyAmm", - }, - index: false, - }, - ], - }, - { - name: "SponsorProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "proposal", - type: "publicKey", - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "teamAddress", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "CollectMeteoraDammFeesEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "pool", - type: "publicKey", - index: false, - }, - { - name: "baseTokenAccount", - type: "publicKey", - index: false, - }, - { - name: "quoteTokenAccount", - type: "publicKey", - index: false, - }, - { - name: "quoteMint", - type: "publicKey", - index: false, - }, - { - name: "baseMint", - type: "publicKey", - index: false, - }, - { - name: "quoteFeesCollected", - type: "u64", - index: false, - }, - { - name: "baseFeesCollected", - type: "u64", - index: false, - }, - ], - }, - { - name: "InitiateVaultSpendOptimisticProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "proposer", - type: "publicKey", - index: false, - }, - { - name: "squadsProposal", - type: "publicKey", - index: false, - }, - { - name: "squadsMultisig", - type: "publicKey", - index: false, - }, - { - name: "squadsMultisigVault", - type: "publicKey", - index: false, - }, - { - name: "amount", - type: "u64", - index: false, - }, - { - name: "recipient", - type: "publicKey", - index: false, - }, - { - name: "daoQuoteVaultAccount", - type: "publicKey", - index: false, - }, - { - name: "recipientQuoteAccount", - type: "publicKey", - index: false, - }, - { - name: "enqueuedTimestamp", - type: "i64", - index: false, - }, - ], - }, - { - name: "FinalizeOptimisticProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "squadsProposal", - type: "publicKey", - index: false, - }, - ], - }, - ], - errors: [ - { - code: 6000, - name: "AmmTooOld", - msg: "Amms must have been created within 5 minutes (counted in slots) of proposal initialization", - }, - { - code: 6001, - name: "InvalidInitialObservation", - msg: "An amm has an `initial_observation` that doesn't match the `dao`'s config", - }, - { - code: 6002, - name: "InvalidMaxObservationChange", - msg: "An amm has a `max_observation_change_per_update` that doesn't match the `dao`'s config", - }, - { - code: 6003, - name: "InvalidStartDelaySlots", - msg: "An amm has a `start_delay_slots` that doesn't match the `dao`'s config", - }, - { - code: 6004, - name: "InvalidSettlementAuthority", - msg: "One of the vaults has an invalid `settlement_authority`", - }, - { - code: 6005, - name: "ProposalTooYoung", - msg: "Proposal is too young to be executed or rejected", - }, - { - code: 6006, - name: "MarketsTooYoung", - msg: "Markets too young for proposal to be finalized. TWAP might need to be cranked", - }, - { - code: 6007, - name: "ProposalAlreadyFinalized", - msg: "This proposal has already been finalized", - }, - { - code: 6008, - name: "InvalidVaultNonce", - msg: "A conditional vault has an invalid nonce. A nonce should encode the proposal number", - }, - { - code: 6009, - name: "ProposalNotPassed", - msg: "This proposal can't be executed because it isn't in the passed state", - }, - { - code: 6010, - name: "InsufficientLiquidity", - msg: "More liquidity needs to be in the AMM to launch this proposal", - }, - { - code: 6011, - name: "ProposalDurationTooShort", - msg: "Proposal duration must be longer 1 day and longer than 2 times the TWAP start delay", - }, - { - code: 6012, - name: "PassThresholdTooHigh", - msg: "Pass threshold must be less than 10%", - }, - { - code: 6013, - name: "QuestionMustBeBinary", - msg: "Question must have exactly 2 outcomes for binary futarchy", - }, - { - code: 6014, - name: "InvalidSquadsProposalStatus", - msg: "Squads proposal must be in Draft status", - }, - { - code: 6015, - name: "CastingOverflow", - msg: "Casting overflow. If you're seeing this, please report this", - }, - { - code: 6016, - name: "InsufficientBalance", - msg: "Insufficient balance", - }, - { - code: 6017, - name: "ZeroLiquidityRemove", - msg: "Cannot remove zero liquidity", - }, - { - code: 6018, - name: "SwapSlippageExceeded", - msg: "Swap slippage exceeded", - }, - { - code: 6019, - name: "AssertFailed", - msg: "Assert failed", - }, - { - code: 6020, - name: "InvalidAdmin", - msg: "Invalid admin", - }, - { - code: 6021, - name: "ProposalNotInDraftState", - msg: "Proposal is not in draft state", - }, - { - code: 6022, - name: "InsufficientTokenBalance", - msg: "Insufficient token balance", - }, - { - code: 6023, - name: "InvalidAmount", - msg: "Invalid amount", - }, - { - code: 6024, - name: "InsufficientStakeToLaunch", - msg: "Insufficient stake to launch proposal", - }, - { - code: 6025, - name: "StakerNotFound", - msg: "Staker not found in proposal", - }, - { - code: 6026, - name: "PoolNotInSpotState", - msg: "Pool must be in spot state", - }, - { - code: 6027, - name: "InvalidDaoCreateLiquidity", - msg: "If you're providing liquidity, you must provide both base and quote token accounts", - }, - { - code: 6028, - name: "InvalidStakeAccount", - msg: "Invalid stake account", - }, - { - code: 6029, - name: "InvariantViolated", - msg: "An invariant was violated. You should get in contact with the MetaDAO team if you see this", - }, - { - code: 6030, - name: "ProposalNotActive", - msg: "Proposal needs to be active to perform a conditional swap", - }, - { - code: 6031, - name: "InvalidTransaction", - msg: "This Squads transaction should only contain calls to update spending limits", - }, - { - code: 6032, - name: "ProposalAlreadySponsored", - msg: "Proposal has already been sponsored", - }, - { - code: 6033, - name: "InvalidTeamSponsoredPassThreshold", - msg: "Team sponsored pass threshold must be between -10% and 10%", - }, - { - code: 6034, - name: "InvalidTargetK", - msg: "Target K must be greater than the current K", - }, - { - code: 6035, - name: "InvalidTransactionMessage", - msg: "Failed to compile transaction message for Squads vault transaction", - }, - { - code: 6036, - name: "InvalidRecipient", - msg: "Invalid recipient", - }, - { - code: 6037, - name: "OptimisticGovernanceDisabled", - msg: "Optimistic governance is disabled", - }, - { - code: 6038, - name: "ActiveOptimisticProposalAlreadyEnqueued", - msg: "An active optimistic proposal is already enqueued", - }, - { - code: 6039, - name: "NoActiveOptimisticProposal", - msg: "No active optimistic proposal", - }, - { - code: 6040, - name: "OptimisticProposalAlreadyPassed", - msg: "Optimistic proposal has already passed", - }, - { - code: 6041, - name: "CannotSponsorOptimisticProposalChallenge", - msg: "Team cannot sponsor a challenge to an optimistic proposal", - }, - { - code: 6042, - name: "InvalidSpendingLimitMint", - msg: "Invalid spending limit mint. Must be the same as the DAO's quote mint", - }, - ], -}; diff --git a/sdk/src/v0.6/types/futarchy_amm.ts b/sdk/src/v0.6/types/futarchy_amm.ts deleted file mode 100644 index c1aef0d19..000000000 --- a/sdk/src/v0.6/types/futarchy_amm.ts +++ /dev/null @@ -1,1663 +0,0 @@ -export type FutarchyAmm = { - version: "0.4.1"; - name: "futarchy_amm"; - instructions: [ - { - name: "createAmm"; - accounts: [ - { - name: "user"; - isMut: true; - isSigner: true; - }, - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "lpMint"; - isMut: true; - isSigner: false; - }, - { - name: "baseMint"; - isMut: false; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "vaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "CreateAmmArgs"; - }; - }, - ]; - }, - { - name: "addLiquidity"; - accounts: [ - { - name: "user"; - isMut: true; - isSigner: true; - }, - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "lpMint"; - isMut: true; - isSigner: false; - }, - { - name: "userLpAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userBaseAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "AddLiquidityArgs"; - }; - }, - ]; - }, - { - name: "removeLiquidity"; - accounts: [ - { - name: "user"; - isMut: true; - isSigner: true; - }, - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "lpMint"; - isMut: true; - isSigner: false; - }, - { - name: "userLpAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userBaseAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "RemoveLiquidityArgs"; - }; - }, - ]; - }, - { - name: "swap"; - accounts: [ - { - name: "user"; - isMut: true; - isSigner: true; - }, - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "userBaseAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "SwapArgs"; - }; - }, - ]; - }, - { - name: "crankThatTwap"; - accounts: [ - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - ]; - accounts: [ - { - name: "amm"; - type: { - kind: "struct"; - fields: [ - { - name: "bump"; - type: "u8"; - }, - { - name: "createdAtSlot"; - type: "u64"; - }, - { - name: "lpMint"; - type: "publicKey"; - }, - { - name: "baseMint"; - type: "publicKey"; - }, - { - name: "quoteMint"; - type: "publicKey"; - }, - { - name: "baseMintDecimals"; - type: "u8"; - }, - { - name: "quoteMintDecimals"; - type: "u8"; - }, - { - name: "baseAmount"; - type: "u64"; - }, - { - name: "quoteAmount"; - type: "u64"; - }, - { - name: "oracle"; - type: { - defined: "TwapOracle"; - }; - }, - { - name: "seqNum"; - type: "u64"; - }, - { - name: "vaultAtaBase"; - type: "publicKey"; - }, - { - name: "vaultAtaQuote"; - type: "publicKey"; - }, - ]; - }; - }, - ]; - types: [ - { - name: "CommonFields"; - type: { - kind: "struct"; - fields: [ - { - name: "slot"; - type: "u64"; - }, - { - name: "unixTimestamp"; - type: "i64"; - }, - { - name: "user"; - type: "publicKey"; - }, - { - name: "amm"; - type: "publicKey"; - }, - { - name: "postBaseReserves"; - type: "u64"; - }, - { - name: "postQuoteReserves"; - type: "u64"; - }, - { - name: "oracleLastPrice"; - type: "u128"; - }, - { - name: "oracleLastObservation"; - type: "u128"; - }, - { - name: "oracleAggregator"; - type: "u128"; - }, - { - name: "seqNum"; - type: "u64"; - }, - ]; - }; - }, - { - name: "AddLiquidityArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "quoteAmount"; - docs: ["How much quote token you will deposit to the pool"]; - type: "u64"; - }, - { - name: "maxBaseAmount"; - docs: ["The maximum base token you will deposit to the pool"]; - type: "u64"; - }, - { - name: "minLpTokens"; - docs: ["The minimum LP token you will get back"]; - type: "u64"; - }, - ]; - }; - }, - { - name: "CreateAmmArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "twapInitialObservation"; - type: "u128"; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; - }, - { - name: "twapStartDelaySlots"; - type: "u64"; - }, - ]; - }; - }, - { - name: "RemoveLiquidityArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "lpTokensToBurn"; - type: "u64"; - }, - { - name: "minQuoteAmount"; - type: "u64"; - }, - { - name: "minBaseAmount"; - type: "u64"; - }, - ]; - }; - }, - { - name: "SwapArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "swapType"; - type: { - defined: "SwapType"; - }; - }, - { - name: "inputAmount"; - type: "u64"; - }, - { - name: "outputAmountMin"; - type: "u64"; - }, - ]; - }; - }, - { - name: "TwapOracle"; - type: { - kind: "struct"; - fields: [ - { - name: "lastUpdatedSlot"; - type: "u64"; - }, - { - name: "lastPrice"; - docs: [ - "A price is the number of quote units per base unit multiplied by 1e12.", - "You cannot simply divide by 1e12 to get a price you can display in the UI", - "because the base and quote decimals may be different. Instead, do:", - "ui_price = (price * (10**(base_decimals - quote_decimals))) / 1e12", - ]; - type: "u128"; - }, - { - name: "lastObservation"; - docs: [ - "If we did a raw TWAP over prices, someone could push the TWAP heavily with", - "a few extremely large outliers. So we use observations, which can only move", - "by `max_observation_change_per_update` per update.", - ]; - type: "u128"; - }, - { - name: "aggregator"; - docs: [ - "Running sum of slots_per_last_update * last_observation.", - "", - "Assuming latest observations are as big as possible (u64::MAX * 1e12),", - "we can store 18 million slots worth of observations, which turns out to", - "be ~85 days worth of slots.", - "", - "Assuming that latest observations are 100x smaller than they could theoretically", - "be, we can store 8500 days (23 years) worth of them. Even this is a very", - "very conservative assumption - META/USDC prices should be between 1e9 and", - "1e15, which would overflow after 1e15 years worth of slots.", - "", - "So in the case of an overflow, the aggregator rolls back to 0. It's the", - "client's responsibility to sanity check the assets or to handle an", - "aggregator at T2 being smaller than an aggregator at T1.", - ]; - type: "u128"; - }, - { - name: "maxObservationChangePerUpdate"; - docs: ["The most that an observation can change per update."]; - type: "u128"; - }, - { - name: "initialObservation"; - docs: ["What the initial `latest_observation` is set to."]; - type: "u128"; - }, - { - name: "startDelaySlots"; - docs: [ - "Number of slots after amm.created_at_slot to start recording TWAP", - ]; - type: "u64"; - }, - ]; - }; - }, - { - name: "SwapType"; - type: { - kind: "enum"; - variants: [ - { - name: "Buy"; - }, - { - name: "Sell"; - }, - ]; - }; - }, - ]; - events: [ - { - name: "SwapEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "inputAmount"; - type: "u64"; - index: false; - }, - { - name: "outputAmount"; - type: "u64"; - index: false; - }, - { - name: "swapType"; - type: { - defined: "SwapType"; - }; - index: false; - }, - ]; - }, - { - name: "AddLiquidityEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "quoteAmount"; - type: "u64"; - index: false; - }, - { - name: "maxBaseAmount"; - type: "u64"; - index: false; - }, - { - name: "minLpTokens"; - type: "u64"; - index: false; - }, - { - name: "baseAmount"; - type: "u64"; - index: false; - }, - { - name: "lpTokensMinted"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "RemoveLiquidityEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "lpTokensBurned"; - type: "u64"; - index: false; - }, - { - name: "minQuoteAmount"; - type: "u64"; - index: false; - }, - { - name: "minBaseAmount"; - type: "u64"; - index: false; - }, - { - name: "baseAmount"; - type: "u64"; - index: false; - }, - { - name: "quoteAmount"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "CreateAmmEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "twapInitialObservation"; - type: "u128"; - index: false; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; - index: false; - }, - { - name: "lpMint"; - type: "publicKey"; - index: false; - }, - { - name: "baseMint"; - type: "publicKey"; - index: false; - }, - { - name: "quoteMint"; - type: "publicKey"; - index: false; - }, - { - name: "vaultAtaBase"; - type: "publicKey"; - index: false; - }, - { - name: "vaultAtaQuote"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "CrankThatTwapEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - ]; - }, - ]; - errors: [ - { - code: 6000; - name: "AssertFailed"; - msg: "An assertion failed"; - }, - { - code: 6001; - name: "NoSlotsPassed"; - msg: "Can't get a TWAP before some observations have been stored"; - }, - { - code: 6002; - name: "NoReserves"; - msg: "Can't swap through a pool without token reserves on either side"; - }, - { - code: 6003; - name: "InputAmountOverflow"; - msg: "Input token amount is too large for a swap, causes overflow"; - }, - { - code: 6004; - name: "AddLiquidityCalculationError"; - msg: "Add liquidity calculation error"; - }, - { - code: 6005; - name: "DecimalScaleError"; - msg: "Error in decimal scale conversion"; - }, - { - code: 6006; - name: "SameTokenMints"; - msg: "You can't create an AMM pool where the token mints are the same"; - }, - { - code: 6007; - name: "SwapSlippageExceeded"; - msg: "A user wouldn't have gotten back their `output_amount_min`, reverting"; - }, - { - code: 6008; - name: "InsufficientBalance"; - msg: "The user had insufficient balance to do this"; - }, - { - code: 6009; - name: "ZeroLiquidityRemove"; - msg: "Must remove a non-zero amount of liquidity"; - }, - { - code: 6010; - name: "ZeroLiquidityToAdd"; - msg: "Cannot add liquidity with 0 tokens on either side"; - }, - { - code: 6011; - name: "ZeroMinLpTokens"; - msg: "Must specify a non-zero `min_lp_tokens` when adding to an existing pool"; - }, - { - code: 6012; - name: "AddLiquiditySlippageExceeded"; - msg: "LP wouldn't have gotten back `lp_token_min`"; - }, - { - code: 6013; - name: "AddLiquidityMaxBaseExceeded"; - msg: "LP would have spent more than `max_base_amount`"; - }, - { - code: 6014; - name: "InsufficientQuoteAmount"; - msg: "`quote_amount` must be greater than 100000000 when initializing a pool"; - }, - { - code: 6015; - name: "ZeroSwapAmount"; - msg: "Users must swap a non-zero amount"; - }, - { - code: 6016; - name: "ConstantProductInvariantFailed"; - msg: "K should always be increasing"; - }, - { - code: 6017; - name: "CastingOverflow"; - msg: "Casting has caused an overflow"; - }, - ]; -}; - -export const IDL: FutarchyAmm = { - version: "0.4.1", - name: "futarchy_amm", - instructions: [ - { - name: "createAmm", - accounts: [ - { - name: "user", - isMut: true, - isSigner: true, - }, - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "lpMint", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "vaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "CreateAmmArgs", - }, - }, - ], - }, - { - name: "addLiquidity", - accounts: [ - { - name: "user", - isMut: true, - isSigner: true, - }, - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "lpMint", - isMut: true, - isSigner: false, - }, - { - name: "userLpAccount", - isMut: true, - isSigner: false, - }, - { - name: "userBaseAccount", - isMut: true, - isSigner: false, - }, - { - name: "userQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "AddLiquidityArgs", - }, - }, - ], - }, - { - name: "removeLiquidity", - accounts: [ - { - name: "user", - isMut: true, - isSigner: true, - }, - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "lpMint", - isMut: true, - isSigner: false, - }, - { - name: "userLpAccount", - isMut: true, - isSigner: false, - }, - { - name: "userBaseAccount", - isMut: true, - isSigner: false, - }, - { - name: "userQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "RemoveLiquidityArgs", - }, - }, - ], - }, - { - name: "swap", - accounts: [ - { - name: "user", - isMut: true, - isSigner: true, - }, - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "userBaseAccount", - isMut: true, - isSigner: false, - }, - { - name: "userQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "SwapArgs", - }, - }, - ], - }, - { - name: "crankThatTwap", - accounts: [ - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "amm", - type: { - kind: "struct", - fields: [ - { - name: "bump", - type: "u8", - }, - { - name: "createdAtSlot", - type: "u64", - }, - { - name: "lpMint", - type: "publicKey", - }, - { - name: "baseMint", - type: "publicKey", - }, - { - name: "quoteMint", - type: "publicKey", - }, - { - name: "baseMintDecimals", - type: "u8", - }, - { - name: "quoteMintDecimals", - type: "u8", - }, - { - name: "baseAmount", - type: "u64", - }, - { - name: "quoteAmount", - type: "u64", - }, - { - name: "oracle", - type: { - defined: "TwapOracle", - }, - }, - { - name: "seqNum", - type: "u64", - }, - { - name: "vaultAtaBase", - type: "publicKey", - }, - { - name: "vaultAtaQuote", - type: "publicKey", - }, - ], - }, - }, - ], - types: [ - { - name: "CommonFields", - type: { - kind: "struct", - fields: [ - { - name: "slot", - type: "u64", - }, - { - name: "unixTimestamp", - type: "i64", - }, - { - name: "user", - type: "publicKey", - }, - { - name: "amm", - type: "publicKey", - }, - { - name: "postBaseReserves", - type: "u64", - }, - { - name: "postQuoteReserves", - type: "u64", - }, - { - name: "oracleLastPrice", - type: "u128", - }, - { - name: "oracleLastObservation", - type: "u128", - }, - { - name: "oracleAggregator", - type: "u128", - }, - { - name: "seqNum", - type: "u64", - }, - ], - }, - }, - { - name: "AddLiquidityArgs", - type: { - kind: "struct", - fields: [ - { - name: "quoteAmount", - docs: ["How much quote token you will deposit to the pool"], - type: "u64", - }, - { - name: "maxBaseAmount", - docs: ["The maximum base token you will deposit to the pool"], - type: "u64", - }, - { - name: "minLpTokens", - docs: ["The minimum LP token you will get back"], - type: "u64", - }, - ], - }, - }, - { - name: "CreateAmmArgs", - type: { - kind: "struct", - fields: [ - { - name: "twapInitialObservation", - type: "u128", - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - }, - { - name: "twapStartDelaySlots", - type: "u64", - }, - ], - }, - }, - { - name: "RemoveLiquidityArgs", - type: { - kind: "struct", - fields: [ - { - name: "lpTokensToBurn", - type: "u64", - }, - { - name: "minQuoteAmount", - type: "u64", - }, - { - name: "minBaseAmount", - type: "u64", - }, - ], - }, - }, - { - name: "SwapArgs", - type: { - kind: "struct", - fields: [ - { - name: "swapType", - type: { - defined: "SwapType", - }, - }, - { - name: "inputAmount", - type: "u64", - }, - { - name: "outputAmountMin", - type: "u64", - }, - ], - }, - }, - { - name: "TwapOracle", - type: { - kind: "struct", - fields: [ - { - name: "lastUpdatedSlot", - type: "u64", - }, - { - name: "lastPrice", - docs: [ - "A price is the number of quote units per base unit multiplied by 1e12.", - "You cannot simply divide by 1e12 to get a price you can display in the UI", - "because the base and quote decimals may be different. Instead, do:", - "ui_price = (price * (10**(base_decimals - quote_decimals))) / 1e12", - ], - type: "u128", - }, - { - name: "lastObservation", - docs: [ - "If we did a raw TWAP over prices, someone could push the TWAP heavily with", - "a few extremely large outliers. So we use observations, which can only move", - "by `max_observation_change_per_update` per update.", - ], - type: "u128", - }, - { - name: "aggregator", - docs: [ - "Running sum of slots_per_last_update * last_observation.", - "", - "Assuming latest observations are as big as possible (u64::MAX * 1e12),", - "we can store 18 million slots worth of observations, which turns out to", - "be ~85 days worth of slots.", - "", - "Assuming that latest observations are 100x smaller than they could theoretically", - "be, we can store 8500 days (23 years) worth of them. Even this is a very", - "very conservative assumption - META/USDC prices should be between 1e9 and", - "1e15, which would overflow after 1e15 years worth of slots.", - "", - "So in the case of an overflow, the aggregator rolls back to 0. It's the", - "client's responsibility to sanity check the assets or to handle an", - "aggregator at T2 being smaller than an aggregator at T1.", - ], - type: "u128", - }, - { - name: "maxObservationChangePerUpdate", - docs: ["The most that an observation can change per update."], - type: "u128", - }, - { - name: "initialObservation", - docs: ["What the initial `latest_observation` is set to."], - type: "u128", - }, - { - name: "startDelaySlots", - docs: [ - "Number of slots after amm.created_at_slot to start recording TWAP", - ], - type: "u64", - }, - ], - }, - }, - { - name: "SwapType", - type: { - kind: "enum", - variants: [ - { - name: "Buy", - }, - { - name: "Sell", - }, - ], - }, - }, - ], - events: [ - { - name: "SwapEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "inputAmount", - type: "u64", - index: false, - }, - { - name: "outputAmount", - type: "u64", - index: false, - }, - { - name: "swapType", - type: { - defined: "SwapType", - }, - index: false, - }, - ], - }, - { - name: "AddLiquidityEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "quoteAmount", - type: "u64", - index: false, - }, - { - name: "maxBaseAmount", - type: "u64", - index: false, - }, - { - name: "minLpTokens", - type: "u64", - index: false, - }, - { - name: "baseAmount", - type: "u64", - index: false, - }, - { - name: "lpTokensMinted", - type: "u64", - index: false, - }, - ], - }, - { - name: "RemoveLiquidityEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "lpTokensBurned", - type: "u64", - index: false, - }, - { - name: "minQuoteAmount", - type: "u64", - index: false, - }, - { - name: "minBaseAmount", - type: "u64", - index: false, - }, - { - name: "baseAmount", - type: "u64", - index: false, - }, - { - name: "quoteAmount", - type: "u64", - index: false, - }, - ], - }, - { - name: "CreateAmmEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "twapInitialObservation", - type: "u128", - index: false, - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - index: false, - }, - { - name: "lpMint", - type: "publicKey", - index: false, - }, - { - name: "baseMint", - type: "publicKey", - index: false, - }, - { - name: "quoteMint", - type: "publicKey", - index: false, - }, - { - name: "vaultAtaBase", - type: "publicKey", - index: false, - }, - { - name: "vaultAtaQuote", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "CrankThatTwapEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - ], - }, - ], - errors: [ - { - code: 6000, - name: "AssertFailed", - msg: "An assertion failed", - }, - { - code: 6001, - name: "NoSlotsPassed", - msg: "Can't get a TWAP before some observations have been stored", - }, - { - code: 6002, - name: "NoReserves", - msg: "Can't swap through a pool without token reserves on either side", - }, - { - code: 6003, - name: "InputAmountOverflow", - msg: "Input token amount is too large for a swap, causes overflow", - }, - { - code: 6004, - name: "AddLiquidityCalculationError", - msg: "Add liquidity calculation error", - }, - { - code: 6005, - name: "DecimalScaleError", - msg: "Error in decimal scale conversion", - }, - { - code: 6006, - name: "SameTokenMints", - msg: "You can't create an AMM pool where the token mints are the same", - }, - { - code: 6007, - name: "SwapSlippageExceeded", - msg: "A user wouldn't have gotten back their `output_amount_min`, reverting", - }, - { - code: 6008, - name: "InsufficientBalance", - msg: "The user had insufficient balance to do this", - }, - { - code: 6009, - name: "ZeroLiquidityRemove", - msg: "Must remove a non-zero amount of liquidity", - }, - { - code: 6010, - name: "ZeroLiquidityToAdd", - msg: "Cannot add liquidity with 0 tokens on either side", - }, - { - code: 6011, - name: "ZeroMinLpTokens", - msg: "Must specify a non-zero `min_lp_tokens` when adding to an existing pool", - }, - { - code: 6012, - name: "AddLiquiditySlippageExceeded", - msg: "LP wouldn't have gotten back `lp_token_min`", - }, - { - code: 6013, - name: "AddLiquidityMaxBaseExceeded", - msg: "LP would have spent more than `max_base_amount`", - }, - { - code: 6014, - name: "InsufficientQuoteAmount", - msg: "`quote_amount` must be greater than 100000000 when initializing a pool", - }, - { - code: 6015, - name: "ZeroSwapAmount", - msg: "Users must swap a non-zero amount", - }, - { - code: 6016, - name: "ConstantProductInvariantFailed", - msg: "K should always be increasing", - }, - { - code: 6017, - name: "CastingOverflow", - msg: "Casting has caused an overflow", - }, - ], -}; diff --git a/sdk/src/v0.6/types/index.ts b/sdk/src/v0.6/types/index.ts deleted file mode 100644 index f00207d02..000000000 --- a/sdk/src/v0.6/types/index.ts +++ /dev/null @@ -1,248 +0,0 @@ -import { Amm as AmmProgram, IDL as AmmIDL } from "./amm.js"; -export { AmmProgram, AmmIDL }; - -import { - Launchpad as LaunchpadProgram, - IDL as LaunchpadIDL, -} from "./launchpad.js"; -export { LaunchpadProgram, LaunchpadIDL }; - -import { - Launchpad as v0_6_0_Launchpad, - IDL as v0_6_0_LaunchpadIDL, -} from "./v0.6.0-launchpad.js"; -export { v0_6_0_Launchpad, v0_6_0_LaunchpadIDL }; - -import { - ConditionalVault as ConditionalVaultProgram, - IDL as ConditionalVaultIDL, -} from "./conditional_vault.js"; -export { ConditionalVaultProgram, ConditionalVaultIDL }; - -import { Futarchy as FutarchyProgram, IDL as FutarchyIDL } from "./futarchy.js"; -export { FutarchyProgram, FutarchyIDL }; - -import { - Futarchy as v0_6_0_Futarchy, - IDL as v0_6_0_FutarchyIDL, -} from "./v0.6.0-futarchy.js"; -export { v0_6_0_Futarchy, v0_6_0_FutarchyIDL }; - -import { - PriceBasedPerformancePackage as PriceBasedPerformancePackageProgram, - IDL as PriceBasedPerformancePackageIDL, -} from "./price_based_performance_package.js"; -export { PriceBasedPerformancePackageProgram, PriceBasedPerformancePackageIDL }; - -export { LowercaseKeys } from "./utils.js"; - -import type { IdlAccounts, IdlTypes, IdlEvents } from "@coral-xyz/anchor"; - -export type Question = IdlAccounts["question"]; -export type ConditionalVault = - IdlAccounts["conditionalVault"]; - -export type InitializeDaoParams = - IdlTypes["InitializeDaoParams"]; -export type UpdateDaoParams = IdlTypes["UpdateDaoParams"]; -export type InitializePerformancePackageParams = - IdlTypes["InitializePerformancePackageParams"]; - -export type Dao = IdlAccounts["dao"]; -export type Proposal = IdlAccounts["proposal"]; -export type Amm = IdlAccounts["amm"]; -export type Launch = IdlAccounts["launch"]; -export type FundingRecord = IdlAccounts["fundingRecord"]; -export type PerformancePackage = - IdlAccounts["performancePackage"]; - -export type OracleConfig = - IdlTypes["OracleConfig"]; -export type Tranche = IdlTypes["Tranche"]; - -// export type OracleConfig = IdlTypes["OracleConfig"]; -// export type SharedLiquidityPool = -// IdlAccounts["sharedLiquidityPool"]; -// export type SharedLiquidityPoolPosition = -// IdlAccounts["liquidityPosition"]; - -export type SwapEvent = IdlEvents["SwapEvent"]; -export type AddLiquidityEvent = IdlEvents["AddLiquidityEvent"]; -export type RemoveLiquidityEvent = - IdlEvents["RemoveLiquidityEvent"]; -export type CreateAmmEvent = IdlEvents["CreateAmmEvent"]; -export type CrankThatTwapEvent = IdlEvents["CrankThatTwapEvent"]; -export type AmmEvent = - | SwapEvent - | AddLiquidityEvent - | RemoveLiquidityEvent - | CreateAmmEvent - | CrankThatTwapEvent; - -export type AddMetadataToConditionalTokensEvent = - IdlEvents["AddMetadataToConditionalTokensEvent"]; -export type InitializeConditionalVaultEvent = - IdlEvents["InitializeConditionalVaultEvent"]; -export type InitializeQuestionEvent = - IdlEvents["InitializeQuestionEvent"]; -export type MergeTokensEvent = - IdlEvents["MergeTokensEvent"]; -export type RedeemTokensEvent = - IdlEvents["RedeemTokensEvent"]; -export type ResolveQuestionEvent = - IdlEvents["ResolveQuestionEvent"]; -export type SplitTokensEvent = - IdlEvents["SplitTokensEvent"]; -export type ConditionalVaultEvent = - | AddMetadataToConditionalTokensEvent - | InitializeConditionalVaultEvent - | InitializeQuestionEvent - | MergeTokensEvent - | RedeemTokensEvent - | ResolveQuestionEvent - | SplitTokensEvent; - -export type LaunchClaimEvent = IdlEvents["LaunchClaimEvent"]; -export type LaunchCompletedEvent = - IdlEvents["LaunchCompletedEvent"]; -export type LaunchFundedEvent = - IdlEvents["LaunchFundedEvent"]; -export type LaunchInitializedEvent = - IdlEvents["LaunchInitializedEvent"]; -export type LaunchRefundedEvent = - IdlEvents["LaunchRefundedEvent"]; -export type LaunchStartedEvent = - IdlEvents["LaunchStartedEvent"]; -export type LaunchCloseEvent = IdlEvents["LaunchCloseEvent"]; -export type LaunchpadEvent = - | LaunchClaimEvent - | LaunchCompletedEvent - | LaunchFundedEvent - | LaunchInitializedEvent - | LaunchRefundedEvent - | LaunchStartedEvent - | LaunchCloseEvent; - -export type v0_6_0_LaunchClaimEvent = - IdlEvents["LaunchClaimEvent"]; -export type v0_6_0_LaunchCompletedEvent = - IdlEvents["LaunchCompletedEvent"]; -export type v0_6_0_LaunchFundedEvent = - IdlEvents["LaunchFundedEvent"]; -export type v0_6_0_LaunchInitializedEvent = - IdlEvents["LaunchInitializedEvent"]; -export type v0_6_0_LaunchRefundedEvent = - IdlEvents["LaunchRefundedEvent"]; -export type v0_6_0_LaunchStartedEvent = - IdlEvents["LaunchStartedEvent"]; -export type v0_6_0_LaunchCloseEvent = - IdlEvents["LaunchCloseEvent"]; -export type v0_6_0_LaunchpadEvent = - | v0_6_0_LaunchClaimEvent - | v0_6_0_LaunchCompletedEvent - | v0_6_0_LaunchFundedEvent - | v0_6_0_LaunchInitializedEvent - | v0_6_0_LaunchRefundedEvent - | v0_6_0_LaunchStartedEvent - | v0_6_0_LaunchCloseEvent; - -export type CollectFeesEvent = IdlEvents["CollectFeesEvent"]; -export type InitializeDaoEvent = - IdlEvents["InitializeDaoEvent"]; -export type UpdateDaoEvent = IdlEvents["UpdateDaoEvent"]; -export type InitializeProposalEvent = - IdlEvents["InitializeProposalEvent"]; -export type StakeToProposalEvent = - IdlEvents["StakeToProposalEvent"]; -export type UnstakeFromProposalEvent = - IdlEvents["UnstakeFromProposalEvent"]; -export type LaunchProposalEvent = - IdlEvents["LaunchProposalEvent"]; -export type FinalizeProposalEvent = - IdlEvents["FinalizeProposalEvent"]; -export type SpotSwapEvent = IdlEvents["SpotSwapEvent"]; -export type ConditionalSwapEvent = - IdlEvents["ConditionalSwapEvent"]; -export type ProvideLiquidityEvent = - IdlEvents["ProvideLiquidityEvent"]; -export type WithdrawLiquidityEvent = - IdlEvents["WithdrawLiquidityEvent"]; -export type SponsorProposalEvent = - IdlEvents["SponsorProposalEvent"]; -export type InitiateVaultSpendOptimisticProposalEvent = - IdlEvents["InitiateVaultSpendOptimisticProposalEvent"]; -export type FinalizeOptimisticProposalEvent = - IdlEvents["FinalizeOptimisticProposalEvent"]; -export type FutarchyEvent = - | CollectFeesEvent - | InitializeDaoEvent - | UpdateDaoEvent - | InitializeProposalEvent - | StakeToProposalEvent - | UnstakeFromProposalEvent - | LaunchProposalEvent - | FinalizeProposalEvent - | SpotSwapEvent - | ConditionalSwapEvent - | ProvideLiquidityEvent - | WithdrawLiquidityEvent - | SponsorProposalEvent - | InitiateVaultSpendOptimisticProposalEvent - | FinalizeOptimisticProposalEvent; - -export type v0_6_0_CollectFeesEvent = - IdlEvents["CollectFeesEvent"]; -export type v0_6_0_InitializeDaoEvent = - IdlEvents["InitializeDaoEvent"]; -export type v0_6_0_UpdateDaoEvent = - IdlEvents["UpdateDaoEvent"]; -export type v0_6_0_InitializeProposalEvent = - IdlEvents["InitializeProposalEvent"]; -export type v0_6_0_StakeToProposalEvent = - IdlEvents["StakeToProposalEvent"]; -export type v0_6_0_UnstakeFromProposalEvent = - IdlEvents["UnstakeFromProposalEvent"]; -export type v0_6_0_LaunchProposalEvent = - IdlEvents["LaunchProposalEvent"]; -export type v0_6_0_FinalizeProposalEvent = - IdlEvents["FinalizeProposalEvent"]; -export type v0_6_0_SpotSwapEvent = IdlEvents["SpotSwapEvent"]; -export type v0_6_0_ConditionalSwapEvent = - IdlEvents["ConditionalSwapEvent"]; -export type v0_6_0_ProvideLiquidityEvent = - IdlEvents["ProvideLiquidityEvent"]; -export type v0_6_0_WithdrawLiquidityEvent = - IdlEvents["WithdrawLiquidityEvent"]; -export type v0_6_0_FutarchyEvent = - | v0_6_0_CollectFeesEvent - | v0_6_0_InitializeDaoEvent - | v0_6_0_UpdateDaoEvent - | v0_6_0_InitializeProposalEvent - | v0_6_0_StakeToProposalEvent - | v0_6_0_UnstakeFromProposalEvent - | v0_6_0_LaunchProposalEvent - | v0_6_0_FinalizeProposalEvent - | v0_6_0_SpotSwapEvent - | v0_6_0_ConditionalSwapEvent - | v0_6_0_ProvideLiquidityEvent - | v0_6_0_WithdrawLiquidityEvent; - -export type PerformancePackageInitializedEvent = - IdlEvents["PerformancePackageInitialized"]; -export type UnlockStartedEvent = - IdlEvents["UnlockStarted"]; -export type UnlockCompletedEvent = - IdlEvents["UnlockCompleted"]; -export type ChangeProposedEvent = - IdlEvents["ChangeProposed"]; -export type ChangeExecutedEvent = - IdlEvents["ChangeExecuted"]; -export type PerformancePackageAuthorityChangedEvent = - IdlEvents["PerformancePackageAuthorityChanged"]; -export type PriceBasedPerformancePackageEvent = - | PerformancePackageInitializedEvent - | UnlockStartedEvent - | UnlockCompletedEvent - | ChangeProposedEvent - | ChangeExecutedEvent - | PerformancePackageAuthorityChangedEvent; diff --git a/sdk/src/v0.6/types/launchpad.ts b/sdk/src/v0.6/types/launchpad.ts deleted file mode 100644 index bbfbca5a7..000000000 --- a/sdk/src/v0.6/types/launchpad.ts +++ /dev/null @@ -1,2813 +0,0 @@ -export type Launchpad = { - version: "0.6.1"; - name: "launchpad"; - instructions: [ - { - name: "initializeLaunch"; - accounts: [ - { - name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "baseMint"; - isMut: true; - isSigner: false; - }, - { - name: "tokenMetadata"; - isMut: true; - isSigner: false; - }, - { - name: "launchSigner"; - isMut: false; - isSigner: false; - }, - { - name: "quoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "baseVault"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "launchAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "rent"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenMetadataProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "InitializeLaunchArgs"; - }; - }, - ]; - }, - { - name: "startLaunch"; - accounts: [ - { - name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "launchAuthority"; - isMut: false; - isSigner: true; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "fund"; - accounts: [ - { - name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "fundingRecord"; - isMut: true; - isSigner: false; - }, - { - name: "launchQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "funder"; - isMut: false; - isSigner: true; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "funderQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "amount"; - type: "u64"; - }, - ]; - }, - { - name: "completeLaunch"; - accounts: [ - { - name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "launchAuthority"; - isMut: false; - isSigner: true; - isOptional: true; - }, - { - name: "tokenMetadata"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "launchSigner"; - isMut: true; - isSigner: false; - }, - { - name: "launchQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "launchBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "treasuryQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "baseMint"; - isMut: true; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "daoOwnedLpPosition"; - isMut: true; - isSigner: false; - }, - { - name: "futarchyAmmBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "futarchyAmmQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisig"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigVault"; - isMut: false; - isSigner: false; - }, - { - name: "spendingLimit"; - isMut: true; - isSigner: false; - }, - { - name: "performancePackage"; - isMut: true; - isSigner: false; - }, - { - name: "performancePackageTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "staticAccounts"; - accounts: [ - { - name: "futarchyProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenMetadataProgram"; - isMut: false; - isSigner: false; - }, - { - name: "autocratEventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "squadsProgram"; - isMut: false; - isSigner: false; - }, - { - name: "squadsProgramConfig"; - isMut: false; - isSigner: false; - }, - { - name: "squadsProgramConfigTreasury"; - isMut: true; - isSigner: false; - }, - { - name: "priceBasedPerformancePackageProgram"; - isMut: false; - isSigner: false; - }, - { - name: "priceBasedPerformancePackageEventAuthority"; - isMut: false; - isSigner: false; - }, - ]; - }, - { - name: "meteoraAccounts"; - accounts: [ - { - name: "dammV2Program"; - isMut: false; - isSigner: false; - }, - { - name: "config"; - isMut: false; - isSigner: false; - }, - { - name: "token2022Program"; - isMut: false; - isSigner: false; - }, - { - name: "positionNftAccount"; - isMut: true; - isSigner: false; - }, - { - name: "pool"; - isMut: true; - isSigner: false; - }, - { - name: "position"; - isMut: true; - isSigner: false; - }, - { - name: "positionNftMint"; - isMut: true; - isSigner: false; - }, - { - name: "baseMint"; - isMut: false; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "tokenAVault"; - isMut: true; - isSigner: false; - }, - { - name: "tokenBVault"; - isMut: true; - isSigner: false; - }, - { - name: "poolCreatorAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "poolAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "dammV2EventAuthority"; - isMut: false; - isSigner: false; - }, - ]; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "CompleteLaunchArgs"; - }; - }, - ]; - }, - { - name: "refund"; - accounts: [ - { - name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "fundingRecord"; - isMut: true; - isSigner: false; - }, - { - name: "launchQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "launchSigner"; - isMut: false; - isSigner: false; - }, - { - name: "funder"; - isMut: false; - isSigner: false; - }, - { - name: "funderQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "claim"; - accounts: [ - { - name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "fundingRecord"; - isMut: true; - isSigner: false; - }, - { - name: "launchSigner"; - isMut: false; - isSigner: false; - }, - { - name: "baseMint"; - isMut: true; - isSigner: false; - }, - { - name: "launchBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "funder"; - isMut: false; - isSigner: false; - }, - { - name: "funderTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "closeLaunch"; - accounts: [ - { - name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "returnFunds"; - accounts: [ - { - name: "admin"; - isMut: false; - isSigner: true; - }, - { - name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "launchQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "launchSigner"; - isMut: false; - isSigner: false; - }, - { - name: "recipient"; - isMut: false; - isSigner: false; - }, - { - name: "recipientQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "ReturnFundsArgs"; - }; - }, - ]; - }, - ]; - accounts: [ - { - name: "fundingRecord"; - type: { - kind: "struct"; - fields: [ - { - name: "pdaBump"; - docs: ["The PDA bump."]; - type: "u8"; - }, - { - name: "funder"; - docs: ["The funder."]; - type: "publicKey"; - }, - { - name: "launch"; - docs: ["The launch."]; - type: "publicKey"; - }, - { - name: "committedAmount"; - docs: ["The amount of USDC that has been committed by the funder."]; - type: "u64"; - }, - { - name: "isTokensClaimed"; - docs: ["Whether the tokens have been claimed."]; - type: "bool"; - }, - { - name: "isUsdcRefunded"; - docs: ["Whether the USDC has been refunded."]; - type: "bool"; - }, - ]; - }; - }, - { - name: "launch"; - type: { - kind: "struct"; - fields: [ - { - name: "pdaBump"; - docs: ["The PDA bump."]; - type: "u8"; - }, - { - name: "minimumRaiseAmount"; - docs: [ - "The minimum amount of USDC that must be raised, otherwise", - "everyone can get their USDC back.", - ]; - type: "u64"; - }, - { - name: "monthlySpendingLimitAmount"; - docs: [ - "The monthly spending limit the DAO allocates to the team. Must be", - "less than 1/6th of the minimum raise amount (so 6 months of burn).", - ]; - type: "u64"; - }, - { - name: "monthlySpendingLimitMembers"; - docs: [ - "The wallets that have access to the monthly spending limit.", - ]; - type: { - vec: "publicKey"; - }; - }, - { - name: "launchAuthority"; - docs: ["The account that can start the launch."]; - type: "publicKey"; - }, - { - name: "launchSigner"; - docs: [ - "The launch signer address. Needed because Raydium pools need a SOL payer and this PDA can't hold SOL.", - ]; - type: "publicKey"; - }, - { - name: "launchSignerPdaBump"; - docs: ["The PDA bump for the launch signer."]; - type: "u8"; - }, - { - name: "launchQuoteVault"; - docs: [ - "The USDC vault that will hold the USDC raised until the launch is over.", - ]; - type: "publicKey"; - }, - { - name: "launchBaseVault"; - docs: ["The token vault, used to send tokens to Raydium."]; - type: "publicKey"; - }, - { - name: "baseMint"; - docs: [ - "The token that will be minted to funders and that will control the DAO.", - ]; - type: "publicKey"; - }, - { - name: "quoteMint"; - docs: ["The USDC mint."]; - type: "publicKey"; - }, - { - name: "unixTimestampStarted"; - docs: ["The unix timestamp when the launch was started."]; - type: { - option: "i64"; - }; - }, - { - name: "unixTimestampClosed"; - docs: [ - "The unix timestamp when the launch stopped taking new contributions.", - ]; - type: { - option: "i64"; - }; - }, - { - name: "totalCommittedAmount"; - docs: ["The amount of USDC that has been committed by the users."]; - type: "u64"; - }, - { - name: "finalRaiseAmount"; - docs: ["The final raise amount."]; - type: { - option: "u64"; - }; - }, - { - name: "state"; - docs: ["The state of the launch."]; - type: { - defined: "LaunchState"; - }; - }, - { - name: "seqNum"; - docs: [ - "The sequence number of this launch. Useful for sorting events.", - ]; - type: "u64"; - }, - { - name: "secondsForLaunch"; - docs: ["The number of seconds that the launch will be live for."]; - type: "u32"; - }, - { - name: "dao"; - docs: ["The DAO, if the launch is complete."]; - type: { - option: "publicKey"; - }; - }, - { - name: "daoVault"; - docs: [ - "The DAO treasury that USDC / LP is sent to, if the launch is complete.", - ]; - type: { - option: "publicKey"; - }; - }, - { - name: "performancePackageGrantee"; - docs: [ - "The address that will receive the performance package tokens.", - ]; - type: "publicKey"; - }, - { - name: "performancePackageTokenAmount"; - docs: [ - "The amount of tokens to be granted to the performance package grantee.", - ]; - type: "u64"; - }, - { - name: "monthsUntilInsidersCanUnlock"; - docs: [ - "The number of months that insiders must wait before unlocking their tokens.", - ]; - type: "u8"; - }, - { - name: "teamAddress"; - docs: ["The initial address used to sponsor team proposals."]; - type: "publicKey"; - }, - ]; - }; - }, - ]; - types: [ - { - name: "CommonFields"; - type: { - kind: "struct"; - fields: [ - { - name: "slot"; - type: "u64"; - }, - { - name: "unixTimestamp"; - type: "i64"; - }, - { - name: "launchSeqNum"; - type: "u64"; - }, - ]; - }; - }, - { - name: "CompleteLaunchArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "finalRaiseAmount"; - type: { - option: "u64"; - }; - }, - ]; - }; - }, - { - name: "InitializeLaunchArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "minimumRaiseAmount"; - type: "u64"; - }, - { - name: "monthlySpendingLimitAmount"; - type: "u64"; - }, - { - name: "monthlySpendingLimitMembers"; - type: { - vec: "publicKey"; - }; - }, - { - name: "secondsForLaunch"; - type: "u32"; - }, - { - name: "tokenName"; - type: "string"; - }, - { - name: "tokenSymbol"; - type: "string"; - }, - { - name: "tokenUri"; - type: "string"; - }, - { - name: "performancePackageGrantee"; - type: "publicKey"; - }, - { - name: "performancePackageTokenAmount"; - type: "u64"; - }, - { - name: "monthsUntilInsidersCanUnlock"; - type: "u8"; - }, - { - name: "teamAddress"; - type: "publicKey"; - }, - ]; - }; - }, - { - name: "ReturnFundsArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "amount"; - type: "u64"; - }, - ]; - }; - }, - { - name: "LaunchState"; - type: { - kind: "enum"; - variants: [ - { - name: "Initialized"; - }, - { - name: "Live"; - }, - { - name: "Closed"; - }, - { - name: "Complete"; - }, - { - name: "Refunding"; - }, - ]; - }; - }, - ]; - events: [ - { - name: "LaunchInitializedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "launch"; - type: "publicKey"; - index: false; - }, - { - name: "minimumRaiseAmount"; - type: "u64"; - index: false; - }, - { - name: "launchAuthority"; - type: "publicKey"; - index: false; - }, - { - name: "launchSigner"; - type: "publicKey"; - index: false; - }, - { - name: "launchSignerPdaBump"; - type: "u8"; - index: false; - }, - { - name: "launchUsdcVault"; - type: "publicKey"; - index: false; - }, - { - name: "launchTokenVault"; - type: "publicKey"; - index: false; - }, - { - name: "performancePackageGrantee"; - type: "publicKey"; - index: false; - }, - { - name: "performancePackageTokenAmount"; - type: "u64"; - index: false; - }, - { - name: "monthsUntilInsidersCanUnlock"; - type: "u8"; - index: false; - }, - { - name: "monthlySpendingLimitAmount"; - type: "u64"; - index: false; - }, - { - name: "monthlySpendingLimitMembers"; - type: { - vec: "publicKey"; - }; - index: false; - }, - { - name: "baseMint"; - type: "publicKey"; - index: false; - }, - { - name: "quoteMint"; - type: "publicKey"; - index: false; - }, - { - name: "pdaBump"; - type: "u8"; - index: false; - }, - { - name: "secondsForLaunch"; - type: "u32"; - index: false; - }, - ]; - }, - { - name: "LaunchStartedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "launch"; - type: "publicKey"; - index: false; - }, - { - name: "launchAuthority"; - type: "publicKey"; - index: false; - }, - { - name: "slotStarted"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "LaunchFundedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "fundingRecord"; - type: "publicKey"; - index: false; - }, - { - name: "launch"; - type: "publicKey"; - index: false; - }, - { - name: "funder"; - type: "publicKey"; - index: false; - }, - { - name: "amount"; - type: "u64"; - index: false; - }, - { - name: "totalCommittedByFunder"; - type: "u64"; - index: false; - }, - { - name: "totalCommitted"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "LaunchCompletedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "launch"; - type: "publicKey"; - index: false; - }, - { - name: "finalState"; - type: { - defined: "LaunchState"; - }; - index: false; - }, - { - name: "totalCommitted"; - type: "u64"; - index: false; - }, - { - name: "dao"; - type: { - option: "publicKey"; - }; - index: false; - }, - { - name: "daoTreasury"; - type: { - option: "publicKey"; - }; - index: false; - }, - { - name: "finalRaiseAmount"; - type: { - option: "u64"; - }; - index: false; - }, - ]; - }, - { - name: "LaunchRefundedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "launch"; - type: "publicKey"; - index: false; - }, - { - name: "funder"; - type: "publicKey"; - index: false; - }, - { - name: "usdcRefunded"; - type: "u64"; - index: false; - }, - { - name: "fundingRecord"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "LaunchClaimEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "launch"; - type: "publicKey"; - index: false; - }, - { - name: "funder"; - type: "publicKey"; - index: false; - }, - { - name: "tokensClaimed"; - type: "u64"; - index: false; - }, - { - name: "fundingRecord"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "LaunchCloseEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "launch"; - type: "publicKey"; - index: false; - }, - { - name: "newState"; - type: { - defined: "LaunchState"; - }; - index: false; - }, - ]; - }, - { - name: "LaunchFundsReturnedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "launch"; - type: "publicKey"; - index: false; - }, - { - name: "recipient"; - type: "publicKey"; - index: false; - }, - { - name: "usdcReturned"; - type: "u64"; - index: false; - }, - ]; - }, - ]; - errors: [ - { - code: 6000; - name: "InvalidAmount"; - msg: "Invalid amount"; - }, - { - code: 6001; - name: "SupplyNonZero"; - msg: "Supply must be zero"; - }, - { - code: 6002; - name: "InvalidSecondsForLaunch"; - msg: "Launch period must be between 1 hour and 2 weeks"; - }, - { - code: 6003; - name: "InsufficientFunds"; - msg: "Insufficient funds"; - }, - { - code: 6004; - name: "InvalidTokenKey"; - msg: "Token mint key must end in 'meta'"; - }, - { - code: 6005; - name: "InvalidLaunchState"; - msg: "Invalid launch state"; - }, - { - code: 6006; - name: "LaunchPeriodNotOver"; - msg: "Launch period not over"; - }, - { - code: 6007; - name: "LaunchExpired"; - msg: "Launch is complete, no more funding allowed"; - }, - { - code: 6008; - name: "LaunchNotRefunding"; - msg: "For you to get a refund, either the launch needs to be in a refunding state or the launch must have been over-committed"; - }, - { - code: 6009; - name: "LaunchNotInitialized"; - msg: "Launch must be initialized to be started"; - }, - { - code: 6010; - name: "FreezeAuthoritySet"; - msg: "Freeze authority can't be set on launchpad tokens"; - }, - { - code: 6011; - name: "InvalidMonthlySpendingLimit"; - msg: "Monthly spending limit must be less than 1/6th of the minimum raise amount and cannot be 0"; - }, - { - code: 6012; - name: "InvalidMonthlySpendingLimitMembers"; - msg: "There can only be at most 10 monthly spending limit members"; - }, - { - code: 6013; - name: "InvalidPriceBasedPremineAmount"; - msg: "Cannot do more than a 50% premine, minimum is 10 atoms of token"; - }, - { - code: 6014; - name: "InvalidPerformancePackageMinUnlockTime"; - msg: "Insiders must be forced to wait at least 18 months before unlocking their tokens"; - }, - { - code: 6015; - name: "LaunchAuthorityNotSet"; - msg: "Launch authority must be set to complete the launch until 2 days after closing"; - }, - { - code: 6016; - name: "FinalRaiseAmountTooLow"; - msg: "The final amount raised must be greater than or equal to the minimum raise amount"; - }, - { - code: 6017; - name: "TokensAlreadyClaimed"; - msg: "Tokens already claimed"; - }, - { - code: 6018; - name: "MoneyAlreadyRefunded"; - msg: "Money already refunded"; - }, - { - code: 6019; - name: "InvariantViolated"; - msg: "An invariant was violated. You should get in contact with the MetaDAO team if you see this"; - }, - { - code: 6020; - name: "LaunchNotLive"; - msg: "Launch must be live to be closed"; - }, - { - code: 6021; - name: "InvalidMinimumRaiseAmount"; - msg: "Minimum raise amount must be greater than or equal to $0.5 so that there's enough liquidity for the launch"; - }, - { - code: 6022; - name: "InvalidAdmin"; - msg: "Invalid admin"; - }, - ]; -}; - -export const IDL: Launchpad = { - version: "0.6.1", - name: "launchpad", - instructions: [ - { - name: "initializeLaunch", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: true, - isSigner: false, - }, - { - name: "tokenMetadata", - isMut: true, - isSigner: false, - }, - { - name: "launchSigner", - isMut: false, - isSigner: false, - }, - { - name: "quoteVault", - isMut: true, - isSigner: false, - }, - { - name: "baseVault", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "launchAuthority", - isMut: false, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "rent", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenMetadataProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "InitializeLaunchArgs", - }, - }, - ], - }, - { - name: "startLaunch", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "launchAuthority", - isMut: false, - isSigner: true, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "fund", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "fundingRecord", - isMut: true, - isSigner: false, - }, - { - name: "launchQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "funder", - isMut: false, - isSigner: true, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "funderQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "amount", - type: "u64", - }, - ], - }, - { - name: "completeLaunch", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "launchAuthority", - isMut: false, - isSigner: true, - isOptional: true, - }, - { - name: "tokenMetadata", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "launchSigner", - isMut: true, - isSigner: false, - }, - { - name: "launchQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "launchBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "treasuryQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: true, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "daoOwnedLpPosition", - isMut: true, - isSigner: false, - }, - { - name: "futarchyAmmBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "futarchyAmmQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigVault", - isMut: false, - isSigner: false, - }, - { - name: "spendingLimit", - isMut: true, - isSigner: false, - }, - { - name: "performancePackage", - isMut: true, - isSigner: false, - }, - { - name: "performancePackageTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "staticAccounts", - accounts: [ - { - name: "futarchyProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenMetadataProgram", - isMut: false, - isSigner: false, - }, - { - name: "autocratEventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgram", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgramConfig", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgramConfigTreasury", - isMut: true, - isSigner: false, - }, - { - name: "priceBasedPerformancePackageProgram", - isMut: false, - isSigner: false, - }, - { - name: "priceBasedPerformancePackageEventAuthority", - isMut: false, - isSigner: false, - }, - ], - }, - { - name: "meteoraAccounts", - accounts: [ - { - name: "dammV2Program", - isMut: false, - isSigner: false, - }, - { - name: "config", - isMut: false, - isSigner: false, - }, - { - name: "token2022Program", - isMut: false, - isSigner: false, - }, - { - name: "positionNftAccount", - isMut: true, - isSigner: false, - }, - { - name: "pool", - isMut: true, - isSigner: false, - }, - { - name: "position", - isMut: true, - isSigner: false, - }, - { - name: "positionNftMint", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "tokenAVault", - isMut: true, - isSigner: false, - }, - { - name: "tokenBVault", - isMut: true, - isSigner: false, - }, - { - name: "poolCreatorAuthority", - isMut: false, - isSigner: false, - }, - { - name: "poolAuthority", - isMut: false, - isSigner: false, - }, - { - name: "dammV2EventAuthority", - isMut: false, - isSigner: false, - }, - ], - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "CompleteLaunchArgs", - }, - }, - ], - }, - { - name: "refund", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "fundingRecord", - isMut: true, - isSigner: false, - }, - { - name: "launchQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "launchSigner", - isMut: false, - isSigner: false, - }, - { - name: "funder", - isMut: false, - isSigner: false, - }, - { - name: "funderQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "claim", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "fundingRecord", - isMut: true, - isSigner: false, - }, - { - name: "launchSigner", - isMut: false, - isSigner: false, - }, - { - name: "baseMint", - isMut: true, - isSigner: false, - }, - { - name: "launchBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "funder", - isMut: false, - isSigner: false, - }, - { - name: "funderTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "closeLaunch", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "returnFunds", - accounts: [ - { - name: "admin", - isMut: false, - isSigner: true, - }, - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "launchQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "launchSigner", - isMut: false, - isSigner: false, - }, - { - name: "recipient", - isMut: false, - isSigner: false, - }, - { - name: "recipientQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "ReturnFundsArgs", - }, - }, - ], - }, - ], - accounts: [ - { - name: "fundingRecord", - type: { - kind: "struct", - fields: [ - { - name: "pdaBump", - docs: ["The PDA bump."], - type: "u8", - }, - { - name: "funder", - docs: ["The funder."], - type: "publicKey", - }, - { - name: "launch", - docs: ["The launch."], - type: "publicKey", - }, - { - name: "committedAmount", - docs: ["The amount of USDC that has been committed by the funder."], - type: "u64", - }, - { - name: "isTokensClaimed", - docs: ["Whether the tokens have been claimed."], - type: "bool", - }, - { - name: "isUsdcRefunded", - docs: ["Whether the USDC has been refunded."], - type: "bool", - }, - ], - }, - }, - { - name: "launch", - type: { - kind: "struct", - fields: [ - { - name: "pdaBump", - docs: ["The PDA bump."], - type: "u8", - }, - { - name: "minimumRaiseAmount", - docs: [ - "The minimum amount of USDC that must be raised, otherwise", - "everyone can get their USDC back.", - ], - type: "u64", - }, - { - name: "monthlySpendingLimitAmount", - docs: [ - "The monthly spending limit the DAO allocates to the team. Must be", - "less than 1/6th of the minimum raise amount (so 6 months of burn).", - ], - type: "u64", - }, - { - name: "monthlySpendingLimitMembers", - docs: [ - "The wallets that have access to the monthly spending limit.", - ], - type: { - vec: "publicKey", - }, - }, - { - name: "launchAuthority", - docs: ["The account that can start the launch."], - type: "publicKey", - }, - { - name: "launchSigner", - docs: [ - "The launch signer address. Needed because Raydium pools need a SOL payer and this PDA can't hold SOL.", - ], - type: "publicKey", - }, - { - name: "launchSignerPdaBump", - docs: ["The PDA bump for the launch signer."], - type: "u8", - }, - { - name: "launchQuoteVault", - docs: [ - "The USDC vault that will hold the USDC raised until the launch is over.", - ], - type: "publicKey", - }, - { - name: "launchBaseVault", - docs: ["The token vault, used to send tokens to Raydium."], - type: "publicKey", - }, - { - name: "baseMint", - docs: [ - "The token that will be minted to funders and that will control the DAO.", - ], - type: "publicKey", - }, - { - name: "quoteMint", - docs: ["The USDC mint."], - type: "publicKey", - }, - { - name: "unixTimestampStarted", - docs: ["The unix timestamp when the launch was started."], - type: { - option: "i64", - }, - }, - { - name: "unixTimestampClosed", - docs: [ - "The unix timestamp when the launch stopped taking new contributions.", - ], - type: { - option: "i64", - }, - }, - { - name: "totalCommittedAmount", - docs: ["The amount of USDC that has been committed by the users."], - type: "u64", - }, - { - name: "finalRaiseAmount", - docs: ["The final raise amount."], - type: { - option: "u64", - }, - }, - { - name: "state", - docs: ["The state of the launch."], - type: { - defined: "LaunchState", - }, - }, - { - name: "seqNum", - docs: [ - "The sequence number of this launch. Useful for sorting events.", - ], - type: "u64", - }, - { - name: "secondsForLaunch", - docs: ["The number of seconds that the launch will be live for."], - type: "u32", - }, - { - name: "dao", - docs: ["The DAO, if the launch is complete."], - type: { - option: "publicKey", - }, - }, - { - name: "daoVault", - docs: [ - "The DAO treasury that USDC / LP is sent to, if the launch is complete.", - ], - type: { - option: "publicKey", - }, - }, - { - name: "performancePackageGrantee", - docs: [ - "The address that will receive the performance package tokens.", - ], - type: "publicKey", - }, - { - name: "performancePackageTokenAmount", - docs: [ - "The amount of tokens to be granted to the performance package grantee.", - ], - type: "u64", - }, - { - name: "monthsUntilInsidersCanUnlock", - docs: [ - "The number of months that insiders must wait before unlocking their tokens.", - ], - type: "u8", - }, - { - name: "teamAddress", - docs: ["The initial address used to sponsor team proposals."], - type: "publicKey", - }, - ], - }, - }, - ], - types: [ - { - name: "CommonFields", - type: { - kind: "struct", - fields: [ - { - name: "slot", - type: "u64", - }, - { - name: "unixTimestamp", - type: "i64", - }, - { - name: "launchSeqNum", - type: "u64", - }, - ], - }, - }, - { - name: "CompleteLaunchArgs", - type: { - kind: "struct", - fields: [ - { - name: "finalRaiseAmount", - type: { - option: "u64", - }, - }, - ], - }, - }, - { - name: "InitializeLaunchArgs", - type: { - kind: "struct", - fields: [ - { - name: "minimumRaiseAmount", - type: "u64", - }, - { - name: "monthlySpendingLimitAmount", - type: "u64", - }, - { - name: "monthlySpendingLimitMembers", - type: { - vec: "publicKey", - }, - }, - { - name: "secondsForLaunch", - type: "u32", - }, - { - name: "tokenName", - type: "string", - }, - { - name: "tokenSymbol", - type: "string", - }, - { - name: "tokenUri", - type: "string", - }, - { - name: "performancePackageGrantee", - type: "publicKey", - }, - { - name: "performancePackageTokenAmount", - type: "u64", - }, - { - name: "monthsUntilInsidersCanUnlock", - type: "u8", - }, - { - name: "teamAddress", - type: "publicKey", - }, - ], - }, - }, - { - name: "ReturnFundsArgs", - type: { - kind: "struct", - fields: [ - { - name: "amount", - type: "u64", - }, - ], - }, - }, - { - name: "LaunchState", - type: { - kind: "enum", - variants: [ - { - name: "Initialized", - }, - { - name: "Live", - }, - { - name: "Closed", - }, - { - name: "Complete", - }, - { - name: "Refunding", - }, - ], - }, - }, - ], - events: [ - { - name: "LaunchInitializedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "minimumRaiseAmount", - type: "u64", - index: false, - }, - { - name: "launchAuthority", - type: "publicKey", - index: false, - }, - { - name: "launchSigner", - type: "publicKey", - index: false, - }, - { - name: "launchSignerPdaBump", - type: "u8", - index: false, - }, - { - name: "launchUsdcVault", - type: "publicKey", - index: false, - }, - { - name: "launchTokenVault", - type: "publicKey", - index: false, - }, - { - name: "performancePackageGrantee", - type: "publicKey", - index: false, - }, - { - name: "performancePackageTokenAmount", - type: "u64", - index: false, - }, - { - name: "monthsUntilInsidersCanUnlock", - type: "u8", - index: false, - }, - { - name: "monthlySpendingLimitAmount", - type: "u64", - index: false, - }, - { - name: "monthlySpendingLimitMembers", - type: { - vec: "publicKey", - }, - index: false, - }, - { - name: "baseMint", - type: "publicKey", - index: false, - }, - { - name: "quoteMint", - type: "publicKey", - index: false, - }, - { - name: "pdaBump", - type: "u8", - index: false, - }, - { - name: "secondsForLaunch", - type: "u32", - index: false, - }, - ], - }, - { - name: "LaunchStartedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "launchAuthority", - type: "publicKey", - index: false, - }, - { - name: "slotStarted", - type: "u64", - index: false, - }, - ], - }, - { - name: "LaunchFundedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "fundingRecord", - type: "publicKey", - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "funder", - type: "publicKey", - index: false, - }, - { - name: "amount", - type: "u64", - index: false, - }, - { - name: "totalCommittedByFunder", - type: "u64", - index: false, - }, - { - name: "totalCommitted", - type: "u64", - index: false, - }, - ], - }, - { - name: "LaunchCompletedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "finalState", - type: { - defined: "LaunchState", - }, - index: false, - }, - { - name: "totalCommitted", - type: "u64", - index: false, - }, - { - name: "dao", - type: { - option: "publicKey", - }, - index: false, - }, - { - name: "daoTreasury", - type: { - option: "publicKey", - }, - index: false, - }, - { - name: "finalRaiseAmount", - type: { - option: "u64", - }, - index: false, - }, - ], - }, - { - name: "LaunchRefundedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "funder", - type: "publicKey", - index: false, - }, - { - name: "usdcRefunded", - type: "u64", - index: false, - }, - { - name: "fundingRecord", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "LaunchClaimEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "funder", - type: "publicKey", - index: false, - }, - { - name: "tokensClaimed", - type: "u64", - index: false, - }, - { - name: "fundingRecord", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "LaunchCloseEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "newState", - type: { - defined: "LaunchState", - }, - index: false, - }, - ], - }, - { - name: "LaunchFundsReturnedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "recipient", - type: "publicKey", - index: false, - }, - { - name: "usdcReturned", - type: "u64", - index: false, - }, - ], - }, - ], - errors: [ - { - code: 6000, - name: "InvalidAmount", - msg: "Invalid amount", - }, - { - code: 6001, - name: "SupplyNonZero", - msg: "Supply must be zero", - }, - { - code: 6002, - name: "InvalidSecondsForLaunch", - msg: "Launch period must be between 1 hour and 2 weeks", - }, - { - code: 6003, - name: "InsufficientFunds", - msg: "Insufficient funds", - }, - { - code: 6004, - name: "InvalidTokenKey", - msg: "Token mint key must end in 'meta'", - }, - { - code: 6005, - name: "InvalidLaunchState", - msg: "Invalid launch state", - }, - { - code: 6006, - name: "LaunchPeriodNotOver", - msg: "Launch period not over", - }, - { - code: 6007, - name: "LaunchExpired", - msg: "Launch is complete, no more funding allowed", - }, - { - code: 6008, - name: "LaunchNotRefunding", - msg: "For you to get a refund, either the launch needs to be in a refunding state or the launch must have been over-committed", - }, - { - code: 6009, - name: "LaunchNotInitialized", - msg: "Launch must be initialized to be started", - }, - { - code: 6010, - name: "FreezeAuthoritySet", - msg: "Freeze authority can't be set on launchpad tokens", - }, - { - code: 6011, - name: "InvalidMonthlySpendingLimit", - msg: "Monthly spending limit must be less than 1/6th of the minimum raise amount and cannot be 0", - }, - { - code: 6012, - name: "InvalidMonthlySpendingLimitMembers", - msg: "There can only be at most 10 monthly spending limit members", - }, - { - code: 6013, - name: "InvalidPriceBasedPremineAmount", - msg: "Cannot do more than a 50% premine, minimum is 10 atoms of token", - }, - { - code: 6014, - name: "InvalidPerformancePackageMinUnlockTime", - msg: "Insiders must be forced to wait at least 18 months before unlocking their tokens", - }, - { - code: 6015, - name: "LaunchAuthorityNotSet", - msg: "Launch authority must be set to complete the launch until 2 days after closing", - }, - { - code: 6016, - name: "FinalRaiseAmountTooLow", - msg: "The final amount raised must be greater than or equal to the minimum raise amount", - }, - { - code: 6017, - name: "TokensAlreadyClaimed", - msg: "Tokens already claimed", - }, - { - code: 6018, - name: "MoneyAlreadyRefunded", - msg: "Money already refunded", - }, - { - code: 6019, - name: "InvariantViolated", - msg: "An invariant was violated. You should get in contact with the MetaDAO team if you see this", - }, - { - code: 6020, - name: "LaunchNotLive", - msg: "Launch must be live to be closed", - }, - { - code: 6021, - name: "InvalidMinimumRaiseAmount", - msg: "Minimum raise amount must be greater than or equal to $0.5 so that there's enough liquidity for the launch", - }, - { - code: 6022, - name: "InvalidAdmin", - msg: "Invalid admin", - }, - ], -}; diff --git a/sdk/src/v0.6/types/launchpad_v7.ts b/sdk/src/v0.6/types/launchpad_v7.ts deleted file mode 100644 index 64f065a02..000000000 --- a/sdk/src/v0.6/types/launchpad_v7.ts +++ /dev/null @@ -1,3053 +0,0 @@ -export type LaunchpadV7 = { - version: "0.7.0"; - name: "launchpad_v7"; - instructions: [ - { - name: "initializeLaunch"; - accounts: [ - { - name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "baseMint"; - isMut: true; - isSigner: false; - }, - { - name: "tokenMetadata"; - isMut: true; - isSigner: false; - }, - { - name: "launchSigner"; - isMut: false; - isSigner: false; - }, - { - name: "quoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "baseVault"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "launchAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "additionalTokensRecipient"; - isMut: false; - isSigner: false; - isOptional: true; - }, - { - name: "rent"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenMetadataProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "InitializeLaunchArgs"; - }; - }, - ]; - }, - { - name: "startLaunch"; - accounts: [ - { - name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "launchAuthority"; - isMut: false; - isSigner: true; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "fund"; - accounts: [ - { - name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "fundingRecord"; - isMut: true; - isSigner: false; - }, - { - name: "launchSigner"; - isMut: false; - isSigner: false; - }, - { - name: "launchQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "funder"; - isMut: false; - isSigner: true; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "funderQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "amount"; - type: "u64"; - }, - ]; - }, - { - name: "setFundingRecordApproval"; - accounts: [ - { - name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "fundingRecord"; - isMut: true; - isSigner: false; - }, - { - name: "launchAuthority"; - isMut: false; - isSigner: true; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "approvedAmount"; - type: "u64"; - }, - ]; - }, - { - name: "completeLaunch"; - accounts: [ - { - name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "launchAuthority"; - isMut: false; - isSigner: true; - isOptional: true; - }, - { - name: "tokenMetadata"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "launchSigner"; - isMut: true; - isSigner: false; - }, - { - name: "launchQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "launchBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "treasuryQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "baseMint"; - isMut: true; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "daoOwnedLpPosition"; - isMut: true; - isSigner: false; - }, - { - name: "futarchyAmmBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "futarchyAmmQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisig"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigVault"; - isMut: false; - isSigner: false; - }, - { - name: "spendingLimit"; - isMut: true; - isSigner: false; - }, - { - name: "performancePackage"; - isMut: true; - isSigner: false; - }, - { - name: "performancePackageTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "staticAccounts"; - accounts: [ - { - name: "futarchyProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenMetadataProgram"; - isMut: false; - isSigner: false; - }, - { - name: "autocratEventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "squadsProgram"; - isMut: false; - isSigner: false; - }, - { - name: "squadsProgramConfig"; - isMut: false; - isSigner: false; - }, - { - name: "squadsProgramConfigTreasury"; - isMut: true; - isSigner: false; - }, - { - name: "priceBasedPerformancePackageProgram"; - isMut: false; - isSigner: false; - }, - { - name: "priceBasedPerformancePackageEventAuthority"; - isMut: false; - isSigner: false; - }, - ]; - }, - { - name: "meteoraAccounts"; - accounts: [ - { - name: "dammV2Program"; - isMut: false; - isSigner: false; - }, - { - name: "config"; - isMut: false; - isSigner: false; - }, - { - name: "token2022Program"; - isMut: false; - isSigner: false; - }, - { - name: "positionNftAccount"; - isMut: true; - isSigner: false; - }, - { - name: "pool"; - isMut: true; - isSigner: false; - }, - { - name: "position"; - isMut: true; - isSigner: false; - }, - { - name: "positionNftMint"; - isMut: true; - isSigner: false; - }, - { - name: "baseMint"; - isMut: false; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "tokenAVault"; - isMut: true; - isSigner: false; - }, - { - name: "tokenBVault"; - isMut: true; - isSigner: false; - }, - { - name: "poolCreatorAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "poolAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "dammV2EventAuthority"; - isMut: false; - isSigner: false; - }, - ]; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "refund"; - accounts: [ - { - name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "fundingRecord"; - isMut: true; - isSigner: false; - }, - { - name: "launchQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "launchSigner"; - isMut: false; - isSigner: false; - }, - { - name: "funder"; - isMut: false; - isSigner: false; - }, - { - name: "funderQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "claim"; - accounts: [ - { - name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "fundingRecord"; - isMut: true; - isSigner: false; - }, - { - name: "launchSigner"; - isMut: false; - isSigner: false; - }, - { - name: "baseMint"; - isMut: true; - isSigner: false; - }, - { - name: "launchBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "funder"; - isMut: false; - isSigner: false; - }, - { - name: "funderTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "closeLaunch"; - accounts: [ - { - name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "claimAdditionalTokenAllocation"; - accounts: [ - { - name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "launchSigner"; - isMut: true; - isSigner: false; - }, - { - name: "launchBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "baseMint"; - isMut: true; - isSigner: false; - }, - { - name: "additionalTokensRecipient"; - isMut: false; - isSigner: false; - }, - { - name: "additionalTokensRecipientTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - ]; - accounts: [ - { - name: "fundingRecord"; - type: { - kind: "struct"; - fields: [ - { - name: "pdaBump"; - docs: ["The PDA bump."]; - type: "u8"; - }, - { - name: "funder"; - docs: ["The funder."]; - type: "publicKey"; - }, - { - name: "launch"; - docs: ["The launch."]; - type: "publicKey"; - }, - { - name: "committedAmount"; - docs: ["The amount of USDC that has been committed by the funder."]; - type: "u64"; - }, - { - name: "isTokensClaimed"; - docs: ["Whether the tokens have been claimed."]; - type: "bool"; - }, - { - name: "isUsdcRefunded"; - docs: ["Whether the USDC has been refunded."]; - type: "bool"; - }, - { - name: "approvedAmount"; - docs: [ - "The amount of USDC that the launch authority has approved for the funder.", - "If zero, the funder has not been approved for any amount.", - ]; - type: "u64"; - }, - ]; - }; - }, - { - name: "launch"; - type: { - kind: "struct"; - fields: [ - { - name: "pdaBump"; - docs: ["The PDA bump."]; - type: "u8"; - }, - { - name: "minimumRaiseAmount"; - docs: [ - "The minimum amount of USDC that must be raised, otherwise", - "everyone can get their USDC back.", - ]; - type: "u64"; - }, - { - name: "monthlySpendingLimitAmount"; - docs: [ - "The monthly spending limit the DAO allocates to the team. Must be", - "less than 1/6th of the minimum raise amount (so 6 months of burn).", - ]; - type: "u64"; - }, - { - name: "monthlySpendingLimitMembers"; - docs: [ - "The wallets that have access to the monthly spending limit.", - ]; - type: { - vec: "publicKey"; - }; - }, - { - name: "launchAuthority"; - docs: ["The account that can start the launch."]; - type: "publicKey"; - }, - { - name: "launchSigner"; - docs: [ - "The launch signer address. Needed because Raydium pools need a SOL payer and this PDA can't hold SOL.", - ]; - type: "publicKey"; - }, - { - name: "launchSignerPdaBump"; - docs: ["The PDA bump for the launch signer."]; - type: "u8"; - }, - { - name: "launchQuoteVault"; - docs: [ - "The USDC vault that will hold the USDC raised until the launch is over.", - ]; - type: "publicKey"; - }, - { - name: "launchBaseVault"; - docs: ["The token vault, used to send tokens to Raydium."]; - type: "publicKey"; - }, - { - name: "baseMint"; - docs: [ - "The token that will be minted to funders and that will control the DAO.", - ]; - type: "publicKey"; - }, - { - name: "quoteMint"; - docs: ["The USDC mint."]; - type: "publicKey"; - }, - { - name: "unixTimestampStarted"; - docs: ["The unix timestamp when the launch was started."]; - type: { - option: "i64"; - }; - }, - { - name: "unixTimestampClosed"; - docs: [ - "The unix timestamp when the launch stopped taking new contributions.", - ]; - type: { - option: "i64"; - }; - }, - { - name: "totalCommittedAmount"; - docs: ["The amount of USDC that has been committed by the users."]; - type: "u64"; - }, - { - name: "state"; - docs: ["The state of the launch."]; - type: { - defined: "LaunchState"; - }; - }, - { - name: "seqNum"; - docs: [ - "The sequence number of this launch. Useful for sorting events.", - ]; - type: "u64"; - }, - { - name: "secondsForLaunch"; - docs: ["The number of seconds that the launch will be live for."]; - type: "u32"; - }, - { - name: "dao"; - docs: ["The DAO, if the launch is complete."]; - type: { - option: "publicKey"; - }; - }, - { - name: "daoVault"; - docs: [ - "The DAO treasury that USDC / LP is sent to, if the launch is complete.", - ]; - type: { - option: "publicKey"; - }; - }, - { - name: "performancePackageGrantee"; - docs: [ - "The address that will receive the performance package tokens.", - ]; - type: "publicKey"; - }, - { - name: "performancePackageTokenAmount"; - docs: [ - "The amount of tokens to be granted to the performance package grantee.", - ]; - type: "u64"; - }, - { - name: "monthsUntilInsidersCanUnlock"; - docs: [ - "The number of months that insiders must wait before unlocking their tokens.", - ]; - type: "u8"; - }, - { - name: "teamAddress"; - docs: ["The initial address used to sponsor team proposals."]; - type: "publicKey"; - }, - { - name: "totalApprovedAmount"; - docs: [ - "The amount of USDC that the launch authority has approved across all funders.", - ]; - type: "u64"; - }, - { - name: "additionalTokensAmount"; - docs: [ - "The amount of additional tokens to be minted on a successful launch.", - ]; - type: "u64"; - }, - { - name: "additionalTokensRecipient"; - docs: [ - "The token account that will receive the additional tokens.", - ]; - type: { - option: "publicKey"; - }; - }, - { - name: "additionalTokensClaimed"; - docs: ["Are the additional tokens claimed"]; - type: "bool"; - }, - ]; - }; - }, - ]; - types: [ - { - name: "CommonFields"; - type: { - kind: "struct"; - fields: [ - { - name: "slot"; - type: "u64"; - }, - { - name: "unixTimestamp"; - type: "i64"; - }, - { - name: "launchSeqNum"; - type: "u64"; - }, - ]; - }; - }, - { - name: "InitializeLaunchArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "minimumRaiseAmount"; - type: "u64"; - }, - { - name: "monthlySpendingLimitAmount"; - type: "u64"; - }, - { - name: "monthlySpendingLimitMembers"; - type: { - vec: "publicKey"; - }; - }, - { - name: "secondsForLaunch"; - type: "u32"; - }, - { - name: "tokenName"; - type: "string"; - }, - { - name: "tokenSymbol"; - type: "string"; - }, - { - name: "tokenUri"; - type: "string"; - }, - { - name: "performancePackageGrantee"; - type: "publicKey"; - }, - { - name: "performancePackageTokenAmount"; - type: "u64"; - }, - { - name: "monthsUntilInsidersCanUnlock"; - type: "u8"; - }, - { - name: "teamAddress"; - type: "publicKey"; - }, - { - name: "additionalTokensAmount"; - type: "u64"; - }, - ]; - }; - }, - { - name: "LaunchState"; - type: { - kind: "enum"; - variants: [ - { - name: "Initialized"; - }, - { - name: "Live"; - }, - { - name: "Closed"; - }, - { - name: "Complete"; - }, - { - name: "Refunding"; - }, - ]; - }; - }, - ]; - events: [ - { - name: "LaunchInitializedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "launch"; - type: "publicKey"; - index: false; - }, - { - name: "minimumRaiseAmount"; - type: "u64"; - index: false; - }, - { - name: "launchAuthority"; - type: "publicKey"; - index: false; - }, - { - name: "launchSigner"; - type: "publicKey"; - index: false; - }, - { - name: "launchSignerPdaBump"; - type: "u8"; - index: false; - }, - { - name: "launchUsdcVault"; - type: "publicKey"; - index: false; - }, - { - name: "launchTokenVault"; - type: "publicKey"; - index: false; - }, - { - name: "performancePackageGrantee"; - type: "publicKey"; - index: false; - }, - { - name: "performancePackageTokenAmount"; - type: "u64"; - index: false; - }, - { - name: "monthsUntilInsidersCanUnlock"; - type: "u8"; - index: false; - }, - { - name: "monthlySpendingLimitAmount"; - type: "u64"; - index: false; - }, - { - name: "monthlySpendingLimitMembers"; - type: { - vec: "publicKey"; - }; - index: false; - }, - { - name: "baseMint"; - type: "publicKey"; - index: false; - }, - { - name: "quoteMint"; - type: "publicKey"; - index: false; - }, - { - name: "pdaBump"; - type: "u8"; - index: false; - }, - { - name: "secondsForLaunch"; - type: "u32"; - index: false; - }, - ]; - }, - { - name: "LaunchStartedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "launch"; - type: "publicKey"; - index: false; - }, - { - name: "launchAuthority"; - type: "publicKey"; - index: false; - }, - { - name: "slotStarted"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "LaunchFundedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "fundingRecord"; - type: "publicKey"; - index: false; - }, - { - name: "launch"; - type: "publicKey"; - index: false; - }, - { - name: "funder"; - type: "publicKey"; - index: false; - }, - { - name: "amount"; - type: "u64"; - index: false; - }, - { - name: "totalCommittedByFunder"; - type: "u64"; - index: false; - }, - { - name: "totalCommitted"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "FundingRecordApprovalSetEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "launch"; - type: "publicKey"; - index: false; - }, - { - name: "fundingRecord"; - type: "publicKey"; - index: false; - }, - { - name: "funder"; - type: "publicKey"; - index: false; - }, - { - name: "approvedAmount"; - type: "u64"; - index: false; - }, - { - name: "totalApproved"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "LaunchCompletedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "launch"; - type: "publicKey"; - index: false; - }, - { - name: "finalState"; - type: { - defined: "LaunchState"; - }; - index: false; - }, - { - name: "totalCommitted"; - type: "u64"; - index: false; - }, - { - name: "dao"; - type: { - option: "publicKey"; - }; - index: false; - }, - { - name: "daoTreasury"; - type: { - option: "publicKey"; - }; - index: false; - }, - { - name: "totalApprovedAmount"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "LaunchRefundedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "launch"; - type: "publicKey"; - index: false; - }, - { - name: "funder"; - type: "publicKey"; - index: false; - }, - { - name: "usdcRefunded"; - type: "u64"; - index: false; - }, - { - name: "fundingRecord"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "LaunchClaimEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "launch"; - type: "publicKey"; - index: false; - }, - { - name: "funder"; - type: "publicKey"; - index: false; - }, - { - name: "tokensClaimed"; - type: "u64"; - index: false; - }, - { - name: "fundingRecord"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "LaunchCloseEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "launch"; - type: "publicKey"; - index: false; - }, - { - name: "newState"; - type: { - defined: "LaunchState"; - }; - index: false; - }, - ]; - }, - { - name: "LaunchClaimAdditionalTokenAllocationEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "launch"; - type: "publicKey"; - index: false; - }, - { - name: "additionalTokensAmount"; - type: "u64"; - index: false; - }, - { - name: "additionalTokensRecipient"; - type: "publicKey"; - index: false; - }, - ]; - }, - ]; - errors: [ - { - code: 6000; - name: "InvalidAmount"; - msg: "Invalid amount"; - }, - { - code: 6001; - name: "SupplyNonZero"; - msg: "Supply must be zero"; - }, - { - code: 6002; - name: "InvalidSecondsForLaunch"; - msg: "Launch period must be between 1 hour and 2 weeks"; - }, - { - code: 6003; - name: "InsufficientFunds"; - msg: "Insufficient funds"; - }, - { - code: 6004; - name: "InvalidTokenKey"; - msg: "Token mint key must end in 'meta'"; - }, - { - code: 6005; - name: "InvalidLaunchState"; - msg: "Invalid launch state"; - }, - { - code: 6006; - name: "LaunchPeriodNotOver"; - msg: "Launch period not over"; - }, - { - code: 6007; - name: "LaunchExpired"; - msg: "Launch is complete, no more funding allowed"; - }, - { - code: 6008; - name: "LaunchNotRefunding"; - msg: "For you to get a refund, either the launch needs to be in a refunding state or the launch must have been over-committed"; - }, - { - code: 6009; - name: "LaunchNotInitialized"; - msg: "Launch must be initialized to be started"; - }, - { - code: 6010; - name: "FreezeAuthoritySet"; - msg: "Freeze authority can't be set on launchpad tokens"; - }, - { - code: 6011; - name: "InvalidMonthlySpendingLimit"; - msg: "Monthly spending limit must be less than 1/6th of the minimum raise amount and cannot be 0"; - }, - { - code: 6012; - name: "InvalidMonthlySpendingLimitMembers"; - msg: "There can only be at most 10 monthly spending limit members"; - }, - { - code: 6013; - name: "InvalidPriceBasedPremineAmount"; - msg: "Cannot do more than a 50% premine, minimum is 10 atoms of token"; - }, - { - code: 6014; - name: "InvalidPerformancePackageMinUnlockTime"; - msg: "Insiders must be forced to wait at least 18 months before unlocking their tokens"; - }, - { - code: 6015; - name: "LaunchAuthorityNotSet"; - msg: "Launch authority must be set to complete the launch until 2 days after closing"; - }, - { - code: 6016; - name: "FinalRaiseAmountTooLow"; - msg: "The final amount raised must be greater than or equal to the minimum raise amount"; - }, - { - code: 6017; - name: "TokensAlreadyClaimed"; - msg: "Tokens already claimed"; - }, - { - code: 6018; - name: "MoneyAlreadyRefunded"; - msg: "Money already refunded"; - }, - { - code: 6019; - name: "InvariantViolated"; - msg: "An invariant was violated. You should get in contact with the MetaDAO team if you see this"; - }, - { - code: 6020; - name: "LaunchNotLive"; - msg: "Launch must be live to be closed"; - }, - { - code: 6021; - name: "InvalidMinimumRaiseAmount"; - msg: "Minimum raise amount must be greater than or equal to $0.5 so that there's enough liquidity for the launch"; - }, - { - code: 6022; - name: "FinalRaiseAmountAlreadySet"; - msg: "The final raise amount has already been set"; - }, - { - code: 6023; - name: "TotalApprovedAmountTooLow"; - msg: "Total approved amount must be greater than or equal to the minimum raise amount"; - }, - { - code: 6024; - name: "InvalidAdditionalTokensRecipient"; - msg: "Invalid additional tokens recipient - should be set if additional tokens amount is greater than 0"; - }, - { - code: 6025; - name: "NoAdditionalTokensRecipientSet"; - msg: "No additional tokens recipient set"; - }, - { - code: 6026; - name: "AdditionalTokensAlreadyClaimed"; - msg: "Additional tokens already claimed"; - }, - ]; -}; - -export const IDL: LaunchpadV7 = { - version: "0.7.0", - name: "launchpad_v7", - instructions: [ - { - name: "initializeLaunch", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: true, - isSigner: false, - }, - { - name: "tokenMetadata", - isMut: true, - isSigner: false, - }, - { - name: "launchSigner", - isMut: false, - isSigner: false, - }, - { - name: "quoteVault", - isMut: true, - isSigner: false, - }, - { - name: "baseVault", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "launchAuthority", - isMut: false, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "additionalTokensRecipient", - isMut: false, - isSigner: false, - isOptional: true, - }, - { - name: "rent", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenMetadataProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "InitializeLaunchArgs", - }, - }, - ], - }, - { - name: "startLaunch", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "launchAuthority", - isMut: false, - isSigner: true, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "fund", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "fundingRecord", - isMut: true, - isSigner: false, - }, - { - name: "launchSigner", - isMut: false, - isSigner: false, - }, - { - name: "launchQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "funder", - isMut: false, - isSigner: true, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "funderQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "amount", - type: "u64", - }, - ], - }, - { - name: "setFundingRecordApproval", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "fundingRecord", - isMut: true, - isSigner: false, - }, - { - name: "launchAuthority", - isMut: false, - isSigner: true, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "approvedAmount", - type: "u64", - }, - ], - }, - { - name: "completeLaunch", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "launchAuthority", - isMut: false, - isSigner: true, - isOptional: true, - }, - { - name: "tokenMetadata", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "launchSigner", - isMut: true, - isSigner: false, - }, - { - name: "launchQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "launchBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "treasuryQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: true, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "daoOwnedLpPosition", - isMut: true, - isSigner: false, - }, - { - name: "futarchyAmmBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "futarchyAmmQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigVault", - isMut: false, - isSigner: false, - }, - { - name: "spendingLimit", - isMut: true, - isSigner: false, - }, - { - name: "performancePackage", - isMut: true, - isSigner: false, - }, - { - name: "performancePackageTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "staticAccounts", - accounts: [ - { - name: "futarchyProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenMetadataProgram", - isMut: false, - isSigner: false, - }, - { - name: "autocratEventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgram", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgramConfig", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgramConfigTreasury", - isMut: true, - isSigner: false, - }, - { - name: "priceBasedPerformancePackageProgram", - isMut: false, - isSigner: false, - }, - { - name: "priceBasedPerformancePackageEventAuthority", - isMut: false, - isSigner: false, - }, - ], - }, - { - name: "meteoraAccounts", - accounts: [ - { - name: "dammV2Program", - isMut: false, - isSigner: false, - }, - { - name: "config", - isMut: false, - isSigner: false, - }, - { - name: "token2022Program", - isMut: false, - isSigner: false, - }, - { - name: "positionNftAccount", - isMut: true, - isSigner: false, - }, - { - name: "pool", - isMut: true, - isSigner: false, - }, - { - name: "position", - isMut: true, - isSigner: false, - }, - { - name: "positionNftMint", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "tokenAVault", - isMut: true, - isSigner: false, - }, - { - name: "tokenBVault", - isMut: true, - isSigner: false, - }, - { - name: "poolCreatorAuthority", - isMut: false, - isSigner: false, - }, - { - name: "poolAuthority", - isMut: false, - isSigner: false, - }, - { - name: "dammV2EventAuthority", - isMut: false, - isSigner: false, - }, - ], - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "refund", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "fundingRecord", - isMut: true, - isSigner: false, - }, - { - name: "launchQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "launchSigner", - isMut: false, - isSigner: false, - }, - { - name: "funder", - isMut: false, - isSigner: false, - }, - { - name: "funderQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "claim", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "fundingRecord", - isMut: true, - isSigner: false, - }, - { - name: "launchSigner", - isMut: false, - isSigner: false, - }, - { - name: "baseMint", - isMut: true, - isSigner: false, - }, - { - name: "launchBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "funder", - isMut: false, - isSigner: false, - }, - { - name: "funderTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "closeLaunch", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "claimAdditionalTokenAllocation", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "launchSigner", - isMut: true, - isSigner: false, - }, - { - name: "launchBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: true, - isSigner: false, - }, - { - name: "additionalTokensRecipient", - isMut: false, - isSigner: false, - }, - { - name: "additionalTokensRecipientTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "fundingRecord", - type: { - kind: "struct", - fields: [ - { - name: "pdaBump", - docs: ["The PDA bump."], - type: "u8", - }, - { - name: "funder", - docs: ["The funder."], - type: "publicKey", - }, - { - name: "launch", - docs: ["The launch."], - type: "publicKey", - }, - { - name: "committedAmount", - docs: ["The amount of USDC that has been committed by the funder."], - type: "u64", - }, - { - name: "isTokensClaimed", - docs: ["Whether the tokens have been claimed."], - type: "bool", - }, - { - name: "isUsdcRefunded", - docs: ["Whether the USDC has been refunded."], - type: "bool", - }, - { - name: "approvedAmount", - docs: [ - "The amount of USDC that the launch authority has approved for the funder.", - "If zero, the funder has not been approved for any amount.", - ], - type: "u64", - }, - ], - }, - }, - { - name: "launch", - type: { - kind: "struct", - fields: [ - { - name: "pdaBump", - docs: ["The PDA bump."], - type: "u8", - }, - { - name: "minimumRaiseAmount", - docs: [ - "The minimum amount of USDC that must be raised, otherwise", - "everyone can get their USDC back.", - ], - type: "u64", - }, - { - name: "monthlySpendingLimitAmount", - docs: [ - "The monthly spending limit the DAO allocates to the team. Must be", - "less than 1/6th of the minimum raise amount (so 6 months of burn).", - ], - type: "u64", - }, - { - name: "monthlySpendingLimitMembers", - docs: [ - "The wallets that have access to the monthly spending limit.", - ], - type: { - vec: "publicKey", - }, - }, - { - name: "launchAuthority", - docs: ["The account that can start the launch."], - type: "publicKey", - }, - { - name: "launchSigner", - docs: [ - "The launch signer address. Needed because Raydium pools need a SOL payer and this PDA can't hold SOL.", - ], - type: "publicKey", - }, - { - name: "launchSignerPdaBump", - docs: ["The PDA bump for the launch signer."], - type: "u8", - }, - { - name: "launchQuoteVault", - docs: [ - "The USDC vault that will hold the USDC raised until the launch is over.", - ], - type: "publicKey", - }, - { - name: "launchBaseVault", - docs: ["The token vault, used to send tokens to Raydium."], - type: "publicKey", - }, - { - name: "baseMint", - docs: [ - "The token that will be minted to funders and that will control the DAO.", - ], - type: "publicKey", - }, - { - name: "quoteMint", - docs: ["The USDC mint."], - type: "publicKey", - }, - { - name: "unixTimestampStarted", - docs: ["The unix timestamp when the launch was started."], - type: { - option: "i64", - }, - }, - { - name: "unixTimestampClosed", - docs: [ - "The unix timestamp when the launch stopped taking new contributions.", - ], - type: { - option: "i64", - }, - }, - { - name: "totalCommittedAmount", - docs: ["The amount of USDC that has been committed by the users."], - type: "u64", - }, - { - name: "state", - docs: ["The state of the launch."], - type: { - defined: "LaunchState", - }, - }, - { - name: "seqNum", - docs: [ - "The sequence number of this launch. Useful for sorting events.", - ], - type: "u64", - }, - { - name: "secondsForLaunch", - docs: ["The number of seconds that the launch will be live for."], - type: "u32", - }, - { - name: "dao", - docs: ["The DAO, if the launch is complete."], - type: { - option: "publicKey", - }, - }, - { - name: "daoVault", - docs: [ - "The DAO treasury that USDC / LP is sent to, if the launch is complete.", - ], - type: { - option: "publicKey", - }, - }, - { - name: "performancePackageGrantee", - docs: [ - "The address that will receive the performance package tokens.", - ], - type: "publicKey", - }, - { - name: "performancePackageTokenAmount", - docs: [ - "The amount of tokens to be granted to the performance package grantee.", - ], - type: "u64", - }, - { - name: "monthsUntilInsidersCanUnlock", - docs: [ - "The number of months that insiders must wait before unlocking their tokens.", - ], - type: "u8", - }, - { - name: "teamAddress", - docs: ["The initial address used to sponsor team proposals."], - type: "publicKey", - }, - { - name: "totalApprovedAmount", - docs: [ - "The amount of USDC that the launch authority has approved across all funders.", - ], - type: "u64", - }, - { - name: "additionalTokensAmount", - docs: [ - "The amount of additional tokens to be minted on a successful launch.", - ], - type: "u64", - }, - { - name: "additionalTokensRecipient", - docs: [ - "The token account that will receive the additional tokens.", - ], - type: { - option: "publicKey", - }, - }, - { - name: "additionalTokensClaimed", - docs: ["Are the additional tokens claimed"], - type: "bool", - }, - ], - }, - }, - ], - types: [ - { - name: "CommonFields", - type: { - kind: "struct", - fields: [ - { - name: "slot", - type: "u64", - }, - { - name: "unixTimestamp", - type: "i64", - }, - { - name: "launchSeqNum", - type: "u64", - }, - ], - }, - }, - { - name: "InitializeLaunchArgs", - type: { - kind: "struct", - fields: [ - { - name: "minimumRaiseAmount", - type: "u64", - }, - { - name: "monthlySpendingLimitAmount", - type: "u64", - }, - { - name: "monthlySpendingLimitMembers", - type: { - vec: "publicKey", - }, - }, - { - name: "secondsForLaunch", - type: "u32", - }, - { - name: "tokenName", - type: "string", - }, - { - name: "tokenSymbol", - type: "string", - }, - { - name: "tokenUri", - type: "string", - }, - { - name: "performancePackageGrantee", - type: "publicKey", - }, - { - name: "performancePackageTokenAmount", - type: "u64", - }, - { - name: "monthsUntilInsidersCanUnlock", - type: "u8", - }, - { - name: "teamAddress", - type: "publicKey", - }, - { - name: "additionalTokensAmount", - type: "u64", - }, - ], - }, - }, - { - name: "LaunchState", - type: { - kind: "enum", - variants: [ - { - name: "Initialized", - }, - { - name: "Live", - }, - { - name: "Closed", - }, - { - name: "Complete", - }, - { - name: "Refunding", - }, - ], - }, - }, - ], - events: [ - { - name: "LaunchInitializedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "minimumRaiseAmount", - type: "u64", - index: false, - }, - { - name: "launchAuthority", - type: "publicKey", - index: false, - }, - { - name: "launchSigner", - type: "publicKey", - index: false, - }, - { - name: "launchSignerPdaBump", - type: "u8", - index: false, - }, - { - name: "launchUsdcVault", - type: "publicKey", - index: false, - }, - { - name: "launchTokenVault", - type: "publicKey", - index: false, - }, - { - name: "performancePackageGrantee", - type: "publicKey", - index: false, - }, - { - name: "performancePackageTokenAmount", - type: "u64", - index: false, - }, - { - name: "monthsUntilInsidersCanUnlock", - type: "u8", - index: false, - }, - { - name: "monthlySpendingLimitAmount", - type: "u64", - index: false, - }, - { - name: "monthlySpendingLimitMembers", - type: { - vec: "publicKey", - }, - index: false, - }, - { - name: "baseMint", - type: "publicKey", - index: false, - }, - { - name: "quoteMint", - type: "publicKey", - index: false, - }, - { - name: "pdaBump", - type: "u8", - index: false, - }, - { - name: "secondsForLaunch", - type: "u32", - index: false, - }, - ], - }, - { - name: "LaunchStartedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "launchAuthority", - type: "publicKey", - index: false, - }, - { - name: "slotStarted", - type: "u64", - index: false, - }, - ], - }, - { - name: "LaunchFundedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "fundingRecord", - type: "publicKey", - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "funder", - type: "publicKey", - index: false, - }, - { - name: "amount", - type: "u64", - index: false, - }, - { - name: "totalCommittedByFunder", - type: "u64", - index: false, - }, - { - name: "totalCommitted", - type: "u64", - index: false, - }, - ], - }, - { - name: "FundingRecordApprovalSetEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "fundingRecord", - type: "publicKey", - index: false, - }, - { - name: "funder", - type: "publicKey", - index: false, - }, - { - name: "approvedAmount", - type: "u64", - index: false, - }, - { - name: "totalApproved", - type: "u64", - index: false, - }, - ], - }, - { - name: "LaunchCompletedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "finalState", - type: { - defined: "LaunchState", - }, - index: false, - }, - { - name: "totalCommitted", - type: "u64", - index: false, - }, - { - name: "dao", - type: { - option: "publicKey", - }, - index: false, - }, - { - name: "daoTreasury", - type: { - option: "publicKey", - }, - index: false, - }, - { - name: "totalApprovedAmount", - type: "u64", - index: false, - }, - ], - }, - { - name: "LaunchRefundedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "funder", - type: "publicKey", - index: false, - }, - { - name: "usdcRefunded", - type: "u64", - index: false, - }, - { - name: "fundingRecord", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "LaunchClaimEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "funder", - type: "publicKey", - index: false, - }, - { - name: "tokensClaimed", - type: "u64", - index: false, - }, - { - name: "fundingRecord", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "LaunchCloseEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "newState", - type: { - defined: "LaunchState", - }, - index: false, - }, - ], - }, - { - name: "LaunchClaimAdditionalTokenAllocationEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "additionalTokensAmount", - type: "u64", - index: false, - }, - { - name: "additionalTokensRecipient", - type: "publicKey", - index: false, - }, - ], - }, - ], - errors: [ - { - code: 6000, - name: "InvalidAmount", - msg: "Invalid amount", - }, - { - code: 6001, - name: "SupplyNonZero", - msg: "Supply must be zero", - }, - { - code: 6002, - name: "InvalidSecondsForLaunch", - msg: "Launch period must be between 1 hour and 2 weeks", - }, - { - code: 6003, - name: "InsufficientFunds", - msg: "Insufficient funds", - }, - { - code: 6004, - name: "InvalidTokenKey", - msg: "Token mint key must end in 'meta'", - }, - { - code: 6005, - name: "InvalidLaunchState", - msg: "Invalid launch state", - }, - { - code: 6006, - name: "LaunchPeriodNotOver", - msg: "Launch period not over", - }, - { - code: 6007, - name: "LaunchExpired", - msg: "Launch is complete, no more funding allowed", - }, - { - code: 6008, - name: "LaunchNotRefunding", - msg: "For you to get a refund, either the launch needs to be in a refunding state or the launch must have been over-committed", - }, - { - code: 6009, - name: "LaunchNotInitialized", - msg: "Launch must be initialized to be started", - }, - { - code: 6010, - name: "FreezeAuthoritySet", - msg: "Freeze authority can't be set on launchpad tokens", - }, - { - code: 6011, - name: "InvalidMonthlySpendingLimit", - msg: "Monthly spending limit must be less than 1/6th of the minimum raise amount and cannot be 0", - }, - { - code: 6012, - name: "InvalidMonthlySpendingLimitMembers", - msg: "There can only be at most 10 monthly spending limit members", - }, - { - code: 6013, - name: "InvalidPriceBasedPremineAmount", - msg: "Cannot do more than a 50% premine, minimum is 10 atoms of token", - }, - { - code: 6014, - name: "InvalidPerformancePackageMinUnlockTime", - msg: "Insiders must be forced to wait at least 18 months before unlocking their tokens", - }, - { - code: 6015, - name: "LaunchAuthorityNotSet", - msg: "Launch authority must be set to complete the launch until 2 days after closing", - }, - { - code: 6016, - name: "FinalRaiseAmountTooLow", - msg: "The final amount raised must be greater than or equal to the minimum raise amount", - }, - { - code: 6017, - name: "TokensAlreadyClaimed", - msg: "Tokens already claimed", - }, - { - code: 6018, - name: "MoneyAlreadyRefunded", - msg: "Money already refunded", - }, - { - code: 6019, - name: "InvariantViolated", - msg: "An invariant was violated. You should get in contact with the MetaDAO team if you see this", - }, - { - code: 6020, - name: "LaunchNotLive", - msg: "Launch must be live to be closed", - }, - { - code: 6021, - name: "InvalidMinimumRaiseAmount", - msg: "Minimum raise amount must be greater than or equal to $0.5 so that there's enough liquidity for the launch", - }, - { - code: 6022, - name: "FinalRaiseAmountAlreadySet", - msg: "The final raise amount has already been set", - }, - { - code: 6023, - name: "TotalApprovedAmountTooLow", - msg: "Total approved amount must be greater than or equal to the minimum raise amount", - }, - { - code: 6024, - name: "InvalidAdditionalTokensRecipient", - msg: "Invalid additional tokens recipient - should be set if additional tokens amount is greater than 0", - }, - { - code: 6025, - name: "NoAdditionalTokensRecipientSet", - msg: "No additional tokens recipient set", - }, - { - code: 6026, - name: "AdditionalTokensAlreadyClaimed", - msg: "Additional tokens already claimed", - }, - ], -}; diff --git a/sdk/src/v0.6/types/optimistic_timelock.ts b/sdk/src/v0.6/types/optimistic_timelock.ts deleted file mode 100644 index fa1f43135..000000000 --- a/sdk/src/v0.6/types/optimistic_timelock.ts +++ /dev/null @@ -1,1023 +0,0 @@ -export type OptimisticTimelock = { - version: "0.3.0"; - name: "optimistic_timelock"; - instructions: [ - { - name: "createTimelock"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: false; - }, - { - name: "timelock"; - isMut: true; - isSigner: true; - }, - ]; - args: [ - { - name: "authority"; - type: "publicKey"; - }, - { - name: "delayInSlots"; - type: "u64"; - }, - { - name: "enqueuers"; - type: { - vec: "publicKey"; - }; - }, - { - name: "enqueuerCooldownSlots"; - type: "u64"; - }, - ]; - }, - { - name: "setDelayInSlots"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "delayInSlots"; - type: "u64"; - }, - ]; - }, - { - name: "setAuthority"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "authority"; - type: "publicKey"; - }, - ]; - }, - { - name: "setOptimisticProposerCooldownSlots"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "cooldownSlots"; - type: "u64"; - }, - ]; - }, - { - name: "addOptimisticProposer"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "enqueuer"; - type: "publicKey"; - }, - ]; - }, - { - name: "removeOptimisticProposer"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "optimisticProposer"; - type: "publicKey"; - }, - ]; - }, - { - name: "createTransactionBatch"; - accounts: [ - { - name: "transactionBatchAuthority"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: false; - isSigner: false; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: true; - }, - ]; - args: []; - }, - { - name: "addTransaction"; - accounts: [ - { - name: "transactionBatchAuthority"; - isMut: false; - isSigner: true; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "programId"; - type: "publicKey"; - }, - { - name: "accounts"; - type: { - vec: { - defined: "TransactionAccount"; - }; - }; - }, - { - name: "data"; - type: "bytes"; - }, - ]; - }, - { - name: "sealTransactionBatch"; - accounts: [ - { - name: "transactionBatchAuthority"; - isMut: false; - isSigner: true; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "enqueueTransactionBatch"; - accounts: [ - { - name: "authority"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "cancelTransactionBatch"; - accounts: [ - { - name: "authority"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "executeTransactionBatch"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: false; - }, - { - name: "timelock"; - isMut: false; - isSigner: false; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - ]; - accounts: [ - { - name: "timelock"; - type: { - kind: "struct"; - fields: [ - { - name: "authority"; - type: "publicKey"; - }, - { - name: "signerBump"; - type: "u8"; - }, - { - name: "delayInSlots"; - type: "u64"; - }, - { - name: "optimisticProposers"; - type: { - vec: { - defined: "OptimisticProposer"; - }; - }; - }, - { - name: "optimisticProposerCooldownSlots"; - docs: [ - "The cooldown period for enqueuers to prevent spamming the timelock.", - ]; - type: "u64"; - }, - ]; - }; - }, - { - name: "transactionBatch"; - type: { - kind: "struct"; - fields: [ - { - name: "status"; - type: { - defined: "TransactionBatchStatus"; - }; - }, - { - name: "transactions"; - type: { - vec: { - defined: "Transaction"; - }; - }; - }, - { - name: "timelock"; - type: "publicKey"; - }, - { - name: "enqueuedSlot"; - type: "u64"; - }, - { - name: "transactionBatchAuthority"; - type: "publicKey"; - }, - { - name: "enqueuerType"; - type: { - defined: "AuthorityType"; - }; - }, - ]; - }; - }, - ]; - types: [ - { - name: "OptimisticProposer"; - type: { - kind: "struct"; - fields: [ - { - name: "pubkey"; - type: "publicKey"; - }, - { - name: "lastSlotEnqueued"; - type: "u64"; - }, - ]; - }; - }, - { - name: "Transaction"; - type: { - kind: "struct"; - fields: [ - { - name: "programId"; - type: "publicKey"; - }, - { - name: "accounts"; - type: { - vec: { - defined: "TransactionAccount"; - }; - }; - }, - { - name: "data"; - type: "bytes"; - }, - { - name: "didExecute"; - type: "bool"; - }, - ]; - }; - }, - { - name: "TransactionAccount"; - type: { - kind: "struct"; - fields: [ - { - name: "pubkey"; - type: "publicKey"; - }, - { - name: "isSigner"; - type: "bool"; - }, - { - name: "isWritable"; - type: "bool"; - }, - ]; - }; - }, - { - name: "AuthorityType"; - type: { - kind: "enum"; - variants: [ - { - name: "OptimisticProposer"; - }, - { - name: "TimelockAuthority"; - }, - ]; - }; - }, - { - name: "TransactionBatchStatus"; - type: { - kind: "enum"; - variants: [ - { - name: "Created"; - }, - { - name: "Sealed"; - }, - { - name: "Enqueued"; - }, - { - name: "Cancelled"; - }, - { - name: "Executed"; - }, - ]; - }; - }, - ]; - errors: [ - { - code: 6000; - name: "NotReady"; - msg: "This transaction is not yet ready to be executed"; - }, - { - code: 6001; - name: "CannotAddTransactions"; - msg: "Can only add instructions when transaction batch status is `Created`"; - }, - { - code: 6002; - name: "CannotSealTransactionBatch"; - msg: "Can only seal the transaction batch when status is `Created`"; - }, - { - code: 6003; - name: "CannotEnqueueTransactionBatch"; - msg: "Can only enqueue the timelock running once the status is `Sealed`"; - }, - { - code: 6004; - name: "CannotCancelTimelock"; - msg: "Can only cancel the transactions if the status `Enqueued`"; - }, - { - code: 6005; - name: "CanOnlyCancelDuringTimelockPeriod"; - msg: "Can only cancel the transactions during the timelock period"; - }, - { - code: 6006; - name: "CannotExecuteTransactions"; - msg: "Can only execute the transactions if the status is `Enqueued`"; - }, - { - code: 6007; - name: "NoAuthority"; - msg: "The signer is neither the timelock authority nor an optimistic proposer"; - }, - { - code: 6008; - name: "InsufficientPermissions"; - msg: "Optimistic proposers can't cancel transaction batches enqueued by the timelock authority"; - }, - { - code: 6009; - name: "OptimisticProposerCooldown"; - msg: "This optimistic proposer is still in its cooldown period"; - }, - ]; -}; - -export const IDL: OptimisticTimelock = { - version: "0.3.0", - name: "optimistic_timelock", - instructions: [ - { - name: "createTimelock", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: false, - }, - { - name: "timelock", - isMut: true, - isSigner: true, - }, - ], - args: [ - { - name: "authority", - type: "publicKey", - }, - { - name: "delayInSlots", - type: "u64", - }, - { - name: "enqueuers", - type: { - vec: "publicKey", - }, - }, - { - name: "enqueuerCooldownSlots", - type: "u64", - }, - ], - }, - { - name: "setDelayInSlots", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "delayInSlots", - type: "u64", - }, - ], - }, - { - name: "setAuthority", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "authority", - type: "publicKey", - }, - ], - }, - { - name: "setOptimisticProposerCooldownSlots", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "cooldownSlots", - type: "u64", - }, - ], - }, - { - name: "addOptimisticProposer", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "enqueuer", - type: "publicKey", - }, - ], - }, - { - name: "removeOptimisticProposer", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "optimisticProposer", - type: "publicKey", - }, - ], - }, - { - name: "createTransactionBatch", - accounts: [ - { - name: "transactionBatchAuthority", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: false, - isSigner: false, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: true, - }, - ], - args: [], - }, - { - name: "addTransaction", - accounts: [ - { - name: "transactionBatchAuthority", - isMut: false, - isSigner: true, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "programId", - type: "publicKey", - }, - { - name: "accounts", - type: { - vec: { - defined: "TransactionAccount", - }, - }, - }, - { - name: "data", - type: "bytes", - }, - ], - }, - { - name: "sealTransactionBatch", - accounts: [ - { - name: "transactionBatchAuthority", - isMut: false, - isSigner: true, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - { - name: "enqueueTransactionBatch", - accounts: [ - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - { - name: "cancelTransactionBatch", - accounts: [ - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - { - name: "executeTransactionBatch", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: false, - }, - { - name: "timelock", - isMut: false, - isSigner: false, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "timelock", - type: { - kind: "struct", - fields: [ - { - name: "authority", - type: "publicKey", - }, - { - name: "signerBump", - type: "u8", - }, - { - name: "delayInSlots", - type: "u64", - }, - { - name: "optimisticProposers", - type: { - vec: { - defined: "OptimisticProposer", - }, - }, - }, - { - name: "optimisticProposerCooldownSlots", - docs: [ - "The cooldown period for enqueuers to prevent spamming the timelock.", - ], - type: "u64", - }, - ], - }, - }, - { - name: "transactionBatch", - type: { - kind: "struct", - fields: [ - { - name: "status", - type: { - defined: "TransactionBatchStatus", - }, - }, - { - name: "transactions", - type: { - vec: { - defined: "Transaction", - }, - }, - }, - { - name: "timelock", - type: "publicKey", - }, - { - name: "enqueuedSlot", - type: "u64", - }, - { - name: "transactionBatchAuthority", - type: "publicKey", - }, - { - name: "enqueuerType", - type: { - defined: "AuthorityType", - }, - }, - ], - }, - }, - ], - types: [ - { - name: "OptimisticProposer", - type: { - kind: "struct", - fields: [ - { - name: "pubkey", - type: "publicKey", - }, - { - name: "lastSlotEnqueued", - type: "u64", - }, - ], - }, - }, - { - name: "Transaction", - type: { - kind: "struct", - fields: [ - { - name: "programId", - type: "publicKey", - }, - { - name: "accounts", - type: { - vec: { - defined: "TransactionAccount", - }, - }, - }, - { - name: "data", - type: "bytes", - }, - { - name: "didExecute", - type: "bool", - }, - ], - }, - }, - { - name: "TransactionAccount", - type: { - kind: "struct", - fields: [ - { - name: "pubkey", - type: "publicKey", - }, - { - name: "isSigner", - type: "bool", - }, - { - name: "isWritable", - type: "bool", - }, - ], - }, - }, - { - name: "AuthorityType", - type: { - kind: "enum", - variants: [ - { - name: "OptimisticProposer", - }, - { - name: "TimelockAuthority", - }, - ], - }, - }, - { - name: "TransactionBatchStatus", - type: { - kind: "enum", - variants: [ - { - name: "Created", - }, - { - name: "Sealed", - }, - { - name: "Enqueued", - }, - { - name: "Cancelled", - }, - { - name: "Executed", - }, - ], - }, - }, - ], - errors: [ - { - code: 6000, - name: "NotReady", - msg: "This transaction is not yet ready to be executed", - }, - { - code: 6001, - name: "CannotAddTransactions", - msg: "Can only add instructions when transaction batch status is `Created`", - }, - { - code: 6002, - name: "CannotSealTransactionBatch", - msg: "Can only seal the transaction batch when status is `Created`", - }, - { - code: 6003, - name: "CannotEnqueueTransactionBatch", - msg: "Can only enqueue the timelock running once the status is `Sealed`", - }, - { - code: 6004, - name: "CannotCancelTimelock", - msg: "Can only cancel the transactions if the status `Enqueued`", - }, - { - code: 6005, - name: "CanOnlyCancelDuringTimelockPeriod", - msg: "Can only cancel the transactions during the timelock period", - }, - { - code: 6006, - name: "CannotExecuteTransactions", - msg: "Can only execute the transactions if the status is `Enqueued`", - }, - { - code: 6007, - name: "NoAuthority", - msg: "The signer is neither the timelock authority nor an optimistic proposer", - }, - { - code: 6008, - name: "InsufficientPermissions", - msg: "Optimistic proposers can't cancel transaction batches enqueued by the timelock authority", - }, - { - code: 6009, - name: "OptimisticProposerCooldown", - msg: "This optimistic proposer is still in its cooldown period", - }, - ], -}; diff --git a/sdk/src/v0.6/types/price_based_performance_package.ts b/sdk/src/v0.6/types/price_based_performance_package.ts deleted file mode 100644 index e72df8588..000000000 --- a/sdk/src/v0.6/types/price_based_performance_package.ts +++ /dev/null @@ -1,1893 +0,0 @@ -export type PriceBasedPerformancePackage = { - version: "0.6.0"; - name: "price_based_performance_package"; - constants: [ - { - name: "MAX_TRANCHES"; - type: { - defined: "usize"; - }; - value: "10"; - }, - ]; - instructions: [ - { - name: "initializePerformancePackage"; - accounts: [ - { - name: "performancePackage"; - isMut: true; - isSigner: false; - }, - { - name: "createKey"; - isMut: false; - isSigner: true; - docs: ["Used to derive the PDA"]; - }, - { - name: "tokenMint"; - isMut: false; - isSigner: false; - docs: ["The mint of the tokens to be locked"]; - }, - { - name: "grantorTokenAccount"; - isMut: true; - isSigner: false; - docs: ["The token account containing the tokens to be locked"]; - }, - { - name: "grantor"; - isMut: false; - isSigner: true; - docs: ["The authority of the token account"]; - }, - { - name: "performancePackageTokenVault"; - isMut: true; - isSigner: false; - docs: ["The locker's token account where tokens will be stored"]; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "InitializePerformancePackageParams"; - }; - }, - ]; - }, - { - name: "startUnlock"; - accounts: [ - { - name: "performancePackage"; - isMut: true; - isSigner: false; - }, - { - name: "oracleAccount"; - isMut: false; - isSigner: false; - }, - { - name: "recipient"; - isMut: false; - isSigner: true; - docs: ["Only the token recipient can start unlock"]; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "completeUnlock"; - accounts: [ - { - name: "performancePackage"; - isMut: true; - isSigner: false; - }, - { - name: "oracleAccount"; - isMut: false; - isSigner: false; - }, - { - name: "performancePackageTokenVault"; - isMut: true; - isSigner: false; - docs: ["The token account where locked tokens are stored"]; - }, - { - name: "tokenMint"; - isMut: false; - isSigner: false; - docs: ["The token mint - validated via has_one constraint on locker"]; - }, - { - name: "recipientTokenAccount"; - isMut: true; - isSigner: false; - docs: [ - "The recipient's ATA where tokens will be sent - created if needed", - ]; - }, - { - name: "tokenRecipient"; - isMut: false; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - docs: ["Payer for creating the ATA if needed"]; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "proposeChange"; - accounts: [ - { - name: "changeRequest"; - isMut: true; - isSigner: false; - }, - { - name: "performancePackage"; - isMut: true; - isSigner: false; - }, - { - name: "proposer"; - isMut: false; - isSigner: true; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "ProposeChangeParams"; - }; - }, - ]; - }, - { - name: "executeChange"; - accounts: [ - { - name: "changeRequest"; - isMut: true; - isSigner: false; - }, - { - name: "performancePackage"; - isMut: true; - isSigner: false; - }, - { - name: "executor"; - isMut: true; - isSigner: true; - docs: [ - "The party executing the change (must be opposite of proposer)", - ]; - }, - ]; - args: []; - }, - { - name: "changePerformancePackageAuthority"; - accounts: [ - { - name: "performancePackage"; - isMut: true; - isSigner: false; - }, - { - name: "currentAuthority"; - isMut: false; - isSigner: true; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "ChangePerformancePackageAuthorityParams"; - }; - }, - ]; - }, - { - name: "burnPerformancePackage"; - accounts: [ - { - name: "performancePackage"; - isMut: true; - isSigner: false; - }, - { - name: "performancePackageTokenVault"; - isMut: true; - isSigner: false; - }, - { - name: "admin"; - isMut: true; - isSigner: true; - }, - { - name: "spillAccount"; - isMut: true; - isSigner: false; - }, - { - name: "tokenMint"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - ]; - accounts: [ - { - name: "performancePackage"; - type: { - kind: "struct"; - fields: [ - { - name: "tranches"; - docs: ["The tranches that make up the performance package"]; - type: { - vec: { - defined: "StoredTranche"; - }; - }; - }, - { - name: "totalTokenAmount"; - docs: ["Total amount of tokens in the performance package"]; - type: "u64"; - }, - { - name: "alreadyUnlockedAmount"; - docs: ["Amount of tokens already unlocked"]; - type: "u64"; - }, - { - name: "minUnlockTimestamp"; - docs: ["The timestamp when unlocking can begin"]; - type: "i64"; - }, - { - name: "oracleConfig"; - docs: ["Where to pull price data from"]; - type: { - defined: "OracleConfig"; - }; - }, - { - name: "twapLengthSeconds"; - docs: [ - "Length of time in seconds for TWAP calculation, between 1 day and 1 year", - ]; - type: "u32"; - }, - { - name: "recipient"; - docs: ["The recipient of the tokens when unlocked"]; - type: "publicKey"; - }, - { - name: "state"; - docs: ["The current state of the locker"]; - type: { - defined: "PerformancePackageState"; - }; - }, - { - name: "createKey"; - docs: ["Used to derive the PDA"]; - type: "publicKey"; - }, - { - name: "pdaBump"; - docs: ["The PDA bump"]; - type: "u8"; - }, - { - name: "performancePackageAuthority"; - docs: [ - "The authorized locker authority that can execute changes, usually the organization", - ]; - type: "publicKey"; - }, - { - name: "tokenMint"; - docs: ["The mint of the locked tokens"]; - type: "publicKey"; - }, - { - name: "seqNum"; - docs: [ - "The sequence number of the performance package, used for indexing events", - ]; - type: "u64"; - }, - { - name: "performancePackageTokenVault"; - docs: ["The vault that stores the tokens"]; - type: "publicKey"; - }, - ]; - }; - }, - { - name: "changeRequest"; - type: { - kind: "struct"; - fields: [ - { - name: "performancePackage"; - docs: ["The performance package this change applies to"]; - type: "publicKey"; - }, - { - name: "changeType"; - docs: ["What is being changed"]; - type: { - defined: "ChangeType"; - }; - }, - { - name: "proposedAt"; - docs: ["When the change was proposed"]; - type: "i64"; - }, - { - name: "proposerType"; - docs: [ - "Who proposed this change (either token_recipient or locker_authority)", - ]; - type: { - defined: "ProposerType"; - }; - }, - { - name: "pdaNonce"; - docs: ["Used to derive the PDA along with the proposer"]; - type: "u32"; - }, - { - name: "pdaBump"; - docs: ["The PDA bump"]; - type: "u8"; - }, - ]; - }; - }, - ]; - types: [ - { - name: "CommonFields"; - type: { - kind: "struct"; - fields: [ - { - name: "slot"; - type: "u64"; - }, - { - name: "unixTimestamp"; - type: "i64"; - }, - { - name: "performancePackageSeqNum"; - type: "u64"; - }, - ]; - }; - }, - { - name: "ChangePerformancePackageAuthorityParams"; - type: { - kind: "struct"; - fields: [ - { - name: "newPerformancePackageAuthority"; - type: "publicKey"; - }, - ]; - }; - }, - { - name: "InitializePerformancePackageParams"; - type: { - kind: "struct"; - fields: [ - { - name: "tranches"; - type: { - vec: { - defined: "Tranche"; - }; - }; - }, - { - name: "minUnlockTimestamp"; - type: "i64"; - }, - { - name: "oracleConfig"; - type: { - defined: "OracleConfig"; - }; - }, - { - name: "twapLengthSeconds"; - type: "u32"; - }, - { - name: "grantee"; - type: "publicKey"; - }, - { - name: "performancePackageAuthority"; - type: "publicKey"; - }, - ]; - }; - }, - { - name: "ProposeChangeParams"; - type: { - kind: "struct"; - fields: [ - { - name: "changeType"; - type: { - defined: "ChangeType"; - }; - }, - { - name: "pdaNonce"; - type: "u32"; - }, - ]; - }; - }, - { - name: "OracleConfig"; - docs: [ - "Starting at `byte_offset` in `oracle_account`, this program expects to read:", - "- 16 bytes for the aggregator, stored as a little endian u128", - "- 8 bytes for the slot that the aggregator was last updated, stored as a", - "little endian u64", - "", - "The aggregator should be a weighted sum of prices, where the weight is the", - "number of seconds between prices. Here's an example:", - "- at second 0, the aggregator is 0", - "- at second 1, the price is 10 and the aggregator is 10 (10 * 1)", - "- at second 4, the price is 11 and 3 seconds have passed, so the aggregator is", - "10 + 11 * 3 = 43", - "", - "This allows our program to read a TWAP over a time period by reading the", - "aggregator value at the beginning and at the end, and dividing the difference", - "by the number of seconds between the two.", - ]; - type: { - kind: "struct"; - fields: [ - { - name: "oracleAccount"; - type: "publicKey"; - }, - { - name: "byteOffset"; - type: "u32"; - }, - ]; - }; - }, - { - name: "Tranche"; - type: { - kind: "struct"; - fields: [ - { - name: "priceThreshold"; - docs: ["The price at which this tranch unlocks"]; - type: "u128"; - }, - { - name: "tokenAmount"; - docs: ["The amount of tokens in this tranch"]; - type: "u64"; - }, - ]; - }; - }, - { - name: "StoredTranche"; - type: { - kind: "struct"; - fields: [ - { - name: "priceThreshold"; - type: "u128"; - }, - { - name: "tokenAmount"; - type: "u64"; - }, - { - name: "isUnlocked"; - type: "bool"; - }, - ]; - }; - }, - { - name: "PerformancePackageState"; - type: { - kind: "enum"; - variants: [ - { - name: "Locked"; - }, - { - name: "Unlocking"; - fields: [ - { - name: "startAggregator"; - docs: ["The aggregator value when unlocking started"]; - type: "u128"; - }, - { - name: "startTimestamp"; - docs: ["The timestamp when unlocking started"]; - type: "i64"; - }, - ]; - }, - { - name: "Unlocked"; - }, - ]; - }; - }, - { - name: "ChangeType"; - type: { - kind: "enum"; - variants: [ - { - name: "Oracle"; - fields: [ - { - name: "newOracleConfig"; - type: { - defined: "OracleConfig"; - }; - }, - ]; - }, - { - name: "Recipient"; - fields: [ - { - name: "newRecipient"; - type: "publicKey"; - }, - ]; - }, - ]; - }; - }, - { - name: "ProposerType"; - type: { - kind: "enum"; - variants: [ - { - name: "Recipient"; - }, - { - name: "Authority"; - }, - ]; - }; - }, - ]; - events: [ - { - name: "PerformancePackageInitialized"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "performancePackage"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "UnlockStarted"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "performancePackage"; - type: "publicKey"; - index: false; - }, - { - name: "startAggregator"; - type: "u128"; - index: false; - }, - { - name: "startTimestamp"; - type: "i64"; - index: false; - }, - ]; - }, - { - name: "UnlockCompleted"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "performancePackage"; - type: "publicKey"; - index: false; - }, - { - name: "tokenAmount"; - type: "u64"; - index: false; - }, - { - name: "recipient"; - type: "publicKey"; - index: false; - }, - { - name: "twapPrice"; - type: "u128"; - index: false; - }, - ]; - }, - { - name: "ChangeProposed"; - fields: [ - { - name: "locker"; - type: "publicKey"; - index: false; - }, - { - name: "changeRequest"; - type: "publicKey"; - index: false; - }, - { - name: "proposer"; - type: "publicKey"; - index: false; - }, - { - name: "changeType"; - type: { - defined: "ChangeType"; - }; - index: false; - }, - ]; - }, - { - name: "ChangeExecuted"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "performancePackage"; - type: "publicKey"; - index: false; - }, - { - name: "changeRequest"; - type: "publicKey"; - index: false; - }, - { - name: "executor"; - type: "publicKey"; - index: false; - }, - { - name: "changeType"; - type: { - defined: "ChangeType"; - }; - index: false; - }, - ]; - }, - { - name: "PerformancePackageAuthorityChanged"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "locker"; - type: "publicKey"; - index: false; - }, - { - name: "oldAuthority"; - type: "publicKey"; - index: false; - }, - { - name: "newAuthority"; - type: "publicKey"; - index: false; - }, - ]; - }, - ]; - errors: [ - { - code: 6000; - name: "UnlockTimestampNotReached"; - msg: "Unlock timestamp has not been reached yet"; - }, - { - code: 6001; - name: "UnlockTimestampInThePast"; - msg: "Unlock timestamp must be in the future"; - }, - { - code: 6002; - name: "InvalidPerformancePackageState"; - msg: "Performance package is not in the expected state"; - }, - { - code: 6003; - name: "TwapPeriodNotElapsed"; - msg: "TWAP calculation failed"; - }, - { - code: 6004; - name: "PriceThresholdNotMet"; - msg: "Price threshold not met"; - }, - { - code: 6005; - name: "InvalidOracleData"; - msg: "Invalid oracle account data"; - }, - { - code: 6006; - name: "UnauthorizedChangeRequest"; - msg: "Unauthorized to create or execute change request"; - }, - { - code: 6007; - name: "InvalidChangeRequest"; - msg: "Change request does not match locker"; - }, - { - code: 6008; - name: "UnauthorizedLockerAuthority"; - msg: "Unauthorized locker authority"; - }, - { - code: 6009; - name: "InvariantViolated"; - msg: "An invariant was violated. You should get in contact with the MetaDAO team if you see this"; - }, - { - code: 6010; - name: "TranchePriceThresholdsNotMonotonic"; - msg: "Tranche price thresholds must be monotonically increasing"; - }, - { - code: 6011; - name: "TrancheTokenAmountZero"; - msg: "Tranche token amount must be greater than 0"; - }, - { - code: 6012; - name: "InvalidTwapLength"; - msg: "TWAP length must be greater than or equal to 1 day and less than 1 year"; - }, - { - code: 6013; - name: "InvalidAdmin"; - msg: "Invalid admin"; - }, - ]; -}; - -export const IDL: PriceBasedPerformancePackage = { - version: "0.6.0", - name: "price_based_performance_package", - constants: [ - { - name: "MAX_TRANCHES", - type: { - defined: "usize", - }, - value: "10", - }, - ], - instructions: [ - { - name: "initializePerformancePackage", - accounts: [ - { - name: "performancePackage", - isMut: true, - isSigner: false, - }, - { - name: "createKey", - isMut: false, - isSigner: true, - docs: ["Used to derive the PDA"], - }, - { - name: "tokenMint", - isMut: false, - isSigner: false, - docs: ["The mint of the tokens to be locked"], - }, - { - name: "grantorTokenAccount", - isMut: true, - isSigner: false, - docs: ["The token account containing the tokens to be locked"], - }, - { - name: "grantor", - isMut: false, - isSigner: true, - docs: ["The authority of the token account"], - }, - { - name: "performancePackageTokenVault", - isMut: true, - isSigner: false, - docs: ["The locker's token account where tokens will be stored"], - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "InitializePerformancePackageParams", - }, - }, - ], - }, - { - name: "startUnlock", - accounts: [ - { - name: "performancePackage", - isMut: true, - isSigner: false, - }, - { - name: "oracleAccount", - isMut: false, - isSigner: false, - }, - { - name: "recipient", - isMut: false, - isSigner: true, - docs: ["Only the token recipient can start unlock"], - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "completeUnlock", - accounts: [ - { - name: "performancePackage", - isMut: true, - isSigner: false, - }, - { - name: "oracleAccount", - isMut: false, - isSigner: false, - }, - { - name: "performancePackageTokenVault", - isMut: true, - isSigner: false, - docs: ["The token account where locked tokens are stored"], - }, - { - name: "tokenMint", - isMut: false, - isSigner: false, - docs: ["The token mint - validated via has_one constraint on locker"], - }, - { - name: "recipientTokenAccount", - isMut: true, - isSigner: false, - docs: [ - "The recipient's ATA where tokens will be sent - created if needed", - ], - }, - { - name: "tokenRecipient", - isMut: false, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - docs: ["Payer for creating the ATA if needed"], - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "proposeChange", - accounts: [ - { - name: "changeRequest", - isMut: true, - isSigner: false, - }, - { - name: "performancePackage", - isMut: true, - isSigner: false, - }, - { - name: "proposer", - isMut: false, - isSigner: true, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "ProposeChangeParams", - }, - }, - ], - }, - { - name: "executeChange", - accounts: [ - { - name: "changeRequest", - isMut: true, - isSigner: false, - }, - { - name: "performancePackage", - isMut: true, - isSigner: false, - }, - { - name: "executor", - isMut: true, - isSigner: true, - docs: [ - "The party executing the change (must be opposite of proposer)", - ], - }, - ], - args: [], - }, - { - name: "changePerformancePackageAuthority", - accounts: [ - { - name: "performancePackage", - isMut: true, - isSigner: false, - }, - { - name: "currentAuthority", - isMut: false, - isSigner: true, - }, - ], - args: [ - { - name: "params", - type: { - defined: "ChangePerformancePackageAuthorityParams", - }, - }, - ], - }, - { - name: "burnPerformancePackage", - accounts: [ - { - name: "performancePackage", - isMut: true, - isSigner: false, - }, - { - name: "performancePackageTokenVault", - isMut: true, - isSigner: false, - }, - { - name: "admin", - isMut: true, - isSigner: true, - }, - { - name: "spillAccount", - isMut: true, - isSigner: false, - }, - { - name: "tokenMint", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "performancePackage", - type: { - kind: "struct", - fields: [ - { - name: "tranches", - docs: ["The tranches that make up the performance package"], - type: { - vec: { - defined: "StoredTranche", - }, - }, - }, - { - name: "totalTokenAmount", - docs: ["Total amount of tokens in the performance package"], - type: "u64", - }, - { - name: "alreadyUnlockedAmount", - docs: ["Amount of tokens already unlocked"], - type: "u64", - }, - { - name: "minUnlockTimestamp", - docs: ["The timestamp when unlocking can begin"], - type: "i64", - }, - { - name: "oracleConfig", - docs: ["Where to pull price data from"], - type: { - defined: "OracleConfig", - }, - }, - { - name: "twapLengthSeconds", - docs: [ - "Length of time in seconds for TWAP calculation, between 1 day and 1 year", - ], - type: "u32", - }, - { - name: "recipient", - docs: ["The recipient of the tokens when unlocked"], - type: "publicKey", - }, - { - name: "state", - docs: ["The current state of the locker"], - type: { - defined: "PerformancePackageState", - }, - }, - { - name: "createKey", - docs: ["Used to derive the PDA"], - type: "publicKey", - }, - { - name: "pdaBump", - docs: ["The PDA bump"], - type: "u8", - }, - { - name: "performancePackageAuthority", - docs: [ - "The authorized locker authority that can execute changes, usually the organization", - ], - type: "publicKey", - }, - { - name: "tokenMint", - docs: ["The mint of the locked tokens"], - type: "publicKey", - }, - { - name: "seqNum", - docs: [ - "The sequence number of the performance package, used for indexing events", - ], - type: "u64", - }, - { - name: "performancePackageTokenVault", - docs: ["The vault that stores the tokens"], - type: "publicKey", - }, - ], - }, - }, - { - name: "changeRequest", - type: { - kind: "struct", - fields: [ - { - name: "performancePackage", - docs: ["The performance package this change applies to"], - type: "publicKey", - }, - { - name: "changeType", - docs: ["What is being changed"], - type: { - defined: "ChangeType", - }, - }, - { - name: "proposedAt", - docs: ["When the change was proposed"], - type: "i64", - }, - { - name: "proposerType", - docs: [ - "Who proposed this change (either token_recipient or locker_authority)", - ], - type: { - defined: "ProposerType", - }, - }, - { - name: "pdaNonce", - docs: ["Used to derive the PDA along with the proposer"], - type: "u32", - }, - { - name: "pdaBump", - docs: ["The PDA bump"], - type: "u8", - }, - ], - }, - }, - ], - types: [ - { - name: "CommonFields", - type: { - kind: "struct", - fields: [ - { - name: "slot", - type: "u64", - }, - { - name: "unixTimestamp", - type: "i64", - }, - { - name: "performancePackageSeqNum", - type: "u64", - }, - ], - }, - }, - { - name: "ChangePerformancePackageAuthorityParams", - type: { - kind: "struct", - fields: [ - { - name: "newPerformancePackageAuthority", - type: "publicKey", - }, - ], - }, - }, - { - name: "InitializePerformancePackageParams", - type: { - kind: "struct", - fields: [ - { - name: "tranches", - type: { - vec: { - defined: "Tranche", - }, - }, - }, - { - name: "minUnlockTimestamp", - type: "i64", - }, - { - name: "oracleConfig", - type: { - defined: "OracleConfig", - }, - }, - { - name: "twapLengthSeconds", - type: "u32", - }, - { - name: "grantee", - type: "publicKey", - }, - { - name: "performancePackageAuthority", - type: "publicKey", - }, - ], - }, - }, - { - name: "ProposeChangeParams", - type: { - kind: "struct", - fields: [ - { - name: "changeType", - type: { - defined: "ChangeType", - }, - }, - { - name: "pdaNonce", - type: "u32", - }, - ], - }, - }, - { - name: "OracleConfig", - docs: [ - "Starting at `byte_offset` in `oracle_account`, this program expects to read:", - "- 16 bytes for the aggregator, stored as a little endian u128", - "- 8 bytes for the slot that the aggregator was last updated, stored as a", - "little endian u64", - "", - "The aggregator should be a weighted sum of prices, where the weight is the", - "number of seconds between prices. Here's an example:", - "- at second 0, the aggregator is 0", - "- at second 1, the price is 10 and the aggregator is 10 (10 * 1)", - "- at second 4, the price is 11 and 3 seconds have passed, so the aggregator is", - "10 + 11 * 3 = 43", - "", - "This allows our program to read a TWAP over a time period by reading the", - "aggregator value at the beginning and at the end, and dividing the difference", - "by the number of seconds between the two.", - ], - type: { - kind: "struct", - fields: [ - { - name: "oracleAccount", - type: "publicKey", - }, - { - name: "byteOffset", - type: "u32", - }, - ], - }, - }, - { - name: "Tranche", - type: { - kind: "struct", - fields: [ - { - name: "priceThreshold", - docs: ["The price at which this tranch unlocks"], - type: "u128", - }, - { - name: "tokenAmount", - docs: ["The amount of tokens in this tranch"], - type: "u64", - }, - ], - }, - }, - { - name: "StoredTranche", - type: { - kind: "struct", - fields: [ - { - name: "priceThreshold", - type: "u128", - }, - { - name: "tokenAmount", - type: "u64", - }, - { - name: "isUnlocked", - type: "bool", - }, - ], - }, - }, - { - name: "PerformancePackageState", - type: { - kind: "enum", - variants: [ - { - name: "Locked", - }, - { - name: "Unlocking", - fields: [ - { - name: "startAggregator", - docs: ["The aggregator value when unlocking started"], - type: "u128", - }, - { - name: "startTimestamp", - docs: ["The timestamp when unlocking started"], - type: "i64", - }, - ], - }, - { - name: "Unlocked", - }, - ], - }, - }, - { - name: "ChangeType", - type: { - kind: "enum", - variants: [ - { - name: "Oracle", - fields: [ - { - name: "newOracleConfig", - type: { - defined: "OracleConfig", - }, - }, - ], - }, - { - name: "Recipient", - fields: [ - { - name: "newRecipient", - type: "publicKey", - }, - ], - }, - ], - }, - }, - { - name: "ProposerType", - type: { - kind: "enum", - variants: [ - { - name: "Recipient", - }, - { - name: "Authority", - }, - ], - }, - }, - ], - events: [ - { - name: "PerformancePackageInitialized", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "performancePackage", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "UnlockStarted", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "performancePackage", - type: "publicKey", - index: false, - }, - { - name: "startAggregator", - type: "u128", - index: false, - }, - { - name: "startTimestamp", - type: "i64", - index: false, - }, - ], - }, - { - name: "UnlockCompleted", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "performancePackage", - type: "publicKey", - index: false, - }, - { - name: "tokenAmount", - type: "u64", - index: false, - }, - { - name: "recipient", - type: "publicKey", - index: false, - }, - { - name: "twapPrice", - type: "u128", - index: false, - }, - ], - }, - { - name: "ChangeProposed", - fields: [ - { - name: "locker", - type: "publicKey", - index: false, - }, - { - name: "changeRequest", - type: "publicKey", - index: false, - }, - { - name: "proposer", - type: "publicKey", - index: false, - }, - { - name: "changeType", - type: { - defined: "ChangeType", - }, - index: false, - }, - ], - }, - { - name: "ChangeExecuted", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "performancePackage", - type: "publicKey", - index: false, - }, - { - name: "changeRequest", - type: "publicKey", - index: false, - }, - { - name: "executor", - type: "publicKey", - index: false, - }, - { - name: "changeType", - type: { - defined: "ChangeType", - }, - index: false, - }, - ], - }, - { - name: "PerformancePackageAuthorityChanged", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "locker", - type: "publicKey", - index: false, - }, - { - name: "oldAuthority", - type: "publicKey", - index: false, - }, - { - name: "newAuthority", - type: "publicKey", - index: false, - }, - ], - }, - ], - errors: [ - { - code: 6000, - name: "UnlockTimestampNotReached", - msg: "Unlock timestamp has not been reached yet", - }, - { - code: 6001, - name: "UnlockTimestampInThePast", - msg: "Unlock timestamp must be in the future", - }, - { - code: 6002, - name: "InvalidPerformancePackageState", - msg: "Performance package is not in the expected state", - }, - { - code: 6003, - name: "TwapPeriodNotElapsed", - msg: "TWAP calculation failed", - }, - { - code: 6004, - name: "PriceThresholdNotMet", - msg: "Price threshold not met", - }, - { - code: 6005, - name: "InvalidOracleData", - msg: "Invalid oracle account data", - }, - { - code: 6006, - name: "UnauthorizedChangeRequest", - msg: "Unauthorized to create or execute change request", - }, - { - code: 6007, - name: "InvalidChangeRequest", - msg: "Change request does not match locker", - }, - { - code: 6008, - name: "UnauthorizedLockerAuthority", - msg: "Unauthorized locker authority", - }, - { - code: 6009, - name: "InvariantViolated", - msg: "An invariant was violated. You should get in contact with the MetaDAO team if you see this", - }, - { - code: 6010, - name: "TranchePriceThresholdsNotMonotonic", - msg: "Tranche price thresholds must be monotonically increasing", - }, - { - code: 6011, - name: "TrancheTokenAmountZero", - msg: "Tranche token amount must be greater than 0", - }, - { - code: 6012, - name: "InvalidTwapLength", - msg: "TWAP length must be greater than or equal to 1 day and less than 1 year", - }, - { - code: 6013, - name: "InvalidAdmin", - msg: "Invalid admin", - }, - ], -}; diff --git a/sdk/src/v0.6/types/price_based_token_lock.ts b/sdk/src/v0.6/types/price_based_token_lock.ts deleted file mode 100644 index 3ac0813bb..000000000 --- a/sdk/src/v0.6/types/price_based_token_lock.ts +++ /dev/null @@ -1,887 +0,0 @@ -export type PriceBasedTokenLock = { - version: "0.1.0"; - name: "price_based_token_lock"; - constants: [ - { - name: "SEED"; - type: "string"; - value: '"anchor"'; - }, - ]; - instructions: [ - { - name: "initializeLocker"; - accounts: [ - { - name: "locker"; - isMut: true; - isSigner: false; - }, - { - name: "createKey"; - isMut: false; - isSigner: true; - docs: ["Used to derive the PDA"]; - }, - { - name: "tokenMint"; - isMut: false; - isSigner: false; - docs: ["The mint of the tokens to be locked"]; - }, - { - name: "fromTokenAccount"; - isMut: true; - isSigner: false; - docs: ["The token account containing the tokens to be locked"]; - }, - { - name: "tokenAuthority"; - isMut: false; - isSigner: true; - docs: ["The authority of the token account"]; - }, - { - name: "lockerTokenAccount"; - isMut: true; - isSigner: false; - docs: ["The locker's token account where tokens will be stored"]; - }, - { - name: "recipientTokenAccount"; - isMut: false; - isSigner: false; - docs: [ - "The recipient's token account where tokens will be sent when unlocked", - ]; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "InitializeLockerParams"; - }; - }, - ]; - }, - { - name: "startUnlock"; - accounts: [ - { - name: "locker"; - isMut: true; - isSigner: false; - }, - { - name: "oracleAccount"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "completeUnlock"; - accounts: [ - { - name: "locker"; - isMut: true; - isSigner: false; - }, - { - name: "oracleAccount"; - isMut: false; - isSigner: false; - }, - { - name: "lockerTokenAccount"; - isMut: true; - isSigner: false; - docs: ["The token account where locked tokens are stored"]; - }, - { - name: "recipientTokenAccount"; - isMut: true; - isSigner: false; - docs: ["The recipient's token account where tokens will be sent"]; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - ]; - accounts: [ - { - name: "locker"; - type: { - kind: "struct"; - fields: [ - { - name: "priceThreshold"; - docs: [ - "The price threshold that must be met for tokens to be unlocked", - ]; - type: "u128"; - }, - { - name: "tokenAmount"; - docs: ["The amount of tokens locked"]; - type: "u64"; - }, - { - name: "unlockTimestamp"; - docs: ["The timestamp when unlocking can begin"]; - type: "i64"; - }, - { - name: "oracleConfig"; - docs: ["Where to pull price data from"]; - type: { - defined: "OracleConfig"; - }; - }, - { - name: "twapLengthSeconds"; - docs: ["Length of time in seconds for TWAP calculation"]; - type: "u64"; - }, - { - name: "tokenRecipient"; - docs: ["The recipient of the tokens when unlocked"]; - type: "publicKey"; - }, - { - name: "state"; - docs: ["The current state of the locker"]; - type: { - defined: "LockerState"; - }; - }, - { - name: "createKey"; - docs: ["Used to derive the PDA"]; - type: "publicKey"; - }, - { - name: "pdaBump"; - docs: ["The PDA bump"]; - type: "u8"; - }, - ]; - }; - }, - ]; - types: [ - { - name: "InitializeLockerParams"; - type: { - kind: "struct"; - fields: [ - { - name: "priceThreshold"; - type: "u128"; - }, - { - name: "tokenAmount"; - type: "u64"; - }, - { - name: "unlockTimestamp"; - type: "i64"; - }, - { - name: "oracleConfig"; - type: { - defined: "OracleConfig"; - }; - }, - { - name: "twapLengthSeconds"; - type: "u64"; - }, - { - name: "tokenRecipient"; - type: "publicKey"; - }, - ]; - }; - }, - { - name: "OracleConfig"; - docs: [ - "Starting at `byte_offset` in `oracle_account`, this program expects to read:", - "- 16 bytes for the aggregator, stored as a little endian u128", - "- 8 bytes for the slot that the aggregator was last updated, stored as a", - "little endian u64", - "", - "The aggregator should be a weighted sum of prices, where the weight is the", - "number of seconds between prices. Here's an example:", - "- at second 0, the aggregator is 0", - "- at second 1, the price is 10 and the aggregator is 10 (10 * 1)", - "- at second 4, the price is 11 and 3 seconds have passed, so the aggregator is", - "10 + 11 * 3 = 43", - "", - "This allows our program to read a TWAP over a time period by reading the", - "aggregator value at the beginning and at the end, and dividing the difference", - "by the number of seconds between the two.", - ]; - type: { - kind: "struct"; - fields: [ - { - name: "oracleAccount"; - type: "publicKey"; - }, - { - name: "byteOffset"; - type: "u32"; - }, - ]; - }; - }, - { - name: "LockerState"; - type: { - kind: "enum"; - variants: [ - { - name: "Locked"; - }, - { - name: "Unlocking"; - fields: [ - { - name: "startAggregator"; - docs: ["The aggregator value when unlocking started"]; - type: "u128"; - }, - { - name: "startTimestamp"; - docs: ["The timestamp when unlocking started"]; - type: "i64"; - }, - ]; - }, - { - name: "Unlocked"; - }, - ]; - }; - }, - ]; - events: [ - { - name: "LockerInitialized"; - fields: [ - { - name: "locker"; - type: "publicKey"; - index: false; - }, - { - name: "priceThreshold"; - type: "u128"; - index: false; - }, - { - name: "tokenAmount"; - type: "u64"; - index: false; - }, - { - name: "unlockTimestamp"; - type: "i64"; - index: false; - }, - { - name: "oracleConfig"; - type: { - defined: "OracleConfig"; - }; - index: false; - }, - { - name: "tokenRecipient"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "UnlockStarted"; - fields: [ - { - name: "locker"; - type: "publicKey"; - index: false; - }, - { - name: "startAggregator"; - type: "u128"; - index: false; - }, - { - name: "startTimestamp"; - type: "i64"; - index: false; - }, - ]; - }, - { - name: "UnlockCompleted"; - fields: [ - { - name: "locker"; - type: "publicKey"; - index: false; - }, - { - name: "tokenAmount"; - type: "u64"; - index: false; - }, - { - name: "recipient"; - type: "publicKey"; - index: false; - }, - { - name: "twapPrice"; - type: "u128"; - index: false; - }, - { - name: "priceThreshold"; - type: "u128"; - index: false; - }, - ]; - }, - ]; - errors: [ - { - code: 6000; - name: "UnlockTimestampNotReached"; - msg: "Unlock timestamp has not been reached yet"; - }, - { - code: 6001; - name: "InvalidLockerState"; - msg: "Locker is not in the expected state"; - }, - { - code: 6002; - name: "TwapCalculationFailed"; - msg: "TWAP calculation failed"; - }, - { - code: 6003; - name: "PriceThresholdNotMet"; - msg: "Price threshold not met"; - }, - { - code: 6004; - name: "InvalidOracleData"; - msg: "Invalid oracle account data"; - }, - ]; -}; - -export const IDL: PriceBasedTokenLock = { - version: "0.1.0", - name: "price_based_token_lock", - constants: [ - { - name: "SEED", - type: "string", - value: '"anchor"', - }, - ], - instructions: [ - { - name: "initializeLocker", - accounts: [ - { - name: "locker", - isMut: true, - isSigner: false, - }, - { - name: "createKey", - isMut: false, - isSigner: true, - docs: ["Used to derive the PDA"], - }, - { - name: "tokenMint", - isMut: false, - isSigner: false, - docs: ["The mint of the tokens to be locked"], - }, - { - name: "fromTokenAccount", - isMut: true, - isSigner: false, - docs: ["The token account containing the tokens to be locked"], - }, - { - name: "tokenAuthority", - isMut: false, - isSigner: true, - docs: ["The authority of the token account"], - }, - { - name: "lockerTokenAccount", - isMut: true, - isSigner: false, - docs: ["The locker's token account where tokens will be stored"], - }, - { - name: "recipientTokenAccount", - isMut: false, - isSigner: false, - docs: [ - "The recipient's token account where tokens will be sent when unlocked", - ], - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "InitializeLockerParams", - }, - }, - ], - }, - { - name: "startUnlock", - accounts: [ - { - name: "locker", - isMut: true, - isSigner: false, - }, - { - name: "oracleAccount", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "completeUnlock", - accounts: [ - { - name: "locker", - isMut: true, - isSigner: false, - }, - { - name: "oracleAccount", - isMut: false, - isSigner: false, - }, - { - name: "lockerTokenAccount", - isMut: true, - isSigner: false, - docs: ["The token account where locked tokens are stored"], - }, - { - name: "recipientTokenAccount", - isMut: true, - isSigner: false, - docs: ["The recipient's token account where tokens will be sent"], - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "locker", - type: { - kind: "struct", - fields: [ - { - name: "priceThreshold", - docs: [ - "The price threshold that must be met for tokens to be unlocked", - ], - type: "u128", - }, - { - name: "tokenAmount", - docs: ["The amount of tokens locked"], - type: "u64", - }, - { - name: "unlockTimestamp", - docs: ["The timestamp when unlocking can begin"], - type: "i64", - }, - { - name: "oracleConfig", - docs: ["Where to pull price data from"], - type: { - defined: "OracleConfig", - }, - }, - { - name: "twapLengthSeconds", - docs: ["Length of time in seconds for TWAP calculation"], - type: "u64", - }, - { - name: "tokenRecipient", - docs: ["The recipient of the tokens when unlocked"], - type: "publicKey", - }, - { - name: "state", - docs: ["The current state of the locker"], - type: { - defined: "LockerState", - }, - }, - { - name: "createKey", - docs: ["Used to derive the PDA"], - type: "publicKey", - }, - { - name: "pdaBump", - docs: ["The PDA bump"], - type: "u8", - }, - ], - }, - }, - ], - types: [ - { - name: "InitializeLockerParams", - type: { - kind: "struct", - fields: [ - { - name: "priceThreshold", - type: "u128", - }, - { - name: "tokenAmount", - type: "u64", - }, - { - name: "unlockTimestamp", - type: "i64", - }, - { - name: "oracleConfig", - type: { - defined: "OracleConfig", - }, - }, - { - name: "twapLengthSeconds", - type: "u64", - }, - { - name: "tokenRecipient", - type: "publicKey", - }, - ], - }, - }, - { - name: "OracleConfig", - docs: [ - "Starting at `byte_offset` in `oracle_account`, this program expects to read:", - "- 16 bytes for the aggregator, stored as a little endian u128", - "- 8 bytes for the slot that the aggregator was last updated, stored as a", - "little endian u64", - "", - "The aggregator should be a weighted sum of prices, where the weight is the", - "number of seconds between prices. Here's an example:", - "- at second 0, the aggregator is 0", - "- at second 1, the price is 10 and the aggregator is 10 (10 * 1)", - "- at second 4, the price is 11 and 3 seconds have passed, so the aggregator is", - "10 + 11 * 3 = 43", - "", - "This allows our program to read a TWAP over a time period by reading the", - "aggregator value at the beginning and at the end, and dividing the difference", - "by the number of seconds between the two.", - ], - type: { - kind: "struct", - fields: [ - { - name: "oracleAccount", - type: "publicKey", - }, - { - name: "byteOffset", - type: "u32", - }, - ], - }, - }, - { - name: "LockerState", - type: { - kind: "enum", - variants: [ - { - name: "Locked", - }, - { - name: "Unlocking", - fields: [ - { - name: "startAggregator", - docs: ["The aggregator value when unlocking started"], - type: "u128", - }, - { - name: "startTimestamp", - docs: ["The timestamp when unlocking started"], - type: "i64", - }, - ], - }, - { - name: "Unlocked", - }, - ], - }, - }, - ], - events: [ - { - name: "LockerInitialized", - fields: [ - { - name: "locker", - type: "publicKey", - index: false, - }, - { - name: "priceThreshold", - type: "u128", - index: false, - }, - { - name: "tokenAmount", - type: "u64", - index: false, - }, - { - name: "unlockTimestamp", - type: "i64", - index: false, - }, - { - name: "oracleConfig", - type: { - defined: "OracleConfig", - }, - index: false, - }, - { - name: "tokenRecipient", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "UnlockStarted", - fields: [ - { - name: "locker", - type: "publicKey", - index: false, - }, - { - name: "startAggregator", - type: "u128", - index: false, - }, - { - name: "startTimestamp", - type: "i64", - index: false, - }, - ], - }, - { - name: "UnlockCompleted", - fields: [ - { - name: "locker", - type: "publicKey", - index: false, - }, - { - name: "tokenAmount", - type: "u64", - index: false, - }, - { - name: "recipient", - type: "publicKey", - index: false, - }, - { - name: "twapPrice", - type: "u128", - index: false, - }, - { - name: "priceThreshold", - type: "u128", - index: false, - }, - ], - }, - ], - errors: [ - { - code: 6000, - name: "UnlockTimestampNotReached", - msg: "Unlock timestamp has not been reached yet", - }, - { - code: 6001, - name: "InvalidLockerState", - msg: "Locker is not in the expected state", - }, - { - code: 6002, - name: "TwapCalculationFailed", - msg: "TWAP calculation failed", - }, - { - code: 6003, - name: "PriceThresholdNotMet", - msg: "Price threshold not met", - }, - { - code: 6004, - name: "InvalidOracleData", - msg: "Invalid oracle account data", - }, - ], -}; diff --git a/sdk/src/v0.6/types/price_based_unlock.ts b/sdk/src/v0.6/types/price_based_unlock.ts deleted file mode 100644 index bd6db4a3f..000000000 --- a/sdk/src/v0.6/types/price_based_unlock.ts +++ /dev/null @@ -1,1717 +0,0 @@ -export type PriceBasedUnlock = { - version: "0.1.0"; - name: "price_based_unlock"; - constants: [ - { - name: "SEED"; - type: "string"; - value: '"anchor"'; - }, - ]; - instructions: [ - { - name: "initializeLocker"; - accounts: [ - { - name: "locker"; - isMut: true; - isSigner: false; - }, - { - name: "createKey"; - isMut: false; - isSigner: true; - docs: ["Used to derive the PDA"]; - }, - { - name: "tokenMint"; - isMut: false; - isSigner: false; - docs: ["The mint of the tokens to be locked"]; - }, - { - name: "fromTokenAccount"; - isMut: true; - isSigner: false; - docs: ["The token account containing the tokens to be locked"]; - }, - { - name: "tokenAuthority"; - isMut: false; - isSigner: true; - docs: ["The authority of the token account"]; - }, - { - name: "lockerTokenAccount"; - isMut: true; - isSigner: false; - docs: ["The locker's token account where tokens will be stored"]; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "InitializeLockerParams"; - }; - }, - ]; - }, - { - name: "startUnlock"; - accounts: [ - { - name: "locker"; - isMut: true; - isSigner: false; - }, - { - name: "oracleAccount"; - isMut: false; - isSigner: false; - }, - { - name: "recipient"; - isMut: false; - isSigner: true; - docs: ["Only the token recipient can start unlock"]; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "completeUnlock"; - accounts: [ - { - name: "locker"; - isMut: true; - isSigner: false; - }, - { - name: "oracleAccount"; - isMut: false; - isSigner: false; - }, - { - name: "lockerTokenAccount"; - isMut: true; - isSigner: false; - docs: ["The token account where locked tokens are stored"]; - }, - { - name: "tokenMint"; - isMut: false; - isSigner: false; - docs: ["The token mint - validated via has_one constraint on locker"]; - }, - { - name: "recipientTokenAccount"; - isMut: true; - isSigner: false; - docs: [ - "The recipient's ATA where tokens will be sent - created if needed", - ]; - }, - { - name: "tokenRecipient"; - isMut: false; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - docs: ["Payer for creating the ATA if needed"]; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "proposeChange"; - accounts: [ - { - name: "changeRequest"; - isMut: true; - isSigner: false; - }, - { - name: "locker"; - isMut: true; - isSigner: false; - }, - { - name: "proposer"; - isMut: true; - isSigner: true; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "ProposeChangeParams"; - }; - }, - ]; - }, - { - name: "executeChange"; - accounts: [ - { - name: "changeRequest"; - isMut: true; - isSigner: false; - }, - { - name: "locker"; - isMut: true; - isSigner: false; - }, - { - name: "executor"; - isMut: true; - isSigner: true; - docs: [ - "The party executing the change (must be opposite of proposer)", - ]; - }, - ]; - args: []; - }, - { - name: "changeLockerAuthority"; - accounts: [ - { - name: "locker"; - isMut: true; - isSigner: false; - }, - { - name: "currentAuthority"; - isMut: false; - isSigner: true; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "ChangeLockerAuthorityParams"; - }; - }, - ]; - }, - ]; - accounts: [ - { - name: "locker"; - type: { - kind: "struct"; - fields: [ - { - name: "priceThreshold"; - docs: ["The price threshold for 100% unlocking (max price target)"]; - type: "u128"; - }, - { - name: "tokenAmount"; - docs: ["The amount of tokens locked"]; - type: "u64"; - }, - { - name: "tokensAlreadyUnlocked"; - docs: ["The amount of tokens already unlocked"]; - type: "u64"; - }, - { - name: "unlockTimestamp"; - docs: ["The timestamp when unlocking can begin"]; - type: "i64"; - }, - { - name: "oracleConfig"; - docs: ["Where to pull price data from"]; - type: { - defined: "OracleConfig"; - }; - }, - { - name: "twapLengthSeconds"; - docs: ["Length of time in seconds for TWAP calculation"]; - type: "u64"; - }, - { - name: "tokenRecipient"; - docs: ["The recipient of the tokens when unlocked"]; - type: "publicKey"; - }, - { - name: "state"; - docs: ["The current state of the locker"]; - type: { - defined: "LockerState"; - }; - }, - { - name: "createKey"; - docs: ["Used to derive the PDA"]; - type: "publicKey"; - }, - { - name: "pdaBump"; - docs: ["The PDA bump"]; - type: "u8"; - }, - { - name: "lockerAuthority"; - docs: ["The authorized locker authority that can execute changes"]; - type: "publicKey"; - }, - { - name: "tokenMint"; - docs: ["The mint of the locked tokens"]; - type: "publicKey"; - }, - ]; - }; - }, - { - name: "changeRequest"; - type: { - kind: "struct"; - fields: [ - { - name: "locker"; - docs: ["The locker this change applies to"]; - type: "publicKey"; - }, - { - name: "changeType"; - docs: ["What is being changed"]; - type: { - defined: "ChangeType"; - }; - }, - { - name: "proposedAt"; - docs: ["When the change was proposed"]; - type: "i64"; - }, - { - name: "previousState"; - docs: ["The locker state before the change was proposed"]; - type: { - defined: "LockerState"; - }; - }, - { - name: "proposer"; - docs: [ - "Who proposed this change (either token_recipient or locker_authority)", - ]; - type: "publicKey"; - }, - { - name: "pdaNonce"; - docs: ["Used to derive the PDA along with the proposer"]; - type: "u32"; - }, - { - name: "pdaBump"; - docs: ["The PDA bump"]; - type: "u8"; - }, - ]; - }; - }, - ]; - types: [ - { - name: "CommonFields"; - type: { - kind: "struct"; - fields: [ - { - name: "slot"; - type: "u64"; - }, - { - name: "unixTimestamp"; - type: "i64"; - }, - { - name: "lockerSeqNum"; - type: "u64"; - }, - ]; - }; - }, - { - name: "ChangeLockerAuthorityParams"; - type: { - kind: "struct"; - fields: [ - { - name: "newLockerAuthority"; - type: "publicKey"; - }, - ]; - }; - }, - { - name: "InitializeLockerParams"; - type: { - kind: "struct"; - fields: [ - { - name: "priceThreshold"; - type: "u128"; - }, - { - name: "tokenAmount"; - type: "u64"; - }, - { - name: "unlockTimestamp"; - type: "i64"; - }, - { - name: "oracleConfig"; - type: { - defined: "OracleConfig"; - }; - }, - { - name: "twapLengthSeconds"; - type: "u64"; - }, - { - name: "beneficiary"; - type: "publicKey"; - }, - { - name: "lockerAuthority"; - type: "publicKey"; - }, - ]; - }; - }, - { - name: "ProposeChangeParams"; - type: { - kind: "struct"; - fields: [ - { - name: "changeType"; - type: { - defined: "ChangeType"; - }; - }, - { - name: "pdaNonce"; - type: "u32"; - }, - ]; - }; - }, - { - name: "OracleConfig"; - docs: [ - "Starting at `byte_offset` in `oracle_account`, this program expects to read:", - "- 16 bytes for the aggregator, stored as a little endian u128", - "- 8 bytes for the slot that the aggregator was last updated, stored as a", - "little endian u64", - "", - "The aggregator should be a weighted sum of prices, where the weight is the", - "number of seconds between prices. Here's an example:", - "- at second 0, the aggregator is 0", - "- at second 1, the price is 10 and the aggregator is 10 (10 * 1)", - "- at second 4, the price is 11 and 3 seconds have passed, so the aggregator is", - "10 + 11 * 3 = 43", - "", - "This allows our program to read a TWAP over a time period by reading the", - "aggregator value at the beginning and at the end, and dividing the difference", - "by the number of seconds between the two.", - ]; - type: { - kind: "struct"; - fields: [ - { - name: "oracleAccount"; - type: "publicKey"; - }, - { - name: "byteOffset"; - type: "u32"; - }, - ]; - }; - }, - { - name: "LockerState"; - type: { - kind: "enum"; - variants: [ - { - name: "Locked"; - }, - { - name: "Unlocking"; - fields: [ - { - name: "startAggregator"; - docs: ["The aggregator value when unlocking started"]; - type: "u128"; - }, - { - name: "startTimestamp"; - docs: ["The timestamp when unlocking started"]; - type: "i64"; - }, - ]; - }, - { - name: "Unlocked"; - }, - ]; - }; - }, - { - name: "ChangeType"; - type: { - kind: "enum"; - variants: [ - { - name: "Oracle"; - fields: [ - { - name: "newOracleConfig"; - type: { - defined: "OracleConfig"; - }; - }, - ]; - }, - { - name: "Recipient"; - fields: [ - { - name: "newRecipient"; - type: "publicKey"; - }, - ]; - }, - ]; - }; - }, - ]; - events: [ - { - name: "LockerInitialized"; - fields: [ - { - name: "locker"; - type: "publicKey"; - index: false; - }, - { - name: "priceThreshold"; - type: "u128"; - index: false; - }, - { - name: "tokenAmount"; - type: "u64"; - index: false; - }, - { - name: "unlockTimestamp"; - type: "i64"; - index: false; - }, - { - name: "oracleConfig"; - type: { - defined: "OracleConfig"; - }; - index: false; - }, - { - name: "tokenRecipient"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "UnlockStarted"; - fields: [ - { - name: "locker"; - type: "publicKey"; - index: false; - }, - { - name: "startAggregator"; - type: "u128"; - index: false; - }, - { - name: "startTimestamp"; - type: "i64"; - index: false; - }, - ]; - }, - { - name: "UnlockCompleted"; - fields: [ - { - name: "locker"; - type: "publicKey"; - index: false; - }, - { - name: "tokenAmount"; - type: "u64"; - index: false; - }, - { - name: "recipient"; - type: "publicKey"; - index: false; - }, - { - name: "twapPrice"; - type: "u128"; - index: false; - }, - { - name: "priceThreshold"; - type: "u128"; - index: false; - }, - ]; - }, - { - name: "TokensClaimed"; - fields: [ - { - name: "locker"; - type: "publicKey"; - index: false; - }, - { - name: "recipient"; - type: "publicKey"; - index: false; - }, - { - name: "tokensClaimed"; - type: "u64"; - index: false; - }, - { - name: "tokensAlreadyUnlocked"; - type: "u64"; - index: false; - }, - { - name: "totalTokenAmount"; - type: "u64"; - index: false; - }, - { - name: "currentPrice"; - type: "u128"; - index: false; - }, - { - name: "unlockPercentage"; - type: "u128"; - index: false; - }, - ]; - }, - { - name: "ChangeProposed"; - fields: [ - { - name: "locker"; - type: "publicKey"; - index: false; - }, - { - name: "changeRequest"; - type: "publicKey"; - index: false; - }, - { - name: "proposer"; - type: "publicKey"; - index: false; - }, - { - name: "changeType"; - type: { - defined: "ChangeType"; - }; - index: false; - }, - { - name: "proposedAt"; - type: "i64"; - index: false; - }, - ]; - }, - { - name: "ChangeExecuted"; - fields: [ - { - name: "locker"; - type: "publicKey"; - index: false; - }, - { - name: "changeRequest"; - type: "publicKey"; - index: false; - }, - { - name: "executor"; - type: "publicKey"; - index: false; - }, - { - name: "changeType"; - type: { - defined: "ChangeType"; - }; - index: false; - }, - { - name: "executedAt"; - type: "i64"; - index: false; - }, - ]; - }, - { - name: "LockerAuthorityChanged"; - fields: [ - { - name: "locker"; - type: "publicKey"; - index: false; - }, - { - name: "oldAuthority"; - type: "publicKey"; - index: false; - }, - { - name: "newAuthority"; - type: "publicKey"; - index: false; - }, - { - name: "changedAt"; - type: "i64"; - index: false; - }, - ]; - }, - ]; - errors: [ - { - code: 6000; - name: "UnlockTimestampNotReached"; - msg: "Unlock timestamp has not been reached yet"; - }, - { - code: 6001; - name: "UnlockTimestampInThePast"; - msg: "Unlock timestamp must be in the future"; - }, - { - code: 6002; - name: "InvalidLockerState"; - msg: "Locker is not in the expected state"; - }, - { - code: 6003; - name: "TwapCalculationFailed"; - msg: "TWAP calculation failed"; - }, - { - code: 6004; - name: "PriceThresholdNotMet"; - msg: "Price threshold not met"; - }, - { - code: 6005; - name: "InvalidOracleData"; - msg: "Invalid oracle account data"; - }, - { - code: 6006; - name: "UnauthorizedChangeRequest"; - msg: "Unauthorized to create or execute change request"; - }, - { - code: 6007; - name: "InvalidChangeRequest"; - msg: "Change request does not match locker"; - }, - { - code: 6008; - name: "UnauthorizedLockerAuthority"; - msg: "Unauthorized locker authority"; - }, - { - code: 6009; - name: "InvariantViolated"; - msg: "An invariant was violated. You should get in contact with the MetaDAO team if you see this"; - }, - ]; -}; - -export const IDL: PriceBasedUnlock = { - version: "0.1.0", - name: "price_based_unlock", - constants: [ - { - name: "SEED", - type: "string", - value: '"anchor"', - }, - ], - instructions: [ - { - name: "initializeLocker", - accounts: [ - { - name: "locker", - isMut: true, - isSigner: false, - }, - { - name: "createKey", - isMut: false, - isSigner: true, - docs: ["Used to derive the PDA"], - }, - { - name: "tokenMint", - isMut: false, - isSigner: false, - docs: ["The mint of the tokens to be locked"], - }, - { - name: "fromTokenAccount", - isMut: true, - isSigner: false, - docs: ["The token account containing the tokens to be locked"], - }, - { - name: "tokenAuthority", - isMut: false, - isSigner: true, - docs: ["The authority of the token account"], - }, - { - name: "lockerTokenAccount", - isMut: true, - isSigner: false, - docs: ["The locker's token account where tokens will be stored"], - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "InitializeLockerParams", - }, - }, - ], - }, - { - name: "startUnlock", - accounts: [ - { - name: "locker", - isMut: true, - isSigner: false, - }, - { - name: "oracleAccount", - isMut: false, - isSigner: false, - }, - { - name: "recipient", - isMut: false, - isSigner: true, - docs: ["Only the token recipient can start unlock"], - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "completeUnlock", - accounts: [ - { - name: "locker", - isMut: true, - isSigner: false, - }, - { - name: "oracleAccount", - isMut: false, - isSigner: false, - }, - { - name: "lockerTokenAccount", - isMut: true, - isSigner: false, - docs: ["The token account where locked tokens are stored"], - }, - { - name: "tokenMint", - isMut: false, - isSigner: false, - docs: ["The token mint - validated via has_one constraint on locker"], - }, - { - name: "recipientTokenAccount", - isMut: true, - isSigner: false, - docs: [ - "The recipient's ATA where tokens will be sent - created if needed", - ], - }, - { - name: "tokenRecipient", - isMut: false, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - docs: ["Payer for creating the ATA if needed"], - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "proposeChange", - accounts: [ - { - name: "changeRequest", - isMut: true, - isSigner: false, - }, - { - name: "locker", - isMut: true, - isSigner: false, - }, - { - name: "proposer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "ProposeChangeParams", - }, - }, - ], - }, - { - name: "executeChange", - accounts: [ - { - name: "changeRequest", - isMut: true, - isSigner: false, - }, - { - name: "locker", - isMut: true, - isSigner: false, - }, - { - name: "executor", - isMut: true, - isSigner: true, - docs: [ - "The party executing the change (must be opposite of proposer)", - ], - }, - ], - args: [], - }, - { - name: "changeLockerAuthority", - accounts: [ - { - name: "locker", - isMut: true, - isSigner: false, - }, - { - name: "currentAuthority", - isMut: false, - isSigner: true, - }, - ], - args: [ - { - name: "params", - type: { - defined: "ChangeLockerAuthorityParams", - }, - }, - ], - }, - ], - accounts: [ - { - name: "locker", - type: { - kind: "struct", - fields: [ - { - name: "priceThreshold", - docs: ["The price threshold for 100% unlocking (max price target)"], - type: "u128", - }, - { - name: "tokenAmount", - docs: ["The amount of tokens locked"], - type: "u64", - }, - { - name: "tokensAlreadyUnlocked", - docs: ["The amount of tokens already unlocked"], - type: "u64", - }, - { - name: "unlockTimestamp", - docs: ["The timestamp when unlocking can begin"], - type: "i64", - }, - { - name: "oracleConfig", - docs: ["Where to pull price data from"], - type: { - defined: "OracleConfig", - }, - }, - { - name: "twapLengthSeconds", - docs: ["Length of time in seconds for TWAP calculation"], - type: "u64", - }, - { - name: "tokenRecipient", - docs: ["The recipient of the tokens when unlocked"], - type: "publicKey", - }, - { - name: "state", - docs: ["The current state of the locker"], - type: { - defined: "LockerState", - }, - }, - { - name: "createKey", - docs: ["Used to derive the PDA"], - type: "publicKey", - }, - { - name: "pdaBump", - docs: ["The PDA bump"], - type: "u8", - }, - { - name: "lockerAuthority", - docs: ["The authorized locker authority that can execute changes"], - type: "publicKey", - }, - { - name: "tokenMint", - docs: ["The mint of the locked tokens"], - type: "publicKey", - }, - ], - }, - }, - { - name: "changeRequest", - type: { - kind: "struct", - fields: [ - { - name: "locker", - docs: ["The locker this change applies to"], - type: "publicKey", - }, - { - name: "changeType", - docs: ["What is being changed"], - type: { - defined: "ChangeType", - }, - }, - { - name: "proposedAt", - docs: ["When the change was proposed"], - type: "i64", - }, - { - name: "previousState", - docs: ["The locker state before the change was proposed"], - type: { - defined: "LockerState", - }, - }, - { - name: "proposer", - docs: [ - "Who proposed this change (either token_recipient or locker_authority)", - ], - type: "publicKey", - }, - { - name: "pdaNonce", - docs: ["Used to derive the PDA along with the proposer"], - type: "u32", - }, - { - name: "pdaBump", - docs: ["The PDA bump"], - type: "u8", - }, - ], - }, - }, - ], - types: [ - { - name: "CommonFields", - type: { - kind: "struct", - fields: [ - { - name: "slot", - type: "u64", - }, - { - name: "unixTimestamp", - type: "i64", - }, - { - name: "lockerSeqNum", - type: "u64", - }, - ], - }, - }, - { - name: "ChangeLockerAuthorityParams", - type: { - kind: "struct", - fields: [ - { - name: "newLockerAuthority", - type: "publicKey", - }, - ], - }, - }, - { - name: "InitializeLockerParams", - type: { - kind: "struct", - fields: [ - { - name: "priceThreshold", - type: "u128", - }, - { - name: "tokenAmount", - type: "u64", - }, - { - name: "unlockTimestamp", - type: "i64", - }, - { - name: "oracleConfig", - type: { - defined: "OracleConfig", - }, - }, - { - name: "twapLengthSeconds", - type: "u64", - }, - { - name: "beneficiary", - type: "publicKey", - }, - { - name: "lockerAuthority", - type: "publicKey", - }, - ], - }, - }, - { - name: "ProposeChangeParams", - type: { - kind: "struct", - fields: [ - { - name: "changeType", - type: { - defined: "ChangeType", - }, - }, - { - name: "pdaNonce", - type: "u32", - }, - ], - }, - }, - { - name: "OracleConfig", - docs: [ - "Starting at `byte_offset` in `oracle_account`, this program expects to read:", - "- 16 bytes for the aggregator, stored as a little endian u128", - "- 8 bytes for the slot that the aggregator was last updated, stored as a", - "little endian u64", - "", - "The aggregator should be a weighted sum of prices, where the weight is the", - "number of seconds between prices. Here's an example:", - "- at second 0, the aggregator is 0", - "- at second 1, the price is 10 and the aggregator is 10 (10 * 1)", - "- at second 4, the price is 11 and 3 seconds have passed, so the aggregator is", - "10 + 11 * 3 = 43", - "", - "This allows our program to read a TWAP over a time period by reading the", - "aggregator value at the beginning and at the end, and dividing the difference", - "by the number of seconds between the two.", - ], - type: { - kind: "struct", - fields: [ - { - name: "oracleAccount", - type: "publicKey", - }, - { - name: "byteOffset", - type: "u32", - }, - ], - }, - }, - { - name: "LockerState", - type: { - kind: "enum", - variants: [ - { - name: "Locked", - }, - { - name: "Unlocking", - fields: [ - { - name: "startAggregator", - docs: ["The aggregator value when unlocking started"], - type: "u128", - }, - { - name: "startTimestamp", - docs: ["The timestamp when unlocking started"], - type: "i64", - }, - ], - }, - { - name: "Unlocked", - }, - ], - }, - }, - { - name: "ChangeType", - type: { - kind: "enum", - variants: [ - { - name: "Oracle", - fields: [ - { - name: "newOracleConfig", - type: { - defined: "OracleConfig", - }, - }, - ], - }, - { - name: "Recipient", - fields: [ - { - name: "newRecipient", - type: "publicKey", - }, - ], - }, - ], - }, - }, - ], - events: [ - { - name: "LockerInitialized", - fields: [ - { - name: "locker", - type: "publicKey", - index: false, - }, - { - name: "priceThreshold", - type: "u128", - index: false, - }, - { - name: "tokenAmount", - type: "u64", - index: false, - }, - { - name: "unlockTimestamp", - type: "i64", - index: false, - }, - { - name: "oracleConfig", - type: { - defined: "OracleConfig", - }, - index: false, - }, - { - name: "tokenRecipient", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "UnlockStarted", - fields: [ - { - name: "locker", - type: "publicKey", - index: false, - }, - { - name: "startAggregator", - type: "u128", - index: false, - }, - { - name: "startTimestamp", - type: "i64", - index: false, - }, - ], - }, - { - name: "UnlockCompleted", - fields: [ - { - name: "locker", - type: "publicKey", - index: false, - }, - { - name: "tokenAmount", - type: "u64", - index: false, - }, - { - name: "recipient", - type: "publicKey", - index: false, - }, - { - name: "twapPrice", - type: "u128", - index: false, - }, - { - name: "priceThreshold", - type: "u128", - index: false, - }, - ], - }, - { - name: "TokensClaimed", - fields: [ - { - name: "locker", - type: "publicKey", - index: false, - }, - { - name: "recipient", - type: "publicKey", - index: false, - }, - { - name: "tokensClaimed", - type: "u64", - index: false, - }, - { - name: "tokensAlreadyUnlocked", - type: "u64", - index: false, - }, - { - name: "totalTokenAmount", - type: "u64", - index: false, - }, - { - name: "currentPrice", - type: "u128", - index: false, - }, - { - name: "unlockPercentage", - type: "u128", - index: false, - }, - ], - }, - { - name: "ChangeProposed", - fields: [ - { - name: "locker", - type: "publicKey", - index: false, - }, - { - name: "changeRequest", - type: "publicKey", - index: false, - }, - { - name: "proposer", - type: "publicKey", - index: false, - }, - { - name: "changeType", - type: { - defined: "ChangeType", - }, - index: false, - }, - { - name: "proposedAt", - type: "i64", - index: false, - }, - ], - }, - { - name: "ChangeExecuted", - fields: [ - { - name: "locker", - type: "publicKey", - index: false, - }, - { - name: "changeRequest", - type: "publicKey", - index: false, - }, - { - name: "executor", - type: "publicKey", - index: false, - }, - { - name: "changeType", - type: { - defined: "ChangeType", - }, - index: false, - }, - { - name: "executedAt", - type: "i64", - index: false, - }, - ], - }, - { - name: "LockerAuthorityChanged", - fields: [ - { - name: "locker", - type: "publicKey", - index: false, - }, - { - name: "oldAuthority", - type: "publicKey", - index: false, - }, - { - name: "newAuthority", - type: "publicKey", - index: false, - }, - { - name: "changedAt", - type: "i64", - index: false, - }, - ], - }, - ], - errors: [ - { - code: 6000, - name: "UnlockTimestampNotReached", - msg: "Unlock timestamp has not been reached yet", - }, - { - code: 6001, - name: "UnlockTimestampInThePast", - msg: "Unlock timestamp must be in the future", - }, - { - code: 6002, - name: "InvalidLockerState", - msg: "Locker is not in the expected state", - }, - { - code: 6003, - name: "TwapCalculationFailed", - msg: "TWAP calculation failed", - }, - { - code: 6004, - name: "PriceThresholdNotMet", - msg: "Price threshold not met", - }, - { - code: 6005, - name: "InvalidOracleData", - msg: "Invalid oracle account data", - }, - { - code: 6006, - name: "UnauthorizedChangeRequest", - msg: "Unauthorized to create or execute change request", - }, - { - code: 6007, - name: "InvalidChangeRequest", - msg: "Change request does not match locker", - }, - { - code: 6008, - name: "UnauthorizedLockerAuthority", - msg: "Unauthorized locker authority", - }, - { - code: 6009, - name: "InvariantViolated", - msg: "An invariant was violated. You should get in contact with the MetaDAO team if you see this", - }, - ], -}; diff --git a/sdk/src/v0.6/types/shared_liquidity_manager.ts b/sdk/src/v0.6/types/shared_liquidity_manager.ts deleted file mode 100644 index 124942da9..000000000 --- a/sdk/src/v0.6/types/shared_liquidity_manager.ts +++ /dev/null @@ -1,177 +0,0 @@ -export type SharedLiquidityManager = { - version: "0.1.0"; - name: "shared_liquidity_manager"; - docs: ["TODO:", "- add unstake", "- add unit tests"]; - instructions: []; - errors: [ - { - code: 6000; - name: "InsufficientStake"; - msg: "Insufficient stake amount"; - }, - { - code: 6001; - name: "ProposalNotFinalized"; - msg: "Proposal is not finalized"; - }, - { - code: 6002; - name: "NoLpTokensToRemove"; - msg: "No LP tokens to remove from AMM"; - }, - { - code: 6003; - name: "NoTokensFromAmm"; - msg: "No tokens received from AMM removal"; - }, - { - code: 6004; - name: "InsufficientReservesReturned"; - msg: "Insufficient reserves returned to spot AMM (less than 99.5%)"; - }, - { - code: 6005; - name: "PoolInUse"; - msg: "Pool is currently being used by an active proposal"; - }, - { - code: 6006; - name: "InsufficientLpShares"; - msg: "User does not have enough LP shares to withdraw"; - }, - { - code: 6007; - name: "SlippageExceeded"; - msg: "Slippage exceeded minimum token amounts"; - }, - { - code: 6008; - name: "NoLpTokensInPool"; - msg: "No LP tokens in pool's LP token account"; - }, - { - code: 6009; - name: "NotEnoughLpTokens"; - msg: "Not enough LP tokens to provide liquidity to proposal"; - }, - { - code: 6010; - name: "InsufficientFunds"; - msg: "Insufficient funds"; - }, - { - code: 6011; - name: "NoActiveProposal"; - msg: "No active proposal"; - }, - { - code: 6012; - name: "ProposalNotInDraftStatus"; - msg: "Proposal is not in draft status"; - }, - { - code: 6013; - name: "ProposalAlreadyActive"; - msg: "Proposal already active"; - }, - { - code: 6014; - name: "AmmAlreadyHasLiquidity"; - msg: "AMM already has liquidity"; - }, - { - code: 6015; - name: "QuestionAlreadyResolved"; - msg: "Question already resolved"; - }, - ]; -}; - -export const IDL: SharedLiquidityManager = { - version: "0.1.0", - name: "shared_liquidity_manager", - docs: ["TODO:", "- add unstake", "- add unit tests"], - instructions: [], - errors: [ - { - code: 6000, - name: "InsufficientStake", - msg: "Insufficient stake amount", - }, - { - code: 6001, - name: "ProposalNotFinalized", - msg: "Proposal is not finalized", - }, - { - code: 6002, - name: "NoLpTokensToRemove", - msg: "No LP tokens to remove from AMM", - }, - { - code: 6003, - name: "NoTokensFromAmm", - msg: "No tokens received from AMM removal", - }, - { - code: 6004, - name: "InsufficientReservesReturned", - msg: "Insufficient reserves returned to spot AMM (less than 99.5%)", - }, - { - code: 6005, - name: "PoolInUse", - msg: "Pool is currently being used by an active proposal", - }, - { - code: 6006, - name: "InsufficientLpShares", - msg: "User does not have enough LP shares to withdraw", - }, - { - code: 6007, - name: "SlippageExceeded", - msg: "Slippage exceeded minimum token amounts", - }, - { - code: 6008, - name: "NoLpTokensInPool", - msg: "No LP tokens in pool's LP token account", - }, - { - code: 6009, - name: "NotEnoughLpTokens", - msg: "Not enough LP tokens to provide liquidity to proposal", - }, - { - code: 6010, - name: "InsufficientFunds", - msg: "Insufficient funds", - }, - { - code: 6011, - name: "NoActiveProposal", - msg: "No active proposal", - }, - { - code: 6012, - name: "ProposalNotInDraftStatus", - msg: "Proposal is not in draft status", - }, - { - code: 6013, - name: "ProposalAlreadyActive", - msg: "Proposal already active", - }, - { - code: 6014, - name: "AmmAlreadyHasLiquidity", - msg: "AMM already has liquidity", - }, - { - code: 6015, - name: "QuestionAlreadyResolved", - msg: "Question already resolved", - }, - ], -}; diff --git a/sdk/src/v0.6/types/utils.ts b/sdk/src/v0.6/types/utils.ts deleted file mode 100644 index c878debe7..000000000 --- a/sdk/src/v0.6/types/utils.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type LowercaseKeys = { - [K in keyof T as Lowercase]: T[K]; -}; diff --git a/sdk/src/v0.6/utils/cu.ts b/sdk/src/v0.6/utils/cu.ts deleted file mode 100644 index b55cbac95..000000000 --- a/sdk/src/v0.6/utils/cu.ts +++ /dev/null @@ -1,11 +0,0 @@ -export const MaxCUs = { - initializeDao: 40_000, - createIdempotent: 25_000, - initializeConditionalVault: 45_000, - mintConditionalTokens: 35_000, - initializeAmm: 120_000, - addLiquidity: 120_000, - initializeProposal: 60_000, -}; - -export const DEFAULT_CU_PRICE = 1; diff --git a/sdk/src/v0.6/utils/filters.ts b/sdk/src/v0.6/utils/filters.ts deleted file mode 100644 index aee93f618..000000000 --- a/sdk/src/v0.6/utils/filters.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { GetProgramAccountsFilter, PublicKey } from "@solana/web3.js"; - -export const filterPositionsByUser = ( - userAddr: PublicKey, -): GetProgramAccountsFilter => ({ - memcmp: { - offset: 8, // discriminator - bytes: userAddr.toBase58(), - }, -}); - -export const filterPositionsByAmm = ( - ammAddr: PublicKey, -): GetProgramAccountsFilter => ({ - memcmp: { - offset: - 8 + // discriminator - 32, // user address - bytes: ammAddr.toBase58(), - }, -}); diff --git a/sdk/src/v0.6/utils/index.ts b/sdk/src/v0.6/utils/index.ts deleted file mode 100644 index ee7438b0a..000000000 --- a/sdk/src/v0.6/utils/index.ts +++ /dev/null @@ -1,40 +0,0 @@ -export * from "./filters.js"; -export * from "./pda.js"; -export * from "./priceMath.js"; -export * from "./metadata.js"; -export * from "./cu.js"; -export * from "./instruction.js"; - -import { AccountMeta, ComputeBudgetProgram, PublicKey } from "@solana/web3.js"; - -export enum PriorityFeeTier { - NORMAL = 35, - HIGH = 3571, - TURBO = 357142, -} - -export const addComputeUnits = (num_units: number = 1_400_000) => - ComputeBudgetProgram.setComputeUnitLimit({ - units: num_units, - }); - -export const addPriorityFee = (pf: number) => - ComputeBudgetProgram.setComputeUnitPrice({ - microLamports: pf, - }); - -export const pubkeyToAccountInfo = ( - pubkey: PublicKey, - isWritable: boolean, - isSigner = false, -): AccountMeta => { - return { - pubkey: pubkey, - isSigner: isSigner, - isWritable: isWritable, - }; -}; - -export async function sleep(ms: number) { - return new Promise((resolve) => setTimeout(resolve, ms)); -} diff --git a/sdk/src/v0.6/utils/instruction.ts b/sdk/src/v0.6/utils/instruction.ts deleted file mode 100644 index f18e48834..000000000 --- a/sdk/src/v0.6/utils/instruction.ts +++ /dev/null @@ -1,16 +0,0 @@ -import * as anchor from "@coral-xyz/anchor"; -import { TransactionInstruction } from "@solana/web3.js"; - -export class InstructionUtils { - public static async getInstructions( - ...methodBuilders: any[] - ): Promise { - let instructions: TransactionInstruction[] = []; - - for (const methodBuilder of methodBuilders) { - instructions.push(...(await methodBuilder.transaction()).instructions); - } - - return instructions; - } -} diff --git a/sdk/src/v0.6/utils/metadata.ts b/sdk/src/v0.6/utils/metadata.ts deleted file mode 100644 index ef17bbdb8..000000000 --- a/sdk/src/v0.6/utils/metadata.ts +++ /dev/null @@ -1,35 +0,0 @@ -import BN from "bn.js"; -import { createUmi } from "@metaplex-foundation/umi-bundle-defaults"; -import { Connection } from "@solana/web3.js"; -import { bundlrUploader } from "@metaplex-foundation/umi-uploader-bundlr"; -import { UmiPlugin } from "@metaplex-foundation/umi"; - -export const assetImageMap: Record = { - fMETA: "https://arweave.net/tGxvOjMZw7B0qHsdCcIMO57oH5g5OaItOZdXo3BXKz8", - fUSDC: "https://arweave.net/DpvxeAyVbaoivhIVCLjdf566k2SwVn0YVBL0sTOezWk", - pMETA: "https://arweave.net/iuqi7PRRESdDxj1oRyk2WzR90_zdFcmZsuWicv3XGfs", - pUSDC: "https://arweave.net/e4IO7F59F_RKCiuB--_ABPot7Qh1yFsGkWzVhcXuKDU", -}; - -// Upload some JSON, returning its URL -export const uploadConditionalTokenMetadataJson = async ( - connection: Connection, - identityPlugin: UmiPlugin, - proposalNumber: number, - symbol: string, - // proposal: BN, - // conditionalToken: string, - // image: string -): Promise => { - // use bundlr, targeting arweave - const umi = createUmi(connection); - umi.use(bundlrUploader()); - umi.use(identityPlugin); - - return umi.uploader.uploadJson({ - name: `Proposal ${proposalNumber}: ${symbol}`, - image: assetImageMap[symbol], - symbol, - description: "A conditional token for use in futarchy.", - }); -}; diff --git a/sdk/src/v0.6/utils/pda.ts b/sdk/src/v0.6/utils/pda.ts deleted file mode 100644 index a1c8836b3..000000000 --- a/sdk/src/v0.6/utils/pda.ts +++ /dev/null @@ -1,238 +0,0 @@ -import { AccountMeta, PublicKey } from "@solana/web3.js"; -import { utils } from "@coral-xyz/anchor"; -import { - ASSOCIATED_TOKEN_PROGRAM_ID, - TOKEN_PROGRAM_ID, -} from "@solana/spl-token"; -import BN from "bn.js"; -import { - fromWeb3JsPublicKey, - toWeb3JsPublicKey, -} from "@metaplex-foundation/umi-web3js-adapters"; -import { - DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID, - MPL_TOKEN_METADATA_PROGRAM_ID, - PRICE_BASED_PERFORMANCE_PACKAGE_PROGRAM_ID, - RAYDIUM_CP_SWAP_PROGRAM_ID, - SHARED_LIQUIDITY_MANAGER_PROGRAM_ID, -} from "../constants.js"; -import { LAUNCHPAD_PROGRAM_ID, FUTARCHY_PROGRAM_ID } from "../constants.js"; - -export const getEventAuthorityAddr = (programId: PublicKey) => { - return PublicKey.findProgramAddressSync( - [Buffer.from("__event_authority")], - programId, - ); -}; - -export const getQuestionAddr = ( - programId: PublicKey, - questionId: Uint8Array, - oracle: PublicKey, - numOutcomes: number, -) => { - if (questionId.length != 32) { - throw new Error("questionId must be 32 bytes"); - } - - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("question"), - Buffer.from(questionId), - oracle.toBuffer(), - new BN(numOutcomes).toArrayLike(Buffer, "le", 1), - ], - programId, - ); -}; - -export const getVaultAddr = ( - programId: PublicKey, - question: PublicKey, - underlyingTokenMint: PublicKey, -) => { - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("conditional_vault"), - question.toBuffer(), - underlyingTokenMint.toBuffer(), - ], - programId, - ); -}; - -export const getConditionalTokenMintAddr = ( - programId: PublicKey, - vault: PublicKey, - index: number, -) => { - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("conditional_token"), - vault.toBuffer(), - new BN(index).toArrayLike(Buffer, "le", 1), - ], - programId, - ); -}; - -export const getDownAndUpMintAddrs = ( - programId: PublicKey, - vault: PublicKey, -): { down: PublicKey; up: PublicKey } => { - return { - down: getConditionalTokenMintAddr(programId, vault, 0)[0], - up: getConditionalTokenMintAddr(programId, vault, 1)[0], - }; -}; - -export const getFailAndPassMintAddrs = ( - programId: PublicKey, - vault: PublicKey, -): { fail: PublicKey; pass: PublicKey } => { - return { - fail: getConditionalTokenMintAddr(programId, vault, 0)[0], - pass: getConditionalTokenMintAddr(programId, vault, 1)[0], - }; -}; - -export const getMetadataAddr = (mint: PublicKey) => { - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("metadata"), - MPL_TOKEN_METADATA_PROGRAM_ID.toBuffer(), - mint.toBuffer(), - ], - MPL_TOKEN_METADATA_PROGRAM_ID, - ); -}; - -export const getDaoAddr = ({ - nonce, - daoCreator, - programId = FUTARCHY_PROGRAM_ID, -}: { - nonce: BN; - daoCreator: PublicKey; - programId?: PublicKey; -}): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [ - Buffer.from("dao"), - daoCreator.toBuffer(), - nonce.toArrayLike(Buffer, "le", 8), - ], - programId, - ); -}; - -/** - * @deprecated Use getAutocratProposalAddr instead - */ -export const getProposalAddr = ( - programId: PublicKey, - squadsProposal: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [utils.bytes.utf8.encode("proposal"), squadsProposal.toBuffer()], - programId, - ); -}; - -export const getProposalAddrV2 = ({ - programId = FUTARCHY_PROGRAM_ID, - squadsProposal, -}: { - programId?: PublicKey; - squadsProposal: PublicKey; -}): [PublicKey, number] => { - return getProposalAddr(programId, squadsProposal); -}; - -export function getLaunchAddr( - programId: PublicKey = LAUNCHPAD_PROGRAM_ID, - tokenMint: PublicKey, -): [PublicKey, number] { - return PublicKey.findProgramAddressSync( - [Buffer.from("launch"), tokenMint.toBuffer()], - programId, - ); -} - -export const getLaunchSignerAddr = ( - programId: PublicKey = LAUNCHPAD_PROGRAM_ID, - launch: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [Buffer.from("launch_signer"), launch.toBuffer()], - programId, - ); -}; - -export const getFundingRecordAddr = ( - programId: PublicKey = LAUNCHPAD_PROGRAM_ID, - launch: PublicKey, - funder: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [Buffer.from("funding_record"), launch.toBuffer(), funder.toBuffer()], - programId, - ); -}; - -export const getStakeRecordAddr = ( - programId: PublicKey = SHARED_LIQUIDITY_MANAGER_PROGRAM_ID, - draftProposal: PublicKey, - staker: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [Buffer.from("stake_record"), draftProposal.toBuffer(), staker.toBuffer()], - programId, - ); -}; - -export const getStakeAddr = ( - programId: PublicKey = FUTARCHY_PROGRAM_ID, - draftProposal: PublicKey, - staker: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [Buffer.from("stake"), draftProposal.toBuffer(), staker.toBuffer()], - programId, - ); -}; - -export const getPerformancePackageAddr = ({ - programId = PRICE_BASED_PERFORMANCE_PACKAGE_PROGRAM_ID, - createKey, -}: { - programId?: PublicKey; - createKey: PublicKey; -}) => { - return PublicKey.findProgramAddressSync( - [Buffer.from("performance_package"), createKey.toBuffer()], - programId, - ); -}; - -export const getChangeRequestAddr = ({ - programId = PRICE_BASED_PERFORMANCE_PACKAGE_PROGRAM_ID, - performancePackage, - proposer, - pdaNonce, -}: { - programId?: PublicKey; - performancePackage: PublicKey; - proposer: PublicKey; - pdaNonce: number; -}) => { - return PublicKey.findProgramAddressSync( - [ - Buffer.from("change_request"), - performancePackage.toBuffer(), - proposer.toBuffer(), - Buffer.from(new Uint8Array(new Uint32Array([pdaNonce]).buffer)), - ], - programId, - ); -}; diff --git a/sdk/src/v0.6/utils/priceMath.ts b/sdk/src/v0.6/utils/priceMath.ts deleted file mode 100644 index 4e7addb3c..000000000 --- a/sdk/src/v0.6/utils/priceMath.ts +++ /dev/null @@ -1,197 +0,0 @@ -import BN from "bn.js"; -import { Amm } from "../types/index.js"; -import { AmmMath as V3AmmMath } from "../../v0.3/utils/ammMath.js"; - -const BN_TEN = new BN(10); -const PRICE_SCALE = BN_TEN.pow(new BN(12)); -const PRICE_SCALE_NUMBER = 1e12; - -export type AddLiquiditySimulation = { - baseAmount: BN; - quoteAmount: BN; - expectedLpTokens: BN; - minLpTokens?: BN; - maxBaseAmount?: BN; -}; - -export type SwapSimulation = { - expectedOut: BN; - newBaseReserves: BN; - newQuoteReserves: BN; - minExpectedOut?: BN; -}; - -export type RemoveLiquiditySimulation = { - expectedBaseOut: BN; - expectedQuoteOut: BN; - minBaseOut?: BN; - minQuoteOut?: BN; -}; - -export class AmmMath { - // Re-export common methods from v0.3 - public static getHumanPriceFromReserves = V3AmmMath.getHumanPriceFromReserves; - public static getAmmPriceFromReserves = V3AmmMath.getAmmPriceFromReserves; - public static getChainAmount = V3AmmMath.getChainAmount; - public static getHumanAmount = V3AmmMath.getHumanAmount; - public static getAmmPrice = V3AmmMath.getAmmPrice; - public static getAmmPrices = V3AmmMath.getAmmPrices; - public static scale = V3AmmMath.scale; - public static addSlippage = V3AmmMath.addSlippage; - public static subtractSlippage = V3AmmMath.subtractSlippage; - public static simulateAddLiquidity = V3AmmMath.simulateAddLiquidity; - public static simulateRemoveLiquidity = V3AmmMath.simulateRemoveLiquidity; - - public static getHumanPrice( - ammPrice: BN, - baseDecimals: number, - quoteDecimals: number, - ): number { - const decimalScalar = BN_TEN.pow( - new BN(quoteDecimals - baseDecimals).abs(), - ); - const price1e12 = - quoteDecimals > baseDecimals - ? ammPrice.div(decimalScalar) - : ammPrice.mul(decimalScalar); - - // in case the BN is too large to cast to number, we try - try { - return price1e12.toNumber() / 1e12; - } catch (e) { - // BN tried to cast into number larger than 53 bits so we we do division via BN methods first, then cast to number(so it is smaller before the cast) - return price1e12.div(new BN(1e12)).toNumber(); - } - } - - public static getTwap(amm: Amm): BN { - return amm.oracle.aggregator.div( - amm.oracle.lastUpdatedSlot.sub(amm.createdAtSlot), - ); - } - - public static simulateSwapInner( - inputAmount: BN, - inputReserves: BN, - outputReserves: BN, - ): BN { - if (inputReserves.eqn(0) || outputReserves.eqn(0)) { - throw new Error("reserves must be non-zero"); - } - - let inputAmountWithFee: BN = inputAmount.muln(990); - - let numerator: BN = inputAmountWithFee.mul(outputReserves); - let denominator: BN = inputReserves.muln(1000).add(inputAmountWithFee); - - return numerator.div(denominator); - } - - // public static simulateSwap( - // inputAmount: BN, - // swapType: SwapType, - // baseReserves: BN, - // quoteReserves: BN, - // slippageBps?: BN - // ): SwapSimulation { - // let inputReserves: BN, outputReserves: BN; - // if (swapType.buy) { - // inputReserves = quoteReserves; - // outputReserves = baseReserves; - // } else { - // inputReserves = baseReserves; - // outputReserves = quoteReserves; - // } - - // let expectedOut = this.simulateSwapInner( - // inputAmount, - // inputReserves, - // outputReserves - // ); - - // let minExpectedOut; - // if (slippageBps) { - // minExpectedOut = AmmMath.subtractSlippage(expectedOut, slippageBps); - // } - - // let newBaseReserves: BN, newQuoteReserves: BN; - // if (swapType.buy) { - // newBaseReserves = baseReserves.sub(expectedOut); - // newQuoteReserves = quoteReserves.add(inputAmount); - // } else { - // newBaseReserves = baseReserves.add(inputAmount); - // newQuoteReserves = quoteReserves.sub(expectedOut); - // } - - // return { - // expectedOut, - // newBaseReserves, - // newQuoteReserves, - // minExpectedOut, - // }; - // } - - // /** - // * Calculates the optimal swap amount and mergeable tokens without using square roots. - // * @param userBalanceIn BN – Tokens that a user wants to dispose of. - // * @param ammReserveIn BN – Amount of tokens in the AMM of the token that the user wants to dispose of. - // * @param ammReserveOut BN – Amount of tokens in the AMM of the token that the user wants to receive. - // * @returns An object containing the optimal swap amount, expected quote received, and expected mergeable tokens. - // */ - - // public static calculateOptimalSwapForMerge( - // userBalanceIn: BN, - // ammReserveIn: BN, - // ammReserveOut: BN, - // slippageBps: BN - // ): { - // optimalSwapAmount: BN; - // userInAfterSwap: BN; - // expectedOut: BN; - // minimumExpectedOut: BN; - // } { - // // essentially, we want to calculate the swap amount so that the remaining user balance = received token amount - - // // solve this system of equations for swapAmount, outputAmount (we only care about swap amount tho) - // // (baseReserve + swapAmount) * (quoteReserve - outputAmount) = baseReserve * quoteReserve - // // baseAmount - swapAmount = outputAmount - - // //solve equation - // // (baseReserve + .99*swapAmount) * (quoteReserve - (userTokens - swapAmount)) = baseReserve * quoteReserve - // // multiplying out the left hand side and subtracting baseReserve * quoteReserve from both sides yields the following: - // // baseReserve*quoteReserve - baseReserve*userTokens + baseReserve*swapAmount + .99*swapAmount*quoteReserve - .99*swapAmount*userTokens + .99*swapAmount^2 = baseReserve*quoteReserve - // // .99*swapAmount^2 + baseReserve*swapAmount + .99*swapAmount*quoteReserve - baseReserve*userTokens - .99*swapAmount*userTokens = 0 - // // in the quadratic equation, a = .99, b = (baseReserve + .99*quoteReserve - .99*userTokens), c = -baseReserve*userTokens - // // x = (-b + sqrt(b^2 - 4ac)) / 2a - - // let a = 0.99; - // let b = - // Number(ammReserveIn) + - // 0.99 * Number(ammReserveOut) - - // 0.99 * Number(userBalanceIn); - // let c = -Number(ammReserveIn) * Number(userBalanceIn); - - // let x = (-b + Math.sqrt(b ** 2 - 4 * a * c)) / (2 * a); - // //this should mathematically return a positive number assuming userBalanceIn, ammReserveIn, and ammReserveOut are all positive (which they should be) - // // -b + Math.sqrt(b ** 2 - 4 * a * c) > 0 because -4*a*c > 0 and sqrt(b**2 + positive number) > b - - // const swapAmount = x; - - // let expectedOut = this.simulateSwapInner( - // new BN(swapAmount), - // ammReserveIn, - // ammReserveOut - // ); - // let minimumExpectedOut = - // Number(expectedOut) - (Number(expectedOut) * Number(slippageBps)) / 10000; - // return { - // optimalSwapAmount: new BN(swapAmount), - // userInAfterSwap: new BN(Number(userBalanceIn) - swapAmount), - // expectedOut: expectedOut, - // minimumExpectedOut: new BN(minimumExpectedOut), - // }; - // } -} - -// Add backwards compatibility alias -export { AmmMath as PriceMath }; diff --git a/sdk/src/v0.7/ConditionalVaultClient.ts b/sdk/src/v0.7/ConditionalVaultClient.ts deleted file mode 100644 index 047e0a46f..000000000 --- a/sdk/src/v0.7/ConditionalVaultClient.ts +++ /dev/null @@ -1,475 +0,0 @@ -import { AnchorProvider, Program, utils } from "@coral-xyz/anchor"; -import { - AccountInfo, - AddressLookupTableAccount, - Keypair, - PublicKey, - SystemProgram, -} from "@solana/web3.js"; - -import { ConditionalVaultProgram, ConditionalVaultIDL } from "./types/index.js"; - -import BN from "bn.js"; -import { - CONDITIONAL_VAULT_PROGRAM_ID, - MPL_TOKEN_METADATA_PROGRAM_ID, -} from "./constants.js"; -import { - getQuestionAddr, - getMetadataAddr, - getVaultAddr, - getConditionalTokenMintAddr, -} from "./utils/index.js"; -import { - createAssociatedTokenAccountIdempotentInstruction, - createAssociatedTokenAccountInstruction, - getAssociatedTokenAddressSync, - TOKEN_PROGRAM_ID, -} from "@solana/spl-token"; -import { ConditionalVault, Question } from "./types/index.js"; - -export type CreateVaultClientParams = { - provider: AnchorProvider; - conditionalVaultProgramId?: PublicKey; -}; - -export class ConditionalVaultClient { - public readonly provider: AnchorProvider; - public readonly vaultProgram: Program; - - constructor(provider: AnchorProvider, conditionalVaultProgramId: PublicKey) { - this.provider = provider; - this.vaultProgram = new Program( - ConditionalVaultIDL, - conditionalVaultProgramId, - provider, - ); - } - - public static createClient( - createVaultClientParams: CreateVaultClientParams, - ): ConditionalVaultClient { - let { provider, conditionalVaultProgramId } = createVaultClientParams; - - return new ConditionalVaultClient( - provider, - conditionalVaultProgramId || CONDITIONAL_VAULT_PROGRAM_ID, - ); - } - - async fetchQuestion(question: PublicKey): Promise { - return this.vaultProgram.account.question.fetchNullable(question); - } - - async fetchVault(vault: PublicKey): Promise { - return this.vaultProgram.account.conditionalVault.fetchNullable(vault); - } - - async deserializeQuestion( - accountInfo: AccountInfo, - ): Promise { - return this.vaultProgram.coder.accounts.decode( - "question", - accountInfo.data, - ); - } - - async deserializeVault( - accountInfo: AccountInfo, - ): Promise { - return this.vaultProgram.coder.accounts.decode( - "conditionalVault", - accountInfo.data, - ); - } - - initializeQuestionIx( - questionId: Uint8Array, - oracle: PublicKey, - numOutcomes: number, - ) { - const [question] = getQuestionAddr( - this.vaultProgram.programId, - questionId, - oracle, - numOutcomes, - ); - - return this.vaultProgram.methods - .initializeQuestion({ - questionId: Array.from(questionId), - oracle, - numOutcomes, - }) - .accounts({ - question, - }); - } - - async initializeQuestion( - questionId: Uint8Array, - oracle: PublicKey, - numOutcomes: number, - ): Promise { - const [question] = getQuestionAddr( - this.vaultProgram.programId, - questionId, - oracle, - numOutcomes, - ); - - await this.initializeQuestionIx(questionId, oracle, numOutcomes).rpc(); - - return question; - } - - initializeVaultIx( - question: PublicKey, - underlyingTokenMint: PublicKey, - numOutcomes: number, - payer: PublicKey = this.provider.publicKey, - ) { - const [vault] = getVaultAddr( - this.vaultProgram.programId, - question, - underlyingTokenMint, - ); - - let conditionalTokenMintAddrs = []; - for (let i = 0; i < numOutcomes; i++) { - const [conditionalTokenMint] = getConditionalTokenMintAddr( - this.vaultProgram.programId, - vault, - i, - ); - conditionalTokenMintAddrs.push(conditionalTokenMint); - } - - const vaultUnderlyingTokenAccount = getAssociatedTokenAddressSync( - underlyingTokenMint, - vault, - true, - ); - - return this.vaultProgram.methods - .initializeConditionalVault() - .accounts({ - vault, - question, - underlyingTokenMint, - vaultUnderlyingTokenAccount, - }) - .preInstructions([ - createAssociatedTokenAccountIdempotentInstruction( - payer, - vaultUnderlyingTokenAccount, - vault, - underlyingTokenMint, - ), - ]) - .remainingAccounts( - conditionalTokenMintAddrs.map((conditionalTokenMint) => { - return { - pubkey: conditionalTokenMint, - isWritable: true, - isSigner: false, - }; - }), - ); - } - - // TODO remove `numOucomes` - - async initializeVault( - question: PublicKey, - underlyingTokenMint: PublicKey, - numOutcomes: number, - ): Promise { - const [vault] = getVaultAddr( - this.vaultProgram.programId, - question, - underlyingTokenMint, - ); - - await this.initializeVaultIx( - question, - underlyingTokenMint, - numOutcomes, - ).rpc(); - - return vault; - } - - resolveQuestionIx( - question: PublicKey, - oracle: Keypair, - payoutNumerators: number[], - ) { - return this.vaultProgram.methods - .resolveQuestion({ - payoutNumerators, - }) - .accounts({ - question, - oracle: oracle.publicKey, - }) - .signers([oracle]); - } - - getConditionalTokenMints(vault: PublicKey, numOutcomes: number): PublicKey[] { - let conditionalTokenMintAddrs = []; - for (let i = 0; i < numOutcomes; i++) { - const [conditionalTokenMint] = getConditionalTokenMintAddr( - this.vaultProgram.programId, - vault, - i, - ); - conditionalTokenMintAddrs.push(conditionalTokenMint); - } - return conditionalTokenMintAddrs; - } - - getRemainingAccounts( - conditionalTokenMints: PublicKey[], - userConditionalAccounts: PublicKey[], - ) { - return conditionalTokenMints - .concat(userConditionalAccounts) - .map((account) => ({ - pubkey: account, - isWritable: true, - isSigner: false, - })); - } - - // Helper method to get conditional token accounts and instructions - getConditionalTokenAccountsAndInstructions( - vault: PublicKey, - numOutcomes: number, - user: PublicKey = this.provider.publicKey, - payer: PublicKey = this.provider.publicKey, - ) { - const conditionalTokenMintAddrs = this.getConditionalTokenMints( - vault, - numOutcomes, - ); - const userConditionalAccounts = conditionalTokenMintAddrs.map((mint) => - getAssociatedTokenAddressSync(mint, user, true), - ); - - const preInstructions = conditionalTokenMintAddrs.map((mint) => - createAssociatedTokenAccountIdempotentInstruction( - payer, - getAssociatedTokenAddressSync(mint, user, true), - user, - mint, - ), - ); - - const remainingAccounts = this.getRemainingAccounts( - conditionalTokenMintAddrs, - userConditionalAccounts, - ); - - return { userConditionalAccounts, preInstructions, remainingAccounts }; - } - - splitTokensIx( - question: PublicKey, - vault: PublicKey, - underlyingTokenMint: PublicKey, - amount: BN, - numOutcomes: number, - user: PublicKey = this.provider.publicKey, - payer: PublicKey = this.provider.publicKey, - ) { - const { preInstructions, remainingAccounts } = - this.getConditionalTokenAccountsAndInstructions( - vault, - numOutcomes, - user, - payer, - ); - - return this.vaultProgram.methods - .splitTokens(amount) - .accounts({ - question, - authority: user, - vault, - vaultUnderlyingTokenAccount: getAssociatedTokenAddressSync( - underlyingTokenMint, - vault, - true, - ), - userUnderlyingTokenAccount: getAssociatedTokenAddressSync( - underlyingTokenMint, - user, - true, - ), - }) - .preInstructions(preInstructions) - .remainingAccounts(remainingAccounts); - } - - mergeTokensIx( - question: PublicKey, - vault: PublicKey, - underlyingTokenMint: PublicKey, - amount: BN, - numOutcomes: number, - user: PublicKey = this.provider.publicKey, - payer: PublicKey = this.provider.publicKey, - ) { - let conditionalTokenMintAddrs = this.getConditionalTokenMints( - vault, - numOutcomes, - ); - - let userConditionalAccounts = []; - for (let conditionalTokenMint of conditionalTokenMintAddrs) { - userConditionalAccounts.push( - getAssociatedTokenAddressSync(conditionalTokenMint, user, true), - ); - } - - let ix = this.vaultProgram.methods - .mergeTokens(amount) - .accounts({ - question, - authority: user, - vault, - vaultUnderlyingTokenAccount: getAssociatedTokenAddressSync( - underlyingTokenMint, - vault, - true, - ), - userUnderlyingTokenAccount: getAssociatedTokenAddressSync( - underlyingTokenMint, - user, - true, - ), - }) - .preInstructions( - conditionalTokenMintAddrs.map((conditionalTokenMint) => { - return createAssociatedTokenAccountIdempotentInstruction( - payer, - getAssociatedTokenAddressSync(conditionalTokenMint, user, true), - user, - conditionalTokenMint, - ); - }), - ) - .remainingAccounts( - conditionalTokenMintAddrs - .concat(userConditionalAccounts) - .map((conditionalTokenMint) => { - return { - pubkey: conditionalTokenMint, - isWritable: true, - isSigner: false, - }; - }), - ); - - return ix; - } - - redeemTokensIx( - question: PublicKey, - vault: PublicKey, - underlyingTokenMint: PublicKey, - numOutcomes: number, - user: PublicKey = this.provider.publicKey, - payer: PublicKey = this.provider.publicKey, - ) { - let conditionalTokenMintAddrs = []; - for (let i = 0; i < numOutcomes; i++) { - const [conditionalTokenMint] = getConditionalTokenMintAddr( - this.vaultProgram.programId, - vault, - i, - ); - conditionalTokenMintAddrs.push(conditionalTokenMint); - } - - let userConditionalAccounts = []; - for (let conditionalTokenMint of conditionalTokenMintAddrs) { - userConditionalAccounts.push( - getAssociatedTokenAddressSync(conditionalTokenMint, user, true), - ); - } - - let ix = this.vaultProgram.methods - .redeemTokens() - .accounts({ - question, - authority: user, - vault, - vaultUnderlyingTokenAccount: getAssociatedTokenAddressSync( - underlyingTokenMint, - vault, - true, - ), - userUnderlyingTokenAccount: getAssociatedTokenAddressSync( - underlyingTokenMint, - user, - true, - ), - }) - .preInstructions( - conditionalTokenMintAddrs.map((conditionalTokenMint) => { - return createAssociatedTokenAccountIdempotentInstruction( - payer, - getAssociatedTokenAddressSync(conditionalTokenMint, user, true), - user, - conditionalTokenMint, - ); - }), - ) - .remainingAccounts( - conditionalTokenMintAddrs - .concat(userConditionalAccounts) - .map((conditionalTokenMint) => { - return { - pubkey: conditionalTokenMint, - isWritable: true, - isSigner: false, - }; - }), - ); - - return ix; - } - - addMetadataToConditionalTokensIx( - vault: PublicKey, - index: number, - name: string, - symbol: string, - uri: string, - payer: PublicKey = this.provider.publicKey, - ) { - const [conditionalTokenMint] = getConditionalTokenMintAddr( - this.vaultProgram.programId, - vault, - index, - ); - - const [conditionalTokenMetadata] = getMetadataAddr(conditionalTokenMint); - - return this.vaultProgram.methods - .addMetadataToConditionalTokens({ - name, - symbol, - uri, - }) - .accounts({ - payer, - vault, - conditionalTokenMint, - conditionalTokenMetadata, - tokenMetadataProgram: MPL_TOKEN_METADATA_PROGRAM_ID, - }); - } -} diff --git a/sdk/src/v0.7/index.ts b/sdk/src/v0.7/index.ts deleted file mode 100644 index b705e0721..000000000 --- a/sdk/src/v0.7/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -export * from "./types/index.js"; -export * from "./utils/index.js"; -export * from "./constants.js"; -export * from "./BidWallClient.js"; -export * from "./FutarchyClient.js"; -export * from "./ConditionalVaultClient.js"; -export * from "./LaunchpadClient.js"; -export * from "./PriceBasedPerformancePackageClient.js"; -export * from "./MintGovernorClient.js"; -export * from "./PerformancePackageV2Client.js"; -export * from "./LiquidationClient.js"; diff --git a/sdk/src/v0.7/types/amm.ts b/sdk/src/v0.7/types/amm.ts deleted file mode 100644 index 6d36be8d8..000000000 --- a/sdk/src/v0.7/types/amm.ts +++ /dev/null @@ -1,1663 +0,0 @@ -export type Amm = { - version: "0.5.0"; - name: "amm"; - instructions: [ - { - name: "createAmm"; - accounts: [ - { - name: "user"; - isMut: true; - isSigner: true; - }, - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "lpMint"; - isMut: true; - isSigner: false; - }, - { - name: "baseMint"; - isMut: false; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "vaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "CreateAmmArgs"; - }; - }, - ]; - }, - { - name: "addLiquidity"; - accounts: [ - { - name: "user"; - isMut: true; - isSigner: true; - }, - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "lpMint"; - isMut: true; - isSigner: false; - }, - { - name: "userLpAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userBaseAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "AddLiquidityArgs"; - }; - }, - ]; - }, - { - name: "removeLiquidity"; - accounts: [ - { - name: "user"; - isMut: true; - isSigner: true; - }, - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "lpMint"; - isMut: true; - isSigner: false; - }, - { - name: "userLpAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userBaseAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "RemoveLiquidityArgs"; - }; - }, - ]; - }, - { - name: "swap"; - accounts: [ - { - name: "user"; - isMut: true; - isSigner: true; - }, - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "userBaseAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "SwapArgs"; - }; - }, - ]; - }, - { - name: "crankThatTwap"; - accounts: [ - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - ]; - accounts: [ - { - name: "amm"; - type: { - kind: "struct"; - fields: [ - { - name: "bump"; - type: "u8"; - }, - { - name: "createdAtSlot"; - type: "u64"; - }, - { - name: "lpMint"; - type: "publicKey"; - }, - { - name: "baseMint"; - type: "publicKey"; - }, - { - name: "quoteMint"; - type: "publicKey"; - }, - { - name: "baseMintDecimals"; - type: "u8"; - }, - { - name: "quoteMintDecimals"; - type: "u8"; - }, - { - name: "baseAmount"; - type: "u64"; - }, - { - name: "quoteAmount"; - type: "u64"; - }, - { - name: "oracle"; - type: { - defined: "TwapOracle"; - }; - }, - { - name: "seqNum"; - type: "u64"; - }, - { - name: "vaultAtaBase"; - type: "publicKey"; - }, - { - name: "vaultAtaQuote"; - type: "publicKey"; - }, - ]; - }; - }, - ]; - types: [ - { - name: "CommonFields"; - type: { - kind: "struct"; - fields: [ - { - name: "slot"; - type: "u64"; - }, - { - name: "unixTimestamp"; - type: "i64"; - }, - { - name: "user"; - type: "publicKey"; - }, - { - name: "amm"; - type: "publicKey"; - }, - { - name: "postBaseReserves"; - type: "u64"; - }, - { - name: "postQuoteReserves"; - type: "u64"; - }, - { - name: "oracleLastPrice"; - type: "u128"; - }, - { - name: "oracleLastObservation"; - type: "u128"; - }, - { - name: "oracleAggregator"; - type: "u128"; - }, - { - name: "seqNum"; - type: "u64"; - }, - ]; - }; - }, - { - name: "AddLiquidityArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "quoteAmount"; - docs: ["How much quote token you will deposit to the pool"]; - type: "u64"; - }, - { - name: "maxBaseAmount"; - docs: ["The maximum base token you will deposit to the pool"]; - type: "u64"; - }, - { - name: "minLpTokens"; - docs: ["The minimum LP token you will get back"]; - type: "u64"; - }, - ]; - }; - }, - { - name: "CreateAmmArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "twapInitialObservation"; - type: "u128"; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; - }, - { - name: "twapStartDelaySlots"; - type: "u64"; - }, - ]; - }; - }, - { - name: "RemoveLiquidityArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "lpTokensToBurn"; - type: "u64"; - }, - { - name: "minQuoteAmount"; - type: "u64"; - }, - { - name: "minBaseAmount"; - type: "u64"; - }, - ]; - }; - }, - { - name: "SwapArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "swapType"; - type: { - defined: "SwapType"; - }; - }, - { - name: "inputAmount"; - type: "u64"; - }, - { - name: "outputAmountMin"; - type: "u64"; - }, - ]; - }; - }, - { - name: "TwapOracle"; - type: { - kind: "struct"; - fields: [ - { - name: "lastUpdatedSlot"; - type: "u64"; - }, - { - name: "lastPrice"; - docs: [ - "A price is the number of quote units per base unit multiplied by 1e12.", - "You cannot simply divide by 1e12 to get a price you can display in the UI", - "because the base and quote decimals may be different. Instead, do:", - "ui_price = (price * (10**(base_decimals - quote_decimals))) / 1e12", - ]; - type: "u128"; - }, - { - name: "lastObservation"; - docs: [ - "If we did a raw TWAP over prices, someone could push the TWAP heavily with", - "a few extremely large outliers. So we use observations, which can only move", - "by `max_observation_change_per_update` per update.", - ]; - type: "u128"; - }, - { - name: "aggregator"; - docs: [ - "Running sum of slots_per_last_update * last_observation.", - "", - "Assuming latest observations are as big as possible (u64::MAX * 1e12),", - "we can store 18 million slots worth of observations, which turns out to", - "be ~85 days worth of slots.", - "", - "Assuming that latest observations are 100x smaller than they could theoretically", - "be, we can store 8500 days (23 years) worth of them. Even this is a very", - "very conservative assumption - META/USDC prices should be between 1e9 and", - "1e15, which would overflow after 1e15 years worth of slots.", - "", - "So in the case of an overflow, the aggregator rolls back to 0. It's the", - "client's responsibility to sanity check the assets or to handle an", - "aggregator at T2 being smaller than an aggregator at T1.", - ]; - type: "u128"; - }, - { - name: "maxObservationChangePerUpdate"; - docs: ["The most that an observation can change per update."]; - type: "u128"; - }, - { - name: "initialObservation"; - docs: ["What the initial `latest_observation` is set to."]; - type: "u128"; - }, - { - name: "startDelaySlots"; - docs: [ - "Number of slots after amm.created_at_slot to start recording TWAP", - ]; - type: "u64"; - }, - ]; - }; - }, - { - name: "SwapType"; - type: { - kind: "enum"; - variants: [ - { - name: "Buy"; - }, - { - name: "Sell"; - }, - ]; - }; - }, - ]; - events: [ - { - name: "SwapEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "inputAmount"; - type: "u64"; - index: false; - }, - { - name: "outputAmount"; - type: "u64"; - index: false; - }, - { - name: "swapType"; - type: { - defined: "SwapType"; - }; - index: false; - }, - ]; - }, - { - name: "AddLiquidityEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "quoteAmount"; - type: "u64"; - index: false; - }, - { - name: "maxBaseAmount"; - type: "u64"; - index: false; - }, - { - name: "minLpTokens"; - type: "u64"; - index: false; - }, - { - name: "baseAmount"; - type: "u64"; - index: false; - }, - { - name: "lpTokensMinted"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "RemoveLiquidityEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "lpTokensBurned"; - type: "u64"; - index: false; - }, - { - name: "minQuoteAmount"; - type: "u64"; - index: false; - }, - { - name: "minBaseAmount"; - type: "u64"; - index: false; - }, - { - name: "baseAmount"; - type: "u64"; - index: false; - }, - { - name: "quoteAmount"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "CreateAmmEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "twapInitialObservation"; - type: "u128"; - index: false; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; - index: false; - }, - { - name: "lpMint"; - type: "publicKey"; - index: false; - }, - { - name: "baseMint"; - type: "publicKey"; - index: false; - }, - { - name: "quoteMint"; - type: "publicKey"; - index: false; - }, - { - name: "vaultAtaBase"; - type: "publicKey"; - index: false; - }, - { - name: "vaultAtaQuote"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "CrankThatTwapEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - ]; - }, - ]; - errors: [ - { - code: 6000; - name: "AssertFailed"; - msg: "An assertion failed"; - }, - { - code: 6001; - name: "NoSlotsPassed"; - msg: "Can't get a TWAP before some observations have been stored"; - }, - { - code: 6002; - name: "NoReserves"; - msg: "Can't swap through a pool without token reserves on either side"; - }, - { - code: 6003; - name: "InputAmountOverflow"; - msg: "Input token amount is too large for a swap, causes overflow"; - }, - { - code: 6004; - name: "AddLiquidityCalculationError"; - msg: "Add liquidity calculation error"; - }, - { - code: 6005; - name: "DecimalScaleError"; - msg: "Error in decimal scale conversion"; - }, - { - code: 6006; - name: "SameTokenMints"; - msg: "You can't create an AMM pool where the token mints are the same"; - }, - { - code: 6007; - name: "SwapSlippageExceeded"; - msg: "A user wouldn't have gotten back their `output_amount_min`, reverting"; - }, - { - code: 6008; - name: "InsufficientBalance"; - msg: "The user had insufficient balance to do this"; - }, - { - code: 6009; - name: "ZeroLiquidityRemove"; - msg: "Must remove a non-zero amount of liquidity"; - }, - { - code: 6010; - name: "ZeroLiquidityToAdd"; - msg: "Cannot add liquidity with 0 tokens on either side"; - }, - { - code: 6011; - name: "ZeroMinLpTokens"; - msg: "Must specify a non-zero `min_lp_tokens` when adding to an existing pool"; - }, - { - code: 6012; - name: "AddLiquiditySlippageExceeded"; - msg: "LP wouldn't have gotten back `lp_token_min`"; - }, - { - code: 6013; - name: "AddLiquidityMaxBaseExceeded"; - msg: "LP would have spent more than `max_base_amount`"; - }, - { - code: 6014; - name: "InsufficientQuoteAmount"; - msg: "`quote_amount` must be greater than 100000000 when initializing a pool"; - }, - { - code: 6015; - name: "ZeroSwapAmount"; - msg: "Users must swap a non-zero amount"; - }, - { - code: 6016; - name: "ConstantProductInvariantFailed"; - msg: "K should always be increasing"; - }, - { - code: 6017; - name: "CastingOverflow"; - msg: "Casting has caused an overflow"; - }, - ]; -}; - -export const IDL: Amm = { - version: "0.5.0", - name: "amm", - instructions: [ - { - name: "createAmm", - accounts: [ - { - name: "user", - isMut: true, - isSigner: true, - }, - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "lpMint", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "vaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "CreateAmmArgs", - }, - }, - ], - }, - { - name: "addLiquidity", - accounts: [ - { - name: "user", - isMut: true, - isSigner: true, - }, - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "lpMint", - isMut: true, - isSigner: false, - }, - { - name: "userLpAccount", - isMut: true, - isSigner: false, - }, - { - name: "userBaseAccount", - isMut: true, - isSigner: false, - }, - { - name: "userQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "AddLiquidityArgs", - }, - }, - ], - }, - { - name: "removeLiquidity", - accounts: [ - { - name: "user", - isMut: true, - isSigner: true, - }, - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "lpMint", - isMut: true, - isSigner: false, - }, - { - name: "userLpAccount", - isMut: true, - isSigner: false, - }, - { - name: "userBaseAccount", - isMut: true, - isSigner: false, - }, - { - name: "userQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "RemoveLiquidityArgs", - }, - }, - ], - }, - { - name: "swap", - accounts: [ - { - name: "user", - isMut: true, - isSigner: true, - }, - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "userBaseAccount", - isMut: true, - isSigner: false, - }, - { - name: "userQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "SwapArgs", - }, - }, - ], - }, - { - name: "crankThatTwap", - accounts: [ - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "amm", - type: { - kind: "struct", - fields: [ - { - name: "bump", - type: "u8", - }, - { - name: "createdAtSlot", - type: "u64", - }, - { - name: "lpMint", - type: "publicKey", - }, - { - name: "baseMint", - type: "publicKey", - }, - { - name: "quoteMint", - type: "publicKey", - }, - { - name: "baseMintDecimals", - type: "u8", - }, - { - name: "quoteMintDecimals", - type: "u8", - }, - { - name: "baseAmount", - type: "u64", - }, - { - name: "quoteAmount", - type: "u64", - }, - { - name: "oracle", - type: { - defined: "TwapOracle", - }, - }, - { - name: "seqNum", - type: "u64", - }, - { - name: "vaultAtaBase", - type: "publicKey", - }, - { - name: "vaultAtaQuote", - type: "publicKey", - }, - ], - }, - }, - ], - types: [ - { - name: "CommonFields", - type: { - kind: "struct", - fields: [ - { - name: "slot", - type: "u64", - }, - { - name: "unixTimestamp", - type: "i64", - }, - { - name: "user", - type: "publicKey", - }, - { - name: "amm", - type: "publicKey", - }, - { - name: "postBaseReserves", - type: "u64", - }, - { - name: "postQuoteReserves", - type: "u64", - }, - { - name: "oracleLastPrice", - type: "u128", - }, - { - name: "oracleLastObservation", - type: "u128", - }, - { - name: "oracleAggregator", - type: "u128", - }, - { - name: "seqNum", - type: "u64", - }, - ], - }, - }, - { - name: "AddLiquidityArgs", - type: { - kind: "struct", - fields: [ - { - name: "quoteAmount", - docs: ["How much quote token you will deposit to the pool"], - type: "u64", - }, - { - name: "maxBaseAmount", - docs: ["The maximum base token you will deposit to the pool"], - type: "u64", - }, - { - name: "minLpTokens", - docs: ["The minimum LP token you will get back"], - type: "u64", - }, - ], - }, - }, - { - name: "CreateAmmArgs", - type: { - kind: "struct", - fields: [ - { - name: "twapInitialObservation", - type: "u128", - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - }, - { - name: "twapStartDelaySlots", - type: "u64", - }, - ], - }, - }, - { - name: "RemoveLiquidityArgs", - type: { - kind: "struct", - fields: [ - { - name: "lpTokensToBurn", - type: "u64", - }, - { - name: "minQuoteAmount", - type: "u64", - }, - { - name: "minBaseAmount", - type: "u64", - }, - ], - }, - }, - { - name: "SwapArgs", - type: { - kind: "struct", - fields: [ - { - name: "swapType", - type: { - defined: "SwapType", - }, - }, - { - name: "inputAmount", - type: "u64", - }, - { - name: "outputAmountMin", - type: "u64", - }, - ], - }, - }, - { - name: "TwapOracle", - type: { - kind: "struct", - fields: [ - { - name: "lastUpdatedSlot", - type: "u64", - }, - { - name: "lastPrice", - docs: [ - "A price is the number of quote units per base unit multiplied by 1e12.", - "You cannot simply divide by 1e12 to get a price you can display in the UI", - "because the base and quote decimals may be different. Instead, do:", - "ui_price = (price * (10**(base_decimals - quote_decimals))) / 1e12", - ], - type: "u128", - }, - { - name: "lastObservation", - docs: [ - "If we did a raw TWAP over prices, someone could push the TWAP heavily with", - "a few extremely large outliers. So we use observations, which can only move", - "by `max_observation_change_per_update` per update.", - ], - type: "u128", - }, - { - name: "aggregator", - docs: [ - "Running sum of slots_per_last_update * last_observation.", - "", - "Assuming latest observations are as big as possible (u64::MAX * 1e12),", - "we can store 18 million slots worth of observations, which turns out to", - "be ~85 days worth of slots.", - "", - "Assuming that latest observations are 100x smaller than they could theoretically", - "be, we can store 8500 days (23 years) worth of them. Even this is a very", - "very conservative assumption - META/USDC prices should be between 1e9 and", - "1e15, which would overflow after 1e15 years worth of slots.", - "", - "So in the case of an overflow, the aggregator rolls back to 0. It's the", - "client's responsibility to sanity check the assets or to handle an", - "aggregator at T2 being smaller than an aggregator at T1.", - ], - type: "u128", - }, - { - name: "maxObservationChangePerUpdate", - docs: ["The most that an observation can change per update."], - type: "u128", - }, - { - name: "initialObservation", - docs: ["What the initial `latest_observation` is set to."], - type: "u128", - }, - { - name: "startDelaySlots", - docs: [ - "Number of slots after amm.created_at_slot to start recording TWAP", - ], - type: "u64", - }, - ], - }, - }, - { - name: "SwapType", - type: { - kind: "enum", - variants: [ - { - name: "Buy", - }, - { - name: "Sell", - }, - ], - }, - }, - ], - events: [ - { - name: "SwapEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "inputAmount", - type: "u64", - index: false, - }, - { - name: "outputAmount", - type: "u64", - index: false, - }, - { - name: "swapType", - type: { - defined: "SwapType", - }, - index: false, - }, - ], - }, - { - name: "AddLiquidityEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "quoteAmount", - type: "u64", - index: false, - }, - { - name: "maxBaseAmount", - type: "u64", - index: false, - }, - { - name: "minLpTokens", - type: "u64", - index: false, - }, - { - name: "baseAmount", - type: "u64", - index: false, - }, - { - name: "lpTokensMinted", - type: "u64", - index: false, - }, - ], - }, - { - name: "RemoveLiquidityEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "lpTokensBurned", - type: "u64", - index: false, - }, - { - name: "minQuoteAmount", - type: "u64", - index: false, - }, - { - name: "minBaseAmount", - type: "u64", - index: false, - }, - { - name: "baseAmount", - type: "u64", - index: false, - }, - { - name: "quoteAmount", - type: "u64", - index: false, - }, - ], - }, - { - name: "CreateAmmEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "twapInitialObservation", - type: "u128", - index: false, - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - index: false, - }, - { - name: "lpMint", - type: "publicKey", - index: false, - }, - { - name: "baseMint", - type: "publicKey", - index: false, - }, - { - name: "quoteMint", - type: "publicKey", - index: false, - }, - { - name: "vaultAtaBase", - type: "publicKey", - index: false, - }, - { - name: "vaultAtaQuote", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "CrankThatTwapEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - ], - }, - ], - errors: [ - { - code: 6000, - name: "AssertFailed", - msg: "An assertion failed", - }, - { - code: 6001, - name: "NoSlotsPassed", - msg: "Can't get a TWAP before some observations have been stored", - }, - { - code: 6002, - name: "NoReserves", - msg: "Can't swap through a pool without token reserves on either side", - }, - { - code: 6003, - name: "InputAmountOverflow", - msg: "Input token amount is too large for a swap, causes overflow", - }, - { - code: 6004, - name: "AddLiquidityCalculationError", - msg: "Add liquidity calculation error", - }, - { - code: 6005, - name: "DecimalScaleError", - msg: "Error in decimal scale conversion", - }, - { - code: 6006, - name: "SameTokenMints", - msg: "You can't create an AMM pool where the token mints are the same", - }, - { - code: 6007, - name: "SwapSlippageExceeded", - msg: "A user wouldn't have gotten back their `output_amount_min`, reverting", - }, - { - code: 6008, - name: "InsufficientBalance", - msg: "The user had insufficient balance to do this", - }, - { - code: 6009, - name: "ZeroLiquidityRemove", - msg: "Must remove a non-zero amount of liquidity", - }, - { - code: 6010, - name: "ZeroLiquidityToAdd", - msg: "Cannot add liquidity with 0 tokens on either side", - }, - { - code: 6011, - name: "ZeroMinLpTokens", - msg: "Must specify a non-zero `min_lp_tokens` when adding to an existing pool", - }, - { - code: 6012, - name: "AddLiquiditySlippageExceeded", - msg: "LP wouldn't have gotten back `lp_token_min`", - }, - { - code: 6013, - name: "AddLiquidityMaxBaseExceeded", - msg: "LP would have spent more than `max_base_amount`", - }, - { - code: 6014, - name: "InsufficientQuoteAmount", - msg: "`quote_amount` must be greater than 100000000 when initializing a pool", - }, - { - code: 6015, - name: "ZeroSwapAmount", - msg: "Users must swap a non-zero amount", - }, - { - code: 6016, - name: "ConstantProductInvariantFailed", - msg: "K should always be increasing", - }, - { - code: 6017, - name: "CastingOverflow", - msg: "Casting has caused an overflow", - }, - ], -}; diff --git a/sdk/src/v0.7/types/autocrat.ts b/sdk/src/v0.7/types/autocrat.ts deleted file mode 100644 index a2afb15ee..000000000 --- a/sdk/src/v0.7/types/autocrat.ts +++ /dev/null @@ -1,2377 +0,0 @@ -export type Autocrat = { - version: "0.5.0"; - name: "autocrat"; - instructions: [ - { - name: "initializeDao"; - accounts: [ - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "daoCreator"; - isMut: false; - isSigner: true; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "baseMint"; - isMut: false; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "squadsMultisig"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigVault"; - isMut: false; - isSigner: false; - }, - { - name: "squadsProgram"; - isMut: false; - isSigner: false; - }, - { - name: "squadsProgramConfig"; - isMut: false; - isSigner: false; - }, - { - name: "squadsProgramConfigTreasury"; - isMut: true; - isSigner: false; - }, - { - name: "spendingLimit"; - isMut: true; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "InitializeDaoParams"; - }; - }, - ]; - }, - { - name: "initializeProposal"; - accounts: [ - { - name: "proposal"; - isMut: true; - isSigner: false; - }, - { - name: "squadsProposal"; - isMut: false; - isSigner: false; - }, - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "question"; - isMut: false; - isSigner: false; - }, - { - name: "quoteVault"; - isMut: false; - isSigner: false; - }, - { - name: "baseVault"; - isMut: false; - isSigner: false; - }, - { - name: "passAmm"; - isMut: false; - isSigner: false; - }, - { - name: "passLpMint"; - isMut: false; - isSigner: false; - }, - { - name: "failLpMint"; - isMut: false; - isSigner: false; - }, - { - name: "failAmm"; - isMut: false; - isSigner: false; - }, - { - name: "passLpUserAccount"; - isMut: true; - isSigner: false; - }, - { - name: "failLpUserAccount"; - isMut: true; - isSigner: false; - }, - { - name: "passLpVaultAccount"; - isMut: true; - isSigner: false; - }, - { - name: "failLpVaultAccount"; - isMut: true; - isSigner: false; - }, - { - name: "proposer"; - isMut: false; - isSigner: true; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "InitializeProposalParams"; - }; - }, - ]; - }, - { - name: "finalizeProposal"; - accounts: [ - { - name: "proposal"; - isMut: true; - isSigner: false; - }, - { - name: "squadsProposal"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigProgram"; - isMut: false; - isSigner: false; - }, - { - name: "squadsMultisig"; - isMut: false; - isSigner: false; - }, - { - name: "passAmm"; - isMut: false; - isSigner: false; - }, - { - name: "failAmm"; - isMut: false; - isSigner: false; - }, - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "question"; - isMut: true; - isSigner: false; - }, - { - name: "passLpUserAccount"; - isMut: true; - isSigner: false; - }, - { - name: "failLpUserAccount"; - isMut: true; - isSigner: false; - }, - { - name: "passLpVaultAccount"; - isMut: true; - isSigner: false; - }, - { - name: "failLpVaultAccount"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "vaultProgram"; - isMut: false; - isSigner: false; - }, - { - name: "vaultEventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "updateDao"; - accounts: [ - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigVault"; - isMut: false; - isSigner: true; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "daoParams"; - type: { - defined: "UpdateDaoParams"; - }; - }, - ]; - }, - { - name: "executeSpendingLimitChange"; - accounts: [ - { - name: "proposal"; - isMut: true; - isSigner: false; - }, - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "squadsProposal"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisig"; - isMut: false; - isSigner: false; - }, - { - name: "squadsMultisigProgram"; - isMut: false; - isSigner: false; - }, - { - name: "vaultTransaction"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "upgradeMultisigDao"; - accounts: [ - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisig"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigProgram"; - isMut: false; - isSigner: false; - }, - { - name: "rentPayer"; - isMut: true; - isSigner: true; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "kollan"; - isMut: false; - isSigner: true; - }, - ]; - args: []; - }, - { - name: "fixOmnipairSpendingLimit"; - accounts: [ - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisig"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigProgram"; - isMut: false; - isSigner: false; - }, - { - name: "rentPayer"; - isMut: true; - isSigner: true; - }, - { - name: "kollan"; - isMut: false; - isSigner: true; - }, - { - name: "omnipairSpendingLimit"; - isMut: true; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - ]; - accounts: [ - { - name: "dao"; - type: { - kind: "struct"; - fields: [ - { - name: "nonce"; - docs: ["`nonce` + `dao_creator` are PDA seeds"]; - type: "u64"; - }, - { - name: "daoCreator"; - type: "publicKey"; - }, - { - name: "pdaBump"; - type: "u8"; - }, - { - name: "squadsMultisig"; - type: "publicKey"; - }, - { - name: "squadsMultisigVault"; - type: "publicKey"; - }, - { - name: "baseMint"; - type: "publicKey"; - }, - { - name: "quoteMint"; - type: "publicKey"; - }, - { - name: "proposalCount"; - type: "u32"; - }, - { - name: "passThresholdBps"; - type: "u16"; - }, - { - name: "slotsPerProposal"; - type: "u64"; - }, - { - name: "twapInitialObservation"; - docs: [ - "For manipulation-resistance the TWAP is a time-weighted average observation,", - "where observation tries to approximate price but can only move by", - "`twap_max_observation_change_per_update` per update. Because it can only move", - "a little bit per update, you need to check that it has a good initial observation.", - "Otherwise, an attacker could create a very high initial observation in the pass", - "market and a very low one in the fail market to force the proposal to pass.", - "", - "We recommend setting an initial observation around the spot price of the token,", - "and max observation change per update around 2% the spot price of the token.", - "For example, if the spot price of META is $400, we'd recommend setting an initial", - "observation of 400 (converted into the AMM prices) and a max observation change per", - "update of 8 (also converted into the AMM prices). Observations can be updated once", - "a minute, so 2% allows the proposal market to reach double the spot price or 0", - "in 50 minutes.", - ]; - type: "u128"; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; - }, - { - name: "twapStartDelaySlots"; - docs: [ - "Forces TWAP calculation to start after amm.created_at_slot + twap_start_delay_slots", - ]; - type: "u64"; - }, - { - name: "minQuoteFutarchicLiquidity"; - docs: [ - "As an anti-spam measure and to help liquidity, you need to lock up some liquidity", - "in both futarchic markets in order to create a proposal.", - "", - "For example, for META, we can use a `min_quote_futarchic_liquidity` of", - "5000 * 1_000_000 (5000 USDC) and a `min_base_futarchic_liquidity` of", - "10 * 1_000_000_000 (10 META).", - ]; - type: "u64"; - }, - { - name: "minBaseFutarchicLiquidity"; - type: "u64"; - }, - { - name: "seqNum"; - type: "u64"; - }, - { - name: "initialSpendingLimit"; - type: { - option: { - defined: "InitialSpendingLimit"; - }; - }; - }, - ]; - }; - }, - { - name: "proposal"; - type: { - kind: "struct"; - fields: [ - { - name: "number"; - type: "u32"; - }, - { - name: "proposer"; - type: "publicKey"; - }, - { - name: "descriptionUrl"; - type: "string"; - }, - { - name: "slotEnqueued"; - type: "u64"; - }, - { - name: "state"; - type: { - defined: "ProposalState"; - }; - }, - { - name: "passAmm"; - type: "publicKey"; - }, - { - name: "failAmm"; - type: "publicKey"; - }, - { - name: "baseVault"; - type: "publicKey"; - }, - { - name: "quoteVault"; - type: "publicKey"; - }, - { - name: "dao"; - type: "publicKey"; - }, - { - name: "passLpTokensLocked"; - type: "u64"; - }, - { - name: "failLpTokensLocked"; - type: "u64"; - }, - { - name: "pdaBump"; - type: "u8"; - }, - { - name: "question"; - type: "publicKey"; - }, - { - name: "durationInSlots"; - type: "u64"; - }, - { - name: "squadsProposal"; - type: "publicKey"; - }, - ]; - }; - }, - ]; - types: [ - { - name: "CommonFields"; - type: { - kind: "struct"; - fields: [ - { - name: "slot"; - type: "u64"; - }, - { - name: "unixTimestamp"; - type: "i64"; - }, - ]; - }; - }, - { - name: "InitializeDaoParams"; - type: { - kind: "struct"; - fields: [ - { - name: "twapInitialObservation"; - type: "u128"; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; - }, - { - name: "twapStartDelaySlots"; - type: "u64"; - }, - { - name: "minQuoteFutarchicLiquidity"; - type: "u64"; - }, - { - name: "minBaseFutarchicLiquidity"; - type: "u64"; - }, - { - name: "passThresholdBps"; - type: "u16"; - }, - { - name: "slotsPerProposal"; - type: "u64"; - }, - { - name: "nonce"; - type: "u64"; - }, - { - name: "initialSpendingLimit"; - type: { - option: { - defined: "InitialSpendingLimit"; - }; - }; - }, - ]; - }; - }, - { - name: "InitializeProposalParams"; - type: { - kind: "struct"; - fields: [ - { - name: "descriptionUrl"; - type: "string"; - }, - { - name: "passLpTokensToLock"; - type: "u64"; - }, - { - name: "failLpTokensToLock"; - type: "u64"; - }, - ]; - }; - }, - { - name: "UpdateDaoParams"; - type: { - kind: "struct"; - fields: [ - { - name: "passThresholdBps"; - type: { - option: "u16"; - }; - }, - { - name: "slotsPerProposal"; - type: { - option: "u64"; - }; - }, - { - name: "twapInitialObservation"; - type: { - option: "u128"; - }; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: { - option: "u128"; - }; - }, - { - name: "minQuoteFutarchicLiquidity"; - type: { - option: "u64"; - }; - }, - { - name: "minBaseFutarchicLiquidity"; - type: { - option: "u64"; - }; - }, - ]; - }; - }, - { - name: "InitialSpendingLimit"; - type: { - kind: "struct"; - fields: [ - { - name: "amountPerMonth"; - type: "u64"; - }, - { - name: "members"; - type: { - vec: "publicKey"; - }; - }, - ]; - }; - }, - { - name: "ProposalState"; - type: { - kind: "enum"; - variants: [ - { - name: "Pending"; - }, - { - name: "Passed"; - }, - { - name: "Failed"; - }, - ]; - }; - }, - ]; - events: [ - { - name: "InitializeDaoEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "baseMint"; - type: "publicKey"; - index: false; - }, - { - name: "quoteMint"; - type: "publicKey"; - index: false; - }, - { - name: "passThresholdBps"; - type: "u16"; - index: false; - }, - { - name: "slotsPerProposal"; - type: "u64"; - index: false; - }, - { - name: "twapInitialObservation"; - type: "u128"; - index: false; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; - index: false; - }, - { - name: "minQuoteFutarchicLiquidity"; - type: "u64"; - index: false; - }, - { - name: "minBaseFutarchicLiquidity"; - type: "u64"; - index: false; - }, - { - name: "initialSpendingLimit"; - type: { - option: { - defined: "InitialSpendingLimit"; - }; - }; - index: false; - }, - { - name: "squadsMultisig"; - type: "publicKey"; - index: false; - }, - { - name: "squadsMultisigVault"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "UpdateDaoEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "passThresholdBps"; - type: "u16"; - index: false; - }, - { - name: "slotsPerProposal"; - type: "u64"; - index: false; - }, - { - name: "twapInitialObservation"; - type: "u128"; - index: false; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; - index: false; - }, - { - name: "minQuoteFutarchicLiquidity"; - type: "u64"; - index: false; - }, - { - name: "minBaseFutarchicLiquidity"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "InitializeProposalEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "proposal"; - type: "publicKey"; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "question"; - type: "publicKey"; - index: false; - }, - { - name: "quoteVault"; - type: "publicKey"; - index: false; - }, - { - name: "baseVault"; - type: "publicKey"; - index: false; - }, - { - name: "passAmm"; - type: "publicKey"; - index: false; - }, - { - name: "failAmm"; - type: "publicKey"; - index: false; - }, - { - name: "passLpMint"; - type: "publicKey"; - index: false; - }, - { - name: "failLpMint"; - type: "publicKey"; - index: false; - }, - { - name: "proposer"; - type: "publicKey"; - index: false; - }, - { - name: "number"; - type: "u32"; - index: false; - }, - { - name: "passLpTokensLocked"; - type: "u64"; - index: false; - }, - { - name: "failLpTokensLocked"; - type: "u64"; - index: false; - }, - { - name: "pdaBump"; - type: "u8"; - index: false; - }, - { - name: "durationInSlots"; - type: "u64"; - index: false; - }, - { - name: "squadsProposal"; - type: "publicKey"; - index: false; - }, - { - name: "squadsMultisig"; - type: "publicKey"; - index: false; - }, - { - name: "squadsMultisigVault"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "FinalizeProposalEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "proposal"; - type: "publicKey"; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "passMarketTwap"; - type: "u128"; - index: false; - }, - { - name: "failMarketTwap"; - type: "u128"; - index: false; - }, - { - name: "threshold"; - type: "u128"; - index: false; - }, - { - name: "state"; - type: { - defined: "ProposalState"; - }; - index: false; - }, - { - name: "squadsProposal"; - type: "publicKey"; - index: false; - }, - { - name: "squadsMultisig"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "ExecuteProposalEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "proposal"; - type: "publicKey"; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - ]; - }, - ]; - errors: [ - { - code: 6000; - name: "AmmTooOld"; - msg: "Amms must have been created within 5 minutes (counted in slots) of proposal initialization"; - }, - { - code: 6001; - name: "InvalidInitialObservation"; - msg: "An amm has an `initial_observation` that doesn't match the `dao`'s config"; - }, - { - code: 6002; - name: "InvalidMaxObservationChange"; - msg: "An amm has a `max_observation_change_per_update` that doesn't match the `dao`'s config"; - }, - { - code: 6003; - name: "InvalidStartDelaySlots"; - msg: "An amm has a `start_delay_slots` that doesn't match the `dao`'s config"; - }, - { - code: 6004; - name: "InvalidSettlementAuthority"; - msg: "One of the vaults has an invalid `settlement_authority`"; - }, - { - code: 6005; - name: "ProposalTooYoung"; - msg: "Proposal is too young to be executed or rejected"; - }, - { - code: 6006; - name: "MarketsTooYoung"; - msg: "Markets too young for proposal to be finalized. TWAP might need to be cranked"; - }, - { - code: 6007; - name: "ProposalAlreadyFinalized"; - msg: "This proposal has already been finalized"; - }, - { - code: 6008; - name: "InvalidVaultNonce"; - msg: "A conditional vault has an invalid nonce. A nonce should encode the proposal number"; - }, - { - code: 6009; - name: "ProposalNotPassed"; - msg: "This proposal can't be executed because it isn't in the passed state"; - }, - { - code: 6010; - name: "InsufficientLpTokenBalance"; - msg: "The proposer has fewer pass or fail LP tokens than they requested to lock"; - }, - { - code: 6011; - name: "InsufficientLpTokenLock"; - msg: "The LP tokens passed in have less liquidity than the DAO's `min_quote_futarchic_liquidity` or `min_base_futachic_liquidity`"; - }, - { - code: 6012; - name: "ProposalDurationTooShort"; - msg: "Proposal duration must be longer than TWAP start delay"; - }, - { - code: 6013; - name: "QuestionMustBeBinary"; - msg: "Question must have exactly 2 outcomes for binary futarchy"; - }, - { - code: 6014; - name: "InvalidSquadsProposalStatus"; - msg: "Squads proposal must be in Draft status"; - }, - { - code: 6015; - name: "InvalidTransaction"; - msg: "This Squads transaction should only contain calls to update spending limits"; - }, - ]; -}; - -export const IDL: Autocrat = { - version: "0.5.0", - name: "autocrat", - instructions: [ - { - name: "initializeDao", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "daoCreator", - isMut: false, - isSigner: true, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigVault", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgram", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgramConfig", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgramConfigTreasury", - isMut: true, - isSigner: false, - }, - { - name: "spendingLimit", - isMut: true, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "InitializeDaoParams", - }, - }, - ], - }, - { - name: "initializeProposal", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "squadsProposal", - isMut: false, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "question", - isMut: false, - isSigner: false, - }, - { - name: "quoteVault", - isMut: false, - isSigner: false, - }, - { - name: "baseVault", - isMut: false, - isSigner: false, - }, - { - name: "passAmm", - isMut: false, - isSigner: false, - }, - { - name: "passLpMint", - isMut: false, - isSigner: false, - }, - { - name: "failLpMint", - isMut: false, - isSigner: false, - }, - { - name: "failAmm", - isMut: false, - isSigner: false, - }, - { - name: "passLpUserAccount", - isMut: true, - isSigner: false, - }, - { - name: "failLpUserAccount", - isMut: true, - isSigner: false, - }, - { - name: "passLpVaultAccount", - isMut: true, - isSigner: false, - }, - { - name: "failLpVaultAccount", - isMut: true, - isSigner: false, - }, - { - name: "proposer", - isMut: false, - isSigner: true, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "InitializeProposalParams", - }, - }, - ], - }, - { - name: "finalizeProposal", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "squadsProposal", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigProgram", - isMut: false, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: false, - isSigner: false, - }, - { - name: "passAmm", - isMut: false, - isSigner: false, - }, - { - name: "failAmm", - isMut: false, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "question", - isMut: true, - isSigner: false, - }, - { - name: "passLpUserAccount", - isMut: true, - isSigner: false, - }, - { - name: "failLpUserAccount", - isMut: true, - isSigner: false, - }, - { - name: "passLpVaultAccount", - isMut: true, - isSigner: false, - }, - { - name: "failLpVaultAccount", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "vaultProgram", - isMut: false, - isSigner: false, - }, - { - name: "vaultEventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "updateDao", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigVault", - isMut: false, - isSigner: true, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "daoParams", - type: { - defined: "UpdateDaoParams", - }, - }, - ], - }, - { - name: "executeSpendingLimitChange", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "squadsProposal", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: false, - isSigner: false, - }, - { - name: "squadsMultisigProgram", - isMut: false, - isSigner: false, - }, - { - name: "vaultTransaction", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "upgradeMultisigDao", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigProgram", - isMut: false, - isSigner: false, - }, - { - name: "rentPayer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "kollan", - isMut: false, - isSigner: true, - }, - ], - args: [], - }, - { - name: "fixOmnipairSpendingLimit", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigProgram", - isMut: false, - isSigner: false, - }, - { - name: "rentPayer", - isMut: true, - isSigner: true, - }, - { - name: "kollan", - isMut: false, - isSigner: true, - }, - { - name: "omnipairSpendingLimit", - isMut: true, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "dao", - type: { - kind: "struct", - fields: [ - { - name: "nonce", - docs: ["`nonce` + `dao_creator` are PDA seeds"], - type: "u64", - }, - { - name: "daoCreator", - type: "publicKey", - }, - { - name: "pdaBump", - type: "u8", - }, - { - name: "squadsMultisig", - type: "publicKey", - }, - { - name: "squadsMultisigVault", - type: "publicKey", - }, - { - name: "baseMint", - type: "publicKey", - }, - { - name: "quoteMint", - type: "publicKey", - }, - { - name: "proposalCount", - type: "u32", - }, - { - name: "passThresholdBps", - type: "u16", - }, - { - name: "slotsPerProposal", - type: "u64", - }, - { - name: "twapInitialObservation", - docs: [ - "For manipulation-resistance the TWAP is a time-weighted average observation,", - "where observation tries to approximate price but can only move by", - "`twap_max_observation_change_per_update` per update. Because it can only move", - "a little bit per update, you need to check that it has a good initial observation.", - "Otherwise, an attacker could create a very high initial observation in the pass", - "market and a very low one in the fail market to force the proposal to pass.", - "", - "We recommend setting an initial observation around the spot price of the token,", - "and max observation change per update around 2% the spot price of the token.", - "For example, if the spot price of META is $400, we'd recommend setting an initial", - "observation of 400 (converted into the AMM prices) and a max observation change per", - "update of 8 (also converted into the AMM prices). Observations can be updated once", - "a minute, so 2% allows the proposal market to reach double the spot price or 0", - "in 50 minutes.", - ], - type: "u128", - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - }, - { - name: "twapStartDelaySlots", - docs: [ - "Forces TWAP calculation to start after amm.created_at_slot + twap_start_delay_slots", - ], - type: "u64", - }, - { - name: "minQuoteFutarchicLiquidity", - docs: [ - "As an anti-spam measure and to help liquidity, you need to lock up some liquidity", - "in both futarchic markets in order to create a proposal.", - "", - "For example, for META, we can use a `min_quote_futarchic_liquidity` of", - "5000 * 1_000_000 (5000 USDC) and a `min_base_futarchic_liquidity` of", - "10 * 1_000_000_000 (10 META).", - ], - type: "u64", - }, - { - name: "minBaseFutarchicLiquidity", - type: "u64", - }, - { - name: "seqNum", - type: "u64", - }, - { - name: "initialSpendingLimit", - type: { - option: { - defined: "InitialSpendingLimit", - }, - }, - }, - ], - }, - }, - { - name: "proposal", - type: { - kind: "struct", - fields: [ - { - name: "number", - type: "u32", - }, - { - name: "proposer", - type: "publicKey", - }, - { - name: "descriptionUrl", - type: "string", - }, - { - name: "slotEnqueued", - type: "u64", - }, - { - name: "state", - type: { - defined: "ProposalState", - }, - }, - { - name: "passAmm", - type: "publicKey", - }, - { - name: "failAmm", - type: "publicKey", - }, - { - name: "baseVault", - type: "publicKey", - }, - { - name: "quoteVault", - type: "publicKey", - }, - { - name: "dao", - type: "publicKey", - }, - { - name: "passLpTokensLocked", - type: "u64", - }, - { - name: "failLpTokensLocked", - type: "u64", - }, - { - name: "pdaBump", - type: "u8", - }, - { - name: "question", - type: "publicKey", - }, - { - name: "durationInSlots", - type: "u64", - }, - { - name: "squadsProposal", - type: "publicKey", - }, - ], - }, - }, - ], - types: [ - { - name: "CommonFields", - type: { - kind: "struct", - fields: [ - { - name: "slot", - type: "u64", - }, - { - name: "unixTimestamp", - type: "i64", - }, - ], - }, - }, - { - name: "InitializeDaoParams", - type: { - kind: "struct", - fields: [ - { - name: "twapInitialObservation", - type: "u128", - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - }, - { - name: "twapStartDelaySlots", - type: "u64", - }, - { - name: "minQuoteFutarchicLiquidity", - type: "u64", - }, - { - name: "minBaseFutarchicLiquidity", - type: "u64", - }, - { - name: "passThresholdBps", - type: "u16", - }, - { - name: "slotsPerProposal", - type: "u64", - }, - { - name: "nonce", - type: "u64", - }, - { - name: "initialSpendingLimit", - type: { - option: { - defined: "InitialSpendingLimit", - }, - }, - }, - ], - }, - }, - { - name: "InitializeProposalParams", - type: { - kind: "struct", - fields: [ - { - name: "descriptionUrl", - type: "string", - }, - { - name: "passLpTokensToLock", - type: "u64", - }, - { - name: "failLpTokensToLock", - type: "u64", - }, - ], - }, - }, - { - name: "UpdateDaoParams", - type: { - kind: "struct", - fields: [ - { - name: "passThresholdBps", - type: { - option: "u16", - }, - }, - { - name: "slotsPerProposal", - type: { - option: "u64", - }, - }, - { - name: "twapInitialObservation", - type: { - option: "u128", - }, - }, - { - name: "twapMaxObservationChangePerUpdate", - type: { - option: "u128", - }, - }, - { - name: "minQuoteFutarchicLiquidity", - type: { - option: "u64", - }, - }, - { - name: "minBaseFutarchicLiquidity", - type: { - option: "u64", - }, - }, - ], - }, - }, - { - name: "InitialSpendingLimit", - type: { - kind: "struct", - fields: [ - { - name: "amountPerMonth", - type: "u64", - }, - { - name: "members", - type: { - vec: "publicKey", - }, - }, - ], - }, - }, - { - name: "ProposalState", - type: { - kind: "enum", - variants: [ - { - name: "Pending", - }, - { - name: "Passed", - }, - { - name: "Failed", - }, - ], - }, - }, - ], - events: [ - { - name: "InitializeDaoEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "baseMint", - type: "publicKey", - index: false, - }, - { - name: "quoteMint", - type: "publicKey", - index: false, - }, - { - name: "passThresholdBps", - type: "u16", - index: false, - }, - { - name: "slotsPerProposal", - type: "u64", - index: false, - }, - { - name: "twapInitialObservation", - type: "u128", - index: false, - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - index: false, - }, - { - name: "minQuoteFutarchicLiquidity", - type: "u64", - index: false, - }, - { - name: "minBaseFutarchicLiquidity", - type: "u64", - index: false, - }, - { - name: "initialSpendingLimit", - type: { - option: { - defined: "InitialSpendingLimit", - }, - }, - index: false, - }, - { - name: "squadsMultisig", - type: "publicKey", - index: false, - }, - { - name: "squadsMultisigVault", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "UpdateDaoEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "passThresholdBps", - type: "u16", - index: false, - }, - { - name: "slotsPerProposal", - type: "u64", - index: false, - }, - { - name: "twapInitialObservation", - type: "u128", - index: false, - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - index: false, - }, - { - name: "minQuoteFutarchicLiquidity", - type: "u64", - index: false, - }, - { - name: "minBaseFutarchicLiquidity", - type: "u64", - index: false, - }, - ], - }, - { - name: "InitializeProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "proposal", - type: "publicKey", - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "question", - type: "publicKey", - index: false, - }, - { - name: "quoteVault", - type: "publicKey", - index: false, - }, - { - name: "baseVault", - type: "publicKey", - index: false, - }, - { - name: "passAmm", - type: "publicKey", - index: false, - }, - { - name: "failAmm", - type: "publicKey", - index: false, - }, - { - name: "passLpMint", - type: "publicKey", - index: false, - }, - { - name: "failLpMint", - type: "publicKey", - index: false, - }, - { - name: "proposer", - type: "publicKey", - index: false, - }, - { - name: "number", - type: "u32", - index: false, - }, - { - name: "passLpTokensLocked", - type: "u64", - index: false, - }, - { - name: "failLpTokensLocked", - type: "u64", - index: false, - }, - { - name: "pdaBump", - type: "u8", - index: false, - }, - { - name: "durationInSlots", - type: "u64", - index: false, - }, - { - name: "squadsProposal", - type: "publicKey", - index: false, - }, - { - name: "squadsMultisig", - type: "publicKey", - index: false, - }, - { - name: "squadsMultisigVault", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "FinalizeProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "proposal", - type: "publicKey", - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "passMarketTwap", - type: "u128", - index: false, - }, - { - name: "failMarketTwap", - type: "u128", - index: false, - }, - { - name: "threshold", - type: "u128", - index: false, - }, - { - name: "state", - type: { - defined: "ProposalState", - }, - index: false, - }, - { - name: "squadsProposal", - type: "publicKey", - index: false, - }, - { - name: "squadsMultisig", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "ExecuteProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "proposal", - type: "publicKey", - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - ], - }, - ], - errors: [ - { - code: 6000, - name: "AmmTooOld", - msg: "Amms must have been created within 5 minutes (counted in slots) of proposal initialization", - }, - { - code: 6001, - name: "InvalidInitialObservation", - msg: "An amm has an `initial_observation` that doesn't match the `dao`'s config", - }, - { - code: 6002, - name: "InvalidMaxObservationChange", - msg: "An amm has a `max_observation_change_per_update` that doesn't match the `dao`'s config", - }, - { - code: 6003, - name: "InvalidStartDelaySlots", - msg: "An amm has a `start_delay_slots` that doesn't match the `dao`'s config", - }, - { - code: 6004, - name: "InvalidSettlementAuthority", - msg: "One of the vaults has an invalid `settlement_authority`", - }, - { - code: 6005, - name: "ProposalTooYoung", - msg: "Proposal is too young to be executed or rejected", - }, - { - code: 6006, - name: "MarketsTooYoung", - msg: "Markets too young for proposal to be finalized. TWAP might need to be cranked", - }, - { - code: 6007, - name: "ProposalAlreadyFinalized", - msg: "This proposal has already been finalized", - }, - { - code: 6008, - name: "InvalidVaultNonce", - msg: "A conditional vault has an invalid nonce. A nonce should encode the proposal number", - }, - { - code: 6009, - name: "ProposalNotPassed", - msg: "This proposal can't be executed because it isn't in the passed state", - }, - { - code: 6010, - name: "InsufficientLpTokenBalance", - msg: "The proposer has fewer pass or fail LP tokens than they requested to lock", - }, - { - code: 6011, - name: "InsufficientLpTokenLock", - msg: "The LP tokens passed in have less liquidity than the DAO's `min_quote_futarchic_liquidity` or `min_base_futachic_liquidity`", - }, - { - code: 6012, - name: "ProposalDurationTooShort", - msg: "Proposal duration must be longer than TWAP start delay", - }, - { - code: 6013, - name: "QuestionMustBeBinary", - msg: "Question must have exactly 2 outcomes for binary futarchy", - }, - { - code: 6014, - name: "InvalidSquadsProposalStatus", - msg: "Squads proposal must be in Draft status", - }, - { - code: 6015, - name: "InvalidTransaction", - msg: "This Squads transaction should only contain calls to update spending limits", - }, - ], -}; diff --git a/sdk/src/v0.7/types/autocrat_migrator.ts b/sdk/src/v0.7/types/autocrat_migrator.ts deleted file mode 100644 index 676d2df3d..000000000 --- a/sdk/src/v0.7/types/autocrat_migrator.ts +++ /dev/null @@ -1,237 +0,0 @@ -export type AutocratMigrator = { - version: "0.1.0"; - name: "autocrat_migrator"; - instructions: [ - { - name: "multiTransfer2"; - accounts: [ - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "authority"; - isMut: true; - isSigner: true; - }, - { - name: "from0"; - isMut: true; - isSigner: false; - }, - { - name: "to0"; - isMut: true; - isSigner: false; - }, - { - name: "from1"; - isMut: true; - isSigner: false; - }, - { - name: "to1"; - isMut: true; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "lamportReceiver"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "multiTransfer4"; - accounts: [ - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "authority"; - isMut: true; - isSigner: true; - }, - { - name: "from0"; - isMut: true; - isSigner: false; - }, - { - name: "to0"; - isMut: true; - isSigner: false; - }, - { - name: "from1"; - isMut: true; - isSigner: false; - }, - { - name: "to1"; - isMut: true; - isSigner: false; - }, - { - name: "from2"; - isMut: true; - isSigner: false; - }, - { - name: "to2"; - isMut: true; - isSigner: false; - }, - { - name: "from3"; - isMut: true; - isSigner: false; - }, - { - name: "to3"; - isMut: true; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "lamportReceiver"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - ]; -}; - -export const IDL: AutocratMigrator = { - version: "0.1.0", - name: "autocrat_migrator", - instructions: [ - { - name: "multiTransfer2", - accounts: [ - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "authority", - isMut: true, - isSigner: true, - }, - { - name: "from0", - isMut: true, - isSigner: false, - }, - { - name: "to0", - isMut: true, - isSigner: false, - }, - { - name: "from1", - isMut: true, - isSigner: false, - }, - { - name: "to1", - isMut: true, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "lamportReceiver", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - { - name: "multiTransfer4", - accounts: [ - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "authority", - isMut: true, - isSigner: true, - }, - { - name: "from0", - isMut: true, - isSigner: false, - }, - { - name: "to0", - isMut: true, - isSigner: false, - }, - { - name: "from1", - isMut: true, - isSigner: false, - }, - { - name: "to1", - isMut: true, - isSigner: false, - }, - { - name: "from2", - isMut: true, - isSigner: false, - }, - { - name: "to2", - isMut: true, - isSigner: false, - }, - { - name: "from3", - isMut: true, - isSigner: false, - }, - { - name: "to3", - isMut: true, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "lamportReceiver", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - ], -}; diff --git a/sdk/src/v0.7/types/damm_v2_cpi.ts b/sdk/src/v0.7/types/damm_v2_cpi.ts deleted file mode 100644 index 448829271..000000000 --- a/sdk/src/v0.7/types/damm_v2_cpi.ts +++ /dev/null @@ -1,747 +0,0 @@ -export type DammV2Cpi = { - version: "0.1.0"; - name: "damm_v2_cpi"; - instructions: [ - { - name: "initializePoolWithDynamicConfig"; - accounts: [ - { - name: "creator"; - isMut: false; - isSigner: false; - }, - { - name: "positionNftMint"; - isMut: true; - isSigner: true; - }, - { - name: "positionNftAccount"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - docs: ["Address paying to create the pool. Can be anyone"]; - }, - { - name: "poolCreatorAuthority"; - isMut: false; - isSigner: true; - }, - { - name: "config"; - isMut: false; - isSigner: false; - }, - { - name: "poolAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "pool"; - isMut: true; - isSigner: false; - }, - { - name: "position"; - isMut: true; - isSigner: false; - }, - { - name: "tokenAMint"; - isMut: false; - isSigner: false; - }, - { - name: "tokenBMint"; - isMut: false; - isSigner: false; - }, - { - name: "tokenAVault"; - isMut: true; - isSigner: false; - }, - { - name: "tokenBVault"; - isMut: true; - isSigner: false; - }, - { - name: "payerTokenA"; - isMut: true; - isSigner: false; - }, - { - name: "payerTokenB"; - isMut: true; - isSigner: false; - }, - { - name: "tokenAProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenBProgram"; - isMut: false; - isSigner: false; - }, - { - name: "token2022Program"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "InitializeCustomizablePoolParameters"; - }; - }, - ]; - }, - { - name: "claimPositionFee"; - accounts: [ - { - name: "poolAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "pool"; - isMut: false; - isSigner: false; - }, - { - name: "position"; - isMut: true; - isSigner: false; - }, - { - name: "tokenAAccount"; - isMut: true; - isSigner: false; - docs: ["The user token a account"]; - }, - { - name: "tokenBAccount"; - isMut: true; - isSigner: false; - docs: ["The user token b account"]; - }, - { - name: "tokenAVault"; - isMut: true; - isSigner: false; - docs: ["The vault token account for input token"]; - }, - { - name: "tokenBVault"; - isMut: true; - isSigner: false; - docs: ["The vault token account for output token"]; - }, - { - name: "tokenAMint"; - isMut: false; - isSigner: false; - docs: ["The mint of token a"]; - }, - { - name: "tokenBMint"; - isMut: false; - isSigner: false; - docs: ["The mint of token b"]; - }, - { - name: "positionNftAccount"; - isMut: false; - isSigner: false; - docs: ["The token account for nft"]; - }, - { - name: "owner"; - isMut: false; - isSigner: true; - docs: ["owner of position"]; - }, - { - name: "tokenAProgram"; - isMut: false; - isSigner: false; - docs: ["Token a program"]; - }, - { - name: "tokenBProgram"; - isMut: false; - isSigner: false; - docs: ["Token b program"]; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - ]; - types: [ - { - name: "PoolFeeParameters"; - docs: ["Information regarding fee charges"]; - type: { - kind: "struct"; - fields: [ - { - name: "baseFee"; - docs: ["Base fee"]; - type: { - defined: "BaseFeeParameters"; - }; - }, - { - name: "padding"; - docs: ["padding"]; - type: { - array: ["u8", 3]; - }; - }, - { - name: "dynamicFee"; - docs: ["dynamic fee"]; - type: { - option: { - defined: "DynamicFeeParameters"; - }; - }; - }, - ]; - }; - }, - { - name: "BaseFeeParameters"; - type: { - kind: "struct"; - fields: [ - { - name: "cliffFeeNumerator"; - type: "u64"; - }, - { - name: "numberOfPeriod"; - type: "u16"; - }, - { - name: "periodFrequency"; - type: "u64"; - }, - { - name: "reductionFactor"; - type: "u64"; - }, - { - name: "feeSchedulerMode"; - type: "u8"; - }, - ]; - }; - }, - { - name: "DynamicFeeParameters"; - type: { - kind: "struct"; - fields: [ - { - name: "binStep"; - type: "u16"; - }, - { - name: "binStepU128"; - type: "u128"; - }, - { - name: "filterPeriod"; - type: "u16"; - }, - { - name: "decayPeriod"; - type: "u16"; - }, - { - name: "reductionFactor"; - type: "u16"; - }, - { - name: "maxVolatilityAccumulator"; - type: "u32"; - }, - { - name: "variableFeeControl"; - type: "u32"; - }, - ]; - }; - }, - { - name: "InitializeCustomizablePoolParameters"; - type: { - kind: "struct"; - fields: [ - { - name: "poolFees"; - docs: ["pool fees"]; - type: { - defined: "PoolFeeParameters"; - }; - }, - { - name: "sqrtMinPrice"; - docs: ["sqrt min price"]; - type: "u128"; - }, - { - name: "sqrtMaxPrice"; - docs: ["sqrt max price"]; - type: "u128"; - }, - { - name: "hasAlphaVault"; - docs: ["has alpha vault"]; - type: "bool"; - }, - { - name: "liquidity"; - docs: ["initialize liquidity"]; - type: "u128"; - }, - { - name: "sqrtPrice"; - docs: [ - "The init price of the pool as a sqrt(token_b/token_a) Q64.64 value", - ]; - type: "u128"; - }, - { - name: "activationType"; - docs: ["activation type"]; - type: "u8"; - }, - { - name: "collectFeeMode"; - docs: ["collect fee mode"]; - type: "u8"; - }, - { - name: "activationPoint"; - docs: ["activation point"]; - type: { - option: "u64"; - }; - }, - ]; - }; - }, - ]; -}; - -export const IDL: DammV2Cpi = { - version: "0.1.0", - name: "damm_v2_cpi", - instructions: [ - { - name: "initializePoolWithDynamicConfig", - accounts: [ - { - name: "creator", - isMut: false, - isSigner: false, - }, - { - name: "positionNftMint", - isMut: true, - isSigner: true, - }, - { - name: "positionNftAccount", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - docs: ["Address paying to create the pool. Can be anyone"], - }, - { - name: "poolCreatorAuthority", - isMut: false, - isSigner: true, - }, - { - name: "config", - isMut: false, - isSigner: false, - }, - { - name: "poolAuthority", - isMut: false, - isSigner: false, - }, - { - name: "pool", - isMut: true, - isSigner: false, - }, - { - name: "position", - isMut: true, - isSigner: false, - }, - { - name: "tokenAMint", - isMut: false, - isSigner: false, - }, - { - name: "tokenBMint", - isMut: false, - isSigner: false, - }, - { - name: "tokenAVault", - isMut: true, - isSigner: false, - }, - { - name: "tokenBVault", - isMut: true, - isSigner: false, - }, - { - name: "payerTokenA", - isMut: true, - isSigner: false, - }, - { - name: "payerTokenB", - isMut: true, - isSigner: false, - }, - { - name: "tokenAProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenBProgram", - isMut: false, - isSigner: false, - }, - { - name: "token2022Program", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "InitializeCustomizablePoolParameters", - }, - }, - ], - }, - { - name: "claimPositionFee", - accounts: [ - { - name: "poolAuthority", - isMut: false, - isSigner: false, - }, - { - name: "pool", - isMut: false, - isSigner: false, - }, - { - name: "position", - isMut: true, - isSigner: false, - }, - { - name: "tokenAAccount", - isMut: true, - isSigner: false, - docs: ["The user token a account"], - }, - { - name: "tokenBAccount", - isMut: true, - isSigner: false, - docs: ["The user token b account"], - }, - { - name: "tokenAVault", - isMut: true, - isSigner: false, - docs: ["The vault token account for input token"], - }, - { - name: "tokenBVault", - isMut: true, - isSigner: false, - docs: ["The vault token account for output token"], - }, - { - name: "tokenAMint", - isMut: false, - isSigner: false, - docs: ["The mint of token a"], - }, - { - name: "tokenBMint", - isMut: false, - isSigner: false, - docs: ["The mint of token b"], - }, - { - name: "positionNftAccount", - isMut: false, - isSigner: false, - docs: ["The token account for nft"], - }, - { - name: "owner", - isMut: false, - isSigner: true, - docs: ["owner of position"], - }, - { - name: "tokenAProgram", - isMut: false, - isSigner: false, - docs: ["Token a program"], - }, - { - name: "tokenBProgram", - isMut: false, - isSigner: false, - docs: ["Token b program"], - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - ], - types: [ - { - name: "PoolFeeParameters", - docs: ["Information regarding fee charges"], - type: { - kind: "struct", - fields: [ - { - name: "baseFee", - docs: ["Base fee"], - type: { - defined: "BaseFeeParameters", - }, - }, - { - name: "padding", - docs: ["padding"], - type: { - array: ["u8", 3], - }, - }, - { - name: "dynamicFee", - docs: ["dynamic fee"], - type: { - option: { - defined: "DynamicFeeParameters", - }, - }, - }, - ], - }, - }, - { - name: "BaseFeeParameters", - type: { - kind: "struct", - fields: [ - { - name: "cliffFeeNumerator", - type: "u64", - }, - { - name: "numberOfPeriod", - type: "u16", - }, - { - name: "periodFrequency", - type: "u64", - }, - { - name: "reductionFactor", - type: "u64", - }, - { - name: "feeSchedulerMode", - type: "u8", - }, - ], - }, - }, - { - name: "DynamicFeeParameters", - type: { - kind: "struct", - fields: [ - { - name: "binStep", - type: "u16", - }, - { - name: "binStepU128", - type: "u128", - }, - { - name: "filterPeriod", - type: "u16", - }, - { - name: "decayPeriod", - type: "u16", - }, - { - name: "reductionFactor", - type: "u16", - }, - { - name: "maxVolatilityAccumulator", - type: "u32", - }, - { - name: "variableFeeControl", - type: "u32", - }, - ], - }, - }, - { - name: "InitializeCustomizablePoolParameters", - type: { - kind: "struct", - fields: [ - { - name: "poolFees", - docs: ["pool fees"], - type: { - defined: "PoolFeeParameters", - }, - }, - { - name: "sqrtMinPrice", - docs: ["sqrt min price"], - type: "u128", - }, - { - name: "sqrtMaxPrice", - docs: ["sqrt max price"], - type: "u128", - }, - { - name: "hasAlphaVault", - docs: ["has alpha vault"], - type: "bool", - }, - { - name: "liquidity", - docs: ["initialize liquidity"], - type: "u128", - }, - { - name: "sqrtPrice", - docs: [ - "The init price of the pool as a sqrt(token_b/token_a) Q64.64 value", - ], - type: "u128", - }, - { - name: "activationType", - docs: ["activation type"], - type: "u8", - }, - { - name: "collectFeeMode", - docs: ["collect fee mode"], - type: "u8", - }, - { - name: "activationPoint", - docs: ["activation point"], - type: { - option: "u64", - }, - }, - ], - }, - }, - ], -}; diff --git a/sdk/src/v0.7/types/futarchy_amm.ts b/sdk/src/v0.7/types/futarchy_amm.ts deleted file mode 100644 index c1aef0d19..000000000 --- a/sdk/src/v0.7/types/futarchy_amm.ts +++ /dev/null @@ -1,1663 +0,0 @@ -export type FutarchyAmm = { - version: "0.4.1"; - name: "futarchy_amm"; - instructions: [ - { - name: "createAmm"; - accounts: [ - { - name: "user"; - isMut: true; - isSigner: true; - }, - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "lpMint"; - isMut: true; - isSigner: false; - }, - { - name: "baseMint"; - isMut: false; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - }, - { - name: "vaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "CreateAmmArgs"; - }; - }, - ]; - }, - { - name: "addLiquidity"; - accounts: [ - { - name: "user"; - isMut: true; - isSigner: true; - }, - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "lpMint"; - isMut: true; - isSigner: false; - }, - { - name: "userLpAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userBaseAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "AddLiquidityArgs"; - }; - }, - ]; - }, - { - name: "removeLiquidity"; - accounts: [ - { - name: "user"; - isMut: true; - isSigner: true; - }, - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "lpMint"; - isMut: true; - isSigner: false; - }, - { - name: "userLpAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userBaseAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "RemoveLiquidityArgs"; - }; - }, - ]; - }, - { - name: "swap"; - accounts: [ - { - name: "user"; - isMut: true; - isSigner: true; - }, - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "userBaseAccount"; - isMut: true; - isSigner: false; - }, - { - name: "userQuoteAccount"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaBase"; - isMut: true; - isSigner: false; - }, - { - name: "vaultAtaQuote"; - isMut: true; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "SwapArgs"; - }; - }, - ]; - }, - { - name: "crankThatTwap"; - accounts: [ - { - name: "amm"; - isMut: true; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - ]; - accounts: [ - { - name: "amm"; - type: { - kind: "struct"; - fields: [ - { - name: "bump"; - type: "u8"; - }, - { - name: "createdAtSlot"; - type: "u64"; - }, - { - name: "lpMint"; - type: "publicKey"; - }, - { - name: "baseMint"; - type: "publicKey"; - }, - { - name: "quoteMint"; - type: "publicKey"; - }, - { - name: "baseMintDecimals"; - type: "u8"; - }, - { - name: "quoteMintDecimals"; - type: "u8"; - }, - { - name: "baseAmount"; - type: "u64"; - }, - { - name: "quoteAmount"; - type: "u64"; - }, - { - name: "oracle"; - type: { - defined: "TwapOracle"; - }; - }, - { - name: "seqNum"; - type: "u64"; - }, - { - name: "vaultAtaBase"; - type: "publicKey"; - }, - { - name: "vaultAtaQuote"; - type: "publicKey"; - }, - ]; - }; - }, - ]; - types: [ - { - name: "CommonFields"; - type: { - kind: "struct"; - fields: [ - { - name: "slot"; - type: "u64"; - }, - { - name: "unixTimestamp"; - type: "i64"; - }, - { - name: "user"; - type: "publicKey"; - }, - { - name: "amm"; - type: "publicKey"; - }, - { - name: "postBaseReserves"; - type: "u64"; - }, - { - name: "postQuoteReserves"; - type: "u64"; - }, - { - name: "oracleLastPrice"; - type: "u128"; - }, - { - name: "oracleLastObservation"; - type: "u128"; - }, - { - name: "oracleAggregator"; - type: "u128"; - }, - { - name: "seqNum"; - type: "u64"; - }, - ]; - }; - }, - { - name: "AddLiquidityArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "quoteAmount"; - docs: ["How much quote token you will deposit to the pool"]; - type: "u64"; - }, - { - name: "maxBaseAmount"; - docs: ["The maximum base token you will deposit to the pool"]; - type: "u64"; - }, - { - name: "minLpTokens"; - docs: ["The minimum LP token you will get back"]; - type: "u64"; - }, - ]; - }; - }, - { - name: "CreateAmmArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "twapInitialObservation"; - type: "u128"; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; - }, - { - name: "twapStartDelaySlots"; - type: "u64"; - }, - ]; - }; - }, - { - name: "RemoveLiquidityArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "lpTokensToBurn"; - type: "u64"; - }, - { - name: "minQuoteAmount"; - type: "u64"; - }, - { - name: "minBaseAmount"; - type: "u64"; - }, - ]; - }; - }, - { - name: "SwapArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "swapType"; - type: { - defined: "SwapType"; - }; - }, - { - name: "inputAmount"; - type: "u64"; - }, - { - name: "outputAmountMin"; - type: "u64"; - }, - ]; - }; - }, - { - name: "TwapOracle"; - type: { - kind: "struct"; - fields: [ - { - name: "lastUpdatedSlot"; - type: "u64"; - }, - { - name: "lastPrice"; - docs: [ - "A price is the number of quote units per base unit multiplied by 1e12.", - "You cannot simply divide by 1e12 to get a price you can display in the UI", - "because the base and quote decimals may be different. Instead, do:", - "ui_price = (price * (10**(base_decimals - quote_decimals))) / 1e12", - ]; - type: "u128"; - }, - { - name: "lastObservation"; - docs: [ - "If we did a raw TWAP over prices, someone could push the TWAP heavily with", - "a few extremely large outliers. So we use observations, which can only move", - "by `max_observation_change_per_update` per update.", - ]; - type: "u128"; - }, - { - name: "aggregator"; - docs: [ - "Running sum of slots_per_last_update * last_observation.", - "", - "Assuming latest observations are as big as possible (u64::MAX * 1e12),", - "we can store 18 million slots worth of observations, which turns out to", - "be ~85 days worth of slots.", - "", - "Assuming that latest observations are 100x smaller than they could theoretically", - "be, we can store 8500 days (23 years) worth of them. Even this is a very", - "very conservative assumption - META/USDC prices should be between 1e9 and", - "1e15, which would overflow after 1e15 years worth of slots.", - "", - "So in the case of an overflow, the aggregator rolls back to 0. It's the", - "client's responsibility to sanity check the assets or to handle an", - "aggregator at T2 being smaller than an aggregator at T1.", - ]; - type: "u128"; - }, - { - name: "maxObservationChangePerUpdate"; - docs: ["The most that an observation can change per update."]; - type: "u128"; - }, - { - name: "initialObservation"; - docs: ["What the initial `latest_observation` is set to."]; - type: "u128"; - }, - { - name: "startDelaySlots"; - docs: [ - "Number of slots after amm.created_at_slot to start recording TWAP", - ]; - type: "u64"; - }, - ]; - }; - }, - { - name: "SwapType"; - type: { - kind: "enum"; - variants: [ - { - name: "Buy"; - }, - { - name: "Sell"; - }, - ]; - }; - }, - ]; - events: [ - { - name: "SwapEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "inputAmount"; - type: "u64"; - index: false; - }, - { - name: "outputAmount"; - type: "u64"; - index: false; - }, - { - name: "swapType"; - type: { - defined: "SwapType"; - }; - index: false; - }, - ]; - }, - { - name: "AddLiquidityEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "quoteAmount"; - type: "u64"; - index: false; - }, - { - name: "maxBaseAmount"; - type: "u64"; - index: false; - }, - { - name: "minLpTokens"; - type: "u64"; - index: false; - }, - { - name: "baseAmount"; - type: "u64"; - index: false; - }, - { - name: "lpTokensMinted"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "RemoveLiquidityEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "lpTokensBurned"; - type: "u64"; - index: false; - }, - { - name: "minQuoteAmount"; - type: "u64"; - index: false; - }, - { - name: "minBaseAmount"; - type: "u64"; - index: false; - }, - { - name: "baseAmount"; - type: "u64"; - index: false; - }, - { - name: "quoteAmount"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "CreateAmmEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "twapInitialObservation"; - type: "u128"; - index: false; - }, - { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; - index: false; - }, - { - name: "lpMint"; - type: "publicKey"; - index: false; - }, - { - name: "baseMint"; - type: "publicKey"; - index: false; - }, - { - name: "quoteMint"; - type: "publicKey"; - index: false; - }, - { - name: "vaultAtaBase"; - type: "publicKey"; - index: false; - }, - { - name: "vaultAtaQuote"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "CrankThatTwapEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - ]; - }, - ]; - errors: [ - { - code: 6000; - name: "AssertFailed"; - msg: "An assertion failed"; - }, - { - code: 6001; - name: "NoSlotsPassed"; - msg: "Can't get a TWAP before some observations have been stored"; - }, - { - code: 6002; - name: "NoReserves"; - msg: "Can't swap through a pool without token reserves on either side"; - }, - { - code: 6003; - name: "InputAmountOverflow"; - msg: "Input token amount is too large for a swap, causes overflow"; - }, - { - code: 6004; - name: "AddLiquidityCalculationError"; - msg: "Add liquidity calculation error"; - }, - { - code: 6005; - name: "DecimalScaleError"; - msg: "Error in decimal scale conversion"; - }, - { - code: 6006; - name: "SameTokenMints"; - msg: "You can't create an AMM pool where the token mints are the same"; - }, - { - code: 6007; - name: "SwapSlippageExceeded"; - msg: "A user wouldn't have gotten back their `output_amount_min`, reverting"; - }, - { - code: 6008; - name: "InsufficientBalance"; - msg: "The user had insufficient balance to do this"; - }, - { - code: 6009; - name: "ZeroLiquidityRemove"; - msg: "Must remove a non-zero amount of liquidity"; - }, - { - code: 6010; - name: "ZeroLiquidityToAdd"; - msg: "Cannot add liquidity with 0 tokens on either side"; - }, - { - code: 6011; - name: "ZeroMinLpTokens"; - msg: "Must specify a non-zero `min_lp_tokens` when adding to an existing pool"; - }, - { - code: 6012; - name: "AddLiquiditySlippageExceeded"; - msg: "LP wouldn't have gotten back `lp_token_min`"; - }, - { - code: 6013; - name: "AddLiquidityMaxBaseExceeded"; - msg: "LP would have spent more than `max_base_amount`"; - }, - { - code: 6014; - name: "InsufficientQuoteAmount"; - msg: "`quote_amount` must be greater than 100000000 when initializing a pool"; - }, - { - code: 6015; - name: "ZeroSwapAmount"; - msg: "Users must swap a non-zero amount"; - }, - { - code: 6016; - name: "ConstantProductInvariantFailed"; - msg: "K should always be increasing"; - }, - { - code: 6017; - name: "CastingOverflow"; - msg: "Casting has caused an overflow"; - }, - ]; -}; - -export const IDL: FutarchyAmm = { - version: "0.4.1", - name: "futarchy_amm", - instructions: [ - { - name: "createAmm", - accounts: [ - { - name: "user", - isMut: true, - isSigner: true, - }, - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "lpMint", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "vaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "CreateAmmArgs", - }, - }, - ], - }, - { - name: "addLiquidity", - accounts: [ - { - name: "user", - isMut: true, - isSigner: true, - }, - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "lpMint", - isMut: true, - isSigner: false, - }, - { - name: "userLpAccount", - isMut: true, - isSigner: false, - }, - { - name: "userBaseAccount", - isMut: true, - isSigner: false, - }, - { - name: "userQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "AddLiquidityArgs", - }, - }, - ], - }, - { - name: "removeLiquidity", - accounts: [ - { - name: "user", - isMut: true, - isSigner: true, - }, - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "lpMint", - isMut: true, - isSigner: false, - }, - { - name: "userLpAccount", - isMut: true, - isSigner: false, - }, - { - name: "userBaseAccount", - isMut: true, - isSigner: false, - }, - { - name: "userQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "RemoveLiquidityArgs", - }, - }, - ], - }, - { - name: "swap", - accounts: [ - { - name: "user", - isMut: true, - isSigner: true, - }, - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "userBaseAccount", - isMut: true, - isSigner: false, - }, - { - name: "userQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaBase", - isMut: true, - isSigner: false, - }, - { - name: "vaultAtaQuote", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "SwapArgs", - }, - }, - ], - }, - { - name: "crankThatTwap", - accounts: [ - { - name: "amm", - isMut: true, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "amm", - type: { - kind: "struct", - fields: [ - { - name: "bump", - type: "u8", - }, - { - name: "createdAtSlot", - type: "u64", - }, - { - name: "lpMint", - type: "publicKey", - }, - { - name: "baseMint", - type: "publicKey", - }, - { - name: "quoteMint", - type: "publicKey", - }, - { - name: "baseMintDecimals", - type: "u8", - }, - { - name: "quoteMintDecimals", - type: "u8", - }, - { - name: "baseAmount", - type: "u64", - }, - { - name: "quoteAmount", - type: "u64", - }, - { - name: "oracle", - type: { - defined: "TwapOracle", - }, - }, - { - name: "seqNum", - type: "u64", - }, - { - name: "vaultAtaBase", - type: "publicKey", - }, - { - name: "vaultAtaQuote", - type: "publicKey", - }, - ], - }, - }, - ], - types: [ - { - name: "CommonFields", - type: { - kind: "struct", - fields: [ - { - name: "slot", - type: "u64", - }, - { - name: "unixTimestamp", - type: "i64", - }, - { - name: "user", - type: "publicKey", - }, - { - name: "amm", - type: "publicKey", - }, - { - name: "postBaseReserves", - type: "u64", - }, - { - name: "postQuoteReserves", - type: "u64", - }, - { - name: "oracleLastPrice", - type: "u128", - }, - { - name: "oracleLastObservation", - type: "u128", - }, - { - name: "oracleAggregator", - type: "u128", - }, - { - name: "seqNum", - type: "u64", - }, - ], - }, - }, - { - name: "AddLiquidityArgs", - type: { - kind: "struct", - fields: [ - { - name: "quoteAmount", - docs: ["How much quote token you will deposit to the pool"], - type: "u64", - }, - { - name: "maxBaseAmount", - docs: ["The maximum base token you will deposit to the pool"], - type: "u64", - }, - { - name: "minLpTokens", - docs: ["The minimum LP token you will get back"], - type: "u64", - }, - ], - }, - }, - { - name: "CreateAmmArgs", - type: { - kind: "struct", - fields: [ - { - name: "twapInitialObservation", - type: "u128", - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - }, - { - name: "twapStartDelaySlots", - type: "u64", - }, - ], - }, - }, - { - name: "RemoveLiquidityArgs", - type: { - kind: "struct", - fields: [ - { - name: "lpTokensToBurn", - type: "u64", - }, - { - name: "minQuoteAmount", - type: "u64", - }, - { - name: "minBaseAmount", - type: "u64", - }, - ], - }, - }, - { - name: "SwapArgs", - type: { - kind: "struct", - fields: [ - { - name: "swapType", - type: { - defined: "SwapType", - }, - }, - { - name: "inputAmount", - type: "u64", - }, - { - name: "outputAmountMin", - type: "u64", - }, - ], - }, - }, - { - name: "TwapOracle", - type: { - kind: "struct", - fields: [ - { - name: "lastUpdatedSlot", - type: "u64", - }, - { - name: "lastPrice", - docs: [ - "A price is the number of quote units per base unit multiplied by 1e12.", - "You cannot simply divide by 1e12 to get a price you can display in the UI", - "because the base and quote decimals may be different. Instead, do:", - "ui_price = (price * (10**(base_decimals - quote_decimals))) / 1e12", - ], - type: "u128", - }, - { - name: "lastObservation", - docs: [ - "If we did a raw TWAP over prices, someone could push the TWAP heavily with", - "a few extremely large outliers. So we use observations, which can only move", - "by `max_observation_change_per_update` per update.", - ], - type: "u128", - }, - { - name: "aggregator", - docs: [ - "Running sum of slots_per_last_update * last_observation.", - "", - "Assuming latest observations are as big as possible (u64::MAX * 1e12),", - "we can store 18 million slots worth of observations, which turns out to", - "be ~85 days worth of slots.", - "", - "Assuming that latest observations are 100x smaller than they could theoretically", - "be, we can store 8500 days (23 years) worth of them. Even this is a very", - "very conservative assumption - META/USDC prices should be between 1e9 and", - "1e15, which would overflow after 1e15 years worth of slots.", - "", - "So in the case of an overflow, the aggregator rolls back to 0. It's the", - "client's responsibility to sanity check the assets or to handle an", - "aggregator at T2 being smaller than an aggregator at T1.", - ], - type: "u128", - }, - { - name: "maxObservationChangePerUpdate", - docs: ["The most that an observation can change per update."], - type: "u128", - }, - { - name: "initialObservation", - docs: ["What the initial `latest_observation` is set to."], - type: "u128", - }, - { - name: "startDelaySlots", - docs: [ - "Number of slots after amm.created_at_slot to start recording TWAP", - ], - type: "u64", - }, - ], - }, - }, - { - name: "SwapType", - type: { - kind: "enum", - variants: [ - { - name: "Buy", - }, - { - name: "Sell", - }, - ], - }, - }, - ], - events: [ - { - name: "SwapEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "inputAmount", - type: "u64", - index: false, - }, - { - name: "outputAmount", - type: "u64", - index: false, - }, - { - name: "swapType", - type: { - defined: "SwapType", - }, - index: false, - }, - ], - }, - { - name: "AddLiquidityEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "quoteAmount", - type: "u64", - index: false, - }, - { - name: "maxBaseAmount", - type: "u64", - index: false, - }, - { - name: "minLpTokens", - type: "u64", - index: false, - }, - { - name: "baseAmount", - type: "u64", - index: false, - }, - { - name: "lpTokensMinted", - type: "u64", - index: false, - }, - ], - }, - { - name: "RemoveLiquidityEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "lpTokensBurned", - type: "u64", - index: false, - }, - { - name: "minQuoteAmount", - type: "u64", - index: false, - }, - { - name: "minBaseAmount", - type: "u64", - index: false, - }, - { - name: "baseAmount", - type: "u64", - index: false, - }, - { - name: "quoteAmount", - type: "u64", - index: false, - }, - ], - }, - { - name: "CreateAmmEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "twapInitialObservation", - type: "u128", - index: false, - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - index: false, - }, - { - name: "lpMint", - type: "publicKey", - index: false, - }, - { - name: "baseMint", - type: "publicKey", - index: false, - }, - { - name: "quoteMint", - type: "publicKey", - index: false, - }, - { - name: "vaultAtaBase", - type: "publicKey", - index: false, - }, - { - name: "vaultAtaQuote", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "CrankThatTwapEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - ], - }, - ], - errors: [ - { - code: 6000, - name: "AssertFailed", - msg: "An assertion failed", - }, - { - code: 6001, - name: "NoSlotsPassed", - msg: "Can't get a TWAP before some observations have been stored", - }, - { - code: 6002, - name: "NoReserves", - msg: "Can't swap through a pool without token reserves on either side", - }, - { - code: 6003, - name: "InputAmountOverflow", - msg: "Input token amount is too large for a swap, causes overflow", - }, - { - code: 6004, - name: "AddLiquidityCalculationError", - msg: "Add liquidity calculation error", - }, - { - code: 6005, - name: "DecimalScaleError", - msg: "Error in decimal scale conversion", - }, - { - code: 6006, - name: "SameTokenMints", - msg: "You can't create an AMM pool where the token mints are the same", - }, - { - code: 6007, - name: "SwapSlippageExceeded", - msg: "A user wouldn't have gotten back their `output_amount_min`, reverting", - }, - { - code: 6008, - name: "InsufficientBalance", - msg: "The user had insufficient balance to do this", - }, - { - code: 6009, - name: "ZeroLiquidityRemove", - msg: "Must remove a non-zero amount of liquidity", - }, - { - code: 6010, - name: "ZeroLiquidityToAdd", - msg: "Cannot add liquidity with 0 tokens on either side", - }, - { - code: 6011, - name: "ZeroMinLpTokens", - msg: "Must specify a non-zero `min_lp_tokens` when adding to an existing pool", - }, - { - code: 6012, - name: "AddLiquiditySlippageExceeded", - msg: "LP wouldn't have gotten back `lp_token_min`", - }, - { - code: 6013, - name: "AddLiquidityMaxBaseExceeded", - msg: "LP would have spent more than `max_base_amount`", - }, - { - code: 6014, - name: "InsufficientQuoteAmount", - msg: "`quote_amount` must be greater than 100000000 when initializing a pool", - }, - { - code: 6015, - name: "ZeroSwapAmount", - msg: "Users must swap a non-zero amount", - }, - { - code: 6016, - name: "ConstantProductInvariantFailed", - msg: "K should always be increasing", - }, - { - code: 6017, - name: "CastingOverflow", - msg: "Casting has caused an overflow", - }, - ], -}; diff --git a/sdk/src/v0.7/types/index.ts b/sdk/src/v0.7/types/index.ts deleted file mode 100644 index 101f76110..000000000 --- a/sdk/src/v0.7/types/index.ts +++ /dev/null @@ -1,273 +0,0 @@ -import { Amm as AmmProgram, IDL as AmmIDL } from "./amm.js"; -export { AmmProgram, AmmIDL }; - -import { - LaunchpadV7 as LaunchpadProgram, - IDL as LaunchpadIDL, -} from "./launchpad_v7.js"; -export { LaunchpadProgram, LaunchpadIDL }; - -import { - ConditionalVault as ConditionalVaultProgram, - IDL as ConditionalVaultIDL, -} from "./conditional_vault.js"; -export { ConditionalVaultProgram, ConditionalVaultIDL }; - -import { Futarchy as FutarchyProgram, IDL as FutarchyIDL } from "./futarchy.js"; -export { FutarchyProgram, FutarchyIDL }; - -import { - PriceBasedPerformancePackage as PriceBasedPerformancePackageProgram, - IDL as PriceBasedPerformancePackageIDL, -} from "./price_based_performance_package.js"; -export { PriceBasedPerformancePackageProgram, PriceBasedPerformancePackageIDL }; - -import { BidWall as BidWallProgram, IDL as BidWallIDL } from "./bid_wall.js"; -export { BidWallProgram, BidWallIDL }; - -import { - MintGovernor as MintGovernorProgram, - IDL as MintGovernorIDL, -} from "./mint_governor.js"; -export { MintGovernorProgram, MintGovernorIDL }; - -import { - PerformancePackageV2 as PerformancePackageV2Program, - IDL as PerformancePackageV2IDL, -} from "./performance_package_v2.js"; -export { PerformancePackageV2Program, PerformancePackageV2IDL }; - -import { - Liquidation as LiquidationProgram, - IDL as LiquidationIDL, -} from "./liquidation.js"; -export { LiquidationProgram, LiquidationIDL }; - -export { LowercaseKeys } from "./utils.js"; - -import type { IdlAccounts, IdlTypes, IdlEvents } from "@coral-xyz/anchor"; - -export type Question = IdlAccounts["question"]; -export type ConditionalVault = - IdlAccounts["conditionalVault"]; - -export type InitializeDaoParams = - IdlTypes["InitializeDaoParams"]; -export type UpdateDaoParams = IdlTypes["UpdateDaoParams"]; -export type InitializePerformancePackageParams = - IdlTypes["InitializePerformancePackageParams"]; - -export type Dao = IdlAccounts["dao"]; -export type Proposal = IdlAccounts["proposal"]; -export type Amm = IdlAccounts["amm"]; -export type Launch = IdlAccounts["launch"]; -export type FundingRecord = IdlAccounts["fundingRecord"]; -export type PerformancePackage = - IdlAccounts["performancePackage"]; - -export type OracleConfig = - IdlTypes["OracleConfig"]; -export type Tranche = IdlTypes["Tranche"]; - -// export type OracleConfig = IdlTypes["OracleConfig"]; -// export type SharedLiquidityPool = -// IdlAccounts["sharedLiquidityPool"]; -// export type SharedLiquidityPoolPosition = -// IdlAccounts["liquidityPosition"]; - -export type BidWall = IdlAccounts["bidWall"]; - -export type MintGovernorAccount = - IdlAccounts["mintGovernor"]; -export type MintAuthorityAccount = - IdlAccounts["mintAuthority"]; - -export type PerformancePackageV2Account = - IdlAccounts["performancePackage"]; -export type PerformancePackageV2ChangeRequestAccount = - IdlAccounts["changeRequest"]; -export type PerformancePackageV2OracleReader = - IdlTypes["OracleReader"]; -export type PerformancePackageV2RewardFunction = - IdlTypes["RewardFunction"]; -export type PerformancePackageV2PackageStatus = - IdlTypes["PackageStatus"]; -export type PerformancePackageV2ThresholdTranche = - IdlTypes["ThresholdTranche"]; - -export type LiquidationAccount = IdlAccounts["liquidation"]; -export type RefundRecordAccount = - IdlAccounts["refundRecord"]; - -export type BidWallInitializedEvent = - IdlEvents["BidWallInitializedEvent"]; -export type BidWallTokensSoldEvent = - IdlEvents["BidWallTokensSoldEvent"]; -export type BidWallFeesCollectedEvent = - IdlEvents["BidWallFeesCollectedEvent"]; -export type BidWallClosedEvent = - IdlEvents["BidWallClosedEvent"]; -export type BidWallCanceledEvent = - IdlEvents["BidWallCanceledEvent"]; -export type BidWallEvent = - | BidWallInitializedEvent - | BidWallTokensSoldEvent - | BidWallFeesCollectedEvent - | BidWallClosedEvent - | BidWallCanceledEvent; - -export type SwapEvent = IdlEvents["SwapEvent"]; -export type AddLiquidityEvent = IdlEvents["AddLiquidityEvent"]; -export type RemoveLiquidityEvent = - IdlEvents["RemoveLiquidityEvent"]; -export type CreateAmmEvent = IdlEvents["CreateAmmEvent"]; -export type CrankThatTwapEvent = IdlEvents["CrankThatTwapEvent"]; -export type AmmEvent = - | SwapEvent - | AddLiquidityEvent - | RemoveLiquidityEvent - | CreateAmmEvent - | CrankThatTwapEvent; - -export type AddMetadataToConditionalTokensEvent = - IdlEvents["AddMetadataToConditionalTokensEvent"]; -export type InitializeConditionalVaultEvent = - IdlEvents["InitializeConditionalVaultEvent"]; -export type InitializeQuestionEvent = - IdlEvents["InitializeQuestionEvent"]; -export type MergeTokensEvent = - IdlEvents["MergeTokensEvent"]; -export type RedeemTokensEvent = - IdlEvents["RedeemTokensEvent"]; -export type ResolveQuestionEvent = - IdlEvents["ResolveQuestionEvent"]; -export type SplitTokensEvent = - IdlEvents["SplitTokensEvent"]; -export type ConditionalVaultEvent = - | AddMetadataToConditionalTokensEvent - | InitializeConditionalVaultEvent - | InitializeQuestionEvent - | MergeTokensEvent - | RedeemTokensEvent - | ResolveQuestionEvent - | SplitTokensEvent; - -export type LaunchClaimEvent = IdlEvents["LaunchClaimEvent"]; -export type LaunchCompletedEvent = - IdlEvents["LaunchCompletedEvent"]; -export type LaunchFundedEvent = - IdlEvents["LaunchFundedEvent"]; -export type LaunchInitializedEvent = - IdlEvents["LaunchInitializedEvent"]; -export type LaunchRefundedEvent = - IdlEvents["LaunchRefundedEvent"]; -export type LaunchStartedEvent = - IdlEvents["LaunchStartedEvent"]; -export type LaunchCloseEvent = IdlEvents["LaunchCloseEvent"]; -export type FundingRecordApprovalSetEvent = - IdlEvents["FundingRecordApprovalSetEvent"]; -export type LaunchClaimAdditionalTokenAllocationEvent = - IdlEvents["LaunchClaimAdditionalTokenAllocationEvent"]; -export type LaunchPerformancePackageInitializedEvent = - IdlEvents["LaunchPerformancePackageInitializedEvent"]; -export type LaunchpadEvent = - | LaunchClaimEvent - | LaunchCompletedEvent - | LaunchFundedEvent - | LaunchInitializedEvent - | LaunchRefundedEvent - | LaunchStartedEvent - | LaunchCloseEvent - | FundingRecordApprovalSetEvent - | LaunchClaimAdditionalTokenAllocationEvent - | LaunchPerformancePackageInitializedEvent; - -export type CollectFeesEvent = IdlEvents["CollectFeesEvent"]; -export type InitializeDaoEvent = - IdlEvents["InitializeDaoEvent"]; -export type UpdateDaoEvent = IdlEvents["UpdateDaoEvent"]; -export type InitializeProposalEvent = - IdlEvents["InitializeProposalEvent"]; -export type StakeToProposalEvent = - IdlEvents["StakeToProposalEvent"]; -export type UnstakeFromProposalEvent = - IdlEvents["UnstakeFromProposalEvent"]; -export type LaunchProposalEvent = - IdlEvents["LaunchProposalEvent"]; -export type FinalizeProposalEvent = - IdlEvents["FinalizeProposalEvent"]; -export type SpotSwapEvent = IdlEvents["SpotSwapEvent"]; -export type ConditionalSwapEvent = - IdlEvents["ConditionalSwapEvent"]; -export type ProvideLiquidityEvent = - IdlEvents["ProvideLiquidityEvent"]; -export type WithdrawLiquidityEvent = - IdlEvents["WithdrawLiquidityEvent"]; -export type SponsorProposalEvent = - IdlEvents["SponsorProposalEvent"]; -export type InitiateVaultSpendOptimisticProposalEvent = - IdlEvents["InitiateVaultSpendOptimisticProposalEvent"]; -export type FinalizeOptimisticProposalEvent = - IdlEvents["FinalizeOptimisticProposalEvent"]; -export type FutarchyEvent = - | CollectFeesEvent - | InitializeDaoEvent - | UpdateDaoEvent - | InitializeProposalEvent - | StakeToProposalEvent - | UnstakeFromProposalEvent - | LaunchProposalEvent - | FinalizeProposalEvent - | SpotSwapEvent - | ConditionalSwapEvent - | ProvideLiquidityEvent - | WithdrawLiquidityEvent - | SponsorProposalEvent - | InitiateVaultSpendOptimisticProposalEvent - | FinalizeOptimisticProposalEvent; - -export type PerformancePackageInitializedEvent = - IdlEvents["PerformancePackageInitialized"]; -export type UnlockStartedEvent = - IdlEvents["UnlockStarted"]; -export type UnlockCompletedEvent = - IdlEvents["UnlockCompleted"]; -export type ChangeProposedEvent = - IdlEvents["ChangeProposed"]; -export type ChangeExecutedEvent = - IdlEvents["ChangeExecuted"]; -export type PerformancePackageAuthorityChangedEvent = - IdlEvents["PerformancePackageAuthorityChanged"]; -export type PriceBasedPerformancePackageEvent = - | PerformancePackageInitializedEvent - | UnlockStartedEvent - | UnlockCompletedEvent - | ChangeProposedEvent - | ChangeExecutedEvent - | PerformancePackageAuthorityChangedEvent; - -export type MintGovernorInitializedEvent = - IdlEvents["MintGovernorInitializedEvent"]; -export type MintAuthorityTransferredEvent = - IdlEvents["MintAuthorityTransferredEvent"]; -export type MintAuthorityAddedEvent = - IdlEvents["MintAuthorityAddedEvent"]; -export type TokensMintedEvent = - IdlEvents["TokensMintedEvent"]; -export type MintAuthorityUpdatedEvent = - IdlEvents["MintAuthorityUpdatedEvent"]; -export type MintAuthorityRemovedEvent = - IdlEvents["MintAuthorityRemovedEvent"]; -export type MintGovernorAdminUpdatedEvent = - IdlEvents["MintGovernorAdminUpdatedEvent"]; -export type MintAuthorityReclaimedEvent = - IdlEvents["MintAuthorityReclaimedEvent"]; -export type MintGovernorEvent = - | MintGovernorInitializedEvent - | MintAuthorityTransferredEvent - | MintAuthorityAddedEvent - | TokensMintedEvent - | MintAuthorityUpdatedEvent - | MintAuthorityRemovedEvent - | MintGovernorAdminUpdatedEvent - | MintAuthorityReclaimedEvent; diff --git a/sdk/src/v0.7/types/optimistic_timelock.ts b/sdk/src/v0.7/types/optimistic_timelock.ts deleted file mode 100644 index fa1f43135..000000000 --- a/sdk/src/v0.7/types/optimistic_timelock.ts +++ /dev/null @@ -1,1023 +0,0 @@ -export type OptimisticTimelock = { - version: "0.3.0"; - name: "optimistic_timelock"; - instructions: [ - { - name: "createTimelock"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: false; - }, - { - name: "timelock"; - isMut: true; - isSigner: true; - }, - ]; - args: [ - { - name: "authority"; - type: "publicKey"; - }, - { - name: "delayInSlots"; - type: "u64"; - }, - { - name: "enqueuers"; - type: { - vec: "publicKey"; - }; - }, - { - name: "enqueuerCooldownSlots"; - type: "u64"; - }, - ]; - }, - { - name: "setDelayInSlots"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "delayInSlots"; - type: "u64"; - }, - ]; - }, - { - name: "setAuthority"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "authority"; - type: "publicKey"; - }, - ]; - }, - { - name: "setOptimisticProposerCooldownSlots"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "cooldownSlots"; - type: "u64"; - }, - ]; - }, - { - name: "addOptimisticProposer"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "enqueuer"; - type: "publicKey"; - }, - ]; - }, - { - name: "removeOptimisticProposer"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "optimisticProposer"; - type: "publicKey"; - }, - ]; - }, - { - name: "createTransactionBatch"; - accounts: [ - { - name: "transactionBatchAuthority"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: false; - isSigner: false; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: true; - }, - ]; - args: []; - }, - { - name: "addTransaction"; - accounts: [ - { - name: "transactionBatchAuthority"; - isMut: false; - isSigner: true; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: [ - { - name: "programId"; - type: "publicKey"; - }, - { - name: "accounts"; - type: { - vec: { - defined: "TransactionAccount"; - }; - }; - }, - { - name: "data"; - type: "bytes"; - }, - ]; - }, - { - name: "sealTransactionBatch"; - accounts: [ - { - name: "transactionBatchAuthority"; - isMut: false; - isSigner: true; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "enqueueTransactionBatch"; - accounts: [ - { - name: "authority"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "cancelTransactionBatch"; - accounts: [ - { - name: "authority"; - isMut: false; - isSigner: true; - }, - { - name: "timelock"; - isMut: true; - isSigner: false; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "executeTransactionBatch"; - accounts: [ - { - name: "timelockSigner"; - isMut: false; - isSigner: false; - }, - { - name: "timelock"; - isMut: false; - isSigner: false; - }, - { - name: "transactionBatch"; - isMut: true; - isSigner: false; - }, - ]; - args: []; - }, - ]; - accounts: [ - { - name: "timelock"; - type: { - kind: "struct"; - fields: [ - { - name: "authority"; - type: "publicKey"; - }, - { - name: "signerBump"; - type: "u8"; - }, - { - name: "delayInSlots"; - type: "u64"; - }, - { - name: "optimisticProposers"; - type: { - vec: { - defined: "OptimisticProposer"; - }; - }; - }, - { - name: "optimisticProposerCooldownSlots"; - docs: [ - "The cooldown period for enqueuers to prevent spamming the timelock.", - ]; - type: "u64"; - }, - ]; - }; - }, - { - name: "transactionBatch"; - type: { - kind: "struct"; - fields: [ - { - name: "status"; - type: { - defined: "TransactionBatchStatus"; - }; - }, - { - name: "transactions"; - type: { - vec: { - defined: "Transaction"; - }; - }; - }, - { - name: "timelock"; - type: "publicKey"; - }, - { - name: "enqueuedSlot"; - type: "u64"; - }, - { - name: "transactionBatchAuthority"; - type: "publicKey"; - }, - { - name: "enqueuerType"; - type: { - defined: "AuthorityType"; - }; - }, - ]; - }; - }, - ]; - types: [ - { - name: "OptimisticProposer"; - type: { - kind: "struct"; - fields: [ - { - name: "pubkey"; - type: "publicKey"; - }, - { - name: "lastSlotEnqueued"; - type: "u64"; - }, - ]; - }; - }, - { - name: "Transaction"; - type: { - kind: "struct"; - fields: [ - { - name: "programId"; - type: "publicKey"; - }, - { - name: "accounts"; - type: { - vec: { - defined: "TransactionAccount"; - }; - }; - }, - { - name: "data"; - type: "bytes"; - }, - { - name: "didExecute"; - type: "bool"; - }, - ]; - }; - }, - { - name: "TransactionAccount"; - type: { - kind: "struct"; - fields: [ - { - name: "pubkey"; - type: "publicKey"; - }, - { - name: "isSigner"; - type: "bool"; - }, - { - name: "isWritable"; - type: "bool"; - }, - ]; - }; - }, - { - name: "AuthorityType"; - type: { - kind: "enum"; - variants: [ - { - name: "OptimisticProposer"; - }, - { - name: "TimelockAuthority"; - }, - ]; - }; - }, - { - name: "TransactionBatchStatus"; - type: { - kind: "enum"; - variants: [ - { - name: "Created"; - }, - { - name: "Sealed"; - }, - { - name: "Enqueued"; - }, - { - name: "Cancelled"; - }, - { - name: "Executed"; - }, - ]; - }; - }, - ]; - errors: [ - { - code: 6000; - name: "NotReady"; - msg: "This transaction is not yet ready to be executed"; - }, - { - code: 6001; - name: "CannotAddTransactions"; - msg: "Can only add instructions when transaction batch status is `Created`"; - }, - { - code: 6002; - name: "CannotSealTransactionBatch"; - msg: "Can only seal the transaction batch when status is `Created`"; - }, - { - code: 6003; - name: "CannotEnqueueTransactionBatch"; - msg: "Can only enqueue the timelock running once the status is `Sealed`"; - }, - { - code: 6004; - name: "CannotCancelTimelock"; - msg: "Can only cancel the transactions if the status `Enqueued`"; - }, - { - code: 6005; - name: "CanOnlyCancelDuringTimelockPeriod"; - msg: "Can only cancel the transactions during the timelock period"; - }, - { - code: 6006; - name: "CannotExecuteTransactions"; - msg: "Can only execute the transactions if the status is `Enqueued`"; - }, - { - code: 6007; - name: "NoAuthority"; - msg: "The signer is neither the timelock authority nor an optimistic proposer"; - }, - { - code: 6008; - name: "InsufficientPermissions"; - msg: "Optimistic proposers can't cancel transaction batches enqueued by the timelock authority"; - }, - { - code: 6009; - name: "OptimisticProposerCooldown"; - msg: "This optimistic proposer is still in its cooldown period"; - }, - ]; -}; - -export const IDL: OptimisticTimelock = { - version: "0.3.0", - name: "optimistic_timelock", - instructions: [ - { - name: "createTimelock", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: false, - }, - { - name: "timelock", - isMut: true, - isSigner: true, - }, - ], - args: [ - { - name: "authority", - type: "publicKey", - }, - { - name: "delayInSlots", - type: "u64", - }, - { - name: "enqueuers", - type: { - vec: "publicKey", - }, - }, - { - name: "enqueuerCooldownSlots", - type: "u64", - }, - ], - }, - { - name: "setDelayInSlots", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "delayInSlots", - type: "u64", - }, - ], - }, - { - name: "setAuthority", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "authority", - type: "publicKey", - }, - ], - }, - { - name: "setOptimisticProposerCooldownSlots", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "cooldownSlots", - type: "u64", - }, - ], - }, - { - name: "addOptimisticProposer", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "enqueuer", - type: "publicKey", - }, - ], - }, - { - name: "removeOptimisticProposer", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "optimisticProposer", - type: "publicKey", - }, - ], - }, - { - name: "createTransactionBatch", - accounts: [ - { - name: "transactionBatchAuthority", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: false, - isSigner: false, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: true, - }, - ], - args: [], - }, - { - name: "addTransaction", - accounts: [ - { - name: "transactionBatchAuthority", - isMut: false, - isSigner: true, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "programId", - type: "publicKey", - }, - { - name: "accounts", - type: { - vec: { - defined: "TransactionAccount", - }, - }, - }, - { - name: "data", - type: "bytes", - }, - ], - }, - { - name: "sealTransactionBatch", - accounts: [ - { - name: "transactionBatchAuthority", - isMut: false, - isSigner: true, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - { - name: "enqueueTransactionBatch", - accounts: [ - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - { - name: "cancelTransactionBatch", - accounts: [ - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "timelock", - isMut: true, - isSigner: false, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - { - name: "executeTransactionBatch", - accounts: [ - { - name: "timelockSigner", - isMut: false, - isSigner: false, - }, - { - name: "timelock", - isMut: false, - isSigner: false, - }, - { - name: "transactionBatch", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "timelock", - type: { - kind: "struct", - fields: [ - { - name: "authority", - type: "publicKey", - }, - { - name: "signerBump", - type: "u8", - }, - { - name: "delayInSlots", - type: "u64", - }, - { - name: "optimisticProposers", - type: { - vec: { - defined: "OptimisticProposer", - }, - }, - }, - { - name: "optimisticProposerCooldownSlots", - docs: [ - "The cooldown period for enqueuers to prevent spamming the timelock.", - ], - type: "u64", - }, - ], - }, - }, - { - name: "transactionBatch", - type: { - kind: "struct", - fields: [ - { - name: "status", - type: { - defined: "TransactionBatchStatus", - }, - }, - { - name: "transactions", - type: { - vec: { - defined: "Transaction", - }, - }, - }, - { - name: "timelock", - type: "publicKey", - }, - { - name: "enqueuedSlot", - type: "u64", - }, - { - name: "transactionBatchAuthority", - type: "publicKey", - }, - { - name: "enqueuerType", - type: { - defined: "AuthorityType", - }, - }, - ], - }, - }, - ], - types: [ - { - name: "OptimisticProposer", - type: { - kind: "struct", - fields: [ - { - name: "pubkey", - type: "publicKey", - }, - { - name: "lastSlotEnqueued", - type: "u64", - }, - ], - }, - }, - { - name: "Transaction", - type: { - kind: "struct", - fields: [ - { - name: "programId", - type: "publicKey", - }, - { - name: "accounts", - type: { - vec: { - defined: "TransactionAccount", - }, - }, - }, - { - name: "data", - type: "bytes", - }, - { - name: "didExecute", - type: "bool", - }, - ], - }, - }, - { - name: "TransactionAccount", - type: { - kind: "struct", - fields: [ - { - name: "pubkey", - type: "publicKey", - }, - { - name: "isSigner", - type: "bool", - }, - { - name: "isWritable", - type: "bool", - }, - ], - }, - }, - { - name: "AuthorityType", - type: { - kind: "enum", - variants: [ - { - name: "OptimisticProposer", - }, - { - name: "TimelockAuthority", - }, - ], - }, - }, - { - name: "TransactionBatchStatus", - type: { - kind: "enum", - variants: [ - { - name: "Created", - }, - { - name: "Sealed", - }, - { - name: "Enqueued", - }, - { - name: "Cancelled", - }, - { - name: "Executed", - }, - ], - }, - }, - ], - errors: [ - { - code: 6000, - name: "NotReady", - msg: "This transaction is not yet ready to be executed", - }, - { - code: 6001, - name: "CannotAddTransactions", - msg: "Can only add instructions when transaction batch status is `Created`", - }, - { - code: 6002, - name: "CannotSealTransactionBatch", - msg: "Can only seal the transaction batch when status is `Created`", - }, - { - code: 6003, - name: "CannotEnqueueTransactionBatch", - msg: "Can only enqueue the timelock running once the status is `Sealed`", - }, - { - code: 6004, - name: "CannotCancelTimelock", - msg: "Can only cancel the transactions if the status `Enqueued`", - }, - { - code: 6005, - name: "CanOnlyCancelDuringTimelockPeriod", - msg: "Can only cancel the transactions during the timelock period", - }, - { - code: 6006, - name: "CannotExecuteTransactions", - msg: "Can only execute the transactions if the status is `Enqueued`", - }, - { - code: 6007, - name: "NoAuthority", - msg: "The signer is neither the timelock authority nor an optimistic proposer", - }, - { - code: 6008, - name: "InsufficientPermissions", - msg: "Optimistic proposers can't cancel transaction batches enqueued by the timelock authority", - }, - { - code: 6009, - name: "OptimisticProposerCooldown", - msg: "This optimistic proposer is still in its cooldown period", - }, - ], -}; diff --git a/sdk/src/v0.7/types/price_based_token_lock.ts b/sdk/src/v0.7/types/price_based_token_lock.ts deleted file mode 100644 index 3ac0813bb..000000000 --- a/sdk/src/v0.7/types/price_based_token_lock.ts +++ /dev/null @@ -1,887 +0,0 @@ -export type PriceBasedTokenLock = { - version: "0.1.0"; - name: "price_based_token_lock"; - constants: [ - { - name: "SEED"; - type: "string"; - value: '"anchor"'; - }, - ]; - instructions: [ - { - name: "initializeLocker"; - accounts: [ - { - name: "locker"; - isMut: true; - isSigner: false; - }, - { - name: "createKey"; - isMut: false; - isSigner: true; - docs: ["Used to derive the PDA"]; - }, - { - name: "tokenMint"; - isMut: false; - isSigner: false; - docs: ["The mint of the tokens to be locked"]; - }, - { - name: "fromTokenAccount"; - isMut: true; - isSigner: false; - docs: ["The token account containing the tokens to be locked"]; - }, - { - name: "tokenAuthority"; - isMut: false; - isSigner: true; - docs: ["The authority of the token account"]; - }, - { - name: "lockerTokenAccount"; - isMut: true; - isSigner: false; - docs: ["The locker's token account where tokens will be stored"]; - }, - { - name: "recipientTokenAccount"; - isMut: false; - isSigner: false; - docs: [ - "The recipient's token account where tokens will be sent when unlocked", - ]; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "InitializeLockerParams"; - }; - }, - ]; - }, - { - name: "startUnlock"; - accounts: [ - { - name: "locker"; - isMut: true; - isSigner: false; - }, - { - name: "oracleAccount"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "completeUnlock"; - accounts: [ - { - name: "locker"; - isMut: true; - isSigner: false; - }, - { - name: "oracleAccount"; - isMut: false; - isSigner: false; - }, - { - name: "lockerTokenAccount"; - isMut: true; - isSigner: false; - docs: ["The token account where locked tokens are stored"]; - }, - { - name: "recipientTokenAccount"; - isMut: true; - isSigner: false; - docs: ["The recipient's token account where tokens will be sent"]; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - ]; - accounts: [ - { - name: "locker"; - type: { - kind: "struct"; - fields: [ - { - name: "priceThreshold"; - docs: [ - "The price threshold that must be met for tokens to be unlocked", - ]; - type: "u128"; - }, - { - name: "tokenAmount"; - docs: ["The amount of tokens locked"]; - type: "u64"; - }, - { - name: "unlockTimestamp"; - docs: ["The timestamp when unlocking can begin"]; - type: "i64"; - }, - { - name: "oracleConfig"; - docs: ["Where to pull price data from"]; - type: { - defined: "OracleConfig"; - }; - }, - { - name: "twapLengthSeconds"; - docs: ["Length of time in seconds for TWAP calculation"]; - type: "u64"; - }, - { - name: "tokenRecipient"; - docs: ["The recipient of the tokens when unlocked"]; - type: "publicKey"; - }, - { - name: "state"; - docs: ["The current state of the locker"]; - type: { - defined: "LockerState"; - }; - }, - { - name: "createKey"; - docs: ["Used to derive the PDA"]; - type: "publicKey"; - }, - { - name: "pdaBump"; - docs: ["The PDA bump"]; - type: "u8"; - }, - ]; - }; - }, - ]; - types: [ - { - name: "InitializeLockerParams"; - type: { - kind: "struct"; - fields: [ - { - name: "priceThreshold"; - type: "u128"; - }, - { - name: "tokenAmount"; - type: "u64"; - }, - { - name: "unlockTimestamp"; - type: "i64"; - }, - { - name: "oracleConfig"; - type: { - defined: "OracleConfig"; - }; - }, - { - name: "twapLengthSeconds"; - type: "u64"; - }, - { - name: "tokenRecipient"; - type: "publicKey"; - }, - ]; - }; - }, - { - name: "OracleConfig"; - docs: [ - "Starting at `byte_offset` in `oracle_account`, this program expects to read:", - "- 16 bytes for the aggregator, stored as a little endian u128", - "- 8 bytes for the slot that the aggregator was last updated, stored as a", - "little endian u64", - "", - "The aggregator should be a weighted sum of prices, where the weight is the", - "number of seconds between prices. Here's an example:", - "- at second 0, the aggregator is 0", - "- at second 1, the price is 10 and the aggregator is 10 (10 * 1)", - "- at second 4, the price is 11 and 3 seconds have passed, so the aggregator is", - "10 + 11 * 3 = 43", - "", - "This allows our program to read a TWAP over a time period by reading the", - "aggregator value at the beginning and at the end, and dividing the difference", - "by the number of seconds between the two.", - ]; - type: { - kind: "struct"; - fields: [ - { - name: "oracleAccount"; - type: "publicKey"; - }, - { - name: "byteOffset"; - type: "u32"; - }, - ]; - }; - }, - { - name: "LockerState"; - type: { - kind: "enum"; - variants: [ - { - name: "Locked"; - }, - { - name: "Unlocking"; - fields: [ - { - name: "startAggregator"; - docs: ["The aggregator value when unlocking started"]; - type: "u128"; - }, - { - name: "startTimestamp"; - docs: ["The timestamp when unlocking started"]; - type: "i64"; - }, - ]; - }, - { - name: "Unlocked"; - }, - ]; - }; - }, - ]; - events: [ - { - name: "LockerInitialized"; - fields: [ - { - name: "locker"; - type: "publicKey"; - index: false; - }, - { - name: "priceThreshold"; - type: "u128"; - index: false; - }, - { - name: "tokenAmount"; - type: "u64"; - index: false; - }, - { - name: "unlockTimestamp"; - type: "i64"; - index: false; - }, - { - name: "oracleConfig"; - type: { - defined: "OracleConfig"; - }; - index: false; - }, - { - name: "tokenRecipient"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "UnlockStarted"; - fields: [ - { - name: "locker"; - type: "publicKey"; - index: false; - }, - { - name: "startAggregator"; - type: "u128"; - index: false; - }, - { - name: "startTimestamp"; - type: "i64"; - index: false; - }, - ]; - }, - { - name: "UnlockCompleted"; - fields: [ - { - name: "locker"; - type: "publicKey"; - index: false; - }, - { - name: "tokenAmount"; - type: "u64"; - index: false; - }, - { - name: "recipient"; - type: "publicKey"; - index: false; - }, - { - name: "twapPrice"; - type: "u128"; - index: false; - }, - { - name: "priceThreshold"; - type: "u128"; - index: false; - }, - ]; - }, - ]; - errors: [ - { - code: 6000; - name: "UnlockTimestampNotReached"; - msg: "Unlock timestamp has not been reached yet"; - }, - { - code: 6001; - name: "InvalidLockerState"; - msg: "Locker is not in the expected state"; - }, - { - code: 6002; - name: "TwapCalculationFailed"; - msg: "TWAP calculation failed"; - }, - { - code: 6003; - name: "PriceThresholdNotMet"; - msg: "Price threshold not met"; - }, - { - code: 6004; - name: "InvalidOracleData"; - msg: "Invalid oracle account data"; - }, - ]; -}; - -export const IDL: PriceBasedTokenLock = { - version: "0.1.0", - name: "price_based_token_lock", - constants: [ - { - name: "SEED", - type: "string", - value: '"anchor"', - }, - ], - instructions: [ - { - name: "initializeLocker", - accounts: [ - { - name: "locker", - isMut: true, - isSigner: false, - }, - { - name: "createKey", - isMut: false, - isSigner: true, - docs: ["Used to derive the PDA"], - }, - { - name: "tokenMint", - isMut: false, - isSigner: false, - docs: ["The mint of the tokens to be locked"], - }, - { - name: "fromTokenAccount", - isMut: true, - isSigner: false, - docs: ["The token account containing the tokens to be locked"], - }, - { - name: "tokenAuthority", - isMut: false, - isSigner: true, - docs: ["The authority of the token account"], - }, - { - name: "lockerTokenAccount", - isMut: true, - isSigner: false, - docs: ["The locker's token account where tokens will be stored"], - }, - { - name: "recipientTokenAccount", - isMut: false, - isSigner: false, - docs: [ - "The recipient's token account where tokens will be sent when unlocked", - ], - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "InitializeLockerParams", - }, - }, - ], - }, - { - name: "startUnlock", - accounts: [ - { - name: "locker", - isMut: true, - isSigner: false, - }, - { - name: "oracleAccount", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "completeUnlock", - accounts: [ - { - name: "locker", - isMut: true, - isSigner: false, - }, - { - name: "oracleAccount", - isMut: false, - isSigner: false, - }, - { - name: "lockerTokenAccount", - isMut: true, - isSigner: false, - docs: ["The token account where locked tokens are stored"], - }, - { - name: "recipientTokenAccount", - isMut: true, - isSigner: false, - docs: ["The recipient's token account where tokens will be sent"], - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "locker", - type: { - kind: "struct", - fields: [ - { - name: "priceThreshold", - docs: [ - "The price threshold that must be met for tokens to be unlocked", - ], - type: "u128", - }, - { - name: "tokenAmount", - docs: ["The amount of tokens locked"], - type: "u64", - }, - { - name: "unlockTimestamp", - docs: ["The timestamp when unlocking can begin"], - type: "i64", - }, - { - name: "oracleConfig", - docs: ["Where to pull price data from"], - type: { - defined: "OracleConfig", - }, - }, - { - name: "twapLengthSeconds", - docs: ["Length of time in seconds for TWAP calculation"], - type: "u64", - }, - { - name: "tokenRecipient", - docs: ["The recipient of the tokens when unlocked"], - type: "publicKey", - }, - { - name: "state", - docs: ["The current state of the locker"], - type: { - defined: "LockerState", - }, - }, - { - name: "createKey", - docs: ["Used to derive the PDA"], - type: "publicKey", - }, - { - name: "pdaBump", - docs: ["The PDA bump"], - type: "u8", - }, - ], - }, - }, - ], - types: [ - { - name: "InitializeLockerParams", - type: { - kind: "struct", - fields: [ - { - name: "priceThreshold", - type: "u128", - }, - { - name: "tokenAmount", - type: "u64", - }, - { - name: "unlockTimestamp", - type: "i64", - }, - { - name: "oracleConfig", - type: { - defined: "OracleConfig", - }, - }, - { - name: "twapLengthSeconds", - type: "u64", - }, - { - name: "tokenRecipient", - type: "publicKey", - }, - ], - }, - }, - { - name: "OracleConfig", - docs: [ - "Starting at `byte_offset` in `oracle_account`, this program expects to read:", - "- 16 bytes for the aggregator, stored as a little endian u128", - "- 8 bytes for the slot that the aggregator was last updated, stored as a", - "little endian u64", - "", - "The aggregator should be a weighted sum of prices, where the weight is the", - "number of seconds between prices. Here's an example:", - "- at second 0, the aggregator is 0", - "- at second 1, the price is 10 and the aggregator is 10 (10 * 1)", - "- at second 4, the price is 11 and 3 seconds have passed, so the aggregator is", - "10 + 11 * 3 = 43", - "", - "This allows our program to read a TWAP over a time period by reading the", - "aggregator value at the beginning and at the end, and dividing the difference", - "by the number of seconds between the two.", - ], - type: { - kind: "struct", - fields: [ - { - name: "oracleAccount", - type: "publicKey", - }, - { - name: "byteOffset", - type: "u32", - }, - ], - }, - }, - { - name: "LockerState", - type: { - kind: "enum", - variants: [ - { - name: "Locked", - }, - { - name: "Unlocking", - fields: [ - { - name: "startAggregator", - docs: ["The aggregator value when unlocking started"], - type: "u128", - }, - { - name: "startTimestamp", - docs: ["The timestamp when unlocking started"], - type: "i64", - }, - ], - }, - { - name: "Unlocked", - }, - ], - }, - }, - ], - events: [ - { - name: "LockerInitialized", - fields: [ - { - name: "locker", - type: "publicKey", - index: false, - }, - { - name: "priceThreshold", - type: "u128", - index: false, - }, - { - name: "tokenAmount", - type: "u64", - index: false, - }, - { - name: "unlockTimestamp", - type: "i64", - index: false, - }, - { - name: "oracleConfig", - type: { - defined: "OracleConfig", - }, - index: false, - }, - { - name: "tokenRecipient", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "UnlockStarted", - fields: [ - { - name: "locker", - type: "publicKey", - index: false, - }, - { - name: "startAggregator", - type: "u128", - index: false, - }, - { - name: "startTimestamp", - type: "i64", - index: false, - }, - ], - }, - { - name: "UnlockCompleted", - fields: [ - { - name: "locker", - type: "publicKey", - index: false, - }, - { - name: "tokenAmount", - type: "u64", - index: false, - }, - { - name: "recipient", - type: "publicKey", - index: false, - }, - { - name: "twapPrice", - type: "u128", - index: false, - }, - { - name: "priceThreshold", - type: "u128", - index: false, - }, - ], - }, - ], - errors: [ - { - code: 6000, - name: "UnlockTimestampNotReached", - msg: "Unlock timestamp has not been reached yet", - }, - { - code: 6001, - name: "InvalidLockerState", - msg: "Locker is not in the expected state", - }, - { - code: 6002, - name: "TwapCalculationFailed", - msg: "TWAP calculation failed", - }, - { - code: 6003, - name: "PriceThresholdNotMet", - msg: "Price threshold not met", - }, - { - code: 6004, - name: "InvalidOracleData", - msg: "Invalid oracle account data", - }, - ], -}; diff --git a/sdk/src/v0.7/types/price_based_unlock.ts b/sdk/src/v0.7/types/price_based_unlock.ts deleted file mode 100644 index bd6db4a3f..000000000 --- a/sdk/src/v0.7/types/price_based_unlock.ts +++ /dev/null @@ -1,1717 +0,0 @@ -export type PriceBasedUnlock = { - version: "0.1.0"; - name: "price_based_unlock"; - constants: [ - { - name: "SEED"; - type: "string"; - value: '"anchor"'; - }, - ]; - instructions: [ - { - name: "initializeLocker"; - accounts: [ - { - name: "locker"; - isMut: true; - isSigner: false; - }, - { - name: "createKey"; - isMut: false; - isSigner: true; - docs: ["Used to derive the PDA"]; - }, - { - name: "tokenMint"; - isMut: false; - isSigner: false; - docs: ["The mint of the tokens to be locked"]; - }, - { - name: "fromTokenAccount"; - isMut: true; - isSigner: false; - docs: ["The token account containing the tokens to be locked"]; - }, - { - name: "tokenAuthority"; - isMut: false; - isSigner: true; - docs: ["The authority of the token account"]; - }, - { - name: "lockerTokenAccount"; - isMut: true; - isSigner: false; - docs: ["The locker's token account where tokens will be stored"]; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "InitializeLockerParams"; - }; - }, - ]; - }, - { - name: "startUnlock"; - accounts: [ - { - name: "locker"; - isMut: true; - isSigner: false; - }, - { - name: "oracleAccount"; - isMut: false; - isSigner: false; - }, - { - name: "recipient"; - isMut: false; - isSigner: true; - docs: ["Only the token recipient can start unlock"]; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "completeUnlock"; - accounts: [ - { - name: "locker"; - isMut: true; - isSigner: false; - }, - { - name: "oracleAccount"; - isMut: false; - isSigner: false; - }, - { - name: "lockerTokenAccount"; - isMut: true; - isSigner: false; - docs: ["The token account where locked tokens are stored"]; - }, - { - name: "tokenMint"; - isMut: false; - isSigner: false; - docs: ["The token mint - validated via has_one constraint on locker"]; - }, - { - name: "recipientTokenAccount"; - isMut: true; - isSigner: false; - docs: [ - "The recipient's ATA where tokens will be sent - created if needed", - ]; - }, - { - name: "tokenRecipient"; - isMut: false; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - docs: ["Payer for creating the ATA if needed"]; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "proposeChange"; - accounts: [ - { - name: "changeRequest"; - isMut: true; - isSigner: false; - }, - { - name: "locker"; - isMut: true; - isSigner: false; - }, - { - name: "proposer"; - isMut: true; - isSigner: true; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "ProposeChangeParams"; - }; - }, - ]; - }, - { - name: "executeChange"; - accounts: [ - { - name: "changeRequest"; - isMut: true; - isSigner: false; - }, - { - name: "locker"; - isMut: true; - isSigner: false; - }, - { - name: "executor"; - isMut: true; - isSigner: true; - docs: [ - "The party executing the change (must be opposite of proposer)", - ]; - }, - ]; - args: []; - }, - { - name: "changeLockerAuthority"; - accounts: [ - { - name: "locker"; - isMut: true; - isSigner: false; - }, - { - name: "currentAuthority"; - isMut: false; - isSigner: true; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "ChangeLockerAuthorityParams"; - }; - }, - ]; - }, - ]; - accounts: [ - { - name: "locker"; - type: { - kind: "struct"; - fields: [ - { - name: "priceThreshold"; - docs: ["The price threshold for 100% unlocking (max price target)"]; - type: "u128"; - }, - { - name: "tokenAmount"; - docs: ["The amount of tokens locked"]; - type: "u64"; - }, - { - name: "tokensAlreadyUnlocked"; - docs: ["The amount of tokens already unlocked"]; - type: "u64"; - }, - { - name: "unlockTimestamp"; - docs: ["The timestamp when unlocking can begin"]; - type: "i64"; - }, - { - name: "oracleConfig"; - docs: ["Where to pull price data from"]; - type: { - defined: "OracleConfig"; - }; - }, - { - name: "twapLengthSeconds"; - docs: ["Length of time in seconds for TWAP calculation"]; - type: "u64"; - }, - { - name: "tokenRecipient"; - docs: ["The recipient of the tokens when unlocked"]; - type: "publicKey"; - }, - { - name: "state"; - docs: ["The current state of the locker"]; - type: { - defined: "LockerState"; - }; - }, - { - name: "createKey"; - docs: ["Used to derive the PDA"]; - type: "publicKey"; - }, - { - name: "pdaBump"; - docs: ["The PDA bump"]; - type: "u8"; - }, - { - name: "lockerAuthority"; - docs: ["The authorized locker authority that can execute changes"]; - type: "publicKey"; - }, - { - name: "tokenMint"; - docs: ["The mint of the locked tokens"]; - type: "publicKey"; - }, - ]; - }; - }, - { - name: "changeRequest"; - type: { - kind: "struct"; - fields: [ - { - name: "locker"; - docs: ["The locker this change applies to"]; - type: "publicKey"; - }, - { - name: "changeType"; - docs: ["What is being changed"]; - type: { - defined: "ChangeType"; - }; - }, - { - name: "proposedAt"; - docs: ["When the change was proposed"]; - type: "i64"; - }, - { - name: "previousState"; - docs: ["The locker state before the change was proposed"]; - type: { - defined: "LockerState"; - }; - }, - { - name: "proposer"; - docs: [ - "Who proposed this change (either token_recipient or locker_authority)", - ]; - type: "publicKey"; - }, - { - name: "pdaNonce"; - docs: ["Used to derive the PDA along with the proposer"]; - type: "u32"; - }, - { - name: "pdaBump"; - docs: ["The PDA bump"]; - type: "u8"; - }, - ]; - }; - }, - ]; - types: [ - { - name: "CommonFields"; - type: { - kind: "struct"; - fields: [ - { - name: "slot"; - type: "u64"; - }, - { - name: "unixTimestamp"; - type: "i64"; - }, - { - name: "lockerSeqNum"; - type: "u64"; - }, - ]; - }; - }, - { - name: "ChangeLockerAuthorityParams"; - type: { - kind: "struct"; - fields: [ - { - name: "newLockerAuthority"; - type: "publicKey"; - }, - ]; - }; - }, - { - name: "InitializeLockerParams"; - type: { - kind: "struct"; - fields: [ - { - name: "priceThreshold"; - type: "u128"; - }, - { - name: "tokenAmount"; - type: "u64"; - }, - { - name: "unlockTimestamp"; - type: "i64"; - }, - { - name: "oracleConfig"; - type: { - defined: "OracleConfig"; - }; - }, - { - name: "twapLengthSeconds"; - type: "u64"; - }, - { - name: "beneficiary"; - type: "publicKey"; - }, - { - name: "lockerAuthority"; - type: "publicKey"; - }, - ]; - }; - }, - { - name: "ProposeChangeParams"; - type: { - kind: "struct"; - fields: [ - { - name: "changeType"; - type: { - defined: "ChangeType"; - }; - }, - { - name: "pdaNonce"; - type: "u32"; - }, - ]; - }; - }, - { - name: "OracleConfig"; - docs: [ - "Starting at `byte_offset` in `oracle_account`, this program expects to read:", - "- 16 bytes for the aggregator, stored as a little endian u128", - "- 8 bytes for the slot that the aggregator was last updated, stored as a", - "little endian u64", - "", - "The aggregator should be a weighted sum of prices, where the weight is the", - "number of seconds between prices. Here's an example:", - "- at second 0, the aggregator is 0", - "- at second 1, the price is 10 and the aggregator is 10 (10 * 1)", - "- at second 4, the price is 11 and 3 seconds have passed, so the aggregator is", - "10 + 11 * 3 = 43", - "", - "This allows our program to read a TWAP over a time period by reading the", - "aggregator value at the beginning and at the end, and dividing the difference", - "by the number of seconds between the two.", - ]; - type: { - kind: "struct"; - fields: [ - { - name: "oracleAccount"; - type: "publicKey"; - }, - { - name: "byteOffset"; - type: "u32"; - }, - ]; - }; - }, - { - name: "LockerState"; - type: { - kind: "enum"; - variants: [ - { - name: "Locked"; - }, - { - name: "Unlocking"; - fields: [ - { - name: "startAggregator"; - docs: ["The aggregator value when unlocking started"]; - type: "u128"; - }, - { - name: "startTimestamp"; - docs: ["The timestamp when unlocking started"]; - type: "i64"; - }, - ]; - }, - { - name: "Unlocked"; - }, - ]; - }; - }, - { - name: "ChangeType"; - type: { - kind: "enum"; - variants: [ - { - name: "Oracle"; - fields: [ - { - name: "newOracleConfig"; - type: { - defined: "OracleConfig"; - }; - }, - ]; - }, - { - name: "Recipient"; - fields: [ - { - name: "newRecipient"; - type: "publicKey"; - }, - ]; - }, - ]; - }; - }, - ]; - events: [ - { - name: "LockerInitialized"; - fields: [ - { - name: "locker"; - type: "publicKey"; - index: false; - }, - { - name: "priceThreshold"; - type: "u128"; - index: false; - }, - { - name: "tokenAmount"; - type: "u64"; - index: false; - }, - { - name: "unlockTimestamp"; - type: "i64"; - index: false; - }, - { - name: "oracleConfig"; - type: { - defined: "OracleConfig"; - }; - index: false; - }, - { - name: "tokenRecipient"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "UnlockStarted"; - fields: [ - { - name: "locker"; - type: "publicKey"; - index: false; - }, - { - name: "startAggregator"; - type: "u128"; - index: false; - }, - { - name: "startTimestamp"; - type: "i64"; - index: false; - }, - ]; - }, - { - name: "UnlockCompleted"; - fields: [ - { - name: "locker"; - type: "publicKey"; - index: false; - }, - { - name: "tokenAmount"; - type: "u64"; - index: false; - }, - { - name: "recipient"; - type: "publicKey"; - index: false; - }, - { - name: "twapPrice"; - type: "u128"; - index: false; - }, - { - name: "priceThreshold"; - type: "u128"; - index: false; - }, - ]; - }, - { - name: "TokensClaimed"; - fields: [ - { - name: "locker"; - type: "publicKey"; - index: false; - }, - { - name: "recipient"; - type: "publicKey"; - index: false; - }, - { - name: "tokensClaimed"; - type: "u64"; - index: false; - }, - { - name: "tokensAlreadyUnlocked"; - type: "u64"; - index: false; - }, - { - name: "totalTokenAmount"; - type: "u64"; - index: false; - }, - { - name: "currentPrice"; - type: "u128"; - index: false; - }, - { - name: "unlockPercentage"; - type: "u128"; - index: false; - }, - ]; - }, - { - name: "ChangeProposed"; - fields: [ - { - name: "locker"; - type: "publicKey"; - index: false; - }, - { - name: "changeRequest"; - type: "publicKey"; - index: false; - }, - { - name: "proposer"; - type: "publicKey"; - index: false; - }, - { - name: "changeType"; - type: { - defined: "ChangeType"; - }; - index: false; - }, - { - name: "proposedAt"; - type: "i64"; - index: false; - }, - ]; - }, - { - name: "ChangeExecuted"; - fields: [ - { - name: "locker"; - type: "publicKey"; - index: false; - }, - { - name: "changeRequest"; - type: "publicKey"; - index: false; - }, - { - name: "executor"; - type: "publicKey"; - index: false; - }, - { - name: "changeType"; - type: { - defined: "ChangeType"; - }; - index: false; - }, - { - name: "executedAt"; - type: "i64"; - index: false; - }, - ]; - }, - { - name: "LockerAuthorityChanged"; - fields: [ - { - name: "locker"; - type: "publicKey"; - index: false; - }, - { - name: "oldAuthority"; - type: "publicKey"; - index: false; - }, - { - name: "newAuthority"; - type: "publicKey"; - index: false; - }, - { - name: "changedAt"; - type: "i64"; - index: false; - }, - ]; - }, - ]; - errors: [ - { - code: 6000; - name: "UnlockTimestampNotReached"; - msg: "Unlock timestamp has not been reached yet"; - }, - { - code: 6001; - name: "UnlockTimestampInThePast"; - msg: "Unlock timestamp must be in the future"; - }, - { - code: 6002; - name: "InvalidLockerState"; - msg: "Locker is not in the expected state"; - }, - { - code: 6003; - name: "TwapCalculationFailed"; - msg: "TWAP calculation failed"; - }, - { - code: 6004; - name: "PriceThresholdNotMet"; - msg: "Price threshold not met"; - }, - { - code: 6005; - name: "InvalidOracleData"; - msg: "Invalid oracle account data"; - }, - { - code: 6006; - name: "UnauthorizedChangeRequest"; - msg: "Unauthorized to create or execute change request"; - }, - { - code: 6007; - name: "InvalidChangeRequest"; - msg: "Change request does not match locker"; - }, - { - code: 6008; - name: "UnauthorizedLockerAuthority"; - msg: "Unauthorized locker authority"; - }, - { - code: 6009; - name: "InvariantViolated"; - msg: "An invariant was violated. You should get in contact with the MetaDAO team if you see this"; - }, - ]; -}; - -export const IDL: PriceBasedUnlock = { - version: "0.1.0", - name: "price_based_unlock", - constants: [ - { - name: "SEED", - type: "string", - value: '"anchor"', - }, - ], - instructions: [ - { - name: "initializeLocker", - accounts: [ - { - name: "locker", - isMut: true, - isSigner: false, - }, - { - name: "createKey", - isMut: false, - isSigner: true, - docs: ["Used to derive the PDA"], - }, - { - name: "tokenMint", - isMut: false, - isSigner: false, - docs: ["The mint of the tokens to be locked"], - }, - { - name: "fromTokenAccount", - isMut: true, - isSigner: false, - docs: ["The token account containing the tokens to be locked"], - }, - { - name: "tokenAuthority", - isMut: false, - isSigner: true, - docs: ["The authority of the token account"], - }, - { - name: "lockerTokenAccount", - isMut: true, - isSigner: false, - docs: ["The locker's token account where tokens will be stored"], - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "InitializeLockerParams", - }, - }, - ], - }, - { - name: "startUnlock", - accounts: [ - { - name: "locker", - isMut: true, - isSigner: false, - }, - { - name: "oracleAccount", - isMut: false, - isSigner: false, - }, - { - name: "recipient", - isMut: false, - isSigner: true, - docs: ["Only the token recipient can start unlock"], - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "completeUnlock", - accounts: [ - { - name: "locker", - isMut: true, - isSigner: false, - }, - { - name: "oracleAccount", - isMut: false, - isSigner: false, - }, - { - name: "lockerTokenAccount", - isMut: true, - isSigner: false, - docs: ["The token account where locked tokens are stored"], - }, - { - name: "tokenMint", - isMut: false, - isSigner: false, - docs: ["The token mint - validated via has_one constraint on locker"], - }, - { - name: "recipientTokenAccount", - isMut: true, - isSigner: false, - docs: [ - "The recipient's ATA where tokens will be sent - created if needed", - ], - }, - { - name: "tokenRecipient", - isMut: false, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - docs: ["Payer for creating the ATA if needed"], - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "proposeChange", - accounts: [ - { - name: "changeRequest", - isMut: true, - isSigner: false, - }, - { - name: "locker", - isMut: true, - isSigner: false, - }, - { - name: "proposer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "ProposeChangeParams", - }, - }, - ], - }, - { - name: "executeChange", - accounts: [ - { - name: "changeRequest", - isMut: true, - isSigner: false, - }, - { - name: "locker", - isMut: true, - isSigner: false, - }, - { - name: "executor", - isMut: true, - isSigner: true, - docs: [ - "The party executing the change (must be opposite of proposer)", - ], - }, - ], - args: [], - }, - { - name: "changeLockerAuthority", - accounts: [ - { - name: "locker", - isMut: true, - isSigner: false, - }, - { - name: "currentAuthority", - isMut: false, - isSigner: true, - }, - ], - args: [ - { - name: "params", - type: { - defined: "ChangeLockerAuthorityParams", - }, - }, - ], - }, - ], - accounts: [ - { - name: "locker", - type: { - kind: "struct", - fields: [ - { - name: "priceThreshold", - docs: ["The price threshold for 100% unlocking (max price target)"], - type: "u128", - }, - { - name: "tokenAmount", - docs: ["The amount of tokens locked"], - type: "u64", - }, - { - name: "tokensAlreadyUnlocked", - docs: ["The amount of tokens already unlocked"], - type: "u64", - }, - { - name: "unlockTimestamp", - docs: ["The timestamp when unlocking can begin"], - type: "i64", - }, - { - name: "oracleConfig", - docs: ["Where to pull price data from"], - type: { - defined: "OracleConfig", - }, - }, - { - name: "twapLengthSeconds", - docs: ["Length of time in seconds for TWAP calculation"], - type: "u64", - }, - { - name: "tokenRecipient", - docs: ["The recipient of the tokens when unlocked"], - type: "publicKey", - }, - { - name: "state", - docs: ["The current state of the locker"], - type: { - defined: "LockerState", - }, - }, - { - name: "createKey", - docs: ["Used to derive the PDA"], - type: "publicKey", - }, - { - name: "pdaBump", - docs: ["The PDA bump"], - type: "u8", - }, - { - name: "lockerAuthority", - docs: ["The authorized locker authority that can execute changes"], - type: "publicKey", - }, - { - name: "tokenMint", - docs: ["The mint of the locked tokens"], - type: "publicKey", - }, - ], - }, - }, - { - name: "changeRequest", - type: { - kind: "struct", - fields: [ - { - name: "locker", - docs: ["The locker this change applies to"], - type: "publicKey", - }, - { - name: "changeType", - docs: ["What is being changed"], - type: { - defined: "ChangeType", - }, - }, - { - name: "proposedAt", - docs: ["When the change was proposed"], - type: "i64", - }, - { - name: "previousState", - docs: ["The locker state before the change was proposed"], - type: { - defined: "LockerState", - }, - }, - { - name: "proposer", - docs: [ - "Who proposed this change (either token_recipient or locker_authority)", - ], - type: "publicKey", - }, - { - name: "pdaNonce", - docs: ["Used to derive the PDA along with the proposer"], - type: "u32", - }, - { - name: "pdaBump", - docs: ["The PDA bump"], - type: "u8", - }, - ], - }, - }, - ], - types: [ - { - name: "CommonFields", - type: { - kind: "struct", - fields: [ - { - name: "slot", - type: "u64", - }, - { - name: "unixTimestamp", - type: "i64", - }, - { - name: "lockerSeqNum", - type: "u64", - }, - ], - }, - }, - { - name: "ChangeLockerAuthorityParams", - type: { - kind: "struct", - fields: [ - { - name: "newLockerAuthority", - type: "publicKey", - }, - ], - }, - }, - { - name: "InitializeLockerParams", - type: { - kind: "struct", - fields: [ - { - name: "priceThreshold", - type: "u128", - }, - { - name: "tokenAmount", - type: "u64", - }, - { - name: "unlockTimestamp", - type: "i64", - }, - { - name: "oracleConfig", - type: { - defined: "OracleConfig", - }, - }, - { - name: "twapLengthSeconds", - type: "u64", - }, - { - name: "beneficiary", - type: "publicKey", - }, - { - name: "lockerAuthority", - type: "publicKey", - }, - ], - }, - }, - { - name: "ProposeChangeParams", - type: { - kind: "struct", - fields: [ - { - name: "changeType", - type: { - defined: "ChangeType", - }, - }, - { - name: "pdaNonce", - type: "u32", - }, - ], - }, - }, - { - name: "OracleConfig", - docs: [ - "Starting at `byte_offset` in `oracle_account`, this program expects to read:", - "- 16 bytes for the aggregator, stored as a little endian u128", - "- 8 bytes for the slot that the aggregator was last updated, stored as a", - "little endian u64", - "", - "The aggregator should be a weighted sum of prices, where the weight is the", - "number of seconds between prices. Here's an example:", - "- at second 0, the aggregator is 0", - "- at second 1, the price is 10 and the aggregator is 10 (10 * 1)", - "- at second 4, the price is 11 and 3 seconds have passed, so the aggregator is", - "10 + 11 * 3 = 43", - "", - "This allows our program to read a TWAP over a time period by reading the", - "aggregator value at the beginning and at the end, and dividing the difference", - "by the number of seconds between the two.", - ], - type: { - kind: "struct", - fields: [ - { - name: "oracleAccount", - type: "publicKey", - }, - { - name: "byteOffset", - type: "u32", - }, - ], - }, - }, - { - name: "LockerState", - type: { - kind: "enum", - variants: [ - { - name: "Locked", - }, - { - name: "Unlocking", - fields: [ - { - name: "startAggregator", - docs: ["The aggregator value when unlocking started"], - type: "u128", - }, - { - name: "startTimestamp", - docs: ["The timestamp when unlocking started"], - type: "i64", - }, - ], - }, - { - name: "Unlocked", - }, - ], - }, - }, - { - name: "ChangeType", - type: { - kind: "enum", - variants: [ - { - name: "Oracle", - fields: [ - { - name: "newOracleConfig", - type: { - defined: "OracleConfig", - }, - }, - ], - }, - { - name: "Recipient", - fields: [ - { - name: "newRecipient", - type: "publicKey", - }, - ], - }, - ], - }, - }, - ], - events: [ - { - name: "LockerInitialized", - fields: [ - { - name: "locker", - type: "publicKey", - index: false, - }, - { - name: "priceThreshold", - type: "u128", - index: false, - }, - { - name: "tokenAmount", - type: "u64", - index: false, - }, - { - name: "unlockTimestamp", - type: "i64", - index: false, - }, - { - name: "oracleConfig", - type: { - defined: "OracleConfig", - }, - index: false, - }, - { - name: "tokenRecipient", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "UnlockStarted", - fields: [ - { - name: "locker", - type: "publicKey", - index: false, - }, - { - name: "startAggregator", - type: "u128", - index: false, - }, - { - name: "startTimestamp", - type: "i64", - index: false, - }, - ], - }, - { - name: "UnlockCompleted", - fields: [ - { - name: "locker", - type: "publicKey", - index: false, - }, - { - name: "tokenAmount", - type: "u64", - index: false, - }, - { - name: "recipient", - type: "publicKey", - index: false, - }, - { - name: "twapPrice", - type: "u128", - index: false, - }, - { - name: "priceThreshold", - type: "u128", - index: false, - }, - ], - }, - { - name: "TokensClaimed", - fields: [ - { - name: "locker", - type: "publicKey", - index: false, - }, - { - name: "recipient", - type: "publicKey", - index: false, - }, - { - name: "tokensClaimed", - type: "u64", - index: false, - }, - { - name: "tokensAlreadyUnlocked", - type: "u64", - index: false, - }, - { - name: "totalTokenAmount", - type: "u64", - index: false, - }, - { - name: "currentPrice", - type: "u128", - index: false, - }, - { - name: "unlockPercentage", - type: "u128", - index: false, - }, - ], - }, - { - name: "ChangeProposed", - fields: [ - { - name: "locker", - type: "publicKey", - index: false, - }, - { - name: "changeRequest", - type: "publicKey", - index: false, - }, - { - name: "proposer", - type: "publicKey", - index: false, - }, - { - name: "changeType", - type: { - defined: "ChangeType", - }, - index: false, - }, - { - name: "proposedAt", - type: "i64", - index: false, - }, - ], - }, - { - name: "ChangeExecuted", - fields: [ - { - name: "locker", - type: "publicKey", - index: false, - }, - { - name: "changeRequest", - type: "publicKey", - index: false, - }, - { - name: "executor", - type: "publicKey", - index: false, - }, - { - name: "changeType", - type: { - defined: "ChangeType", - }, - index: false, - }, - { - name: "executedAt", - type: "i64", - index: false, - }, - ], - }, - { - name: "LockerAuthorityChanged", - fields: [ - { - name: "locker", - type: "publicKey", - index: false, - }, - { - name: "oldAuthority", - type: "publicKey", - index: false, - }, - { - name: "newAuthority", - type: "publicKey", - index: false, - }, - { - name: "changedAt", - type: "i64", - index: false, - }, - ], - }, - ], - errors: [ - { - code: 6000, - name: "UnlockTimestampNotReached", - msg: "Unlock timestamp has not been reached yet", - }, - { - code: 6001, - name: "UnlockTimestampInThePast", - msg: "Unlock timestamp must be in the future", - }, - { - code: 6002, - name: "InvalidLockerState", - msg: "Locker is not in the expected state", - }, - { - code: 6003, - name: "TwapCalculationFailed", - msg: "TWAP calculation failed", - }, - { - code: 6004, - name: "PriceThresholdNotMet", - msg: "Price threshold not met", - }, - { - code: 6005, - name: "InvalidOracleData", - msg: "Invalid oracle account data", - }, - { - code: 6006, - name: "UnauthorizedChangeRequest", - msg: "Unauthorized to create or execute change request", - }, - { - code: 6007, - name: "InvalidChangeRequest", - msg: "Change request does not match locker", - }, - { - code: 6008, - name: "UnauthorizedLockerAuthority", - msg: "Unauthorized locker authority", - }, - { - code: 6009, - name: "InvariantViolated", - msg: "An invariant was violated. You should get in contact with the MetaDAO team if you see this", - }, - ], -}; diff --git a/sdk/src/v0.7/types/shared_liquidity_manager.ts b/sdk/src/v0.7/types/shared_liquidity_manager.ts deleted file mode 100644 index 124942da9..000000000 --- a/sdk/src/v0.7/types/shared_liquidity_manager.ts +++ /dev/null @@ -1,177 +0,0 @@ -export type SharedLiquidityManager = { - version: "0.1.0"; - name: "shared_liquidity_manager"; - docs: ["TODO:", "- add unstake", "- add unit tests"]; - instructions: []; - errors: [ - { - code: 6000; - name: "InsufficientStake"; - msg: "Insufficient stake amount"; - }, - { - code: 6001; - name: "ProposalNotFinalized"; - msg: "Proposal is not finalized"; - }, - { - code: 6002; - name: "NoLpTokensToRemove"; - msg: "No LP tokens to remove from AMM"; - }, - { - code: 6003; - name: "NoTokensFromAmm"; - msg: "No tokens received from AMM removal"; - }, - { - code: 6004; - name: "InsufficientReservesReturned"; - msg: "Insufficient reserves returned to spot AMM (less than 99.5%)"; - }, - { - code: 6005; - name: "PoolInUse"; - msg: "Pool is currently being used by an active proposal"; - }, - { - code: 6006; - name: "InsufficientLpShares"; - msg: "User does not have enough LP shares to withdraw"; - }, - { - code: 6007; - name: "SlippageExceeded"; - msg: "Slippage exceeded minimum token amounts"; - }, - { - code: 6008; - name: "NoLpTokensInPool"; - msg: "No LP tokens in pool's LP token account"; - }, - { - code: 6009; - name: "NotEnoughLpTokens"; - msg: "Not enough LP tokens to provide liquidity to proposal"; - }, - { - code: 6010; - name: "InsufficientFunds"; - msg: "Insufficient funds"; - }, - { - code: 6011; - name: "NoActiveProposal"; - msg: "No active proposal"; - }, - { - code: 6012; - name: "ProposalNotInDraftStatus"; - msg: "Proposal is not in draft status"; - }, - { - code: 6013; - name: "ProposalAlreadyActive"; - msg: "Proposal already active"; - }, - { - code: 6014; - name: "AmmAlreadyHasLiquidity"; - msg: "AMM already has liquidity"; - }, - { - code: 6015; - name: "QuestionAlreadyResolved"; - msg: "Question already resolved"; - }, - ]; -}; - -export const IDL: SharedLiquidityManager = { - version: "0.1.0", - name: "shared_liquidity_manager", - docs: ["TODO:", "- add unstake", "- add unit tests"], - instructions: [], - errors: [ - { - code: 6000, - name: "InsufficientStake", - msg: "Insufficient stake amount", - }, - { - code: 6001, - name: "ProposalNotFinalized", - msg: "Proposal is not finalized", - }, - { - code: 6002, - name: "NoLpTokensToRemove", - msg: "No LP tokens to remove from AMM", - }, - { - code: 6003, - name: "NoTokensFromAmm", - msg: "No tokens received from AMM removal", - }, - { - code: 6004, - name: "InsufficientReservesReturned", - msg: "Insufficient reserves returned to spot AMM (less than 99.5%)", - }, - { - code: 6005, - name: "PoolInUse", - msg: "Pool is currently being used by an active proposal", - }, - { - code: 6006, - name: "InsufficientLpShares", - msg: "User does not have enough LP shares to withdraw", - }, - { - code: 6007, - name: "SlippageExceeded", - msg: "Slippage exceeded minimum token amounts", - }, - { - code: 6008, - name: "NoLpTokensInPool", - msg: "No LP tokens in pool's LP token account", - }, - { - code: 6009, - name: "NotEnoughLpTokens", - msg: "Not enough LP tokens to provide liquidity to proposal", - }, - { - code: 6010, - name: "InsufficientFunds", - msg: "Insufficient funds", - }, - { - code: 6011, - name: "NoActiveProposal", - msg: "No active proposal", - }, - { - code: 6012, - name: "ProposalNotInDraftStatus", - msg: "Proposal is not in draft status", - }, - { - code: 6013, - name: "ProposalAlreadyActive", - msg: "Proposal already active", - }, - { - code: 6014, - name: "AmmAlreadyHasLiquidity", - msg: "AMM already has liquidity", - }, - { - code: 6015, - name: "QuestionAlreadyResolved", - msg: "Question already resolved", - }, - ], -}; diff --git a/sdk/src/v0.7/types/utils.ts b/sdk/src/v0.7/types/utils.ts deleted file mode 100644 index c878debe7..000000000 --- a/sdk/src/v0.7/types/utils.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type LowercaseKeys = { - [K in keyof T as Lowercase]: T[K]; -}; diff --git a/sdk/src/v0.7/utils/cu.ts b/sdk/src/v0.7/utils/cu.ts deleted file mode 100644 index b55cbac95..000000000 --- a/sdk/src/v0.7/utils/cu.ts +++ /dev/null @@ -1,11 +0,0 @@ -export const MaxCUs = { - initializeDao: 40_000, - createIdempotent: 25_000, - initializeConditionalVault: 45_000, - mintConditionalTokens: 35_000, - initializeAmm: 120_000, - addLiquidity: 120_000, - initializeProposal: 60_000, -}; - -export const DEFAULT_CU_PRICE = 1; diff --git a/sdk/src/v0.7/utils/filters.ts b/sdk/src/v0.7/utils/filters.ts deleted file mode 100644 index aee93f618..000000000 --- a/sdk/src/v0.7/utils/filters.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { GetProgramAccountsFilter, PublicKey } from "@solana/web3.js"; - -export const filterPositionsByUser = ( - userAddr: PublicKey, -): GetProgramAccountsFilter => ({ - memcmp: { - offset: 8, // discriminator - bytes: userAddr.toBase58(), - }, -}); - -export const filterPositionsByAmm = ( - ammAddr: PublicKey, -): GetProgramAccountsFilter => ({ - memcmp: { - offset: - 8 + // discriminator - 32, // user address - bytes: ammAddr.toBase58(), - }, -}); diff --git a/sdk/src/v0.7/utils/index.ts b/sdk/src/v0.7/utils/index.ts deleted file mode 100644 index ee7438b0a..000000000 --- a/sdk/src/v0.7/utils/index.ts +++ /dev/null @@ -1,40 +0,0 @@ -export * from "./filters.js"; -export * from "./pda.js"; -export * from "./priceMath.js"; -export * from "./metadata.js"; -export * from "./cu.js"; -export * from "./instruction.js"; - -import { AccountMeta, ComputeBudgetProgram, PublicKey } from "@solana/web3.js"; - -export enum PriorityFeeTier { - NORMAL = 35, - HIGH = 3571, - TURBO = 357142, -} - -export const addComputeUnits = (num_units: number = 1_400_000) => - ComputeBudgetProgram.setComputeUnitLimit({ - units: num_units, - }); - -export const addPriorityFee = (pf: number) => - ComputeBudgetProgram.setComputeUnitPrice({ - microLamports: pf, - }); - -export const pubkeyToAccountInfo = ( - pubkey: PublicKey, - isWritable: boolean, - isSigner = false, -): AccountMeta => { - return { - pubkey: pubkey, - isSigner: isSigner, - isWritable: isWritable, - }; -}; - -export async function sleep(ms: number) { - return new Promise((resolve) => setTimeout(resolve, ms)); -} diff --git a/sdk/src/v0.7/utils/instruction.ts b/sdk/src/v0.7/utils/instruction.ts deleted file mode 100644 index f18e48834..000000000 --- a/sdk/src/v0.7/utils/instruction.ts +++ /dev/null @@ -1,16 +0,0 @@ -import * as anchor from "@coral-xyz/anchor"; -import { TransactionInstruction } from "@solana/web3.js"; - -export class InstructionUtils { - public static async getInstructions( - ...methodBuilders: any[] - ): Promise { - let instructions: TransactionInstruction[] = []; - - for (const methodBuilder of methodBuilders) { - instructions.push(...(await methodBuilder.transaction()).instructions); - } - - return instructions; - } -} diff --git a/sdk/src/v0.7/utils/metadata.ts b/sdk/src/v0.7/utils/metadata.ts deleted file mode 100644 index ef17bbdb8..000000000 --- a/sdk/src/v0.7/utils/metadata.ts +++ /dev/null @@ -1,35 +0,0 @@ -import BN from "bn.js"; -import { createUmi } from "@metaplex-foundation/umi-bundle-defaults"; -import { Connection } from "@solana/web3.js"; -import { bundlrUploader } from "@metaplex-foundation/umi-uploader-bundlr"; -import { UmiPlugin } from "@metaplex-foundation/umi"; - -export const assetImageMap: Record = { - fMETA: "https://arweave.net/tGxvOjMZw7B0qHsdCcIMO57oH5g5OaItOZdXo3BXKz8", - fUSDC: "https://arweave.net/DpvxeAyVbaoivhIVCLjdf566k2SwVn0YVBL0sTOezWk", - pMETA: "https://arweave.net/iuqi7PRRESdDxj1oRyk2WzR90_zdFcmZsuWicv3XGfs", - pUSDC: "https://arweave.net/e4IO7F59F_RKCiuB--_ABPot7Qh1yFsGkWzVhcXuKDU", -}; - -// Upload some JSON, returning its URL -export const uploadConditionalTokenMetadataJson = async ( - connection: Connection, - identityPlugin: UmiPlugin, - proposalNumber: number, - symbol: string, - // proposal: BN, - // conditionalToken: string, - // image: string -): Promise => { - // use bundlr, targeting arweave - const umi = createUmi(connection); - umi.use(bundlrUploader()); - umi.use(identityPlugin); - - return umi.uploader.uploadJson({ - name: `Proposal ${proposalNumber}: ${symbol}`, - image: assetImageMap[symbol], - symbol, - description: "A conditional token for use in futarchy.", - }); -}; diff --git a/sdk/src/v0.7/utils/pda.ts b/sdk/src/v0.7/utils/pda.ts deleted file mode 100644 index 24f746632..000000000 --- a/sdk/src/v0.7/utils/pda.ts +++ /dev/null @@ -1,375 +0,0 @@ -import { AccountMeta, PublicKey } from "@solana/web3.js"; -import { utils } from "@coral-xyz/anchor"; -import { - ASSOCIATED_TOKEN_PROGRAM_ID, - TOKEN_PROGRAM_ID, -} from "@solana/spl-token"; -import BN from "bn.js"; -import { - fromWeb3JsPublicKey, - toWeb3JsPublicKey, -} from "@metaplex-foundation/umi-web3js-adapters"; -import { - DEVNET_RAYDIUM_CP_SWAP_PROGRAM_ID, - MPL_TOKEN_METADATA_PROGRAM_ID, - PRICE_BASED_PERFORMANCE_PACKAGE_PROGRAM_ID, - PERFORMANCE_PACKAGE_V2_PROGRAM_ID, - RAYDIUM_CP_SWAP_PROGRAM_ID, - SHARED_LIQUIDITY_MANAGER_PROGRAM_ID, - LAUNCHPAD_PROGRAM_ID, - FUTARCHY_PROGRAM_ID, - BID_WALL_PROGRAM_ID, - MINT_GOVERNOR_PROGRAM_ID, - LIQUIDATION_PROGRAM_ID, -} from "../constants.js"; - -export const getEventAuthorityAddr = (programId: PublicKey) => { - return PublicKey.findProgramAddressSync( - [Buffer.from("__event_authority")], - programId, - ); -}; - -export const getQuestionAddr = ( - programId: PublicKey, - questionId: Uint8Array, - oracle: PublicKey, - numOutcomes: number, -) => { - if (questionId.length != 32) { - throw new Error("questionId must be 32 bytes"); - } - - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("question"), - Buffer.from(questionId), - oracle.toBuffer(), - new BN(numOutcomes).toArrayLike(Buffer, "le", 1), - ], - programId, - ); -}; - -export const getVaultAddr = ( - programId: PublicKey, - question: PublicKey, - underlyingTokenMint: PublicKey, -) => { - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("conditional_vault"), - question.toBuffer(), - underlyingTokenMint.toBuffer(), - ], - programId, - ); -}; - -export const getConditionalTokenMintAddr = ( - programId: PublicKey, - vault: PublicKey, - index: number, -) => { - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("conditional_token"), - vault.toBuffer(), - new BN(index).toArrayLike(Buffer, "le", 1), - ], - programId, - ); -}; - -export const getDownAndUpMintAddrs = ( - programId: PublicKey, - vault: PublicKey, -): { down: PublicKey; up: PublicKey } => { - return { - down: getConditionalTokenMintAddr(programId, vault, 0)[0], - up: getConditionalTokenMintAddr(programId, vault, 1)[0], - }; -}; - -export const getFailAndPassMintAddrs = ( - programId: PublicKey, - vault: PublicKey, -): { fail: PublicKey; pass: PublicKey } => { - return { - fail: getConditionalTokenMintAddr(programId, vault, 0)[0], - pass: getConditionalTokenMintAddr(programId, vault, 1)[0], - }; -}; - -export const getMetadataAddr = (mint: PublicKey) => { - return PublicKey.findProgramAddressSync( - [ - utils.bytes.utf8.encode("metadata"), - MPL_TOKEN_METADATA_PROGRAM_ID.toBuffer(), - mint.toBuffer(), - ], - MPL_TOKEN_METADATA_PROGRAM_ID, - ); -}; - -export const getDaoAddr = ({ - nonce, - daoCreator, - programId = FUTARCHY_PROGRAM_ID, -}: { - nonce: BN; - daoCreator: PublicKey; - programId?: PublicKey; -}): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [ - Buffer.from("dao"), - daoCreator.toBuffer(), - nonce.toArrayLike(Buffer, "le", 8), - ], - programId, - ); -}; - -/** - * @deprecated Use getAutocratProposalAddr instead - */ -export const getProposalAddr = ( - programId: PublicKey, - squadsProposal: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [utils.bytes.utf8.encode("proposal"), squadsProposal.toBuffer()], - programId, - ); -}; - -export const getProposalAddrV2 = ({ - programId = FUTARCHY_PROGRAM_ID, - squadsProposal, -}: { - programId?: PublicKey; - squadsProposal: PublicKey; -}): [PublicKey, number] => { - return getProposalAddr(programId, squadsProposal); -}; - -export function getLaunchAddr( - programId: PublicKey = LAUNCHPAD_PROGRAM_ID, - tokenMint: PublicKey, -): [PublicKey, number] { - return PublicKey.findProgramAddressSync( - [Buffer.from("launch"), tokenMint.toBuffer()], - programId, - ); -} - -export const getLaunchSignerAddr = ( - programId: PublicKey = LAUNCHPAD_PROGRAM_ID, - launch: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [Buffer.from("launch_signer"), launch.toBuffer()], - programId, - ); -}; - -export const getFundingRecordAddr = ( - programId: PublicKey = LAUNCHPAD_PROGRAM_ID, - launch: PublicKey, - funder: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [Buffer.from("funding_record"), launch.toBuffer(), funder.toBuffer()], - programId, - ); -}; - -export const getStakeRecordAddr = ( - programId: PublicKey = SHARED_LIQUIDITY_MANAGER_PROGRAM_ID, - draftProposal: PublicKey, - staker: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [Buffer.from("stake_record"), draftProposal.toBuffer(), staker.toBuffer()], - programId, - ); -}; - -export const getStakeAddr = ( - programId: PublicKey = FUTARCHY_PROGRAM_ID, - draftProposal: PublicKey, - staker: PublicKey, -): [PublicKey, number] => { - return PublicKey.findProgramAddressSync( - [Buffer.from("stake"), draftProposal.toBuffer(), staker.toBuffer()], - programId, - ); -}; - -export const getPerformancePackageAddr = ({ - programId = PRICE_BASED_PERFORMANCE_PACKAGE_PROGRAM_ID, - createKey, -}: { - programId?: PublicKey; - createKey: PublicKey; -}) => { - return PublicKey.findProgramAddressSync( - [Buffer.from("performance_package"), createKey.toBuffer()], - programId, - ); -}; - -export const getChangeRequestAddr = ({ - programId = PRICE_BASED_PERFORMANCE_PACKAGE_PROGRAM_ID, - performancePackage, - proposer, - pdaNonce, -}: { - programId?: PublicKey; - performancePackage: PublicKey; - proposer: PublicKey; - pdaNonce: number; -}) => { - return PublicKey.findProgramAddressSync( - [ - Buffer.from("change_request"), - performancePackage.toBuffer(), - proposer.toBuffer(), - Buffer.from(new Uint8Array(new Uint32Array([pdaNonce]).buffer)), - ], - programId, - ); -}; - -export const getBidWallAddr = ({ - programId = BID_WALL_PROGRAM_ID, - baseMint, - creator, - nonce, -}: { - programId?: PublicKey; - baseMint: PublicKey; - creator: PublicKey; - nonce: BN; -}) => { - return PublicKey.findProgramAddressSync( - [ - Buffer.from("bid_wall"), - baseMint.toBuffer(), - creator.toBuffer(), - nonce.toArrayLike(Buffer, "le", 8), - ], - programId, - ); -}; - -export const getMintGovernorAddr = ({ - programId = MINT_GOVERNOR_PROGRAM_ID, - mint, - createKey, -}: { - programId?: PublicKey; - mint: PublicKey; - createKey: PublicKey; -}) => { - return PublicKey.findProgramAddressSync( - [Buffer.from("mint_governor"), mint.toBuffer(), createKey.toBuffer()], - programId, - ); -}; - -export const getMintAuthorityAddr = ({ - programId = MINT_GOVERNOR_PROGRAM_ID, - mintGovernor, - authorizedMinter, -}: { - programId?: PublicKey; - mintGovernor: PublicKey; - authorizedMinter: PublicKey; -}) => { - return PublicKey.findProgramAddressSync( - [ - Buffer.from("mint_authority"), - mintGovernor.toBuffer(), - authorizedMinter.toBuffer(), - ], - programId, - ); -}; - -export const getPerformancePackageV2Addr = ({ - programId = PERFORMANCE_PACKAGE_V2_PROGRAM_ID, - createKey, -}: { - programId?: PublicKey; - createKey: PublicKey; -}) => { - return PublicKey.findProgramAddressSync( - [Buffer.from("performance_package"), createKey.toBuffer()], - programId, - ); -}; - -export const getChangeRequestV2Addr = ({ - programId = PERFORMANCE_PACKAGE_V2_PROGRAM_ID, - performancePackage, - proposer, - pdaNonce, -}: { - programId?: PublicKey; - performancePackage: PublicKey; - proposer: PublicKey; - pdaNonce: number; -}) => { - return PublicKey.findProgramAddressSync( - [ - Buffer.from("change_request"), - performancePackage.toBuffer(), - proposer.toBuffer(), - Buffer.from(new Uint8Array(new Uint32Array([pdaNonce]).buffer)), - ], - programId, - ); -}; - -export const getLiquidationAddr = ({ - programId = LIQUIDATION_PROGRAM_ID, - baseMint, - quoteMint, - createKey, -}: { - programId?: PublicKey; - baseMint: PublicKey; - quoteMint: PublicKey; - createKey: PublicKey; -}) => { - return PublicKey.findProgramAddressSync( - [ - Buffer.from("liquidation"), - baseMint.toBuffer(), - quoteMint.toBuffer(), - createKey.toBuffer(), - ], - programId, - ); -}; - -export const getRefundRecordAddr = ({ - programId = LIQUIDATION_PROGRAM_ID, - liquidation, - recipient, -}: { - programId?: PublicKey; - liquidation: PublicKey; - recipient: PublicKey; -}) => { - return PublicKey.findProgramAddressSync( - [ - Buffer.from("refund_record"), - liquidation.toBuffer(), - recipient.toBuffer(), - ], - programId, - ); -}; diff --git a/sdk/src/v0.7/utils/priceMath.ts b/sdk/src/v0.7/utils/priceMath.ts deleted file mode 100644 index 4e7addb3c..000000000 --- a/sdk/src/v0.7/utils/priceMath.ts +++ /dev/null @@ -1,197 +0,0 @@ -import BN from "bn.js"; -import { Amm } from "../types/index.js"; -import { AmmMath as V3AmmMath } from "../../v0.3/utils/ammMath.js"; - -const BN_TEN = new BN(10); -const PRICE_SCALE = BN_TEN.pow(new BN(12)); -const PRICE_SCALE_NUMBER = 1e12; - -export type AddLiquiditySimulation = { - baseAmount: BN; - quoteAmount: BN; - expectedLpTokens: BN; - minLpTokens?: BN; - maxBaseAmount?: BN; -}; - -export type SwapSimulation = { - expectedOut: BN; - newBaseReserves: BN; - newQuoteReserves: BN; - minExpectedOut?: BN; -}; - -export type RemoveLiquiditySimulation = { - expectedBaseOut: BN; - expectedQuoteOut: BN; - minBaseOut?: BN; - minQuoteOut?: BN; -}; - -export class AmmMath { - // Re-export common methods from v0.3 - public static getHumanPriceFromReserves = V3AmmMath.getHumanPriceFromReserves; - public static getAmmPriceFromReserves = V3AmmMath.getAmmPriceFromReserves; - public static getChainAmount = V3AmmMath.getChainAmount; - public static getHumanAmount = V3AmmMath.getHumanAmount; - public static getAmmPrice = V3AmmMath.getAmmPrice; - public static getAmmPrices = V3AmmMath.getAmmPrices; - public static scale = V3AmmMath.scale; - public static addSlippage = V3AmmMath.addSlippage; - public static subtractSlippage = V3AmmMath.subtractSlippage; - public static simulateAddLiquidity = V3AmmMath.simulateAddLiquidity; - public static simulateRemoveLiquidity = V3AmmMath.simulateRemoveLiquidity; - - public static getHumanPrice( - ammPrice: BN, - baseDecimals: number, - quoteDecimals: number, - ): number { - const decimalScalar = BN_TEN.pow( - new BN(quoteDecimals - baseDecimals).abs(), - ); - const price1e12 = - quoteDecimals > baseDecimals - ? ammPrice.div(decimalScalar) - : ammPrice.mul(decimalScalar); - - // in case the BN is too large to cast to number, we try - try { - return price1e12.toNumber() / 1e12; - } catch (e) { - // BN tried to cast into number larger than 53 bits so we we do division via BN methods first, then cast to number(so it is smaller before the cast) - return price1e12.div(new BN(1e12)).toNumber(); - } - } - - public static getTwap(amm: Amm): BN { - return amm.oracle.aggregator.div( - amm.oracle.lastUpdatedSlot.sub(amm.createdAtSlot), - ); - } - - public static simulateSwapInner( - inputAmount: BN, - inputReserves: BN, - outputReserves: BN, - ): BN { - if (inputReserves.eqn(0) || outputReserves.eqn(0)) { - throw new Error("reserves must be non-zero"); - } - - let inputAmountWithFee: BN = inputAmount.muln(990); - - let numerator: BN = inputAmountWithFee.mul(outputReserves); - let denominator: BN = inputReserves.muln(1000).add(inputAmountWithFee); - - return numerator.div(denominator); - } - - // public static simulateSwap( - // inputAmount: BN, - // swapType: SwapType, - // baseReserves: BN, - // quoteReserves: BN, - // slippageBps?: BN - // ): SwapSimulation { - // let inputReserves: BN, outputReserves: BN; - // if (swapType.buy) { - // inputReserves = quoteReserves; - // outputReserves = baseReserves; - // } else { - // inputReserves = baseReserves; - // outputReserves = quoteReserves; - // } - - // let expectedOut = this.simulateSwapInner( - // inputAmount, - // inputReserves, - // outputReserves - // ); - - // let minExpectedOut; - // if (slippageBps) { - // minExpectedOut = AmmMath.subtractSlippage(expectedOut, slippageBps); - // } - - // let newBaseReserves: BN, newQuoteReserves: BN; - // if (swapType.buy) { - // newBaseReserves = baseReserves.sub(expectedOut); - // newQuoteReserves = quoteReserves.add(inputAmount); - // } else { - // newBaseReserves = baseReserves.add(inputAmount); - // newQuoteReserves = quoteReserves.sub(expectedOut); - // } - - // return { - // expectedOut, - // newBaseReserves, - // newQuoteReserves, - // minExpectedOut, - // }; - // } - - // /** - // * Calculates the optimal swap amount and mergeable tokens without using square roots. - // * @param userBalanceIn BN – Tokens that a user wants to dispose of. - // * @param ammReserveIn BN – Amount of tokens in the AMM of the token that the user wants to dispose of. - // * @param ammReserveOut BN – Amount of tokens in the AMM of the token that the user wants to receive. - // * @returns An object containing the optimal swap amount, expected quote received, and expected mergeable tokens. - // */ - - // public static calculateOptimalSwapForMerge( - // userBalanceIn: BN, - // ammReserveIn: BN, - // ammReserveOut: BN, - // slippageBps: BN - // ): { - // optimalSwapAmount: BN; - // userInAfterSwap: BN; - // expectedOut: BN; - // minimumExpectedOut: BN; - // } { - // // essentially, we want to calculate the swap amount so that the remaining user balance = received token amount - - // // solve this system of equations for swapAmount, outputAmount (we only care about swap amount tho) - // // (baseReserve + swapAmount) * (quoteReserve - outputAmount) = baseReserve * quoteReserve - // // baseAmount - swapAmount = outputAmount - - // //solve equation - // // (baseReserve + .99*swapAmount) * (quoteReserve - (userTokens - swapAmount)) = baseReserve * quoteReserve - // // multiplying out the left hand side and subtracting baseReserve * quoteReserve from both sides yields the following: - // // baseReserve*quoteReserve - baseReserve*userTokens + baseReserve*swapAmount + .99*swapAmount*quoteReserve - .99*swapAmount*userTokens + .99*swapAmount^2 = baseReserve*quoteReserve - // // .99*swapAmount^2 + baseReserve*swapAmount + .99*swapAmount*quoteReserve - baseReserve*userTokens - .99*swapAmount*userTokens = 0 - // // in the quadratic equation, a = .99, b = (baseReserve + .99*quoteReserve - .99*userTokens), c = -baseReserve*userTokens - // // x = (-b + sqrt(b^2 - 4ac)) / 2a - - // let a = 0.99; - // let b = - // Number(ammReserveIn) + - // 0.99 * Number(ammReserveOut) - - // 0.99 * Number(userBalanceIn); - // let c = -Number(ammReserveIn) * Number(userBalanceIn); - - // let x = (-b + Math.sqrt(b ** 2 - 4 * a * c)) / (2 * a); - // //this should mathematically return a positive number assuming userBalanceIn, ammReserveIn, and ammReserveOut are all positive (which they should be) - // // -b + Math.sqrt(b ** 2 - 4 * a * c) > 0 because -4*a*c > 0 and sqrt(b**2 + positive number) > b - - // const swapAmount = x; - - // let expectedOut = this.simulateSwapInner( - // new BN(swapAmount), - // ammReserveIn, - // ammReserveOut - // ); - // let minimumExpectedOut = - // Number(expectedOut) - (Number(expectedOut) * Number(slippageBps)) / 10000; - // return { - // optimalSwapAmount: new BN(swapAmount), - // userInAfterSwap: new BN(Number(userBalanceIn) - swapAmount), - // expectedOut: expectedOut, - // minimumExpectedOut: new BN(minimumExpectedOut), - // }; - // } -} - -// Add backwards compatibility alias -export { AmmMath as PriceMath }; diff --git a/sdk/sync-types.sh b/sdk/sync-types.sh new file mode 100755 index 000000000..7e99ab46f --- /dev/null +++ b/sdk/sync-types.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Copies IDL type files from anchor build output into sdk2 program type directories. + +TYPES_DIR="../target/types" + +cp "$TYPES_DIR/bid_wall.ts" ./src/bid_wall/v0.7/types/ +cp "$TYPES_DIR/conditional_vault.ts" ./src/conditional_vault/v0.4/types/ +cp "$TYPES_DIR/futarchy.ts" ./src/futarchy/v0.6/types/ +cp "$TYPES_DIR/launchpad.ts" ./src/launchpad/v0.6/types/ +cp "$TYPES_DIR/launchpad_v7.ts" ./src/launchpad/v0.7/types/ +cp "$TYPES_DIR/liquidation.ts" ./src/liquidation/v0.7/types/ +cp "$TYPES_DIR/mint_governor.ts" ./src/mint_governor/v0.7/types/ +cp "$TYPES_DIR/performance_package_v2.ts" ./src/performance_package_v2/v0.7/types/ +cp "$TYPES_DIR/price_based_performance_package.ts" ./src/price_based_performance_package/v0.6/types/ diff --git a/sdk/tsconfig.json b/sdk/tsconfig.json index c32ec9659..bba6b521f 100644 --- a/sdk/tsconfig.json +++ b/sdk/tsconfig.json @@ -1,22 +1,8 @@ { "compilerOptions": { - "types": [ - "mocha", - "chai" - ], - "paths": { - "@metadaoproject/futarchy/v0.3": ["./dist/v0.3/types/index.d.ts"], - "@metadaoproject/futarchy/v0.4": ["./dist/v0.4/types/index.d.ts"], - "@metadaoproject/futarchy/v0.5": ["./dist/v0.5/types/index.d.ts"], - "@metadaoproject/futarchy/v0.6": ["./dist/v0.6/types/index.d.ts"], - "@metadaoproject/futarchy/v0.7": ["./dist/v0.6/types/index.d.ts"] - }, - "typeRoots": [ - "./node_modules/@types" - ], - "lib": [ - "esnext" - ], + "types": ["mocha", "chai"], + "typeRoots": ["./node_modules/@types"], + "lib": ["esnext"], "module": "NodeNext", "target": "esnext", "esModuleInterop": true, @@ -25,20 +11,8 @@ "sourceMap": true, "outDir": "dist", "strict": true, - "declaration": true + "declaration": true, }, - "include": [ - "src/*", - "src/v0.3/*", - "src/v0.4/*", - "src/v0.5/*", - "src/v0.6/*", - "src/v0.7/*" - ], - "exclude": [ - "node_modules", - "target", - "tests", - "migrations" - ] + "include": ["src/**/*"], + "exclude": ["node_modules", "target", "tests", "migrations"] } diff --git a/sdk/yarn.lock b/sdk/yarn.lock index ced234393..2dde4ad19 100644 --- a/sdk/yarn.lock +++ b/sdk/yarn.lock @@ -7,31 +7,6 @@ resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.28.4.tgz#a70226016fabe25c5783b2f22d3e1c9bc5ca3326" integrity sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ== -"@bundlr-network/client@^0.8.8": - version "0.8.9" - resolved "https://registry.yarnpkg.com/@bundlr-network/client/-/client-0.8.9.tgz#58e969a5d80f8d25d212d46bb7a060730a3c1736" - integrity sha512-SJ7BAt/KhONeFQ0+nbqrw2DUWrsev6y6cmlXt+3x7fPCkw7OJwudtxV/h2nBteZd65NXjqw8yzkmLiLfZ7CCRA== - dependencies: - "@solana/wallet-adapter-base" "^0.9.2" - "@solana/web3.js" "^1.36.0" - "@supercharge/promise-pool" "^2.1.0" - algosdk "^1.13.1" - arbundles "^0.6.21" - arweave "^1.11.4" - async-retry "^1.3.3" - axios "^0.25.0" - base64url "^3.0.1" - bignumber.js "^9.0.1" - bs58 "^4.0.1" - commander "^8.2.0" - csv "^6.0.5" - ethers "^5.5.1" - inquirer "^8.2.0" - js-sha256 "^0.9.0" - mime-types "^2.1.34" - near-api-js "^0.44.2" - near-seed-phrase "^0.2.0" - "@coral-xyz/anchor@^0.29.0": version "0.29.0" resolved "https://registry.yarnpkg.com/@coral-xyz/anchor/-/anchor-0.29.0.tgz#bd0be95bedfb30a381c3e676e5926124c310ff12" @@ -60,466 +35,6 @@ bn.js "^5.1.2" buffer-layout "^1.2.0" -"@esbuild/android-arm64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz#bafb75234a5d3d1b690e7c2956a599345e84a2fd" - integrity sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA== - -"@esbuild/android-arm@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.17.19.tgz#5898f7832c2298bc7d0ab53701c57beb74d78b4d" - integrity sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A== - -"@esbuild/android-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.17.19.tgz#658368ef92067866d95fb268719f98f363d13ae1" - integrity sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww== - -"@esbuild/darwin-arm64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz#584c34c5991b95d4d48d333300b1a4e2ff7be276" - integrity sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg== - -"@esbuild/darwin-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz#7751d236dfe6ce136cce343dce69f52d76b7f6cb" - integrity sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw== - -"@esbuild/freebsd-arm64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz#cacd171665dd1d500f45c167d50c6b7e539d5fd2" - integrity sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ== - -"@esbuild/freebsd-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz#0769456eee2a08b8d925d7c00b79e861cb3162e4" - integrity sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ== - -"@esbuild/linux-arm64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz#38e162ecb723862c6be1c27d6389f48960b68edb" - integrity sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg== - -"@esbuild/linux-arm@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz#1a2cd399c50040184a805174a6d89097d9d1559a" - integrity sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA== - -"@esbuild/linux-ia32@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz#e28c25266b036ce1cabca3c30155222841dc035a" - integrity sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ== - -"@esbuild/linux-loong64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz#0f887b8bb3f90658d1a0117283e55dbd4c9dcf72" - integrity sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ== - -"@esbuild/linux-mips64el@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz#f5d2a0b8047ea9a5d9f592a178ea054053a70289" - integrity sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A== - -"@esbuild/linux-ppc64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz#876590e3acbd9fa7f57a2c7d86f83717dbbac8c7" - integrity sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg== - -"@esbuild/linux-riscv64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz#7f49373df463cd9f41dc34f9b2262d771688bf09" - integrity sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA== - -"@esbuild/linux-s390x@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz#e2afd1afcaf63afe2c7d9ceacd28ec57c77f8829" - integrity sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q== - -"@esbuild/linux-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz#8a0e9738b1635f0c53389e515ae83826dec22aa4" - integrity sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw== - -"@esbuild/netbsd-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz#c29fb2453c6b7ddef9a35e2c18b37bda1ae5c462" - integrity sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q== - -"@esbuild/openbsd-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz#95e75a391403cb10297280d524d66ce04c920691" - integrity sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g== - -"@esbuild/sunos-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz#722eaf057b83c2575937d3ffe5aeb16540da7273" - integrity sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg== - -"@esbuild/win32-arm64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz#9aa9dc074399288bdcdd283443e9aeb6b9552b6f" - integrity sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag== - -"@esbuild/win32-ia32@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz#95ad43c62ad62485e210f6299c7b2571e48d2b03" - integrity sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw== - -"@esbuild/win32-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz#8cfaf2ff603e9aabb910e9c0558c26cf32744061" - integrity sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA== - -"@ethersproject/abi@5.8.0", "@ethersproject/abi@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.8.0.tgz#e79bb51940ac35fe6f3262d7fe2cdb25ad5f07d9" - integrity sha512-b9YS/43ObplgyV6SlyQsG53/vkSal0MNA1fskSC4mbnCMi8R+NkcH8K9FPYNESf6jUefBUniE4SOKms0E/KK1Q== - dependencies: - "@ethersproject/address" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/hash" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@ethersproject/abstract-provider@5.8.0", "@ethersproject/abstract-provider@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.8.0.tgz#7581f9be601afa1d02b95d26b9d9840926a35b0c" - integrity sha512-wC9SFcmh4UK0oKuLJQItoQdzS/qZ51EJegK6EmAWlh+OptpQ/npECOR3QqECd8iGHC0RJb4WKbVdSfif4ammrg== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/networks" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - "@ethersproject/web" "^5.8.0" - -"@ethersproject/abstract-signer@5.8.0", "@ethersproject/abstract-signer@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.8.0.tgz#8d7417e95e4094c1797a9762e6789c7356db0754" - integrity sha512-N0XhZTswXcmIZQdYtUnd79VJzvEwXQw6PK0dTl9VoYrEBxxCPXqS0Eod7q5TNKRxe1/5WUMuR0u0nqTF/avdCA== - dependencies: - "@ethersproject/abstract-provider" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - -"@ethersproject/address@5.8.0", "@ethersproject/address@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.8.0.tgz#3007a2c352eee566ad745dca1dbbebdb50a6a983" - integrity sha512-GhH/abcC46LJwshoN+uBNoKVFPxUuZm6dA257z0vZkKmU1+t8xTn8oK7B9qrj8W2rFRMch4gbJl6PmVxjxBEBA== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/rlp" "^5.8.0" - -"@ethersproject/base64@5.8.0", "@ethersproject/base64@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.8.0.tgz#61c669c648f6e6aad002c228465d52ac93ee83eb" - integrity sha512-lN0oIwfkYj9LbPx4xEkie6rAMJtySbpOAFXSDVQaBnAzYfB4X2Qr+FXJGxMoc3Bxp2Sm8OwvzMrywxyw0gLjIQ== - dependencies: - "@ethersproject/bytes" "^5.8.0" - -"@ethersproject/basex@5.8.0", "@ethersproject/basex@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.8.0.tgz#1d279a90c4be84d1c1139114a1f844869e57d03a" - integrity sha512-PIgTszMlDRmNwW9nhS6iqtVfdTAKosA7llYXNmGPw4YAI1PUyMv28988wAb41/gHF/WqGdoLv0erHaRcHRKW2Q== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - -"@ethersproject/bignumber@5.8.0", "@ethersproject/bignumber@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.8.0.tgz#c381d178f9eeb370923d389284efa19f69efa5d7" - integrity sha512-ZyaT24bHaSeJon2tGPKIiHszWjD/54Sz8t57Toch475lCLljC6MgPmxk7Gtzz+ddNN5LuHea9qhAe0x3D+uYPA== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - bn.js "^5.2.1" - -"@ethersproject/bytes@5.8.0", "@ethersproject/bytes@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.8.0.tgz#9074820e1cac7507a34372cadeb035461463be34" - integrity sha512-vTkeohgJVCPVHu5c25XWaWQOZ4v+DkGoC42/TS2ond+PARCxTJvgTFUNDZovyQ/uAQ4EcpqqowKydcdmRKjg7A== - dependencies: - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/constants@5.8.0", "@ethersproject/constants@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.8.0.tgz#12f31c2f4317b113a4c19de94e50933648c90704" - integrity sha512-wigX4lrf5Vu+axVTIvNsuL6YrV4O5AXl5ubcURKMEME5TnWBouUh0CDTWxZ2GpnRn1kcCgE7l8O5+VbV9QTTcg== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - -"@ethersproject/contracts@5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.8.0.tgz#243a38a2e4aa3e757215ea64e276f8a8c9d8ed73" - integrity sha512-0eFjGz9GtuAi6MZwhb4uvUM216F38xiuR0yYCjKJpNfSEy4HUM8hvqqBj9Jmm0IUz8l0xKEhWwLIhPgxNY0yvQ== - dependencies: - "@ethersproject/abi" "^5.8.0" - "@ethersproject/abstract-provider" "^5.8.0" - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - -"@ethersproject/hash@5.8.0", "@ethersproject/hash@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.8.0.tgz#b8893d4629b7f8462a90102572f8cd65a0192b4c" - integrity sha512-ac/lBcTbEWW/VGJij0CNSw/wPcw9bSRgCB0AIBz8CvED/jfvDoV9hsIIiWfvWmFEi8RcXtlNwp2jv6ozWOsooA== - dependencies: - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/base64" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@ethersproject/hdnode@5.8.0", "@ethersproject/hdnode@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.8.0.tgz#a51ae2a50bcd48ef6fd108c64cbae5e6ff34a761" - integrity sha512-4bK1VF6E83/3/Im0ERnnUeWOY3P1BZml4ZD3wcH8Ys0/d1h1xaFt6Zc+Dh9zXf9TapGro0T4wvO71UTCp3/uoA== - dependencies: - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/basex" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/pbkdf2" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/sha2" "^5.8.0" - "@ethersproject/signing-key" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - "@ethersproject/wordlists" "^5.8.0" - -"@ethersproject/json-wallets@5.8.0", "@ethersproject/json-wallets@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.8.0.tgz#d18de0a4cf0f185f232eb3c17d5e0744d97eb8c9" - integrity sha512-HxblNck8FVUtNxS3VTEYJAcwiKYsBIF77W15HufqlBF9gGfhmYOJtYZp8fSDZtn9y5EaXTE87zDwzxRoTFk11w== - dependencies: - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/hdnode" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/pbkdf2" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/random" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - aes-js "3.0.0" - scrypt-js "3.0.1" - -"@ethersproject/keccak256@5.8.0", "@ethersproject/keccak256@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.8.0.tgz#d2123a379567faf2d75d2aaea074ffd4df349e6a" - integrity sha512-A1pkKLZSz8pDaQ1ftutZoaN46I6+jvuqugx5KYNeQOPqq+JZ0Txm7dlWesCHB5cndJSu5vP2VKptKf7cksERng== - dependencies: - "@ethersproject/bytes" "^5.8.0" - js-sha3 "0.8.0" - -"@ethersproject/logger@5.8.0", "@ethersproject/logger@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.8.0.tgz#f0232968a4f87d29623a0481690a2732662713d6" - integrity sha512-Qe6knGmY+zPPWTC+wQrpitodgBfH7XoceCGL5bJVejmH+yCS3R8jJm8iiWuvWbG76RUmyEG53oqv6GMVWqunjA== - -"@ethersproject/networks@5.8.0", "@ethersproject/networks@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.8.0.tgz#8b4517a3139380cba9fb00b63ffad0a979671fde" - integrity sha512-egPJh3aPVAzbHwq8DD7Po53J4OUSsA1MjQp8Vf/OZPav5rlmWUaFLiq8cvQiGK0Z5K6LYzm29+VA/p4RL1FzNg== - dependencies: - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/pbkdf2@5.8.0", "@ethersproject/pbkdf2@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.8.0.tgz#cd2621130e5dd51f6a0172e63a6e4a0c0a0ec37e" - integrity sha512-wuHiv97BrzCmfEaPbUFpMjlVg/IDkZThp9Ri88BpjRleg4iePJaj2SW8AIyE8cXn5V1tuAaMj6lzvsGJkGWskg== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/sha2" "^5.8.0" - -"@ethersproject/properties@5.8.0", "@ethersproject/properties@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.8.0.tgz#405a8affb6311a49a91dabd96aeeae24f477020e" - integrity sha512-PYuiEoQ+FMaZZNGrStmN7+lWjlsoufGIHdww7454FIaGdbe/p5rnaCXTr5MtBYl3NkeoVhHZuyzChPeGeKIpQw== - dependencies: - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/providers@5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.8.0.tgz#6c2ae354f7f96ee150439f7de06236928bc04cb4" - integrity sha512-3Il3oTzEx3o6kzcg9ZzbE+oCZYyY+3Zh83sKkn4s1DZfTUjIegHnN2Cm0kbn9YFy45FDVcuCLLONhU7ny0SsCw== - dependencies: - "@ethersproject/abstract-provider" "^5.8.0" - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/base64" "^5.8.0" - "@ethersproject/basex" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/hash" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/networks" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/random" "^5.8.0" - "@ethersproject/rlp" "^5.8.0" - "@ethersproject/sha2" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - "@ethersproject/web" "^5.8.0" - bech32 "1.1.4" - ws "8.18.0" - -"@ethersproject/random@5.8.0", "@ethersproject/random@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.8.0.tgz#1bced04d49449f37c6437c701735a1a022f0057a" - integrity sha512-E4I5TDl7SVqyg4/kkA/qTfuLWAQGXmSOgYyO01So8hLfwgKvYK5snIlzxJMk72IFdG/7oh8yuSqY2KX7MMwg+A== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/rlp@5.8.0", "@ethersproject/rlp@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.8.0.tgz#5a0d49f61bc53e051532a5179472779141451de5" - integrity sha512-LqZgAznqDbiEunaUvykH2JAoXTT9NV0Atqk8rQN9nx9SEgThA/WMx5DnW8a9FOufo//6FZOCHZ+XiClzgbqV9Q== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/sha2@5.8.0", "@ethersproject/sha2@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.8.0.tgz#8954a613bb78dac9b46829c0a95de561ef74e5e1" - integrity sha512-dDOUrXr9wF/YFltgTBYS0tKslPEKr6AekjqDW2dbn1L1xmjGR+9GiKu4ajxovnrDbwxAKdHjW8jNcwfz8PAz4A== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - hash.js "1.1.7" - -"@ethersproject/signing-key@5.8.0", "@ethersproject/signing-key@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.8.0.tgz#9797e02c717b68239c6349394ea85febf8893119" - integrity sha512-LrPW2ZxoigFi6U6aVkFN/fa9Yx/+4AtIUe4/HACTvKJdhm0eeb107EVCIQcrLZkxaSIgc/eCrX8Q1GtbH+9n3w== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - bn.js "^5.2.1" - elliptic "6.6.1" - hash.js "1.1.7" - -"@ethersproject/solidity@5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.8.0.tgz#429bb9fcf5521307a9448d7358c26b93695379b9" - integrity sha512-4CxFeCgmIWamOHwYN9d+QWGxye9qQLilpgTU0XhYs1OahkclF+ewO+3V1U0mvpiuQxm5EHHmv8f7ClVII8EHsA== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/sha2" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@ethersproject/strings@5.8.0", "@ethersproject/strings@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.8.0.tgz#ad79fafbf0bd272d9765603215ac74fd7953908f" - integrity sha512-qWEAk0MAvl0LszjdfnZ2uC8xbR2wdv4cDabyHiBh3Cldq/T8dPH3V4BbBsAYJUeonwD+8afVXld274Ls+Y1xXg== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/transactions@5.8.0", "@ethersproject/transactions@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.8.0.tgz#1e518822403abc99def5a043d1c6f6fe0007e46b" - integrity sha512-UglxSDjByHG0TuU17bDfCemZ3AnKO2vYrL5/2n2oXvKzvb7Cz+W9gOWXKARjp2URVwcWlQlPOEQyAviKwT4AHg== - dependencies: - "@ethersproject/address" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/rlp" "^5.8.0" - "@ethersproject/signing-key" "^5.8.0" - -"@ethersproject/units@5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.8.0.tgz#c12f34ba7c3a2de0e9fa0ed0ee32f3e46c5c2c6a" - integrity sha512-lxq0CAnc5kMGIiWW4Mr041VT8IhNM+Pn5T3haO74XZWFulk7wH1Gv64HqE96hT4a7iiNMdOCFEBgaxWuk8ETKQ== - dependencies: - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/constants" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - -"@ethersproject/wallet@5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.8.0.tgz#49c300d10872e6986d953e8310dc33d440da8127" - integrity sha512-G+jnzmgg6UxurVKRKvw27h0kvG75YKXZKdlLYmAHeF32TGUzHkOFd7Zn6QHOTYRFWnfjtSSFjBowKo7vfrXzPA== - dependencies: - "@ethersproject/abstract-provider" "^5.8.0" - "@ethersproject/abstract-signer" "^5.8.0" - "@ethersproject/address" "^5.8.0" - "@ethersproject/bignumber" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/hash" "^5.8.0" - "@ethersproject/hdnode" "^5.8.0" - "@ethersproject/json-wallets" "^5.8.0" - "@ethersproject/keccak256" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/random" "^5.8.0" - "@ethersproject/signing-key" "^5.8.0" - "@ethersproject/transactions" "^5.8.0" - "@ethersproject/wordlists" "^5.8.0" - -"@ethersproject/web@5.8.0", "@ethersproject/web@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.8.0.tgz#3e54badc0013b7a801463a7008a87988efce8a37" - integrity sha512-j7+Ksi/9KfGviws6Qtf9Q7KCqRhpwrYKQPs+JBA/rKVFF/yaWLHJEH3zfVP2plVu+eys0d2DlFmhoQJayFewcw== - dependencies: - "@ethersproject/base64" "^5.8.0" - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@ethersproject/wordlists@5.8.0", "@ethersproject/wordlists@^5.8.0": - version "5.8.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.8.0.tgz#7a5654ee8d1bb1f4dbe43f91d217356d650ad821" - integrity sha512-2df9bbXicZws2Sb5S6ET493uJ0Z84Fjr3pC4tu/qlnZERibZCeUVuqdtt+7Tv9xxhUxHoIekIA7avrKUWHrezg== - dependencies: - "@ethersproject/bytes" "^5.8.0" - "@ethersproject/hash" "^5.8.0" - "@ethersproject/logger" "^5.8.0" - "@ethersproject/properties" "^5.8.0" - "@ethersproject/strings" "^5.8.0" - -"@inquirer/external-editor@^1.0.0": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@inquirer/external-editor/-/external-editor-1.0.3.tgz#c23988291ee676290fdab3fd306e64010a6d13b8" - integrity sha512-RWbSrDiYmO4LbejWY7ttpxczuwQyZLBUyygsA9Nsv95hpzUWwnNTVQmAq3xuh7vNwCp07UTmE5i11XAEExx4RA== - dependencies: - chardet "^2.1.1" - iconv-lite "^0.7.0" - "@metaplex-foundation/beet-solana@0.4.0": version "0.4.0" resolved "https://registry.yarnpkg.com/@metaplex-foundation/beet-solana/-/beet-solana-0.4.0.tgz#52891e78674aaa54e0031f1bca5bfbc40de12e8d" @@ -554,166 +69,18 @@ resolved "https://registry.yarnpkg.com/@metaplex-foundation/cusper/-/cusper-0.0.2.tgz#dc2032a452d6c269e25f016aa4dd63600e2af975" integrity sha512-S9RulC2fFCFOQraz61bij+5YCHhSO9llJegK8c8Y6731fSi6snUSQJdCUqYS8AIgR0TKbQvdvgSyIIdbDFZbBA== -"@metaplex-foundation/umi-bundle-defaults@^0.9.2": - version "0.9.2" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/umi-bundle-defaults/-/umi-bundle-defaults-0.9.2.tgz#f8e296b1a0ecb3a6511dbaca4131bc9263071cfc" - integrity sha512-kV3tfvgvRjVP1p9OFOtH+ibOtN9omVJSwKr0We4/9r45e5LTj+32su0V/rixZUkG1EZzzOYBsxhtIE0kIw/Hrw== - dependencies: - "@metaplex-foundation/umi-downloader-http" "^0.9.2" - "@metaplex-foundation/umi-eddsa-web3js" "^0.9.2" - "@metaplex-foundation/umi-http-fetch" "^0.9.2" - "@metaplex-foundation/umi-program-repository" "^0.9.2" - "@metaplex-foundation/umi-rpc-chunk-get-accounts" "^0.9.2" - "@metaplex-foundation/umi-rpc-web3js" "^0.9.2" - "@metaplex-foundation/umi-serializer-data-view" "^0.9.2" - "@metaplex-foundation/umi-transaction-factory-web3js" "^0.9.2" - -"@metaplex-foundation/umi-downloader-http@^0.9.2": - version "0.9.2" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/umi-downloader-http/-/umi-downloader-http-0.9.2.tgz#df84b11df9141854ca1cf7c6c8374658e67de767" - integrity sha512-tzPT9hBwenzTzAQg07rmsrqZfgguAXELbcJrsYMoASp5VqWFXYIP00g94KET6XLjWUXH4P1J2zoa6hGennPXHA== - -"@metaplex-foundation/umi-eddsa-web3js@^0.9.2": - version "0.9.2" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/umi-eddsa-web3js/-/umi-eddsa-web3js-0.9.2.tgz#92225595137c5585dae63b148786ab77fcb6d625" - integrity sha512-hhPCxXbYIp4BC4z9gK78sXpWLkNSrfv4ndhF5ruAkdIp7GcRVYKj0QnOUO6lGYGiIkNlw20yoTwOe1CT//OfTQ== - dependencies: - "@metaplex-foundation/umi-web3js-adapters" "^0.9.2" - "@noble/curves" "^1.0.0" - -"@metaplex-foundation/umi-http-fetch@^0.9.2": - version "0.9.2" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/umi-http-fetch/-/umi-http-fetch-0.9.2.tgz#e233ec34b789ed5257168b97d72fc9b039155046" - integrity sha512-YCZuBu24T9ZzEDe4+w12LEZm/fO9pkyViZufGgASC5NX93814Lvf6Ssjn/hZzjfA7CvZbvLFbmujc6CV3Q/m9Q== - dependencies: - node-fetch "^2.6.7" - -"@metaplex-foundation/umi-options@^0.8.9": - version "0.8.9" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/umi-options/-/umi-options-0.8.9.tgz#9c9e269d9eee7d055ad6831dcb30a30127dcb0c5" - integrity sha512-jSQ61sZMPSAk/TXn8v8fPqtz3x8d0/blVZXLLbpVbo2/T5XobiI6/MfmlUosAjAUaQl6bHRF8aIIqZEFkJiy4A== - -"@metaplex-foundation/umi-program-repository@^0.9.2": - version "0.9.2" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/umi-program-repository/-/umi-program-repository-0.9.2.tgz#53fce2bf506bb97fdb6a53e2118f8d1dd28fd0b5" - integrity sha512-g3+FPqXEmYsBa8eETtUE2gb2Oe3mqac0z3/Ur1TvAg5TtIy3mzRzOy/nza+sgzejnfcxcVg835rmpBaxpBnjDA== - -"@metaplex-foundation/umi-public-keys@^0.8.9": - version "0.8.9" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/umi-public-keys/-/umi-public-keys-0.8.9.tgz#ca7a927c924ed8e28d0f8bb3dc0f2adc1f9011ec" - integrity sha512-CxMzN7dgVGOq9OcNCJe2casKUpJ3RmTVoOvDFyeoTQuK+vkZ1YSSahbqC1iGuHEtKTLSjtWjKvUU6O7zWFTw3Q== - dependencies: - "@metaplex-foundation/umi-serializers-encodings" "^0.8.9" - -"@metaplex-foundation/umi-rpc-chunk-get-accounts@^0.9.2": - version "0.9.2" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/umi-rpc-chunk-get-accounts/-/umi-rpc-chunk-get-accounts-0.9.2.tgz#f93bd43d4c65cdfdb0a68145a837fb6b13e0e832" - integrity sha512-YRwVf6xH0jPBAUgMhEPi+UbjioAeqTXmjsN2TnmQCPAmHbrHrMRj0rlWYwFLWAgkmoxazYrXP9lqOFRrfOGAEA== - -"@metaplex-foundation/umi-rpc-web3js@^0.9.2": - version "0.9.2" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/umi-rpc-web3js/-/umi-rpc-web3js-0.9.2.tgz#b00a4cc1a9bd5d930164d1ba43f816107655c0d9" - integrity sha512-MqcsBz8B4wGl6jxsf2Jo/rAEpYReU9VCSR15QSjhvADHMmdFxCIZCCAgE+gDE2Vuanfl437VhOcP3g5Uw8C16Q== - dependencies: - "@metaplex-foundation/umi-web3js-adapters" "^0.9.2" - -"@metaplex-foundation/umi-serializer-data-view@^0.9.2": - version "0.9.2" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/umi-serializer-data-view/-/umi-serializer-data-view-0.9.2.tgz#a05d88e7120b839e3acba35f7b4e12fe8be2becc" - integrity sha512-5vGptadJxUxvUcyrwFZxXlEc6Q7AYySBesizCtrBFUY8w8PnF2vzmS45CP1MLySEATNH6T9mD4Rs0tLb87iQyA== - -"@metaplex-foundation/umi-serializers-core@^0.8.9": - version "0.8.9" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/umi-serializers-core/-/umi-serializers-core-0.8.9.tgz#cd5ae763a59e54dd01f1284f4a6bf4e78e4aab9c" - integrity sha512-WT82tkiYJ0Qmscp7uTj1Hz6aWQPETwaKLAENAUN5DeWghkuBKtuxyBKVvEOuoXerJSdhiAk0e8DWA4cxcTTQ/w== - -"@metaplex-foundation/umi-serializers-encodings@^0.8.9": - version "0.8.9" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/umi-serializers-encodings/-/umi-serializers-encodings-0.8.9.tgz#0f02605ee3e6fbeac1abc4fb267a7cc96ecb4410" - integrity sha512-N3VWLDTJ0bzzMKcJDL08U3FaqRmwlN79FyE4BHj6bbAaJ9LEHjDQ9RJijZyWqTm0jE7I750fU7Ow5EZL38Xi6Q== - dependencies: - "@metaplex-foundation/umi-serializers-core" "^0.8.9" - -"@metaplex-foundation/umi-serializers-numbers@^0.8.9": - version "0.8.9" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/umi-serializers-numbers/-/umi-serializers-numbers-0.8.9.tgz#28c10367f6aebac0276ec1bce81d0d8db54b05de" - integrity sha512-NtBf1fnVNQJHFQjLFzRu2i9GGnigb9hOm/Gfrk628d0q0tRJB7BOM3bs5C61VAs7kJs4yd+pDNVAERJkknQ7Lg== - dependencies: - "@metaplex-foundation/umi-serializers-core" "^0.8.9" - -"@metaplex-foundation/umi-serializers@^0.9.0": - version "0.9.0" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/umi-serializers/-/umi-serializers-0.9.0.tgz#af6d03a3bf821bf73b7b3450bb8df0407f2f69d6" - integrity sha512-hAOW9Djl4w4ioKeR4erDZl5IG4iJdP0xA19ZomdaCbMhYAAmG/FEs5khh0uT2mq53/MnzWcXSUPoO8WBN4Q+Vg== - dependencies: - "@metaplex-foundation/umi-options" "^0.8.9" - "@metaplex-foundation/umi-public-keys" "^0.8.9" - "@metaplex-foundation/umi-serializers-core" "^0.8.9" - "@metaplex-foundation/umi-serializers-encodings" "^0.8.9" - "@metaplex-foundation/umi-serializers-numbers" "^0.8.9" - -"@metaplex-foundation/umi-transaction-factory-web3js@^0.9.2": - version "0.9.2" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/umi-transaction-factory-web3js/-/umi-transaction-factory-web3js-0.9.2.tgz#294c3ca996897bb95b993b808fb9252bd085db15" - integrity sha512-fR1Kf21uylMFd1Smkltmj4jTNxhqSWf416owsJ+T+cvJi2VCOcOwq/3UFzOrpz78fA0RhsajKYKj0HYsRnQI1g== - dependencies: - "@metaplex-foundation/umi-web3js-adapters" "^0.9.2" - -"@metaplex-foundation/umi-uploader-bundlr@^0.9.2": - version "0.9.2" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/umi-uploader-bundlr/-/umi-uploader-bundlr-0.9.2.tgz#0d832816a32970cac9f412a0b0a8234415ab8534" - integrity sha512-wmixKqWyEO0lRB2GNvm5XOwi3jEyCtPZ6Oqds6sY5YHYdrn1Cqgd1TcdAuu7+DuojcNFErTjWsaQ1F9QR502QQ== - dependencies: - "@bundlr-network/client" "^0.8.8" - "@metaplex-foundation/umi-web3js-adapters" "^0.9.2" - bignumber.js "^9.0.2" - buffer "^6.0.3" - -"@metaplex-foundation/umi-web3js-adapters@^0.9.2": - version "0.9.2" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/umi-web3js-adapters/-/umi-web3js-adapters-0.9.2.tgz#1e0ebb4e3c31e8bead27892b20204292ad6955c5" - integrity sha512-RQqUTtHYY9fmEMnq7s3Hiv/81flGaoI0ZVVoafnFVaQLnxU6QBKxtboRZHk43XtD9CiFh5f9izrMJX7iK7KlOA== - dependencies: - buffer "^6.0.3" - -"@metaplex-foundation/umi@^0.9.2": - version "0.9.2" - resolved "https://registry.yarnpkg.com/@metaplex-foundation/umi/-/umi-0.9.2.tgz#6460bff91d2ac7745842eda1ee6a28fba4d2ffb2" - integrity sha512-9i4Acm4pruQfJcpRrc2EauPBwkfDN0I9QTvJyZocIlKgoZwD6A6wH0PViH1AjOVG5CQCd1YI3tJd5XjYE1ElBw== - dependencies: - "@metaplex-foundation/umi-options" "^0.8.9" - "@metaplex-foundation/umi-public-keys" "^0.8.9" - "@metaplex-foundation/umi-serializers" "^0.9.0" - -"@noble/curves@^1.0.0", "@noble/curves@^1.4.2": +"@noble/curves@^1.4.2": version "1.9.7" resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.9.7.tgz#79d04b4758a43e4bca2cbdc62e7771352fa6b951" integrity sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw== dependencies: "@noble/hashes" "1.8.0" -"@noble/ed25519@^1.6.1": - version "1.7.5" - resolved "https://registry.yarnpkg.com/@noble/ed25519/-/ed25519-1.7.5.tgz#94df8bdb9fec9c4644a56007eecb57b0e9fbd0d7" - integrity sha512-xuS0nwRMQBvSxDa7UxMb61xTiH3MxTgUfhyPUALVIe0FlOAz4sjELwyDRyUvqeEYfRSG9qNjFIycqLZppg4RSA== - "@noble/hashes@1.8.0", "@noble/hashes@^1.3.1", "@noble/hashes@^1.4.0": version "1.8.0" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.8.0.tgz#cee43d801fcef9644b11b8194857695acd5f815a" integrity sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A== -"@randlabs/communication-bridge@1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@randlabs/communication-bridge/-/communication-bridge-1.0.1.tgz#d1ecfc29157afcbb0ca2d73122d67905eecb5bf3" - integrity sha512-CzS0U8IFfXNK7QaJFE4pjbxDGfPjbXBEsEaCn9FN15F+ouSAEUQkva3Gl66hrkBZOGexKFEWMwUHIDKpZ2hfVg== - -"@randlabs/myalgo-connect@^1.1.2": - version "1.4.2" - resolved "https://registry.yarnpkg.com/@randlabs/myalgo-connect/-/myalgo-connect-1.4.2.tgz#ce3ad97b3889ea21da75852187511d3f6be0fa05" - integrity sha512-K9hEyUi7G8tqOp7kWIALJLVbGCByhilcy6123WfcorxWwiE1sbQupPyIU5f3YdQK6wMjBsyTWiLW52ZBMp7sXA== - dependencies: - "@randlabs/communication-bridge" "1.0.1" - "@solana/buffer-layout-utils@^0.2.0": version "0.2.0" resolved "https://registry.yarnpkg.com/@solana/buffer-layout-utils/-/buffer-layout-utils-0.2.0.tgz#b45a6cab3293a2eb7597cceb474f229889d875ca" @@ -834,25 +201,7 @@ "@solana/spl-token-metadata" "^0.1.2" buffer "^6.0.3" -"@solana/wallet-adapter-base@^0.9.2": - version "0.9.27" - resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-base/-/wallet-adapter-base-0.9.27.tgz#f76463db172ac1d7d1f5aa064800363777731dfd" - integrity sha512-kXjeNfNFVs/NE9GPmysBRKQ/nf+foSaq3kfVSeMcO/iVgigyRmB551OjU3WyAolLG/1jeEfKLqF9fKwMCRkUqg== - dependencies: - "@solana/wallet-standard-features" "^1.3.0" - "@wallet-standard/base" "^1.1.0" - "@wallet-standard/features" "^1.1.0" - eventemitter3 "^5.0.1" - -"@solana/wallet-standard-features@^1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@solana/wallet-standard-features/-/wallet-standard-features-1.3.0.tgz#c489eca9d0c78f97084b4af6ca8ad8c1ca197de5" - integrity sha512-ZhpZtD+4VArf6RPitsVExvgkF+nGghd1rzPjd97GmBximpnt1rsUxMOEyoIEuH3XBxPyNB6Us7ha7RHWQR+abg== - dependencies: - "@wallet-standard/base" "^1.1.0" - "@wallet-standard/features" "^1.1.0" - -"@solana/web3.js@^1.32.0", "@solana/web3.js@^1.36.0", "@solana/web3.js@^1.56.2", "@solana/web3.js@^1.68.0", "@solana/web3.js@^1.70.3", "@solana/web3.js@^1.76.0": +"@solana/web3.js@^1.32.0", "@solana/web3.js@^1.56.2", "@solana/web3.js@^1.68.0", "@solana/web3.js@^1.70.3", "@solana/web3.js@^1.76.0": version "1.98.4" resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.98.4.tgz#df51d78be9d865181ec5138b4e699d48e6895bbe" integrity sha512-vv9lfnvjUsRiq//+j5pBdXig0IQdtzA0BRZ3bXEP4KaIyF1CcaydWqgyzQgfZMNIsWNWmG+AUHwPy4AHOD6gpw== @@ -889,11 +238,6 @@ buffer "6.0.3" invariant "2.2.4" -"@supercharge/promise-pool@^2.1.0": - version "2.4.0" - resolved "https://registry.yarnpkg.com/@supercharge/promise-pool/-/promise-pool-2.4.0.tgz#6050eea8c2d7f92ddd4ddc582ee328b15c034ad3" - integrity sha512-O9CMipBlq5OObdt1uKJGIzm9cdjpPWfj+a+Zw9EgWKxaMNHKC7EU7X9taj3H0EGQNLOSq2jAcOa3EzxlfHsD6w== - "@swc/helpers@^0.5.11": version "0.5.17" resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.5.17.tgz#5a7be95ac0f0bf186e7e6e890e7a6f6cda6ce971" @@ -937,11 +281,6 @@ dependencies: undici-types "~7.16.0" -"@types/node@11.11.6": - version "11.11.6" - resolved "https://registry.yarnpkg.com/@types/node/-/node-11.11.6.tgz#df929d1bb2eee5afdda598a41930fe50b43eaa6a" - integrity sha512-Exw4yUWMBXM3X+8oqzJNRqZSwUAaS4+7NdvHqQuFi/d+synz++xmX3QIf+BFqneW8N31R8Ky+sikfZUXq07ggQ== - "@types/node@^12.12.54": version "12.20.55" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240" @@ -971,23 +310,6 @@ resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== -"@wallet-standard/base@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@wallet-standard/base/-/base-1.1.0.tgz#214093c0597a1e724ee6dbacd84191dfec62bb33" - integrity sha512-DJDQhjKmSNVLKWItoKThJS+CsJQjR9AOBOirBVT1F9YpRyC9oYHE+ZnSf8y8bxUphtKqdQMPVQ2mHohYdRvDVQ== - -"@wallet-standard/features@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@wallet-standard/features/-/features-1.1.0.tgz#f256d7b18940c8d134f66164330db358a8f5200e" - integrity sha512-hiEivWNztx73s+7iLxsuD1sOJ28xtRix58W7Xnz4XzzA/pF0+aicnWgjOdA10doVDEDZdUuZCIIqG96SFNlDUg== - dependencies: - "@wallet-standard/base" "^1.1.0" - -aes-js@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" - integrity sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw== - agentkeepalive@^4.5.0: version "4.6.0" resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.6.0.tgz#35f73e94b3f40bf65f105219c623ad19c136ea6a" @@ -995,39 +317,11 @@ agentkeepalive@^4.5.0: dependencies: humanize-ms "^1.2.1" -algo-msgpack-with-bigint@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/algo-msgpack-with-bigint/-/algo-msgpack-with-bigint-2.1.1.tgz#38bb717220525b3ff42232eefdcd9efb9ad405d6" - integrity sha512-F1tGh056XczEaEAqu7s+hlZUDWwOBT70Eq0lfMpBP2YguSQVyxRbprLq5rELXKQOyOaixTWYhMeMQMzP0U5FoQ== - -algosdk@^1.13.1: - version "1.24.1" - resolved "https://registry.yarnpkg.com/algosdk/-/algosdk-1.24.1.tgz#afc4102457ae0c38a32de6b84f4d713aedfc9e89" - integrity sha512-9moZxdqeJ6GdE4N6fA/GlUP4LrbLZMYcYkt141J4Ss68OfEgH9qW0wBuZ3ZOKEx/xjc5bg7mLP2Gjg7nwrkmww== - dependencies: - algo-msgpack-with-bigint "^2.1.1" - buffer "^6.0.2" - cross-fetch "^3.1.5" - hi-base32 "^0.5.1" - js-sha256 "^0.9.0" - js-sha3 "^0.8.0" - js-sha512 "^0.8.0" - json-bigint "^1.0.0" - tweetnacl "^1.0.3" - vlq "^2.0.4" - ansi-colors@4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== -ansi-escapes@^4.2.1: - version "4.3.2" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" - integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== - dependencies: - type-fest "^0.21.3" - ansi-regex@=5.0.1, ansi-regex@^4.1.0, ansi-regex@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" @@ -1053,35 +347,6 @@ anymatch@~3.1.2: normalize-path "^3.0.0" picomatch "^2.0.4" -arbundles@^0.6.21: - version "0.6.23" - resolved "https://registry.yarnpkg.com/arbundles/-/arbundles-0.6.23.tgz#c00cda953df67fa65d4297486237cc8e0c072c47" - integrity sha512-+gr93F3fivN+6dhiImT6BQNaXz4oECPn2GYjCZjS2yEoq7hM78FRvVp6kQyjEdhnuBFQr/q4oS/nkjnQlHdj9Q== - dependencies: - "@noble/ed25519" "^1.6.1" - "@randlabs/myalgo-connect" "^1.1.2" - "@solana/wallet-adapter-base" "^0.9.2" - algosdk "^1.13.1" - arweave "^1.11.4" - arweave-stream-tx "^1.1.0" - avsc "https://github.com/Irys-xyz/avsc#csp-fixes" - axios "^0.21.3" - base64url "^3.0.1" - bs58 "^4.0.1" - ethers "^5.5.1" - keccak "^3.0.2" - multistream "^4.1.0" - process "^0.11.10" - secp256k1 "^4.0.2" - tmp-promise "^3.0.2" - -arconnect@^0.4.2: - version "0.4.2" - resolved "https://registry.yarnpkg.com/arconnect/-/arconnect-0.4.2.tgz#83de7638fb46183e82d7ec7efb5594c5f7cdc806" - integrity sha512-Jkpd4QL3TVqnd3U683gzXmZUVqBUy17DdJDuL/3D9rkysLgX6ymJ2e+sR+xyZF5Rh42CBqDXWNMmCjBXeP7Gbw== - dependencies: - arweave "^1.10.13" - argparse@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" @@ -1092,33 +357,6 @@ arrify@^1.0.0: resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" integrity sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA== -arweave-stream-tx@^1.1.0: - version "1.2.2" - resolved "https://registry.yarnpkg.com/arweave-stream-tx/-/arweave-stream-tx-1.2.2.tgz#2d5c66554301baacd02586a152fbb198b422112f" - integrity sha512-bNt9rj0hbAEzoUZEF2s6WJbIz8nasZlZpxIw03Xm8fzb9gRiiZlZGW3lxQLjfc9Z0VRUWDzwtqoYeEoB/JDToQ== - dependencies: - exponential-backoff "^3.1.0" - -arweave@^1.10.13, arweave@^1.11.4: - version "1.15.7" - resolved "https://registry.yarnpkg.com/arweave/-/arweave-1.15.7.tgz#d09265d128e93a471203649de083ba7fec52cb29" - integrity sha512-F+Y4iWU1qea9IsKQ/YNmLsY4DHQVsaJBuhEbFxQn9cfGHOmtXE+bwo14oY8xqymsqSNf/e1PeIfLk7G7qN/hVA== - dependencies: - arconnect "^0.4.2" - asn1.js "^5.4.1" - base64-js "^1.5.1" - bignumber.js "^9.0.2" - -asn1.js@^5.4.1: - version "5.4.1" - resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-5.4.1.tgz#11a980b84ebb91781ce35b0fdc2ee294e3783f07" - integrity sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA== - dependencies: - bn.js "^4.0.0" - inherits "^2.0.1" - minimalistic-assert "^1.0.0" - safer-buffer "^2.1.0" - assert@^2.0.0, assert@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/assert/-/assert-2.1.0.tgz#6d92a238d05dc02e7427c881fb8be81c8448b2dd" @@ -1135,13 +373,6 @@ assertion-error@^1.1.0: resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== -async-retry@^1.3.3: - version "1.3.3" - resolved "https://registry.yarnpkg.com/async-retry/-/async-retry-1.3.3.tgz#0e7f36c04d8478e7a58bdbed80cedf977785f280" - integrity sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw== - dependencies: - retry "0.13.1" - available-typed-arrays@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz#a5cc375d6a03c2efc87a553f3e0b1522def14846" @@ -1149,24 +380,6 @@ available-typed-arrays@^1.0.7: dependencies: possible-typed-array-names "^1.0.0" -"avsc@https://github.com/Irys-xyz/avsc#csp-fixes": - version "5.4.7" - resolved "https://github.com/Irys-xyz/avsc#a730cc8018b79e114b6a3381bbb57760a24c6cef" - -axios@^0.21.3: - version "0.21.4" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575" - integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg== - dependencies: - follow-redirects "^1.14.0" - -axios@^0.25.0: - version "0.25.0" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.25.0.tgz#349cfbb31331a9b4453190791760a8d35b093e0a" - integrity sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g== - dependencies: - follow-redirects "^1.14.7" - backslash@=0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/backslash/-/backslash-0.2.0.tgz#6c3c1fce7e7e714ccfc10fd74f0f73410677375f" @@ -1189,21 +402,11 @@ base-x@^4.0.0: resolved "https://registry.yarnpkg.com/base-x/-/base-x-4.0.1.tgz#817fb7b57143c501f649805cb247617ad016a885" integrity sha512-uAZ8x6r6S3aUM9rbHGVOIsR15U/ZSc82b3ymnCPsT45Gk1DDvhDPdIgB5MrhirZWt+5K0EEPQH985kNqZgNPFw== -base64-js@^1.3.1, base64-js@^1.5.1: +base64-js@^1.3.1: version "1.5.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== -base64url@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/base64url/-/base64url-3.0.1.tgz#6399d572e2bc3f90a9a8b22d5dbb0a32d33f788d" - integrity sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A== - -bech32@1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" - integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== - bigint-buffer@^1.1.5: version "1.1.5" resolved "https://registry.yarnpkg.com/bigint-buffer/-/bigint-buffer-1.1.5.tgz#d038f31c8e4534c1f8d0015209bf34b4fa6dd442" @@ -1211,7 +414,7 @@ bigint-buffer@^1.1.5: dependencies: bindings "^1.3.0" -bignumber.js@^9.0.0, bignumber.js@^9.0.1, bignumber.js@^9.0.2: +bignumber.js@^9.0.1: version "9.3.1" resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.3.1.tgz#759c5aaddf2ffdc4f154f7b493e1c8770f88c4d7" integrity sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ== @@ -1228,57 +431,11 @@ bindings@^1.3.0: dependencies: file-uri-to-path "1.0.0" -bip39-light@^1.0.7: - version "1.0.7" - resolved "https://registry.yarnpkg.com/bip39-light/-/bip39-light-1.0.7.tgz#06a72f251b89389a136d3f177f29b03342adc5ba" - integrity sha512-WDTmLRQUsiioBdTs9BmSEmkJza+8xfJmptsNJjxnoq3EydSa/ZBXT6rm66KoT3PJIRYMnhSKNR7S9YL1l7R40Q== - dependencies: - create-hash "^1.1.0" - pbkdf2 "^3.0.9" - -bip39@3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/bip39/-/bip39-3.0.2.tgz#2baf42ff3071fc9ddd5103de92e8f80d9257ee32" - integrity sha512-J4E1r2N0tUylTKt07ibXvhpT2c5pyAFgvuA5q1H9uDy6dEGpjV8jmymh3MTYJDLCNbIVClSB9FbND49I6N24MQ== - dependencies: - "@types/node" "11.11.6" - create-hash "^1.1.0" - pbkdf2 "^3.0.9" - randombytes "^2.0.1" - -bl@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" - integrity sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w== - dependencies: - buffer "^5.5.0" - inherits "^2.0.4" - readable-stream "^3.4.0" - -bn.js@5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.0.tgz#358860674396c6997771a9d051fcc1b57d4ae002" - integrity sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw== - -bn.js@^4.0.0, bn.js@^4.11.9: - version "4.12.2" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.2.tgz#3d8fed6796c24e177737f7cc5172ee04ef39ec99" - integrity sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw== - bn.js@^5.1.2, bn.js@^5.2.0, bn.js@^5.2.1: version "5.2.2" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.2.tgz#82c09f9ebbb17107cd72cb7fd39bd1f9d0aaa566" integrity sha512-v2YAxEmKaBLahNwE1mjp4WON6huMNeuDvagFZW+ASCuA/ku0bXR9hSMw0XpiqMoA3+rmnyck/tPRSFQkoC9Cuw== -borsh@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/borsh/-/borsh-0.6.0.tgz#a7c9eeca6a31ca9e0607cb49f329cb659eb791e1" - integrity sha512-sl5k89ViqsThXQpYa9XDtz1sBl3l1lI313cFUY1HKr+wvMILnb+58xpkqTNrYbelh99dY7K8usxoCusQmqix9Q== - dependencies: - bn.js "^5.2.0" - bs58 "^4.0.0" - text-encoding-utf-8 "^1.0.2" - borsh@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/borsh/-/borsh-0.7.0.tgz#6e9560d719d86d90dc589bca60ffc8a6c51fec2a" @@ -1303,11 +460,6 @@ braces@~3.0.2: dependencies: fill-range "^7.1.1" -brorand@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" - integrity sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w== - browser-stdout@1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" @@ -1337,7 +489,7 @@ buffer-layout@^1.2.0, buffer-layout@^1.2.2: resolved "https://registry.yarnpkg.com/buffer-layout/-/buffer-layout-1.2.2.tgz#b9814e7c7235783085f9ca4966a0cfff112259d5" integrity sha512-kWSuLN694+KTk8SrYvCqwP2WcgQjoRCiF5b4QDvkkz8EmgD+aWAIceGFKMIAdmF/pH+vpgNV3d3kAKorcdAmWA== -buffer@6.0.3, buffer@^6.0.2, buffer@^6.0.3, buffer@~6.0.3: +buffer@6.0.3, buffer@^6.0.3, buffer@~6.0.3: version "6.0.3" resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== @@ -1345,14 +497,6 @@ buffer@6.0.3, buffer@^6.0.2, buffer@^6.0.3, buffer@~6.0.3: base64-js "^1.3.1" ieee754 "^1.2.1" -buffer@^5.5.0: - version "5.7.1" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" - integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== - dependencies: - base64-js "^1.3.1" - ieee754 "^1.1.13" - bufferutil@^4.0.1: version "4.0.9" resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.9.tgz#6e81739ad48a95cad45a279588e13e95e24a800a" @@ -1391,11 +535,6 @@ camelcase@^6.0.0, camelcase@^6.3.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -capability@^0.2.5: - version "0.2.5" - resolved "https://registry.yarnpkg.com/capability/-/capability-0.2.5.tgz#51ad87353f1936ffd77f2f21c74633a4dea88801" - integrity sha512-rsJZYVCgXd08sPqwmaIqjAd5SUTfonV0z/gDJ8D6cN8wQphky1kkAYEqQ+hmDxTw7UihvBfjUVUSY+DBEe44jg== - chai@^4.3.4: version "4.5.0" resolved "https://registry.yarnpkg.com/chai/-/chai-4.5.0.tgz#707e49923afdd9b13a8b0b47d33d732d13812fd8" @@ -1416,7 +555,7 @@ chalk-template@=0.4.0: dependencies: chalk "^4.1.2" -chalk@=4.1.2, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2, chalk@^5.3.0, chalk@^5.4.1: +chalk@=4.1.2, chalk@^4.1.0, chalk@^4.1.2, chalk@^5.3.0, chalk@^5.4.1: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== @@ -1424,11 +563,6 @@ chalk@=4.1.2, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2, chalk@^5.3.0, chalk@^5.4 ansi-styles "^4.1.0" supports-color "^7.1.0" -chardet@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/chardet/-/chardet-2.1.1.tgz#5c75593704a642f71ee53717df234031e65373c8" - integrity sha512-PsezH1rqdV9VvyNhxxOW32/d75r01NY7TQCmOqomRo15ZSOKbpTFVsfjghxo6JloQUCGnH4k1LGu0R4yCLlWQQ== - check-error@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.3.tgz#a6502e4312a7ee969f646e83bb3ddd56281bd694" @@ -1451,32 +585,6 @@ chokidar@3.5.3: optionalDependencies: fsevents "~2.3.2" -cipher-base@^1.0.1, cipher-base@^1.0.3: - version "1.0.7" - resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.7.tgz#bd094bfef42634ccfd9e13b9fc73274997111e39" - integrity sha512-Mz9QMT5fJe7bKI7MH31UilT5cEK5EHHRCccw/YRFsRY47AuNgaV6HY3rscp0/I4Q+tTW/5zoqpSeRRI54TkDWA== - dependencies: - inherits "^2.0.4" - safe-buffer "^5.2.1" - to-buffer "^1.2.2" - -cli-cursor@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" - integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw== - dependencies: - restore-cursor "^3.1.0" - -cli-spinners@^2.5.0: - version "2.9.2" - resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.9.2.tgz#1773a8f4b9c4d6ac31563df53b3fc1d79462fe41" - integrity sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg== - -cli-width@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-3.0.0.tgz#a2f48437a2caa9a22436e794bf071ec9e61cedf6" - integrity sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw== - cliui@^7.0.2: version "7.0.4" resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" @@ -1486,11 +594,6 @@ cliui@^7.0.2: strip-ansi "^6.0.0" wrap-ansi "^7.0.0" -clone@^1.0.2: - version "1.0.4" - resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" - integrity sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg== - color-convert@=2.0.1, color-convert@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" @@ -1533,44 +636,11 @@ commander@^2.20.3: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -commander@^8.2.0: - version "8.3.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" - integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== - concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== -core-util-is@~1.0.0: - version "1.0.3" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" - integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== - -create-hash@^1.1.0, create-hash@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" - integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== - dependencies: - cipher-base "^1.0.1" - inherits "^2.0.1" - md5.js "^1.3.4" - ripemd160 "^2.0.1" - sha.js "^2.4.0" - -create-hmac@1.1.7, create-hmac@^1.1.7: - version "1.1.7" - resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" - integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== - dependencies: - cipher-base "^1.0.3" - create-hash "^1.1.0" - inherits "^2.0.1" - ripemd160 "^2.0.0" - safe-buffer "^5.0.1" - sha.js "^2.4.8" - cross-fetch@^3.1.5: version "3.2.0" resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.2.0.tgz#34e9192f53bc757d6614304d9e5e6fb4edb782e3" @@ -1583,31 +653,6 @@ crypto-hash@^1.3.0: resolved "https://registry.yarnpkg.com/crypto-hash/-/crypto-hash-1.3.0.tgz#b402cb08f4529e9f4f09346c3e275942f845e247" integrity sha512-lyAZ0EMyjDkVvz8WOeVnuCPvKVBXcMv1l5SVqO1yC7PzTwrD/pPje/BIRbWhMoPe436U+Y2nD7f5bFx0kt+Sbg== -csv-generate@^4.5.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/csv-generate/-/csv-generate-4.5.0.tgz#5fbbb89bd9f8ce705871c9baf02e1d4bb4000fb3" - integrity sha512-aQr/vmOKyBSBHNwYhAoXw1+kUsPnMSwmYgpNoo36rIXoG1ecWILnvPGZeQ6oUjzrWknZAD3+jfpqYOBAl4x15A== - -csv-parse@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/csv-parse/-/csv-parse-6.1.0.tgz#c642ec5b7fc57c1f477a07d179beb5ff0dfd5ed0" - integrity sha512-CEE+jwpgLn+MmtCpVcPtiCZpVtB6Z2OKPTr34pycYYoL7sxdOkXDdQ4lRiw6ioC0q6BLqhc6cKweCVvral8yhw== - -csv-stringify@^6.6.0: - version "6.6.0" - resolved "https://registry.yarnpkg.com/csv-stringify/-/csv-stringify-6.6.0.tgz#d384859cfb71d0a4a73c5bcc36a4daf5440cb033" - integrity sha512-YW32lKOmIBgbxtu3g5SaiqWNwa/9ISQt2EcgOq0+RAIFufFp9is6tqNnKahqE5kuKvrnYAzs28r+s6pXJR8Vcw== - -csv@^6.0.5: - version "6.4.1" - resolved "https://registry.yarnpkg.com/csv/-/csv-6.4.1.tgz#c9a62130c025f8adb2a85a75d4c2608612995822" - integrity sha512-ajGosmTGnTwYyGl8STqZDu7R6LkDf3xL39XiOmliV/GufQeVUxHzTKIm4NOBCwmEuujK7B6isxs4Uqt9GcRCvA== - dependencies: - csv-generate "^4.5.0" - csv-parse "^6.1.0" - csv-stringify "^6.6.0" - stream-transform "^3.4.0" - debug@4.3.3, debug@=4.4.1, debug@^4.3.3, debug@^4.3.4: version "4.4.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.1.tgz#e5a8bc6cbc4c6cd3e64308b0693a3d4fa550189b" @@ -1620,11 +665,6 @@ decamelize@^4.0.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== -decimal.js@^10.4.3: - version "10.6.0" - resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.6.0.tgz#e649a43e3ab953a72192ff5983865e509f37ed9a" - integrity sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg== - deep-eql@^4.1.3: version "4.1.4" resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-4.1.4.tgz#d0d3912865911bb8fac5afb4e3acfa6a28dc72b7" @@ -1632,13 +672,6 @@ deep-eql@^4.1.3: dependencies: type-detect "^4.0.0" -defaults@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.4.tgz#b0b02062c1e2aa62ff5d9528f0f98baa90978d7a" - integrity sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A== - dependencies: - clone "^1.0.2" - define-data-property@^1.0.1, define-data-property@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.4.tgz#894dc141bb7d3060ae4366f6a0107e68fbe48c5e" @@ -1662,16 +695,6 @@ delay@^5.0.0: resolved "https://registry.yarnpkg.com/delay/-/delay-5.0.0.tgz#137045ef1b96e5071060dd5be60bf9334436bd1d" integrity sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw== -depd@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" - integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== - -depd@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" - integrity sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ== - diff@5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" @@ -1699,19 +722,6 @@ dunder-proto@^1.0.1: es-errors "^1.3.0" gopd "^1.2.0" -elliptic@6.6.1, elliptic@^6.5.7: - version "6.6.1" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.6.1.tgz#3b8ffb02670bf69e382c7f65bf524c97c5405c06" - integrity sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g== - dependencies: - bn.js "^4.11.9" - brorand "^1.1.0" - hash.js "^1.0.0" - hmac-drbg "^1.0.1" - inherits "^2.0.4" - minimalistic-assert "^1.0.1" - minimalistic-crypto-utils "^1.0.1" - emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" @@ -1724,15 +734,6 @@ error-ex@=1.3.2: dependencies: is-arrayish "^0.2.1" -error-polyfill@^0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/error-polyfill/-/error-polyfill-0.1.3.tgz#df848b61ad8834f7a5db69a70b9913df86721d15" - integrity sha512-XHJk60ufE+TG/ydwp4lilOog549iiQF2OAPhkk9DdiYWMrltz5yhDz/xnKuenNwP7gy3dsibssO5QpVhkrSzzg== - dependencies: - capability "^0.2.5" - o3 "^1.0.3" - u3 "^0.1.1" - es-define-property@^1.0.0, es-define-property@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.1.tgz#983eb2f9a6724e9303f61addf011c72e09e0b0fa" @@ -1762,34 +763,6 @@ es6-promisify@^5.0.0: dependencies: es6-promise "^4.0.3" -esbuild@^0.17.15: - version "0.17.19" - resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.17.19.tgz#087a727e98299f0462a3d0bcdd9cd7ff100bd955" - integrity sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw== - optionalDependencies: - "@esbuild/android-arm" "0.17.19" - "@esbuild/android-arm64" "0.17.19" - "@esbuild/android-x64" "0.17.19" - "@esbuild/darwin-arm64" "0.17.19" - "@esbuild/darwin-x64" "0.17.19" - "@esbuild/freebsd-arm64" "0.17.19" - "@esbuild/freebsd-x64" "0.17.19" - "@esbuild/linux-arm" "0.17.19" - "@esbuild/linux-arm64" "0.17.19" - "@esbuild/linux-ia32" "0.17.19" - "@esbuild/linux-loong64" "0.17.19" - "@esbuild/linux-mips64el" "0.17.19" - "@esbuild/linux-ppc64" "0.17.19" - "@esbuild/linux-riscv64" "0.17.19" - "@esbuild/linux-s390x" "0.17.19" - "@esbuild/linux-x64" "0.17.19" - "@esbuild/netbsd-x64" "0.17.19" - "@esbuild/openbsd-x64" "0.17.19" - "@esbuild/sunos-x64" "0.17.19" - "@esbuild/win32-arm64" "0.17.19" - "@esbuild/win32-ia32" "0.17.19" - "@esbuild/win32-x64" "0.17.19" - escalade@^3.1.1: version "3.2.0" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5" @@ -1800,47 +773,6 @@ escape-string-regexp@4.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== -escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== - -ethers@^5.5.1: - version "5.8.0" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.8.0.tgz#97858dc4d4c74afce83ea7562fe9493cedb4d377" - integrity sha512-DUq+7fHrCg1aPDFCHx6UIPb3nmt2XMpM7Y/g2gLhsl3lIBqeAfOJIl1qEvRf2uq3BiKxmh6Fh5pfp2ieyek7Kg== - dependencies: - "@ethersproject/abi" "5.8.0" - "@ethersproject/abstract-provider" "5.8.0" - "@ethersproject/abstract-signer" "5.8.0" - "@ethersproject/address" "5.8.0" - "@ethersproject/base64" "5.8.0" - "@ethersproject/basex" "5.8.0" - "@ethersproject/bignumber" "5.8.0" - "@ethersproject/bytes" "5.8.0" - "@ethersproject/constants" "5.8.0" - "@ethersproject/contracts" "5.8.0" - "@ethersproject/hash" "5.8.0" - "@ethersproject/hdnode" "5.8.0" - "@ethersproject/json-wallets" "5.8.0" - "@ethersproject/keccak256" "5.8.0" - "@ethersproject/logger" "5.8.0" - "@ethersproject/networks" "5.8.0" - "@ethersproject/pbkdf2" "5.8.0" - "@ethersproject/properties" "5.8.0" - "@ethersproject/providers" "5.8.0" - "@ethersproject/random" "5.8.0" - "@ethersproject/rlp" "5.8.0" - "@ethersproject/sha2" "5.8.0" - "@ethersproject/signing-key" "5.8.0" - "@ethersproject/solidity" "5.8.0" - "@ethersproject/strings" "5.8.0" - "@ethersproject/transactions" "5.8.0" - "@ethersproject/units" "5.8.0" - "@ethersproject/wallet" "5.8.0" - "@ethersproject/web" "5.8.0" - "@ethersproject/wordlists" "5.8.0" - eventemitter3@^4.0.7: version "4.0.7" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" @@ -1851,11 +783,6 @@ eventemitter3@^5.0.1: resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-5.0.1.tgz#53f5ffd0a492ac800721bb42c66b841de96423c4" integrity sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA== -exponential-backoff@^3.1.0: - version "3.1.3" - resolved "https://registry.yarnpkg.com/exponential-backoff/-/exponential-backoff-3.1.3.tgz#51cf92c1c0493c766053f9d3abee4434c244d2f6" - integrity sha512-ZgEeZXj30q+I0EN+CbSSpIyPaJ5HVQD18Z1m+u1FXbAeT94mr1zw50q4q6jiiC447Nl/YTcIYSAftiGqetwXCA== - eyes@^0.1.8: version "0.1.8" resolved "https://registry.yarnpkg.com/eyes/-/eyes-0.1.8.tgz#62cf120234c683785d902348a800ef3e0cc20bc0" @@ -1866,13 +793,6 @@ fast-stable-stringify@^1.0.0: resolved "https://registry.yarnpkg.com/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz#5c5543462b22aeeefd36d05b34e51c78cb86d313" integrity sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag== -figures@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" - integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg== - dependencies: - escape-string-regexp "^1.0.5" - file-uri-to-path@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" @@ -1898,11 +818,6 @@ flat@^5.0.2: resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== -follow-redirects@^1.14.0, follow-redirects@^1.14.7: - version "1.15.11" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.11.tgz#777d73d72a92f8ec4d2e410eb47352a56b8e8340" - integrity sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ== - for-each@^0.3.5: version "0.3.5" resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.5.tgz#d650688027826920feeb0af747ee7b9421a41d47" @@ -2024,24 +939,6 @@ has-tostringtag@^1.0.2: dependencies: has-symbols "^1.0.3" -hash-base@^3.0.0, hash-base@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.1.2.tgz#79d72def7611c3f6e3c3b5730652638001b10a74" - integrity sha512-Bb33KbowVTIj5s7Ked1OsqHUeCpz//tPwR+E2zJgJKo9Z5XolZ9b6bdUgjmYlwnWhoOQKoTd1TYToZGn5mAYOg== - dependencies: - inherits "^2.0.4" - readable-stream "^2.3.8" - safe-buffer "^5.2.1" - to-buffer "^1.2.1" - -hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3: - version "1.1.7" - resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" - integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== - dependencies: - inherits "^2.0.3" - minimalistic-assert "^1.0.1" - hasown@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" @@ -2054,31 +951,6 @@ he@1.2.0: resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== -hi-base32@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/hi-base32/-/hi-base32-0.5.1.tgz#1279f2ddae2673219ea5870c2121d2a33132857e" - integrity sha512-EmBBpvdYh/4XxsnUybsPag6VikPYnN30td+vQk+GI3qpahVEG9+gTkG0aXVxTjBqQ5T6ijbWIu77O+C5WFWsnA== - -hmac-drbg@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" - integrity sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg== - dependencies: - hash.js "^1.0.3" - minimalistic-assert "^1.0.0" - minimalistic-crypto-utils "^1.0.1" - -http-errors@^1.7.2: - version "1.8.1" - resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.8.1.tgz#7c3f28577cbc8a207388455dbd62295ed07bd68c" - integrity sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g== - dependencies: - depd "~1.1.2" - inherits "2.0.4" - setprototypeof "1.2.0" - statuses ">= 1.5.0 < 2" - toidentifier "1.0.1" - humanize-ms@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed" @@ -2086,14 +958,7 @@ humanize-ms@^1.2.1: dependencies: ms "^2.0.0" -iconv-lite@^0.7.0: - version "0.7.1" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.7.1.tgz#d4af1d2092f2bb05aab6296e5e7cd286d2f15432" - integrity sha512-2Tth85cXwGFHfvRgZWszZSvdo+0Xsqmw8k8ZwxScfcBneNUraK+dxRxRm24nszx80Y0TVio8kKLt5sLE7ZCLlw== - dependencies: - safer-buffer ">= 2.1.2 < 3.0.0" - -ieee754@^1.1.13, ieee754@^1.2.1: +ieee754@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== @@ -2106,32 +971,11 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.3: +inherits@2, inherits@^2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== -inquirer@^8.2.0: - version "8.2.7" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-8.2.7.tgz#62f6b931a9b7f8735dc42db927316d8fb6f71de8" - integrity sha512-UjOaSel/iddGZJ5xP/Eixh6dY1XghiBw4XK13rCCIJcJfyhhoul/7KhLLUGtebEj6GDYM6Vnx/mVsjx2L/mFIA== - dependencies: - "@inquirer/external-editor" "^1.0.0" - ansi-escapes "^4.2.1" - chalk "^4.1.1" - cli-cursor "^3.1.0" - cli-width "^3.0.0" - figures "^3.0.0" - lodash "^4.17.21" - mute-stream "0.0.8" - ora "^5.4.1" - run-async "^2.4.0" - rxjs "^7.5.5" - string-width "^4.1.0" - strip-ansi "^6.0.0" - through "^2.3.6" - wrap-ansi "^6.0.1" - invariant@2.2.4: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" @@ -2197,11 +1041,6 @@ is-glob@^4.0.1, is-glob@~4.0.1: dependencies: is-extglob "^2.1.1" -is-interactive@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-interactive/-/is-interactive-1.0.0.tgz#cea6e6ae5c870a7b0a0004070b7b587e0252912e" - integrity sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w== - is-nan@^1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/is-nan/-/is-nan-1.3.2.tgz#043a54adea31748b55b6cd4e09aadafa69bd9e1d" @@ -2230,7 +1069,7 @@ is-regex@^1.2.1: has-tostringtag "^1.0.2" hasown "^2.0.2" -is-typed-array@^1.1.14, is-typed-array@^1.1.3: +is-typed-array@^1.1.3: version "1.1.15" resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.15.tgz#4bfb4a45b61cee83a5a46fba778e4e8d59c0ce0b" integrity sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ== @@ -2242,16 +1081,6 @@ is-unicode-supported@^0.1.0: resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7" integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== -isarray@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" - integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== - -isarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== - isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" @@ -2280,21 +1109,6 @@ jayson@^4.1.1: uuid "^8.3.2" ws "^7.5.10" -js-sha256@^0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/js-sha256/-/js-sha256-0.9.0.tgz#0b89ac166583e91ef9123644bd3c5334ce9d0966" - integrity sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA== - -js-sha3@0.8.0, js-sha3@^0.8.0: - version "0.8.0" - resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" - integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== - -js-sha512@^0.8.0: - version "0.8.0" - resolved "https://registry.yarnpkg.com/js-sha512/-/js-sha512-0.8.0.tgz#dd22db8d02756faccf19f218e3ed61ec8249f7d4" - integrity sha512-PWsmefG6Jkodqt+ePTvBZCSMFgN7Clckjd0O7su3I0+BW2QWUTJNzjktHsztGLhncP2h8mcF9V9Y2Ha59pAViQ== - "js-tokens@^3.0.0 || ^4.0.0": version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" @@ -2307,13 +1121,6 @@ js-yaml@4.1.0: dependencies: argparse "^2.0.1" -json-bigint@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/json-bigint/-/json-bigint-1.0.0.tgz#ae547823ac0cad8398667f8cd9ef4730f5b01ff1" - integrity sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ== - dependencies: - bignumber.js "^9.0.0" - json-stringify-safe@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" @@ -2326,15 +1133,6 @@ json5@^1.0.2: dependencies: minimist "^1.2.0" -keccak@^3.0.2: - version "3.0.4" - resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.4.tgz#edc09b89e633c0549da444432ecf062ffadee86d" - integrity sha512-3vKuW0jV8J3XNTzvfyicFR5qvxrSAGl7KIhvgOu5cmWwM7tZRj3fMbj/pfIf4be7aznbc+prBWGjywox/g2Y6Q== - dependencies: - node-addon-api "^2.0.0" - node-gyp-build "^4.2.0" - readable-stream "^3.6.0" - locate-path@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" @@ -2342,12 +1140,7 @@ locate-path@^6.0.0: dependencies: p-locate "^5.0.0" -lodash@^4.17.21: - version "4.17.21" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" - integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== - -log-symbols@4.1.0, log-symbols@^4.1.0: +log-symbols@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== @@ -2386,42 +1179,6 @@ math-intrinsics@^1.1.0: resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9" integrity sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g== -md5.js@^1.3.4: - version "1.3.5" - resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" - integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== - dependencies: - hash-base "^3.0.0" - inherits "^2.0.1" - safe-buffer "^5.1.2" - -mime-db@1.52.0: - version "1.52.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" - integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== - -mime-types@^2.1.34: - version "2.1.35" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" - integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== - dependencies: - mime-db "1.52.0" - -mimic-fn@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" - integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== - -minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" - integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== - -minimalistic-crypto-utils@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" - integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg== - minimatch@4.2.1: version "4.2.1" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-4.2.1.tgz#40d9d511a46bdc4e563c22c3080cde9c0d8299b4" @@ -2483,65 +1240,11 @@ ms@2.1.3, ms@^2.0.0, ms@^2.1.3: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== -multistream@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/multistream/-/multistream-4.1.0.tgz#7bf00dfd119556fbc153cff3de4c6d477909f5a8" - integrity sha512-J1XDiAmmNpRCBfIWJv+n0ymC4ABcf/Pl+5YvC5B/D2f/2+8PtHvCNxMPKiQcZyi922Hq69J2YOpb1pTywfifyw== - dependencies: - once "^1.4.0" - readable-stream "^3.6.0" - -mustache@^4.0.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/mustache/-/mustache-4.2.0.tgz#e5892324d60a12ec9c2a73359edca52972bf6f64" - integrity sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ== - -mute-stream@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" - integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== - nanoid@3.3.1: version "3.3.1" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.1.tgz#6347a18cac88af88f58af0b3594b723d5e99bb35" integrity sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw== -near-api-js@^0.44.2: - version "0.44.2" - resolved "https://registry.yarnpkg.com/near-api-js/-/near-api-js-0.44.2.tgz#e451f68f2c56bd885c7b918db5818a3e6e9423d0" - integrity sha512-eMnc4V+geggapEUa3nU2p8HSHn/njtloI4P2mceHQWO8vDE1NGpnAw8FuTBrLmXSgIv9m6oocgFc9t3VNf5zwg== - dependencies: - bn.js "5.2.0" - borsh "^0.6.0" - bs58 "^4.0.0" - depd "^2.0.0" - error-polyfill "^0.1.3" - http-errors "^1.7.2" - js-sha256 "^0.9.0" - mustache "^4.0.0" - node-fetch "^2.6.1" - text-encoding-utf-8 "^1.0.2" - tweetnacl "^1.0.1" - -near-hd-key@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/near-hd-key/-/near-hd-key-1.2.1.tgz#f508ff15436cf8a439b543220f3cc72188a46756" - integrity sha512-SIrthcL5Wc0sps+2e1xGj3zceEa68TgNZDLuCx0daxmfTP7sFTB3/mtE2pYhlFsCxWoMn+JfID5E1NlzvvbRJg== - dependencies: - bip39 "3.0.2" - create-hmac "1.1.7" - tweetnacl "1.0.3" - -near-seed-phrase@^0.2.0: - version "0.2.1" - resolved "https://registry.yarnpkg.com/near-seed-phrase/-/near-seed-phrase-0.2.1.tgz#7d5b54d5e836d295f10b0bdfdae9086443651d20" - integrity sha512-feMuums+kVL3LSuPcP4ld07xHCb2mu6z48SGfP3W+8tl1Qm5xIcjiQzY2IDPBvFgajRDxWSb8GzsRHoInazByw== - dependencies: - bip39-light "^1.0.7" - bs58 "^4.0.1" - near-hd-key "^1.2.1" - tweetnacl "^1.0.2" - no-case@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/no-case/-/no-case-3.0.4.tgz#d361fd5c9800f558551a8369fc0dcd4662b6124d" @@ -2550,24 +1253,14 @@ no-case@^3.0.4: lower-case "^2.0.2" tslib "^2.0.3" -node-addon-api@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-2.0.2.tgz#432cfa82962ce494b132e9d72a15b29f71ff5d32" - integrity sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA== - -node-addon-api@^5.0.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-5.1.0.tgz#49da1ca055e109a23d537e9de43c09cca21eb762" - integrity sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA== - -node-fetch@^2.6.1, node-fetch@^2.6.7, node-fetch@^2.7.0: +node-fetch@^2.7.0: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== dependencies: whatwg-url "^5.0.0" -node-gyp-build@^4.2.0, node-gyp-build@^4.3.0: +node-gyp-build@^4.3.0: version "4.8.4" resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.8.4.tgz#8a70ee85464ae52327772a90d66c6077a900cfc8" integrity sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ== @@ -2577,13 +1270,6 @@ normalize-path@^3.0.0, normalize-path@~3.0.0: resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== -o3@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/o3/-/o3-1.0.3.tgz#192ce877a882dfa6751f0412a865fafb2da1dac0" - integrity sha512-f+4n+vC6s4ysy7YO7O2gslWZBUu8Qj2i2OUJOvjRxQva7jVjYjB29jrr9NCjmxZQR0gzrOcv1RnqoYOeMs5VRQ== - dependencies: - capability "^0.2.5" - object-is@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.1.6.tgz#1a6a53aed2dd8f7e6775ff870bea58545956ab07" @@ -2609,35 +1295,13 @@ object.assign@^4.1.4: has-symbols "^1.1.0" object-keys "^1.1.1" -once@^1.3.0, once@^1.4.0: +once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== dependencies: wrappy "1" -onetime@^5.1.0: - version "5.1.2" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" - integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== - dependencies: - mimic-fn "^2.1.0" - -ora@^5.4.1: - version "5.4.1" - resolved "https://registry.yarnpkg.com/ora/-/ora-5.4.1.tgz#1b2678426af4ac4a509008e5e4ac9e9959db9e18" - integrity sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ== - dependencies: - bl "^4.1.0" - chalk "^4.1.0" - cli-cursor "^3.1.0" - cli-spinners "^2.5.0" - is-interactive "^1.0.0" - is-unicode-supported "^0.1.0" - log-symbols "^4.1.0" - strip-ansi "^6.0.0" - wcwidth "^1.0.1" - p-limit@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" @@ -2672,18 +1336,6 @@ pathval@^1.1.1: resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d" integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ== -pbkdf2@^3.0.9: - version "3.1.5" - resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.5.tgz#444a59d7a259a95536c56e80c89de31cc01ed366" - integrity sha512-Q3CG/cYvCO1ye4QKkuH7EXxs3VC/rI1/trd+qX2+PolbaKG0H+bgcZzrTt96mMyRtejk+JMCiLUn3y29W8qmFQ== - dependencies: - create-hash "^1.2.0" - create-hmac "^1.1.7" - ripemd160 "^2.0.3" - safe-buffer "^5.2.1" - sha.js "^2.4.12" - to-buffer "^1.2.1" - picomatch@^2.0.4, picomatch@^2.2.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" @@ -2699,45 +1351,13 @@ prettier@3.6.2: resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.6.2.tgz#ccda02a1003ebbb2bfda6f83a074978f608b9393" integrity sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ== -process-nextick-args@~2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" - integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== - -process@^0.11.10: - version "0.11.10" - resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182" - integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== - -randombytes@^2.0.1, randombytes@^2.1.0: +randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== dependencies: safe-buffer "^5.1.0" -readable-stream@^2.3.8: - version "2.3.8" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b" - integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~2.0.0" - safe-buffer "~5.1.1" - string_decoder "~1.1.1" - util-deprecate "~1.0.1" - -readable-stream@^3.4.0, readable-stream@^3.6.0: - version "3.6.2" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" - integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== - dependencies: - inherits "^2.0.3" - string_decoder "^1.1.1" - util-deprecate "^1.0.1" - readdirp@~3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" @@ -2750,27 +1370,6 @@ require-directory@^2.1.1: resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== -restore-cursor@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" - integrity sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA== - dependencies: - onetime "^5.1.0" - signal-exit "^3.0.2" - -retry@0.13.1: - version "0.13.1" - resolved "https://registry.yarnpkg.com/retry/-/retry-0.13.1.tgz#185b1587acf67919d63b357349e03537b2484658" - integrity sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg== - -ripemd160@^2.0.0, ripemd160@^2.0.1, ripemd160@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.3.tgz#9be54e4ba5e3559c8eee06a25cd7648bbccdf5a8" - integrity sha512-5Di9UC0+8h1L6ZD2d7awM7E/T4uA1fJRlx6zk/NvdCCVEoAnFqvHmCuNeIKoCeIixBX/q8uM+6ycDvF8woqosA== - dependencies: - hash-base "^3.1.2" - inherits "^2.0.4" - rpc-websockets@^9.0.2: version "9.3.2" resolved "https://registry.yarnpkg.com/rpc-websockets/-/rpc-websockets-9.3.2.tgz#26b4d7ebaf8e53422528619a3c314e83590d85bf" @@ -2787,28 +1386,11 @@ rpc-websockets@^9.0.2: bufferutil "^4.0.1" utf-8-validate "^5.0.2" -run-async@^2.4.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.1.tgz#8440eccf99ea3e70bd409d49aab88e10c189a455" - integrity sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ== - -rxjs@^7.5.5: - version "7.8.2" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.2.tgz#955bc473ed8af11a002a2be52071bf475638607b" - integrity sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA== - dependencies: - tslib "^2.1.0" - -safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.2, safe-buffer@^5.2.1, safe-buffer@~5.2.0: +safe-buffer@^5.0.1, safe-buffer@^5.1.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== -safe-buffer@~5.1.0, safe-buffer@~5.1.1: - version "5.1.2" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" - integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== - safe-regex-test@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.1.0.tgz#7f87dfb67a3150782eaaf18583ff5d1711ac10c1" @@ -2818,25 +1400,6 @@ safe-regex-test@^1.1.0: es-errors "^1.3.0" is-regex "^1.2.1" -"safer-buffer@>= 2.1.2 < 3.0.0", safer-buffer@^2.1.0: - version "2.1.2" - resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" - integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== - -scrypt-js@3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" - integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== - -secp256k1@^4.0.2: - version "4.0.4" - resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-4.0.4.tgz#58f0bfe1830fe777d9ca1ffc7574962a8189f8ab" - integrity sha512-6JfvwvjUOn8F/jUoBY2Q1v5WY5XS+rj8qSe0v8Y4ezH4InLgTEeOOPQsRll9OV429Pvo6BCHGavIyJfr3TAhsw== - dependencies: - elliptic "^6.5.7" - node-addon-api "^5.0.0" - node-gyp-build "^4.2.0" - serialize-javascript@6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" @@ -2856,25 +1419,6 @@ set-function-length@^1.2.2: gopd "^1.0.1" has-property-descriptors "^1.0.2" -setprototypeof@1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" - integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== - -sha.js@^2.4.0, sha.js@^2.4.12, sha.js@^2.4.8: - version "2.4.12" - resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.12.tgz#eb8b568bf383dfd1867a32c3f2b74eb52bdbf23f" - integrity sha512-8LzC5+bvI45BjpfXU8V5fdU2mfeKiQe1D1gIMn7XUlF3OTUrpdJpPPH4EMAnF0DsHHdSZqCdSss5qCmJKuiO3w== - dependencies: - inherits "^2.0.4" - safe-buffer "^5.2.1" - to-buffer "^1.2.0" - -signal-exit@^3.0.2: - version "3.0.7" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" - integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== - simple-swizzle@=0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" @@ -2958,11 +1502,6 @@ spl-token-bankrun@0.2.3: "@solana/spl-token" "^0.3.8" solana-bankrun "^0.2.0" -"statuses@>= 1.5.0 < 2": - version "1.5.0" - resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" - integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA== - stream-chain@^2.2.5: version "2.2.5" resolved "https://registry.yarnpkg.com/stream-chain/-/stream-chain-2.2.5.tgz#b30967e8f14ee033c5b9a19bbe8a2cba90ba0d09" @@ -2975,11 +1514,6 @@ stream-json@^1.9.1: dependencies: stream-chain "^2.2.5" -stream-transform@^3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/stream-transform/-/stream-transform-3.4.0.tgz#38d562fbdad38c3b6cda959ad36751014bb26e18" - integrity sha512-QO3OGhKyeIV8p6eRQdG+W6WounFw519zk690hHCNfhgfP9bylVS+NTXsuBc7n+RsGn31UgFPGrWYIgoAbArKEw== - string-width@^4.1.0, string-width@^4.2.0: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" @@ -2989,20 +1523,6 @@ string-width@^4.1.0, string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" -string_decoder@^1.1.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== - dependencies: - safe-buffer "~5.2.0" - -string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" - integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== - dependencies: - safe-buffer "~5.1.0" - strip-ansi@=6.0.1, strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" @@ -3050,32 +1570,6 @@ text-encoding-utf-8@^1.0.2: resolved "https://registry.yarnpkg.com/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz#585b62197b0ae437e3c7b5d0af27ac1021e10d13" integrity sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg== -through@^2.3.6: - version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" - integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== - -tmp-promise@^3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/tmp-promise/-/tmp-promise-3.0.3.tgz#60a1a1cc98c988674fcbfd23b6e3367bdeac4ce7" - integrity sha512-RwM7MoPojPxsOBYnyd2hy0bxtIlVrihNs9pj5SUvY8Zz1sQcQG2tG1hSr8PDxfgEB8RNKDhqbIlroIarSNDNsQ== - dependencies: - tmp "^0.2.0" - -tmp@^0.2.0: - version "0.2.5" - resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.5.tgz#b06bcd23f0f3c8357b426891726d16015abfd8f8" - integrity sha512-voyz6MApa1rQGUxT3E+BK7/ROe8itEx7vD8/HEvt4xwXucvQ5G5oeEiHkmHZJuBO21RpOf+YYm9MOivj709jow== - -to-buffer@^1.2.0, to-buffer@^1.2.1, to-buffer@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/to-buffer/-/to-buffer-1.2.2.tgz#ffe59ef7522ada0a2d1cb5dfe03bb8abc3cdc133" - integrity sha512-db0E3UJjcFhpDhAF4tLo03oli3pwl3dbnzXOUIlRKrp+ldk/VUxzpWYZENsw2SZiuBjHAk7DfB0VU7NKdpb6sw== - dependencies: - isarray "^2.0.5" - safe-buffer "^5.2.1" - typed-array-buffer "^1.0.3" - to-regex-range@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" @@ -3083,11 +1577,6 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" -toidentifier@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" - integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== - toml@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/toml/-/toml-3.0.0.tgz#342160f1af1904ec9d204d03a5d61222d762c5ee" @@ -3131,45 +1620,21 @@ tsconfig-paths@^3.5.0: minimist "^1.2.6" strip-bom "^3.0.0" -tslib@^2.0.3, tslib@^2.1.0, tslib@^2.8.0: +tslib@^2.0.3, tslib@^2.8.0: version "2.8.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== -tweetnacl@1.0.3, tweetnacl@^1.0.1, tweetnacl@^1.0.2, tweetnacl@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596" - integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw== - type-detect@^4.0.0, type-detect@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.1.0.tgz#deb2453e8f08dcae7ae98c626b13dddb0155906c" integrity sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw== -type-fest@^0.21.3: - version "0.21.3" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" - integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== - -typed-array-buffer@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz#a72395450a4869ec033fd549371b47af3a2ee536" - integrity sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw== - dependencies: - call-bound "^1.0.3" - es-errors "^1.3.0" - is-typed-array "^1.1.14" - -typescript@^5.5.5: +typescript@5.9.3: version "5.9.3" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.3.tgz#5b4f59e15310ab17a216f5d6cf53ee476ede670f" integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw== -u3@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/u3/-/u3-0.1.1.tgz#5f52044f42ee76cd8de33148829e14528494b73b" - integrity sha512-+J5D5ir763y+Am/QY6hXNRlwljIeRMZMGs0cT6qqZVVzzT3X3nFPXVyPOFRMOR4kupB0T8JnCdpWdp6Q/iXn3w== - undici-types@~7.16.0: version "7.16.0" resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.16.0.tgz#ffccdff36aea4884cbfce9a750a0580224f58a46" @@ -3182,11 +1647,6 @@ utf-8-validate@^5.0.2: dependencies: node-gyp-build "^4.3.0" -util-deprecate@^1.0.1, util-deprecate@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== - util@^0.12.5: version "0.12.5" resolved "https://registry.yarnpkg.com/util/-/util-0.12.5.tgz#5f17a6059b73db61a875668781a1c2b136bd6fbc" @@ -3203,18 +1663,6 @@ uuid@^8.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== -vlq@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/vlq/-/vlq-2.0.4.tgz#6057b85729245b9829e3cc7755f95b228d4fe041" - integrity sha512-aodjPa2wPQFkra1G8CzJBTHXhgk3EVSwxSWXNPr1fgdFLUb8kvLV1iEb6rFgasIsjP82HWI6dsb5Io26DDnasA== - -wcwidth@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" - integrity sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg== - dependencies: - defaults "^1.0.3" - webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" @@ -3253,7 +1701,7 @@ workerpool@6.2.0: resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.0.tgz#827d93c9ba23ee2019c3ffaff5c27fccea289e8b" integrity sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A== -wrap-ansi@=7.0.0, wrap-ansi@^6.0.1, wrap-ansi@^7.0.0: +wrap-ansi@=7.0.0, wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -3267,11 +1715,6 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== -ws@8.18.0: - version "8.18.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" - integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== - ws@^7.5.10: version "7.5.10" resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.10.tgz#58b5c20dc281633f6c19113f39b349bd8bd558d9" diff --git a/tests/bidWall/main.test.ts b/tests/bidWall/main.test.ts index 2c5a5e985..d288af7d7 100644 --- a/tests/bidWall/main.test.ts +++ b/tests/bidWall/main.test.ts @@ -5,9 +5,9 @@ import closeBidWall from "./unit/closeBidWall.test.js"; import cancelBidWall from "./unit/cancelBidWall.test.js"; import { PublicKey } from "@solana/web3.js"; import { - LAUNCHPAD_PROGRAM_ID, - MAINNET_METEORA_CONFIG, -} from "@metadaoproject/futarchy/v0.7"; + LAUNCHPAD_V0_7_PROGRAM_ID, + LAUNCHPAD_V0_7_MAINNET_METEORA_CONFIG, +} from "@metadaoproject/programs"; export default function suite() { before(async function () { @@ -22,7 +22,7 @@ export default function suite() { const [poolCreatorAuthority] = PublicKey.findProgramAddressSync( [Buffer.from("damm_pool_creator_authority")], - LAUNCHPAD_PROGRAM_ID, + LAUNCHPAD_V0_7_PROGRAM_ID, ); dynamicConfig.data.set( @@ -31,7 +31,10 @@ export default function suite() { ); dynamicConfig.data.set([1], configTypeOffset); - this.context.setAccount(MAINNET_METEORA_CONFIG, dynamicConfig); + this.context.setAccount( + LAUNCHPAD_V0_7_MAINNET_METEORA_CONFIG, + dynamicConfig, + ); }); describe("#initialize_bid_wall", initializeBidWall); describe("#sell_tokens", sellTokens); diff --git a/tests/bidWall/unit/cancelBidWall.test.ts b/tests/bidWall/unit/cancelBidWall.test.ts index 099c9abde..25705adb6 100644 --- a/tests/bidWall/unit/cancelBidWall.test.ts +++ b/tests/bidWall/unit/cancelBidWall.test.ts @@ -13,7 +13,7 @@ import { MAINNET_USDC, getBidWallAddr, METADAO_MULTISIG_VAULT, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { BN } from "bn.js"; import { createAssociatedTokenAccountIdempotentInstruction, @@ -83,6 +83,7 @@ export default function suite() { performancePackageTokenAmount: new BN(10), // Effectively no premine monthsUntilInsidersCanUnlock: 24, // 2 years teamAddress: PublicKey.default, + hasBidWall: true, }) .rpc(); @@ -137,7 +138,6 @@ export default function suite() { dao = launchAccount.dao; daoTreasury = launchAccount.daoVault; - let ammBaseVaultReserves = new BN(await this.getTokenBalance(META, dao)); let ammQuoteVaultReserves = new BN( await this.getTokenBalance(MAINNET_USDC, dao), ); diff --git a/tests/bidWall/unit/closeBidWall.test.ts b/tests/bidWall/unit/closeBidWall.test.ts index d424aba58..81ebbb718 100644 --- a/tests/bidWall/unit/closeBidWall.test.ts +++ b/tests/bidWall/unit/closeBidWall.test.ts @@ -14,7 +14,7 @@ import { MAINNET_USDC, getBidWallAddr, METADAO_MULTISIG_VAULT, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { BN } from "bn.js"; import { getAssociatedTokenAddressSync } from "@solana/spl-token"; import { initializeMintWithSeeds } from "../utils.js"; @@ -82,6 +82,7 @@ export default function suite() { performancePackageTokenAmount: new BN(10), // Effectively no premine monthsUntilInsidersCanUnlock: 24, // 2 years teamAddress: PublicKey.default, + hasBidWall: true, }) .rpc(); @@ -136,7 +137,6 @@ export default function suite() { dao = launchAccount.dao; daoTreasury = launchAccount.daoVault; - let ammBaseVaultReserves = new BN(await this.getTokenBalance(META, dao)); let ammQuoteVaultReserves = new BN( await this.getTokenBalance(MAINNET_USDC, dao), ); diff --git a/tests/bidWall/unit/collectFees.test.ts b/tests/bidWall/unit/collectFees.test.ts index 1e554a03e..6a2e0a7c9 100644 --- a/tests/bidWall/unit/collectFees.test.ts +++ b/tests/bidWall/unit/collectFees.test.ts @@ -13,7 +13,7 @@ import { MAINNET_USDC, getBidWallAddr, METADAO_MULTISIG_VAULT, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { BN } from "bn.js"; import { getAssociatedTokenAddressSync, @@ -82,6 +82,7 @@ export default function suite() { performancePackageTokenAmount: new BN(10), // Effectively no premine monthsUntilInsidersCanUnlock: 24, // 2 years teamAddress: PublicKey.default, + hasBidWall: false, }) .rpc(); diff --git a/tests/bidWall/unit/initializeBidWall.test.ts b/tests/bidWall/unit/initializeBidWall.test.ts index 336e58399..bdd212eaa 100644 --- a/tests/bidWall/unit/initializeBidWall.test.ts +++ b/tests/bidWall/unit/initializeBidWall.test.ts @@ -12,7 +12,7 @@ import { MAINNET_USDC, getBidWallAddr, METADAO_MULTISIG_VAULT, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import BN from "bn.js"; import { getAssociatedTokenAddressSync } from "@solana/spl-token"; import { initializeMintWithSeeds } from "../utils.js"; @@ -81,6 +81,7 @@ export default function suite() { performancePackageTokenAmount: new BN(10), // Effectively no premine monthsUntilInsidersCanUnlock: 24, // 2 years teamAddress: PublicKey.default, + hasBidWall: false, }) .rpc(); diff --git a/tests/bidWall/unit/sellTokens.test.ts b/tests/bidWall/unit/sellTokens.test.ts index ed3148bb7..2e47265a1 100644 --- a/tests/bidWall/unit/sellTokens.test.ts +++ b/tests/bidWall/unit/sellTokens.test.ts @@ -12,7 +12,7 @@ import { BidWallClient, MAINNET_USDC, getBidWallAddr, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import BN from "bn.js"; import { getAssociatedTokenAddressSync } from "@solana/spl-token"; import { initializeMintWithSeeds } from "../utils.js"; @@ -78,6 +78,7 @@ export default function suite() { performancePackageTokenAmount: new BN(10), // Effectively no premine monthsUntilInsidersCanUnlock: 24, // 2 years teamAddress: PublicKey.default, + hasBidWall: false, }) .rpc(); diff --git a/tests/bidWall/utils.ts b/tests/bidWall/utils.ts index 45fef8cb8..fe2f8ce47 100644 --- a/tests/bidWall/utils.ts +++ b/tests/bidWall/utils.ts @@ -1,11 +1,11 @@ import { PublicKey, Signer, SystemProgram, Transaction } from "@solana/web3.js"; import * as token from "@solana/spl-token"; import { BanksClient } from "solana-bankrun"; -import { LaunchpadClient } from "@metadaoproject/futarchy/v0.7"; import { + LaunchpadClient, getLaunchAddr, getLaunchSignerAddr, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; export async function initializeMintWithSeeds( banksClient: BanksClient, diff --git a/tests/conditionalVault/integration/binaryPredictionMarket.test.ts b/tests/conditionalVault/integration/binaryPredictionMarket.test.ts index 51c24da35..6ae01d2fe 100644 --- a/tests/conditionalVault/integration/binaryPredictionMarket.test.ts +++ b/tests/conditionalVault/integration/binaryPredictionMarket.test.ts @@ -1,5 +1,4 @@ -import { ConditionalVaultClient } from "@metadaoproject/futarchy/v0.6"; -import { sha256 } from "@metadaoproject/futarchy"; +import { ConditionalVaultClient, sha256 } from "@metadaoproject/programs"; import { Keypair, PublicKey } from "@solana/web3.js"; import BN from "bn.js"; diff --git a/tests/conditionalVault/integration/multiOptionPredictionMarket.test.ts b/tests/conditionalVault/integration/multiOptionPredictionMarket.test.ts index eba8424cf..ecb79398b 100644 --- a/tests/conditionalVault/integration/multiOptionPredictionMarket.test.ts +++ b/tests/conditionalVault/integration/multiOptionPredictionMarket.test.ts @@ -1,4 +1,4 @@ -import { ConditionalVaultClient, sha256 } from "@metadaoproject/futarchy"; +import { ConditionalVaultClient, sha256 } from "@metadaoproject/programs"; import { Keypair, PublicKey } from "@solana/web3.js"; import BN from "bn.js"; diff --git a/tests/conditionalVault/integration/scalarGrantMarket.test.ts b/tests/conditionalVault/integration/scalarGrantMarket.test.ts index 373d0055b..9e81bcb84 100644 --- a/tests/conditionalVault/integration/scalarGrantMarket.test.ts +++ b/tests/conditionalVault/integration/scalarGrantMarket.test.ts @@ -1,4 +1,4 @@ -import { ConditionalVaultClient, sha256 } from "@metadaoproject/futarchy"; +import { ConditionalVaultClient, sha256 } from "@metadaoproject/programs"; import { Keypair, PublicKey } from "@solana/web3.js"; import BN from "bn.js"; diff --git a/tests/conditionalVault/unit.ts b/tests/conditionalVault/unit.ts index dc732c775..f016a4c05 100644 --- a/tests/conditionalVault/unit.ts +++ b/tests/conditionalVault/unit.ts @@ -25,15 +25,15 @@ const { PublicKey, Keypair } = web3; import { ConditionalVault, IDL as ConditionalVaultIDL, -} from "../../target/types/conditional_vault"; +} from "../../target/types/conditional_vault.js"; import { - CONDITIONAL_VAULT_PROGRAM_ID, + CONDITIONAL_VAULT_V0_4_PROGRAM_ID, ConditionalVaultClient, getConditionalTokenMintAddr, getQuestionAddr, getVaultAddr, sha256, -} from "@metadaoproject/futarchy"; +} from "@metadaoproject/programs"; export type VaultProgram = anchor.Program; export type PublicKey = anchor.web3.PublicKey; @@ -97,7 +97,7 @@ describe("conditional_vault", async function () { vaultProgram = new Program( ConditionalVaultIDL, - CONDITIONAL_VAULT_PROGRAM_ID, + CONDITIONAL_VAULT_V0_4_PROGRAM_ID, provider, ); @@ -463,7 +463,7 @@ describe("conditional_vault", async function () { ).then((acc) => acc.amount); await vaultClient - .redeemTokensIx(question, vault, underlyingTokenMint, new BN(600), 2) + .redeemTokensIx(question, vault, underlyingTokenMint, 2) .rpc(); const balanceAfter = await getAccount( diff --git a/tests/conditionalVault/unit/addMetadataToConditionalTokens.test.ts b/tests/conditionalVault/unit/addMetadataToConditionalTokens.test.ts index d14112fb9..870cb6ec0 100644 --- a/tests/conditionalVault/unit/addMetadataToConditionalTokens.test.ts +++ b/tests/conditionalVault/unit/addMetadataToConditionalTokens.test.ts @@ -1,9 +1,9 @@ -import { sha256 } from "@metadaoproject/futarchy"; import { + sha256, ConditionalVaultClient, getConditionalTokenMintAddr, getMetadataAddr, -} from "@metadaoproject/futarchy/v0.5"; +} from "@metadaoproject/programs"; import { Keypair, PublicKey } from "@solana/web3.js"; import { assert } from "chai"; import { createMint } from "spl-token-bankrun"; diff --git a/tests/conditionalVault/unit/initializeConditionalVault.test.ts b/tests/conditionalVault/unit/initializeConditionalVault.test.ts index 98cc0c9f8..5587801c6 100644 --- a/tests/conditionalVault/unit/initializeConditionalVault.test.ts +++ b/tests/conditionalVault/unit/initializeConditionalVault.test.ts @@ -2,8 +2,8 @@ import { ConditionalVaultClient, getVaultAddr, getConditionalTokenMintAddr, -} from "@metadaoproject/futarchy/v0.5"; -import { sha256 } from "@metadaoproject/futarchy"; + sha256, +} from "@metadaoproject/programs"; import { Keypair, PublicKey } from "@solana/web3.js"; import { assert } from "chai"; import { createMint, getMint } from "spl-token-bankrun"; diff --git a/tests/conditionalVault/unit/initializeQuestion.test.ts b/tests/conditionalVault/unit/initializeQuestion.test.ts index d46585c50..62aa304dc 100644 --- a/tests/conditionalVault/unit/initializeQuestion.test.ts +++ b/tests/conditionalVault/unit/initializeQuestion.test.ts @@ -1,13 +1,13 @@ -import { sha256 } from "@metadaoproject/futarchy"; -// const { ConditionalVaultClient, getQuestionAddr } = futarchy; -import { Keypair } from "@solana/web3.js"; -import { assert } from "chai"; -import { expectError } from "../../utils"; import { + sha256, ConditionalVaultClient, getQuestionAddr, -} from "@metadaoproject/futarchy/v0.5"; -// import { getQuestionAddr } from "@metadaoproject/futarchy/dist/v0.4"; +} from "@metadaoproject/programs"; +// const { ConditionalVaultClient, getQuestionAddr } = futarchy; +import { Keypair } from "@solana/web3.js"; +import { assert } from "chai"; +import { expectError } from "../../utils.js"; +// import { getQuestionAddr } from "@metadaoproject/programs/dist/v0.4"; export default function suite() { let vaultClient: ConditionalVaultClient; diff --git a/tests/conditionalVault/unit/mergeTokens.test.ts b/tests/conditionalVault/unit/mergeTokens.test.ts index 9e609b763..fd54c5796 100644 --- a/tests/conditionalVault/unit/mergeTokens.test.ts +++ b/tests/conditionalVault/unit/mergeTokens.test.ts @@ -1,5 +1,4 @@ -import { sha256 } from "@metadaoproject/futarchy"; -import { ConditionalVaultClient } from "@metadaoproject/futarchy/v0.5"; +import { sha256, ConditionalVaultClient } from "@metadaoproject/programs"; import { ComputeBudgetProgram, Keypair, PublicKey } from "@solana/web3.js"; import { assert } from "chai"; import { diff --git a/tests/conditionalVault/unit/redeemTokens.test.ts b/tests/conditionalVault/unit/redeemTokens.test.ts index 52850abd5..15576522a 100644 --- a/tests/conditionalVault/unit/redeemTokens.test.ts +++ b/tests/conditionalVault/unit/redeemTokens.test.ts @@ -1,5 +1,4 @@ -import { sha256 } from "@metadaoproject/futarchy"; -import { ConditionalVaultClient } from "@metadaoproject/futarchy/v0.5"; +import { sha256, ConditionalVaultClient } from "@metadaoproject/programs"; import { ComputeBudgetProgram, Keypair, PublicKey } from "@solana/web3.js"; import { assert } from "chai"; import { diff --git a/tests/conditionalVault/unit/resolveQuestion.test.ts b/tests/conditionalVault/unit/resolveQuestion.test.ts index 3fa0fba42..677fb735c 100644 --- a/tests/conditionalVault/unit/resolveQuestion.test.ts +++ b/tests/conditionalVault/unit/resolveQuestion.test.ts @@ -1,5 +1,4 @@ -import { sha256 } from "@metadaoproject/futarchy"; -import { ConditionalVaultClient } from "@metadaoproject/futarchy/v0.5"; +import { sha256, ConditionalVaultClient } from "@metadaoproject/programs"; import { Keypair, PublicKey } from "@solana/web3.js"; import { assert } from "chai"; import { expectError } from "../../utils.js"; diff --git a/tests/conditionalVault/unit/splitTokens.test.ts b/tests/conditionalVault/unit/splitTokens.test.ts index 65ab5e9f3..28160329c 100644 --- a/tests/conditionalVault/unit/splitTokens.test.ts +++ b/tests/conditionalVault/unit/splitTokens.test.ts @@ -1,5 +1,4 @@ -import { sha256 } from "@metadaoproject/futarchy"; -import { ConditionalVaultClient } from "@metadaoproject/futarchy/v0.5"; +import { sha256, ConditionalVaultClient } from "@metadaoproject/programs"; import { ComputeBudgetProgram, Keypair, PublicKey } from "@solana/web3.js"; import { assert } from "chai"; import { getMint } from "spl-token-bankrun"; @@ -38,7 +37,7 @@ export default function suite() { underlyingTokenMint, this.payer.publicKey, this.payer, - 10_000_000_000n, + 10_000_000_000, ); }); diff --git a/tests/futarchy/integration/fullProposal.test.ts b/tests/futarchy/integration/fullProposal.test.ts index 01ba873dd..9c065a80b 100644 --- a/tests/futarchy/integration/fullProposal.test.ts +++ b/tests/futarchy/integration/fullProposal.test.ts @@ -1,4 +1,6 @@ -import { getDaoAddr } from "@metadaoproject/futarchy/v0.5"; +// @ts-nocheck +// TODO: fix this test and remove the @ts-nocheck +import { getDaoAddr, PERMISSIONLESS_ACCOUNT } from "@metadaoproject/programs"; import { ComputeBudgetProgram, SystemProgram, @@ -7,7 +9,6 @@ import { } from "@solana/web3.js"; import BN from "bn.js"; import * as multisig from "@sqds/multisig"; -import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/futarchy/v0.5"; import { ONE_MINUTE_IN_SLOTS } from "../../utils.js"; export default function suite() { diff --git a/tests/futarchy/integration/futarchyAmm.test.ts b/tests/futarchy/integration/futarchyAmm.test.ts index 2325f8469..b74c7ede8 100644 --- a/tests/futarchy/integration/futarchyAmm.test.ts +++ b/tests/futarchy/integration/futarchyAmm.test.ts @@ -1,7 +1,8 @@ import { PERMISSIONLESS_ACCOUNT, PriceMath, -} from "@metadaoproject/futarchy/v0.6"; + METADAO_MULTISIG_VAULT, +} from "@metadaoproject/programs"; import { ComputeBudgetProgram, PublicKey, @@ -16,7 +17,6 @@ import BN from "bn.js"; import { setupBasicDao } from "../../utils.js"; import { assert } from "chai"; import * as multisig from "@sqds/multisig"; -import { METADAO_MULTISIG_VAULT } from "../../../sdk/src/v0.6/constants.js"; const { Permissions, Permission } = multisig.types; const THOUSAND_BUCK_PRICE = PriceMath.getAmmPrice(1000, 9, 6); @@ -81,6 +81,7 @@ export default function suite() { twapStartDelaySeconds: null, teamSponsoredPassThresholdBps: null, teamAddress: null, + isOptimisticGovernanceEnabled: null, }, }) .instruction(); @@ -140,7 +141,7 @@ export default function suite() { it("futarchy amm", async function () { // Get initial state before spot swap (before launching proposal) const daoBeforeSpotSwap = - await this.futarchy.autocrat.account.dao.fetch(dao); + await this.futarchy.futarchy.account.dao.fetch(dao); const initialUserBaseBalance = await this.getTokenBalance( META, @@ -166,7 +167,7 @@ export default function suite() { // Get state after spot swap const daoAfterSpotSwap = - await this.futarchy.autocrat.account.dao.fetch(dao); + await this.futarchy.futarchy.account.dao.fetch(dao); const finalUserBaseBalance = await this.getTokenBalance( META, diff --git a/tests/futarchy/integration/proposalBatchTx.test.ts b/tests/futarchy/integration/proposalBatchTx.test.ts index 91b2889ee..ffae04507 100644 --- a/tests/futarchy/integration/proposalBatchTx.test.ts +++ b/tests/futarchy/integration/proposalBatchTx.test.ts @@ -1,4 +1,6 @@ -import { getDaoAddr } from "@metadaoproject/futarchy/v0.5"; +// @ts-nocheck +// TODO: fix this test and remove the @ts-nocheck +import { getDaoAddr, PERMISSIONLESS_ACCOUNT } from "@metadaoproject/programs"; import { ComputeBudgetProgram, SystemProgram, @@ -7,7 +9,6 @@ import { } from "@solana/web3.js"; import BN from "bn.js"; import * as multisig from "@sqds/multisig"; -import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/futarchy/v0.5"; import { ONE_MINUTE_IN_SLOTS } from "../../utils.js"; export default function suite() { diff --git a/tests/futarchy/main.test.ts b/tests/futarchy/main.test.ts index 022cd7eab..ee37f0ec5 100644 --- a/tests/futarchy/main.test.ts +++ b/tests/futarchy/main.test.ts @@ -24,9 +24,9 @@ import unstakeFromProposal from "./unit/unstakeFromProposal.test.js"; import { PublicKey } from "@solana/web3.js"; import { - LAUNCHPAD_PROGRAM_ID, - MAINNET_METEORA_CONFIG, -} from "@metadaoproject/futarchy/v0.7"; + LAUNCHPAD_V0_7_PROGRAM_ID, + LAUNCHPAD_V0_7_MAINNET_METEORA_CONFIG, +} from "@metadaoproject/programs"; export default function suite() { before(async function () { @@ -41,7 +41,7 @@ export default function suite() { const [poolCreatorAuthority] = PublicKey.findProgramAddressSync( [Buffer.from("damm_pool_creator_authority")], - LAUNCHPAD_PROGRAM_ID, + LAUNCHPAD_V0_7_PROGRAM_ID, ); dynamicConfig.data.set( @@ -50,7 +50,10 @@ export default function suite() { ); dynamicConfig.data.set([1], configTypeOffset); - this.context.setAccount(MAINNET_METEORA_CONFIG, dynamicConfig); + this.context.setAccount( + LAUNCHPAD_V0_7_MAINNET_METEORA_CONFIG, + dynamicConfig, + ); }); describe("#initialize_dao", initializeDao); describe("#initialize_proposal", initializeProposal); diff --git a/tests/futarchy/unit/adminApproveMultisigProposal.test.ts b/tests/futarchy/unit/adminApproveMultisigProposal.test.ts index 628877c9b..6c4138553 100644 --- a/tests/futarchy/unit/adminApproveMultisigProposal.test.ts +++ b/tests/futarchy/unit/adminApproveMultisigProposal.test.ts @@ -1,4 +1,4 @@ -import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/futarchy/v0.6"; +import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/programs"; import { ComputeBudgetProgram, Keypair, @@ -97,7 +97,7 @@ export default function suite() { multisig.generated.isProposalStatusActive(squadsProposal.status), ); - await this.futarchy.autocrat.methods + await this.futarchy.futarchy.methods .adminApproveMultisigProposal({ transactionIndex: new BN(1) }) .accounts({ dao: dao, @@ -228,7 +228,7 @@ export default function suite() { }); // Approve and execute the config transaction using the new split instructions - await this.futarchy.autocrat.methods + await this.futarchy.futarchy.methods .adminApproveMultisigProposal({ transactionIndex: new BN(configTransactionIndex.toString()), }) @@ -242,7 +242,7 @@ export default function suite() { .signers([this.payer]) .rpc(); - await this.futarchy.autocrat.methods + await this.futarchy.futarchy.methods .adminExecuteMultisigProposal() .accounts({ dao: dao, @@ -279,7 +279,7 @@ export default function suite() { "The proposal should not be approved because it should have been invalidated", ); - await this.futarchy.autocrat.methods + await this.futarchy.futarchy.methods .adminApproveMultisigProposal({ transactionIndex: new BN(1) }) .accounts({ dao: dao, @@ -366,7 +366,7 @@ export default function suite() { enqueuedTimestamp: new BN(1000), }; const daoAccountBuffer = - await this.futarchy.autocrat.account.dao.coder.accounts.encode( + await this.futarchy.futarchy.account.dao.coder.accounts.encode( "dao", daoAccount, ); @@ -379,7 +379,7 @@ export default function suite() { "Should fail because DAO has an active optimistic proposal", ); - await this.futarchy.autocrat.methods + await this.futarchy.futarchy.methods .adminApproveMultisigProposal({ transactionIndex: new BN(1) }) .accounts({ dao: dao, diff --git a/tests/futarchy/unit/adminCancelProposal.test.ts b/tests/futarchy/unit/adminCancelProposal.test.ts index 2b0febe20..cea663183 100644 --- a/tests/futarchy/unit/adminCancelProposal.test.ts +++ b/tests/futarchy/unit/adminCancelProposal.test.ts @@ -1,9 +1,9 @@ -import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/futarchy/v0.6"; import { - CONDITIONAL_VAULT_PROGRAM_ID, + PERMISSIONLESS_ACCOUNT, + CONDITIONAL_VAULT_V0_4_PROGRAM_ID, SQUADS_PROGRAM_ID, getEventAuthorityAddr, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { ComputeBudgetProgram, PublicKey, @@ -74,6 +74,7 @@ export default function suite() { twapStartDelaySeconds: null, teamSponsoredPassThresholdBps: null, teamAddress: null, + isOptimisticGovernanceEnabled: null, }, }) .instruction(); @@ -151,10 +152,10 @@ export default function suite() { const multisigPda = multisig.getMultisigPda({ createKey: dao })[0]; const [vaultEventAuthority] = getEventAuthorityAddr( - CONDITIONAL_VAULT_PROGRAM_ID, + CONDITIONAL_VAULT_V0_4_PROGRAM_ID, ); - await this.futarchy.autocrat.methods + await this.futarchy.futarchy.methods .adminCancelProposal() .accounts({ proposal, @@ -194,7 +195,7 @@ export default function suite() { dao, true, ), - vaultProgram: CONDITIONAL_VAULT_PROGRAM_ID, + vaultProgram: CONDITIONAL_VAULT_V0_4_PROGRAM_ID, vaultEventAuthority, quoteVault, quoteVaultUnderlyingTokenAccount: getAssociatedTokenAddressSync( @@ -249,7 +250,7 @@ export default function suite() { const multisigPda = multisig.getMultisigPda({ createKey: dao })[0]; const [vaultEventAuthority] = getEventAuthorityAddr( - CONDITIONAL_VAULT_PROGRAM_ID, + CONDITIONAL_VAULT_V0_4_PROGRAM_ID, ); const accounts = { @@ -282,7 +283,7 @@ export default function suite() { dao, true, ), - vaultProgram: CONDITIONAL_VAULT_PROGRAM_ID, + vaultProgram: CONDITIONAL_VAULT_V0_4_PROGRAM_ID, vaultEventAuthority, quoteVault, quoteVaultUnderlyingTokenAccount: getAssociatedTokenAddressSync( @@ -303,7 +304,7 @@ export default function suite() { }; // Cancel the proposal first - await this.futarchy.autocrat.methods + await this.futarchy.futarchy.methods .adminCancelProposal() .accounts(accounts) .preInstructions([ @@ -321,7 +322,7 @@ export default function suite() { "should not cancel an already cancelled proposal", ); - await this.futarchy.autocrat.methods + await this.futarchy.futarchy.methods .adminCancelProposal() .accounts(accounts) .preInstructions([ diff --git a/tests/futarchy/unit/adminExecuteMultisigProposal.test.ts b/tests/futarchy/unit/adminExecuteMultisigProposal.test.ts index 97ab5dabc..55b744f69 100644 --- a/tests/futarchy/unit/adminExecuteMultisigProposal.test.ts +++ b/tests/futarchy/unit/adminExecuteMultisigProposal.test.ts @@ -1,4 +1,4 @@ -import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/futarchy/v0.6"; +import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/programs"; import { ComputeBudgetProgram, PublicKey, @@ -110,7 +110,7 @@ export default function suite() { }); // First approve - await this.futarchy.autocrat.methods + await this.futarchy.futarchy.methods .adminApproveMultisigProposal({ transactionIndex: new BN(1) }) .accounts({ dao: dao, @@ -123,7 +123,7 @@ export default function suite() { .rpc(); // Then execute - await this.futarchy.autocrat.methods + await this.futarchy.futarchy.methods .adminExecuteMultisigProposal() .accounts({ dao: dao, @@ -227,7 +227,7 @@ export default function suite() { "The proposal should not be executed because it has not been approved", ); - await this.futarchy.autocrat.methods + await this.futarchy.futarchy.methods .adminExecuteMultisigProposal() .accounts({ dao: dao, diff --git a/tests/futarchy/unit/adminRemoveProposal.test.ts b/tests/futarchy/unit/adminRemoveProposal.test.ts index aab9ef045..565313bf9 100644 --- a/tests/futarchy/unit/adminRemoveProposal.test.ts +++ b/tests/futarchy/unit/adminRemoveProposal.test.ts @@ -1,7 +1,4 @@ -import { - PERMISSIONLESS_ACCOUNT, - PriceMath, -} from "@metadaoproject/futarchy/v0.6"; +import { PERMISSIONLESS_ACCOUNT, PriceMath } from "@metadaoproject/programs"; import { ComputeBudgetProgram, Keypair, @@ -53,6 +50,7 @@ export default function suite() { twapStartDelaySeconds: null, teamSponsoredPassThresholdBps: null, teamAddress: null, + isOptimisticGovernanceEnabled: null, }, }) .instruction(); @@ -102,7 +100,7 @@ export default function suite() { assert.exists(storedProposal.state.draft); // Call admin_remove_proposal - await this.futarchy.autocrat.methods + await this.futarchy.futarchy.methods .adminRemoveProposal() .accounts({ proposal, @@ -133,7 +131,7 @@ export default function suite() { .rpc(); // Remove the proposal - await this.futarchy.autocrat.methods + await this.futarchy.futarchy.methods .adminRemoveProposal() .accounts({ proposal, @@ -169,7 +167,7 @@ export default function suite() { it("should not allow staking to Removed proposals", async function () { // Remove the proposal first - await this.futarchy.autocrat.methods + await this.futarchy.futarchy.methods .adminRemoveProposal() .accounts({ proposal, @@ -248,7 +246,7 @@ export default function suite() { "Should not allow removing Pending proposal", ); - await this.futarchy.autocrat.methods + await this.futarchy.futarchy.methods .adminRemoveProposal() .accounts({ proposal, diff --git a/tests/futarchy/unit/collectFees.test.ts b/tests/futarchy/unit/collectFees.test.ts index 0b61ef8e6..c893e6e7c 100644 --- a/tests/futarchy/unit/collectFees.test.ts +++ b/tests/futarchy/unit/collectFees.test.ts @@ -12,9 +12,8 @@ import { import { expectError, setupBasicDao } from "../../utils.js"; import BN from "bn.js"; import { assert } from "chai"; -import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/futarchy/v0.6"; +import { METADAO_MULTISIG_VAULT } from "@metadaoproject/programs"; import { MEMO_PROGRAM_ID } from "@solana/spl-memo"; -import { METADAO_MULTISIG_VAULT } from "../../../sdk/src/v0.6/constants.js"; export default function suite() { let META: PublicKey, USDC: PublicKey, dao: PublicKey; diff --git a/tests/futarchy/unit/collectMeteoraDammFees.test.ts b/tests/futarchy/unit/collectMeteoraDammFees.test.ts index 5ecef4506..70adb3cf3 100644 --- a/tests/futarchy/unit/collectMeteoraDammFees.test.ts +++ b/tests/futarchy/unit/collectMeteoraDammFees.test.ts @@ -10,10 +10,11 @@ import { DAMM_V2_PROGRAM_ID, FutarchyClient, LaunchpadClient, - MAINNET_METEORA_CONFIG, + LAUNCHPAD_V0_7_MAINNET_METEORA_CONFIG, MAINNET_USDC, PERMISSIONLESS_ACCOUNT, -} from "@metadaoproject/futarchy/v0.7"; + METADAO_MULTISIG_VAULT, +} from "@metadaoproject/programs"; import { BN } from "bn.js"; import { initializeMintWithSeeds } from "../../launchpad_v7/utils.js"; import { createLookupTableForTransaction } from "../../utils.js"; @@ -24,7 +25,6 @@ import { getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID, } from "@solana/spl-token"; -import { METADAO_MULTISIG_VAULT } from "../../../sdk/src/v0.7/constants.js"; import { CpAmm } from "@meteora-ag/cp-amm-sdk"; export default function suite() { @@ -73,6 +73,7 @@ export default function suite() { performancePackageTokenAmount: premineAmount, monthsUntilInsidersCanUnlock: 18, teamAddress: PublicKey.default, + hasBidWall: false, }) .rpc(); @@ -169,23 +170,13 @@ export default function suite() { const [pool] = PublicKey.findProgramAddressSync( [ Buffer.from("pool"), - MAINNET_METEORA_CONFIG.toBuffer(), + LAUNCHPAD_V0_7_MAINNET_METEORA_CONFIG.toBuffer(), sortedMint1, sortedMint2, ], DAMM_V2_PROGRAM_ID, ); - const [tokenAVault] = PublicKey.findProgramAddressSync( - [Buffer.from("token_vault"), META.toBuffer(), pool.toBuffer()], - DAMM_V2_PROGRAM_ID, - ); - - const [tokenBVault] = PublicKey.findProgramAddressSync( - [Buffer.from("token_vault"), MAINNET_USDC.toBuffer(), pool.toBuffer()], - DAMM_V2_PROGRAM_ID, - ); - const swapTx = await cpAmm._program.methods .swap({ amountIn: new BN(1_000_000), // 1 USDC swap @@ -202,8 +193,6 @@ export default function suite() { payer: this.payer.publicKey, pool: pool, program: DAMM_V2_PROGRAM_ID, - tokenAVault: tokenAVault, - tokenBVault: tokenBVault, }) .transaction(); @@ -303,7 +292,7 @@ export default function suite() { quoteMint: MAINNET_USDC, transactionIndex: BigInt(squadsMultisigAccount.transactionIndex.toString()) + 1n, - meteoraConfig: MAINNET_METEORA_CONFIG, + meteoraConfig: LAUNCHPAD_V0_7_MAINNET_METEORA_CONFIG, admin: this.payer.publicKey, }) .preInstructions([ diff --git a/tests/futarchy/unit/conditionalSwap.test.ts b/tests/futarchy/unit/conditionalSwap.test.ts index 350f3a78b..f83f11fba 100644 --- a/tests/futarchy/unit/conditionalSwap.test.ts +++ b/tests/futarchy/unit/conditionalSwap.test.ts @@ -11,7 +11,7 @@ import { import { expectError, setupBasicDao } from "../../utils.js"; import { BN } from "bn.js"; import { assert } from "chai"; -import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/futarchy/v0.6"; +import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/programs"; import { MEMO_PROGRAM_ID } from "@solana/spl-memo"; import { ComputeBudget } from "litesvm"; diff --git a/tests/futarchy/unit/executeSpendingLimitChange.test.ts b/tests/futarchy/unit/executeSpendingLimitChange.test.ts index 67ebb27d2..da68fc85e 100644 --- a/tests/futarchy/unit/executeSpendingLimitChange.test.ts +++ b/tests/futarchy/unit/executeSpendingLimitChange.test.ts @@ -1,7 +1,4 @@ -import { - PERMISSIONLESS_ACCOUNT, - PriceMath, -} from "@metadaoproject/futarchy/v0.6"; +import { PERMISSIONLESS_ACCOUNT, PriceMath } from "@metadaoproject/programs"; import { ComputeBudgetProgram, PublicKey, @@ -169,7 +166,7 @@ export default function suite() { }, ); - await this.futarchy.autocrat.methods + await this.futarchy.futarchy.methods .executeSpendingLimitChange() .accounts({ squadsMultisig: multisigPda, @@ -293,7 +290,7 @@ export default function suite() { enqueuedTimestamp: new BN(0), }; const daoAccountBuffer = - await this.futarchy.autocrat.account.dao.coder.accounts.encode( + await this.futarchy.futarchy.account.dao.coder.accounts.encode( "dao", daoAccount, ); @@ -334,7 +331,7 @@ export default function suite() { "Should fail because there is an active optimistic proposal", ); - await this.futarchy.autocrat.methods + await this.futarchy.futarchy.methods .executeSpendingLimitChange() .accounts({ squadsMultisig: multisigPda, @@ -461,7 +458,7 @@ export default function suite() { "The transaction should not be executed because it contains a call to remove the DAO as a member", ); - await this.futarchy.autocrat.methods + await this.futarchy.futarchy.methods .executeSpendingLimitChange() .accounts({ squadsMultisig: multisigPda, @@ -588,7 +585,7 @@ export default function suite() { "The transaction should not be executed because it contains a call to remove the DAO as a member", ); - await this.futarchy.autocrat.methods + await this.futarchy.futarchy.methods .executeSpendingLimitChange() .accounts({ squadsMultisig: multisigPda, diff --git a/tests/futarchy/unit/finalizeOptimisticProposal.test.ts b/tests/futarchy/unit/finalizeOptimisticProposal.test.ts index 07b0d58e1..b3c50f0a0 100644 --- a/tests/futarchy/unit/finalizeOptimisticProposal.test.ts +++ b/tests/futarchy/unit/finalizeOptimisticProposal.test.ts @@ -1,7 +1,9 @@ import { PERMISSIONLESS_ACCOUNT, PriceMath, -} from "@metadaoproject/futarchy/v0.7"; + getDaoAddr, + MAINNET_USDC, +} from "@metadaoproject/programs"; import { ComputeBudgetProgram, PublicKey, @@ -10,7 +12,6 @@ import { } from "@solana/web3.js"; import BN from "bn.js"; import { expectError, setOptimisticGovernanceEnabled } from "../../utils.js"; -import { getDaoAddr, MAINNET_USDC } from "@metadaoproject/futarchy/v0.7"; import { createTransferInstruction, getAssociatedTokenAddressSync, diff --git a/tests/futarchy/unit/finalizeProposal.test.ts b/tests/futarchy/unit/finalizeProposal.test.ts index 46a57e13a..cf2ea57d4 100644 --- a/tests/futarchy/unit/finalizeProposal.test.ts +++ b/tests/futarchy/unit/finalizeProposal.test.ts @@ -1,7 +1,4 @@ -import { - PERMISSIONLESS_ACCOUNT, - PriceMath, -} from "@metadaoproject/futarchy/v0.6"; +import { PERMISSIONLESS_ACCOUNT, PriceMath } from "@metadaoproject/programs"; import { ComputeBudgetProgram, PublicKey, @@ -77,6 +74,7 @@ export default function suite() { twapStartDelaySeconds: null, teamSponsoredPassThresholdBps: null, teamAddress: null, + isOptimisticGovernanceEnabled: null, }, }) .instruction(); @@ -118,7 +116,7 @@ export default function suite() { await this.banksClient.processTransaction(tx); - // Now initialize the autocrat proposal + // Now initialize the futarchy proposal proposal = await this.futarchy.initializeProposal(dao, squadsProposalPda); await this.futarchy @@ -173,26 +171,6 @@ export default function suite() { dao, ); - // await this.autocratClient. - // await this.futarchy.autocrat.methods.launchProposal() - // .accounts({ - // proposal, - // dao, - // baseVault, - // quoteVault, - // passBaseMint, - // passQuoteMint, - // failBaseMint, - // failQuoteMint, - // ammPassBaseVault: getAssociatedTokenAddressSync(passBaseMint, dao, true), - // ammPassQuoteVault: getAssociatedTokenAddressSync(passQuoteMint, dao, true), - // ammFailBaseVault: getAssociatedTokenAddressSync(failBaseMint, dao, true), - // ammFailQuoteVault: getAssociatedTokenAddressSync(failQuoteMint, dao, true), - // payer: this.payer.publicKey, - // }) - // .preInstructions([ComputeBudgetProgram.setComputeUnitLimit({ units: 300_000 })]) - // .rpc(); - await this.futarchy .conditionalSwapIx({ dao, @@ -457,6 +435,7 @@ export default function suite() { twapStartDelaySeconds: null, teamSponsoredPassThresholdBps: null, teamAddress: null, + isOptimisticGovernanceEnabled: null, }, }) .instruction(); @@ -500,7 +479,7 @@ export default function suite() { await this.banksClient.processTransaction(tx); - // Now initialize the autocrat proposal + // Now initialize the futarchy proposal const teamSponsoredProposal = await this.futarchy.initializeProposal( daoWithTeamSponsorship, squadsProposalPda, diff --git a/tests/futarchy/unit/initializeDao.test.ts b/tests/futarchy/unit/initializeDao.test.ts index 4066a9d90..110c3faae 100644 --- a/tests/futarchy/unit/initializeDao.test.ts +++ b/tests/futarchy/unit/initializeDao.test.ts @@ -2,7 +2,7 @@ import { getDaoAddr, PERMISSIONLESS_ACCOUNT, PriceMath, -} from "@metadaoproject/futarchy/v0.6"; +} from "@metadaoproject/programs"; import { ComputeBudgetProgram, Keypair, PublicKey } from "@solana/web3.js"; import BN from "bn.js"; import { expectError } from "../../utils.js"; diff --git a/tests/futarchy/unit/initializeProposal.test.ts b/tests/futarchy/unit/initializeProposal.test.ts index 97221628f..ec3bea394 100644 --- a/tests/futarchy/unit/initializeProposal.test.ts +++ b/tests/futarchy/unit/initializeProposal.test.ts @@ -2,7 +2,7 @@ import { getDaoAddr, PERMISSIONLESS_ACCOUNT, PriceMath, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { ComputeBudgetProgram, PublicKey, @@ -132,7 +132,7 @@ export default function suite() { await this.banksClient.processTransaction(tx); - // Now initialize the autocrat proposal + // Now initialize the futarchy proposal const proposal = await this.futarchy.initializeProposal( dao, squadsProposalPda, diff --git a/tests/futarchy/unit/initiateVaultSpendOptimisticProposal.test.ts b/tests/futarchy/unit/initiateVaultSpendOptimisticProposal.test.ts index a6cb8d848..db4dd15a0 100644 --- a/tests/futarchy/unit/initiateVaultSpendOptimisticProposal.test.ts +++ b/tests/futarchy/unit/initiateVaultSpendOptimisticProposal.test.ts @@ -2,7 +2,9 @@ import { PERMISSIONLESS_ACCOUNT, PriceMath, SQUADS_PROGRAM_ID, -} from "@metadaoproject/futarchy/v0.7"; + getDaoAddr, + MAINNET_USDC, +} from "@metadaoproject/programs"; import { ComputeBudgetProgram, Keypair, @@ -14,7 +16,6 @@ import { } from "@solana/web3.js"; import BN from "bn.js"; import { expectError, setOptimisticGovernanceEnabled } from "../../utils.js"; -import { getDaoAddr, MAINNET_USDC } from "@metadaoproject/futarchy/v0.7"; import { createAssociatedTokenAccountIdempotentInstruction, createTransferInstruction, @@ -268,7 +269,7 @@ export default function suite() { programId: squads.PROGRAM_ID, }); - await this.futarchy.autocrat.methods + await this.futarchy.futarchy.methods .executeSpendingLimitChange() .accounts({ squadsMultisig: multisigPda, @@ -363,7 +364,7 @@ export default function suite() { }; const daoAccountBuffer = - await this.futarchy.autocrat.account.dao.coder.accounts.encode( + await this.futarchy.futarchy.account.dao.coder.accounts.encode( "dao", daoAccount, ); @@ -535,7 +536,7 @@ export default function suite() { true, ); - return ctx.futarchy.autocrat.methods + return ctx.futarchy.futarchy.methods .initiateVaultSpendOptimisticProposal({ amount }) .accounts({ squadsMultisig: multisigPda, diff --git a/tests/futarchy/unit/launchProposal.test.ts b/tests/futarchy/unit/launchProposal.test.ts index ed44fa66d..a2a06198f 100644 --- a/tests/futarchy/unit/launchProposal.test.ts +++ b/tests/futarchy/unit/launchProposal.test.ts @@ -3,7 +3,7 @@ import { PriceMath, getDaoAddr, getProposalAddrV2, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { ComputeBudgetProgram, Keypair, @@ -384,7 +384,7 @@ export default function suite() { // Directly modify the DAO's secondsPerProposal to 5 days const daoAccountInfo = await this.banksClient.getAccount(dao); - const coder = this.futarchy.autocrat.coder.accounts; + const coder = this.futarchy.futarchy.coder.accounts; const daoData = coder.decode("dao", Buffer.from(daoAccountInfo.data)); daoData.secondsPerProposal = FIVE_DAYS; const encodedData = await coder.encode("dao", daoData); diff --git a/tests/futarchy/unit/provideLiquidity.test.ts b/tests/futarchy/unit/provideLiquidity.test.ts index 3464a10c2..006092d7b 100644 --- a/tests/futarchy/unit/provideLiquidity.test.ts +++ b/tests/futarchy/unit/provideLiquidity.test.ts @@ -1,7 +1,7 @@ import { Keypair, PublicKey } from "@solana/web3.js"; import BN from "bn.js"; import { assert } from "chai"; -import { FUTARCHY_PROGRAM_ID } from "@metadaoproject/futarchy/v0.7"; +import { FUTARCHY_V0_6_PROGRAM_ID } from "@metadaoproject/programs"; import { getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID, @@ -32,12 +32,12 @@ export default function suite() { dao.toBuffer(), this.payer.publicKey.toBuffer(), ], - FUTARCHY_PROGRAM_ID, + FUTARCHY_V0_6_PROGRAM_ID, ); // Fetch position before const positionBefore = - await this.futarchy.autocrat.account.ammPosition.fetch(ammPositionPda); + await this.futarchy.futarchy.account.ammPosition.fetch(ammPositionPda); // Call provideLiquidityIx to add more liquidity // maxBaseAmount needs buffer for rounding (add 1% or more) @@ -56,7 +56,7 @@ export default function suite() { // Fetch position after const positionAfter = - await this.futarchy.autocrat.account.ammPosition.fetch(ammPositionPda); + await this.futarchy.futarchy.account.ammPosition.fetch(ammPositionPda); // Assert liquidity increased assert.isTrue(positionAfter.liquidity.gt(positionBefore.liquidity)); @@ -83,12 +83,12 @@ export default function suite() { dao.toBuffer(), this.payer.publicKey.toBuffer(), ], - FUTARCHY_PROGRAM_ID, + FUTARCHY_V0_6_PROGRAM_ID, ); // Fetch position before attack const positionBefore = - await this.futarchy.autocrat.account.ammPosition.fetch(ammPositionPda); + await this.futarchy.futarchy.account.ammPosition.fetch(ammPositionPda); // Attacker calls provideLiquidityIx with positionAuthority=victim, liquidityProvider=attacker await this.futarchy @@ -107,7 +107,7 @@ export default function suite() { // Fetch position after attack const positionAfter = - await this.futarchy.autocrat.account.ammPosition.fetch(ammPositionPda); + await this.futarchy.futarchy.account.ammPosition.fetch(ammPositionPda); // Assert position_authority is still victim (not overwritten to attacker) assert.isTrue(positionAfter.positionAuthority.equals(this.payer.publicKey)); @@ -132,7 +132,7 @@ export default function suite() { dao.toBuffer(), this.payer.publicKey.toBuffer(), ], - FUTARCHY_PROGRAM_ID, + FUTARCHY_V0_6_PROGRAM_ID, ); // Attacker calls provideLiquidityIx attempting hijack @@ -162,16 +162,16 @@ export default function suite() { // Fetch position to get current liquidity const position = - await this.futarchy.autocrat.account.ammPosition.fetch(ammPositionPda); + await this.futarchy.futarchy.account.ammPosition.fetch(ammPositionPda); // Derive event authority const [eventAuthority] = PublicKey.findProgramAddressSync( [Buffer.from("__event_authority")], - FUTARCHY_PROGRAM_ID, + FUTARCHY_V0_6_PROGRAM_ID, ); // Victim withdraws all liquidity - await this.futarchy.autocrat.methods + await this.futarchy.futarchy.methods .withdrawLiquidity({ liquidityToWithdraw: position.liquidity, minBaseAmount: new BN(0), @@ -195,7 +195,7 @@ export default function suite() { ammPosition: ammPositionPda, tokenProgram: TOKEN_PROGRAM_ID, eventAuthority, - program: FUTARCHY_PROGRAM_ID, + program: FUTARCHY_V0_6_PROGRAM_ID, }) .rpc(); diff --git a/tests/futarchy/unit/unstakeFromProposal.test.ts b/tests/futarchy/unit/unstakeFromProposal.test.ts index 609560a08..96a31a728 100644 --- a/tests/futarchy/unit/unstakeFromProposal.test.ts +++ b/tests/futarchy/unit/unstakeFromProposal.test.ts @@ -1,7 +1,7 @@ import { InstructionUtils, PERMISSIONLESS_ACCOUNT, -} from "@metadaoproject/futarchy/v0.6"; +} from "@metadaoproject/programs"; import { ComputeBudgetProgram, PublicKey, @@ -76,6 +76,7 @@ export default function suite() { twapStartDelaySeconds: null, teamSponsoredPassThresholdBps: null, teamAddress: null, + isOptimisticGovernanceEnabled: null, }, }) .instruction(); diff --git a/tests/futarchy/unit/updateDao.test.ts b/tests/futarchy/unit/updateDao.test.ts index 0460e6ba1..50b8fc00e 100644 --- a/tests/futarchy/unit/updateDao.test.ts +++ b/tests/futarchy/unit/updateDao.test.ts @@ -14,8 +14,8 @@ import { getDaoAddr, PriceMath, MAINNET_USDC, -} from "@metadaoproject/futarchy/v0.7"; -import { sha256 } from "@metadaoproject/futarchy"; + sha256, +} from "@metadaoproject/programs"; import BN from "bn.js"; import { setOptimisticGovernanceEnabled } from "../../utils.js"; diff --git a/tests/integration/fullLaunch.test.ts b/tests/integration/fullLaunch.test.ts index 8d9c18a4b..4c756b6a5 100644 --- a/tests/integration/fullLaunch.test.ts +++ b/tests/integration/fullLaunch.test.ts @@ -8,11 +8,11 @@ import { import { assert } from "chai"; import { getPerformancePackageAddr, - LAUNCHPAD_PROGRAM_ID, - MAINNET_METEORA_CONFIG, + LAUNCHPAD_V0_6_PROGRAM_ID, + LAUNCHPAD_V0_6_MAINNET_METEORA_CONFIG, MAINNET_USDC, PERMISSIONLESS_ACCOUNT, -} from "@metadaoproject/futarchy/v0.6"; +} from "@metadaoproject/programs"; import { BN } from "bn.js"; import { initializeMintWithSeeds } from "../launchpad/utils.js"; import { createLookupTableForTransaction } from "../utils.js"; @@ -34,7 +34,7 @@ export default async function suite() { const [poolCreatorAuthority] = PublicKey.findProgramAddressSync( [Buffer.from("damm_pool_creator_authority")], - LAUNCHPAD_PROGRAM_ID, + LAUNCHPAD_V0_6_PROGRAM_ID, ); dynamicConfig.data.set( @@ -43,7 +43,10 @@ export default async function suite() { ); dynamicConfig.data.set([1], configTypeOffset); - this.context.setAccount(MAINNET_METEORA_CONFIG, dynamicConfig); + this.context.setAccount( + LAUNCHPAD_V0_6_MAINNET_METEORA_CONFIG, + dynamicConfig, + ); }); it("launch a DAO, have a multi-ix proposal pass, execute it, and have insiders vest their first 2 tranches", async function () { @@ -429,7 +432,7 @@ export default async function suite() { await this.banksClient.processTransaction(squadsTx); - // Now initialize the autocrat proposal with the proper squads proposal + // Now initialize the futarchy proposal with the proper squads proposal const proposal = await this.futarchy.initializeProposal( dao, squadsProposalPda, diff --git a/tests/integration/fullLaunch_v7.test.ts b/tests/integration/fullLaunch_v7.test.ts index beafebcb5..5687c10f7 100644 --- a/tests/integration/fullLaunch_v7.test.ts +++ b/tests/integration/fullLaunch_v7.test.ts @@ -9,11 +9,11 @@ import { import { assert } from "chai"; import { getPerformancePackageAddr, - LAUNCHPAD_PROGRAM_ID, - MAINNET_METEORA_CONFIG, + LAUNCHPAD_V0_7_PROGRAM_ID, + LAUNCHPAD_V0_7_MAINNET_METEORA_CONFIG, MAINNET_USDC, PERMISSIONLESS_ACCOUNT, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { BN } from "bn.js"; import { initializeMintWithSeeds } from "../launchpad_v7/utils.js"; import { createLookupTableForTransaction, expectError } from "../utils.js"; @@ -35,7 +35,7 @@ export default async function suite() { const [poolCreatorAuthority] = PublicKey.findProgramAddressSync( [Buffer.from("damm_pool_creator_authority")], - LAUNCHPAD_PROGRAM_ID, + LAUNCHPAD_V0_7_PROGRAM_ID, ); dynamicConfig.data.set( @@ -44,7 +44,10 @@ export default async function suite() { ); dynamicConfig.data.set([1], configTypeOffset); - this.context.setAccount(MAINNET_METEORA_CONFIG, dynamicConfig); + this.context.setAccount( + LAUNCHPAD_V0_7_MAINNET_METEORA_CONFIG, + dynamicConfig, + ); }); it("launch a DAO, have a multi-ix proposal pass, execute it, and have insiders vest their first 2 tranches", async function () { @@ -161,6 +164,7 @@ export default async function suite() { monthsUntilInsidersCanUnlock: 24, teamAddress: PublicKey.default, launchAuthority: launchAuthority.publicKey, + hasBidWall: false, }) .rpc(); @@ -474,7 +478,7 @@ export default async function suite() { await this.banksClient.processTransaction(squadsTx); - // Now initialize the autocrat proposal with the proper squads proposal + // Now initialize the futarchy proposal with the proper squads proposal const proposal = await this.futarchy.initializeProposal( dao, squadsProposalPda, diff --git a/tests/integration/mintAndSwap.test.ts b/tests/integration/mintAndSwap.test.ts index cd1780760..486268cc4 100644 --- a/tests/integration/mintAndSwap.test.ts +++ b/tests/integration/mintAndSwap.test.ts @@ -2,7 +2,7 @@ import { ConditionalVaultClient, FutarchyClient, InstructionUtils, -} from "@metadaoproject/futarchy/v0.6"; +} from "@metadaoproject/programs"; import { PublicKey, Transaction } from "@solana/web3.js"; import BN from "bn.js"; import { assert } from "chai"; @@ -44,6 +44,8 @@ export default async function test() { nonce, initialSpendingLimit: null, baseToStake: new BN(0), + teamAddress: PublicKey.default, + teamSponsoredPassThresholdBps: 0, }, provideLiquidity: false, }) diff --git a/tests/launchpad/main.test.ts b/tests/launchpad/main.test.ts index a8f77d349..0406819d2 100644 --- a/tests/launchpad/main.test.ts +++ b/tests/launchpad/main.test.ts @@ -8,13 +8,11 @@ import closeLaunch from "./unit/closeLaunch.test.js"; import returnFunds from "./unit/returnFunds.test.js"; import { PublicKey } from "@solana/web3.js"; import { - LAUNCHPAD_PROGRAM_ID, - LaunchpadClient, - MAINNET_METEORA_CONFIG, + LAUNCHPAD_V0_6_PROGRAM_ID, + LAUNCHPAD_V0_6_MAINNET_METEORA_CONFIG, MAINNET_USDC, -} from "@metadaoproject/futarchy/v0.6"; +} from "@metadaoproject/programs"; import BN from "bn.js"; -import { BankrunProvider } from "anchor-bankrun"; // TODO add a many-outcome integration test export default function suite() { @@ -30,7 +28,7 @@ export default function suite() { const [poolCreatorAuthority] = PublicKey.findProgramAddressSync( [Buffer.from("damm_pool_creator_authority")], - LAUNCHPAD_PROGRAM_ID, + LAUNCHPAD_V0_6_PROGRAM_ID, ); dynamicConfig.data.set( @@ -39,7 +37,10 @@ export default function suite() { ); dynamicConfig.data.set([1], configTypeOffset); - this.context.setAccount(MAINNET_METEORA_CONFIG, dynamicConfig); + this.context.setAccount( + LAUNCHPAD_V0_6_MAINNET_METEORA_CONFIG, + dynamicConfig, + ); this.setupBasicLaunch = async ({ baseMint, diff --git a/tests/launchpad/unit/claim.test.ts b/tests/launchpad/unit/claim.test.ts index bdaec5d10..e85963fad 100644 --- a/tests/launchpad/unit/claim.test.ts +++ b/tests/launchpad/unit/claim.test.ts @@ -6,11 +6,10 @@ import { } from "@solana/web3.js"; import { assert } from "chai"; import { - FutarchyClient, getFundingRecordAddr, LaunchpadClient, - MAINNET_USDC, -} from "@metadaoproject/futarchy/v0.6"; +} from "@metadaoproject/programs/launchpad/v0.6"; +import { FutarchyClient, MAINNET_USDC } from "@metadaoproject/programs"; import { BN } from "bn.js"; import { getAssociatedTokenAddressSync } from "@solana/spl-token"; import { initializeMintWithSeeds } from "../utils.js"; diff --git a/tests/launchpad/unit/closeLaunch.test.ts b/tests/launchpad/unit/closeLaunch.test.ts index 259104ce9..e7484d846 100644 --- a/tests/launchpad/unit/closeLaunch.test.ts +++ b/tests/launchpad/unit/closeLaunch.test.ts @@ -1,6 +1,7 @@ import { ComputeBudgetProgram, Keypair, PublicKey } from "@solana/web3.js"; import { assert } from "chai"; -import { LaunchpadClient, MAINNET_USDC } from "@metadaoproject/futarchy/v0.6"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.6"; +import { MAINNET_USDC } from "@metadaoproject/programs"; import { BN } from "bn.js"; import { getAssociatedTokenAddressSync } from "@solana/spl-token"; import { initializeMintWithSeeds } from "../utils.js"; diff --git a/tests/launchpad/unit/completeLaunch.test.ts b/tests/launchpad/unit/completeLaunch.test.ts index 26c8bf46d..1f3de5428 100644 --- a/tests/launchpad/unit/completeLaunch.test.ts +++ b/tests/launchpad/unit/completeLaunch.test.ts @@ -5,16 +5,16 @@ import { VersionedTransaction, } from "@solana/web3.js"; import { assert } from "chai"; -import { - getLiquidityPoolAddr, - getRaydiumCpmmLpMintAddr, -} from "@metadaoproject/futarchy/v0.5"; import { FutarchyClient, getMetadataAddr, - LaunchpadClient, MAINNET_USDC, -} from "@metadaoproject/futarchy/v0.6"; +} from "@metadaoproject/programs"; +import { + getLiquidityPoolAddr, + getRaydiumCpmmLpMintAddr, + LaunchpadClient, +} from "@metadaoproject/programs/launchpad/v0.6"; import { BN } from "bn.js"; import { deserializeMetadata } from "@metaplex-foundation/mpl-token-metadata"; import { diff --git a/tests/launchpad/unit/fund.test.ts b/tests/launchpad/unit/fund.test.ts index 908573c1a..f94641f9f 100644 --- a/tests/launchpad/unit/fund.test.ts +++ b/tests/launchpad/unit/fund.test.ts @@ -1,18 +1,16 @@ import { Keypair, PublicKey } from "@solana/web3.js"; import { assert } from "chai"; import { - FutarchyClient, getFundingRecordAddr, LaunchpadClient, - MAINNET_USDC, -} from "@metadaoproject/futarchy/v0.6"; +} from "@metadaoproject/programs/launchpad/v0.6"; +import { MAINNET_USDC } from "@metadaoproject/programs"; import { getAccount } from "spl-token-bankrun"; import { BN } from "bn.js"; import { getAssociatedTokenAddressSync } from "@solana/spl-token"; import { initializeMintWithSeeds } from "../utils.js"; export default function suite() { - let autocratClient: FutarchyClient; let launchpadClient: LaunchpadClient; let META: PublicKey; let launch: PublicKey; @@ -30,7 +28,6 @@ export default function suite() { const unlockThreshold = new BN(2000_000000); before(async function () { - autocratClient = this.futarchy; launchpadClient = this.launchpad_v6; }); diff --git a/tests/launchpad/unit/initializeLaunch.test.ts b/tests/launchpad/unit/initializeLaunch.test.ts index e0f40213b..6ed91c34a 100644 --- a/tests/launchpad/unit/initializeLaunch.test.ts +++ b/tests/launchpad/unit/initializeLaunch.test.ts @@ -6,19 +6,19 @@ import { } from "@solana/web3.js"; import { assert } from "chai"; import { - FutarchyClient, getLaunchAddr, getLaunchSignerAddr, - getMetadataAddr, LaunchpadClient, -} from "@metadaoproject/futarchy/v0.6"; +} from "@metadaoproject/programs/launchpad/v0.6"; import { BN } from "bn.js"; import { getAssociatedTokenAddressSync } from "@solana/spl-token"; import * as token from "@solana/spl-token"; import { + FutarchyClient, + getMetadataAddr, MAINNET_USDC, MPL_TOKEN_METADATA_PROGRAM_ID, -} from "@metadaoproject/futarchy/v0.6"; +} from "@metadaoproject/programs"; import { initializeMintWithSeeds } from "../utils.js"; export default function suite() { diff --git a/tests/launchpad/unit/refund.test.ts b/tests/launchpad/unit/refund.test.ts index cbec64bd6..25c2c7cac 100644 --- a/tests/launchpad/unit/refund.test.ts +++ b/tests/launchpad/unit/refund.test.ts @@ -5,11 +5,8 @@ import { VersionedTransaction, } from "@solana/web3.js"; import { assert } from "chai"; -import { - FutarchyClient, - LaunchpadClient, - MAINNET_USDC, -} from "@metadaoproject/futarchy/v0.6"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.6"; +import { FutarchyClient, MAINNET_USDC } from "@metadaoproject/programs"; import { BN } from "bn.js"; import { getAssociatedTokenAddressSync } from "@solana/spl-token"; import { initializeMintWithSeeds } from "../utils.js"; diff --git a/tests/launchpad/unit/returnFunds.test.ts b/tests/launchpad/unit/returnFunds.test.ts index e98782d36..dfa22f157 100644 --- a/tests/launchpad/unit/returnFunds.test.ts +++ b/tests/launchpad/unit/returnFunds.test.ts @@ -1,11 +1,10 @@ import { Keypair, PublicKey } from "@solana/web3.js"; import { assert } from "chai"; import { - FutarchyClient, getLaunchSignerAddr, LaunchpadClient, - MAINNET_USDC, -} from "@metadaoproject/futarchy/v0.6"; +} from "@metadaoproject/programs/launchpad/v0.6"; +import { FutarchyClient, MAINNET_USDC } from "@metadaoproject/programs"; import { BN } from "bn.js"; import { createAssociatedTokenAccountIdempotentInstruction, diff --git a/tests/launchpad/unit/startLaunch.test.ts b/tests/launchpad/unit/startLaunch.test.ts index 731353e9e..36de4c74a 100644 --- a/tests/launchpad/unit/startLaunch.test.ts +++ b/tests/launchpad/unit/startLaunch.test.ts @@ -1,10 +1,10 @@ import { Keypair, PublicKey } from "@solana/web3.js"; import { assert } from "chai"; -import { FutarchyClient, LaunchpadClient } from "@metadaoproject/futarchy/v0.6"; +import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.6"; import { BN } from "bn.js"; import { initializeMintWithSeeds } from "../utils.js"; -import { MAINNET_USDC } from "@metadaoproject/futarchy/v0.6"; +import { FutarchyClient, MAINNET_USDC } from "@metadaoproject/programs"; export default function suite() { let futarchyClient: FutarchyClient; diff --git a/tests/launchpad/utils.ts b/tests/launchpad/utils.ts index 46f37b8ea..e5e523513 100644 --- a/tests/launchpad/utils.ts +++ b/tests/launchpad/utils.ts @@ -1,11 +1,11 @@ import { PublicKey, Signer, SystemProgram, Transaction } from "@solana/web3.js"; import * as token from "@solana/spl-token"; import { BanksClient } from "solana-bankrun"; -import { LaunchpadClient } from "@metadaoproject/futarchy/v0.6"; import { + LaunchpadClient, getLaunchAddr, getLaunchSignerAddr, -} from "@metadaoproject/futarchy/v0.6"; +} from "@metadaoproject/programs/launchpad/v0.6"; export async function initializeMintWithSeeds( banksClient: BanksClient, diff --git a/tests/launchpad_v7/main.test.ts b/tests/launchpad_v7/main.test.ts index 2398a586e..3bf079920 100644 --- a/tests/launchpad_v7/main.test.ts +++ b/tests/launchpad_v7/main.test.ts @@ -11,10 +11,10 @@ import initializePerformancePackage from "./unit/initializePerformancePackage.te import extendLaunch from "./unit/extendLaunch.test.js"; import { PublicKey } from "@solana/web3.js"; import { - LAUNCHPAD_PROGRAM_ID, - MAINNET_METEORA_CONFIG, + LAUNCHPAD_V0_7_PROGRAM_ID, + LAUNCHPAD_V0_7_MAINNET_METEORA_CONFIG, MAINNET_USDC, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import BN from "bn.js"; // TODO add a many-outcome integration test @@ -31,7 +31,7 @@ export default function suite() { const [poolCreatorAuthority] = PublicKey.findProgramAddressSync( [Buffer.from("damm_pool_creator_authority")], - LAUNCHPAD_PROGRAM_ID, + LAUNCHPAD_V0_7_PROGRAM_ID, ); dynamicConfig.data.set( @@ -40,7 +40,10 @@ export default function suite() { ); dynamicConfig.data.set([1], configTypeOffset); - this.context.setAccount(MAINNET_METEORA_CONFIG, dynamicConfig); + this.context.setAccount( + LAUNCHPAD_V0_7_MAINNET_METEORA_CONFIG, + dynamicConfig, + ); this.setupBasicLaunch = async ({ baseMint, diff --git a/tests/launchpad_v7/unit/claim.test.ts b/tests/launchpad_v7/unit/claim.test.ts index 012fe7cb0..6041b28c7 100644 --- a/tests/launchpad_v7/unit/claim.test.ts +++ b/tests/launchpad_v7/unit/claim.test.ts @@ -11,7 +11,7 @@ import { getFundingRecordAddr, LaunchpadClient, MAINNET_USDC, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import BN from "bn.js"; import { getAssociatedTokenAddressSync } from "@solana/spl-token"; import { initializeMintWithSeeds } from "../utils.js"; diff --git a/tests/launchpad_v7/unit/claimAdditionalTokenAllocation.test.ts b/tests/launchpad_v7/unit/claimAdditionalTokenAllocation.test.ts index 1dd24b536..2ce6a359d 100644 --- a/tests/launchpad_v7/unit/claimAdditionalTokenAllocation.test.ts +++ b/tests/launchpad_v7/unit/claimAdditionalTokenAllocation.test.ts @@ -11,7 +11,7 @@ import { FutarchyClient, LaunchpadClient, MAINNET_USDC, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { BN } from "bn.js"; import { initializeMintWithSeeds } from "../utils.js"; import { createLookupTableForTransaction, expectError } from "../../utils.js"; diff --git a/tests/launchpad_v7/unit/closeLaunch.test.ts b/tests/launchpad_v7/unit/closeLaunch.test.ts index 33ff9ff01..58ad4cf1e 100644 --- a/tests/launchpad_v7/unit/closeLaunch.test.ts +++ b/tests/launchpad_v7/unit/closeLaunch.test.ts @@ -5,7 +5,7 @@ import { Signer, } from "@solana/web3.js"; import { assert } from "chai"; -import { LaunchpadClient, MAINNET_USDC } from "@metadaoproject/futarchy/v0.7"; +import { LaunchpadClient, MAINNET_USDC } from "@metadaoproject/programs"; import { BN } from "bn.js"; import { getAssociatedTokenAddressSync } from "@solana/spl-token"; import { initializeMintWithSeeds } from "../utils.js"; diff --git a/tests/launchpad_v7/unit/completeLaunch.test.ts b/tests/launchpad_v7/unit/completeLaunch.test.ts index 1f8f6dbf5..3805b85c3 100644 --- a/tests/launchpad_v7/unit/completeLaunch.test.ts +++ b/tests/launchpad_v7/unit/completeLaunch.test.ts @@ -11,7 +11,7 @@ import { getMetadataAddr, LaunchpadClient, MAINNET_USDC, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { BN } from "bn.js"; import { deserializeMetadata } from "@metaplex-foundation/mpl-token-metadata"; import { diff --git a/tests/launchpad_v7/unit/extendLaunch.test.ts b/tests/launchpad_v7/unit/extendLaunch.test.ts index 7b0490c09..4a893c077 100644 --- a/tests/launchpad_v7/unit/extendLaunch.test.ts +++ b/tests/launchpad_v7/unit/extendLaunch.test.ts @@ -5,7 +5,7 @@ import { Signer, } from "@solana/web3.js"; import { assert } from "chai"; -import { LaunchpadClient, MAINNET_USDC } from "@metadaoproject/futarchy/v0.7"; +import { LaunchpadClient, MAINNET_USDC } from "@metadaoproject/programs"; import { BN } from "bn.js"; import { initializeMintWithSeeds } from "../utils.js"; diff --git a/tests/launchpad_v7/unit/fund.test.ts b/tests/launchpad_v7/unit/fund.test.ts index b683ae17b..de60a8a46 100644 --- a/tests/launchpad_v7/unit/fund.test.ts +++ b/tests/launchpad_v7/unit/fund.test.ts @@ -6,26 +6,21 @@ import { } from "@solana/web3.js"; import { assert } from "chai"; import { - FutarchyClient, getFundingRecordAddr, LaunchpadClient, MAINNET_USDC, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { getAccount } from "spl-token-bankrun"; import { BN } from "bn.js"; import { getAssociatedTokenAddressSync } from "@solana/spl-token"; import { initializeMintWithSeeds } from "../utils.js"; export default function suite() { - let autocratClient: FutarchyClient; let launchpadClient: LaunchpadClient; let META: PublicKey; let launch: PublicKey; let launchSigner: PublicKey; - let baseVault: PublicKey; let quoteVault: PublicKey; - let funderBaseAccount: PublicKey; - let funderQuoteAccount: PublicKey; let launchAuthority: Signer; const minRaise = new BN(1000_000000); // 1000 USDC @@ -33,10 +28,7 @@ export default function suite() { const monthlySpend = new BN(100_000000); const recipientAddress = Keypair.generate().publicKey; const premineAmount = new BN(500_000_000); - const unlockThreshold = new BN(2000_000000); - before(async function () { - autocratClient = this.futarchy; launchpadClient = this.launchpad_v7; }); @@ -52,20 +44,11 @@ export default function suite() { launchSigner = result.launchSigner; launchAuthority = new Keypair(); - baseVault = getAssociatedTokenAddressSync(META, launchSigner, true); quoteVault = getAssociatedTokenAddressSync( MAINNET_USDC, launchSigner, true, ); - funderBaseAccount = getAssociatedTokenAddressSync( - META, - this.payer.publicKey, - ); - funderQuoteAccount = getAssociatedTokenAddressSync( - MAINNET_USDC, - this.payer.publicKey, - ); // TODO: put this in main test // Initialize launch diff --git a/tests/launchpad_v7/unit/initializeLaunch.test.ts b/tests/launchpad_v7/unit/initializeLaunch.test.ts index a4834db08..61d309f50 100644 --- a/tests/launchpad_v7/unit/initializeLaunch.test.ts +++ b/tests/launchpad_v7/unit/initializeLaunch.test.ts @@ -12,14 +12,14 @@ import { getLaunchSignerAddr, getMetadataAddr, LaunchpadClient, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { BN } from "bn.js"; import { getAssociatedTokenAddressSync } from "@solana/spl-token"; import * as token from "@solana/spl-token"; import { MAINNET_USDC, MPL_TOKEN_METADATA_PROGRAM_ID, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { initializeMintWithSeeds } from "../utils.js"; export default function suite() { diff --git a/tests/launchpad_v7/unit/initializePerformancePackage.test.ts b/tests/launchpad_v7/unit/initializePerformancePackage.test.ts index 98ffb081d..f030585c6 100644 --- a/tests/launchpad_v7/unit/initializePerformancePackage.test.ts +++ b/tests/launchpad_v7/unit/initializePerformancePackage.test.ts @@ -13,7 +13,7 @@ import { LaunchpadClient, MAINNET_USDC, PriceBasedPerformancePackageClient, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { BN } from "bn.js"; import { deserializeMetadata } from "@metaplex-foundation/mpl-token-metadata"; import { diff --git a/tests/launchpad_v7/unit/refund.test.ts b/tests/launchpad_v7/unit/refund.test.ts index fa20453f7..e27389604 100644 --- a/tests/launchpad_v7/unit/refund.test.ts +++ b/tests/launchpad_v7/unit/refund.test.ts @@ -10,7 +10,7 @@ import { FutarchyClient, LaunchpadClient, MAINNET_USDC, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { BN } from "bn.js"; import { getAssociatedTokenAddressSync } from "@solana/spl-token"; import { initializeMintWithSeeds } from "../utils.js"; diff --git a/tests/launchpad_v7/unit/setFundingRecordApproval.test.ts b/tests/launchpad_v7/unit/setFundingRecordApproval.test.ts index 0c50475ad..2f1dc186d 100644 --- a/tests/launchpad_v7/unit/setFundingRecordApproval.test.ts +++ b/tests/launchpad_v7/unit/setFundingRecordApproval.test.ts @@ -9,7 +9,7 @@ import { FutarchyClient, LaunchpadClient, MAINNET_USDC, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { BN } from "bn.js"; import { initializeMintWithSeeds } from "../utils.js"; import { createLookupTableForTransaction, expectError } from "../../utils.js"; diff --git a/tests/launchpad_v7/unit/startLaunch.test.ts b/tests/launchpad_v7/unit/startLaunch.test.ts index ea9f8bb8f..8e958e908 100644 --- a/tests/launchpad_v7/unit/startLaunch.test.ts +++ b/tests/launchpad_v7/unit/startLaunch.test.ts @@ -1,10 +1,10 @@ import { Keypair, PublicKey, Signer } from "@solana/web3.js"; import { assert } from "chai"; -import { FutarchyClient, LaunchpadClient } from "@metadaoproject/futarchy/v0.7"; +import { FutarchyClient, LaunchpadClient } from "@metadaoproject/programs"; import { BN } from "bn.js"; import { initializeMintWithSeeds } from "../utils.js"; -import { MAINNET_USDC } from "@metadaoproject/futarchy/v0.7"; +import { MAINNET_USDC } from "@metadaoproject/programs"; export default function suite() { let futarchyClient: FutarchyClient; diff --git a/tests/launchpad_v7/utils.ts b/tests/launchpad_v7/utils.ts index 45fef8cb8..3d3af5af3 100644 --- a/tests/launchpad_v7/utils.ts +++ b/tests/launchpad_v7/utils.ts @@ -1,11 +1,8 @@ import { PublicKey, Signer, SystemProgram, Transaction } from "@solana/web3.js"; import * as token from "@solana/spl-token"; import { BanksClient } from "solana-bankrun"; -import { LaunchpadClient } from "@metadaoproject/futarchy/v0.7"; -import { - getLaunchAddr, - getLaunchSignerAddr, -} from "@metadaoproject/futarchy/v0.7"; +import { LaunchpadClient } from "@metadaoproject/programs"; +import { getLaunchAddr, getLaunchSignerAddr } from "@metadaoproject/programs"; export async function initializeMintWithSeeds( banksClient: BanksClient, diff --git a/tests/liquidation/main.test.ts b/tests/liquidation/main.test.ts index a0dabe85a..2d717d775 100644 --- a/tests/liquidation/main.test.ts +++ b/tests/liquidation/main.test.ts @@ -1,4 +1,4 @@ -import { LiquidationClient } from "@metadaoproject/futarchy/v0.7"; +import { LiquidationClient } from "@metadaoproject/programs"; import { BankrunProvider } from "anchor-bankrun"; import initializeLiquidation from "./unit/initializeLiquidation.test.js"; import setRefundRecord from "./unit/setRefundRecord.test.js"; diff --git a/tests/liquidation/unit/activateLiquidation.test.ts b/tests/liquidation/unit/activateLiquidation.test.ts index 2f8071ac5..d099bc168 100644 --- a/tests/liquidation/unit/activateLiquidation.test.ts +++ b/tests/liquidation/unit/activateLiquidation.test.ts @@ -1,4 +1,4 @@ -import { LiquidationClient } from "@metadaoproject/futarchy/v0.7"; +import { LiquidationClient } from "@metadaoproject/programs"; import { Keypair, PublicKey, ComputeBudgetProgram } from "@solana/web3.js"; import { assert } from "chai"; import { expectError } from "../../utils.js"; diff --git a/tests/liquidation/unit/initializeLiquidation.test.ts b/tests/liquidation/unit/initializeLiquidation.test.ts index 5872f809b..c594f223b 100644 --- a/tests/liquidation/unit/initializeLiquidation.test.ts +++ b/tests/liquidation/unit/initializeLiquidation.test.ts @@ -1,4 +1,4 @@ -import { LiquidationClient } from "@metadaoproject/futarchy/v0.7"; +import { LiquidationClient } from "@metadaoproject/programs"; import { Keypair } from "@solana/web3.js"; import { assert } from "chai"; import * as token from "@solana/spl-token"; diff --git a/tests/liquidation/unit/refund.test.ts b/tests/liquidation/unit/refund.test.ts index 0efc3f238..d53303734 100644 --- a/tests/liquidation/unit/refund.test.ts +++ b/tests/liquidation/unit/refund.test.ts @@ -1,4 +1,4 @@ -import { LiquidationClient } from "@metadaoproject/futarchy/v0.7"; +import { LiquidationClient } from "@metadaoproject/programs"; import { Keypair, PublicKey, diff --git a/tests/liquidation/unit/setRefundRecord.test.ts b/tests/liquidation/unit/setRefundRecord.test.ts index 6d364c7c8..89bc8a876 100644 --- a/tests/liquidation/unit/setRefundRecord.test.ts +++ b/tests/liquidation/unit/setRefundRecord.test.ts @@ -1,4 +1,4 @@ -import { LiquidationClient } from "@metadaoproject/futarchy/v0.7"; +import { LiquidationClient } from "@metadaoproject/programs"; import { Keypair, PublicKey } from "@solana/web3.js"; import { assert } from "chai"; import { expectError } from "../../utils.js"; diff --git a/tests/liquidation/unit/withdrawRemainingQuote.test.ts b/tests/liquidation/unit/withdrawRemainingQuote.test.ts index a0a68d79f..e4138d300 100644 --- a/tests/liquidation/unit/withdrawRemainingQuote.test.ts +++ b/tests/liquidation/unit/withdrawRemainingQuote.test.ts @@ -1,4 +1,4 @@ -import { LiquidationClient } from "@metadaoproject/futarchy/v0.7"; +import { LiquidationClient } from "@metadaoproject/programs"; import { Keypair, PublicKey, ComputeBudgetProgram } from "@solana/web3.js"; import { assert } from "chai"; import { expectError } from "../../utils.js"; diff --git a/tests/liquidation/utils.ts b/tests/liquidation/utils.ts index 7921ddfa8..7eb28ae81 100644 --- a/tests/liquidation/utils.ts +++ b/tests/liquidation/utils.ts @@ -4,7 +4,7 @@ import { ComputeBudgetProgram, SystemProgram, } from "@solana/web3.js"; -import { LiquidationClient } from "@metadaoproject/futarchy/v0.7"; +import { LiquidationClient } from "@metadaoproject/programs"; import BN from "bn.js"; export async function setupLiquidation(ctx: Mocha.Context): Promise<{ diff --git a/tests/main.test.ts b/tests/main.test.ts index 75212cde4..3e5a879b1 100644 --- a/tests/main.test.ts +++ b/tests/main.test.ts @@ -26,7 +26,6 @@ import { SQUADS_PROGRAM_CONFIG, SQUADS_PROGRAM_ID, PERMISSIONLESS_ACCOUNT, - FUTARCHY_PROGRAM_ID, getDaoAddr, PriceMath, getProposalAddr, @@ -34,13 +33,14 @@ import { InstructionUtils, getPerformancePackageAddr, DAMM_V2_PROGRAM_ID, - LAUNCHPAD_PROGRAM_ID, - MAINNET_METEORA_CONFIG, + LAUNCHPAD_V0_7_MAINNET_METEORA_CONFIG, BidWallClient, MintGovernorClient, LiquidationClient, -} from "@metadaoproject/futarchy/v0.7"; -import { LaunchpadClient as LaunchpadClientV6 } from "@metadaoproject/futarchy/v0.6"; + LOW_FEE_RAYDIUM_CONFIG, + sha256, +} from "@metadaoproject/programs"; +import { LaunchpadClient as LaunchpadClientV6 } from "@metadaoproject/programs/launchpad/v0.6"; import { PublicKey, @@ -66,7 +66,6 @@ import { assert } from "chai"; import { MPL_TOKEN_METADATA_PROGRAM_ID as UMI_MPL_TOKEN_METADATA_PROGRAM_ID } from "@metaplex-foundation/mpl-token-metadata"; import { toWeb3JsPublicKey } from "@metaplex-foundation/umi-web3js-adapters"; import * as fs from "fs"; -import { LOW_FEE_RAYDIUM_CONFIG } from "@metadaoproject/futarchy/v0.4"; import { AccountInfo } from "@solana/web3.js"; const MPL_TOKEN_METADATA_PROGRAM_ID = toWeb3JsPublicKey( @@ -80,7 +79,6 @@ import mintAndSwap from "./integration/mintAndSwap.test.js"; import fullLaunch from "./integration/fullLaunch.test.js"; import fullLaunch_v7 from "./integration/fullLaunch_v7.test.js"; import { BN } from "bn.js"; -import { sha256 } from "@metadaoproject/futarchy"; const ONE_BUCK_PRICE = PriceMath.getAmmPrice(1, 6, 6); diff --git a/tests/mintGovernor/main.test.ts b/tests/mintGovernor/main.test.ts index 8c13c97b1..1c18af131 100644 --- a/tests/mintGovernor/main.test.ts +++ b/tests/mintGovernor/main.test.ts @@ -6,7 +6,7 @@ import removeMintAuthority from "./unit/removeMintAuthority.test.js"; import mintTokens from "./unit/mintTokens.test.js"; import updateMintGovernorAdmin from "./unit/updateMintGovernorAdmin.test.js"; import reclaimAuthority from "./unit/reclaimAuthority.test.js"; -import { MintGovernorClient } from "@metadaoproject/futarchy/v0.7"; +import { MintGovernorClient } from "@metadaoproject/programs"; import { BankrunProvider } from "anchor-bankrun"; export default function suite() { diff --git a/tests/mintGovernor/unit/addMintAuthority.test.ts b/tests/mintGovernor/unit/addMintAuthority.test.ts index 5f77a04e6..259d4a297 100644 --- a/tests/mintGovernor/unit/addMintAuthority.test.ts +++ b/tests/mintGovernor/unit/addMintAuthority.test.ts @@ -4,7 +4,7 @@ import { assert } from "chai"; import { MintGovernorClient, getMintAuthorityAddr, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { setupMintWithGovernor } from "../utils.js"; import { expectError } from "../../utils.js"; diff --git a/tests/mintGovernor/unit/initializeMintGovernor.test.ts b/tests/mintGovernor/unit/initializeMintGovernor.test.ts index a80ecb52f..2adab25f4 100644 --- a/tests/mintGovernor/unit/initializeMintGovernor.test.ts +++ b/tests/mintGovernor/unit/initializeMintGovernor.test.ts @@ -3,7 +3,7 @@ import { assert } from "chai"; import { MintGovernorClient, getMintGovernorAddr, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { createMintWithAuthority } from "../utils.js"; export default function suite() { diff --git a/tests/mintGovernor/unit/mintTokens.test.ts b/tests/mintGovernor/unit/mintTokens.test.ts index 399147a8a..5eafa6f91 100644 --- a/tests/mintGovernor/unit/mintTokens.test.ts +++ b/tests/mintGovernor/unit/mintTokens.test.ts @@ -5,7 +5,7 @@ import { assert } from "chai"; import { MintGovernorClient, getMintAuthorityAddr, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { setupMintWithGovernor, createMintAndGovernor, diff --git a/tests/mintGovernor/unit/reclaimAuthority.test.ts b/tests/mintGovernor/unit/reclaimAuthority.test.ts index c0b247b12..7d187808e 100644 --- a/tests/mintGovernor/unit/reclaimAuthority.test.ts +++ b/tests/mintGovernor/unit/reclaimAuthority.test.ts @@ -5,7 +5,7 @@ import { assert } from "chai"; import { MintGovernorClient, getMintAuthorityAddr, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { setupMintWithGovernor, createMintAndGovernor } from "../utils.js"; import { expectError } from "../../utils.js"; diff --git a/tests/mintGovernor/unit/removeMintAuthority.test.ts b/tests/mintGovernor/unit/removeMintAuthority.test.ts index c060ccfcd..d03d6e00e 100644 --- a/tests/mintGovernor/unit/removeMintAuthority.test.ts +++ b/tests/mintGovernor/unit/removeMintAuthority.test.ts @@ -4,7 +4,7 @@ import { assert } from "chai"; import { MintGovernorClient, getMintAuthorityAddr, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { setupMintWithGovernor } from "../utils.js"; import { expectError } from "../../utils.js"; diff --git a/tests/mintGovernor/unit/transferAuthorityToGovernor.test.ts b/tests/mintGovernor/unit/transferAuthorityToGovernor.test.ts index d34823c2e..2fde6e709 100644 --- a/tests/mintGovernor/unit/transferAuthorityToGovernor.test.ts +++ b/tests/mintGovernor/unit/transferAuthorityToGovernor.test.ts @@ -1,7 +1,7 @@ import { Keypair, PublicKey } from "@solana/web3.js"; import * as token from "@solana/spl-token"; import { assert } from "chai"; -import { MintGovernorClient } from "@metadaoproject/futarchy/v0.7"; +import { MintGovernorClient } from "@metadaoproject/programs"; import { createMintWithAuthority, createMintAndGovernor } from "../utils.js"; import { expectError } from "../../utils.js"; diff --git a/tests/mintGovernor/unit/updateMintAuthority.test.ts b/tests/mintGovernor/unit/updateMintAuthority.test.ts index 9aff2b6a8..40ad78884 100644 --- a/tests/mintGovernor/unit/updateMintAuthority.test.ts +++ b/tests/mintGovernor/unit/updateMintAuthority.test.ts @@ -4,7 +4,7 @@ import { assert } from "chai"; import { MintGovernorClient, getMintAuthorityAddr, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { setupMintWithGovernor } from "../utils.js"; import { expectError } from "../../utils.js"; diff --git a/tests/mintGovernor/unit/updateMintGovernorAdmin.test.ts b/tests/mintGovernor/unit/updateMintGovernorAdmin.test.ts index f30481c69..0202055a8 100644 --- a/tests/mintGovernor/unit/updateMintGovernorAdmin.test.ts +++ b/tests/mintGovernor/unit/updateMintGovernorAdmin.test.ts @@ -1,7 +1,7 @@ import { Keypair, PublicKey } from "@solana/web3.js"; import BN from "bn.js"; import { assert } from "chai"; -import { MintGovernorClient } from "@metadaoproject/futarchy/v0.7"; +import { MintGovernorClient } from "@metadaoproject/programs"; import { setupMintWithGovernor } from "../utils.js"; import { expectError } from "../../utils.js"; diff --git a/tests/mintGovernor/utils.ts b/tests/mintGovernor/utils.ts index e9193a8f6..a732db38a 100644 --- a/tests/mintGovernor/utils.ts +++ b/tests/mintGovernor/utils.ts @@ -9,7 +9,7 @@ import { BanksClient } from "solana-bankrun"; import { MintGovernorClient, getMintGovernorAddr, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; /** * Creates a mint with the payer as the mint authority diff --git a/tests/performancePackageV2/main.test.ts b/tests/performancePackageV2/main.test.ts index a8b7cf515..e6e30a9e4 100644 --- a/tests/performancePackageV2/main.test.ts +++ b/tests/performancePackageV2/main.test.ts @@ -8,7 +8,7 @@ import closePerformancePackage from "./unit/closePerformancePackage.test.js"; import { MintGovernorClient, PerformancePackageV2Client, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { BankrunProvider } from "anchor-bankrun"; export default function suite() { diff --git a/tests/performancePackageV2/unit/changeAuthority.test.ts b/tests/performancePackageV2/unit/changeAuthority.test.ts index 10b8b9344..6357b4b3b 100644 --- a/tests/performancePackageV2/unit/changeAuthority.test.ts +++ b/tests/performancePackageV2/unit/changeAuthority.test.ts @@ -4,7 +4,7 @@ import { assert } from "chai"; import { MintGovernorClient, PerformancePackageV2Client, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { setupPerformancePackageV2, createCliffLinearReward, diff --git a/tests/performancePackageV2/unit/closePerformancePackage.test.ts b/tests/performancePackageV2/unit/closePerformancePackage.test.ts index d27ae1d08..25f4b9ecc 100644 --- a/tests/performancePackageV2/unit/closePerformancePackage.test.ts +++ b/tests/performancePackageV2/unit/closePerformancePackage.test.ts @@ -4,7 +4,7 @@ import { assert } from "chai"; import { MintGovernorClient, PerformancePackageV2Client, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { setupPerformancePackageV2, createCliffLinearReward, diff --git a/tests/performancePackageV2/unit/completeUnlock.test.ts b/tests/performancePackageV2/unit/completeUnlock.test.ts index 1ca99b662..1109dc15c 100644 --- a/tests/performancePackageV2/unit/completeUnlock.test.ts +++ b/tests/performancePackageV2/unit/completeUnlock.test.ts @@ -10,7 +10,8 @@ import { assert } from "chai"; import { MintGovernorClient, PerformancePackageV2Client, -} from "@metadaoproject/futarchy/v0.7"; + getPerformancePackageV2Addr, +} from "@metadaoproject/programs"; import { setupPerformancePackageV2, setupMintGovernorWithAuthority, @@ -20,7 +21,6 @@ import { setupDaoForTwapTests, } from "../utils.js"; import { expectError } from "../../utils.js"; -import { getPerformancePackageV2Addr } from "@metadaoproject/futarchy/v0.7"; export default function suite() { let mintGovernorClient: MintGovernorClient; diff --git a/tests/performancePackageV2/unit/executeChange.test.ts b/tests/performancePackageV2/unit/executeChange.test.ts index 1450ff583..b5bb6d78c 100644 --- a/tests/performancePackageV2/unit/executeChange.test.ts +++ b/tests/performancePackageV2/unit/executeChange.test.ts @@ -4,7 +4,7 @@ import { assert } from "chai"; import { MintGovernorClient, PerformancePackageV2Client, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { setupPerformancePackageV2, createCliffLinearReward, diff --git a/tests/performancePackageV2/unit/initializePerformancePackage.test.ts b/tests/performancePackageV2/unit/initializePerformancePackage.test.ts index 1416ce079..a59a2e0a5 100644 --- a/tests/performancePackageV2/unit/initializePerformancePackage.test.ts +++ b/tests/performancePackageV2/unit/initializePerformancePackage.test.ts @@ -5,7 +5,7 @@ import { MintGovernorClient, PerformancePackageV2Client, getPerformancePackageV2Addr, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { setupMintGovernorWithAuthority, createCliffLinearReward, diff --git a/tests/performancePackageV2/unit/proposeChange.test.ts b/tests/performancePackageV2/unit/proposeChange.test.ts index 44108989b..52d761581 100644 --- a/tests/performancePackageV2/unit/proposeChange.test.ts +++ b/tests/performancePackageV2/unit/proposeChange.test.ts @@ -4,7 +4,7 @@ import { assert } from "chai"; import { MintGovernorClient, PerformancePackageV2Client, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import { setupPerformancePackageV2, createCliffLinearReward, diff --git a/tests/performancePackageV2/unit/startUnlock.test.ts b/tests/performancePackageV2/unit/startUnlock.test.ts index 753ad53bd..98ecc35e1 100644 --- a/tests/performancePackageV2/unit/startUnlock.test.ts +++ b/tests/performancePackageV2/unit/startUnlock.test.ts @@ -4,7 +4,8 @@ import { assert } from "chai"; import { MintGovernorClient, PerformancePackageV2Client, -} from "@metadaoproject/futarchy/v0.7"; + getPerformancePackageV2Addr, +} from "@metadaoproject/programs"; import { setupPerformancePackageV2, createCliffLinearReward, @@ -13,7 +14,6 @@ import { setupDaoForTwapTests, } from "../utils.js"; import { expectError } from "../../utils.js"; -import { getPerformancePackageV2Addr } from "@metadaoproject/futarchy/v0.7"; export default function suite() { let mintGovernorClient: MintGovernorClient; diff --git a/tests/performancePackageV2/utils.ts b/tests/performancePackageV2/utils.ts index dea04a66c..c9ab04597 100644 --- a/tests/performancePackageV2/utils.ts +++ b/tests/performancePackageV2/utils.ts @@ -16,11 +16,11 @@ import { getPerformancePackageV2Addr, PriceMath, getDaoAddr, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; import type { PerformancePackageV2OracleReader, PerformancePackageV2RewardFunction, -} from "@metadaoproject/futarchy/v0.7"; +} from "@metadaoproject/programs"; /** * Creates a mint with the specified authority diff --git a/tests/priceBasedPerformancePackage/unit/burnPerformancePackage.test.ts b/tests/priceBasedPerformancePackage/unit/burnPerformancePackage.test.ts index 795512fb8..73a0af2b5 100644 --- a/tests/priceBasedPerformancePackage/unit/burnPerformancePackage.test.ts +++ b/tests/priceBasedPerformancePackage/unit/burnPerformancePackage.test.ts @@ -7,10 +7,7 @@ import { import { assert } from "chai"; import { mintTo, getAccount } from "spl-token-bankrun"; import BN from "bn.js"; -import { - getPerformancePackageAddr, - Tranche, -} from "@metadaoproject/futarchy/v0.6"; +import { getPerformancePackageAddr, Tranche } from "@metadaoproject/programs"; import { expectError } from "../../utils.js"; import { getAssociatedTokenAddress } from "@solana/spl-token"; diff --git a/tests/priceBasedPerformancePackage/unit/changeLockerAuthority.test.ts b/tests/priceBasedPerformancePackage/unit/changeLockerAuthority.test.ts deleted file mode 100644 index 2e7d34709..000000000 --- a/tests/priceBasedPerformancePackage/unit/changeLockerAuthority.test.ts +++ /dev/null @@ -1,278 +0,0 @@ -import { - PublicKey, - Keypair, - Transaction, - SystemProgram, -} from "@solana/web3.js"; -import { assert } from "chai"; -import BN from "bn.js"; - -export default function () { - let createKey: Keypair; - let tokenMint: PublicKey; - let tokenAuthority: PublicKey; - let tokenAccount: PublicKey; - let recipient: Keypair; - let currentAuthority: Keypair; - let newAuthority: Keypair; - let performancePackage: PublicKey; - let oracleAccount: Keypair; - - beforeEach(async function () { - // Create test accounts - createKey = Keypair.generate(); - tokenAuthority = this.payer.publicKey; - recipient = Keypair.generate(); - currentAuthority = Keypair.generate(); - newAuthority = Keypair.generate(); - oracleAccount = Keypair.generate(); - - // Fund the accounts with SOL - const fundingTx = new Transaction().add( - SystemProgram.transfer({ - fromPubkey: this.payer.publicKey, - toPubkey: createKey.publicKey, - lamports: 1000000000, // 1 SOL - }), - SystemProgram.transfer({ - fromPubkey: this.payer.publicKey, - toPubkey: recipient.publicKey, - lamports: 1000000000, // 1 SOL - }), - SystemProgram.transfer({ - fromPubkey: this.payer.publicKey, - toPubkey: currentAuthority.publicKey, - lamports: 1000000000, // 1 SOL - }), - SystemProgram.transfer({ - fromPubkey: this.payer.publicKey, - toPubkey: newAuthority.publicKey, - lamports: 1000000000, // 1 SOL - }), - ); - fundingTx.recentBlockhash = ( - await this.context.banksClient.getLatestBlockhash() - )[0]; - fundingTx.sign(this.payer); - await this.banksClient.processTransaction(fundingTx); - - // Create token mint and accounts - tokenMint = await this.createMint(tokenAuthority, 6); - tokenAccount = await this.createTokenAccount(tokenMint, tokenAuthority); - - // Mint tokens to the authority's account - await this.mintTo(tokenMint, tokenAuthority, this.payer, 1000000); // 1M tokens - - // Initialize a performancePackage - const params = { - priceThreshold: new BN(1000000), - tokenAmount: new BN(100000), - minUnlockTimestamp: new BN( - Number((await this.context.banksClient.getClock()).unixTimestamp) + - 3600, - ), - oracleConfig: { - oracleAccount: oracleAccount.publicKey, - byteOffset: 0, - }, - twapLengthSeconds: new BN(3600), - tokenRecipient: recipient.publicKey, - performancePackageAuthority: currentAuthority.publicKey, - }; - - await this.priceBasedPerformancePackage - .initializePerformancePackageIx({ - params, - createKey: createKey.publicKey, - tokenMint, - fromTokenAccount: tokenAccount, - tokenAuthority: tokenAuthority, - payer: this.payer.publicKey, - }) - .rpc(); - - // Get performancePackage address - performancePackage = - this.priceBasedPerformancePackage.getPerformancePackage( - createKey.publicKey, - ); - }); - - it("should change performancePackage authority successfully", async function () { - // Verify initial authority - const initialPerformancePackage = - await this.priceBasedPerformancePackage.getPerformancePackage( - performancePackage, - ); - assert.equal( - initialPerformancePackage.performancePackageAuthority.toString(), - currentAuthority.publicKey.toString(), - ); - - // Change the performancePackage authority - const tx = await this.priceBasedPerformancePackage - .changePerformancePackageAuthorityIx({ - performancePackage, - currentAuthority: currentAuthority.publicKey, - newPerformancePackageAuthority: newAuthority.publicKey, - }) - .transaction(); - - tx.recentBlockhash = ( - await this.context.banksClient.getLatestBlockhash() - )[0]; - tx.feePayer = currentAuthority.publicKey; - tx.sign(currentAuthority); - await this.banksClient.processTransaction(tx); - - // Verify authority was changed - const updatedPerformancePackage = - await this.priceBasedPerformancePackage.getPerformancePackage( - performancePackage, - ); - assert.equal( - updatedPerformancePackage.performancePackageAuthority.toString(), - newAuthority.publicKey.toString(), - ); - }); - - it("should fail if unauthorized party tries to change authority", async function () { - const unauthorizedWallet = Keypair.generate(); - - // Fund the unauthorized wallet - const fundTx = new Transaction().add( - SystemProgram.transfer({ - fromPubkey: this.payer.publicKey, - toPubkey: unauthorizedWallet.publicKey, - lamports: 1000000000, // 1 SOL - }), - ); - fundTx.recentBlockhash = ( - await this.context.banksClient.getLatestBlockhash() - )[0]; - fundTx.sign(this.payer); - await this.banksClient.processTransaction(fundTx); - - try { - const tx = await this.priceBasedPerformancePackage - .changePerformancePackageAuthorityIx({ - performancePackage, - currentAuthority: unauthorizedWallet.publicKey, - newPerformancePackageAuthority: newAuthority.publicKey, - }) - .transaction(); - - tx.recentBlockhash = ( - await this.context.banksClient.getLatestBlockhash() - )[0]; - tx.feePayer = unauthorizedWallet.publicKey; - tx.sign(unauthorizedWallet); - await this.banksClient.processTransaction(tx); - - assert.fail("Should have failed with unauthorized authority change"); - } catch (error) { - assert.include(error.message.toLowerCase(), "0x1778"); - } - }); - - it("should fail if current authority doesn't match performancePackage authority", async function () { - const wrongAuthority = Keypair.generate(); - - // Fund the wrong authority - const fundTx = new Transaction().add( - SystemProgram.transfer({ - fromPubkey: this.payer.publicKey, - toPubkey: wrongAuthority.publicKey, - lamports: 1000000000, // 1 SOL - }), - ); - fundTx.recentBlockhash = ( - await this.context.banksClient.getLatestBlockhash() - )[0]; - fundTx.sign(this.payer); - await this.banksClient.processTransaction(fundTx); - - try { - const tx = await this.priceBasedPerformancePackage - .changePerformancePackageAuthorityIx({ - performancePackage, - currentAuthority: wrongAuthority.publicKey, - newPerformancePackageAuthority: newAuthority.publicKey, - }) - .transaction(); - - tx.recentBlockhash = ( - await this.context.banksClient.getLatestBlockhash() - )[0]; - tx.feePayer = wrongAuthority.publicKey; - tx.sign(wrongAuthority); - await this.banksClient.processTransaction(tx); - - assert.fail("Should have failed with wrong current authority"); - } catch (error) { - assert.include(error.message.toLowerCase(), "0x1778"); - } - }); - - it("should allow new authority to perform authority actions", async function () { - // First change the authority - const changeTx = await this.priceBasedPerformancePackage - .changePerformancePackageAuthorityIx({ - performancePackage, - currentAuthority: currentAuthority.publicKey, - newPerformancePackageAuthority: newAuthority.publicKey, - }) - .transaction(); - - changeTx.recentBlockhash = ( - await this.context.banksClient.getLatestBlockhash() - )[0]; - changeTx.feePayer = currentAuthority.publicKey; - changeTx.sign(currentAuthority); - await this.banksClient.processTransaction(changeTx); - - // Now try to propose a change using the new authority - const pdaNonce = Math.floor(Math.random() * 1000000); - const proposeTx = await this.priceBasedPerformancePackage - .proposeChangeIx({ - params: { - changeType: { - oracle: { - newOracleConfig: { - oracleAccount: Keypair.generate().publicKey, - byteOffset: 8, - }, - }, - }, - pdaNonce: pdaNonce, - }, - performancePackage, - proposer: newAuthority.publicKey, // New authority proposes - payer: newAuthority.publicKey, - }) - .transaction(); - - proposeTx.recentBlockhash = ( - await this.context.banksClient.getLatestBlockhash() - )[0]; - proposeTx.feePayer = newAuthority.publicKey; - proposeTx.sign(newAuthority); - await this.banksClient.processTransaction(proposeTx); - - // Verify the change request was created successfully - const changeRequestAddr = - this.priceBasedPerformancePackage.getChangeRequestAddress( - performancePackage, - newAuthority.publicKey, - pdaNonce, - ); - const changeRequest = - await this.priceBasedPerformancePackage.getChangeRequest( - changeRequestAddr, - ); - assert.equal( - changeRequest.proposer.toString(), - newAuthority.publicKey.toString(), - ); - }); -} diff --git a/tests/priceBasedPerformancePackage/unit/completeUnlock.test.ts b/tests/priceBasedPerformancePackage/unit/completeUnlock.test.ts index 7dc2be49c..fb5c4416d 100644 --- a/tests/priceBasedPerformancePackage/unit/completeUnlock.test.ts +++ b/tests/priceBasedPerformancePackage/unit/completeUnlock.test.ts @@ -8,7 +8,7 @@ import { import { assert } from "chai"; import * as token from "@solana/spl-token"; import BN from "bn.js"; -import { getPerformancePackageAddr } from "@metadaoproject/futarchy/v0.6"; +import { getPerformancePackageAddr } from "@metadaoproject/programs"; import { expectError } from "../../utils.js"; export default function () { diff --git a/tests/priceBasedPerformancePackage/unit/executeChange.test.ts b/tests/priceBasedPerformancePackage/unit/executeChange.test.ts index 42d8f0f03..bf559e515 100644 --- a/tests/priceBasedPerformancePackage/unit/executeChange.test.ts +++ b/tests/priceBasedPerformancePackage/unit/executeChange.test.ts @@ -7,7 +7,7 @@ import { import { assert } from "chai"; import BN from "bn.js"; import { expectError } from "../../utils.js"; -import { getChangeRequestAddr } from "@metadaoproject/futarchy/v0.6"; +import { getChangeRequestAddr } from "@metadaoproject/programs"; export default function () { let createKey: Keypair; diff --git a/tests/priceBasedPerformancePackage/unit/initializePerformancePackage.test.ts b/tests/priceBasedPerformancePackage/unit/initializePerformancePackage.test.ts index 6cc8a6831..a88207fdd 100644 --- a/tests/priceBasedPerformancePackage/unit/initializePerformancePackage.test.ts +++ b/tests/priceBasedPerformancePackage/unit/initializePerformancePackage.test.ts @@ -9,8 +9,9 @@ import { mintTo, getAccount } from "spl-token-bankrun"; import BN from "bn.js"; import { getPerformancePackageAddr, + InitializePerformancePackageParams, Tranche, -} from "@metadaoproject/futarchy/v0.6"; +} from "@metadaoproject/programs"; import { expectError } from "../../utils.js"; export default function () { @@ -88,7 +89,7 @@ export default function () { tokenAmount: new BN(200000), }, ]; - const params = { + const params: InitializePerformancePackageParams = { tranches, grantee: recipient.publicKey, performancePackageAuthority: this.payer.publicKey, @@ -100,8 +101,7 @@ export default function () { oracleAccount: oracleAccount.publicKey, byteOffset: 0, }, - twapLengthSeconds: new BN(86_400), // 1 day - tokenRecipient: recipient.publicKey, + twapLengthSeconds: 86_400, // 1 day }; const tx = await this.priceBasedPerformancePackage @@ -202,7 +202,7 @@ export default function () { fundingTx.sign(this.payer); await this.banksClient.processTransaction(fundingTx); - const params = { + const params: InitializePerformancePackageParams = { tranches: [ { priceThreshold: new BN(1000000), @@ -219,8 +219,7 @@ export default function () { oracleAccount: oracleAccount.publicKey, byteOffset: 0, }, - twapLengthSeconds: new BN(24 * 60 * 60), - tokenRecipient: recipient.publicKey, + twapLengthSeconds: 24 * 60 * 60, }; const tx = await this.priceBasedPerformancePackage @@ -255,7 +254,7 @@ export default function () { it("should fail if recipient equals authority", async function () { const sameKeyCreateKey = Keypair.generate(); - const params = { + const params: InitializePerformancePackageParams = { tranches: [ { priceThreshold: new BN(1000000), @@ -272,8 +271,7 @@ export default function () { oracleAccount: oracleAccount.publicKey, byteOffset: 0, }, - twapLengthSeconds: new BN(86_400), - tokenRecipient: this.payer.publicKey, + twapLengthSeconds: 86_400, }; const callbacks = expectError( @@ -310,7 +308,7 @@ export default function () { fundingTx.sign(this.payer); await this.banksClient.processTransaction(fundingTx); - const params = { + const params: InitializePerformancePackageParams = { tranches: [ { priceThreshold: new BN(1000000), @@ -327,8 +325,7 @@ export default function () { oracleAccount: oracleAccount.publicKey, byteOffset: 0, }, - twapLengthSeconds: new BN(3600), - tokenRecipient: recipient.publicKey, + twapLengthSeconds: 3600, }; const callbacks = expectError( diff --git a/tests/priceBasedPerformancePackage/unit/startUnlock.test.ts b/tests/priceBasedPerformancePackage/unit/startUnlock.test.ts index b17d10528..5cac0ff20 100644 --- a/tests/priceBasedPerformancePackage/unit/startUnlock.test.ts +++ b/tests/priceBasedPerformancePackage/unit/startUnlock.test.ts @@ -10,7 +10,7 @@ import { import { assert } from "chai"; import * as token from "@solana/spl-token"; import BN from "bn.js"; -import { getPerformancePackageAddr } from "@metadaoproject/futarchy/v0.6"; +import { getPerformancePackageAddr } from "@metadaoproject/programs"; import { expectError } from "../../utils.js"; export default function () { diff --git a/tests/utils.ts b/tests/utils.ts index af52b0241..26a197040 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -10,7 +10,7 @@ import { Transaction, } from "@solana/web3.js"; import { TestContext } from "./main.test.js"; -import { getDaoAddr, PriceMath } from "@metadaoproject/futarchy/v0.6"; +import { getDaoAddr, PriceMath } from "@metadaoproject/programs"; export const TEN_SECONDS_IN_SLOTS = 25n; export const ONE_MINUTE_IN_SLOTS = TEN_SECONDS_IN_SLOTS * 6n; @@ -78,7 +78,7 @@ export async function setOptimisticGovernanceEnabled( const daoAccount = await context.futarchy.getDao(dao); daoAccount.isOptimisticGovernanceEnabled = enabled; const daoAccountBuffer = - await context.futarchy.autocrat.account.dao.coder.accounts.encode( + await context.futarchy.futarchy.account.dao.coder.accounts.encode( "dao", daoAccount, ); diff --git a/tsconfig.json b/tsconfig.json index f1dd71d77..f7ad19bd9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,6 +16,7 @@ "moduleResolution": "nodenext", "esModuleInterop": true, "resolveJsonModule": true, + "skipLibCheck": true, "paths": { "@solana/spl-token": [ "./node_modules/@solana/spl-token" diff --git a/yarn.lock b/yarn.lock index 8a17c79e7..374642413 100644 --- a/yarn.lock +++ b/yarn.lock @@ -138,161 +138,81 @@ resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.25.11.tgz#2ae33300598132cc4cf580dbbb28d30fed3c5c49" integrity sha512-Xt1dOL13m8u0WE8iplx9Ibbm+hFAO0GsU2P34UNoDGvZYkY8ifSiy6Zuc1lYxfG7svWE2fzqCUmFp5HCn51gJg== -"@esbuild/android-arm64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz#bafb75234a5d3d1b690e7c2956a599345e84a2fd" - integrity sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA== - "@esbuild/android-arm64@0.25.11": version "0.25.11" resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.25.11.tgz#927708b3db5d739d6cb7709136924cc81bec9b03" integrity sha512-9slpyFBc4FPPz48+f6jyiXOx/Y4v34TUeDDXJpZqAWQn/08lKGeD8aDp9TMn9jDz2CiEuHwfhRmGBvpnd/PWIQ== -"@esbuild/android-arm@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.17.19.tgz#5898f7832c2298bc7d0ab53701c57beb74d78b4d" - integrity sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A== - "@esbuild/android-arm@0.25.11": version "0.25.11" resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.25.11.tgz#571f94e7f4068957ec4c2cfb907deae3d01b55ae" integrity sha512-uoa7dU+Dt3HYsethkJ1k6Z9YdcHjTrSb5NUy66ZfZaSV8hEYGD5ZHbEMXnqLFlbBflLsl89Zke7CAdDJ4JI+Gg== -"@esbuild/android-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.17.19.tgz#658368ef92067866d95fb268719f98f363d13ae1" - integrity sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww== - "@esbuild/android-x64@0.25.11": version "0.25.11" resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.25.11.tgz#8a3bf5cae6c560c7ececa3150b2bde76e0fb81e6" integrity sha512-Sgiab4xBjPU1QoPEIqS3Xx+R2lezu0LKIEcYe6pftr56PqPygbB7+szVnzoShbx64MUupqoE0KyRlN7gezbl8g== -"@esbuild/darwin-arm64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz#584c34c5991b95d4d48d333300b1a4e2ff7be276" - integrity sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg== - "@esbuild/darwin-arm64@0.25.11": version "0.25.11" resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.25.11.tgz#0a678c4ac4bf8717e67481e1a797e6c152f93c84" integrity sha512-VekY0PBCukppoQrycFxUqkCojnTQhdec0vevUL/EDOCnXd9LKWqD/bHwMPzigIJXPhC59Vd1WFIL57SKs2mg4w== -"@esbuild/darwin-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz#7751d236dfe6ce136cce343dce69f52d76b7f6cb" - integrity sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw== - "@esbuild/darwin-x64@0.25.11": version "0.25.11" resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.25.11.tgz#70f5e925a30c8309f1294d407a5e5e002e0315fe" integrity sha512-+hfp3yfBalNEpTGp9loYgbknjR695HkqtY3d3/JjSRUyPg/xd6q+mQqIb5qdywnDxRZykIHs3axEqU6l1+oWEQ== -"@esbuild/freebsd-arm64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz#cacd171665dd1d500f45c167d50c6b7e539d5fd2" - integrity sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ== - "@esbuild/freebsd-arm64@0.25.11": version "0.25.11" resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.11.tgz#4ec1db687c5b2b78b44148025da9632397553e8a" integrity sha512-CmKjrnayyTJF2eVuO//uSjl/K3KsMIeYeyN7FyDBjsR3lnSJHaXlVoAK8DZa7lXWChbuOk7NjAc7ygAwrnPBhA== -"@esbuild/freebsd-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz#0769456eee2a08b8d925d7c00b79e861cb3162e4" - integrity sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ== - "@esbuild/freebsd-x64@0.25.11": version "0.25.11" resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.25.11.tgz#4c81abd1b142f1e9acfef8c5153d438ca53f44bb" integrity sha512-Dyq+5oscTJvMaYPvW3x3FLpi2+gSZTCE/1ffdwuM6G1ARang/mb3jvjxs0mw6n3Lsw84ocfo9CrNMqc5lTfGOw== -"@esbuild/linux-arm64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz#38e162ecb723862c6be1c27d6389f48960b68edb" - integrity sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg== - "@esbuild/linux-arm64@0.25.11": version "0.25.11" resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.25.11.tgz#69517a111acfc2b93aa0fb5eaeb834c0202ccda5" integrity sha512-Qr8AzcplUhGvdyUF08A1kHU3Vr2O88xxP0Tm8GcdVOUm25XYcMPp2YqSVHbLuXzYQMf9Bh/iKx7YPqECs6ffLA== -"@esbuild/linux-arm@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz#1a2cd399c50040184a805174a6d89097d9d1559a" - integrity sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA== - "@esbuild/linux-arm@0.25.11": version "0.25.11" resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.25.11.tgz#58dac26eae2dba0fac5405052b9002dac088d38f" integrity sha512-TBMv6B4kCfrGJ8cUPo7vd6NECZH/8hPpBHHlYI3qzoYFvWu2AdTvZNuU/7hsbKWqu/COU7NIK12dHAAqBLLXgw== -"@esbuild/linux-ia32@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz#e28c25266b036ce1cabca3c30155222841dc035a" - integrity sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ== - "@esbuild/linux-ia32@0.25.11": version "0.25.11" resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.25.11.tgz#b89d4efe9bdad46ba944f0f3b8ddd40834268c2b" integrity sha512-TmnJg8BMGPehs5JKrCLqyWTVAvielc615jbkOirATQvWWB1NMXY77oLMzsUjRLa0+ngecEmDGqt5jiDC6bfvOw== -"@esbuild/linux-loong64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz#0f887b8bb3f90658d1a0117283e55dbd4c9dcf72" - integrity sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ== - "@esbuild/linux-loong64@0.25.11": version "0.25.11" resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.25.11.tgz#11f603cb60ad14392c3f5c94d64b3cc8b630fbeb" integrity sha512-DIGXL2+gvDaXlaq8xruNXUJdT5tF+SBbJQKbWy/0J7OhU8gOHOzKmGIlfTTl6nHaCOoipxQbuJi7O++ldrxgMw== -"@esbuild/linux-mips64el@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz#f5d2a0b8047ea9a5d9f592a178ea054053a70289" - integrity sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A== - "@esbuild/linux-mips64el@0.25.11": version "0.25.11" resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.25.11.tgz#b7d447ff0676b8ab247d69dac40a5cf08e5eeaf5" integrity sha512-Osx1nALUJu4pU43o9OyjSCXokFkFbyzjXb6VhGIJZQ5JZi8ylCQ9/LFagolPsHtgw6himDSyb5ETSfmp4rpiKQ== -"@esbuild/linux-ppc64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz#876590e3acbd9fa7f57a2c7d86f83717dbbac8c7" - integrity sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg== - "@esbuild/linux-ppc64@0.25.11": version "0.25.11" resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.25.11.tgz#b3a28ed7cc252a61b07ff7c8fd8a984ffd3a2f74" integrity sha512-nbLFgsQQEsBa8XSgSTSlrnBSrpoWh7ioFDUmwo158gIm5NNP+17IYmNWzaIzWmgCxq56vfr34xGkOcZ7jX6CPw== -"@esbuild/linux-riscv64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz#7f49373df463cd9f41dc34f9b2262d771688bf09" - integrity sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA== - "@esbuild/linux-riscv64@0.25.11": version "0.25.11" resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.25.11.tgz#ce75b08f7d871a75edcf4d2125f50b21dc9dc273" integrity sha512-HfyAmqZi9uBAbgKYP1yGuI7tSREXwIb438q0nqvlpxAOs3XnZ8RsisRfmVsgV486NdjD7Mw2UrFSw51lzUk1ww== -"@esbuild/linux-s390x@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz#e2afd1afcaf63afe2c7d9ceacd28ec57c77f8829" - integrity sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q== - "@esbuild/linux-s390x@0.25.11": version "0.25.11" resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.25.11.tgz#cd08f6c73b6b6ff9ccdaabbd3ff6ad3dca99c263" integrity sha512-HjLqVgSSYnVXRisyfmzsH6mXqyvj0SA7pG5g+9W7ESgwA70AXYNpfKBqh1KbTxmQVaYxpzA/SvlB9oclGPbApw== -"@esbuild/linux-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz#8a0e9738b1635f0c53389e515ae83826dec22aa4" - integrity sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw== - "@esbuild/linux-x64@0.25.11": version "0.25.11" resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.25.11.tgz#3c3718af31a95d8946ebd3c32bb1e699bdf74910" @@ -303,11 +223,6 @@ resolved "https://registry.yarnpkg.com/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.11.tgz#b4c767082401e3a4e8595fe53c47cd7f097c8077" integrity sha512-hr9Oxj1Fa4r04dNpWr3P8QKVVsjQhqrMSUzZzf+LZcYjZNqhA3IAfPQdEh1FLVUJSiu6sgAwp3OmwBfbFgG2Xg== -"@esbuild/netbsd-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz#c29fb2453c6b7ddef9a35e2c18b37bda1ae5c462" - integrity sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q== - "@esbuild/netbsd-x64@0.25.11": version "0.25.11" resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.25.11.tgz#f2a930458ed2941d1f11ebc34b9c7d61f7a4d034" @@ -318,11 +233,6 @@ resolved "https://registry.yarnpkg.com/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.11.tgz#b4ae93c75aec48bc1e8a0154957a05f0641f2dad" integrity sha512-Qq6YHhayieor3DxFOoYM1q0q1uMFYb7cSpLD2qzDSvK1NAvqFi8Xgivv0cFC6J+hWVw2teCYltyy9/m/14ryHg== -"@esbuild/openbsd-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz#95e75a391403cb10297280d524d66ce04c920691" - integrity sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g== - "@esbuild/openbsd-x64@0.25.11": version "0.25.11" resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.25.11.tgz#b42863959c8dcf9b01581522e40012d2c70045e2" @@ -333,41 +243,21 @@ resolved "https://registry.yarnpkg.com/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.11.tgz#b2e717141c8fdf6bddd4010f0912e6b39e1640f1" integrity sha512-rOREuNIQgaiR+9QuNkbkxubbp8MSO9rONmwP5nKncnWJ9v5jQ4JxFnLu4zDSRPf3x4u+2VN4pM4RdyIzDty/wQ== -"@esbuild/sunos-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz#722eaf057b83c2575937d3ffe5aeb16540da7273" - integrity sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg== - "@esbuild/sunos-x64@0.25.11": version "0.25.11" resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.25.11.tgz#9fbea1febe8778927804828883ec0f6dd80eb244" integrity sha512-nq2xdYaWxyg9DcIyXkZhcYulC6pQ2FuCgem3LI92IwMgIZ69KHeY8T4Y88pcwoLIjbed8n36CyKoYRDygNSGhA== -"@esbuild/win32-arm64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz#9aa9dc074399288bdcdd283443e9aeb6b9552b6f" - integrity sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag== - "@esbuild/win32-arm64@0.25.11": version "0.25.11" resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.25.11.tgz#501539cedb24468336073383989a7323005a8935" integrity sha512-3XxECOWJq1qMZ3MN8srCJ/QfoLpL+VaxD/WfNRm1O3B4+AZ/BnLVgFbUV3eiRYDMXetciH16dwPbbHqwe1uU0Q== -"@esbuild/win32-ia32@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz#95ad43c62ad62485e210f6299c7b2571e48d2b03" - integrity sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw== - "@esbuild/win32-ia32@0.25.11": version "0.25.11" resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.25.11.tgz#8ac7229aa82cef8f16ffb58f1176a973a7a15343" integrity sha512-3ukss6gb9XZ8TlRyJlgLn17ecsK4NSQTmdIXRASVsiS2sQ6zPPZklNJT5GR5tE/MUarymmy8kCEf5xPCNCqVOA== -"@esbuild/win32-x64@0.17.19": - version "0.17.19" - resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz#8cfaf2ff603e9aabb910e9c0558c26cf32744061" - integrity sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA== - "@esbuild/win32-x64@0.25.11": version "0.25.11" resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.25.11.tgz#5ecda6f3fe138b7e456f4e429edde33c823f392f" @@ -974,20 +864,15 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" -"@metadaoproject/futarchy@./sdk": - version "0.7.4-alpha.3" +"@metadaoproject/programs@./sdk": + version "0.1.0-alpha.1" dependencies: "@coral-xyz/anchor" "^0.29.0" - "@metaplex-foundation/umi" "^0.9.2" - "@metaplex-foundation/umi-bundle-defaults" "^0.9.2" - "@metaplex-foundation/umi-uploader-bundlr" "^0.9.2" "@noble/hashes" "^1.4.0" "@solana/spl-token" "^0.3.7" "@solana/web3.js" "^1.76.0" "@sqds/multisig" "^2.1.4" bn.js "^5.2.1" - decimal.js "^10.4.3" - esbuild "^0.17.15" "@metaplex-foundation/beet-solana@0.4.0": version "0.4.0" @@ -1035,7 +920,7 @@ resolved "https://registry.yarnpkg.com/@metaplex-foundation/mpl-toolbox/-/mpl-toolbox-0.10.0.tgz#c7d2f27259e69ab86cc4b7dd55b7bfef11bbed13" integrity sha512-84KD1L5cFyw5xnntHwL4uPwfcrkKSiwuDeypiVr92qCUFuF3ZENa2zlFVPu+pQcjTlod2LmEX3MhBmNjRMpdKg== -"@metaplex-foundation/umi-bundle-defaults@^0.9.1", "@metaplex-foundation/umi-bundle-defaults@^0.9.2": +"@metaplex-foundation/umi-bundle-defaults@^0.9.1": version "0.9.2" resolved "https://registry.yarnpkg.com/@metaplex-foundation/umi-bundle-defaults/-/umi-bundle-defaults-0.9.2.tgz#f8e296b1a0ecb3a6511dbaca4131bc9263071cfc" integrity sha512-kV3tfvgvRjVP1p9OFOtH+ibOtN9omVJSwKr0We4/9r45e5LTj+32su0V/rixZUkG1EZzzOYBsxhtIE0kIw/Hrw== @@ -1147,7 +1032,7 @@ dependencies: "@metaplex-foundation/umi-web3js-adapters" "^0.9.2" -"@metaplex-foundation/umi-uploader-bundlr@^0.9.1", "@metaplex-foundation/umi-uploader-bundlr@^0.9.2": +"@metaplex-foundation/umi-uploader-bundlr@^0.9.1": version "0.9.2" resolved "https://registry.yarnpkg.com/@metaplex-foundation/umi-uploader-bundlr/-/umi-uploader-bundlr-0.9.2.tgz#0d832816a32970cac9f412a0b0a8234415ab8534" integrity sha512-wmixKqWyEO0lRB2GNvm5XOwi3jEyCtPZ6Oqds6sY5YHYdrn1Cqgd1TcdAuu7+DuojcNFErTjWsaQ1F9QR502QQ== @@ -1171,7 +1056,7 @@ dependencies: buffer "^6.0.3" -"@metaplex-foundation/umi@^0.9.1", "@metaplex-foundation/umi@^0.9.2": +"@metaplex-foundation/umi@^0.9.1": version "0.9.2" resolved "https://registry.yarnpkg.com/@metaplex-foundation/umi/-/umi-0.9.2.tgz#6460bff91d2ac7745842eda1ee6a28fba4d2ffb2" integrity sha512-9i4Acm4pruQfJcpRrc2EauPBwkfDN0I9QTvJyZocIlKgoZwD6A6wH0PViH1AjOVG5CQCd1YI3tJd5XjYE1ElBw== @@ -2494,7 +2379,7 @@ decamelize@^4.0.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== -decimal.js@^10.4.2, decimal.js@^10.4.3: +decimal.js@^10.4.2: version "10.6.0" resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.6.0.tgz#e649a43e3ab953a72192ff5983865e509f37ed9a" integrity sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg== @@ -2654,34 +2539,6 @@ es6-promisify@^5.0.0: dependencies: es6-promise "^4.0.3" -esbuild@^0.17.15: - version "0.17.19" - resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.17.19.tgz#087a727e98299f0462a3d0bcdd9cd7ff100bd955" - integrity sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw== - optionalDependencies: - "@esbuild/android-arm" "0.17.19" - "@esbuild/android-arm64" "0.17.19" - "@esbuild/android-x64" "0.17.19" - "@esbuild/darwin-arm64" "0.17.19" - "@esbuild/darwin-x64" "0.17.19" - "@esbuild/freebsd-arm64" "0.17.19" - "@esbuild/freebsd-x64" "0.17.19" - "@esbuild/linux-arm" "0.17.19" - "@esbuild/linux-arm64" "0.17.19" - "@esbuild/linux-ia32" "0.17.19" - "@esbuild/linux-loong64" "0.17.19" - "@esbuild/linux-mips64el" "0.17.19" - "@esbuild/linux-ppc64" "0.17.19" - "@esbuild/linux-riscv64" "0.17.19" - "@esbuild/linux-s390x" "0.17.19" - "@esbuild/linux-x64" "0.17.19" - "@esbuild/netbsd-x64" "0.17.19" - "@esbuild/openbsd-x64" "0.17.19" - "@esbuild/sunos-x64" "0.17.19" - "@esbuild/win32-arm64" "0.17.19" - "@esbuild/win32-ia32" "0.17.19" - "@esbuild/win32-x64" "0.17.19" - esbuild@~0.25.0: version "0.25.11" resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.25.11.tgz#0f31b82f335652580f75ef6897bba81962d9ae3d" @@ -4729,10 +4586,10 @@ typescript-eslint@^8.43.0: "@typescript-eslint/typescript-estree" "8.46.2" "@typescript-eslint/utils" "8.46.2" -typescript@^4.3.5: - version "4.9.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" - integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== +typescript@5.9.3: + version "5.9.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.3.tgz#5b4f59e15310ab17a216f5d6cf53ee476ede670f" + integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw== u3@^0.1.1: version "0.1.1"