diff --git a/.cursor/rules/futarchy-project-overview.mdc b/.cursor/rules/futarchy-project-overview.mdc index 405a367a8..02b78a660 100644 --- a/.cursor/rules/futarchy-project-overview.mdc +++ b/.cursor/rules/futarchy-project-overview.mdc @@ -33,7 +33,7 @@ This is a Solana-based futarchy platform that implements decision markets and DA - Programs follow Anchor's instruction-based architecture ### Testing Patterns -- Tests use `bankrun` for fast, deterministic testing +- Tests run in-process on LiteSVM (via `tests/litesvm/`) for fast, deterministic testing - Complex transactions use lookup tables and `TransactionMessage` for large account lists - Tests often require full proposal lifecycle setup (draft → stake → initialize → crank → finalize). We generally do that setup in `before` and `beforeEach` blocks diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 4792db7d3..1b25a7f6c 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -4,17 +4,19 @@ # is released on GitHub. # -FROM rust:1.75 +FROM rust:1.95 ARG DEBIAN_FRONTEND=noninteractive -ARG SOLANA_CLI="1.17.16" -ARG ANCHOR_CLI="0.29.0" -ARG NODE_VERSION="v18.16.0" +ARG SOLANA_CLI="4.3.0" +ARG CARGO_BUILD_SBF="4.4.0" +ARG ANCHOR_CLI="0.32.2" +ARG NODE_VERSION="v20.18.0" ENV HOME="/root" -ENV PATH="${HOME}/.cargo/bin:${PATH}" +# The cargo bin directory comes first so the standalone cargo-build-sbf wins over the copy Agave bundles. ENV PATH="${HOME}/.local/share/solana/install/active_release/bin:${PATH}" +ENV PATH="${HOME}/.cargo/bin:${PATH}" ENV PATH="${HOME}/.nvm/versions/node/${NODE_VERSION}/bin:${PATH}" # Install base utilities. @@ -26,10 +28,8 @@ RUN mkdir -p /workdir && mkdir -p /tmp && \ #RUN wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.19_amd64.deb #RUN dpkg -i libssl1.1_1.1.1f-1ubuntu2.19_amd64.deb -# Install rust. -RUN curl "https://sh.rustup.rs" -sfo rustup.sh && \ - sh rustup.sh -y && \ - rustup component add rustfmt clippy +# The base image ships the Rust version rust-toolchain.toml pins; add its components. +RUN rustup component add rustfmt clippy # Install node / npm / yarn. RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash @@ -41,7 +41,10 @@ RUN . $NVM_DIR/nvm.sh && \ npm install -g yarn # Install Solana tools. -RUN sh -c "$(curl -sSfL https://release.solana.com/v${SOLANA_CLI}/install)" +RUN sh -c "$(curl -sSfL https://release.anza.xyz/v${SOLANA_CLI}/install)" + +# Install the standalone cargo-build-sbf, which emits SBPFv3 by default. +RUN cargo install cargo-build-sbf --version ${CARGO_BUILD_SBF} --locked # Install anchor. RUN cargo install --git https://github.com/coral-xyz/anchor avm --locked --force diff --git a/.github/actions/anchor-test/action.yml b/.github/actions/anchor-test/action.yml index fe2f8b98c..bf22efd22 100644 --- a/.github/actions/anchor-test/action.yml +++ b/.github/actions/anchor-test/action.yml @@ -1,5 +1,5 @@ name: 'Anchor Test' -description: 'An "anchor test" action that runs in ~1 minute.' +description: 'Build the programs as SBPFv3 and run the test suite.' branding: icon: anchor color: blue @@ -7,15 +7,15 @@ inputs: node-version: description: 'Version of node.js to use' required: false - default: '20.11.0' # LTS + default: '24.22.1' solana-cli-version: - description: 'Version of Solana CLI to use' + description: 'Version of the Agave CLI to use' required: false - default: '1.17.16' # stable + default: '4.3.0' anchor-version: - description: 'Version of Anchor to use' + description: 'Version of the Anchor CLI to use' required: false - default: '0.29.0' # latest + default: '0.32.2' features: description: 'Features to pass to cargo' required: false @@ -23,7 +23,7 @@ inputs: runs: using: 'composite' steps: - - uses: metadaoproject/setup-anchor@aeeb5505f3fd3d52a1080d14863c6aa428c9fdf9 # v3.4 + - uses: ./.github/actions/setup-toolchain with: node-version: ${{ inputs.node-version }} solana-cli-version: ${{ inputs.solana-cli-version }} @@ -39,17 +39,11 @@ runs: - name: Create keypair run: solana-keygen new --no-bip39-passphrase shell: bash - - name: Make Anchor.toml compatible with runner - run: sed -i 's:/user/:/runner/:' Anchor.toml - shell: bash - - name: Install Cargo toolchain - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7 - with: - toolchain: stable - profile: minimal - components: rustc - name: Cache Cargo dependencies uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + - name: Build programs + run: anchor build -- --features ${{ inputs.features }} + shell: bash - name: Run tests - run: anchor test -- --features ${{ inputs.features }} + run: anchor test --skip-build shell: bash diff --git a/.github/actions/setup-toolchain/action.yml b/.github/actions/setup-toolchain/action.yml new file mode 100644 index 000000000..c0271b15b --- /dev/null +++ b/.github/actions/setup-toolchain/action.yml @@ -0,0 +1,67 @@ +name: 'Setup Toolchain' +description: 'Install Node.js, the Rust version pinned in rust-toolchain.toml, the Agave CLI, the Anchor CLI and the standalone cargo-build-sbf.' +inputs: + node-version: + description: 'Version of Node.js to use' + required: false + default: '24.22.1' + solana-cli-version: + description: 'Version of the Agave CLI to use' + required: false + default: '4.3.0' + anchor-version: + description: 'Version of the Anchor CLI to use' + required: false + default: '0.32.2' + cargo-build-sbf-version: + description: 'Version of the standalone cargo-build-sbf to use' + required: false + default: '4.4.0' +runs: + using: 'composite' + steps: + - uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node-version }} + # Installs the Rust version pinned in rust-toolchain.toml. + - name: Install Rust + run: rustup toolchain install + shell: bash + - name: Cache Agave CLI + uses: actions/cache@v4 + id: cache-agave + with: + path: ~/.local/share/solana/ + key: agave-${{ runner.os }}-${{ inputs.solana-cli-version }} + - name: Install Agave CLI + if: steps.cache-agave.outputs.cache-hit != 'true' + run: sh -c "$(curl -sSfL https://release.anza.xyz/v${{ inputs.solana-cli-version }}/install)" + shell: bash + - name: Install Anchor CLI + run: npm i -g @anchor-lang/cli@${{ inputs.anchor-version }} + shell: bash + - name: Cache cargo-build-sbf + uses: actions/cache@v4 + id: cache-cargo-build-sbf + with: + path: ~/.cargo/bin/cargo-build-sbf + key: cargo-build-sbf-${{ runner.os }}-${{ inputs.cargo-build-sbf-version }} + - name: Install cargo-build-sbf + if: steps.cache-cargo-build-sbf.outputs.cache-hit != 'true' + run: cargo install cargo-build-sbf --version ${{ inputs.cargo-build-sbf-version }} --locked + shell: bash + # Later lines end up earlier on PATH, so the cargo-installed cargo-build-sbf wins over the copy Agave bundles. + - name: Put the toolchain on PATH + run: | + echo "$HOME/.local/share/solana/install/active_release/bin" >> "$GITHUB_PATH" + echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" + shell: bash + - name: Check tool versions + run: | + rustc --version + solana --version + [ "$(anchor --version)" = "anchor-cli ${{ inputs.anchor-version }}" ] || + { echo "anchor --version must print anchor-cli ${{ inputs.anchor-version }}"; exit 1; } + [ "$(cargo build-sbf --version | head -1)" = "cargo-build-sbf ${{ inputs.cargo-build-sbf-version }}" ] || + { echo "cargo-build-sbf ${{ inputs.cargo-build-sbf-version }} must be the first cargo-build-sbf on PATH"; exit 1; } + shell: bash diff --git a/.github/actions/solana/verify-build/action.yaml b/.github/actions/solana/verify-build/action.yaml index c69e77ca2..2e313e01d 100644 --- a/.github/actions/solana/verify-build/action.yaml +++ b/.github/actions/solana/verify-build/action.yaml @@ -91,6 +91,7 @@ runs: --program-id ${{ inputs.program-id }} \ --url ${{ inputs.rpc-url }} \ --library-name ${{ inputs.program }} \ + --arch v3 \ -k ./deploy-keypair.json \ $ARGS \ ${{ inputs.repo-url }} \ @@ -108,6 +109,7 @@ runs: ${{ inputs.repo-url }} \ --program-id ${{ inputs.program-id }} \ --library-name ${{ inputs.program }} \ + --arch v3 \ --uploader ${{ inputs.vault-address }} \ --commit-hash ${{ inputs.commit-hash }} \ --url ${{ inputs.rpc-url }} \ diff --git a/.github/repo-guard.toml b/.github/repo-guard.toml index 2b27009c3..d632f6731 100644 --- a/.github/repo-guard.toml +++ b/.github/repo-guard.toml @@ -5,36 +5,28 @@ [toolchain] # Anchor CLI version. Consistent across every workflow. -anchor_version = "0.29.0" +anchor_version = "0.32.2" -# Solana CLI declared in Anchor.toml `[toolchain] solana_version`. Local-dev -# only: anchor test on a developer machine auto-installs this version. CI -# workflows pass their own solana-cli-version explicitly and ignore Anchor.toml. -local_dev_solana_version = "1.17.34" +# Solana CLI declared in Anchor.toml `[toolchain] solana_version`. anchor test +# on a developer machine auto-installs this version. CI workflows pass their +# own solana-cli-version explicitly, except `reusable-build.yaml`, which reads +# this same Anchor.toml value. +local_dev_solana_version = "4.3.0" -# Per-workflow Solana CLI versions. The split is intentional: -# -# 1.17.31 - build/test workflows that compile programs locally. This is the -# newest tag published as `ellipsislabs/solana:` on Docker -# Hub, which is what solana-verify uses to reproduce the deployed -# .so files. Changing this version changes the bytes that -# solana-verify expects, breaking verification of deployed -# programs unless they are rebuilt. -# -# 1.17.16 - CLI tooling workflows. These do not compile - they only invoke -# `solana program write-buffer` / `solana-verify --remote`, which -# talk to the cluster RPC. The version mostly does not matter; -# 1.17.16 is what the repo has used and there is no reason to -# move it. +# Per-workflow Solana CLI versions. Every workflow that compiles programs or +# talks to a cluster runs the Agave 4.3.0 CLI: the artifacts are SBPFv3, which +# a pre-4.x CLI rejects in `solana program write-buffer`. Verifiable builds +# compile inside the solana-verify Docker image, so +# `generate-verifiable-builds.yaml` declares no CLI version. # # `reusable-build.yaml` is intentionally not in this map: it reads versions -# from Cargo.lock via `solana-developers/github-actions/extract-versions`, -# so the version is dynamic and stays in sync with the workspace. +# from Anchor.toml `[toolchain]` via +# `solana-developers/github-actions/extract-versions`, so the version stays +# in sync with the workspace. [toolchain.workflow_solana_cli] -".github/workflows/anchor-test.yaml" = "1.17.31" -".github/workflows/generate-verifiable-builds.yaml" = "1.17.31" -".github/workflows/deploy-buffer.yaml" = "1.17.16" -".github/workflows/verify-build.yaml" = "1.17.16" +".github/workflows/anchor-test.yaml" = "4.3.0" +".github/workflows/deploy-buffer.yaml" = "4.3.0" +".github/workflows/verify-build.yaml" = "4.3.0" [cargo] # Every program's Cargo.toml must pin external deps with `=x.y.z`. Loose @@ -43,16 +35,8 @@ local_dev_solana_version = "1.17.34" # anchor-lang and anchor-spl must be the version declared below across # every program manifest. Cross-program divergence (program A pins =0.29.0 # but program B pins =0.29.1) fails. -anchor_lang_version = "0.29.0" -anchor_spl_version = "0.29.0" - -# `solana-program` crate version. Distinct from any of the CLI versions -# above - this is the Solana primitives library that program binaries link -# against, and Cargo.lock is built around it. Currently pinned by the three -# launchpads (v06/v07/v08). The guard fails if any program pins a different -# version. Cargo.lock freshness independently catches drift between this -# pin and the resolved tree. -solana_program_version = "1.17.14" +anchor_lang_version = "0.32.2" +anchor_spl_version = "0.32.2" # Minimum age in days for a newly pinned crate version. The check is scoped # to crates whose version differs from the PR base, so unrelated bumps that @@ -70,12 +54,6 @@ package_min_age_days = 14 # add it here in a PR that also bumps the workflow reference. CODEOWNERS # review is required. [actions.sha_allowlist] -"metadaoproject/anchor-test" = ["876dde6990e0a3d22e1cf1c702b4e4c64aa47d15"] # v2.3 -"metadaoproject/anchor-verifiable-build" = ["6d8fc1999ea4b7ff701e8b166903b398741e1c50"] # v0.4 -"metadaoproject/setup-anchor" = [ - "7d1e9699eb18c33ba5f32f6a9952f0e90515996a", # v3.2 - "aeeb5505f3fd3d52a1080d14863c6aa428c9fdf9", # v3.4 -] "nick-fields/retry" = [ "ce71cc2ab81d554ebbe88c79ab5975992d79ba08", # v3 "14672906e672a08bd6eeb15720e9ed3ce869cdd4", # v2 @@ -85,7 +63,6 @@ package_min_age_days = 14 "EndBug/add-and-commit" = ["a94899bca583c204427a224a7af87c02f9b325d5"] # v9.1.4 "peter-evans/find-comment" = ["3eae4d37986fb5a8592848f6a574fdf654e61f9e"] # v3 "peter-evans/create-or-update-comment" = ["71345be0265236311c031f5c7866368bd1eff043"] # v4 -"actions-rs/toolchain" = ["16499b5e05bf2e26879000db0c1d13f7e13fa3af"] # v1.0.7 "Swatinem/rust-cache" = ["6323deb102c322ba6fcbdcafc7e3dddab59af2b6"] # v2.9.2 [sensitive_diff] diff --git a/.github/workflows/anchor-test.yaml b/.github/workflows/anchor-test.yaml index 032b316f2..b7d203705 100644 --- a/.github/workflows/anchor-test.yaml +++ b/.github/workflows/anchor-test.yaml @@ -15,7 +15,7 @@ env: jobs: run-anchor-test: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 @@ -23,7 +23,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '20.18.0' + node-version: '24.22.1' cache: 'yarn' cache-dependency-path: sdk/yarn.lock @@ -39,7 +39,7 @@ jobs: - uses: ./.github/actions/anchor-test with: - anchor-version: '0.29.0' - solana-cli-version: '1.17.31' - node-version: '20.18.0' + anchor-version: '0.32.2' + solana-cli-version: '4.3.0' + node-version: '24.22.1' diff --git a/.github/workflows/deploy-buffer.yaml b/.github/workflows/deploy-buffer.yaml index b98f43d1c..e9f9caee5 100644 --- a/.github/workflows/deploy-buffer.yaml +++ b/.github/workflows/deploy-buffer.yaml @@ -17,6 +17,14 @@ on: description: 'Program ID' required: true type: string + network: + description: 'Network whose deployer keypair pays for the buffer' + required: true + type: choice + options: + - devnet + - mainnet + default: 'devnet' rpc_url: description: 'RPC URL' required: true @@ -25,17 +33,18 @@ on: jobs: deploy-buffer: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - - uses: metadaoproject/setup-anchor@7d1e9699eb18c33ba5f32f6a9952f0e90515996a # v3.2 + - uses: ./.github/actions/setup-toolchain with: - solana-cli-version: '1.17.16' - anchor-version: '0.29.0' + solana-cli-version: '4.3.0' + anchor-version: '0.32.2' + node-version: '24.22.1' - run: echo "$DEPLOYER_KEYPAIR" > deployer-keypair.json && chmod 600 deployer-keypair.json shell: bash env: - DEPLOYER_KEYPAIR: ${{ secrets.DEPLOYER_KEYPAIR }} + DEPLOYER_KEYPAIR: ${{ inputs.network == 'mainnet' && secrets.MAINNET_DEPLOYER_KEYPAIR || secrets.DEVNET_DEPLOYER_KEYPAIR }} - run: solana-keygen new -s -o buffer-keypair --no-bip39-passphrase shell: bash - name: Deploy Buffer @@ -44,4 +53,8 @@ jobs: timeout_minutes: 30 max_attempts: 10 shell: bash - command: solana program write-buffer --max-sign-attempts 50 --with-compute-unit-price 100 --use-rpc --buffer ./buffer-keypair ./verifiable-builds/${{ inputs.program_name }}.so -u $NETWORK \ No newline at end of file + command: solana program write-buffer --max-sign-attempts 50 --with-compute-unit-price 100 --use-rpc -k ./deployer-keypair.json --buffer ./buffer-keypair ./verifiable-builds/${{ inputs.program_name }}.so -u ${{ inputs.rpc_url }} + - name: Remove deployer keypair + if: always() + run: rm -f deployer-keypair.json + shell: bash diff --git a/.github/workflows/generate-verifiable-builds.yaml b/.github/workflows/generate-verifiable-builds.yaml index 78680bf54..c659a8964 100644 --- a/.github/workflows/generate-verifiable-builds.yaml +++ b/.github/workflows/generate-verifiable-builds.yaml @@ -13,192 +13,47 @@ permissions: env: HUSKY: 0 + SOLANA_VERIFY_VERSION: "0.5.2" jobs: - generate-verifiable-futarchy: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - uses: metadaoproject/anchor-verifiable-build@6d8fc1999ea4b7ff701e8b166903b398741e1c50 # v0.4 - with: - program: futarchy - anchor-version: '0.29.0' - solana-cli-version: '1.17.31' - features: 'production' - - run: 'git pull --rebase' - - run: cp target/deploy/futarchy.so ./verifiable-builds - - name: Commit verifiable build back to mainline - uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4 - with: - default_author: github_actions - message: 'Update futarchy verifiable build' - generate-verifiable-conditional-vault: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - uses: metadaoproject/anchor-verifiable-build@6d8fc1999ea4b7ff701e8b166903b398741e1c50 # v0.4 - with: - program: conditional_vault - anchor-version: '0.29.0' - solana-cli-version: '1.17.31' - features: 'production' - - run: 'git pull --rebase' - - run: cp target/deploy/conditional_vault.so ./verifiable-builds - - name: Commit verifiable build back to mainline - uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4 - with: - default_author: github_actions - message: 'Update conditional_vault verifiable build' - generate-verifiable-launchpad-v6: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - uses: metadaoproject/anchor-verifiable-build@6d8fc1999ea4b7ff701e8b166903b398741e1c50 # v0.4 - with: - program: launchpad - anchor-version: '0.29.0' - solana-cli-version: '1.17.31' - features: 'production' - - run: 'git pull --rebase' - - run: cp target/deploy/launchpad.so ./verifiable-builds - - name: Commit verifiable build back to mainline - uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4 - with: - default_author: github_actions - message: 'Update launchpad_v6 verifiable build' - generate-verifiable-price-based-performance-package: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - uses: metadaoproject/anchor-verifiable-build@6d8fc1999ea4b7ff701e8b166903b398741e1c50 # v0.4 - with: - program: price_based_performance_package - anchor-version: '0.29.0' - solana-cli-version: '1.17.31' - features: 'production' - - run: 'git pull --rebase' - - run: cp target/deploy/price_based_performance_package.so ./verifiable-builds - - name: Commit verifiable build back to mainline - uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4 - with: - default_author: github_actions - message: 'Update price_based_performance_package verifiable build' - generate-verifiable-launchpad-v7: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - uses: metadaoproject/anchor-verifiable-build@6d8fc1999ea4b7ff701e8b166903b398741e1c50 # v0.4 - with: - program: launchpad_v7 - anchor-version: '0.29.0' - solana-cli-version: '1.17.31' - features: 'production' - - run: 'git pull --rebase' - - run: cp target/deploy/launchpad_v7.so ./verifiable-builds - - name: Commit verifiable build back to mainline - uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4 - with: - default_author: github_actions - message: 'Update launchpad_v7 verifiable build' - generate-verifiable-bid-wall: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - uses: metadaoproject/anchor-verifiable-build@6d8fc1999ea4b7ff701e8b166903b398741e1c50 # v0.4 - with: - program: bid_wall - anchor-version: '0.29.0' - solana-cli-version: '1.17.31' - features: 'production' - - run: 'git pull --rebase' - - run: cp target/deploy/bid_wall.so ./verifiable-builds - - name: Commit verifiable build back to mainline - uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4 - with: - default_author: github_actions - message: 'Update bid_wall verifiable build' - generate-verifiable-liquidation: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - uses: metadaoproject/anchor-verifiable-build@6d8fc1999ea4b7ff701e8b166903b398741e1c50 # v0.4 - with: - program: liquidation - anchor-version: '0.29.0' - solana-cli-version: '1.17.31' - features: 'production' - - run: 'git pull --rebase' - - run: cp target/deploy/liquidation.so ./verifiable-builds - - name: Commit verifiable build back to mainline - uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4 - with: - default_author: github_actions - message: 'Update liquidation verifiable build' - generate-verifiable-mint-governor: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - uses: metadaoproject/anchor-verifiable-build@6d8fc1999ea4b7ff701e8b166903b398741e1c50 # v0.4 - with: - program: mint_governor - anchor-version: '0.29.0' - solana-cli-version: '1.17.31' - features: 'production' - - run: 'git pull --rebase' - - run: cp target/deploy/mint_governor.so ./verifiable-builds - - name: Commit verifiable build back to mainline - uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4 - with: - default_author: github_actions - message: 'Update mint_governor verifiable build' - generate-verifiable-performance-package-v2: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - uses: metadaoproject/anchor-verifiable-build@6d8fc1999ea4b7ff701e8b166903b398741e1c50 # v0.4 - with: - program: performance_package_v2 - anchor-version: '0.29.0' - solana-cli-version: '1.17.31' - features: 'production' - - run: 'git pull --rebase' - - run: cp target/deploy/performance_package_v2.so ./verifiable-builds - - name: Commit verifiable build back to mainline - uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4 - with: - default_author: github_actions - message: 'Update performance_package_v2 verifiable build' - generate-verifiable-launchpad-v8: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - uses: metadaoproject/anchor-verifiable-build@6d8fc1999ea4b7ff701e8b166903b398741e1c50 # v0.4 - with: - program: launchpad_v8 - anchor-version: '0.29.0' - solana-cli-version: '1.17.31' - features: 'production' - - run: 'git pull --rebase' - - run: cp target/deploy/launchpad_v8.so ./verifiable-builds - - name: Commit verifiable build back to mainline - uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4 - with: - default_author: github_actions - message: 'Update launchpad_v8 verifiable build' - generate-verifiable-gated-mint: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - uses: metadaoproject/anchor-verifiable-build@6d8fc1999ea4b7ff701e8b166903b398741e1c50 # v0.4 - with: - program: gated_mint - anchor-version: '0.29.0' - solana-cli-version: '1.17.31' - features: 'production' - - run: 'git pull --rebase' - - run: cp target/deploy/gated_mint.so ./verifiable-builds - - name: Commit verifiable build back to mainline - uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4 - with: - default_author: github_actions - message: 'Update gated_mint verifiable build' \ No newline at end of file + generate-verifiable: + name: generate-verifiable-${{ matrix.program }} + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + program: + - futarchy + - conditional_vault + - launchpad + - price_based_performance_package + - launchpad_v7 + - bid_wall + - liquidation + - mint_governor + - performance_package_v2 + - launchpad_v8 + - gated_mint + steps: + - uses: actions/checkout@v4 + - name: Cache solana-verify + uses: actions/cache@v4 + id: cache-solana-verify + with: + path: ~/.cargo/bin/solana-verify + key: solana-verify-${{ runner.os }}-${{ env.SOLANA_VERIFY_VERSION }} + - name: Install solana-verify + if: steps.cache-solana-verify.outputs.cache-hit != 'true' + run: cargo install solana-verify --version ${{ env.SOLANA_VERIFY_VERSION }} --locked + # The build image comes from [workspace.metadata.cli] in Cargo.toml; --arch v3 makes that image's cargo-build-sbf emit SBPFv3. + - name: Build verifiable artifact + run: solana-verify build --library-name ${{ matrix.program }} --arch v3 -- --features production + - name: Print artifact hash + run: solana-verify get-executable-hash target/deploy/${{ matrix.program }}.so + - run: 'git pull --rebase' + - run: cp target/deploy/${{ matrix.program }}.so ./verifiable-builds + - name: Commit verifiable build back to mainline + uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4 + with: + default_author: github_actions + message: 'Update ${{ matrix.program }} verifiable build' diff --git a/.github/workflows/repo-guard.yml b/.github/workflows/repo-guard.yml index 464d1e753..d9c7e14a6 100644 --- a/.github/workflows/repo-guard.yml +++ b/.github/workflows/repo-guard.yml @@ -9,7 +9,7 @@ permissions: jobs: repository-guard: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 env: EMERGENCY_BYPASS: ${{ contains(github.event.pull_request.labels.*.name, 'emergency-override') }} @@ -37,7 +37,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '20.18.0' + node-version: '24.22.1' cache: 'yarn' # sdk first: the root install links `link:./sdk` and needs sdk/node_modules to exist. diff --git a/.github/workflows/reusable-build.yaml b/.github/workflows/reusable-build.yaml index 1ebe3ed68..1cf5a4533 100644 --- a/.github/workflows/reusable-build.yaml +++ b/.github/workflows/reusable-build.yaml @@ -85,10 +85,10 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 timeout-minutes: 60 env: - SOLANA_VERIFY_VERSION: "0.4.1" + SOLANA_VERIFY_VERSION: "0.5.2" outputs: buffer: ${{ steps.program-buffer.outputs.buffer }} idl_buffer: ${{ steps.idl-buffer.outputs.buffer }} @@ -263,19 +263,20 @@ jobs: echo "No Anchor.toml found (this is expected for native programs)" fi - - name: Build Anchor - uses: solana-developers/github-actions/build-anchor@860d4e7d3afc9f180f3c5016593a1e86e77eede4 # v0.2.5 + # Only the IDL is taken from this step; the binary that ships is the verified build below. + - name: Build IDL if: steps.check-anchor.outputs.is_anchor == 'true' - with: - program: ${{ env.PROGRAM_NAME }} - features: ${{ inputs.features }} + run: | + FEATURES="${{ inputs.features }}" + mkdir -p target/idl + anchor idl build -p ${{ env.PROGRAM_NAME }} -o target/idl/${{ env.PROGRAM_NAME }}.json -- ${FEATURES:+--features $FEATURES} + # The build image comes from [workspace.metadata.cli] in Cargo.toml; --arch v3 makes that image's cargo-build-sbf emit SBPFv3. - name: Build Verified - uses: solana-developers/github-actions/build-verified@860d4e7d3afc9f180f3c5016593a1e86e77eede4 # v0.2.5 id: build-verified - with: - program: ${{ env.PROGRAM_NAME }} - features: ${{ inputs.features }} + run: | + FEATURES="${{ inputs.features }}" + solana-verify build --library-name ${{ env.PROGRAM_NAME }} --arch v3 -- ${FEATURES:+--features $FEATURES} - name: Create local artifacts directory run: | diff --git a/.github/workflows/verify-build.yaml b/.github/workflows/verify-build.yaml index 56d29c9ee..1af15717e 100644 --- a/.github/workflows/verify-build.yaml +++ b/.github/workflows/verify-build.yaml @@ -20,11 +20,11 @@ on: anchor-version: description: 'Anchor version' required: true - default: '0.29.0' + default: '0.32.2' solana-cli-version: description: 'Solana CLI version' required: true - default: '1.17.16' + default: '4.3.0' features: description: 'Build features' required: true @@ -37,10 +37,12 @@ on: jobs: verify-build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 + env: + SOLANA_VERIFY_VERSION: "0.5.2" steps: - uses: actions/checkout@v4 - - uses: metadaoproject/setup-anchor@7d1e9699eb18c33ba5f32f6a9952f0e90515996a # v3.2 + - uses: ./.github/actions/setup-toolchain with: anchor-version: ${{ inputs.anchor-version }} solana-cli-version: ${{ inputs.solana-cli-version }} @@ -59,14 +61,15 @@ jobs: with: path: | ~/.cargo/bin/solana-verify - key: cargo-${{ runner.os }}-solana-verify - - run: cargo install solana-verify + key: solana-verify-${{ runner.os }}-${{ env.SOLANA_VERIFY_VERSION }} + - run: cargo install solana-verify --version ${{ env.SOLANA_VERIFY_VERSION }} --locked if: steps.cache-solana-verify.outputs.cache-hit != 'true' shell: bash + # The deployed artifacts are SBPFv3, so the rebuild must pass --arch v3 to reproduce them. - name: Verify build run: | if [ "${{ inputs.features }}" = "none" ]; then - solana-verify verify-from-repo --remote -um --program-id ${{ inputs.program_id }} https://github.com/${{ github.repository }} --library-name ${{ inputs.program_name }} + solana-verify verify-from-repo --remote -um --arch v3 --program-id ${{ inputs.program_id }} https://github.com/${{ github.repository }} --library-name ${{ inputs.program_name }} else - solana-verify verify-from-repo --remote -um --program-id ${{ inputs.program_id }} https://github.com/${{ github.repository }} --library-name ${{ inputs.program_name }} -- --features ${{ inputs.features }} + solana-verify verify-from-repo --remote -um --arch v3 --program-id ${{ inputs.program_id }} https://github.com/${{ github.repository }} --library-name ${{ inputs.program_name }} -- --features ${{ inputs.features }} fi diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 000000000..ce62013c3 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +24.22.1 diff --git a/Anchor.toml b/Anchor.toml index 15e775928..37e6b40aa 100644 --- a/Anchor.toml +++ b/Anchor.toml @@ -1,8 +1,8 @@ [toolchain] -solana_version = "1.17.34" +anchor_version = "0.32.2" +solana_version = "4.3.0" [features] -seeds = false skip-lint = false [programs.localnet] @@ -78,7 +78,7 @@ v07-resize-daos = "yarn run tsx scripts/v0.7/resizeDaos.ts" v07-extend-launch = "yarn run tsx scripts/v0.7/extendLaunch.ts" [test] -startup_wait = 5000 +startup_wait = 20000 shutdown_wait = 2000 upgradeable = false diff --git a/CLAUDE.md b/CLAUDE.md index 86ec6b110..86a3229d1 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Project Overview -MetaDAO Futarchy Protocol - Solana programs for market-driven governance and token launches. Uses Anchor 0.29.0, Solana 1.17.34, Rust 1.78.0. +MetaDAO Futarchy Protocol - Solana programs for market-driven governance and token launches. Uses Anchor 0.32.2, Agave 4.3.0, the standalone cargo-build-sbf 4.4.0 (`cargo install cargo-build-sbf --version 4.4.0 --locked`; it emits SBPFv3 by default, so `anchor build` needs no arch flag), host Rust 1.95.0 pinned by `rust-toolchain.toml`. ## Build & Test Commands @@ -46,7 +46,7 @@ sdk/ # TypeScript client library (@metadaoproject/progra │ └── index.ts # Re-exports the latest version └── package.json -tests/ # TypeScript tests (bankrun + mocha) +tests/ # TypeScript tests (LiteSVM + mocha) ├── conditionalVault/ # Unit + integration tests per program ├── futarchy/ ├── launchpad/ @@ -185,13 +185,13 @@ Always append new error variants to the **end** of `#[error_code]` enums. Anchor 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 -Tests use `solana-bankrun` for deterministic testing without external RPC: +### Testing with LiteSVM +Tests run in-process on LiteSVM through the facade in `tests/litesvm/` (a bankrun-shaped `BanksClient` / `ProgramTestContext` / provider), with no external RPC: - `setupBasicDao()` - Create a test DAO with mints - `advanceBySlots()` - Simulate time progression - Time constants: `TEN_SECONDS_IN_SLOTS`, `ONE_MINUTE_IN_SLOTS`, `HOUR_IN_SLOTS`, `DAY_IN_SLOTS` -**Getting unique transaction signatures:** When testing error cases that call the same instruction multiple times (e.g., verifying an action fails after state changes), add a `ComputeBudgetProgram.setComputeUnitLimit()` instruction with incrementing values to produce different transaction signatures: +**Getting unique transaction signatures:** The LiteSVM facade rotates the blockhash after every processed transaction, so repeated identical instructions get distinct signatures and this is no longer required. Existing tests still carry the older convention of adding a `ComputeBudgetProgram.setComputeUnitLimit()` instruction with incrementing values: ```typescript // First call (200_000), second call (200_001), etc. @@ -302,8 +302,6 @@ External programs required for tests. These are pre-compiled `.so` files in `tes **Tests timeout**: Increase `startup_wait` in `Anchor.toml` -**Cargo.lock version error**: If `Cargo.lock` ends up with `version = 4`, simply change it back to `version = 3` to fix lockfile issues. You don't have to remove the lockfile. - ## Mainnet Program IDs | Program | Version | ID | diff --git a/Cargo.lock b/Cargo.lock index ee0a528c2..34891ec74 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,33 +1,33 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "aead" -version = "0.4.3" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" dependencies = [ + "crypto-common 0.1.7", "generic-array", ] [[package]] name = "aes" -version = "0.7.5" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ "cfg-if", "cipher", - "cpufeatures", - "opaque-debug", + "cpufeatures 0.2.17", ] [[package]] name = "aes-gcm-siv" -version = "0.10.3" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589c637f0e68c877bbd59a4599bbe849cac8e5f3e4b5a3ebae8f528cd218dcdc" +checksum = "ae0784134ba9375416d469ec31e7c5f9fa94405049cf08c5ce5b4698be673e0d" dependencies = [ "aead", "aes", @@ -40,42 +40,30 @@ dependencies = [ [[package]] name = "ahash" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" -dependencies = [ - "getrandom 0.2.16", - "once_cell", - "version_check", -] - -[[package]] -name = "ahash" -version = "0.8.6" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" dependencies = [ "cfg-if", - "getrandom 0.2.16", "once_cell", "version_check", - "zerocopy 0.7.35", + "zerocopy", ] [[package]] name = "aho-corasick" -version = "1.1.3" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" dependencies = [ "memchr", ] [[package]] name = "anchor-attribute-access-control" -version = "0.29.0" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5f619f1d04f53621925ba8a2e633ba5a6081f2ae14758cbb67f38fd823e0a3e" +checksum = "b9b938c8b4988a78a4d2203bee59f6727883ddefc551bebbc31dc39bce0cad9b" dependencies = [ "anchor-syn", "proc-macro2", @@ -85,12 +73,12 @@ dependencies = [ [[package]] name = "anchor-attribute-account" -version = "0.29.0" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7f2a3e1df4685f18d12a943a9f2a7456305401af21a07c9fe076ef9ecd6e400" +checksum = "f31140e3f7622f0d5c519941210a4cd8cbc8b7c159bfbe3c5e18033b54afcf3d" dependencies = [ "anchor-syn", - "bs58 0.5.1", + "bs58", "proc-macro2", "quote", "syn 1.0.109", @@ -98,9 +86,9 @@ dependencies = [ [[package]] name = "anchor-attribute-constant" -version = "0.29.0" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9423945cb55627f0b30903288e78baf6f62c6c8ab28fb344b6b25f1ffee3dca7" +checksum = "072af3e841c04fc330da06ae4ce21d64f82126ee29735dc3b38463d4df429ab7" dependencies = [ "anchor-syn", "quote", @@ -109,9 +97,9 @@ dependencies = [ [[package]] name = "anchor-attribute-error" -version = "0.29.0" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ed12720033cc3c3bf3cfa293349c2275cd5ab99936e33dd4bf283aaad3e241" +checksum = "118ab229afbc4d263c27fdc21198309212e82eba26b09d8810d65898ceceb706" dependencies = [ "anchor-syn", "quote", @@ -120,9 +108,9 @@ dependencies = [ [[package]] name = "anchor-attribute-event" -version = "0.29.0" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eef4dc0371eba2d8c8b54794b0b0eb786a234a559b77593d6f80825b6d2c77a2" +checksum = "c6fb6b19b701c057b7844b41e01ebdd802b8b0e06be39c0b4a163e8ef5f54f0e" dependencies = [ "anchor-syn", "proc-macro2", @@ -132,20 +120,26 @@ dependencies = [ [[package]] name = "anchor-attribute-program" -version = "0.29.0" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b18c4f191331e078d4a6a080954d1576241c29c56638783322a18d308ab27e4f" +checksum = "a43a3b862af82a9a32644b71a85ddd7c1aff2c2378d4e973c979c1637672ac2c" dependencies = [ + "anchor-lang-idl", "anchor-syn", + "anyhow", + "bs58", + "heck", + "proc-macro2", "quote", + "serde_json", "syn 1.0.109", ] [[package]] name = "anchor-derive-accounts" -version = "0.29.0" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de10d6e9620d3bcea56c56151cad83c5992f50d5960b3a9bebc4a50390ddc3c" +checksum = "26b63581912522eeaf2ef1e1efd0cdc5ffc376d7dd2e3e9fcd99dc309f8a13b9" dependencies = [ "anchor-syn", "quote", @@ -154,12 +148,12 @@ dependencies = [ [[package]] name = "anchor-derive-serde" -version = "0.29.0" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4e2e5be518ec6053d90a2a7f26843dbee607583c779e6c8395951b9739bdfbe" +checksum = "030232abc6f00f427b50a8b3f8d1e10fbb1c961245fd2353ec129c3594c15f1e" dependencies = [ "anchor-syn", - "borsh-derive-internal 0.10.4", + "borsh-derive-internal", "proc-macro2", "quote", "syn 1.0.109", @@ -167,9 +161,9 @@ dependencies = [ [[package]] name = "anchor-derive-space" -version = "0.29.0" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ecc31d19fa54840e74b7a979d44bcea49d70459de846088a1d71e87ba53c419" +checksum = "c1f96c7183104c29e48ffd0daab154a602e1da765d0f8c3d45b0a48f12e8af61" dependencies = [ "proc-macro2", "quote", @@ -178,9 +172,9 @@ dependencies = [ [[package]] name = "anchor-lang" -version = "0.29.0" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35da4785497388af0553586d55ebdc08054a8b1724720ef2749d313494f2b8ad" +checksum = "d7469ba047dd8d26cee94878db458cc024a26a191310e72d76646fc0b969382d" dependencies = [ "anchor-attribute-access-control", "anchor-attribute-account", @@ -191,38 +185,84 @@ dependencies = [ "anchor-derive-accounts", "anchor-derive-serde", "anchor-derive-space", - "arrayref", - "base64 0.13.1", + "anchor-lang-idl", + "base64 0.21.7", "bincode", "borsh 0.10.4", "bytemuck", - "getrandom 0.2.16", - "solana-program", - "thiserror", + "solana-account-info", + "solana-clock", + "solana-cpi", + "solana-define-syscall", + "solana-feature-gate-interface", + "solana-instruction", + "solana-instructions-sysvar", + "solana-invoke", + "solana-loader-v3-interface 3.0.0", + "solana-msg", + "solana-program-entrypoint", + "solana-program-error", + "solana-program-memory", + "solana-program-option", + "solana-program-pack", + "solana-pubkey", + "solana-sdk-ids", + "solana-system-interface", + "solana-sysvar", + "solana-sysvar-id", + "thiserror 1.0.69", +] + +[[package]] +name = "anchor-lang-idl" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47914b4290ae2bdf4ec203aa821e6eba86d7c78ef497918938038dcc6919f953" +dependencies = [ + "anchor-lang-idl-spec", + "anyhow", + "heck", + "regex", + "serde", + "serde_json", + "sha2 0.10.9", +] + +[[package]] +name = "anchor-lang-idl-spec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bdf143115440fe621bdac3a29a1f7472e09f6cd82b2aa569429a0c13f103838" +dependencies = [ + "anyhow", + "serde", ] [[package]] name = "anchor-spl" -version = "0.29.0" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c4fd6e43b2ca6220d2ef1641539e678bfc31b6cc393cf892b373b5997b6a39a" +checksum = "ec9436d0ba1c4784fc040ee1e50e7d76f02399f3f976ba0c5b843ff9c17a6d35" dependencies = [ "anchor-lang", "mpl-token-metadata", - "solana-program", "spl-associated-token-account", + "spl-pod", "spl-token", "spl-token-2022", + "spl-token-group-interface", + "spl-token-metadata-interface", ] [[package]] name = "anchor-syn" -version = "0.29.0" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9101b84702fed2ea57bd22992f75065da5648017135b844283a2f6d74f27825" +checksum = "d8bfc8f646330093d9413fff5b471d71046511fac50d52ccc22d9ab07af8c416" dependencies = [ "anyhow", - "bs58 0.5.1", + "bs58", + "cargo_toml", "heck", "proc-macro2", "quote", @@ -230,131 +270,14 @@ dependencies = [ "serde_json", "sha2 0.10.9", "syn 1.0.109", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "anyhow" -version = "1.0.98" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" - -[[package]] -name = "ark-bn254" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" -dependencies = [ - "ark-ec", - "ark-ff", - "ark-std", -] - -[[package]] -name = "ark-ec" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" -dependencies = [ - "ark-ff", - "ark-poly", - "ark-serialize", - "ark-std", - "derivative", - "hashbrown 0.13.2", - "itertools", - "num-traits", - "zeroize", -] - -[[package]] -name = "ark-ff" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" -dependencies = [ - "ark-ff-asm", - "ark-ff-macros", - "ark-serialize", - "ark-std", - "derivative", - "digest 0.10.7", - "itertools", - "num-bigint", - "num-traits", - "paste", - "rustc_version", - "zeroize", -] - -[[package]] -name = "ark-ff-asm" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" -dependencies = [ - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-ff-macros" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" -dependencies = [ - "num-bigint", - "num-traits", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-poly" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" -dependencies = [ - "ark-ff", - "ark-serialize", - "ark-std", - "derivative", - "hashbrown 0.13.2", -] - -[[package]] -name = "ark-serialize" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" -dependencies = [ - "ark-serialize-derive", - "ark-std", - "digest 0.10.7", - "num-bigint", -] - -[[package]] -name = "ark-serialize-derive" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ark-std" -version = "0.4.0" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" -dependencies = [ - "num-traits", - "rand 0.8.5", -] +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" [[package]] name = "arrayref" @@ -364,32 +287,15 @@ checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" [[package]] name = "arrayvec" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" - -[[package]] -name = "assert_matches" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" - -[[package]] -name = "atty" -version = "0.2.14" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" [[package]] name = "autocfg" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" [[package]] name = "base64" @@ -399,15 +305,15 @@ checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" [[package]] name = "base64" -version = "0.13.1" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64" -version = "0.21.7" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bid_wall" @@ -429,34 +335,22 @@ dependencies = [ [[package]] name = "bitflags" -version = "2.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" -dependencies = [ - "serde", -] - -[[package]] -name = "bitmaps" -version = "2.1.0" +version = "2.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" -dependencies = [ - "typenum", -] +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" [[package]] name = "blake3" -version = "1.8.2" +version = "1.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3888aaa89e4b2a40fca9848e400f6a658a5a3978de7be858e209cafa8be9a4a0" +checksum = "6d9e454fc11f76977dc803893aff6304ed33d6a26efae8696573bea74baa27ae" dependencies = [ - "arrayref", "arrayvec", "cc", "cfg-if", "constant_time_eq", - "digest 0.10.7", + "cpufeatures 0.3.1", + "digest 0.11.3", ] [[package]] @@ -465,7 +359,6 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "block-padding", "generic-array", ] @@ -479,19 +372,12 @@ dependencies = [ ] [[package]] -name = "block-padding" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" - -[[package]] -name = "borsh" -version = "0.9.3" +name = "block-buffer" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15bf3650200d8bffa99015595e10f1fbd17de07abbc25bb067da79e769939bfa" +checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa" dependencies = [ - "borsh-derive 0.9.3", - "hashbrown 0.11.2", + "hybrid-array", ] [[package]] @@ -505,16 +391,14 @@ dependencies = [ ] [[package]] -name = "borsh-derive" -version = "0.9.3" +name = "borsh" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6441c552f230375d18e3cc377677914d2ca2b0d36e52129fe15450a2dce46775" +checksum = "553c5d846a6ba5150c65e3b1b8ec073bcf1abc20f9b7220de384a4443ea4e20a" dependencies = [ - "borsh-derive-internal 0.9.3", - "borsh-schema-derive-internal 0.9.3", - "proc-macro-crate 0.1.5", - "proc-macro2", - "syn 1.0.109", + "borsh-derive 1.8.1", + "bytes", + "cfg_aliases", ] [[package]] @@ -523,22 +407,24 @@ version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "831213f80d9423998dd696e2c5345aba6be7a0bd8cd19e31c5243e13df1cef89" dependencies = [ - "borsh-derive-internal 0.10.4", - "borsh-schema-derive-internal 0.10.4", + "borsh-derive-internal", + "borsh-schema-derive-internal", "proc-macro-crate 0.1.5", "proc-macro2", "syn 1.0.109", ] [[package]] -name = "borsh-derive-internal" -version = "0.9.3" +name = "borsh-derive" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5449c28a7b352f2d1e592a8a28bf139bc71afb0764a14f3c02500935d8c44065" +checksum = "12cdfe656708a01f89b451a7d36466e6fe6c414de0aa18fc54f864f6f9ca9f56" dependencies = [ + "once_cell", + "proc-macro-crate 3.5.0", "proc-macro2", "quote", - "syn 1.0.109", + "syn 3.0.9", ] [[package]] @@ -552,17 +438,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "borsh-schema-derive-internal" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdbd5696d8bfa21d53d9fe39a714a18538bad11492a42d066dbbc395fb1951c0" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "borsh-schema-derive-internal" version = "0.10.4" @@ -574,12 +449,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "bs58" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" - [[package]] name = "bs58" version = "0.5.1" @@ -591,9 +460,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.19.0" +version = "3.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" [[package]] name = "bv" @@ -607,22 +476,22 @@ dependencies = [ [[package]] name = "bytemuck" -version = "1.23.1" +version = "1.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c76a5792e44e4abe34d3abf15636779261d45a7450612059293d1d2cfc63422" +checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.9.3" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ecc273b49b3205b83d648f0690daa588925572cc5063745bfe547fe7ec8e1a1" +checksum = "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 3.0.9", ] [[package]] @@ -631,41 +500,60 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" + +[[package]] +name = "cargo_toml" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a98356df42a2eb1bd8f1793ae4ee4de48e384dd974ce5eac8eee802edb7492be" +dependencies = [ + "serde", + "toml 0.8.23", +] + [[package]] name = "cc" -version = "1.2.27" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d487aa071b5f64da6f19a3e848e3578944b726ee5a4854b82172f02aa876bfdc" +checksum = "877bf67ac8e52449eb2f9e98a344ea163beb70dd1f9eebe3cc5357dcfeaee4df" dependencies = [ - "jobserver", - "libc", + "find-msvc-tools", "shlex", ] [[package]] name = "cfg-if" -version = "1.0.1" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" [[package]] -name = "chrono" -version = "0.4.41" +name = "cfg_aliases" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" -dependencies = [ - "num-traits", -] +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" [[package]] name = "cipher" -version = "0.3.0" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ - "generic-array", + "crypto-common 0.1.7", + "inout", ] +[[package]] +name = "cmov" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c9ea0ac24bc397ab3c98583a3c9ba74fa56b09a4449bbe172b9b1ddb016027a" + [[package]] name = "conditional_vault" version = "0.4.0" @@ -697,9 +585,9 @@ dependencies = [ [[package]] name = "constant_time_eq" -version = "0.3.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" +checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b" [[package]] name = "cpufeatures" @@ -711,30 +599,14 @@ dependencies = [ ] [[package]] -name = "crossbeam-deque" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" +name = "cpufeatures" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" dependencies = [ - "crossbeam-utils", + "libc", ] -[[package]] -name = "crossbeam-utils" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" - [[package]] name = "crunchy" version = "0.2.4" @@ -743,87 +615,76 @@ checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" [[package]] name = "crypto-common" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" dependencies = [ "generic-array", + "rand_core 0.6.4", "typenum", ] [[package]] -name = "crypto-mac" -version = "0.8.0" +name = "crypto-common" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" dependencies = [ - "generic-array", - "subtle", + "hybrid-array", ] [[package]] name = "ctr" -version = "0.8.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ "cipher", ] [[package]] -name = "curve25519-dalek" -version = "3.2.1" +name = "ctutils" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", - "serde", - "subtle", - "zeroize", -] - -[[package]] -name = "damm_v2_cpi" -version = "0.1.0" +checksum = "03bb0e1cc970d482d121d9a1744999169b69a07470b3d644a7894e53fcaf4574" dependencies = [ - "anchor-lang", + "cmov", ] [[package]] -name = "darling" -version = "0.20.11" +name = "curve25519-dalek" +version = "4.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" dependencies = [ - "darling_core", - "darling_macro", + "cfg-if", + "cpufeatures 0.2.17", + "curve25519-dalek-derive", + "digest 0.10.7", + "fiat-crypto", + "rand_core 0.6.4", + "rustc_version", + "serde", + "subtle", + "zeroize", ] [[package]] -name = "darling_core" -version = "0.20.11" +name = "curve25519-dalek-derive" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ - "fnv", - "ident_case", "proc-macro2", "quote", - "strsim", - "syn 2.0.104", + "syn 2.0.119", ] [[package]] -name = "darling_macro" -version = "0.20.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +name = "damm_v2_cpi" +version = "0.1.0" dependencies = [ - "darling_core", - "quote", - "syn 2.0.104", + "anchor-lang", ] [[package]] @@ -832,17 +693,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e5c37193a1db1d8ed868c03ec7b152175f26160a5b740e5e484143877e0adf0" -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "digest" version = "0.9.0" @@ -859,75 +709,74 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", - "crypto-common", + "crypto-common 0.1.7", "subtle", ] [[package]] -name = "ed25519" -version = "1.5.3" +name = "digest" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" +checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" dependencies = [ - "signature", + "block-buffer 0.12.1", + "crypto-common 0.2.2", + "ctutils", ] [[package]] -name = "ed25519-dalek" -version = "1.0.1" +name = "either" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" -dependencies = [ - "curve25519-dalek", - "ed25519", - "rand 0.7.3", - "serde", - "sha2 0.9.9", - "zeroize", -] +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" [[package]] -name = "ed25519-dalek-bip32" -version = "0.2.0" +name = "equivalent" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d2be62a4061b872c8c0873ee4fc6f101ce7b889d039f019c5fa2af471a59908" -dependencies = [ - "derivation-path", - "ed25519-dalek", - "hmac 0.12.1", - "sha2 0.10.9", -] +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" [[package]] -name = "either" -version = "1.15.0" +name = "feature-probe" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "find-msvc-tools" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" [[package]] -name = "env_logger" -version = "0.9.3" +name = "five8" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" +checksum = "a75b8549488b4715defcb0d8a8a1c1c76a80661b5fa106b4ca0e7fce59d7d875" dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", + "five8_core", ] [[package]] -name = "equivalent" -version = "1.0.2" +name = "five8_const" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +checksum = "26dec3da8bc3ef08f2c04f61eab298c3ab334523e55f076354d6d6f613799a7b" +dependencies = [ + "five8_core", +] [[package]] -name = "feature-probe" -version = "0.1.1" +name = "five8_core" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" +checksum = "2551bf44bc5f776c15044b9b94153a00198be06743e262afaaa61f11ac7523a5" [[package]] name = "fnv" @@ -944,18 +793,42 @@ dependencies = [ "conditional_vault", "damm_v2_cpi", "mint_governor", + "solana-address-lookup-table-interface", "solana-security-txt", "spl-memo", "squads-multisig-program", ] +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "slab", +] + [[package]] name = "gated_mint" version = "0.1.0" dependencies = [ "anchor-lang", "anchor-spl", - "solana-program", "solana-security-txt", "spl-token", ] @@ -966,7 +839,6 @@ version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ - "serde", "typenum", "version_check", ] @@ -978,17 +850,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ "cfg-if", - "js-sys", "libc", "wasi 0.9.0+wasi-snapshot-preview1", - "wasm-bindgen", ] [[package]] name = "getrandom" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" dependencies = [ "cfg-if", "js-sys", @@ -997,41 +867,20 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "getrandom" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" -dependencies = [ - "cfg-if", - "libc", - "r-efi", - "wasi 0.14.2+wasi-0.2.4", -] - -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -dependencies = [ - "ahash 0.7.8", -] - [[package]] name = "hashbrown" version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.6", + "ahash", ] [[package]] name = "hashbrown" -version = "0.15.4" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" [[package]] name = "heck" @@ -1042,25 +891,6 @@ dependencies = [ "unicode-segmentation", ] -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hmac" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" -dependencies = [ - "crypto-mac", - "digest 0.9.0", -] - [[package]] name = "hmac" version = "0.12.1" @@ -1071,112 +901,78 @@ dependencies = [ ] [[package]] -name = "hmac-drbg" -version = "0.3.0" +name = "hybrid-array" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17" dependencies = [ - "digest 0.9.0", - "generic-array", - "hmac 0.8.1", + "typenum", ] [[package]] -name = "humantime" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b112acc8b3adf4b107a8ec20977da0273a8c386765a3ec0229bd500a1443f9f" - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "im" -version = "15.1.0" +name = "indexmap" +version = "2.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0acd33ff0285af998aaf9b57342af478078f53492322fafc47450e09397e0e9" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" dependencies = [ - "bitmaps", - "rand_core 0.6.4", - "rand_xoshiro", - "rayon", - "serde", - "sized-chunks", - "typenum", - "version_check", + "equivalent", + "hashbrown 0.17.1", ] [[package]] -name = "indexmap" -version = "2.10.0" +name = "inout" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" dependencies = [ - "equivalent", - "hashbrown 0.15.4", + "generic-array", ] [[package]] name = "itertools" -version = "0.10.5" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" - -[[package]] -name = "jobserver" -version = "0.1.33" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" -dependencies = [ - "getrandom 0.3.3", - "libc", -] +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" [[package]] name = "js-sys" -version = "0.3.77" +version = "0.3.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" dependencies = [ - "once_cell", + "cfg-if", + "futures-util", "wasm-bindgen", ] [[package]] name = "keccak" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +checksum = "cb26cec98cce3a3d96cbb7bced3c4b16e3d13f27ec56dbd62cbc8f39cfb9d653" dependencies = [ - "cpufeatures", + "cpufeatures 0.2.17", ] [[package]] name = "launchpad" version = "0.6.1" dependencies = [ - "ahash 0.8.6", "anchor-lang", "anchor-spl", "damm_v2_cpi", "futarchy", "price_based_performance_package", - "solana-program", "solana-security-txt", - "spl-memo", - "spl-token", "squads-multisig-program", ] @@ -1184,17 +980,13 @@ dependencies = [ name = "launchpad_v7" version = "0.7.0" dependencies = [ - "ahash 0.8.6", "anchor-lang", "anchor-spl", "bid_wall", "damm_v2_cpi", "futarchy", "price_based_performance_package", - "solana-program", "solana-security-txt", - "spl-memo", - "spl-token", "squads-multisig-program", ] @@ -1202,7 +994,6 @@ dependencies = [ name = "launchpad_v8" version = "0.8.0" dependencies = [ - "ahash 0.8.6", "anchor-lang", "anchor-spl", "bid_wall", @@ -1211,24 +1002,21 @@ dependencies = [ "gated_mint", "mint_governor", "performance_package_v2", - "solana-program", "solana-security-txt", - "spl-memo", - "spl-token", "squads-multisig-program", ] [[package]] name = "lazy_static" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb" [[package]] name = "libc" -version = "0.2.174" +version = "0.2.191" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" [[package]] name = "libsecp256k1" @@ -1239,14 +1027,12 @@ dependencies = [ "arrayref", "base64 0.12.3", "digest 0.9.0", - "hmac-drbg", "libsecp256k1-core", "libsecp256k1-gen-ecmult", "libsecp256k1-gen-genmult", "rand 0.7.3", "serde", "sha2 0.9.9", - "typenum", ] [[package]] @@ -1278,18 +1064,6 @@ dependencies = [ "libsecp256k1-core", ] -[[package]] -name = "light-poseidon" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c9a85a9752c549ceb7578064b4ed891179d20acd85f27318573b64d2d7ee7ee" -dependencies = [ - "ark-bn254", - "ark-ff", - "num-bigint", - "thiserror", -] - [[package]] name = "liquidation" version = "0.1.0" @@ -1301,34 +1075,24 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" dependencies = [ - "autocfg", "scopeguard", ] [[package]] name = "log" -version = "0.4.27" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" [[package]] name = "memchr" -version = "2.7.5" +version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" - -[[package]] -name = "memmap2" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" -dependencies = [ - "libc", -] +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" [[package]] name = "memoffset" @@ -1362,22 +1126,22 @@ dependencies = [ [[package]] name = "mpl-token-metadata" -version = "3.2.3" +version = "5.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba8ee05284d79b367ae8966d558e1a305a781fc80c9df51f37775169117ba64f" +checksum = "046f0779684ec348e2759661361c8798d79021707b1392cb49f3b5eb911340ff" dependencies = [ "borsh 0.10.4", "num-derive 0.3.3", "num-traits", "solana-program", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "num-bigint" -version = "0.4.6" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" dependencies = [ "num-integer", "num-traits", @@ -1402,14 +1166,14 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.119", ] [[package]] name = "num-integer" -version = "0.1.46" +version = "0.1.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" dependencies = [ "num-traits", ] @@ -1425,51 +1189,31 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" -dependencies = [ - "num_enum_derive 0.6.1", -] - -[[package]] -name = "num_enum" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70bf6736f74634d299d00086f02986875b3c2d924781a6a2cb6c201e73da0ceb" -dependencies = [ - "num_enum_derive 0.7.0", -] - -[[package]] -name = "num_enum_derive" -version = "0.6.1" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 2.0.104", + "num_enum_derive", + "rustversion", ] [[package]] name = "num_enum_derive" -version = "0.7.0" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ea360eafe1022f7cc56cd7b869ed57330fb2453d0c7831d99b74c65d2f5597" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate 3.5.0", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.119", ] [[package]] name = "once_cell" -version = "1.21.3" +version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] name = "opaque-debug" @@ -1479,9 +1223,9 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "parking_lot" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" dependencies = [ "lock_api", "parking_lot_core", @@ -1489,30 +1233,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.11" +version = "0.9.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets", -] - -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - -[[package]] -name = "pbkdf2" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" -dependencies = [ - "crypto-mac", + "windows-link", ] [[package]] @@ -1526,9 +1255,9 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.3.1" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "performance_package_v2" @@ -1541,14 +1270,20 @@ dependencies = [ "solana-security-txt", ] +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + [[package]] name = "polyval" -version = "0.5.3" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" +checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "opaque-debug", "universal-hash", ] @@ -1559,7 +1294,7 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ - "zerocopy 0.8.26", + "zerocopy", ] [[package]] @@ -1578,24 +1313,23 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" dependencies = [ - "toml", + "toml 0.5.11", ] [[package]] name = "proc-macro-crate" -version = "1.3.1" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" dependencies = [ - "once_cell", - "toml_edit", + "toml_edit 0.25.17+spec-1.1.0", ] [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" dependencies = [ "unicode-ident", ] @@ -1609,32 +1343,15 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "qualifier_attr" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e2e25ee72f5b24d773cae88422baddefff7714f97aab68d96fe2b6fc4a28fb2" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - [[package]] name = "quote" -version = "1.0.40" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" dependencies = [ "proc-macro2", ] -[[package]] -name = "r-efi" -version = "5.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" - [[package]] name = "rand" version = "0.7.3" @@ -1650,9 +1367,9 @@ dependencies = [ [[package]] name = "rand" -version = "0.8.5" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" dependencies = [ "libc", "rand_chacha 0.3.1", @@ -1694,7 +1411,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.16", + "getrandom 0.2.17", ] [[package]] @@ -1706,49 +1423,20 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "rand_xoshiro" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" -dependencies = [ - "rand_core 0.6.4", -] - -[[package]] -name = "rayon" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - [[package]] name = "redox_syscall" -version = "0.5.13" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d04b7d0ee6b4a0207a0a7adb104d23ecb0b47d6beae7152d0fa34b692b29fd6" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ "bitflags", ] [[package]] name = "regex" -version = "1.11.1" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" dependencies = [ "aho-corasick", "memchr", @@ -1758,9 +1446,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" dependencies = [ "aho-corasick", "memchr", @@ -1769,15 +1457,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" - -[[package]] -name = "rustc-hash" -version = "1.1.0" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" [[package]] name = "rustc_version" @@ -1790,15 +1472,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" - -[[package]] -name = "ryu" -version = "1.0.20" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" [[package]] name = "scopeguard" @@ -1808,71 +1484,70 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "semver" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" dependencies = [ + "serde_core", "serde_derive", ] [[package]] name = "serde_bytes" -version = "0.11.17" +version = "0.11.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8437fd221bde2d4ca316d61b90e337e9e702b3820b87d63caa9ba6c02bd06d96" +checksum = "a5d440709e79d88e51ac01c4b72fc6cb7314017bb7da9eeff678aa94c10e3ea8" dependencies = [ "serde", + "serde_core", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.229" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 3.0.9", ] [[package]] name = "serde_json" -version = "1.0.140" +version = "1.0.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" dependencies = [ "itoa", "memchr", - "ryu", "serde", + "serde_core", + "zmij", ] [[package]] -name = "serde_with" -version = "2.3.3" +name = "serde_spanned" +version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" dependencies = [ "serde", - "serde_with_macros", -] - -[[package]] -name = "serde_with_macros" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.104", ] [[package]] @@ -1883,7 +1558,7 @@ checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer 0.9.0", "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "digest 0.9.0", "opaque-debug", ] @@ -1895,232 +1570,689 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "digest 0.10.7", ] [[package]] name = "sha3" -version = "0.9.1" +version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" +checksum = "77fd7028345d415a4034cf8777cd4f8ab1851274233b45f84e3d955502d93874" dependencies = [ - "block-buffer 0.9.0", - "digest 0.9.0", + "digest 0.10.7", "keccak", - "opaque-debug", ] [[package]] -name = "sha3" -version = "0.10.8" +name = "shlex" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" -dependencies = [ - "digest 0.10.7", - "keccak", -] +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" [[package]] -name = "shlex" -version = "1.3.0" +name = "slab" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] -name = "signature" -version = "1.6.4" +name = "smallvec" +version = "1.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" +checksum = "5b3dc8af474f516a851ff4bd12db780f948b9250ad37211e4eec0bccea54e01b" [[package]] -name = "sized-chunks" -version = "0.6.5" +name = "solana-account" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" +checksum = "0f949fe4edaeaea78c844023bfc1c898e0b1f5a100f8a8d2d0f85d0a7b090258" dependencies = [ - "bitmaps", - "typenum", + "solana-account-info", + "solana-clock", + "solana-instruction", + "solana-pubkey", + "solana-sdk-ids", ] [[package]] -name = "smallvec" -version = "1.15.1" +name = "solana-account-info" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +checksum = "c8f5152a288ef1912300fc6efa6c2d1f9bb55d9398eb6c72326360b8063987da" +dependencies = [ + "bincode", + "serde", + "solana-program-error", + "solana-program-memory", + "solana-pubkey", +] [[package]] -name = "solana-frozen-abi" -version = "1.17.14" +name = "solana-address-lookup-table-interface" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e2c5e5dde22cac045d29675b3fefa84817e1f63b0b911d094c599e80c0c07d9" +checksum = "d1673f67efe870b64a65cb39e6194be5b26527691ce5922909939961a6e6b395" dependencies = [ - "ahash 0.8.6", - "blake3", - "block-buffer 0.10.4", - "bs58 0.4.0", - "bv", - "byteorder", - "cc", - "either", - "generic-array", - "im", - "lazy_static", - "log", - "memmap2", - "rustc_version", + "bincode", + "bytemuck", "serde", - "serde_bytes", "serde_derive", - "serde_json", - "sha2 0.10.9", - "solana-frozen-abi-macro", + "solana-clock", + "solana-instruction", + "solana-pubkey", + "solana-sdk-ids", + "solana-slot-hashes", +] + +[[package]] +name = "solana-atomic-u64" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52e52720efe60465b052b9e7445a01c17550666beec855cce66f44766697bc2" +dependencies = [ + "parking_lot", +] + +[[package]] +name = "solana-big-mod-exp" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75db7f2bbac3e62cfd139065d15bcda9e2428883ba61fc8d27ccb251081e7567" +dependencies = [ + "num-bigint", + "num-traits", + "solana-define-syscall", +] + +[[package]] +name = "solana-bincode" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19a3787b8cf9c9fe3dd360800e8b70982b9e5a8af9e11c354b6665dd4a003adc" +dependencies = [ + "bincode", + "serde", + "solana-instruction", +] + +[[package]] +name = "solana-blake3-hasher" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a0801e25a1b31a14494fc80882a036be0ffd290efc4c2d640bfcca120a4672" +dependencies = [ + "blake3", + "solana-define-syscall", + "solana-hash", + "solana-sanitize", +] + +[[package]] +name = "solana-borsh" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "718333bcd0a1a7aed6655aa66bef8d7fb047944922b2d3a18f49cbc13e73d004" +dependencies = [ + "borsh 0.10.4", + "borsh 1.8.1", +] + +[[package]] +name = "solana-clock" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8584296123df8fe229b95e2ebfd37ae637fe9db9b7d4dd677ac5a78e80dbfce" +dependencies = [ + "serde", + "serde_derive", + "solana-sdk-ids", + "solana-sdk-macro", + "solana-sysvar-id", +] + +[[package]] +name = "solana-cpi" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dc71126edddc2ba014622fc32d0f5e2e78ec6c5a1e0eb511b85618c09e9ea11" +dependencies = [ + "solana-account-info", + "solana-define-syscall", + "solana-instruction", + "solana-program-error", + "solana-pubkey", + "solana-stable-layout", +] + +[[package]] +name = "solana-curve25519" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae4261b9a8613d10e77ac831a8fa60b6fa52b9b103df46d641deff9f9812a23" +dependencies = [ + "bytemuck", + "bytemuck_derive", + "curve25519-dalek", + "solana-define-syscall", "subtle", - "thiserror", + "thiserror 2.0.21", ] [[package]] -name = "solana-frozen-abi-macro" -version = "1.17.14" +name = "solana-decode-error" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "296e4cf0e2479e4c21afe4d17e32526f71f1bcd93b1c7c660900bc3e4233447a" +checksum = "8c781686a18db2f942e70913f7ca15dc120ec38dcab42ff7557db2c70c625a35" dependencies = [ - "proc-macro2", - "quote", - "rustc_version", - "syn 2.0.104", + "num-traits", ] [[package]] -name = "solana-logger" -version = "1.17.14" +name = "solana-define-syscall" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ae3e2abcf541c8122eafe9a625d4d194b4023c20adde1e251f94e056bb1aee2" + +[[package]] +name = "solana-derivation-path" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d37a1b1a383a01039afbc6447a1712fb2a1a73a5ba8916762e693e8e492fabf3" +checksum = "939756d798b25c5ec3cca10e06212bdca3b1443cb9bb740a38124f58b258737b" +dependencies = [ + "derivation-path", + "qstring", + "uriparse", +] + +[[package]] +name = "solana-epoch-rewards" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b575d3dd323b9ea10bb6fe89bf6bf93e249b215ba8ed7f68f1a3633f384db7" +dependencies = [ + "serde", + "serde_derive", + "solana-hash", + "solana-sdk-ids", + "solana-sdk-macro", + "solana-sysvar-id", +] + +[[package]] +name = "solana-epoch-schedule" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fce071fbddecc55d727b1d7ed16a629afe4f6e4c217bc8d00af3b785f6f67ed" +dependencies = [ + "serde", + "serde_derive", + "solana-sdk-ids", + "solana-sdk-macro", + "solana-sysvar-id", +] + +[[package]] +name = "solana-example-mocks" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84461d56cbb8bb8d539347151e0525b53910102e4bced875d49d5139708e39d3" +dependencies = [ + "serde", + "serde_derive", + "solana-address-lookup-table-interface", + "solana-clock", + "solana-hash", + "solana-instruction", + "solana-keccak-hasher", + "solana-message", + "solana-nonce", + "solana-pubkey", + "solana-sdk-ids", + "solana-system-interface", + "thiserror 2.0.21", +] + +[[package]] +name = "solana-feature-gate-interface" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43f5c5382b449e8e4e3016fb05e418c53d57782d8b5c30aa372fc265654b956d" +dependencies = [ + "bincode", + "serde", + "serde_derive", + "solana-account", + "solana-account-info", + "solana-instruction", + "solana-program-error", + "solana-pubkey", + "solana-rent", + "solana-sdk-ids", + "solana-system-interface", +] + +[[package]] +name = "solana-fee-calculator" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89bc408da0fb3812bc3008189d148b4d3e08252c79ad810b245482a3f70cd8d" dependencies = [ - "env_logger", - "lazy_static", "log", + "serde", + "serde_derive", ] [[package]] -name = "solana-program" -version = "1.17.14" +name = "solana-hash" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e3a3b9623f09e2c480b4e129c92d7a036f8614fd0fc7519791bd44e64061ce8" +checksum = "b5b96e9f0300fa287b545613f007dfe20043d7812bee255f418c1eb649c93b63" +dependencies = [ + "borsh 1.8.1", + "bytemuck", + "bytemuck_derive", + "five8", + "js-sys", + "serde", + "serde_derive", + "solana-atomic-u64", + "solana-sanitize", + "wasm-bindgen", +] + +[[package]] +name = "solana-instruction" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bab5682934bd1f65f8d2c16f21cb532526fcc1a09f796e2cacdb091eee5774ad" dependencies = [ - "ark-bn254", - "ark-ec", - "ark-ff", - "ark-serialize", - "base64 0.21.7", "bincode", + "borsh 1.8.1", + "getrandom 0.2.17", + "js-sys", + "num-traits", + "serde", + "serde_derive", + "serde_json", + "solana-define-syscall", + "solana-pubkey", + "wasm-bindgen", +] + +[[package]] +name = "solana-instructions-sysvar" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0e85a6fad5c2d0c4f5b91d34b8ca47118fc593af706e523cdbedf846a954f57" +dependencies = [ "bitflags", + "solana-account-info", + "solana-instruction", + "solana-program-error", + "solana-pubkey", + "solana-sanitize", + "solana-sdk-ids", + "solana-serialize-utils", + "solana-sysvar-id", +] + +[[package]] +name = "solana-invoke" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58f5693c6de226b3626658377168b0184e94e8292ff16e3d31d4766e65627565" +dependencies = [ + "solana-account-info", + "solana-define-syscall", + "solana-instruction", + "solana-program-entrypoint", + "solana-stable-layout", +] + +[[package]] +name = "solana-keccak-hasher" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7aeb957fbd42a451b99235df4942d96db7ef678e8d5061ef34c9b34cae12f79" +dependencies = [ + "sha3", + "solana-define-syscall", + "solana-hash", + "solana-sanitize", +] + +[[package]] +name = "solana-last-restart-slot" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6360ac2fdc72e7463565cd256eedcf10d7ef0c28a1249d261ec168c1b55cdd" +dependencies = [ + "serde", + "serde_derive", + "solana-sdk-ids", + "solana-sdk-macro", + "solana-sysvar-id", +] + +[[package]] +name = "solana-loader-v2-interface" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8ab08006dad78ae7cd30df8eea0539e207d08d91eaefb3e1d49a446e1c49654" +dependencies = [ + "serde", + "serde_bytes", + "serde_derive", + "solana-instruction", + "solana-pubkey", + "solana-sdk-ids", +] + +[[package]] +name = "solana-loader-v3-interface" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4be76cfa9afd84ca2f35ebc09f0da0f0092935ccdac0595d98447f259538c2" +dependencies = [ + "serde", + "serde_bytes", + "serde_derive", + "solana-instruction", + "solana-pubkey", + "solana-sdk-ids", + "solana-system-interface", +] + +[[package]] +name = "solana-loader-v3-interface" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f7162a05b8b0773156b443bccd674ea78bb9aa406325b467ea78c06c99a63a2" +dependencies = [ + "serde", + "serde_bytes", + "serde_derive", + "solana-instruction", + "solana-pubkey", + "solana-sdk-ids", + "solana-system-interface", +] + +[[package]] +name = "solana-loader-v4-interface" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "706a777242f1f39a83e2a96a2a6cb034cb41169c6ecbee2cf09cb873d9659e7e" +dependencies = [ + "serde", + "serde_bytes", + "serde_derive", + "solana-instruction", + "solana-pubkey", + "solana-sdk-ids", + "solana-system-interface", +] + +[[package]] +name = "solana-message" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1796aabce376ff74bf89b78d268fa5e683d7d7a96a0a4e4813ec34de49d5314b" +dependencies = [ + "bincode", + "blake3", + "lazy_static", + "serde", + "serde_derive", + "solana-bincode", + "solana-hash", + "solana-instruction", + "solana-pubkey", + "solana-sanitize", + "solana-sdk-ids", + "solana-short-vec", + "solana-system-interface", + "solana-transaction-error", + "wasm-bindgen", +] + +[[package]] +name = "solana-msg" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36a1a14399afaabc2781a1db09cb14ee4cc4ee5c7a5a3cfcc601811379a8092" +dependencies = [ + "solana-define-syscall", +] + +[[package]] +name = "solana-native-token" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61515b880c36974053dd499c0510066783f0cc6ac17def0c7ef2a244874cf4a9" + +[[package]] +name = "solana-nonce" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703e22eb185537e06204a5bd9d509b948f0066f2d1d814a6f475dafb3ddf1325" +dependencies = [ + "serde", + "serde_derive", + "solana-fee-calculator", + "solana-hash", + "solana-pubkey", + "solana-sha256-hasher", +] + +[[package]] +name = "solana-program" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98eca145bd3545e2fbb07166e895370576e47a00a7d824e325390d33bf467210" +dependencies = [ + "bincode", "blake3", "borsh 0.10.4", - "borsh 0.9.3", - "bs58 0.4.0", - "bv", + "borsh 1.8.1", + "bs58", "bytemuck", - "cc", "console_error_panic_hook", "console_log", - "curve25519-dalek", - "getrandom 0.2.16", - "itertools", - "js-sys", + "getrandom 0.2.17", "lazy_static", - "libc", - "libsecp256k1", - "light-poseidon", "log", "memoffset", "num-bigint", - "num-derive 0.3.3", + "num-derive 0.4.2", "num-traits", - "parking_lot", - "rand 0.8.5", - "rustc_version", - "rustversion", + "rand 0.8.8", "serde", "serde_bytes", "serde_derive", - "serde_json", - "sha2 0.10.9", - "sha3 0.10.8", - "solana-frozen-abi", - "solana-frozen-abi-macro", + "solana-account-info", + "solana-address-lookup-table-interface", + "solana-atomic-u64", + "solana-big-mod-exp", + "solana-bincode", + "solana-blake3-hasher", + "solana-borsh", + "solana-clock", + "solana-cpi", + "solana-decode-error", + "solana-define-syscall", + "solana-epoch-rewards", + "solana-epoch-schedule", + "solana-example-mocks", + "solana-feature-gate-interface", + "solana-fee-calculator", + "solana-hash", + "solana-instruction", + "solana-instructions-sysvar", + "solana-keccak-hasher", + "solana-last-restart-slot", + "solana-loader-v2-interface", + "solana-loader-v3-interface 5.0.0", + "solana-loader-v4-interface", + "solana-message", + "solana-msg", + "solana-native-token", + "solana-nonce", + "solana-program-entrypoint", + "solana-program-error", + "solana-program-memory", + "solana-program-option", + "solana-program-pack", + "solana-pubkey", + "solana-rent", + "solana-sanitize", + "solana-sdk-ids", "solana-sdk-macro", - "thiserror", - "tiny-bip39", + "solana-secp256k1-recover", + "solana-serde-varint", + "solana-serialize-utils", + "solana-sha256-hasher", + "solana-short-vec", + "solana-slot-hashes", + "solana-slot-history", + "solana-stable-layout", + "solana-stake-interface", + "solana-system-interface", + "solana-sysvar", + "solana-sysvar-id", + "solana-vote-interface", + "thiserror 2.0.21", "wasm-bindgen", - "zeroize", ] [[package]] -name = "solana-sdk" -version = "1.17.14" +name = "solana-program-entrypoint" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb34583922c5e79004ad8d8d69f333d274d21b614f0e1a575f325fc29a104ec2" +checksum = "32ce041b1a0ed275290a5008ee1a4a6c48f5054c8a3d78d313c08958a06aedbd" +dependencies = [ + "solana-account-info", + "solana-msg", + "solana-program-error", + "solana-pubkey", +] + +[[package]] +name = "solana-program-error" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ee2e0217d642e2ea4bee237f37bd61bb02aec60da3647c48ff88f6556ade775" +dependencies = [ + "borsh 1.8.1", + "num-traits", + "serde", + "serde_derive", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-pubkey", +] + +[[package]] +name = "solana-program-memory" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a5426090c6f3fd6cfdc10685322fede9ca8e5af43cd6a59e98bfe4e91671712" +dependencies = [ + "solana-define-syscall", +] + +[[package]] +name = "solana-program-option" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc677a2e9bc616eda6dbdab834d463372b92848b2bfe4a1ed4e4b4adba3397d0" + +[[package]] +name = "solana-program-pack" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "319f0ef15e6e12dc37c597faccb7d62525a509fec5f6975ecb9419efddeb277b" +dependencies = [ + "solana-program-error", +] + +[[package]] +name = "solana-pubkey" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b62adb9c3261a052ca1f999398c388f1daf558a1b492f60a6d9e64857db4ff1" dependencies = [ - "assert_matches", - "base64 0.21.7", - "bincode", - "bitflags", "borsh 0.10.4", - "bs58 0.4.0", + "borsh 1.8.1", "bytemuck", - "byteorder", - "chrono", - "derivation-path", - "digest 0.10.7", - "ed25519-dalek", - "ed25519-dalek-bip32", - "generic-array", - "hmac 0.12.1", - "itertools", + "bytemuck_derive", + "curve25519-dalek", + "five8", + "five8_const", + "getrandom 0.2.17", "js-sys", - "lazy_static", - "libsecp256k1", - "log", - "memmap2", - "num-derive 0.3.3", "num-traits", - "num_enum 0.6.1", - "pbkdf2 0.11.0", - "qstring", - "qualifier_attr", - "rand 0.7.3", - "rand 0.8.5", - "rustc_version", - "rustversion", "serde", - "serde_bytes", "serde_derive", - "serde_json", - "serde_with", - "sha2 0.10.9", - "sha3 0.10.8", - "solana-frozen-abi", - "solana-frozen-abi-macro", - "solana-logger", - "solana-program", - "solana-sdk-macro", - "thiserror", - "uriparse", + "solana-atomic-u64", + "solana-decode-error", + "solana-define-syscall", + "solana-sanitize", + "solana-sha256-hasher", "wasm-bindgen", ] +[[package]] +name = "solana-rent" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1aea8fdea9de98ca6e8c2da5827707fb3842833521b528a713810ca685d2480" +dependencies = [ + "serde", + "serde_derive", + "solana-sdk-ids", + "solana-sdk-macro", + "solana-sysvar-id", +] + +[[package]] +name = "solana-sanitize" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61f1bc1357b8188d9c4a3af3fc55276e56987265eb7ad073ae6f8180ee54cecf" + +[[package]] +name = "solana-sdk-ids" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5d8b9cc68d5c88b062a33e23a6466722467dde0035152d8fb1afbcdf350a5f" +dependencies = [ + "solana-pubkey", +] + [[package]] name = "solana-sdk-macro" -version = "1.17.14" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60f58786e949f43b8c9b826fdfa5ad8586634b077ab04f989fb8e30535786712" +checksum = "86280da8b99d03560f6ab5aca9de2e38805681df34e0bb8f238e69b29433b9df" dependencies = [ - "bs58 0.4.0", + "bs58", "proc-macro2", "quote", - "rustversion", - "syn 2.0.104", + "syn 2.0.119", +] + +[[package]] +name = "solana-secp256k1-recover" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baa3120b6cdaa270f39444f5093a90a7b03d296d362878f7a6991d6de3bbe496" +dependencies = [ + "libsecp256k1", + "solana-define-syscall", + "thiserror 2.0.21", ] [[package]] @@ -2130,248 +2262,660 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "468aa43b7edb1f9b7b7b686d5c3aeb6630dc1708e86e31343499dd5c4d775183" [[package]] -name = "solana-zk-token-sdk" -version = "1.17.14" +name = "solana-seed-derivable" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3beb82b5adb266c6ea90e5cf3967235644848eac476c5a1f2f9283a143b7c97f" +dependencies = [ + "solana-derivation-path", +] + +[[package]] +name = "solana-seed-phrase" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36187af2324f079f65a675ec22b31c24919cb4ac22c79472e85d819db9bbbc15" +dependencies = [ + "hmac", + "pbkdf2", + "sha2 0.10.9", +] + +[[package]] +name = "solana-serde-varint" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a7e155eba458ecfb0107b98236088c3764a09ddf0201ec29e52a0be40857113" +dependencies = [ + "serde", +] + +[[package]] +name = "solana-serialize-utils" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "817a284b63197d2b27afdba829c5ab34231da4a9b4e763466a003c40ca4f535e" +dependencies = [ + "solana-instruction", + "solana-pubkey", + "solana-sanitize", +] + +[[package]] +name = "solana-sha256-hasher" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa3feb32c28765f6aa1ce8f3feac30936f16c5c3f7eb73d63a5b8f6f8ecdc44" +dependencies = [ + "sha2 0.10.9", + "solana-define-syscall", + "solana-hash", +] + +[[package]] +name = "solana-short-vec" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c54c66f19b9766a56fa0057d060de8378676cb64987533fa088861858fc5a69" +dependencies = [ + "serde", +] + +[[package]] +name = "solana-signature" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64c8ec8e657aecfc187522fc67495142c12f35e55ddeca8698edbb738b8dbd8c" +dependencies = [ + "five8", + "solana-sanitize", +] + +[[package]] +name = "solana-signer" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c41991508a4b02f021c1342ba00bcfa098630b213726ceadc7cb032e051975b" +dependencies = [ + "solana-pubkey", + "solana-signature", + "solana-transaction-error", +] + +[[package]] +name = "solana-slot-hashes" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c8691982114513763e88d04094c9caa0376b867a29577939011331134c301ce" +dependencies = [ + "serde", + "serde_derive", + "solana-hash", + "solana-sdk-ids", + "solana-sysvar-id", +] + +[[package]] +name = "solana-slot-history" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97ccc1b2067ca22754d5283afb2b0126d61eae734fc616d23871b0943b0d935e" +dependencies = [ + "bv", + "serde", + "serde_derive", + "solana-sdk-ids", + "solana-sysvar-id", +] + +[[package]] +name = "solana-stable-layout" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f14f7d02af8f2bc1b5efeeae71bc1c2b7f0f65cd75bcc7d8180f2c762a57f54" +dependencies = [ + "solana-instruction", + "solana-pubkey", +] + +[[package]] +name = "solana-stake-interface" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5269e89fde216b4d7e1d1739cf5303f8398a1ff372a81232abbee80e554a838c" +dependencies = [ + "borsh 0.10.4", + "borsh 1.8.1", + "num-traits", + "serde", + "serde_derive", + "solana-clock", + "solana-cpi", + "solana-decode-error", + "solana-instruction", + "solana-program-error", + "solana-pubkey", + "solana-system-interface", + "solana-sysvar-id", +] + +[[package]] +name = "solana-system-interface" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94d7c18cb1a91c6be5f5a8ac9276a1d7c737e39a21beba9ea710ab4b9c63bc90" +dependencies = [ + "js-sys", + "num-traits", + "serde", + "serde_derive", + "solana-decode-error", + "solana-instruction", + "solana-pubkey", + "wasm-bindgen", +] + +[[package]] +name = "solana-sysvar" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8c3595f95069f3d90f275bb9bd235a1973c4d059028b0a7f81baca2703815db" +dependencies = [ + "base64 0.22.1", + "bincode", + "bytemuck", + "bytemuck_derive", + "lazy_static", + "serde", + "serde_derive", + "solana-account-info", + "solana-clock", + "solana-define-syscall", + "solana-epoch-rewards", + "solana-epoch-schedule", + "solana-fee-calculator", + "solana-hash", + "solana-instruction", + "solana-instructions-sysvar", + "solana-last-restart-slot", + "solana-program-entrypoint", + "solana-program-error", + "solana-program-memory", + "solana-pubkey", + "solana-rent", + "solana-sanitize", + "solana-sdk-ids", + "solana-sdk-macro", + "solana-slot-hashes", + "solana-slot-history", + "solana-stake-interface", + "solana-sysvar-id", +] + +[[package]] +name = "solana-sysvar-id" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03d932d7b13a223a6c1068d7061df7e9d2de14bfc0a874350eef19d59086b04a" +checksum = "5762b273d3325b047cfda250787f8d796d781746860d5d0a746ee29f3e8812c1" +dependencies = [ + "solana-pubkey", + "solana-sdk-ids", +] + +[[package]] +name = "solana-transaction-error" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "222a9dc8fdb61c6088baab34fc3a8b8473a03a7a5fd404ed8dd502fa79b67cb1" +dependencies = [ + "solana-instruction", + "solana-sanitize", +] + +[[package]] +name = "solana-vote-interface" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b80d57478d6599d30acc31cc5ae7f93ec2361a06aefe8ea79bc81739a08af4c3" +dependencies = [ + "bincode", + "num-derive 0.4.2", + "num-traits", + "serde", + "serde_derive", + "solana-clock", + "solana-decode-error", + "solana-hash", + "solana-instruction", + "solana-pubkey", + "solana-rent", + "solana-sdk-ids", + "solana-serde-varint", + "solana-serialize-utils", + "solana-short-vec", + "solana-system-interface", +] + +[[package]] +name = "solana-zk-sdk" +version = "2.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b9fc6ec37d16d0dccff708ed1dd6ea9ba61796700c3bb7c3b401973f10f63b" dependencies = [ "aes-gcm-siv", - "base64 0.21.7", + "base64 0.22.1", "bincode", "bytemuck", - "byteorder", + "bytemuck_derive", "curve25519-dalek", - "getrandom 0.1.16", "itertools", - "lazy_static", + "js-sys", "merlin", - "num-derive 0.3.3", + "num-derive 0.4.2", "num-traits", - "rand 0.7.3", + "rand 0.8.8", "serde", + "serde_derive", "serde_json", - "sha3 0.9.1", - "solana-program", - "solana-sdk", + "sha3", + "solana-derivation-path", + "solana-instruction", + "solana-pubkey", + "solana-sdk-ids", + "solana-seed-derivable", + "solana-seed-phrase", + "solana-signature", + "solana-signer", "subtle", - "thiserror", + "thiserror 2.0.21", + "wasm-bindgen", "zeroize", ] [[package]] name = "spl-associated-token-account" -version = "2.2.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "385e31c29981488f2820b2022d8e731aae3b02e6e18e2fd854e4c9a94dc44fc3" +checksum = "ae179d4a26b3c7a20c839898e6aed84cb4477adf108a366c95532f058aea041b" dependencies = [ - "assert_matches", - "borsh 0.10.4", + "borsh 1.8.1", "num-derive 0.4.2", "num-traits", "solana-program", + "spl-associated-token-account-client", "spl-token", "spl-token-2022", - "thiserror", + "thiserror 2.0.21", +] + +[[package]] +name = "spl-associated-token-account-client" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f8349dbcbe575f354f9a533a21f272f3eb3808a49e2fdc1c34393b88ba76cb" +dependencies = [ + "solana-instruction", + "solana-pubkey", ] [[package]] name = "spl-discriminator" -version = "0.1.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cce5d563b58ef1bb2cdbbfe0dfb9ffdc24903b10ae6a4df2d8f425ece375033f" +checksum = "a7398da23554a31660f17718164e31d31900956054f54f52d5ec1be51cb4f4b3" dependencies = [ "bytemuck", - "solana-program", + "solana-program-error", + "solana-sha256-hasher", "spl-discriminator-derive", ] [[package]] name = "spl-discriminator-derive" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07fd7858fc4ff8fb0e34090e41d7eb06a823e1057945c26d480bfc21d2338a93" +checksum = "d9e8418ea6269dcfb01c712f0444d2c75542c04448b480e87de59d2865edc750" dependencies = [ "quote", "spl-discriminator-syn", - "syn 2.0.104", + "syn 2.0.119", ] [[package]] name = "spl-discriminator-syn" -version = "0.1.2" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fea7be851bd98d10721782ea958097c03a0c2a07d8d4997041d0ece6319a63" +checksum = "5d1dbc82ab91422345b6df40a79e2b78c7bce1ebb366da323572dd60b7076b67" dependencies = [ "proc-macro2", "quote", "sha2 0.10.9", - "syn 2.0.104", - "thiserror", + "syn 2.0.119", + "thiserror 1.0.69", +] + +[[package]] +name = "spl-elgamal-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65edfeed09cd4231e595616aa96022214f9c9d2be02dea62c2b30d5695a6833a" +dependencies = [ + "bytemuck", + "solana-account-info", + "solana-cpi", + "solana-instruction", + "solana-msg", + "solana-program-entrypoint", + "solana-program-error", + "solana-pubkey", + "solana-rent", + "solana-sdk-ids", + "solana-system-interface", + "solana-sysvar", + "solana-zk-sdk", + "spl-pod", + "spl-token-confidential-transfer-proof-extraction", ] [[package]] name = "spl-memo" -version = "4.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f180b03318c3dbab3ef4e1e4d46d5211ae3c780940dd0a28695aba4b59a75a" +checksum = "9f09647c0974e33366efeb83b8e2daebb329f0420149e74d3a4bd2c08cf9f7cb" dependencies = [ - "solana-program", + "solana-account-info", + "solana-instruction", + "solana-msg", + "solana-program-entrypoint", + "solana-program-error", + "solana-pubkey", ] [[package]] name = "spl-pod" -version = "0.1.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2881dddfca792737c0706fa0175345ab282b1b0879c7d877bad129645737c079" +checksum = "d994afaf86b779104b4a95ba9ca75b8ced3fdb17ee934e38cb69e72afbe17799" dependencies = [ - "borsh 0.10.4", + "borsh 1.8.1", "bytemuck", - "solana-program", - "solana-zk-token-sdk", - "spl-program-error", + "bytemuck_derive", + "num-derive 0.4.2", + "num-traits", + "solana-decode-error", + "solana-msg", + "solana-program-error", + "solana-program-option", + "solana-pubkey", + "solana-zk-sdk", + "thiserror 2.0.21", ] [[package]] name = "spl-program-error" -version = "0.3.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "249e0318493b6bcf27ae9902600566c689b7dfba9f1bdff5893e92253374e78c" +checksum = "9cdebc8b42553070b75aa5106f071fef2eb798c64a7ec63375da4b1f058688c6" dependencies = [ "num-derive 0.4.2", "num-traits", - "solana-program", + "solana-decode-error", + "solana-msg", + "solana-program-error", "spl-program-error-derive", - "thiserror", + "thiserror 2.0.21", ] [[package]] name = "spl-program-error-derive" -version = "0.3.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1845dfe71fd68f70382232742e758557afe973ae19e6c06807b2c30f5d5cb474" +checksum = "2a2539e259c66910d78593475540e8072f0b10f0f61d7607bbf7593899ed52d0" dependencies = [ "proc-macro2", "quote", "sha2 0.10.9", - "syn 2.0.104", + "syn 2.0.119", ] [[package]] name = "spl-tlv-account-resolution" -version = "0.4.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "062e148d3eab7b165582757453632ffeef490c02c86a48bfdb4988f63eefb3b9" +checksum = "1408e961215688715d5a1063cbdcf982de225c45f99c82b4f7d7e1dd22b998d7" dependencies = [ "bytemuck", - "solana-program", + "num-derive 0.4.2", + "num-traits", + "solana-account-info", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-error", + "solana-pubkey", "spl-discriminator", "spl-pod", "spl-program-error", "spl-type-length-value", + "thiserror 2.0.21", ] [[package]] name = "spl-token" -version = "4.0.0" +version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08459ba1b8f7c1020b4582c4edf0f5c7511a5e099a7a97570c9698d4f2337060" +checksum = "053067c6a82c705004f91dae058b11b4780407e9ccd6799dc9e7d0fab5f242da" dependencies = [ "arrayref", "bytemuck", - "num-derive 0.3.3", + "num-derive 0.4.2", "num-traits", - "num_enum 0.6.1", - "solana-program", - "thiserror", + "num_enum", + "solana-account-info", + "solana-cpi", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-entrypoint", + "solana-program-error", + "solana-program-memory", + "solana-program-option", + "solana-program-pack", + "solana-pubkey", + "solana-rent", + "solana-sdk-ids", + "solana-sysvar", + "thiserror 2.0.21", ] [[package]] name = "spl-token-2022" -version = "0.9.0" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4abf34a65ba420584a0c35f3903f8d727d1f13ababbdc3f714c6b065a686e86" +checksum = "31f0dfbb079eebaee55e793e92ca5f433744f4b71ee04880bfd6beefba5973e5" dependencies = [ "arrayref", "bytemuck", "num-derive 0.4.2", "num-traits", - "num_enum 0.7.0", - "solana-program", - "solana-zk-token-sdk", + "num_enum", + "solana-account-info", + "solana-clock", + "solana-cpi", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-native-token", + "solana-program-entrypoint", + "solana-program-error", + "solana-program-memory", + "solana-program-option", + "solana-program-pack", + "solana-pubkey", + "solana-rent", + "solana-sdk-ids", + "solana-security-txt", + "solana-system-interface", + "solana-sysvar", + "solana-zk-sdk", + "spl-elgamal-registry", "spl-memo", "spl-pod", "spl-token", + "spl-token-confidential-transfer-ciphertext-arithmetic", + "spl-token-confidential-transfer-proof-extraction", + "spl-token-confidential-transfer-proof-generation", + "spl-token-group-interface", "spl-token-metadata-interface", "spl-transfer-hook-interface", "spl-type-length-value", - "thiserror", + "thiserror 2.0.21", +] + +[[package]] +name = "spl-token-confidential-transfer-ciphertext-arithmetic" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cddd52bfc0f1c677b41493dafa3f2dbbb4b47cf0990f08905429e19dc8289b35" +dependencies = [ + "base64 0.22.1", + "bytemuck", + "solana-curve25519", + "solana-zk-sdk", +] + +[[package]] +name = "spl-token-confidential-transfer-proof-extraction" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe2629860ff04c17bafa9ba4bed8850a404ecac81074113e1f840dbd0ebb7bd6" +dependencies = [ + "bytemuck", + "solana-account-info", + "solana-curve25519", + "solana-instruction", + "solana-instructions-sysvar", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "solana-sdk-ids", + "solana-zk-sdk", + "spl-pod", + "thiserror 2.0.21", +] + +[[package]] +name = "spl-token-confidential-transfer-proof-generation" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa27b9174bea869a7ebf31e0be6890bce90b1a4288bc2bbf24bd413f80ae3fde" +dependencies = [ + "curve25519-dalek", + "solana-zk-sdk", + "thiserror 2.0.21", +] + +[[package]] +name = "spl-token-group-interface" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5597b4cd76f85ce7cd206045b7dc22da8c25516573d42d267c8d1fd128db5129" +dependencies = [ + "bytemuck", + "num-derive 0.4.2", + "num-traits", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-error", + "solana-pubkey", + "spl-discriminator", + "spl-pod", + "thiserror 2.0.21", ] [[package]] name = "spl-token-metadata-interface" -version = "0.2.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c16ce3ba6979645fb7627aa1e435576172dd63088dc7848cb09aa331fa1fe4f" +checksum = "304d6e06f0de0c13a621464b1fd5d4b1bebf60d15ca71a44d3839958e0da16ee" dependencies = [ - "borsh 0.10.4", - "solana-program", + "borsh 1.8.1", + "num-derive 0.4.2", + "num-traits", + "solana-borsh", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-error", + "solana-pubkey", "spl-discriminator", "spl-pod", - "spl-program-error", "spl-type-length-value", + "thiserror 2.0.21", ] [[package]] name = "spl-transfer-hook-interface" -version = "0.3.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "051d31803f873cabe71aec3c1b849f35248beae5d19a347d93a5c9cccc5d5a9b" +checksum = "a7e905b849b6aba63bde8c4badac944ebb6c8e6e14817029cbe1bc16829133bd" dependencies = [ "arrayref", "bytemuck", - "solana-program", + "num-derive 0.4.2", + "num-traits", + "solana-account-info", + "solana-cpi", + "solana-decode-error", + "solana-instruction", + "solana-msg", + "solana-program-error", + "solana-pubkey", "spl-discriminator", "spl-pod", "spl-program-error", "spl-tlv-account-resolution", "spl-type-length-value", + "thiserror 2.0.21", ] [[package]] name = "spl-type-length-value" -version = "0.3.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a468e6f6371f9c69aae760186ea9f1a01c2908351b06a5e0026d21cfc4d7ecac" +checksum = "d417eb548214fa822d93f84444024b4e57c13ed6719d4dcc68eec24fb481e9f5" dependencies = [ "bytemuck", - "solana-program", + "num-derive 0.4.2", + "num-traits", + "solana-account-info", + "solana-decode-error", + "solana-msg", + "solana-program-error", "spl-discriminator", "spl-pod", - "spl-program-error", + "thiserror 2.0.21", ] [[package]] name = "squads-multisig-program" version = "2.1.0" -source = "git+https://github.com/Squads-Protocol/v4?rev=6d5235da621a2e9b7379ea358e48760e981053be#6d5235da621a2e9b7379ea358e48760e981053be" +source = "git+https://github.com/metapileks/squads-v4?rev=d7fbfab3b2b218bf71bab8d7127574a88b468c17#d7fbfab3b2b218bf71bab8d7127574a88b468c17" dependencies = [ "anchor-lang", "anchor-spl", + "solana-address-lookup-table-interface", + "solana-borsh", "solana-program", "solana-security-txt", ] -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - [[package]] name = "subtle" -version = "2.4.1" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -2386,9 +2930,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.104" +version = "2.0.119" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" dependencies = [ "proc-macro2", "quote", @@ -2396,12 +2940,14 @@ dependencies = [ ] [[package]] -name = "termcolor" -version = "1.4.1" +name = "syn" +version = "3.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" dependencies = [ - "winapi-util", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] @@ -2410,7 +2956,16 @@ version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl 2.0.21", ] [[package]] @@ -2421,50 +2976,45 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.119", ] [[package]] -name = "tiny-bip39" -version = "0.8.2" +name = "thiserror-impl" +version = "2.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" dependencies = [ - "anyhow", - "hmac 0.8.1", - "once_cell", - "pbkdf2 0.4.0", - "rand 0.7.3", - "rustc-hash", - "sha2 0.9.9", - "thiserror", - "unicode-normalization", - "wasm-bindgen", - "zeroize", + "proc-macro2", + "quote", + "syn 3.0.9", ] [[package]] name = "tinyvec" -version = "1.9.0" +version = "1.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71" -dependencies = [ - "tinyvec_macros", -] +checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" [[package]] -name = "tinyvec_macros" -version = "0.1.1" +name = "toml" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] [[package]] name = "toml" -version = "0.5.11" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" dependencies = [ "serde", + "serde_spanned", + "toml_datetime 0.6.11", + "toml_edit 0.22.27", ] [[package]] @@ -2472,52 +3022,85 @@ name = "toml_datetime" version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", +] [[package]] -name = "toml_edit" -version = "0.19.15" +name = "toml_datetime" +version = "1.1.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053" dependencies = [ - "indexmap", - "toml_datetime", - "winnow", + "serde_core", ] [[package]] -name = "typenum" -version = "1.18.0" +name = "toml_edit" +version = "0.22.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime 0.6.11", + "toml_write", + "winnow 0.7.15", +] [[package]] -name = "unicode-ident" -version = "1.0.18" +name = "toml_edit" +version = "0.25.17+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" +checksum = "e3641d5bbb5349a79e1020a242d251efbc546ad8048d133958323ce9c40a9c9c" +dependencies = [ + "indexmap", + "toml_datetime 1.1.2+spec-1.1.0", + "toml_parser", + "winnow 1.0.4", +] [[package]] -name = "unicode-normalization" -version = "0.1.24" +name = "toml_parser" +version = "1.1.5+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c" dependencies = [ - "tinyvec", + "winnow 1.0.4", ] +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + [[package]] name = "unicode-segmentation" -version = "1.12.0" +version = "1.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" [[package]] name = "universal-hash" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" +checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" dependencies = [ - "generic-array", + "crypto-common 0.1.7", "subtle", ] @@ -2549,46 +3132,24 @@ version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" -[[package]] -name = "wasi" -version = "0.14.2+wasi-0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" -dependencies = [ - "wit-bindgen-rt", -] - [[package]] name = "wasm-bindgen" -version = "0.2.100" +version = "0.2.129" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" dependencies = [ "cfg-if", "once_cell", "rustversion", "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" -dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn 2.0.104", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.100" +version = "0.2.129" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2596,214 +3157,102 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.100" +version = "0.2.129" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7" dependencies = [ + "bumpalo", "proc-macro2", "quote", - "syn 2.0.104", - "wasm-bindgen-backend", + "syn 3.0.9", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.100" +version = "0.2.129" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6" dependencies = [ "unicode-ident", ] [[package]] name = "web-sys" -version = "0.3.77" +version = "0.3.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" +checksum = "88261b9deccee56594c11a3460c462c41f58d148598fe70ad77070126a68aba4" dependencies = [ "js-sys", "wasm-bindgen", ] [[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" -dependencies = [ - "windows-sys", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" +name = "windows-link" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] name = "winnow" -version = "0.5.40" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" dependencies = [ "memchr", ] [[package]] -name = "wit-bindgen-rt" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" -dependencies = [ - "bitflags", -] - -[[package]] -name = "zerocopy" -version = "0.7.35" +name = "winnow" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" dependencies = [ - "zerocopy-derive 0.7.35", + "memchr", ] [[package]] name = "zerocopy" -version = "0.8.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" -dependencies = [ - "zerocopy-derive 0.8.26", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.35" +version = "0.8.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", + "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.26" +version = "0.8.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" +checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.119", ] [[package]] name = "zeroize" -version = "1.3.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" +checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879" dependencies = [ "zeroize_derive", ] [[package]] name = "zeroize_derive" -version = "1.4.2" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.119", ] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/Cargo.toml b/Cargo.toml index 9fe12d57a..cdcfb491a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,24 @@ exclude = [ ] resolver = "2" +[workspace.metadata.cli] +solana = "4.3.0" + +# Pins the platform-tools compiler that cargo-build-sbf uses. +[workspace.metadata.solana] +tools-version = "v1.57" + +# Anchor's macros expand to code guarded by these cfgs; declare them so rustc does not flag every expansion. +[workspace.lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = [ + 'cfg(target_os, values("solana"))', + 'cfg(feature, values("anchor-debug", "custom-heap", "custom-panic"))', +] } + +# The upstream crate lacks the `idl-build` feature the IDL build needs; this fork adds it. +[patch."https://github.com/Squads-Protocol/v4"] +squads-multisig-program = { git = "https://github.com/metapileks/squads-v4", rev = "d7fbfab3b2b218bf71bab8d7127574a88b468c17" } + [profile.release] overflow-checks = true lto = "fat" diff --git a/README.md b/README.md index 3aee5b7cf..9d798129d 100644 --- a/README.md +++ b/README.md @@ -42,10 +42,11 @@ Programs for unruggable capital formation and market-driven governance. Before you can build and test the programs, you'll need to install the following tools: -- **Rust**: 1.78.0 or compatible -- **Solana CLI**: 1.17.34 or compatible -- **Anchor CLI**: 0.29.0 -- **Node.js**: 16.x or higher (tested with v23.x) +- **Rust**: 1.95.0, pinned by `rust-toolchain.toml` (rustup installs it on first use) +- **Solana CLI**: Agave 4.3.0 (`agave-install init 4.3.0`) +- **cargo-build-sbf**: 4.4.0 standalone (`cargo install cargo-build-sbf --version 4.4.0 --locked`), which emits SBPFv3 by default +- **Anchor CLI**: 0.32.2 (`avm install 0.32.2`) +- **Node.js**: 20.18 or higher (tested with v22.x) - **Yarn**: 1.22.22 or compatible ### MacOS Setup @@ -61,14 +62,13 @@ cd programs ```bash curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -rustup install 1.78.0 -rustup default 1.78.0 +rustup toolchain install ``` #### 3. Install Solana CLI ```bash -sh -c "$(curl -sSfL https://release.solana.com/v1.17.34/install)" +sh -c "$(curl -sSfL https://release.anza.xyz/v4.3.0/install)" ``` Add Solana to your PATH (add to `~/.zshrc` or `~/.bash_profile`): @@ -83,10 +83,26 @@ Reload your shell configuration: source ~/.zshrc # or source ~/.bash_profile ``` +Agave 4.3.0 bundles cargo-build-sbf 4.3.0, which emits SBPFv0. The programs are built as SBPFv3, which the standalone 4.4.0 emits by default: + +```bash +cargo install cargo-build-sbf --version 4.4.0 --locked +``` + +The Solana install directory holds the bundled copy too, so add this line *after* the Solana PATH line in your shell profile to make the cargo-installed copy win: + +```bash +export PATH="$HOME/.cargo/bin:$PATH" +``` + +Check with `cargo build-sbf --version`, which must print `cargo-build-sbf 4.4.0`. (`./rebuild.sh` sets this order for itself.) + #### 4. Install Anchor CLI ```bash -cargo install --git https://github.com/coral-xyz/anchor --tag v0.29.0 anchor-cli --locked +cargo install --git https://github.com/coral-xyz/anchor avm --locked +avm install 0.32.2 +avm use 0.32.2 ``` #### 5. Install Node.js and Yarn @@ -95,8 +111,8 @@ Install Node.js using [nvm](https://github.com/nvm-sh/nvm) (recommended): ```bash curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash -nvm install 18 -nvm use 18 +nvm install 20 +nvm use 20 ``` Install Yarn: diff --git a/VERIFYING-BUILDS.md b/VERIFYING-BUILDS.md index 39516337a..48500ae0d 100644 --- a/VERIFYING-BUILDS.md +++ b/VERIFYING-BUILDS.md @@ -3,14 +3,15 @@ If you're on the MetaDAO security council, you will need to verify builds before allowing the program to be upgraded. Here's how to do it: -1. Open up `futarchy` on GitHub.com +1. Open up `programs` on GitHub.com 2. Navigate to the 'Actions' tab 3. Click on the 'generate-verifiable-builds' workflow 4. Click on the latest commit 5. Click on the relevant program -6. Open up the `anchor-verifiable-build` step -7. Verify that the action name is `metadaoproject/anchor-verifiable-build@v0.2` -8. Scroll down to the bottom of the step, you should see a hash right below "Program Solana version: vx.y.z" +6. Open up the `Build verifiable artifact` step +7. Verify that the command is `solana-verify build --library-name --arch v3 -- --features production` with no + `--base-image`, and that the log names the `solanafoundation/solana-verifiable-build:4.3.0` image +8. Open up the `Print artifact hash` step, its only output line is the hash 9. Open up app.squads.so 10. Click on the program upgrade transaction, you should be able to see the buffer account from either simulating the transaction or looking at the transaction details diff --git a/package.json b/package.json index 72d7b887a..51c952533 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ ] }, "dependencies": { - "@coral-xyz/anchor": "0.29.0", + "@anchor-lang/core": "0.32.2", "@inquirer/prompts": "7.9.0", "@ledgerhq/hw-app-solana": "7.10.4", "@ledgerhq/hw-transport-node-hid": "6.33.4", @@ -38,17 +38,14 @@ "@meteora-ag/cp-amm-sdk": "1.2.6", "@noble/ed25519": "2.3.0", "@noble/secp256k1": "2.3.0", + "@solana/kit": "8.3.0", "@solana/spl-token": "0.3.11", - "@solana/web3.js": "1.76.0", + "@solana/web3.js": "1.99.0", "@sqds/multisig": "2.1.4", - "anchor-bankrun": "0.3.0", - "anchor-litesvm": "0.1.2", "arweave": "1.15.7", "bs58": "6.0.0", - "litesvm": "0.2.0", - "rpc-websockets": "7.5.0", - "solana-bankrun": "0.3.1", - "spl-token-bankrun": "0.2.6" + "litesvm": "1.4.1", + "rpc-websockets": "7.5.0" }, "devDependencies": { "@eslint/js": "9.38.0", diff --git a/programs/bid_wall/Cargo.toml b/programs/bid_wall/Cargo.toml index a711bbb2b..2ac87e31a 100644 --- a/programs/bid_wall/Cargo.toml +++ b/programs/bid_wall/Cargo.toml @@ -13,10 +13,15 @@ no-entrypoint = [] no-idl = [] no-log-ix-name = [] cpi = ["no-entrypoint"] +idl-build = ["anchor-lang/idl-build", "anchor-spl/idl-build"] default = [] +devnet = [] production = [] [dependencies] -anchor-lang = { version = "=0.29.0", features = ["event-cpi", "init-if-needed"] } -anchor-spl = "=0.29.0" +anchor-lang = { version = "=0.32.2", features = ["event-cpi", "init-if-needed"] } +anchor-spl = "=0.32.2" solana-security-txt = "=1.1.1" + +[lints] +workspace = true diff --git a/programs/bid_wall/src/instructions/collect_fees.rs b/programs/bid_wall/src/instructions/collect_fees.rs index 5988f343f..eca7e5e47 100644 --- a/programs/bid_wall/src/instructions/collect_fees.rs +++ b/programs/bid_wall/src/instructions/collect_fees.rs @@ -11,7 +11,7 @@ use crate::{ }; pub mod metadao_cranker { - use anchor_lang::prelude::declare_id; + use anchor_lang::solana_program::pubkey::declare_id; declare_id!("tSTp6B6kE9o6ZaTmHm2ZwnJBBtgd3x112tapxFhmBEQ"); } diff --git a/programs/bid_wall/src/lib.rs b/programs/bid_wall/src/lib.rs index a4054c101..a08a679d8 100644 --- a/programs/bid_wall/src/lib.rs +++ b/programs/bid_wall/src/lib.rs @@ -25,7 +25,7 @@ security_txt! { declare_id!("WALL8ucBuUyL46QYxwYJjidaFYhdvxUFrgvBxPshERx"); pub mod usdc_mint { - use anchor_lang::prelude::declare_id; + use anchor_lang::solana_program::pubkey::declare_id; #[cfg(feature = "devnet")] declare_id!("4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"); @@ -35,7 +35,7 @@ pub mod usdc_mint { } pub mod metadao_multisig_vault { - use anchor_lang::prelude::declare_id; + use anchor_lang::solana_program::pubkey::declare_id; // MetaDAO operations multisig vault - hardcoded fee destination declare_id!("6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf"); diff --git a/programs/conditional_vault/Cargo.toml b/programs/conditional_vault/Cargo.toml index e3318ddac..6a7645c99 100644 --- a/programs/conditional_vault/Cargo.toml +++ b/programs/conditional_vault/Cargo.toml @@ -13,10 +13,14 @@ no-entrypoint = [] no-idl = [] no-log-ix-name = [] cpi = ["no-entrypoint"] +idl-build = ["anchor-lang/idl-build", "anchor-spl/idl-build"] default = [] production = [] [dependencies] -anchor-lang = { version = "=0.29.0", features = ["init-if-needed", "event-cpi"] } -anchor-spl = { version = "=0.29.0", features = ["metadata"] } +anchor-lang = { version = "=0.32.2", features = ["init-if-needed", "event-cpi"] } +anchor-spl = { version = "=0.32.2", features = ["metadata"] } solana-security-txt = "=1.1.1" + +[lints] +workspace = true diff --git a/programs/conditional_vault/src/instructions/add_metadata_to_conditional_tokens.rs b/programs/conditional_vault/src/instructions/add_metadata_to_conditional_tokens.rs index dee3ce953..753b009a7 100644 --- a/programs/conditional_vault/src/instructions/add_metadata_to_conditional_tokens.rs +++ b/programs/conditional_vault/src/instructions/add_metadata_to_conditional_tokens.rs @@ -1,7 +1,7 @@ use super::*; pub mod proph3t_deployer { - use anchor_lang::declare_id; + use anchor_lang::solana_program::pubkey::declare_id; declare_id!("613BRiXuAEn7vibs2oAYzpGW9fXgjzDNuFMM4wPzLdY"); } diff --git a/programs/damm_v2_cpi/Cargo.toml b/programs/damm_v2_cpi/Cargo.toml index e1194a796..40a2f96cf 100644 --- a/programs/damm_v2_cpi/Cargo.toml +++ b/programs/damm_v2_cpi/Cargo.toml @@ -13,7 +13,11 @@ no-entrypoint = [] no-idl = [] no-log-ix-name = [] cpi = ["no-entrypoint"] +idl-build = ["anchor-lang/idl-build"] default = [] [dependencies] -anchor-lang = { version = "=0.29.0", features = ["event-cpi"] } +anchor-lang = { version = "=0.32.2", features = ["event-cpi"] } + +[lints] +workspace = true diff --git a/programs/futarchy/Cargo.toml b/programs/futarchy/Cargo.toml index 8630f815e..19db4e24c 100644 --- a/programs/futarchy/Cargo.toml +++ b/programs/futarchy/Cargo.toml @@ -13,15 +13,27 @@ no-entrypoint = [] no-idl = [] no-log-ix-name = [] cpi = ["no-entrypoint"] +idl-build = [ + "anchor-lang/idl-build", + "anchor-spl/idl-build", + "conditional_vault/idl-build", + "damm_v2_cpi/idl-build", + "mint_governor/idl-build", + "squads-multisig-program/idl-build", +] default = [] production = [] [dependencies] -anchor-lang = "=0.29.0" -anchor-spl = "=0.29.0" +anchor-lang = "=0.32.2" +anchor-spl = "=0.32.2" solana-security-txt = "=1.1.1" -spl-memo = { version = "=4.0.0", features = ["no-entrypoint"] } +spl-memo = { version = "=6.0.0", features = ["no-entrypoint"] } +solana-address-lookup-table-interface = { version = "=2.2.2", features = ["bincode", "bytemuck"] } conditional_vault = { path = "../conditional_vault", features = ["cpi"] } -squads-multisig-program = { git = "https://github.com/Squads-Protocol/v4", package = "squads-multisig-program", rev = "6d5235da621a2e9b7379ea358e48760e981053be", features = ["cpi"] } +squads-multisig-program = { git = "https://github.com/Squads-Protocol/v4", package = "squads-multisig-program", rev = "af94153ff77a28b6effe46b9c94baaa93742b48c", features = ["cpi"] } damm_v2_cpi = { path = "../damm_v2_cpi", features = ["cpi"] } mint_governor = { path = "../mint_governor", features = ["cpi"] } + +[lints] +workspace = true diff --git a/programs/futarchy/src/foreign.rs b/programs/futarchy/src/foreign.rs new file mode 100644 index 000000000..aa8fdf02f --- /dev/null +++ b/programs/futarchy/src/foreign.rs @@ -0,0 +1,47 @@ +use anchor_lang::prelude::*; +use std::ops::Deref; + +/// Wraps an account owned by another Anchor program so it can be used with `Account` without being listed in this program's IDL. +#[derive(Clone)] +pub struct Foreign(pub T); + +impl Deref for Foreign { + type Target = T; + fn deref(&self) -> &T { + &self.0 + } +} + +impl AccountDeserialize for Foreign { + fn try_deserialize(buf: &mut &[u8]) -> Result { + T::try_deserialize(buf).map(Foreign) + } + fn try_deserialize_unchecked(buf: &mut &[u8]) -> Result { + T::try_deserialize_unchecked(buf).map(Foreign) + } +} + +impl AccountSerialize for Foreign { + fn try_serialize(&self, writer: &mut W) -> Result<()> { + self.0.try_serialize(writer) + } +} + +impl Owner for Foreign { + fn owner() -> Pubkey { + T::owner() + } +} + +impl Discriminator for Foreign { + const DISCRIMINATOR: &'static [u8] = T::DISCRIMINATOR; +} + +#[cfg(feature = "idl-build")] +impl anchor_lang::IdlBuild for Foreign {} + +// `#[derive(Accounts)]` needs a plain type path, so the wrapper is used through aliases. +pub type SquadsMultisig = Foreign; +pub type SquadsProposal = Foreign; +pub type SquadsVaultTransaction = Foreign; +pub type SquadsSpendingLimit = Foreign; diff --git a/programs/futarchy/src/instructions/admin_cancel_proposal.rs b/programs/futarchy/src/instructions/admin_cancel_proposal.rs index b220fa567..8d0168071 100644 --- a/programs/futarchy/src/instructions/admin_cancel_proposal.rs +++ b/programs/futarchy/src/instructions/admin_cancel_proposal.rs @@ -3,8 +3,8 @@ use super::*; use conditional_vault::{cpi::accounts::ResolveQuestion, ResolveQuestionArgs}; use squads_multisig_program::program::SquadsMultisigProgram; -pub mod admin { - use anchor_lang::prelude::declare_id; +mod admin { + use anchor_lang::solana_program::pubkey::declare_id; declare_id!("CWGawadYU8CzRVBecnJymNw97H7E3ndDinV5sMzesgY2"); } diff --git a/programs/futarchy/src/instructions/admin_enqueue_multisig_proposal_approval.rs b/programs/futarchy/src/instructions/admin_enqueue_multisig_proposal_approval.rs index 2ccc1ff01..f4f51ebc7 100644 --- a/programs/futarchy/src/instructions/admin_enqueue_multisig_proposal_approval.rs +++ b/programs/futarchy/src/instructions/admin_enqueue_multisig_proposal_approval.rs @@ -1,7 +1,7 @@ use super::*; mod admin { - use anchor_lang::prelude::declare_id; + use anchor_lang::solana_program::pubkey::declare_id; declare_id!("6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf"); } @@ -15,7 +15,7 @@ pub struct AdminEnqueueMultisigProposalApprovalArgs { #[instruction(args: AdminEnqueueMultisigProposalApprovalArgs)] pub struct AdminEnqueueMultisigProposalApproval<'info> { #[account(has_one = squads_multisig)] - pub dao: Account<'info, Dao>, + pub dao: Box>, #[account(mut)] pub admin: Signer<'info>, @@ -29,7 +29,7 @@ pub struct AdminEnqueueMultisigProposalApproval<'info> { bump, seeds::program = squads_multisig_program::ID, )] - pub squads_multisig: Account<'info, squads_multisig_program::Multisig>, + pub squads_multisig: Box>, #[account( seeds = [ @@ -42,7 +42,7 @@ pub struct AdminEnqueueMultisigProposalApproval<'info> { bump, seeds::program = squads_multisig_program::ID, )] - pub squads_multisig_proposal: Account<'info, squads_multisig_program::Proposal>, + pub squads_multisig_proposal: Box>, #[account( init, diff --git a/programs/futarchy/src/instructions/admin_enqueue_multisig_proposal_cancellation.rs b/programs/futarchy/src/instructions/admin_enqueue_multisig_proposal_cancellation.rs index 79b41ff17..51eac1755 100644 --- a/programs/futarchy/src/instructions/admin_enqueue_multisig_proposal_cancellation.rs +++ b/programs/futarchy/src/instructions/admin_enqueue_multisig_proposal_cancellation.rs @@ -1,7 +1,7 @@ use super::*; mod admin { - use anchor_lang::prelude::declare_id; + use anchor_lang::solana_program::pubkey::declare_id; // MetaDAO ops multisig — the same signer as the approval enqueue declare_id!("6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf"); @@ -16,7 +16,7 @@ pub struct AdminEnqueueMultisigProposalCancellationArgs { #[instruction(args: AdminEnqueueMultisigProposalCancellationArgs)] pub struct AdminEnqueueMultisigProposalCancellation<'info> { #[account(has_one = squads_multisig)] - pub dao: Account<'info, Dao>, + pub dao: Box>, #[account(mut)] pub admin: Signer<'info>, @@ -30,7 +30,7 @@ pub struct AdminEnqueueMultisigProposalCancellation<'info> { bump, seeds::program = squads_multisig_program::ID, )] - pub squads_multisig: Account<'info, squads_multisig_program::Multisig>, + pub squads_multisig: Box>, #[account( seeds = [ @@ -43,7 +43,7 @@ pub struct AdminEnqueueMultisigProposalCancellation<'info> { bump, seeds::program = squads_multisig_program::ID, )] - pub squads_multisig_proposal: Account<'info, squads_multisig_program::Proposal>, + pub squads_multisig_proposal: Box>, #[account( init, diff --git a/programs/futarchy/src/instructions/admin_execute_multisig_proposal.rs b/programs/futarchy/src/instructions/admin_execute_multisig_proposal.rs index 0a93e81c7..457e0152e 100644 --- a/programs/futarchy/src/instructions/admin_execute_multisig_proposal.rs +++ b/programs/futarchy/src/instructions/admin_execute_multisig_proposal.rs @@ -1,7 +1,7 @@ use super::*; mod admin { - use anchor_lang::prelude::declare_id; + use anchor_lang::solana_program::pubkey::declare_id; // MetaDAO-controlled admin - cannot be a Squads signer because of reentrancy declare_id!("CWGawadYU8CzRVBecnJymNw97H7E3ndDinV5sMzesgY2"); @@ -24,7 +24,7 @@ pub struct AdminExecuteMultisigProposal<'info> { bump, seeds::program = squads_multisig_program )] - pub squads_multisig: Account<'info, squads_multisig_program::Multisig>, + pub squads_multisig: Account<'info, SquadsMultisig>, #[account( mut, @@ -38,7 +38,7 @@ pub struct AdminExecuteMultisigProposal<'info> { bump, seeds::program = squads_multisig_program )] - pub squads_multisig_proposal: Account<'info, squads_multisig_program::Proposal>, + pub squads_multisig_proposal: Account<'info, SquadsProposal>, #[account( mut, @@ -51,8 +51,7 @@ pub struct AdminExecuteMultisigProposal<'info> { bump, seeds::program = squads_multisig_program )] - pub squads_multisig_vault_transaction: - Account<'info, squads_multisig_program::VaultTransaction>, + pub squads_multisig_vault_transaction: Account<'info, SquadsVaultTransaction>, pub squads_multisig_program: Program<'info, squads_multisig_program::program::SquadsMultisigProgram>, diff --git a/programs/futarchy/src/instructions/admin_remove_proposal.rs b/programs/futarchy/src/instructions/admin_remove_proposal.rs index 4e21eeb61..7959024c0 100644 --- a/programs/futarchy/src/instructions/admin_remove_proposal.rs +++ b/programs/futarchy/src/instructions/admin_remove_proposal.rs @@ -1,7 +1,7 @@ use super::*; -pub mod admin { - use anchor_lang::prelude::declare_id; +mod admin { + use anchor_lang::solana_program::pubkey::declare_id; declare_id!("CWGawadYU8CzRVBecnJymNw97H7E3ndDinV5sMzesgY2"); } diff --git a/programs/futarchy/src/instructions/admin_update_proposal_params.rs b/programs/futarchy/src/instructions/admin_update_proposal_params.rs index d3974d7ab..028a7b6c2 100644 --- a/programs/futarchy/src/instructions/admin_update_proposal_params.rs +++ b/programs/futarchy/src/instructions/admin_update_proposal_params.rs @@ -1,7 +1,7 @@ use super::*; mod admin { - use anchor_lang::prelude::declare_id; + use anchor_lang::solana_program::pubkey::declare_id; // MetaDAO ops multisig — the same signer as the approval enqueue declare_id!("6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf"); diff --git a/programs/futarchy/src/instructions/collect_fees.rs b/programs/futarchy/src/instructions/collect_fees.rs index 7dbf667cf..dfc0eab7e 100644 --- a/programs/futarchy/src/instructions/collect_fees.rs +++ b/programs/futarchy/src/instructions/collect_fees.rs @@ -1,14 +1,14 @@ use super::*; -pub mod metadao_multisig_vault { - use anchor_lang::prelude::declare_id; +mod metadao_multisig_vault { + use anchor_lang::solana_program::pubkey::declare_id; // MetaDAO operations multisig vault - hardcoded fee destination declare_id!("6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf"); } -pub mod metadao_admin { - use anchor_lang::prelude::declare_id; +mod metadao_admin { + use anchor_lang::solana_program::pubkey::declare_id; declare_id!("tSTp6B6kE9o6ZaTmHm2ZwnJBBtgd3x112tapxFhmBEQ"); } diff --git a/programs/futarchy/src/instructions/collect_meteora_damm_fees.rs b/programs/futarchy/src/instructions/collect_meteora_damm_fees.rs index b36ae9e4c..cb648df8f 100644 --- a/programs/futarchy/src/instructions/collect_meteora_damm_fees.rs +++ b/programs/futarchy/src/instructions/collect_meteora_damm_fees.rs @@ -5,21 +5,21 @@ use damm_v2_cpi::program::DammV2Cpi; use super::*; pub mod metadao_multisig_vault { - use anchor_lang::prelude::declare_id; + use anchor_lang::solana_program::pubkey::declare_id; // MetaDAO multisig declare_id!("6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf"); } -pub mod metadao_admin { - use anchor_lang::prelude::declare_id; +mod metadao_admin { + use anchor_lang::solana_program::pubkey::declare_id; // We must use a non-Squads signer because of CPI depth limits declare_id!("tSTp6B6kE9o6ZaTmHm2ZwnJBBtgd3x112tapxFhmBEQ"); } pub mod pool_authority { - use anchor_lang::prelude::declare_id; + use anchor_lang::solana_program::pubkey::declare_id; // DAMM V2 Pool Authority declare_id!("HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC"); @@ -39,7 +39,7 @@ pub struct CollectMeteoraDammFees<'info> { /// CHECK: checked by futarchy program #[account(mut, seeds = [squads_multisig_program::SEED_PREFIX, squads_multisig_program::SEED_MULTISIG, dao.key().as_ref()], bump, seeds::program = squads_program)] - pub squads_multisig: Account<'info, squads_multisig_program::Multisig>, + pub squads_multisig: Account<'info, SquadsMultisig>, /// CHECK: signer for the squads transaction, checked by squads program #[account(mut, seeds = [squads_multisig_program::SEED_PREFIX, squads_multisig.key().as_ref(), squads_multisig_program::SEED_VAULT, 0_u8.to_le_bytes().as_ref()], bump, seeds::program = squads_program)] pub squads_multisig_vault: UncheckedAccount<'info>, diff --git a/programs/futarchy/src/instructions/execute_multisig_proposal_approval.rs b/programs/futarchy/src/instructions/execute_multisig_proposal_approval.rs index d44e12525..362c489b4 100644 --- a/programs/futarchy/src/instructions/execute_multisig_proposal_approval.rs +++ b/programs/futarchy/src/instructions/execute_multisig_proposal_approval.rs @@ -18,7 +18,7 @@ pub struct ExecuteMultisigProposalApproval<'info> { bump, seeds::program = squads_multisig_program::ID, )] - pub squads_multisig: Account<'info, squads_multisig_program::Multisig>, + pub squads_multisig: Account<'info, SquadsMultisig>, #[account( mut, @@ -32,7 +32,7 @@ pub struct ExecuteMultisigProposalApproval<'info> { bump, seeds::program = squads_multisig_program::ID, )] - pub squads_multisig_proposal: Account<'info, squads_multisig_program::Proposal>, + pub squads_multisig_proposal: Account<'info, SquadsProposal>, #[account( mut, diff --git a/programs/futarchy/src/instructions/execute_multisig_proposal_cancellation.rs b/programs/futarchy/src/instructions/execute_multisig_proposal_cancellation.rs index 5934cfbd5..c96f28d25 100644 --- a/programs/futarchy/src/instructions/execute_multisig_proposal_cancellation.rs +++ b/programs/futarchy/src/instructions/execute_multisig_proposal_cancellation.rs @@ -18,7 +18,7 @@ pub struct ExecuteMultisigProposalCancellation<'info> { bump, seeds::program = squads_multisig_program::ID, )] - pub squads_multisig: Account<'info, squads_multisig_program::Multisig>, + pub squads_multisig: Account<'info, SquadsMultisig>, #[account( mut, @@ -32,7 +32,7 @@ pub struct ExecuteMultisigProposalCancellation<'info> { bump, seeds::program = squads_multisig_program::ID, )] - pub squads_multisig_proposal: Account<'info, squads_multisig_program::Proposal>, + pub squads_multisig_proposal: Account<'info, SquadsProposal>, #[account( mut, diff --git a/programs/futarchy/src/instructions/finalize_proposal.rs b/programs/futarchy/src/instructions/finalize_proposal.rs index 65e84b038..e8d5ea2fc 100644 --- a/programs/futarchy/src/instructions/finalize_proposal.rs +++ b/programs/futarchy/src/instructions/finalize_proposal.rs @@ -323,15 +323,39 @@ impl FinalizeProposal<'_> { dao.seq_num += 1; + Self::emit_finalize_event( + &ctx, + &clock, + pass_market_twap, + fail_market_twap, + threshold, + new_proposal_state, + is_team_sponsored, + ) + } + + // Kept out of `handle`, whose stack frame would otherwise exceed the 4 KiB limit. + #[inline(never)] + fn emit_finalize_event( + ctx: &Context, + clock: &Clock, + pass_market_twap: u128, + fail_market_twap: u128, + threshold: u128, + state: ProposalState, + is_team_sponsored: bool, + ) -> Result<()> { + let dao = &ctx.accounts.dao; + emit_cpi!(FinalizeProposalEvent { - common: CommonFields::new(&clock, dao.seq_num), - proposal: proposal.key(), + common: CommonFields::new(clock, dao.seq_num), + proposal: ctx.accounts.proposal.key(), dao: dao.key(), pass_market_twap, fail_market_twap, threshold, - state: new_proposal_state, - squads_proposal: squads_proposal.key(), + state, + squads_proposal: ctx.accounts.squads_proposal.key(), squads_multisig: dao.squads_multisig, post_amm_state: dao.amm.clone(), is_team_sponsored, diff --git a/programs/futarchy/src/instructions/initialize_dao.rs b/programs/futarchy/src/instructions/initialize_dao.rs index df9215811..3322b8e5a 100644 --- a/programs/futarchy/src/instructions/initialize_dao.rs +++ b/programs/futarchy/src/instructions/initialize_dao.rs @@ -64,7 +64,7 @@ pub struct InitializeDao<'info> { } pub mod permissionless_account { - use anchor_lang::prelude::declare_id; + use anchor_lang::solana_program::pubkey::declare_id; declare_id!("EP3SoC2SvR3d4c2eXVBvhEMWSr2j3YtoCY3UMiQV7BPD"); } diff --git a/programs/futarchy/src/instructions/initialize_hostile_liquidate_proposal.rs b/programs/futarchy/src/instructions/initialize_hostile_liquidate_proposal.rs index d9e7654b7..921d7166f 100644 --- a/programs/futarchy/src/instructions/initialize_hostile_liquidate_proposal.rs +++ b/programs/futarchy/src/instructions/initialize_hostile_liquidate_proposal.rs @@ -1,7 +1,7 @@ use super::*; -pub mod metadao_multisig_vault { - use anchor_lang::prelude::declare_id; +mod metadao_multisig_vault { + use anchor_lang::solana_program::pubkey::declare_id; // MetaDAO operations multisig vault declare_id!("6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf"); diff --git a/programs/futarchy/src/instructions/initialize_proposal.rs b/programs/futarchy/src/instructions/initialize_proposal.rs index ad6359fc6..cc9e1e7a6 100644 --- a/programs/futarchy/src/instructions/initialize_proposal.rs +++ b/programs/futarchy/src/instructions/initialize_proposal.rs @@ -11,8 +11,8 @@ pub struct InitializeProposal<'info> { bump )] pub proposal: Box>, - pub squads_proposal: Box>, - pub squads_multisig: Box>, + pub squads_proposal: Box>, + pub squads_multisig: Box>, #[account( seeds = [ squads_multisig_program::SEED_PREFIX, @@ -23,7 +23,7 @@ pub struct InitializeProposal<'info> { bump, seeds::program = squads_multisig_program::ID, )] - pub squads_vault_transaction: Box>, + pub squads_vault_transaction: Box>, #[account(mut, has_one = squads_multisig)] pub dao: Box>, #[account( diff --git a/programs/futarchy/src/instructions/launch_proposal.rs b/programs/futarchy/src/instructions/launch_proposal.rs index 43da59bfb..d9ed2a2d9 100644 --- a/programs/futarchy/src/instructions/launch_proposal.rs +++ b/programs/futarchy/src/instructions/launch_proposal.rs @@ -28,9 +28,9 @@ pub struct LaunchProposal<'info> { #[account(init_if_needed, payer = payer, associated_token::mint = fail_quote_mint, associated_token::authority = dao)] pub amm_fail_quote_vault: Box>, #[account(seeds = [squads_multisig_program::SEED_PREFIX, squads_multisig_program::SEED_MULTISIG, dao.key().as_ref()], bump, seeds::program = squads_multisig_program::ID)] - pub squads_multisig: Account<'info, squads_multisig_program::Multisig>, + pub squads_multisig: Account<'info, SquadsMultisig>, #[account(owner = squads_multisig_program::ID)] - pub squads_proposal: Account<'info, squads_multisig_program::Proposal>, + pub squads_proposal: Account<'info, SquadsProposal>, pub system_program: Program<'info, System>, pub token_program: Program<'info, Token>, pub associated_token_program: Program<'info, AssociatedToken>, diff --git a/programs/futarchy/src/instructions/resize_dao.rs b/programs/futarchy/src/instructions/resize_dao.rs index 8ec4ba4b7..b9a54092a 100644 --- a/programs/futarchy/src/instructions/resize_dao.rs +++ b/programs/futarchy/src/instructions/resize_dao.rs @@ -22,7 +22,7 @@ impl ResizeDao<'_> { let dao = &ctx.accounts.dao; require_eq!(dao.owner, &crate::ID); - let is_discriminator_correct = dao.try_borrow_data().unwrap()[..8] == Dao::discriminator(); + let is_discriminator_correct = &dao.try_borrow_data().unwrap()[..8] == Dao::DISCRIMINATOR; require_eq!(is_discriminator_correct, true); const AFTER_REALLOC_SIZE: usize = Dao::MIGRATED_SIZE; @@ -97,7 +97,7 @@ impl ResizeDao<'_> { typed_proposals_enabled: false, }; - dao.realloc(AFTER_REALLOC_SIZE, true)?; + dao.resize(AFTER_REALLOC_SIZE)?; let lamports_needed = Rent::get()?.minimum_balance(AFTER_REALLOC_SIZE); diff --git a/programs/futarchy/src/instructions/resize_proposal.rs b/programs/futarchy/src/instructions/resize_proposal.rs index 9b9eef67b..17704531e 100644 --- a/programs/futarchy/src/instructions/resize_proposal.rs +++ b/programs/futarchy/src/instructions/resize_proposal.rs @@ -22,7 +22,7 @@ impl ResizeProposal<'_> { require_eq!(proposal.owner, &crate::ID); let is_discriminator_correct = - proposal.try_borrow_data().unwrap()[..8] == Proposal::discriminator(); + &proposal.try_borrow_data().unwrap()[..8] == Proposal::DISCRIMINATOR; require_eq!(is_discriminator_correct, true); const AFTER_REALLOC_SIZE: usize = Proposal::MIGRATED_SIZE; @@ -89,7 +89,7 @@ impl ResizeProposal<'_> { params_overridden: false, }; - proposal.realloc(AFTER_REALLOC_SIZE, true)?; + proposal.resize(AFTER_REALLOC_SIZE)?; let lamports_needed = Rent::get()?.minimum_balance(AFTER_REALLOC_SIZE); diff --git a/programs/futarchy/src/instructions/sync_spending_limit.rs b/programs/futarchy/src/instructions/sync_spending_limit.rs index fe66a02f4..f58028940 100644 --- a/programs/futarchy/src/instructions/sync_spending_limit.rs +++ b/programs/futarchy/src/instructions/sync_spending_limit.rs @@ -8,7 +8,7 @@ pub struct SyncSpendingLimit<'info> { #[account(mut, has_one = squads_multisig)] pub dao: Box>, #[account(mut)] - pub squads_multisig: Box>, + pub squads_multisig: Box>, /// CHECK: the Squads spending-limit PDA (`create_key` is always the DAO); may not exist #[account(mut, seeds = [squads_multisig_program::SEED_PREFIX, squads_multisig.key().as_ref(), squads_multisig_program::SEED_SPENDING_LIMIT, dao.key().as_ref()], bump, seeds::program = squads_program)] pub spending_limit: UncheckedAccount<'info>, diff --git a/programs/futarchy/src/instructions/typed_initialize.rs b/programs/futarchy/src/instructions/typed_initialize.rs index 8d618389f..d80285356 100644 --- a/programs/futarchy/src/instructions/typed_initialize.rs +++ b/programs/futarchy/src/instructions/typed_initialize.rs @@ -18,7 +18,7 @@ pub struct TypedInitializeAccounts<'info> { #[account(mut, has_one = squads_multisig)] pub dao: Box>, #[account(mut)] - pub squads_multisig: Box>, + pub squads_multisig: Box>, /// CHECK: empty on entry; the vault_transaction_create CPI initializes it /// and enforces that it is the transaction PDA for the next transaction index #[account(mut)] diff --git a/programs/futarchy/src/lib.rs b/programs/futarchy/src/lib.rs index 1ab15ee30..ad602c56d 100644 --- a/programs/futarchy/src/lib.rs +++ b/programs/futarchy/src/lib.rs @@ -6,12 +6,14 @@ use conditional_vault::{ConditionalVault, Question}; pub mod error; pub mod events; +pub mod foreign; pub mod instructions; pub mod squads; pub mod state; pub use error::FutarchyError; pub use events::*; +pub use foreign::*; pub use instructions::*; pub use squads::*; pub use state::*; diff --git a/programs/futarchy/src/squads.rs b/programs/futarchy/src/squads.rs index 96a009e42..241010703 100644 --- a/programs/futarchy/src/squads.rs +++ b/programs/futarchy/src/squads.rs @@ -1,5 +1,7 @@ use anchor_lang::prelude::*; -use anchor_lang::solana_program::address_lookup_table::{self, state::AddressLookupTable}; +use solana_address_lookup_table_interface::{ + self as address_lookup_table, state::AddressLookupTable, +}; use std::collections::BTreeMap; diff --git a/programs/gated_mint/Cargo.toml b/programs/gated_mint/Cargo.toml index 49145be28..2e8e549e6 100644 --- a/programs/gated_mint/Cargo.toml +++ b/programs/gated_mint/Cargo.toml @@ -13,12 +13,15 @@ no-entrypoint = [] no-idl = [] no-log-ix-name = [] cpi = ["no-entrypoint"] +idl-build = ["anchor-lang/idl-build", "anchor-spl/idl-build"] default = [] production = [] [dependencies] -anchor-lang = { version = "=0.29.0", features = ["init-if-needed", "event-cpi"] } -anchor-spl = "=0.29.0" -solana-program = "=1.17.14" -spl-token = "=4.0.0" +anchor-lang = { version = "=0.32.2", features = ["init-if-needed", "event-cpi"] } +anchor-spl = "=0.32.2" +spl-token = { version = "=8.0.0", features = ["no-entrypoint"] } solana-security-txt = "=1.1.1" + +[lints] +workspace = true diff --git a/programs/gated_mint/src/constants.rs b/programs/gated_mint/src/constants.rs index 49b9edd02..31174e3f5 100644 --- a/programs/gated_mint/src/constants.rs +++ b/programs/gated_mint/src/constants.rs @@ -1,5 +1,5 @@ use anchor_lang::prelude::Pubkey; -use anchor_lang::solana_program::pubkey; +use anchor_lang::solana_program::pubkey::pubkey; pub const WHITELISTED_PROGRAMS: &[Pubkey] = &[ pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"), diff --git a/programs/liquidation/Cargo.toml b/programs/liquidation/Cargo.toml index 4b400389c..10065432b 100644 --- a/programs/liquidation/Cargo.toml +++ b/programs/liquidation/Cargo.toml @@ -13,10 +13,14 @@ no-entrypoint = [] no-idl = [] no-log-ix-name = [] cpi = ["no-entrypoint"] +idl-build = ["anchor-lang/idl-build", "anchor-spl/idl-build"] default = [] production = [] [dependencies] -anchor-lang = { version = "=0.29.0", features = ["event-cpi", "init-if-needed"] } -anchor-spl = "=0.29.0" +anchor-lang = { version = "=0.32.2", features = ["event-cpi", "init-if-needed"] } +anchor-spl = "=0.32.2" solana-security-txt = "=1.1.1" + +[lints] +workspace = true diff --git a/programs/mint_governor/Cargo.toml b/programs/mint_governor/Cargo.toml index 59986a36d..bb265f7cc 100644 --- a/programs/mint_governor/Cargo.toml +++ b/programs/mint_governor/Cargo.toml @@ -13,10 +13,14 @@ no-entrypoint = [] no-idl = [] no-log-ix-name = [] cpi = ["no-entrypoint"] +idl-build = ["anchor-lang/idl-build", "anchor-spl/idl-build"] default = [] production = [] [dependencies] -anchor-lang = { version = "=0.29.0", features = ["init-if-needed", "event-cpi"] } -anchor-spl = "=0.29.0" +anchor-lang = { version = "=0.32.2", features = ["init-if-needed", "event-cpi"] } +anchor-spl = "=0.32.2" solana-security-txt = "=1.1.1" + +[lints] +workspace = true diff --git a/programs/performance_package_v2/Cargo.toml b/programs/performance_package_v2/Cargo.toml index ad3b14516..f9e6159ec 100644 --- a/programs/performance_package_v2/Cargo.toml +++ b/programs/performance_package_v2/Cargo.toml @@ -13,12 +13,21 @@ no-entrypoint = [] no-idl = [] no-log-ix-name = [] cpi = ["no-entrypoint"] +idl-build = [ + "anchor-lang/idl-build", + "anchor-spl/idl-build", + "mint_governor/idl-build", + "futarchy/idl-build", +] default = [] production = [] [dependencies] -anchor-lang = { version = "=0.29.0", features = ["init-if-needed", "event-cpi"] } -anchor-spl = "=0.29.0" +anchor-lang = { version = "=0.32.2", features = ["init-if-needed", "event-cpi"] } +anchor-spl = "=0.32.2" solana-security-txt = "=1.1.1" mint_governor = { path = "../mint_governor", features = ["cpi"] } futarchy = { path = "../futarchy", features = ["cpi"] } + +[lints] +workspace = true diff --git a/programs/performance_package_v2/src/constants.rs b/programs/performance_package_v2/src/constants.rs index 871f1a05e..ef6ead468 100644 --- a/programs/performance_package_v2/src/constants.rs +++ b/programs/performance_package_v2/src/constants.rs @@ -3,7 +3,6 @@ use anchor_lang::prelude::*; pub const PERFORMANCE_PACKAGE_SEED: &[u8] = b"performance_package"; pub const CHANGE_REQUEST_SEED: &[u8] = b"change_request"; -#[constant] pub const MAX_TRANCHES: usize = 10; #[constant] diff --git a/programs/performance_package_v2/src/instructions/close_performance_package.rs b/programs/performance_package_v2/src/instructions/close_performance_package.rs index 72e4856d7..fc2e78fd0 100644 --- a/programs/performance_package_v2/src/instructions/close_performance_package.rs +++ b/programs/performance_package_v2/src/instructions/close_performance_package.rs @@ -6,7 +6,7 @@ use crate::{ }; pub mod admin { - use anchor_lang::prelude::declare_id; + use anchor_lang::solana_program::pubkey::declare_id; // MetaDAO operational multisig declare_id!("6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf"); diff --git a/programs/price_based_performance_package/Cargo.toml b/programs/price_based_performance_package/Cargo.toml index abae9909b..22f1e31c1 100644 --- a/programs/price_based_performance_package/Cargo.toml +++ b/programs/price_based_performance_package/Cargo.toml @@ -13,11 +13,15 @@ no-entrypoint = [] no-idl = [] no-log-ix-name = [] cpi = ["no-entrypoint"] +idl-build = ["anchor-lang/idl-build", "anchor-spl/idl-build", "futarchy/idl-build"] default = [] production = [] [dependencies] -anchor-lang = { version = "=0.29.0", features = ["init-if-needed", "event-cpi"] } -anchor-spl = "=0.29.0" +anchor-lang = { version = "=0.32.2", features = ["init-if-needed", "event-cpi"] } +anchor-spl = "=0.32.2" futarchy = { path = "../futarchy", features = ["cpi"] } solana-security-txt = "=1.1.1" + +[lints] +workspace = true diff --git a/programs/price_based_performance_package/src/constants.rs b/programs/price_based_performance_package/src/constants.rs index f837e7165..dec2d180e 100644 --- a/programs/price_based_performance_package/src/constants.rs +++ b/programs/price_based_performance_package/src/constants.rs @@ -1,8 +1,7 @@ use anchor_lang::prelude::*; -#[constant] pub const MAX_TRANCHES: usize = 10; /// Scale of oracle prices: quote atoms per base atom, times 1e12 #[constant] -pub const PRICE_SCALE: u128 = 1_000_000_000_000; +pub const PRICE_SCALE: u128 = 1_000_000_000_000u128; diff --git a/programs/price_based_performance_package/src/instructions/burn_performance_package.rs b/programs/price_based_performance_package/src/instructions/burn_performance_package.rs index 36e6fe6cf..22feea077 100644 --- a/programs/price_based_performance_package/src/instructions/burn_performance_package.rs +++ b/programs/price_based_performance_package/src/instructions/burn_performance_package.rs @@ -4,7 +4,7 @@ use anchor_spl::token::{self, Burn, CloseAccount, Mint, Token, TokenAccount}; use super::*; pub mod admin { - use anchor_lang::prelude::declare_id; + use anchor_lang::solana_program::pubkey::declare_id; // MetaDAO multisig declare_id!("6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf"); diff --git a/programs/price_based_performance_package/src/instructions/resize_performance_package.rs b/programs/price_based_performance_package/src/instructions/resize_performance_package.rs index a1075731f..f799df055 100644 --- a/programs/price_based_performance_package/src/instructions/resize_performance_package.rs +++ b/programs/price_based_performance_package/src/instructions/resize_performance_package.rs @@ -24,7 +24,7 @@ impl ResizePerformancePackage<'_> { let data = self.performance_package.try_borrow_data()?; require_gte!(data.len(), 8, ErrorCode::AccountDiscriminatorNotFound); require!( - data[..8] == PerformancePackage::discriminator(), + &data[..8] == PerformancePackage::DISCRIMINATOR, ErrorCode::AccountDiscriminatorMismatch ); @@ -67,7 +67,7 @@ impl ResizePerformancePackage<'_> { last_change_proposed_at: 0, }; - performance_package.realloc(PerformancePackage::SIZE, true)?; + performance_package.resize(PerformancePackage::SIZE)?; let lamports_needed = Rent::get()?.minimum_balance(PerformancePackage::SIZE); if lamports_needed > performance_package.lamports() { diff --git a/programs/v06_launchpad/Cargo.toml b/programs/v06_launchpad/Cargo.toml index 6b56c8dfa..9a97087f0 100644 --- a/programs/v06_launchpad/Cargo.toml +++ b/programs/v06_launchpad/Cargo.toml @@ -13,20 +13,27 @@ no-entrypoint = [] no-idl = [] no-log-ix-name = [] cpi = ["no-entrypoint"] +idl-build = [ + "anchor-lang/idl-build", + "anchor-spl/idl-build", + "futarchy/idl-build", + "price_based_performance_package/idl-build", + "damm_v2_cpi/idl-build", + "squads-multisig-program/idl-build", +] default = ["custom-heap"] devnet = [] production = [] custom-heap = [] [dependencies] -anchor-lang = "=0.29.0" -anchor-spl = "=0.29.0" +anchor-lang = "=0.32.2" +anchor-spl = "=0.32.2" futarchy = { path = "../futarchy", features = ["cpi"] } price_based_performance_package = { path = "../price_based_performance_package", features = ["cpi"] } -spl-memo = "=4.0.0" -solana-program = "=1.17.14" -spl-token = "=4.0.0" -ahash = "=0.8.6" solana-security-txt = "=1.1.1" -squads-multisig-program = { git = "https://github.com/Squads-Protocol/v4", package = "squads-multisig-program", rev = "6d5235da621a2e9b7379ea358e48760e981053be", features = ["cpi"] } +squads-multisig-program = { git = "https://github.com/Squads-Protocol/v4", package = "squads-multisig-program", rev = "af94153ff77a28b6effe46b9c94baaa93742b48c", features = ["cpi"] } damm_v2_cpi = { path = "../damm_v2_cpi", features = ["cpi"] } + +[lints] +workspace = true diff --git a/programs/v06_launchpad/src/allocator.rs b/programs/v06_launchpad/src/allocator.rs index 88fdc88fb..57e6c3a4b 100644 --- a/programs/v06_launchpad/src/allocator.rs +++ b/programs/v06_launchpad/src/allocator.rs @@ -95,7 +95,7 @@ but with changes to its HEAP_LENGTH and its starting allocation address. */ -use solana_program::entrypoint::HEAP_START_ADDRESS; +use anchor_lang::solana_program::entrypoint::HEAP_START_ADDRESS; use std::{alloc::Layout, mem::size_of, ptr::null_mut}; /// Length of the memory region used for program heap. @@ -131,6 +131,6 @@ unsafe impl std::alloc::GlobalAlloc for BumpAllocator { } // Only use the allocator if we're not in a no-entrypoint context -#[cfg(not(feature = "no-entrypoint"))] +#[cfg(all(not(feature = "no-entrypoint"), target_os = "solana"))] #[global_allocator] static A: BumpAllocator = BumpAllocator; diff --git a/programs/v06_launchpad/src/instructions/return_funds.rs b/programs/v06_launchpad/src/instructions/return_funds.rs index 05483fe21..d7edf34eb 100644 --- a/programs/v06_launchpad/src/instructions/return_funds.rs +++ b/programs/v06_launchpad/src/instructions/return_funds.rs @@ -5,7 +5,7 @@ use crate::events::{CommonFields, LaunchFundsReturnedEvent}; use crate::state::Launch; pub mod admin { - use anchor_lang::prelude::declare_id; + use anchor_lang::solana_program::pubkey::declare_id; // MetaDAO multisig vault declare_id!("6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf"); diff --git a/programs/v06_launchpad/src/lib.rs b/programs/v06_launchpad/src/lib.rs index 25d29c896..b6305e706 100644 --- a/programs/v06_launchpad/src/lib.rs +++ b/programs/v06_launchpad/src/lib.rs @@ -40,7 +40,7 @@ pub const TOKENS_TO_DAMM_V2_LIQUIDITY_UNSCALED: u64 = 900_000; pub const MAX_PREMINE: u64 = 15_000_000 * TOKEN_SCALE; pub mod usdc_mint { - use anchor_lang::prelude::declare_id; + use anchor_lang::solana_program::pubkey::declare_id; #[cfg(feature = "devnet")] declare_id!("4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"); diff --git a/programs/v07_launchpad/Cargo.toml b/programs/v07_launchpad/Cargo.toml index a81326e89..ff85da18a 100644 --- a/programs/v07_launchpad/Cargo.toml +++ b/programs/v07_launchpad/Cargo.toml @@ -13,21 +13,29 @@ no-entrypoint = [] no-idl = [] no-log-ix-name = [] cpi = ["no-entrypoint"] +idl-build = [ + "anchor-lang/idl-build", + "anchor-spl/idl-build", + "futarchy/idl-build", + "price_based_performance_package/idl-build", + "damm_v2_cpi/idl-build", + "bid_wall/idl-build", + "squads-multisig-program/idl-build", +] default = ["custom-heap"] devnet = [] production = [] custom-heap = [] [dependencies] -anchor-lang = "=0.29.0" -anchor-spl = "=0.29.0" +anchor-lang = "=0.32.2" +anchor-spl = "=0.32.2" futarchy = { path = "../futarchy", features = ["cpi"] } price_based_performance_package = { path = "../price_based_performance_package", features = ["cpi"] } -spl-memo = "=4.0.0" -solana-program = "=1.17.14" -spl-token = "=4.0.0" -ahash = "=0.8.6" solana-security-txt = "=1.1.1" -squads-multisig-program = { git = "https://github.com/Squads-Protocol/v4", package = "squads-multisig-program", rev = "6d5235da621a2e9b7379ea358e48760e981053be", features = ["cpi"] } +squads-multisig-program = { git = "https://github.com/Squads-Protocol/v4", package = "squads-multisig-program", rev = "af94153ff77a28b6effe46b9c94baaa93742b48c", features = ["cpi"] } damm_v2_cpi = { path = "../damm_v2_cpi", features = ["cpi"] } -bid_wall = { path = "../bid_wall", features = ["cpi"] } \ No newline at end of file +bid_wall = { path = "../bid_wall", features = ["cpi"] } + +[lints] +workspace = true diff --git a/programs/v07_launchpad/src/allocator.rs b/programs/v07_launchpad/src/allocator.rs index 88fdc88fb..57e6c3a4b 100644 --- a/programs/v07_launchpad/src/allocator.rs +++ b/programs/v07_launchpad/src/allocator.rs @@ -95,7 +95,7 @@ but with changes to its HEAP_LENGTH and its starting allocation address. */ -use solana_program::entrypoint::HEAP_START_ADDRESS; +use anchor_lang::solana_program::entrypoint::HEAP_START_ADDRESS; use std::{alloc::Layout, mem::size_of, ptr::null_mut}; /// Length of the memory region used for program heap. @@ -131,6 +131,6 @@ unsafe impl std::alloc::GlobalAlloc for BumpAllocator { } // Only use the allocator if we're not in a no-entrypoint context -#[cfg(not(feature = "no-entrypoint"))] +#[cfg(all(not(feature = "no-entrypoint"), target_os = "solana"))] #[global_allocator] static A: BumpAllocator = BumpAllocator; diff --git a/programs/v07_launchpad/src/instructions/resize_funding_record.rs b/programs/v07_launchpad/src/instructions/resize_funding_record.rs index 2eb79a715..a019fce4e 100644 --- a/programs/v07_launchpad/src/instructions/resize_funding_record.rs +++ b/programs/v07_launchpad/src/instructions/resize_funding_record.rs @@ -22,7 +22,7 @@ impl ResizeFundingRecord<'_> { // Discriminator check let is_discriminator_correct = - funding_record.data.try_borrow_mut().unwrap()[..8] == FundingRecord::discriminator(); + &funding_record.data.try_borrow_mut().unwrap()[..8] == FundingRecord::DISCRIMINATOR; require_eq!(is_discriminator_correct, true); const AFTER_REALLOC_SIZE: usize = 8 + FundingRecord::INIT_SPACE; @@ -49,7 +49,7 @@ impl ResizeFundingRecord<'_> { last_accumulator_update: 0, }; - funding_record.realloc(AFTER_REALLOC_SIZE, true)?; + funding_record.resize(AFTER_REALLOC_SIZE)?; let lamports_needed = Rent::get()?.minimum_balance(AFTER_REALLOC_SIZE); diff --git a/programs/v07_launchpad/src/instructions/resize_launch.rs b/programs/v07_launchpad/src/instructions/resize_launch.rs index 98c31c85c..04900d46d 100644 --- a/programs/v07_launchpad/src/instructions/resize_launch.rs +++ b/programs/v07_launchpad/src/instructions/resize_launch.rs @@ -22,7 +22,7 @@ impl ResizeLaunch<'_> { // Discriminator check let is_discriminator_correct = - launch.data.try_borrow_mut().unwrap()[..8] == Launch::discriminator(); + &launch.data.try_borrow_mut().unwrap()[..8] == Launch::DISCRIMINATOR; require_eq!(is_discriminator_correct, true); const AFTER_REALLOC_SIZE: usize = 8 + Launch::INIT_SPACE; @@ -70,7 +70,7 @@ impl ResizeLaunch<'_> { has_bid_wall: false, }; - launch.realloc(AFTER_REALLOC_SIZE, true)?; + launch.resize(AFTER_REALLOC_SIZE)?; let lamports_needed = Rent::get()?.minimum_balance(AFTER_REALLOC_SIZE); diff --git a/programs/v07_launchpad/src/lib.rs b/programs/v07_launchpad/src/lib.rs index ccd3f3be5..e908a848a 100644 --- a/programs/v07_launchpad/src/lib.rs +++ b/programs/v07_launchpad/src/lib.rs @@ -41,7 +41,7 @@ pub const TOKENS_TO_DAMM_V2_LIQUIDITY_UNSCALED: u64 = 900_000; pub const PROPOSAL_MIN_STAKE_TOKENS: u64 = 1_500_000 * TOKEN_SCALE; pub mod usdc_mint { - use anchor_lang::prelude::declare_id; + use anchor_lang::solana_program::pubkey::declare_id; #[cfg(feature = "devnet")] declare_id!("4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"); @@ -51,7 +51,7 @@ pub mod usdc_mint { } pub mod metadao_multisig_vault { - use anchor_lang::prelude::declare_id; + use anchor_lang::solana_program::pubkey::declare_id; // MetaDAO operations multisig vault declare_id!("6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf"); diff --git a/programs/v08_launchpad/Cargo.toml b/programs/v08_launchpad/Cargo.toml index 56986c589..283ddcbf1 100644 --- a/programs/v08_launchpad/Cargo.toml +++ b/programs/v08_launchpad/Cargo.toml @@ -13,23 +13,33 @@ no-entrypoint = [] no-idl = [] no-log-ix-name = [] cpi = ["no-entrypoint"] +idl-build = [ + "anchor-lang/idl-build", + "anchor-spl/idl-build", + "futarchy/idl-build", + "performance_package_v2/idl-build", + "mint_governor/idl-build", + "damm_v2_cpi/idl-build", + "bid_wall/idl-build", + "gated_mint/idl-build", + "squads-multisig-program/idl-build", +] default = ["custom-heap"] devnet = [] production = [] custom-heap = [] [dependencies] -anchor-lang = { version = "=0.29.0", features = ["init-if-needed", "event-cpi"] } -anchor-spl = "=0.29.0" +anchor-lang = { version = "=0.32.2", features = ["init-if-needed", "event-cpi"] } +anchor-spl = "=0.32.2" futarchy = { path = "../futarchy", features = ["cpi"] } performance_package_v2 = { path = "../performance_package_v2", features = ["cpi"] } mint_governor = { path = "../mint_governor", features = ["cpi"] } -spl-memo = "=4.0.0" -solana-program = "=1.17.14" -spl-token = "=4.0.0" -ahash = "=0.8.6" solana-security-txt = "=1.1.1" -squads-multisig-program = { git = "https://github.com/Squads-Protocol/v4", package = "squads-multisig-program", rev = "6d5235da621a2e9b7379ea358e48760e981053be", features = ["cpi"] } +squads-multisig-program = { git = "https://github.com/Squads-Protocol/v4", package = "squads-multisig-program", rev = "af94153ff77a28b6effe46b9c94baaa93742b48c", features = ["cpi"] } damm_v2_cpi = { path = "../damm_v2_cpi", features = ["cpi"] } bid_wall = { path = "../bid_wall", features = ["cpi"] } gated_mint = { path = "../gated_mint", features = ["no-entrypoint"] } + +[lints] +workspace = true diff --git a/programs/v08_launchpad/src/allocator.rs b/programs/v08_launchpad/src/allocator.rs index 88fdc88fb..57e6c3a4b 100644 --- a/programs/v08_launchpad/src/allocator.rs +++ b/programs/v08_launchpad/src/allocator.rs @@ -95,7 +95,7 @@ but with changes to its HEAP_LENGTH and its starting allocation address. */ -use solana_program::entrypoint::HEAP_START_ADDRESS; +use anchor_lang::solana_program::entrypoint::HEAP_START_ADDRESS; use std::{alloc::Layout, mem::size_of, ptr::null_mut}; /// Length of the memory region used for program heap. @@ -131,6 +131,6 @@ unsafe impl std::alloc::GlobalAlloc for BumpAllocator { } // Only use the allocator if we're not in a no-entrypoint context -#[cfg(not(feature = "no-entrypoint"))] +#[cfg(all(not(feature = "no-entrypoint"), target_os = "solana"))] #[global_allocator] static A: BumpAllocator = BumpAllocator; diff --git a/programs/v08_launchpad/src/lib.rs b/programs/v08_launchpad/src/lib.rs index 273f4bca9..dc3b26f48 100644 --- a/programs/v08_launchpad/src/lib.rs +++ b/programs/v08_launchpad/src/lib.rs @@ -48,7 +48,7 @@ pub const PP_PRICE_MULTIPLIERS: [u128; 5] = [2, 4, 8, 16, 32]; pub const PP_TWAP_MIN_DURATION: u32 = 3 * 30 * 24 * 60 * 60; // 7_776_000 seconds pub mod usdc_mint { - use anchor_lang::prelude::declare_id; + use anchor_lang::solana_program::pubkey::declare_id; #[cfg(feature = "devnet")] declare_id!("4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"); @@ -58,7 +58,7 @@ pub mod usdc_mint { } pub mod metadao_multisig_vault { - use anchor_lang::prelude::declare_id; + use anchor_lang::solana_program::pubkey::declare_id; // MetaDAO operations multisig vault declare_id!("6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf"); diff --git a/rebuild.sh b/rebuild.sh index d4c4daab7..86392820a 100755 --- a/rebuild.sh +++ b/rebuild.sh @@ -1,11 +1,17 @@ -# rebuild.sh #!/bin/bash set -e + +# cargo-build-sbf 4.4.0 emits SBPFv3 by default; the cargo-installed copy must win over the one bundled with Agave 4.3.0. +export PATH="$HOME/.cargo/bin:$PATH" +[ "$(cargo build-sbf --version | head -1)" = "cargo-build-sbf 4.4.0" ] || + { echo "cargo-build-sbf 4.4.0 required: cargo install cargo-build-sbf --version 4.4.0 --locked"; exit 1; } + anchor build + cd sdk yarn install yarn build-local cd .. yarn install yarn lint:fix -echo "✅ rebuild complete" \ No newline at end of file +echo "✅ rebuild complete" diff --git a/run.sh b/run.sh index a67dd134e..47820b698 100755 --- a/run.sh +++ b/run.sh @@ -49,7 +49,7 @@ test_logs_no_build() { # ./test.sh build_verifiable autocrat build_verifiable() { PROGRAM_NAME=$1 - solana-verify build --library-name "$PROGRAM_NAME" -b ellipsislabs/solana:1.16.10 + solana-verify build --library-name "$PROGRAM_NAME" --arch v3 } deploy() { @@ -65,7 +65,7 @@ deploy_verifiable() { solana program deploy --use-rpc -u "$CLUSTER" --program-id ./target/deploy/"$PROGRAM_NAME"-keypair.json ./verifiable-builds/"$PROGRAM_NAME".so --with-compute-unit-price 5 --max-sign-attempts 15 && PROGRAM_ID=$(solana-keygen pubkey ./target/deploy/"$PROGRAM_NAME"-keypair.json) && anchor idl init --filepath ./target/idl/"$PROGRAM_NAME".json $PROGRAM_ID --provider.cluster "$CLUSTER" && - solana-verify verify-from-repo --remote -u "$CLUSTER" --program-id $PROGRAM_ID https://github.com/metaDAOproject/programs --library-name $PROGRAM_NAME -b ellipsislabs/solana:1.17.16 -y -- --features $FEATURES + solana-verify verify-from-repo --remote -u "$CLUSTER" --program-id $PROGRAM_ID https://github.com/metaDAOproject/programs --library-name $PROGRAM_NAME --arch v3 -y -- --features $FEATURES } verify() { @@ -73,7 +73,7 @@ verify() { PROGRAM_ID=$2 CLUSTER=$3 FEATURES=$4 - solana-verify verify-from-repo --remote -u "$CLUSTER" --program-id $PROGRAM_ID https://github.com/metaDAOproject/programs --library-name $PROGRAM_NAME -b ellipsislabs/solana:1.17.16 -y -- --features $FEATURES + solana-verify verify-from-repo --remote -u "$CLUSTER" --program-id $PROGRAM_ID https://github.com/metaDAOproject/programs --library-name $PROGRAM_NAME --arch v3 -y -- --features $FEATURES } assign_to_multisig() { @@ -92,14 +92,14 @@ export_verifiable() { PROGRAM_NAME=$1 PROGRAM_ID=$2 FEATURES=$3 - solana-verify export-pda-tx -um https://github.com/metaDAOproject/futarchy --program-id "$PROGRAM_ID" --uploader 6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf -b ellipsislabs/solana:1.17.31 --library-name "$PROGRAM_NAME" -- --features $FEATURES + solana-verify export-pda-tx -um https://github.com/metaDAOproject/futarchy --program-id "$PROGRAM_ID" --uploader 6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf --arch v3 --library-name "$PROGRAM_NAME" -- --features $FEATURES } verify_local() { PROGRAM_NAME=$1 PROGRAM_ID=$2 FEATURES=$3 - solana-verify verify-from-repo --remote -um --program-id $PROGRAM_ID https://github.com/metaDAOproject/futarchy --library-name $PROGRAM_NAME -b ellipsislabs/solana:1.17.31 -- --features $FEATURES + solana-verify verify-from-repo --remote -um --program-id $PROGRAM_ID https://github.com/metaDAOproject/futarchy --library-name $PROGRAM_NAME --arch v3 -- --features $FEATURES } # verify() { diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 000000000..63e7d322c --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,5 @@ +# The host compiler, the same rustc as inside platform-tools v1.57 (Agave 4.3.0). Bump it together with the Solana toolchain. +[toolchain] +channel = "1.95.0" +components = ["rustfmt", "clippy"] +profile = "minimal" diff --git a/scripts/repo-guard.ts b/scripts/repo-guard.ts index 5e300c344..592675d4c 100644 --- a/scripts/repo-guard.ts +++ b/scripts/repo-guard.ts @@ -8,21 +8,20 @@ // 1. Cargo manifests pin every external dep with `=x.y.z`. // 2. anchor-lang / anchor-spl versions across programs match the value // declared in repo-guard.toml [cargo] - no cross-program drift. -// 3. `solana-program` crate pin in launchpads must match the value in -// [cargo].solana_program_version. Distinct from any CLI version. -// 4. Anchor.toml [toolchain].solana_version must match +// 3. Anchor.toml [toolchain].solana_version must match // [toolchain].local_dev_solana_version. -// 5. Crates.io minimum age (scoped to PR-introduced version changes). -// 6. Yarn package.json files use exact versions (no ^, ~, ranges). -// 7. npm registry minimum age for new yarn pins. -// 8. anchor-version in every workflow is [toolchain].anchor_version. +// 4. Crates.io minimum age (scoped to PR-introduced version changes). +// 5. Yarn package.json files use exact versions (no ^, ~, ranges). +// 6. npm registry minimum age for new yarn pins. +// 7. anchor-version in every workflow is [toolchain].anchor_version. // solana-cli-version is checked per-file against -// [toolchain.workflow_solana_cli]. Workflows not in the map are -// assumed to read versions from Cargo.lock (e.g. reusable-build.yaml). -// 9. Every third-party GitHub Action is pinned to a SHA from the +// [toolchain.workflow_solana_cli]. Workflows not in the map either +// read versions from Anchor.toml (reusable-build.yaml) or build inside +// Docker (generate-verifiable-builds.yaml). +// 8. Every third-party GitHub Action is pinned to a SHA from the // [actions.sha_allowlist] in repo-guard.toml. actions/* (GitHub-owned) // are exempt. -// 10. Sensitive-diff heuristics (review-assist, not a merge gate): +// 9. Sensitive-diff heuristics (review-assist, not a merge gate): // changes to declare_id! literals, #[error_code] enums, Anchor.toml // [programs.*], or files listed in [sensitive_diff.files]. // @@ -44,7 +43,6 @@ type GuardConfig = { workflowSolanaCli: Map; anchorLangVersion: string; anchorSplVersion: string; - solanaProgramVersion: string; packageMinAgeDays: number; actionShaAllowlist: Map>; sensitiveFiles: Set; @@ -286,7 +284,6 @@ function loadConfig(): GuardConfig { workflowSolanaCli, anchorLangVersion: requireString("cargo", "anchor_lang_version"), anchorSplVersion: requireString("cargo", "anchor_spl_version"), - solanaProgramVersion: requireString("cargo", "solana_program_version"), packageMinAgeDays: requireNumber("cargo", "package_min_age_days"), actionShaAllowlist: allowlist, sensitiveFiles, @@ -909,9 +906,10 @@ function checkWorkflowToolchain(config: GuardConfig): { for (const file of files) { const lines = readFileSync(join(ROOT, file), "utf8").split("\n"); - // Per-file expected Solana CLI version. Workflows not in the map are - // dynamic (e.g. reusable-build.yaml reads from Cargo.lock) - we don't - // enforce a value for those. + // Per-file expected Solana CLI version. Workflows not in the map either + // read versions from Anchor.toml (reusable-build.yaml) or build inside + // Docker (generate-verifiable-builds.yaml) - we don't enforce a value + // for those. const expectedSolana = config.workflowSolanaCli.get(file); for (let i = 0; i < lines.length; i += 1) { @@ -955,54 +953,10 @@ function checkWorkflowToolchain(config: GuardConfig): { }; } -// `solana-program` crate pin in launchpads. Must match -// [cargo].solana_program_version exactly across every program that -// declares it. Programs that don't declare `solana-program` rely on -// anchor-lang's transitive dep - not our concern here. -function checkSolanaProgramCrate(config: GuardConfig): { - status: CheckStatus; - violations: Array<{ - file: string; - line: number; - spec: string; - expected: string; - }>; -} { - const files = walkCargoToml(join(ROOT, "programs"), []); - const violations: Array<{ - file: string; - line: number; - spec: string; - expected: string; - }> = []; - - for (const file of files) { - const deps = parseCargoToml(file); - for (const dep of deps) { - if (dep.name !== "solana-program") continue; - if (!dep.spec) continue; - const version = dep.spec.replace(/^=/, ""); - if (version !== config.solanaProgramVersion) { - violations.push({ - file, - line: dep.line, - spec: dep.spec, - expected: `=${config.solanaProgramVersion}`, - }); - } - } - } - - return { - status: violations.length === 0 ? "pass" : "fail", - violations, - }; -} - // Anchor.toml [toolchain].solana_version is what `anchor test` auto-installs -// on a local-dev machine. CI workflows don't read it (they pass -// solana-cli-version explicitly), but we still lock it down so the value -// stays predictable. +// on a local-dev machine and what reusable-build.yaml installs through +// extract-versions. The other CI workflows pass solana-cli-version +// explicitly, so we lock the value down to keep every path on one version. function checkAnchorTomlSolanaVersion(config: GuardConfig): { status: CheckStatus; actual: string | null; @@ -1340,25 +1294,6 @@ function renderWorkflowToolchain( return lines; } -function renderSolanaProgramCrate( - r: ReturnType, - config: GuardConfig, -): string[] { - const lines = renderHeader("solana-program crate pin", r.status); - if (r.status === "pass") { - lines.push( - `- Every \`solana-program = "=X"\` declaration is \`=${config.solanaProgramVersion}\` (locked to match \`Cargo.lock\`).`, - ); - return lines; - } - for (const v of r.violations) { - lines.push( - `- ${fmtPath(v.file)}:${v.line} has \`solana-program = "${v.spec}"\`, expected \`${v.expected}\``, - ); - } - return lines; -} - function renderAnchorTomlSolanaVersion( r: ReturnType, ): string[] { @@ -1430,7 +1365,6 @@ async function main() { const cargoPinning = checkCargoExactPinning(config); const crossProgram = checkCrossProgramConsistency(config); - const solanaProgramCrate = checkSolanaProgramCrate(config); const anchorTomlSolana = checkAnchorTomlSolanaVersion(config); const crateAge = await checkCrateAge(config, cargoPinning.exactDependencies); const npmPinning = checkPackageJsonPinning(); @@ -1442,7 +1376,6 @@ async function main() { const overallFailed = cargoPinning.status === "fail" || crossProgram.status === "fail" || - solanaProgramCrate.status === "fail" || anchorTomlSolana.status === "fail" || crateAge.status === "fail" || npmPinning.status === "fail" || @@ -1457,8 +1390,6 @@ async function main() { "", ...renderCrossProgram(crossProgram), "", - ...renderSolanaProgramCrate(solanaProgramCrate, config), - "", ...renderAnchorTomlSolanaVersion(anchorTomlSolana), "", ...renderCrateAge(crateAge, config), @@ -1514,11 +1445,6 @@ async function main() { ); } } - for (const v of solanaProgramCrate.violations) { - console.error( - `::error file=${v.file},line=${v.line}::solana-program = "${v.spec}", expected "${v.expected}"`, - ); - } if (anchorTomlSolana.status === "fail") { console.error( `::error file=Anchor.toml::solana_version = "${anchorTomlSolana.actual ?? "(missing)"}", expected "${anchorTomlSolana.expected}"`, diff --git a/scripts/setupFutarchyAmm.ts b/scripts/setupFutarchyAmm.ts index eb0138491..49e2230fb 100644 --- a/scripts/setupFutarchyAmm.ts +++ b/scripts/setupFutarchyAmm.ts @@ -1,6 +1,6 @@ // @ts-nocheck // Legacy script -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { AutocratClient, getDaoAddr } from "@metadaoproject/programs/v0.6"; import { Keypair, PublicKey } from "@solana/web3.js"; import BN from "bn.js"; @@ -120,7 +120,7 @@ async function main() { await autocratClient.autocrat.methods .initializeFutarchyAmm() - .accounts({ + .accountsPartial({ futarchyAmm, createKey: payer.publicKey, payer: payer.publicKey, @@ -159,7 +159,7 @@ async function main() { maxBaseAmount: new BN(100_000 * 1_000_000), // 100,000 META equivalent minLiquidity: new BN(0), }) - .accounts({ + .accountsPartial({ futarchyAmm, payer: payer.publicKey, ammBaseVault: token.getAssociatedTokenAddressSync( diff --git a/scripts/utils/adminApproval.ts b/scripts/utils/adminApproval.ts index 11abc5f74..360d8274e 100644 --- a/scripts/utils/adminApproval.ts +++ b/scripts/utils/adminApproval.ts @@ -1,4 +1,4 @@ -import { AnchorProvider } from "@coral-xyz/anchor"; +import { AnchorProvider } from "@anchor-lang/core"; import * as multisig from "@sqds/multisig"; import BN from "bn.js"; import { @@ -144,7 +144,7 @@ export const buildAdminApprovalTransactions = async ({ .adminEnqueueMultisigProposalApproval({ transactionIndex: new BN(daoTransactionIndex.toString()), }) - .accounts({ + .accountsPartial({ dao, admin: METADAO_MULTISIG_VAULT, squadsMultisig: daoMultisig, diff --git a/scripts/utils/daoActions.ts b/scripts/utils/daoActions.ts index c4b3c033a..d97a8d175 100644 --- a/scripts/utils/daoActions.ts +++ b/scripts/utils/daoActions.ts @@ -1,4 +1,4 @@ -import { AnchorProvider } from "@coral-xyz/anchor"; +import { AnchorProvider } from "@anchor-lang/core"; import * as multisig from "@sqds/multisig"; import BN from "bn.js"; import { @@ -161,7 +161,7 @@ const withdrawLiquidityAction = async ( minBaseAmount, minQuoteAmount, }) - .accounts({ + .accountsPartial({ dao, positionAuthority: daoMultisigVault, liquidityProviderBaseAccount: vaultBaseTokenAccount, @@ -876,7 +876,7 @@ export const proposePerformancePackageUnlockTerms = proposer: daoMultisigVault, }) // The vault pays the rent; otherwise the payer defaults to the wallet - .accounts({ payer: daoMultisigVault }) + .accountsPartial({ payer: daoMultisigVault }) .instruction(), ], }; diff --git a/scripts/utils/futarchyProposal.ts b/scripts/utils/futarchyProposal.ts index 8d9a89f14..d139c0dea 100644 --- a/scripts/utils/futarchyProposal.ts +++ b/scripts/utils/futarchyProposal.ts @@ -1,4 +1,4 @@ -import { AnchorProvider } from "@coral-xyz/anchor"; +import { AnchorProvider } from "@anchor-lang/core"; import * as multisig from "@sqds/multisig"; import { sha256 } from "@noble/hashes/sha256"; import { diff --git a/scripts/utils/transactions.ts b/scripts/utils/transactions.ts index 6e8ade831..103352195 100644 --- a/scripts/utils/transactions.ts +++ b/scripts/utils/transactions.ts @@ -1,4 +1,4 @@ -import { AnchorProvider } from "@coral-xyz/anchor"; +import { AnchorProvider } from "@anchor-lang/core"; import bs58 from "bs58"; import { Keypair, SendTransactionError, Transaction } from "@solana/web3.js"; diff --git a/scripts/v0.3/crankTwap.ts b/scripts/v0.3/crankTwap.ts index eba1ee94d..f917c5983 100644 --- a/scripts/v0.3/crankTwap.ts +++ b/scripts/v0.3/crankTwap.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { AmmClient } from "@metadaoproject/programs/amm/v0.3"; import { AutocratClient } from "@metadaoproject/programs/autocrat/v0.3"; import { PublicKey } from "@solana/web3.js"; diff --git a/scripts/v0.3/finalizeProposal.ts b/scripts/v0.3/finalizeProposal.ts index c3f22a64b..526dca29e 100644 --- a/scripts/v0.3/finalizeProposal.ts +++ b/scripts/v0.3/finalizeProposal.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; 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 3c1a94650..cd6afa465 100644 --- a/scripts/v0.3/initializeDao.ts +++ b/scripts/v0.3/initializeDao.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { AutocratClient } from "@metadaoproject/programs/autocrat/v0.3"; import { DEAN_DEVNET, diff --git a/scripts/v0.3/initializeProposal.ts b/scripts/v0.3/initializeProposal.ts index 6358c36c3..682c72a98 100644 --- a/scripts/v0.3/initializeProposal.ts +++ b/scripts/v0.3/initializeProposal.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { MEMO_PROGRAM_ID } from "@solana/spl-memo"; import * as token from "@solana/spl-token"; import { LAMPORTS_PER_SOL } from "@solana/web3.js"; diff --git a/scripts/v0.3/initializeVault.ts b/scripts/v0.3/initializeVault.ts index de578e1d4..5f800a5b7 100644 --- a/scripts/v0.3/initializeVault.ts +++ b/scripts/v0.3/initializeVault.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import * as token from "@solana/spl-token"; const { PublicKey, Keypair, SystemProgram } = anchor.web3; const { BN, Program } = anchor; @@ -61,7 +61,7 @@ async function main() { await vaultProgram.vaultProgram.methods .initializeConditionalVault({ settlementAuthority }) - .accounts({ + .accountsPartial({ vault, underlyingTokenMint, vaultUnderlyingTokenAccount, diff --git a/scripts/v0.3/main.ts b/scripts/v0.3/main.ts index ecc80852f..7a9587dc2 100644 --- a/scripts/v0.3/main.ts +++ b/scripts/v0.3/main.ts @@ -1,6 +1,6 @@ // @ts-nocheck // Legacy script -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import * as token from "@solana/spl-token"; const { BN, Program } = anchor; import { MPL_TOKEN_METADATA_PROGRAM_ID as UMI_MPL_TOKEN_METADATA_PROGRAM_ID } from "@metaplex-foundation/mpl-token-metadata"; @@ -91,21 +91,18 @@ anchor.setProvider(provider); export const payer = provider.wallet["payer"]; export const autocratProgram = new Program( - AutocratIDL, - AUTOCRAT_PROGRAM_ID, + { ...AutocratIDL, address: AUTOCRAT_PROGRAM_ID.toBase58() }, provider, ); export const vaultProgram = new Program( - ConditionalVaultIDL, - CONDITIONAL_VAULT_PROGRAM_ID, + { ...ConditionalVaultIDL, address: CONDITIONAL_VAULT_PROGRAM_ID.toBase58() }, provider, ); export const openbook = new OpenBookV2Client(provider); export const openbookTwap = new Program( - OpenbookTwapIDL, - OPENBOOK_TWAP_PROGRAM_ID, + { ...OpenbookTwapIDL, address: OPENBOOK_TWAP_PROGRAM_ID.toBase58() }, provider, ); @@ -197,7 +194,7 @@ async function generateAddMetadataToConditionalTokensIx( passTokenMetadataUri, failTokenMetadataUri, ) - .accounts({ + .accountsPartial({ payer: payer.publicKey, vault, underlyingTokenMint: mint, @@ -254,7 +251,7 @@ async function initializeVault( const initializeConditionalVaultBuilder = vaultProgram.methods .initializeConditionalVault(settlementAuthority, nonce) - .accounts({ + .accountsPartial({ vault, underlyingTokenMint, vaultUnderlyingTokenAccount, @@ -302,7 +299,7 @@ async function initializeVault( // export async function initializeDAO(META: any, USDC: any) { // await autocratProgram.methods // .initializeDao() -// .accounts({ +// .accountsPartial({ // dao, // metaMint: META, // usdcMint: USDC, @@ -351,7 +348,7 @@ export async function fetchDao() { // const ix = await migrator.methods // .multiTransfer2() -// .accounts({ +// .accountsPartial({ // authority: daoTreasury, // from0: treasuryMetaAccount.address, // to0: newTreasuryMetaAccount.address, @@ -369,7 +366,7 @@ export async function fetchDao() { // let tx = await autocratProgram.methods // .finalizeProposal() -// .accounts({ +// .accountsPartial({ // proposal, // openbookTwapPassMarket: storedProposal.openbookTwapPassMarket, // openbookTwapFailMarket: storedProposal.openbookTwapFailMarket, @@ -542,14 +539,14 @@ export async function initializeProposal( ), await openbookTwap.methods .createTwapMarket(new BN(10_000), maxObservationChangePerUpdateLots) - .accounts({ + .accountsPartial({ market: openbookPassMarketKP.publicKey, twapMarket: openbookTwapPassMarket, }) .instruction(), await openbookTwap.methods .createTwapMarket(new BN(10_000), maxObservationChangePerUpdateLots) - .accounts({ + .accountsPartial({ market: openbookFailMarketKP.publicKey, twapMarket: openbookTwapFailMarket, }) @@ -557,7 +554,7 @@ export async function initializeProposal( cuPriceIx, cuLimitIx, ]) - .accounts({ + .accountsPartial({ proposal: proposalKeypair.publicKey, dao, daoTreasury, @@ -628,7 +625,7 @@ async function placeOrdersOnBothSides(twapMarket: any) { await openbookTwap.methods .placeOrder(buyArgs) - .accounts({ + .accountsPartial({ asks: storedMarket.asks, bids: storedMarket.bids, marketVault: storedMarket.marketQuoteVault, @@ -643,7 +640,7 @@ async function placeOrdersOnBothSides(twapMarket: any) { await openbookTwap.methods .placeOrder(sellArgs) - .accounts({ + .accountsPartial({ asks: storedMarket.asks, bids: storedMarket.bids, marketVault: storedMarket.marketBaseVault, @@ -699,7 +696,7 @@ async function placeTakeOrder(twapMarket: any) { let tx = await openbookTwap.methods .placeTakeOrder(buyArgs) - .accounts({ + .accountsPartial({ asks: storedMarket.asks, bids: storedMarket.bids, eventHeap: storedMarket.eventHeap, @@ -773,7 +770,7 @@ export async function mintConditionalTokens(amount: number, vault: PublicKey) { // Mint conditional tokens await vaultProgram.methods .mintConditionalTokens(bnAmount) - .accounts({ + .accountsPartial({ authority: payer.publicKey, vault, vaultUnderlyingTokenAccount, diff --git a/scripts/v0.3/sendTokens.ts b/scripts/v0.3/sendTokens.ts index 20c808441..2bbfb34e8 100644 --- a/scripts/v0.3/sendTokens.ts +++ b/scripts/v0.3/sendTokens.ts @@ -1,6 +1,6 @@ import * as token from "@solana/spl-token"; import { PublicKey } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; const mints: PublicKey[] = [ new PublicKey("Et9wvs9gEBQtFY2RkvLw2XVLaBqjotHPvQBDvqkKxDR8"), // ORE diff --git a/scripts/v0.3/uploadMetadata.ts b/scripts/v0.3/uploadMetadata.ts index 7595de907..c85da9335 100644 --- a/scripts/v0.3/uploadMetadata.ts +++ b/scripts/v0.3/uploadMetadata.ts @@ -1,5 +1,5 @@ import { PublicKey } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { ConditionalVaultClient } from "@metadaoproject/programs/conditional_vault/v0.3"; import { AutocratClient } from "@metadaoproject/programs/autocrat/v0.3"; diff --git a/scripts/v0.3/uploadOffchainMetadata.ts b/scripts/v0.3/uploadOffchainMetadata.ts index 209839bf5..4668a478b 100644 --- a/scripts/v0.3/uploadOffchainMetadata.ts +++ b/scripts/v0.3/uploadOffchainMetadata.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { Metadata, deserializeMetadata, @@ -12,6 +12,7 @@ import { signerIdentity, } from "@metaplex-foundation/umi"; import { + fromWeb3JsKeypair, fromWeb3JsPublicKey, toWeb3JsPublicKey, } from "@metaplex-foundation/umi-web3js-adapters"; @@ -34,7 +35,7 @@ anchor.setProvider(provider); const payer = provider.wallet["payer"]; const umi = createUmi(provider.connection); -umi.use(keypairIdentity(payer)); +umi.use(keypairIdentity(fromWeb3JsKeypair(payer))); type AcceptedVaultTokens = "META" | "USDC"; type ConditionalToken = "pMETA" | "fMETA" | "pUSDC" | "fUSDC"; diff --git a/scripts/v0.4/claimAllLaunch.ts b/scripts/v0.4/claimAllLaunch.ts index 0c34db005..bbf938d90 100644 --- a/scripts/v0.4/claimAllLaunch.ts +++ b/scripts/v0.4/claimAllLaunch.ts @@ -4,7 +4,7 @@ import { Transaction, PublicKey, } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.4"; import { AutocratClient } from "@metadaoproject/programs/autocrat/v0.4"; import { homedir } from "os"; diff --git a/scripts/v0.4/finalizeLaunch.ts b/scripts/v0.4/finalizeLaunch.ts index 245d9fa6d..a01e0c522 100644 --- a/scripts/v0.4/finalizeLaunch.ts +++ b/scripts/v0.4/finalizeLaunch.ts @@ -4,7 +4,7 @@ import { Transaction, PublicKey, } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.4"; import { homedir } from "os"; import { join } from "path"; diff --git a/scripts/v0.4/initializeDao.ts b/scripts/v0.4/initializeDao.ts index b86072286..c05bf494d 100644 --- a/scripts/v0.4/initializeDao.ts +++ b/scripts/v0.4/initializeDao.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { Keypair } from "@solana/web3.js"; import { AutocratClient } from "@metadaoproject/programs/autocrat/v0.4"; import * as token from "@solana/spl-token"; diff --git a/scripts/v0.4/initializeLaunch.ts b/scripts/v0.4/initializeLaunch.ts index 2baf32fb0..b59ada896 100644 --- a/scripts/v0.4/initializeLaunch.ts +++ b/scripts/v0.4/initializeLaunch.ts @@ -1,6 +1,6 @@ import * as token from "@solana/spl-token"; import { ComputeBudgetProgram, Keypair, Transaction } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { getLaunchAddr, getLaunchSignerAddr, diff --git a/scripts/v0.4/initializeMetricMarket.ts b/scripts/v0.4/initializeMetricMarket.ts index aff33bbd3..0cb04d09e 100644 --- a/scripts/v0.4/initializeMetricMarket.ts +++ b/scripts/v0.4/initializeMetricMarket.ts @@ -1,6 +1,6 @@ import * as token from "@solana/spl-token"; import { PublicKey, Transaction } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { ConditionalVault, ConditionalVaultClient, diff --git a/scripts/v0.4/initializeProposal.ts b/scripts/v0.4/initializeProposal.ts index e0dabff53..355e8712d 100644 --- a/scripts/v0.4/initializeProposal.ts +++ b/scripts/v0.4/initializeProposal.ts @@ -1,12 +1,8 @@ import * as token from "@solana/spl-token"; import { PublicKey } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; -import { - AutocratClient, - AutocratIDL, -} from "@metadaoproject/programs/autocrat/v0.4"; +import * as anchor from "@anchor-lang/core"; +import { AutocratClient } 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 @@ -59,34 +55,22 @@ async function main() { return; } - const autocrat = new anchor.Program( - AutocratIDL, - AUTOCRAT_V0_4_PROGRAM_ID, - provider, - ); - - const accounts = [ - { - pubkey: dao, - isSigner: true, - isWritable: true, - }, - ]; - - const data = autocrat.coder.instruction.encode("update_dao", { - daoParams: { + const updateDaoIx = await autocratProgram.autocrat.methods + .updateDao({ passThresholdBps: 500, - baseBurnLamports: null, - burnDecayPerSlotLamports: null, slotsPerProposal: null, - marketTakerFee: null, - }, - }); + twapInitialObservation: null, + twapMaxObservationChangePerUpdate: null, + minQuoteFutarchicLiquidity: null, + minBaseFutarchicLiquidity: null, + }) + .accountsPartial({ dao, treasury: storedDao.treasury }) + .instruction(); const ix = { - programId: autocratProgram.getProgramId(), - accounts, - data, + programId: updateDaoIx.programId, + accounts: updateDaoIx.keys, + data: updateDaoIx.data, }; // Initialize the proposal diff --git a/scripts/v0.4/startLaunch.ts b/scripts/v0.4/startLaunch.ts index 5c432a65d..ef938b8b4 100644 --- a/scripts/v0.4/startLaunch.ts +++ b/scripts/v0.4/startLaunch.ts @@ -1,5 +1,5 @@ import { Keypair, PublicKey, Transaction } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.4"; import { homedir } from "os"; import { join } from "path"; diff --git a/scripts/v0.4/uploadMetadata.ts b/scripts/v0.4/uploadMetadata.ts index cbe525bd1..a7725b7c3 100644 --- a/scripts/v0.4/uploadMetadata.ts +++ b/scripts/v0.4/uploadMetadata.ts @@ -1,5 +1,5 @@ import { ComputeBudgetProgram, PublicKey, Transaction } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { ConditionalVaultClient } from "@metadaoproject/programs/conditional_vault/v0.4"; import { AutocratClient } from "@metadaoproject/programs/autocrat/v0.4"; diff --git a/scripts/v0.5/assignPermissionlessAccount.ts b/scripts/v0.5/assignPermissionlessAccount.ts index 3d1b81144..96de008db 100644 --- a/scripts/v0.5/assignPermissionlessAccount.ts +++ b/scripts/v0.5/assignPermissionlessAccount.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { SystemProgram, Transaction } from "@solana/web3.js"; import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/programs"; import { AutocratClient } from "@metadaoproject/programs/autocrat/v0.5"; diff --git a/scripts/v0.5/claimAllLaunch.ts b/scripts/v0.5/claimAllLaunch.ts index 76253c06f..1ddbf4583 100644 --- a/scripts/v0.5/claimAllLaunch.ts +++ b/scripts/v0.5/claimAllLaunch.ts @@ -4,7 +4,7 @@ import { Transaction, PublicKey, } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.4"; import { AutocratClient } from "@metadaoproject/programs/autocrat/v0.4"; import dotenv from "dotenv"; diff --git a/scripts/v0.5/executeProposal.ts b/scripts/v0.5/executeProposal.ts index 279482691..995a0c508 100644 --- a/scripts/v0.5/executeProposal.ts +++ b/scripts/v0.5/executeProposal.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { PERMISSIONLESS_ACCOUNT, DEVNET_SQUADS_PROGRAM_CONFIG_TREASURY, diff --git a/scripts/v0.5/finalizeLaunch.ts b/scripts/v0.5/finalizeLaunch.ts index a57989731..9b5fc5f6f 100644 --- a/scripts/v0.5/finalizeLaunch.ts +++ b/scripts/v0.5/finalizeLaunch.ts @@ -5,7 +5,7 @@ import { TransactionMessage, VersionedTransaction, } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.5"; import dotenv from "dotenv"; diff --git a/scripts/v0.5/initializeDao.ts b/scripts/v0.5/initializeDao.ts index 1a6bba95b..858c450dd 100644 --- a/scripts/v0.5/initializeDao.ts +++ b/scripts/v0.5/initializeDao.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { DEVNET_USDC, MAINNET_USDC, diff --git a/scripts/v0.5/initializeLaunch.ts b/scripts/v0.5/initializeLaunch.ts index 374ac8afc..309515160 100644 --- a/scripts/v0.5/initializeLaunch.ts +++ b/scripts/v0.5/initializeLaunch.ts @@ -1,5 +1,5 @@ import * as token from "@solana/spl-token"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { getLaunchAddr, getLaunchSignerAddr, diff --git a/scripts/v0.5/initializeProposal.ts b/scripts/v0.5/initializeProposal.ts index 9c9bce875..a596cf29a 100644 --- a/scripts/v0.5/initializeProposal.ts +++ b/scripts/v0.5/initializeProposal.ts @@ -18,7 +18,7 @@ import { VersionedTransaction, } from "@solana/web3.js"; import { BN } from "bn.js"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import * as multisig from "@sqds/multisig"; import { assert } from "chai"; import { getAssociatedTokenAddressSync } from "@solana/spl-token"; diff --git a/scripts/v0.5/migrateMeta.ts b/scripts/v0.5/migrateMeta.ts index 086b0cc8f..5d5f15061 100644 --- a/scripts/v0.5/migrateMeta.ts +++ b/scripts/v0.5/migrateMeta.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { PublicKey, SystemProgram, @@ -38,11 +38,16 @@ import { updateMetadataAccountV2, } from "@metaplex-foundation/mpl-token-metadata"; import { + createSignerFromKeypair, percentAmount, signerIdentity, publicKey as UmiPublicKey, } from "@metaplex-foundation/umi"; -import { toWeb3JsInstruction } from "@metaplex-foundation/umi-web3js-adapters"; +import { + fromWeb3JsKeypair, + fromWeb3JsPublicKey, + toWeb3JsInstruction, +} from "@metaplex-foundation/umi-web3js-adapters"; // Testing flag set to true to run it with seed. const MINT_FROM_SEED: boolean = true; @@ -360,7 +365,8 @@ const initializeNewDaoAndToken = async () => { const umi = createUmi(provider.connection); umi.use(mplTokenMetadata()); - umi.use(signerIdentity(payer.publicKey)); + const umiPayer = createSignerFromKeypair(umi, fromWeb3JsKeypair(payer)); + umi.use(signerIdentity(umiPayer)); const umiMint = UmiPublicKey(TOKEN.toBase58()); const umiUpdateAuthority = UmiPublicKey(squadsMultisigVault.toBase58()); // TODO: Confirm this. @@ -368,7 +374,7 @@ const initializeNewDaoAndToken = async () => { // Generate Umi instructions const umiInstructions = createV1(umi, { mint: umiMint, - updateAuthority: payer.publicKey, + updateAuthority: fromWeb3JsPublicKey(payer.publicKey), name: "MetaDAO", // TODO: Review this is correct. symbol: "META", // TODO: Review this is correct. uri: "https://raw.githubusercontent.com/metaDAOproject/futarchy/refs/heads/develop/scripts/assets/META/META.json", @@ -380,7 +386,7 @@ const initializeNewDaoAndToken = async () => { decimals: 6, tokenStandard: TokenStandard.Fungible, isMutable: true, // TODO: Review this is correct. - payer: payer.publicKey, + payer: umiPayer, }).getInstructions(); const asset = getMetadataAddr(TOKEN); diff --git a/scripts/v0.5/recoverProposalFunds.ts b/scripts/v0.5/recoverProposalFunds.ts index 705662680..2473a6d9e 100644 --- a/scripts/v0.5/recoverProposalFunds.ts +++ b/scripts/v0.5/recoverProposalFunds.ts @@ -7,7 +7,7 @@ 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"; +import * as anchor from "@anchor-lang/core"; import { getAssociatedTokenAddressSync } from "@solana/spl-token"; const provider = anchor.AnchorProvider.env(); diff --git a/scripts/v0.5/squads/executeProposal.ts b/scripts/v0.5/squads/executeProposal.ts index 8aa768bfb..683d0e6d7 100644 --- a/scripts/v0.5/squads/executeProposal.ts +++ b/scripts/v0.5/squads/executeProposal.ts @@ -1,6 +1,6 @@ import { PublicKey, Transaction } from "@solana/web3.js"; import * as multisig from "@sqds/multisig"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/programs/"; import { getSquadsPdasFromDao } from "../../utils/squads.js"; diff --git a/scripts/v0.5/squads/initalizeTransferProposal.ts b/scripts/v0.5/squads/initalizeTransferProposal.ts index f8c7af72d..50a58cea0 100644 --- a/scripts/v0.5/squads/initalizeTransferProposal.ts +++ b/scripts/v0.5/squads/initalizeTransferProposal.ts @@ -1,6 +1,6 @@ import { PublicKey, Transaction, TransactionMessage } from "@solana/web3.js"; import * as multisig from "@sqds/multisig"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/programs"; import { createTransferInstruction, diff --git a/scripts/v0.5/squads/removeSpendingLimit.ts b/scripts/v0.5/squads/removeSpendingLimit.ts index 1f9558d15..8ffbc9667 100644 --- a/scripts/v0.5/squads/removeSpendingLimit.ts +++ b/scripts/v0.5/squads/removeSpendingLimit.ts @@ -1,6 +1,6 @@ import { PublicKey, Transaction, TransactionMessage } from "@solana/web3.js"; import * as multisig from "@sqds/multisig"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/programs"; import { getSquadsPdasFromDao } from "../../utils/squads.js"; diff --git a/scripts/v0.5/squads/updateSpendingLimit.ts b/scripts/v0.5/squads/updateSpendingLimit.ts index b5cd59bf8..2e653f101 100644 --- a/scripts/v0.5/squads/updateSpendingLimit.ts +++ b/scripts/v0.5/squads/updateSpendingLimit.ts @@ -1,6 +1,6 @@ import { PublicKey, Transaction, TransactionMessage } from "@solana/web3.js"; import * as multisig from "@sqds/multisig"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { getAssociatedTokenAddress } from "@solana/spl-token"; import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/programs"; import { getSquadsPdasFromDao } from "../../utils/squads.js"; diff --git a/scripts/v0.5/squads/useSpendingLimit.ts b/scripts/v0.5/squads/useSpendingLimit.ts index d83579086..e8eb36f0b 100644 --- a/scripts/v0.5/squads/useSpendingLimit.ts +++ b/scripts/v0.5/squads/useSpendingLimit.ts @@ -1,6 +1,6 @@ import { PublicKey, Transaction } from "@solana/web3.js"; import * as multisig from "@sqds/multisig"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { createAssociatedTokenAccountIdempotentInstruction, getAssociatedTokenAddressSync, diff --git a/scripts/v0.5/startLaunch.ts b/scripts/v0.5/startLaunch.ts index 6deb23e21..1ef56f294 100644 --- a/scripts/v0.5/startLaunch.ts +++ b/scripts/v0.5/startLaunch.ts @@ -1,5 +1,5 @@ import { Keypair, PublicKey, Transaction } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.5"; import dotenv from "dotenv"; diff --git a/scripts/v0.6/adminExecuteMultisigProposal.ts b/scripts/v0.6/adminExecuteMultisigProposal.ts index 9031c4975..6c20d7777 100644 --- a/scripts/v0.6/adminExecuteMultisigProposal.ts +++ b/scripts/v0.6/adminExecuteMultisigProposal.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import * as multisig from "@sqds/multisig"; import BN from "bn.js"; import { @@ -88,7 +88,7 @@ async function main() { instructions.push( await futarchy.futarchy.methods .executeMultisigProposalApproval() - .accounts({ + .accountsPartial({ dao, rentReceiver: payer.publicKey, squadsMultisig: daoMultisig, @@ -117,7 +117,7 @@ async function main() { instructions.push( await futarchy.futarchy.methods .adminExecuteMultisigProposal() - .accounts({ + .accountsPartial({ dao, admin: payer.publicKey, squadsMultisig: daoMultisig, diff --git a/scripts/v0.6/burnPerformancePackage.ts b/scripts/v0.6/burnPerformancePackage.ts index 6ce9b236f..7d406daca 100644 --- a/scripts/v0.6/burnPerformancePackage.ts +++ b/scripts/v0.6/burnPerformancePackage.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import * as multisig from "@sqds/multisig"; import { PriceBasedPerformancePackageClient, @@ -71,7 +71,7 @@ export const burnPerformancePackage = async () => { const vaultTxCreateSignature = await multisig.rpc.vaultTransactionCreate({ connection: anchor.getProvider().connection, creator: payer.publicKey, - feePayer: payer.publicKey, + feePayer: payer, ephemeralSigners: 0, multisigPda: metadaoSquadsMultisig, transactionIndex: diff --git a/scripts/v0.6/claimAllLaunch.ts b/scripts/v0.6/claimAllLaunch.ts index 4865d04b3..f0894e1e4 100644 --- a/scripts/v0.6/claimAllLaunch.ts +++ b/scripts/v0.6/claimAllLaunch.ts @@ -4,7 +4,7 @@ import { Transaction, PublicKey, } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.6"; import dotenv from "dotenv"; diff --git a/scripts/v0.6/collectMeteoraDammFees.ts b/scripts/v0.6/collectMeteoraDammFees.ts index a04755f1a..912de80db 100644 --- a/scripts/v0.6/collectMeteoraDammFees.ts +++ b/scripts/v0.6/collectMeteoraDammFees.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import * as multisig from "@sqds/multisig"; import { CONDITIONAL_VAULT_V0_4_PROGRAM_ID, diff --git a/scripts/v0.6/createDao.ts b/scripts/v0.6/createDao.ts index d474c69dd..a4ab46640 100644 --- a/scripts/v0.6/createDao.ts +++ b/scripts/v0.6/createDao.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { FutarchyClient, getDaoAddr, diff --git a/scripts/v0.6/dumpDaos.ts b/scripts/v0.6/dumpDaos.ts index 6bc54e479..2df73a015 100644 --- a/scripts/v0.6/dumpDaos.ts +++ b/scripts/v0.6/dumpDaos.ts @@ -1,6 +1,9 @@ import { PublicKey } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; -import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; +import * as anchor from "@anchor-lang/core"; +import { + FutarchyClient, + FutarchyIDL, +} from "@metadaoproject/programs/futarchy/v0.6"; import dotenv from "dotenv"; import * as fs from "fs"; import * as path from "path"; @@ -12,7 +15,7 @@ const provider = anchor.AnchorProvider.env(); function getDiscriminator(accountName: string): Buffer { return Buffer.from( - anchor.BorshAccountsCoder.accountDiscriminator(accountName), + FutarchyIDL.accounts.find((a) => a.name === accountName)!.discriminator, ); } diff --git a/scripts/v0.6/dumpDaosProposals.ts b/scripts/v0.6/dumpDaosProposals.ts index a2c5e1b19..e4fb6337c 100644 --- a/scripts/v0.6/dumpDaosProposals.ts +++ b/scripts/v0.6/dumpDaosProposals.ts @@ -1,6 +1,9 @@ import { PublicKey } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; -import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; +import * as anchor from "@anchor-lang/core"; +import { + FutarchyClient, + FutarchyIDL, +} from "@metadaoproject/programs/futarchy/v0.6"; import dotenv from "dotenv"; import * as fs from "fs"; import * as path from "path"; @@ -14,7 +17,7 @@ const payer = provider.wallet["payer"]; // Calculate discriminator for an account type using Anchor's method function getDiscriminator(accountName: string): Buffer { return Buffer.from( - anchor.BorshAccountsCoder.accountDiscriminator(accountName), + FutarchyIDL.accounts.find((a) => a.name === accountName)!.discriminator, ); } diff --git a/scripts/v0.6/enqueueTemplate.ts b/scripts/v0.6/enqueueTemplate.ts index 9b91f2ba2..3e705919c 100644 --- a/scripts/v0.6/enqueueTemplate.ts +++ b/scripts/v0.6/enqueueTemplate.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import BN from "bn.js"; import { PublicKey } from "@solana/web3.js"; import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; diff --git a/scripts/v0.6/executeGeneralProposal.ts b/scripts/v0.6/executeGeneralProposal.ts index 27720dcad..27708d877 100644 --- a/scripts/v0.6/executeGeneralProposal.ts +++ b/scripts/v0.6/executeGeneralProposal.ts @@ -5,7 +5,7 @@ import { VersionedTransaction, } from "@solana/web3.js"; import * as multisig from "@sqds/multisig"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/programs"; diff --git a/scripts/v0.6/finalizeLaunch.ts b/scripts/v0.6/finalizeLaunch.ts index a28d4cac9..6d0c364b6 100644 --- a/scripts/v0.6/finalizeLaunch.ts +++ b/scripts/v0.6/finalizeLaunch.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient, getLaunchAddr, diff --git a/scripts/v0.6/finalizeProposal.ts b/scripts/v0.6/finalizeProposal.ts index 46f7ffa42..747543cea 100644 --- a/scripts/v0.6/finalizeProposal.ts +++ b/scripts/v0.6/finalizeProposal.ts @@ -1,7 +1,7 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; import { PublicKey, Transaction } from "@solana/web3.js"; -import { BN } from "@coral-xyz/anchor"; +import { BN } from "@anchor-lang/core"; const provider = anchor.AnchorProvider.env(); const payer = provider.wallet["payer"]; diff --git a/scripts/v0.6/initializeDao.ts b/scripts/v0.6/initializeDao.ts index 715047315..c11547cfa 100644 --- a/scripts/v0.6/initializeDao.ts +++ b/scripts/v0.6/initializeDao.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { FutarchyClient, getDaoAddr, diff --git a/scripts/v0.6/launch.ts b/scripts/v0.6/launch.ts index 9feaa7b84..d098a25f8 100644 --- a/scripts/v0.6/launch.ts +++ b/scripts/v0.6/launch.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient, getLaunchAddr, diff --git a/scripts/v0.6/launchLoyal.ts b/scripts/v0.6/launchLoyal.ts index ce3777d4f..1e15f7946 100644 --- a/scripts/v0.6/launchLoyal.ts +++ b/scripts/v0.6/launchLoyal.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient, getLaunchAddr, diff --git a/scripts/v0.6/launchPaystream.ts b/scripts/v0.6/launchPaystream.ts index 0c17ea44b..ecfd9a744 100644 --- a/scripts/v0.6/launchPaystream.ts +++ b/scripts/v0.6/launchPaystream.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient, getLaunchAddr, diff --git a/scripts/v0.6/launchSOLO.ts b/scripts/v0.6/launchSOLO.ts index 9240d83d6..4c3af6748 100644 --- a/scripts/v0.6/launchSOLO.ts +++ b/scripts/v0.6/launchSOLO.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient, getLaunchAddr, diff --git a/scripts/v0.6/launchZKLSOL.ts b/scripts/v0.6/launchZKLSOL.ts index 352bae72a..6a47c436d 100644 --- a/scripts/v0.6/launchZKLSOL.ts +++ b/scripts/v0.6/launchZKLSOL.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient, getLaunchAddr, diff --git a/scripts/v0.6/liquidationTemplate.ts b/scripts/v0.6/liquidationTemplate.ts index 872d546e5..a73b8a3d8 100644 --- a/scripts/v0.6/liquidationTemplate.ts +++ b/scripts/v0.6/liquidationTemplate.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { PublicKey } from "@solana/web3.js"; import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; import { METADAO_MULTISIG_VAULT } from "@metadaoproject/programs"; diff --git a/scripts/v0.6/migrateDaos.ts b/scripts/v0.6/migrateDaos.ts index ce578031b..bf6255ae0 100644 --- a/scripts/v0.6/migrateDaos.ts +++ b/scripts/v0.6/migrateDaos.ts @@ -5,8 +5,11 @@ import { VersionedTransaction, TransactionMessage, } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; -import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; +import * as anchor from "@anchor-lang/core"; +import { + FutarchyClient, + FutarchyIDL, +} from "@metadaoproject/programs/futarchy/v0.6"; import dotenv from "dotenv"; import bs58 from "bs58"; @@ -17,7 +20,7 @@ const payer = provider.wallet["payer"]; function getDiscriminator(accountName: string): Buffer { return Buffer.from( - anchor.BorshAccountsCoder.accountDiscriminator(accountName), + FutarchyIDL.accounts.find((a) => a.name === accountName)!.discriminator, ); } @@ -108,7 +111,7 @@ async function main() { batch.map(async ({ pubkey }) => { return await futarchy.futarchy.methods .resizeDao() - .accounts({ + .accountsPartial({ dao: pubkey, payer: payer.publicKey, }) diff --git a/scripts/v0.6/migrateDaosProposals.ts b/scripts/v0.6/migrateDaosProposals.ts index 39b4deb0b..b648c02e0 100644 --- a/scripts/v0.6/migrateDaosProposals.ts +++ b/scripts/v0.6/migrateDaosProposals.ts @@ -6,9 +6,10 @@ import { VersionedTransaction, TransactionMessage, } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { FutarchyClient, + FutarchyIDL, getSpendingLimitAddr, } from "@metadaoproject/programs/futarchy/v0.6"; import dotenv from "dotenv"; @@ -21,7 +22,7 @@ const payer = provider.wallet["payer"]; function getDiscriminator(accountName: string): Buffer { return Buffer.from( - anchor.BorshAccountsCoder.accountDiscriminator(accountName), + FutarchyIDL.accounts.find((a) => a.name === accountName)!.discriminator, ); } @@ -90,7 +91,7 @@ async function main() { batch.map(async ({ pubkey }) => { return await futarchy.futarchy.methods .resizeDao() - .accounts({ + .accountsPartial({ dao: pubkey, spendingLimit: getSpendingLimitAddr({ dao: pubkey })[0], payer: payer.publicKey, @@ -133,7 +134,7 @@ async function main() { batch.map(async ({ pubkey, account }) => { return await futarchy.futarchy.methods .resizeProposal() - .accounts({ + .accountsPartial({ proposal: pubkey, dao: getProposalDao(account.data), payer: payer.publicKey, diff --git a/scripts/v0.6/proposalTemplate.ts b/scripts/v0.6/proposalTemplate.ts index 9b37c0527..3b162902b 100644 --- a/scripts/v0.6/proposalTemplate.ts +++ b/scripts/v0.6/proposalTemplate.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import BN from "bn.js"; import { PublicKey } from "@solana/web3.js"; import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; diff --git a/scripts/v0.6/provideLiquidity.ts b/scripts/v0.6/provideLiquidity.ts index 2e340302a..44f9a9c01 100644 --- a/scripts/v0.6/provideLiquidity.ts +++ b/scripts/v0.6/provideLiquidity.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; import { MAINNET_USDC, DEVNET_USDC } from "@metadaoproject/programs"; import { PublicKey } from "@solana/web3.js"; diff --git a/scripts/v0.6/returnFunds.ts b/scripts/v0.6/returnFunds.ts index 73cf3968d..4ec873e5a 100644 --- a/scripts/v0.6/returnFunds.ts +++ b/scripts/v0.6/returnFunds.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import * as multisig from "@sqds/multisig"; import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.6"; import { MAINNET_USDC, METADAO_MULTISIG_VAULT } from "@metadaoproject/programs"; @@ -31,7 +31,7 @@ export const returnFunds = async () => { const returnFundsIx = await launchpad.launchpad.methods .returnFunds({ amount: REFUND_AMOUNT }) - .accounts({ + .accountsPartial({ launch: LAUNCH, recipient: REFUND_RECIPIENT, recipientQuoteAccount: getAssociatedTokenAddressSync( diff --git a/scripts/v0.6/sponsorProposal.ts b/scripts/v0.6/sponsorProposal.ts index a9cd583b9..b34e5ada9 100644 --- a/scripts/v0.6/sponsorProposal.ts +++ b/scripts/v0.6/sponsorProposal.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; import { PublicKey, TransactionMessage } from "@solana/web3.js"; import bs58 from "bs58"; diff --git a/scripts/v0.7/burnPerformancePackage.ts b/scripts/v0.7/burnPerformancePackage.ts index 2e9dafffb..d7396001c 100644 --- a/scripts/v0.7/burnPerformancePackage.ts +++ b/scripts/v0.7/burnPerformancePackage.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import * as multisig from "@sqds/multisig"; import { PRICE_BASED_PERFORMANCE_PACKAGE_PROGRAM_ID, @@ -69,7 +69,7 @@ export const burnPerformancePackage = async () => { const vaultTxCreateSignature = await multisig.rpc.vaultTransactionCreate({ connection: anchor.getProvider().connection, creator: payer.publicKey, - feePayer: payer.publicKey, + feePayer: payer, ephemeralSigners: 0, multisigPda: metadaoSquadsMultisig, transactionIndex: diff --git a/scripts/v0.7/claimAllLaunch.ts b/scripts/v0.7/claimAllLaunch.ts index de8d5c30c..f1f4bca39 100644 --- a/scripts/v0.7/claimAllLaunch.ts +++ b/scripts/v0.7/claimAllLaunch.ts @@ -4,7 +4,7 @@ import { Transaction, PublicKey, } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; import dotenv from "dotenv"; diff --git a/scripts/v0.7/claimLaunchAdditionalTokens.ts b/scripts/v0.7/claimLaunchAdditionalTokens.ts index e9f3cd87b..25d4a8e16 100644 --- a/scripts/v0.7/claimLaunchAdditionalTokens.ts +++ b/scripts/v0.7/claimLaunchAdditionalTokens.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; import { PublicKey } from "@solana/web3.js"; diff --git a/scripts/v0.7/closeLaunch.ts b/scripts/v0.7/closeLaunch.ts index 3ed7730a7..dcd8cee97 100644 --- a/scripts/v0.7/closeLaunch.ts +++ b/scripts/v0.7/closeLaunch.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; import { PublicKey } from "@solana/web3.js"; diff --git a/scripts/v0.7/collectAllFees.ts b/scripts/v0.7/collectAllFees.ts index 82704c1f8..98ffcebd5 100644 --- a/scripts/v0.7/collectAllFees.ts +++ b/scripts/v0.7/collectAllFees.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import * as multisig from "@sqds/multisig"; import { BidWallClient } from "@metadaoproject/programs/bid_wall/v0.7"; import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; diff --git a/scripts/v0.7/collectFees.ts b/scripts/v0.7/collectFees.ts index f185ff0e0..dbdaafe8d 100644 --- a/scripts/v0.7/collectFees.ts +++ b/scripts/v0.7/collectFees.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import * as multisig from "@sqds/multisig"; import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; import { @@ -59,7 +59,7 @@ export const collectFees = async () => { const vaultTxCreateSignature = await multisig.rpc.vaultTransactionCreate({ connection: anchor.getProvider().connection, creator: payer.publicKey, - feePayer: payer.publicKey, + feePayer: payer, ephemeralSigners: 0, multisigPda: metadaoSquadsMultisig, transactionIndex: diff --git a/scripts/v0.7/collectMeteoraDammFees.ts b/scripts/v0.7/collectMeteoraDammFees.ts index 2049a3bcd..48c6f07a3 100644 --- a/scripts/v0.7/collectMeteoraDammFees.ts +++ b/scripts/v0.7/collectMeteoraDammFees.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import * as multisig from "@sqds/multisig"; import { CONDITIONAL_VAULT_V0_4_PROGRAM_ID, diff --git a/scripts/v0.7/completeLaunch.ts b/scripts/v0.7/completeLaunch.ts index 677c4c2d7..a49cfda83 100644 --- a/scripts/v0.7/completeLaunch.ts +++ b/scripts/v0.7/completeLaunch.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; import { PublicKey, diff --git a/scripts/v0.7/credible/complete.ts b/scripts/v0.7/credible/complete.ts index c1a65aea5..3b3fda7d1 100644 --- a/scripts/v0.7/credible/complete.ts +++ b/scripts/v0.7/credible/complete.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient, getLaunchAddr, @@ -9,7 +9,6 @@ import { VersionedTransaction, } from "@solana/web3.js"; import { createLookupTableForTransaction } from "../../utils/utils.js"; -import { token } from "@coral-xyz/anchor/dist/cjs/utils/index.js"; import { TOKEN_SEED } from "./constants.js"; const provider = anchor.AnchorProvider.env(); @@ -23,7 +22,7 @@ export const completeLaunch = async () => { const TOKEN = await PublicKey.createWithSeed( payer.publicKey, TOKEN_SEED, - token.TOKEN_PROGRAM_ID, + anchor.utils.token.TOKEN_PROGRAM_ID, ); console.log("Token address:", TOKEN.toBase58()); diff --git a/scripts/v0.7/credible/end.ts b/scripts/v0.7/credible/end.ts index f78bb9b67..3af7f2c4a 100644 --- a/scripts/v0.7/credible/end.ts +++ b/scripts/v0.7/credible/end.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient, getLaunchAddr, diff --git a/scripts/v0.7/credible/initialize.ts b/scripts/v0.7/credible/initialize.ts index 9cc2f8a3c..06948940b 100644 --- a/scripts/v0.7/credible/initialize.ts +++ b/scripts/v0.7/credible/initialize.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient, getLaunchAddr, diff --git a/scripts/v0.7/credible/start.ts b/scripts/v0.7/credible/start.ts index 9582ec04f..e22da13b9 100644 --- a/scripts/v0.7/credible/start.ts +++ b/scripts/v0.7/credible/start.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient, getLaunchAddr, diff --git a/scripts/v0.7/dumpDaos.ts b/scripts/v0.7/dumpDaos.ts index 44c697b1a..1dcb6678e 100644 --- a/scripts/v0.7/dumpDaos.ts +++ b/scripts/v0.7/dumpDaos.ts @@ -1,6 +1,9 @@ import { PublicKey } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; -import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; +import * as anchor from "@anchor-lang/core"; +import { + FutarchyClient, + FutarchyIDL, +} from "@metadaoproject/programs/futarchy/v0.6"; import dotenv from "dotenv"; import * as fs from "fs"; import * as path from "path"; @@ -12,7 +15,7 @@ const provider = anchor.AnchorProvider.env(); function getDiscriminator(accountName: string): Buffer { return Buffer.from( - anchor.BorshAccountsCoder.accountDiscriminator(accountName), + FutarchyIDL.accounts.find((a) => a.name === accountName)!.discriminator, ); } diff --git a/scripts/v0.7/dumpLaunches.ts b/scripts/v0.7/dumpLaunches.ts index 49ccaed04..5b8238710 100644 --- a/scripts/v0.7/dumpLaunches.ts +++ b/scripts/v0.7/dumpLaunches.ts @@ -1,6 +1,9 @@ import { PublicKey } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; -import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; +import * as anchor from "@anchor-lang/core"; +import { + LaunchpadClient, + LaunchpadIDL, +} from "@metadaoproject/programs/launchpad/v0.7"; import dotenv from "dotenv"; import * as fs from "fs"; import * as path from "path"; @@ -12,7 +15,7 @@ const provider = anchor.AnchorProvider.env(); function getDiscriminator(accountName: string): Buffer { return Buffer.from( - anchor.BorshAccountsCoder.accountDiscriminator(accountName), + LaunchpadIDL.accounts.find((a) => a.name === accountName)!.discriminator, ); } diff --git a/scripts/v0.7/dumpLaunchesAndFundingRecords.ts b/scripts/v0.7/dumpLaunchesAndFundingRecords.ts index 68f7b8675..cbfa9db24 100644 --- a/scripts/v0.7/dumpLaunchesAndFundingRecords.ts +++ b/scripts/v0.7/dumpLaunchesAndFundingRecords.ts @@ -1,6 +1,9 @@ import { PublicKey } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; -import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; +import * as anchor from "@anchor-lang/core"; +import { + LaunchpadClient, + LaunchpadIDL, +} from "@metadaoproject/programs/launchpad/v0.7"; import dotenv from "dotenv"; import * as fs from "fs"; import * as path from "path"; @@ -12,7 +15,7 @@ const provider = anchor.AnchorProvider.env(); function getDiscriminator(accountName: string): Buffer { return Buffer.from( - anchor.BorshAccountsCoder.accountDiscriminator(accountName), + LaunchpadIDL.accounts.find((a) => a.name === accountName)!.discriminator, ); } diff --git a/scripts/v0.7/executeChange.ts b/scripts/v0.7/executeChange.ts index f5fe4c8f4..a6a39e4b8 100644 --- a/scripts/v0.7/executeChange.ts +++ b/scripts/v0.7/executeChange.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import BN from "bn.js"; import { PriceBasedPerformancePackageClient } from "@metadaoproject/programs/price_based_performance_package"; import { PublicKey } from "@solana/web3.js"; diff --git a/scripts/v0.7/extendLaunch.ts b/scripts/v0.7/extendLaunch.ts index f22e8310f..327f41938 100644 --- a/scripts/v0.7/extendLaunch.ts +++ b/scripts/v0.7/extendLaunch.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import * as multisig from "@sqds/multisig"; import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; import { METADAO_MULTISIG_VAULT } from "@metadaoproject/programs"; diff --git a/scripts/v0.7/hurupay/setupLaunch.ts b/scripts/v0.7/hurupay/setupLaunch.ts index 001ea793b..ff1eda56d 100644 --- a/scripts/v0.7/hurupay/setupLaunch.ts +++ b/scripts/v0.7/hurupay/setupLaunch.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient, getLaunchAddr, diff --git a/scripts/v0.7/initializePerformancePackage.ts b/scripts/v0.7/initializePerformancePackage.ts index 74dda58af..706d29cf7 100644 --- a/scripts/v0.7/initializePerformancePackage.ts +++ b/scripts/v0.7/initializePerformancePackage.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; import { PublicKey } from "@solana/web3.js"; diff --git a/scripts/v0.7/laso/complete.ts b/scripts/v0.7/laso/complete.ts index 782ba574e..98f72bd08 100644 --- a/scripts/v0.7/laso/complete.ts +++ b/scripts/v0.7/laso/complete.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient, getLaunchAddr, @@ -9,7 +9,6 @@ import { VersionedTransaction, } from "@solana/web3.js"; import { createLookupTableForTransaction } from "../../utils/utils.js"; -import { token } from "@coral-xyz/anchor/dist/cjs/utils/index.js"; import { TOKEN_SEED } from "./constants.js"; const provider = anchor.AnchorProvider.env(); @@ -23,7 +22,7 @@ export const completeLaunch = async () => { const TOKEN = await PublicKey.createWithSeed( payer.publicKey, TOKEN_SEED, - token.TOKEN_PROGRAM_ID, + anchor.utils.token.TOKEN_PROGRAM_ID, ); console.log("Token address:", TOKEN.toBase58()); diff --git a/scripts/v0.7/laso/end.ts b/scripts/v0.7/laso/end.ts index f78bb9b67..3af7f2c4a 100644 --- a/scripts/v0.7/laso/end.ts +++ b/scripts/v0.7/laso/end.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient, getLaunchAddr, diff --git a/scripts/v0.7/laso/initialize.ts b/scripts/v0.7/laso/initialize.ts index 9cc2f8a3c..06948940b 100644 --- a/scripts/v0.7/laso/initialize.ts +++ b/scripts/v0.7/laso/initialize.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient, getLaunchAddr, diff --git a/scripts/v0.7/laso/start.ts b/scripts/v0.7/laso/start.ts index 9582ec04f..e22da13b9 100644 --- a/scripts/v0.7/laso/start.ts +++ b/scripts/v0.7/laso/start.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient, getLaunchAddr, diff --git a/scripts/v0.7/launchP2P.ts b/scripts/v0.7/launchP2P.ts index b93ba510b..0b300de29 100644 --- a/scripts/v0.7/launchP2P.ts +++ b/scripts/v0.7/launchP2P.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient, getLaunchAddr, diff --git a/scripts/v0.7/launchRNGR.ts b/scripts/v0.7/launchRNGR.ts index 129779085..9ddc45bd8 100644 --- a/scripts/v0.7/launchRNGR.ts +++ b/scripts/v0.7/launchRNGR.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient, getLaunchAddr, diff --git a/scripts/v0.7/launchTemplate.ts b/scripts/v0.7/launchTemplate.ts index 2c2193f0c..30d926ea1 100644 --- a/scripts/v0.7/launchTemplate.ts +++ b/scripts/v0.7/launchTemplate.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient, getLaunchAddr, diff --git a/scripts/v0.7/pointsBased/approveWithPointsWeightedPhase.ts b/scripts/v0.7/pointsBased/approveWithPointsWeightedPhase.ts index ca0611622..2f85b6e6c 100644 --- a/scripts/v0.7/pointsBased/approveWithPointsWeightedPhase.ts +++ b/scripts/v0.7/pointsBased/approveWithPointsWeightedPhase.ts @@ -7,7 +7,7 @@ import { Transaction, PublicKey, } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; import dotenv from "dotenv"; import fs from "fs"; diff --git a/scripts/v0.7/removeProposal.ts b/scripts/v0.7/removeProposal.ts index 7adfd6b35..000489631 100644 --- a/scripts/v0.7/removeProposal.ts +++ b/scripts/v0.7/removeProposal.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; import { FUTARCHY_V0_6_PROGRAM_ID, @@ -31,7 +31,7 @@ export const removeProposal = async () => { const tx = await futarchy.futarchy.methods .adminRemoveProposal() - .accounts({ + .accountsPartial({ proposal, dao: proposalAccount.dao, admin: payer.publicKey, diff --git a/scripts/v0.7/resizeDaos.ts b/scripts/v0.7/resizeDaos.ts index b4443525b..4a87a343e 100644 --- a/scripts/v0.7/resizeDaos.ts +++ b/scripts/v0.7/resizeDaos.ts @@ -5,8 +5,11 @@ import { VersionedTransaction, TransactionMessage, } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; -import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; +import * as anchor from "@anchor-lang/core"; +import { + FutarchyClient, + FutarchyIDL, +} from "@metadaoproject/programs/futarchy/v0.6"; import dotenv from "dotenv"; import bs58 from "bs58"; @@ -17,7 +20,7 @@ const payer = provider.wallet["payer"]; function getDiscriminator(accountName: string): Buffer { return Buffer.from( - anchor.BorshAccountsCoder.accountDiscriminator(accountName), + FutarchyIDL.accounts.find((a) => a.name === accountName)!.discriminator, ); } diff --git a/scripts/v0.7/resizeLaunches.ts b/scripts/v0.7/resizeLaunches.ts index 38cf0d841..c15693958 100644 --- a/scripts/v0.7/resizeLaunches.ts +++ b/scripts/v0.7/resizeLaunches.ts @@ -5,8 +5,11 @@ import { VersionedTransaction, TransactionMessage, } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; -import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; +import * as anchor from "@anchor-lang/core"; +import { + LaunchpadClient, + LaunchpadIDL, +} from "@metadaoproject/programs/launchpad/v0.7"; import dotenv from "dotenv"; import bs58 from "bs58"; @@ -17,7 +20,7 @@ const payer = provider.wallet["payer"]; function getDiscriminator(accountName: string): Buffer { return Buffer.from( - anchor.BorshAccountsCoder.accountDiscriminator(accountName), + LaunchpadIDL.accounts.find((a) => a.name === accountName)!.discriminator, ); } @@ -61,7 +64,7 @@ async function main() { batch.map(async ({ pubkey }) => { return await launchpad.launchpad.methods .resizeLaunch() - .accounts({ + .accountsPartial({ launch: pubkey, payer: payer.publicKey, }) diff --git a/scripts/v0.7/resizeLaunchesAndFundingRecords.ts b/scripts/v0.7/resizeLaunchesAndFundingRecords.ts index e6582afc7..6993bcdea 100644 --- a/scripts/v0.7/resizeLaunchesAndFundingRecords.ts +++ b/scripts/v0.7/resizeLaunchesAndFundingRecords.ts @@ -5,8 +5,11 @@ import { VersionedTransaction, TransactionMessage, } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; -import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; +import * as anchor from "@anchor-lang/core"; +import { + LaunchpadClient, + LaunchpadIDL, +} from "@metadaoproject/programs/launchpad/v0.7"; import dotenv from "dotenv"; import bs58 from "bs58"; @@ -17,7 +20,7 @@ const payer = provider.wallet["payer"]; function getDiscriminator(accountName: string): Buffer { return Buffer.from( - anchor.BorshAccountsCoder.accountDiscriminator(accountName), + LaunchpadIDL.accounts.find((a) => a.name === accountName)!.discriminator, ); } @@ -66,7 +69,7 @@ async function main() { batch.map(async ({ pubkey }) => { return await launchpad.launchpad.methods .resizeLaunch() - .accounts({ + .accountsPartial({ launch: pubkey, payer: payer.publicKey, }) @@ -117,7 +120,7 @@ async function main() { batch.map(async ({ pubkey }) => { return await launchpad.launchpad.methods .resizeFundingRecord() - .accounts({ + .accountsPartial({ fundingRecord: pubkey, payer: payer.publicKey, }) diff --git a/scripts/v0.7/resizePerformancePackages.ts b/scripts/v0.7/resizePerformancePackages.ts index bbd36772c..f55b5b75c 100644 --- a/scripts/v0.7/resizePerformancePackages.ts +++ b/scripts/v0.7/resizePerformancePackages.ts @@ -5,8 +5,11 @@ import { VersionedTransaction, TransactionMessage, } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; -import { PriceBasedPerformancePackageClient } from "@metadaoproject/programs/price_based_performance_package"; +import * as anchor from "@anchor-lang/core"; +import { + PriceBasedPerformancePackageClient, + PriceBasedPerformancePackageIDL, +} from "@metadaoproject/programs/price_based_performance_package"; import dotenv from "dotenv"; import bs58 from "bs58"; @@ -17,7 +20,9 @@ const payer = provider.wallet["payer"]; function getDiscriminator(accountName: string): Buffer { return Buffer.from( - anchor.BorshAccountsCoder.accountDiscriminator(accountName), + PriceBasedPerformancePackageIDL.accounts.find( + (a) => a.name === accountName, + )!.discriminator, ); } diff --git a/scripts/v0.7/rip-cars/proposeUnlockTerms.ts b/scripts/v0.7/rip-cars/proposeUnlockTerms.ts index 8f49f206e..fd4f6bcc6 100644 --- a/scripts/v0.7/rip-cars/proposeUnlockTerms.ts +++ b/scripts/v0.7/rip-cars/proposeUnlockTerms.ts @@ -1,4 +1,4 @@ -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import BN from "bn.js"; import { PublicKey } from "@solana/web3.js"; import { FutarchyClient } from "@metadaoproject/programs/futarchy/v0.6"; diff --git a/scripts/v0.7/startLaunch.ts b/scripts/v0.7/startLaunch.ts index 9ebf9dd61..f528861b8 100644 --- a/scripts/v0.7/startLaunch.ts +++ b/scripts/v0.7/startLaunch.ts @@ -1,5 +1,5 @@ import { Keypair, PublicKey, Transaction } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { LaunchpadClient } from "@metadaoproject/programs/launchpad/v0.7"; import dotenv from "dotenv"; diff --git a/sdk/README.md b/sdk/README.md index 08da22f6d..56a89fdce 100644 --- a/sdk/README.md +++ b/sdk/README.md @@ -70,7 +70,7 @@ import { ConditionalVaultClient } from "@metadaoproject/programs/conditional_vau 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 { AnchorProvider } from "@anchor-lang/core"; import { FutarchyClient } from "@metadaoproject/programs/futarchy"; const provider = AnchorProvider.env(); diff --git a/sdk/package.json b/sdk/package.json index 04581425e..24b1a925c 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -44,11 +44,12 @@ "prepublishOnly": "yarn lint:fix && yarn build" }, "dependencies": { - "@coral-xyz/anchor": "0.29.0", + "@anchor-lang/core": "0.32.2", "@noble/hashes": "1.8.0", "@solana/spl-token": "0.3.11", - "@solana/web3.js": "1.98.4", + "@solana/web3.js": "1.99.0", "@sqds/multisig": "2.1.4", + "@types/node": "25.0.3", "bn.js": "5.2.2" }, "devDependencies": { @@ -58,8 +59,6 @@ "chai": "4.5.0", "mocha": "9.2.2", "prettier": "3.6.2", - "solana-bankrun": "0.2.0", - "spl-token-bankrun": "0.2.3", "ts-mocha": "10.1.0", "typescript": "5.9.3" }, diff --git a/sdk/src/amm/v0.3/AmmClient.ts b/sdk/src/amm/v0.3/AmmClient.ts index 1e933ef20..8cb1f4793 100644 --- a/sdk/src/amm/v0.3/AmmClient.ts +++ b/sdk/src/amm/v0.3/AmmClient.ts @@ -1,7 +1,7 @@ -import { AnchorProvider, IdlTypes, Program } from "@coral-xyz/anchor"; +import { AnchorProvider, IdlTypes, Program } from "@anchor-lang/core"; import { AddressLookupTableAccount, Keypair, PublicKey } from "@solana/web3.js"; -import { Amm as AmmIDLType, IDL as AmmIDL } from "./types/amm.js"; +import { AmmProgram as AmmIDLType, AmmIDL } from "./types/index.js"; import BN from "bn.js"; import { AMM_V0_3_PROGRAM_ID } from "../../constants.js"; @@ -16,7 +16,7 @@ import { } from "@solana/spl-token"; import { AmmMath, PriceMath } from "../../priceMath.js"; -export type SwapType = LowercaseKeys["SwapType"]>; +export type SwapType = LowercaseKeys["swapType"]>; export type CreateAmmClientParams = { provider: AnchorProvider; @@ -34,7 +34,10 @@ export class AmmClient { luts: AddressLookupTableAccount[], ) { this.provider = provider; - this.program = new Program(AmmIDL, ammProgramId, provider); + this.program = new Program( + { ...AmmIDL, address: ammProgramId.toBase58() }, + provider, + ); this.luts = luts; } @@ -109,7 +112,7 @@ export class AmmClient { twapInitialObservation, twapMaxObservationChangePerUpdate, }) - .accounts({ + .accountsPartial({ user: this.provider.publicKey, amm, lpMint, @@ -209,7 +212,7 @@ export class AmmClient { maxBaseAmount, minLpTokens, }) - .accounts({ + .accountsPartial({ user, amm, lpMint, @@ -245,7 +248,7 @@ export class AmmClient { minBaseAmount, minQuoteAmount, }) - .accounts({ + .accountsPartial({ user: this.provider.publicKey, amm: ammAddr, lpMint, @@ -315,7 +318,7 @@ export class AmmClient { inputAmount, outputAmountMin, }) - .accounts({ + .accountsPartial({ user, amm, userBaseAccount: getAssociatedTokenAddressSync(baseMint, user, true), @@ -338,7 +341,7 @@ export class AmmClient { } crankThatTwapIx(amm: PublicKey) { - return this.program.methods.crankThatTwap().accounts({ + return this.program.methods.crankThatTwap().accountsPartial({ amm, }); } diff --git a/sdk/src/amm/v0.3/pda.ts b/sdk/src/amm/v0.3/pda.ts index 6fdba69a8..78015a97c 100644 --- a/sdk/src/amm/v0.3/pda.ts +++ b/sdk/src/amm/v0.3/pda.ts @@ -1,5 +1,5 @@ import { PublicKey } from "@solana/web3.js"; -import { utils } from "@coral-xyz/anchor"; +import { utils } from "@anchor-lang/core"; import { AMM_V0_3_PROGRAM_ID } from "../../constants.js"; export const getAmmAddr = ( diff --git a/sdk/src/amm/v0.3/types/amm.json b/sdk/src/amm/v0.3/types/amm.json new file mode 100644 index 000000000..1dac28de2 --- /dev/null +++ b/sdk/src/amm/v0.3/types/amm.json @@ -0,0 +1,596 @@ +{ + "address": "AMM5G2nxuKUwCLRYTW7qqEwuoqCtNSjtbipwEmm2g8bH", + "metadata": { + "name": "amm", + "version": "0.3.0", + "spec": "0.1.0" + }, + "instructions": [ + { + "name": "create_amm", + "discriminator": [ + 242, + 91, + 21, + 170, + 5, + 68, + 125, + 64 + ], + "accounts": [ + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "amm", + "writable": true + }, + { + "name": "lp_mint", + "writable": true + }, + { + "name": "base_mint" + }, + { + "name": "quote_mint" + }, + { + "name": "vault_ata_base", + "writable": true + }, + { + "name": "vault_ata_quote", + "writable": true + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "CreateAmmArgs" + } + } + } + ] + }, + { + "name": "add_liquidity", + "discriminator": [ + 181, + 157, + 89, + 67, + 143, + 182, + 52, + 72 + ], + "accounts": [ + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "amm", + "writable": true + }, + { + "name": "lp_mint", + "writable": true + }, + { + "name": "user_lp_account", + "writable": true + }, + { + "name": "user_base_account", + "writable": true + }, + { + "name": "user_quote_account", + "writable": true + }, + { + "name": "vault_ata_base", + "writable": true + }, + { + "name": "vault_ata_quote", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "AddLiquidityArgs" + } + } + } + ] + }, + { + "name": "remove_liquidity", + "discriminator": [ + 80, + 85, + 209, + 72, + 24, + 206, + 177, + 108 + ], + "accounts": [ + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "amm", + "writable": true + }, + { + "name": "lp_mint", + "writable": true + }, + { + "name": "user_lp_account", + "writable": true + }, + { + "name": "user_base_account", + "writable": true + }, + { + "name": "user_quote_account", + "writable": true + }, + { + "name": "vault_ata_base", + "writable": true + }, + { + "name": "vault_ata_quote", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "RemoveLiquidityArgs" + } + } + } + ] + }, + { + "name": "swap", + "discriminator": [ + 248, + 198, + 158, + 145, + 225, + 117, + 135, + 200 + ], + "accounts": [ + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "amm", + "writable": true + }, + { + "name": "user_base_account", + "writable": true + }, + { + "name": "user_quote_account", + "writable": true + }, + { + "name": "vault_ata_base", + "writable": true + }, + { + "name": "vault_ata_quote", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "SwapArgs" + } + } + } + ] + }, + { + "name": "crank_that_twap", + "discriminator": [ + 220, + 100, + 25, + 249, + 0, + 92, + 195, + 193 + ], + "accounts": [ + { + "name": "amm", + "writable": true + } + ], + "args": [] + } + ], + "accounts": [ + { + "name": "Amm", + "discriminator": [ + 143, + 245, + 200, + 17, + 74, + 214, + 196, + 135 + ] + } + ], + "errors": [ + { + "code": 6000, + "name": "NoSlotsPassed", + "msg": "Can't get a TWAP before some observations have been stored" + }, + { + "code": 6001, + "name": "NoReserves", + "msg": "Can't swap through a pool without token reserves on either side" + }, + { + "code": 6002, + "name": "InputAmountOverflow", + "msg": "Input token amount is too large for a swap, causes overflow" + }, + { + "code": 6003, + "name": "AddLiquidityCalculationError", + "msg": "Add liquidity calculation error" + }, + { + "code": 6004, + "name": "DecimalScaleError", + "msg": "Error in decimal scale conversion" + }, + { + "code": 6005, + "name": "SameTokenMints", + "msg": "You can't create an AMM pool where the token mints are the same" + }, + { + "code": 6006, + "name": "SwapSlippageExceeded", + "msg": "A user wouldn't have gotten back their `output_amount_min`, reverting" + }, + { + "code": 6007, + "name": "InsufficientBalance", + "msg": "The user had insufficient balance to do this" + }, + { + "code": 6008, + "name": "ZeroLiquidityRemove", + "msg": "Must remove a non-zero amount of liquidity" + }, + { + "code": 6009, + "name": "ZeroLiquidityToAdd", + "msg": "Cannot add liquidity with 0 tokens on either side" + }, + { + "code": 6010, + "name": "ZeroMinLpTokens", + "msg": "Must specify a non-zero `min_lp_tokens` when adding to an existing pool" + }, + { + "code": 6011, + "name": "AddLiquiditySlippageExceeded", + "msg": "LP wouldn't have gotten back `lp_token_min`" + }, + { + "code": 6012, + "name": "AddLiquidityMaxBaseExceeded", + "msg": "LP would have spent more than `max_base_amount`" + }, + { + "code": 6013, + "name": "InsufficientQuoteAmount", + "msg": "`quote_amount` must be greater than 100000000 when initializing a pool" + }, + { + "code": 6014, + "name": "ZeroSwapAmount", + "msg": "Users must swap a non-zero amount" + }, + { + "code": 6015, + "name": "ConstantProductInvariantFailed", + "msg": "K should always be increasing" + }, + { + "code": 6016, + "name": "CastingOverflow", + "msg": "Casting has caused an overflow" + } + ], + "types": [ + { + "name": "AddLiquidityArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "quote_amount", + "docs": [ + "How much quote token you will deposit to the pool" + ], + "type": "u64" + }, + { + "name": "max_base_amount", + "docs": [ + "The maximum base token you will deposit to the pool" + ], + "type": "u64" + }, + { + "name": "min_lp_tokens", + "docs": [ + "The minimum LP token you will get back" + ], + "type": "u64" + } + ] + } + }, + { + "name": "CreateAmmArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "twap_initial_observation", + "type": "u128" + }, + { + "name": "twap_max_observation_change_per_update", + "type": "u128" + } + ] + } + }, + { + "name": "RemoveLiquidityArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "lp_tokens_to_burn", + "type": "u64" + }, + { + "name": "min_quote_amount", + "type": "u64" + }, + { + "name": "min_base_amount", + "type": "u64" + } + ] + } + }, + { + "name": "SwapArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "swap_type", + "type": { + "defined": { + "name": "SwapType" + } + } + }, + { + "name": "input_amount", + "type": "u64" + }, + { + "name": "output_amount_min", + "type": "u64" + } + ] + } + }, + { + "name": "TwapOracle", + "type": { + "kind": "struct", + "fields": [ + { + "name": "last_updated_slot", + "type": "u64" + }, + { + "name": "last_price", + "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": "last_observation", + "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": "max_observation_change_per_update", + "docs": [ + "The most that an observation can change per update." + ], + "type": "u128" + }, + { + "name": "initial_observation", + "docs": [ + "What the initial `latest_observation` is set to." + ], + "type": "u128" + } + ] + } + }, + { + "name": "SwapType", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Buy" + }, + { + "name": "Sell" + } + ] + } + }, + { + "name": "Amm", + "type": { + "kind": "struct", + "fields": [ + { + "name": "bump", + "type": "u8" + }, + { + "name": "created_at_slot", + "type": "u64" + }, + { + "name": "lp_mint", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "base_mint_decimals", + "type": "u8" + }, + { + "name": "quote_mint_decimals", + "type": "u8" + }, + { + "name": "base_amount", + "type": "u64" + }, + { + "name": "quote_amount", + "type": "u64" + }, + { + "name": "oracle", + "type": { + "defined": { + "name": "TwapOracle" + } + } + } + ] + } + } + ] +} \ No newline at end of file diff --git a/sdk/src/amm/v0.3/types/amm.ts b/sdk/src/amm/v0.3/types/amm.ts index 6e5bcf53a..fd6bf6ef6 100644 --- a/sdk/src/amm/v0.3/types/amm.ts +++ b/sdk/src/amm/v0.3/types/amm.ts @@ -1,241 +1,231 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL was converted from the legacy format with `anchor idl convert` and lives in + * the `.json` file next to this one. + */ export type Amm = { - version: "0.3.0"; - name: "amm"; + address: "AMM5G2nxuKUwCLRYTW7qqEwuoqCtNSjtbipwEmm2g8bH"; + metadata: { + name: "amm"; + version: "0.3.0"; + spec: "0.1.0"; + }; instructions: [ { name: "createAmm"; + discriminator: [242, 91, 21, 170, 5, 68, 125, 64]; accounts: [ { name: "user"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "amm"; - isMut: true; - isSigner: false; + writable: true; }, { name: "lpMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "baseMint"; - isMut: false; - isSigner: false; }, { name: "quoteMint"; - isMut: false; - isSigner: false; }, { name: "vaultAtaBase"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultAtaQuote"; - isMut: true; - isSigner: false; + writable: true; }, { name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, ]; args: [ { name: "args"; type: { - defined: "CreateAmmArgs"; + defined: { + name: "createAmmArgs"; + }; }; }, ]; }, { name: "addLiquidity"; + discriminator: [181, 157, 89, 67, 143, 182, 52, 72]; accounts: [ { name: "user"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "amm"; - isMut: true; - isSigner: false; + writable: true; }, { name: "lpMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userLpAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userBaseAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultAtaBase"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultAtaQuote"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, ]; args: [ { name: "args"; type: { - defined: "AddLiquidityArgs"; + defined: { + name: "addLiquidityArgs"; + }; }; }, ]; }, { name: "removeLiquidity"; + discriminator: [80, 85, 209, 72, 24, 206, 177, 108]; accounts: [ { name: "user"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "amm"; - isMut: true; - isSigner: false; + writable: true; }, { name: "lpMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userLpAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userBaseAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultAtaBase"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultAtaQuote"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, ]; args: [ { name: "args"; type: { - defined: "RemoveLiquidityArgs"; + defined: { + name: "removeLiquidityArgs"; + }; }; }, ]; }, { name: "swap"; + discriminator: [248, 198, 158, 145, 225, 117, 135, 200]; accounts: [ { name: "user"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "amm"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userBaseAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultAtaBase"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultAtaQuote"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, ]; args: [ { name: "args"; type: { - defined: "SwapArgs"; + defined: { + name: "swapArgs"; + }; }; }, ]; }, { name: "crankThatTwap"; + discriminator: [220, 100, 25, 249, 0, 92, 195, 193]; accounts: [ { name: "amm"; - isMut: true; - isSigner: false; + writable: true; }, ]; args: []; @@ -244,58 +234,99 @@ export type Amm = { 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"; - }; - }, - ]; - }; + discriminator: [143, 245, 200, 17, 74, 214, 196, 135]; + }, + ]; + errors: [ + { + code: 6000; + name: "noSlotsPassed"; + msg: "Can't get a TWAP before some observations have been stored"; + }, + { + code: 6001; + name: "noReserves"; + msg: "Can't swap through a pool without token reserves on either side"; + }, + { + code: 6002; + name: "inputAmountOverflow"; + msg: "Input token amount is too large for a swap, causes overflow"; + }, + { + code: 6003; + name: "addLiquidityCalculationError"; + msg: "Add liquidity calculation error"; + }, + { + code: 6004; + name: "decimalScaleError"; + msg: "Error in decimal scale conversion"; + }, + { + code: 6005; + name: "sameTokenMints"; + msg: "You can't create an AMM pool where the token mints are the same"; + }, + { + code: 6006; + name: "swapSlippageExceeded"; + msg: "A user wouldn't have gotten back their `output_amount_min`, reverting"; + }, + { + code: 6007; + name: "insufficientBalance"; + msg: "The user had insufficient balance to do this"; + }, + { + code: 6008; + name: "zeroLiquidityRemove"; + msg: "Must remove a non-zero amount of liquidity"; + }, + { + code: 6009; + name: "zeroLiquidityToAdd"; + msg: "Cannot add liquidity with 0 tokens on either side"; + }, + { + code: 6010; + name: "zeroMinLpTokens"; + msg: "Must specify a non-zero `min_lp_tokens` when adding to an existing pool"; + }, + { + code: 6011; + name: "addLiquiditySlippageExceeded"; + msg: "LP wouldn't have gotten back `lp_token_min`"; + }, + { + code: 6012; + name: "addLiquidityMaxBaseExceeded"; + msg: "LP would have spent more than `max_base_amount`"; + }, + { + code: 6013; + name: "insufficientQuoteAmount"; + msg: "`quote_amount` must be greater than 100000000 when initializing a pool"; + }, + { + code: 6014; + name: "zeroSwapAmount"; + msg: "Users must swap a non-zero amount"; + }, + { + code: 6015; + name: "constantProductInvariantFailed"; + msg: "K should always be increasing"; + }, + { + code: 6016; + name: "castingOverflow"; + msg: "Casting has caused an overflow"; }, ]; types: [ { - name: "AddLiquidityArgs"; + name: "addLiquidityArgs"; type: { kind: "struct"; fields: [ @@ -318,7 +349,7 @@ export type Amm = { }; }, { - name: "CreateAmmArgs"; + name: "createAmmArgs"; type: { kind: "struct"; fields: [ @@ -334,7 +365,7 @@ export type Amm = { }; }, { - name: "RemoveLiquidityArgs"; + name: "removeLiquidityArgs"; type: { kind: "struct"; fields: [ @@ -354,14 +385,16 @@ export type Amm = { }; }, { - name: "SwapArgs"; + name: "swapArgs"; type: { kind: "struct"; fields: [ { name: "swapType"; type: { - defined: "SwapType"; + defined: { + name: "swapType"; + }; }; }, { @@ -376,7 +409,7 @@ export type Amm = { }; }, { - name: "TwapOracle"; + name: "twapOracle"; type: { kind: "struct"; fields: [ @@ -437,647 +470,70 @@ export type Amm = { }; }, { - name: "SwapType"; + name: "swapType"; type: { kind: "enum"; variants: [ { - name: "Buy"; + name: "buy"; }, { - name: "Sell"; + name: "sell"; }, ]; }; }, - ]; - errors: [ - { - code: 6000; - name: "NoSlotsPassed"; - msg: "Can't get a TWAP before some observations have been stored"; - }, - { - code: 6001; - name: "NoReserves"; - msg: "Can't swap through a pool without token reserves on either side"; - }, - { - code: 6002; - name: "InputAmountOverflow"; - msg: "Input token amount is too large for a swap, causes overflow"; - }, - { - code: 6003; - name: "AddLiquidityCalculationError"; - msg: "Add liquidity calculation error"; - }, - { - code: 6004; - name: "DecimalScaleError"; - msg: "Error in decimal scale conversion"; - }, - { - code: 6005; - name: "SameTokenMints"; - msg: "You can't create an AMM pool where the token mints are the same"; - }, - { - code: 6006; - name: "SwapSlippageExceeded"; - msg: "A user wouldn't have gotten back their `output_amount_min`, reverting"; - }, - { - code: 6007; - name: "InsufficientBalance"; - msg: "The user had insufficient balance to do this"; - }, - { - code: 6008; - name: "ZeroLiquidityRemove"; - msg: "Must remove a non-zero amount of liquidity"; - }, - { - code: 6009; - name: "ZeroLiquidityToAdd"; - msg: "Cannot add liquidity with 0 tokens on either side"; - }, - { - code: 6010; - name: "ZeroMinLpTokens"; - msg: "Must specify a non-zero `min_lp_tokens` when adding to an existing pool"; - }, - { - code: 6011; - name: "AddLiquiditySlippageExceeded"; - msg: "LP wouldn't have gotten back `lp_token_min`"; - }, { - code: 6012; - name: "AddLiquidityMaxBaseExceeded"; - msg: "LP would have spent more than `max_base_amount`"; - }, - { - code: 6013; - name: "InsufficientQuoteAmount"; - msg: "`quote_amount` must be greater than 100000000 when initializing a pool"; - }, - { - code: 6014; - name: "ZeroSwapAmount"; - msg: "Users must swap a non-zero amount"; - }, - { - code: 6015; - name: "ConstantProductInvariantFailed"; - msg: "K should always be increasing"; - }, - { - code: 6016; - name: "CastingOverflow"; - msg: "Casting has caused an overflow"; - }, - ]; -}; - -export const IDL: Amm = { - version: "0.3.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, - }, - ], - 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, - }, - ], - 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, - }, - ], - 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, - }, - ], - args: [ - { - name: "args", - type: { - defined: "SwapArgs", - }, - }, - ], - }, - { - name: "crankThatTwap", - accounts: [ - { - name: "amm", - isMut: true, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "amm", + name: "amm"; type: { - kind: "struct", + 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: "bump"; + type: "u8"; }, { - name: "oracle", - type: { - defined: "TwapOracle", - }, + name: "createdAtSlot"; + type: "u64"; }, - ], - }, - }, - ], - types: [ - { - name: "AddLiquidityArgs", - type: { - kind: "struct", - fields: [ { - name: "quoteAmount", - docs: ["How much quote token you will deposit to the pool"], - type: "u64", + name: "lpMint"; + type: "pubkey"; }, { - name: "maxBaseAmount", - docs: ["The maximum base token you will deposit to the pool"], - type: "u64", + name: "baseMint"; + type: "pubkey"; }, { - name: "minLpTokens", - docs: ["The minimum LP token you will get back"], - type: "u64", - }, - ], - }, - }, - { - name: "CreateAmmArgs", - type: { - kind: "struct", - fields: [ - { - name: "twapInitialObservation", - type: "u128", + name: "quoteMint"; + type: "pubkey"; }, { - name: "twapMaxObservationChangePerUpdate", - type: "u128", + name: "baseMintDecimals"; + type: "u8"; }, - ], - }, - }, - { - name: "RemoveLiquidityArgs", - type: { - kind: "struct", - fields: [ { - name: "lpTokensToBurn", - type: "u64", + name: "quoteMintDecimals"; + type: "u8"; }, { - name: "minQuoteAmount", - type: "u64", + name: "baseAmount"; + type: "u64"; }, { - name: "minBaseAmount", - type: "u64", + name: "quoteAmount"; + type: "u64"; }, - ], - }, - }, - { - name: "SwapArgs", - type: { - kind: "struct", - fields: [ { - name: "swapType", + name: "oracle"; 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: "SwapType", - type: { - kind: "enum", - variants: [ - { - name: "Buy", - }, - { - name: "Sell", + defined: { + name: "twapOracle"; + }; + }; }, - ], - }, - }, - ], - errors: [ - { - code: 6000, - name: "NoSlotsPassed", - msg: "Can't get a TWAP before some observations have been stored", - }, - { - code: 6001, - name: "NoReserves", - msg: "Can't swap through a pool without token reserves on either side", - }, - { - code: 6002, - name: "InputAmountOverflow", - msg: "Input token amount is too large for a swap, causes overflow", - }, - { - code: 6003, - name: "AddLiquidityCalculationError", - msg: "Add liquidity calculation error", - }, - { - code: 6004, - name: "DecimalScaleError", - msg: "Error in decimal scale conversion", - }, - { - code: 6005, - name: "SameTokenMints", - msg: "You can't create an AMM pool where the token mints are the same", - }, - { - code: 6006, - name: "SwapSlippageExceeded", - msg: "A user wouldn't have gotten back their `output_amount_min`, reverting", - }, - { - code: 6007, - name: "InsufficientBalance", - msg: "The user had insufficient balance to do this", - }, - { - code: 6008, - name: "ZeroLiquidityRemove", - msg: "Must remove a non-zero amount of liquidity", - }, - { - code: 6009, - name: "ZeroLiquidityToAdd", - msg: "Cannot add liquidity with 0 tokens on either side", - }, - { - code: 6010, - name: "ZeroMinLpTokens", - msg: "Must specify a non-zero `min_lp_tokens` when adding to an existing pool", - }, - { - code: 6011, - name: "AddLiquiditySlippageExceeded", - msg: "LP wouldn't have gotten back `lp_token_min`", - }, - { - code: 6012, - name: "AddLiquidityMaxBaseExceeded", - msg: "LP would have spent more than `max_base_amount`", - }, - { - code: 6013, - name: "InsufficientQuoteAmount", - msg: "`quote_amount` must be greater than 100000000 when initializing a pool", - }, - { - code: 6014, - name: "ZeroSwapAmount", - msg: "Users must swap a non-zero amount", - }, - { - code: 6015, - name: "ConstantProductInvariantFailed", - msg: "K should always be increasing", - }, - { - code: 6016, - name: "CastingOverflow", - msg: "Casting has caused an overflow", + ]; + }; }, - ], + ]; }; diff --git a/sdk/src/amm/v0.3/types/index.ts b/sdk/src/amm/v0.3/types/index.ts index 66251d5f8..d04c4e76a 100644 --- a/sdk/src/amm/v0.3/types/index.ts +++ b/sdk/src/amm/v0.3/types/index.ts @@ -1,6 +1,8 @@ -import { Amm as AmmProgram, IDL as AmmIDL } from "./amm.js"; -export { AmmProgram, AmmIDL }; +import type { Amm as AmmProgram } from "./amm.js"; +import ammIdl from "./amm.json" with { type: "json" }; +export type { AmmProgram }; +export const AmmIDL = ammIdl as AmmProgram; -import type { IdlAccounts } from "@coral-xyz/anchor"; +import type { IdlAccounts } from "@anchor-lang/core"; export type Amm = IdlAccounts["amm"]; diff --git a/sdk/src/amm/v0.4/AmmClient.ts b/sdk/src/amm/v0.4/AmmClient.ts index 9fa792143..9e40ca27a 100644 --- a/sdk/src/amm/v0.4/AmmClient.ts +++ b/sdk/src/amm/v0.4/AmmClient.ts @@ -1,4 +1,4 @@ -import { AnchorProvider, IdlTypes, Program } from "@coral-xyz/anchor"; +import { AnchorProvider, IdlTypes, Program } from "@anchor-lang/core"; import { AccountInfo, AddressLookupTableAccount, @@ -6,7 +6,7 @@ import { PublicKey, } from "@solana/web3.js"; -import { Amm as AmmIDLType, IDL as AmmIDL } from "./types/amm.js"; +import { AmmProgram as AmmIDLType, AmmIDL } from "./types/index.js"; import BN from "bn.js"; import { AMM_V0_4_PROGRAM_ID } from "../../constants.js"; @@ -21,7 +21,7 @@ import { } from "@solana/spl-token"; import { AmmMath, PriceMath } from "../../priceMath.js"; -export type SwapType = LowercaseKeys["SwapType"]>; +export type SwapType = LowercaseKeys["swapType"]>; export type CreateAmmClientParams = { provider: AnchorProvider; @@ -39,7 +39,10 @@ export class AmmClient { luts: AddressLookupTableAccount[], ) { this.provider = provider; - this.program = new Program(AmmIDL, ammProgramId, provider); + this.program = new Program( + { ...AmmIDL, address: ammProgramId.toBase58() }, + provider, + ); this.luts = luts; } @@ -130,7 +133,7 @@ export class AmmClient { twapMaxObservationChangePerUpdate, twapStartDelaySlots, }) - .accounts({ + .accountsPartial({ user: this.provider.publicKey, amm, lpMint, @@ -237,7 +240,7 @@ export class AmmClient { maxBaseAmount, minLpTokens, }) - .accounts({ + .accountsPartial({ user, amm, lpMint, @@ -273,7 +276,7 @@ export class AmmClient { minBaseAmount, minQuoteAmount, }) - .accounts({ + .accountsPartial({ user: this.provider.publicKey, amm: ammAddr, lpMint, @@ -345,7 +348,7 @@ export class AmmClient { inputAmount, outputAmountMin, }) - .accounts({ + .accountsPartial({ user, amm, userBaseAccount: getAssociatedTokenAddressSync(baseMint, user, true), @@ -369,7 +372,7 @@ export class AmmClient { } crankThatTwapIx(amm: PublicKey) { - return this.program.methods.crankThatTwap().accounts({ + return this.program.methods.crankThatTwap().accountsPartial({ amm, }); } diff --git a/sdk/src/amm/v0.4/pda.ts b/sdk/src/amm/v0.4/pda.ts index 9d6abcd19..13441a6cd 100644 --- a/sdk/src/amm/v0.4/pda.ts +++ b/sdk/src/amm/v0.4/pda.ts @@ -1,5 +1,5 @@ import { PublicKey } from "@solana/web3.js"; -import { utils } from "@coral-xyz/anchor"; +import { utils } from "@anchor-lang/core"; import { AMM_V0_4_PROGRAM_ID } from "../../constants.js"; export const getAmmAddr = ( diff --git a/sdk/src/amm/v0.4/types/amm.json b/sdk/src/amm/v0.4/types/amm.json new file mode 100644 index 000000000..b9f4e391d --- /dev/null +++ b/sdk/src/amm/v0.4/types/amm.json @@ -0,0 +1,925 @@ +{ + "address": "AMMyu265tkBpRW21iGQxKGLaves3gKm2JcMUqfXNSpqD", + "metadata": { + "name": "amm", + "version": "0.4.1", + "spec": "0.1.0" + }, + "instructions": [ + { + "name": "create_amm", + "discriminator": [ + 242, + 91, + 21, + 170, + 5, + 68, + 125, + 64 + ], + "accounts": [ + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "amm", + "writable": true + }, + { + "name": "lp_mint", + "writable": true + }, + { + "name": "base_mint" + }, + { + "name": "quote_mint" + }, + { + "name": "vault_ata_base", + "writable": true + }, + { + "name": "vault_ata_quote", + "writable": true + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "CreateAmmArgs" + } + } + } + ] + }, + { + "name": "add_liquidity", + "discriminator": [ + 181, + 157, + 89, + 67, + 143, + 182, + 52, + 72 + ], + "accounts": [ + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "amm", + "writable": true + }, + { + "name": "lp_mint", + "writable": true + }, + { + "name": "user_lp_account", + "writable": true + }, + { + "name": "user_base_account", + "writable": true + }, + { + "name": "user_quote_account", + "writable": true + }, + { + "name": "vault_ata_base", + "writable": true + }, + { + "name": "vault_ata_quote", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "AddLiquidityArgs" + } + } + } + ] + }, + { + "name": "remove_liquidity", + "discriminator": [ + 80, + 85, + 209, + 72, + 24, + 206, + 177, + 108 + ], + "accounts": [ + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "amm", + "writable": true + }, + { + "name": "lp_mint", + "writable": true + }, + { + "name": "user_lp_account", + "writable": true + }, + { + "name": "user_base_account", + "writable": true + }, + { + "name": "user_quote_account", + "writable": true + }, + { + "name": "vault_ata_base", + "writable": true + }, + { + "name": "vault_ata_quote", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "RemoveLiquidityArgs" + } + } + } + ] + }, + { + "name": "swap", + "discriminator": [ + 248, + 198, + 158, + 145, + 225, + 117, + 135, + 200 + ], + "accounts": [ + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "amm", + "writable": true + }, + { + "name": "user_base_account", + "writable": true + }, + { + "name": "user_quote_account", + "writable": true + }, + { + "name": "vault_ata_base", + "writable": true + }, + { + "name": "vault_ata_quote", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "SwapArgs" + } + } + } + ] + }, + { + "name": "crank_that_twap", + "discriminator": [ + 220, + 100, + 25, + 249, + 0, + 92, + 195, + 193 + ], + "accounts": [ + { + "name": "amm", + "writable": true + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + } + ], + "accounts": [ + { + "name": "Amm", + "discriminator": [ + 143, + 245, + 200, + 17, + 74, + 214, + 196, + 135 + ] + } + ], + "events": [ + { + "name": "SwapEvent", + "discriminator": [ + 64, + 198, + 205, + 232, + 38, + 8, + 113, + 226 + ] + }, + { + "name": "AddLiquidityEvent", + "discriminator": [ + 27, + 178, + 153, + 186, + 47, + 196, + 140, + 45 + ] + }, + { + "name": "RemoveLiquidityEvent", + "discriminator": [ + 141, + 199, + 182, + 123, + 159, + 94, + 215, + 102 + ] + }, + { + "name": "CreateAmmEvent", + "discriminator": [ + 87, + 213, + 21, + 39, + 67, + 210, + 139, + 177 + ] + }, + { + "name": "CrankThatTwapEvent", + "discriminator": [ + 151, + 40, + 1, + 219, + 150, + 58, + 199, + 212 + ] + } + ], + "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" + } + ], + "types": [ + { + "name": "CommonFields", + "type": { + "kind": "struct", + "fields": [ + { + "name": "slot", + "type": "u64" + }, + { + "name": "unix_timestamp", + "type": "i64" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "amm", + "type": "pubkey" + }, + { + "name": "post_base_reserves", + "type": "u64" + }, + { + "name": "post_quote_reserves", + "type": "u64" + }, + { + "name": "oracle_last_price", + "type": "u128" + }, + { + "name": "oracle_last_observation", + "type": "u128" + }, + { + "name": "oracle_aggregator", + "type": "u128" + }, + { + "name": "seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "AddLiquidityArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "quote_amount", + "docs": [ + "How much quote token you will deposit to the pool" + ], + "type": "u64" + }, + { + "name": "max_base_amount", + "docs": [ + "The maximum base token you will deposit to the pool" + ], + "type": "u64" + }, + { + "name": "min_lp_tokens", + "docs": [ + "The minimum LP token you will get back" + ], + "type": "u64" + } + ] + } + }, + { + "name": "CreateAmmArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "twap_initial_observation", + "type": "u128" + }, + { + "name": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "twap_start_delay_slots", + "type": "u64" + } + ] + } + }, + { + "name": "RemoveLiquidityArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "lp_tokens_to_burn", + "type": "u64" + }, + { + "name": "min_quote_amount", + "type": "u64" + }, + { + "name": "min_base_amount", + "type": "u64" + } + ] + } + }, + { + "name": "SwapArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "swap_type", + "type": { + "defined": { + "name": "SwapType" + } + } + }, + { + "name": "input_amount", + "type": "u64" + }, + { + "name": "output_amount_min", + "type": "u64" + } + ] + } + }, + { + "name": "TwapOracle", + "type": { + "kind": "struct", + "fields": [ + { + "name": "last_updated_slot", + "type": "u64" + }, + { + "name": "last_price", + "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": "last_observation", + "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": "max_observation_change_per_update", + "docs": [ + "The most that an observation can change per update." + ], + "type": "u128" + }, + { + "name": "initial_observation", + "docs": [ + "What the initial `latest_observation` is set to." + ], + "type": "u128" + }, + { + "name": "start_delay_slots", + "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" + } + ] + } + }, + { + "name": "Amm", + "type": { + "kind": "struct", + "fields": [ + { + "name": "bump", + "type": "u8" + }, + { + "name": "created_at_slot", + "type": "u64" + }, + { + "name": "lp_mint", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "base_mint_decimals", + "type": "u8" + }, + { + "name": "quote_mint_decimals", + "type": "u8" + }, + { + "name": "base_amount", + "type": "u64" + }, + { + "name": "quote_amount", + "type": "u64" + }, + { + "name": "oracle", + "type": { + "defined": { + "name": "TwapOracle" + } + } + }, + { + "name": "seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "SwapEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "input_amount", + "type": "u64" + }, + { + "name": "output_amount", + "type": "u64" + }, + { + "name": "swap_type", + "type": { + "defined": { + "name": "SwapType" + } + } + } + ] + } + }, + { + "name": "AddLiquidityEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "quote_amount", + "type": "u64" + }, + { + "name": "max_base_amount", + "type": "u64" + }, + { + "name": "min_lp_tokens", + "type": "u64" + }, + { + "name": "base_amount", + "type": "u64" + }, + { + "name": "lp_tokens_minted", + "type": "u64" + } + ] + } + }, + { + "name": "RemoveLiquidityEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "lp_tokens_burned", + "type": "u64" + }, + { + "name": "min_quote_amount", + "type": "u64" + }, + { + "name": "min_base_amount", + "type": "u64" + }, + { + "name": "base_amount", + "type": "u64" + }, + { + "name": "quote_amount", + "type": "u64" + } + ] + } + }, + { + "name": "CreateAmmEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "twap_initial_observation", + "type": "u128" + }, + { + "name": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "lp_mint", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "vault_ata_base", + "type": "pubkey" + }, + { + "name": "vault_ata_quote", + "type": "pubkey" + } + ] + } + }, + { + "name": "CrankThatTwapEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + } + ] + } + } + ] +} \ No newline at end of file diff --git a/sdk/src/amm/v0.4/types/amm.ts b/sdk/src/amm/v0.4/types/amm.ts index 72fc00cc8..edfbf06a7 100644 --- a/sdk/src/amm/v0.4/types/amm.ts +++ b/sdk/src/amm/v0.4/types/amm.ts @@ -1,291 +1,261 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL was converted from the legacy format with `anchor idl convert` and lives in + * the `.json` file next to this one. + */ export type Amm = { - version: "0.4.1"; - name: "amm"; + address: "AMMyu265tkBpRW21iGQxKGLaves3gKm2JcMUqfXNSpqD"; + metadata: { + name: "amm"; + version: "0.4.1"; + spec: "0.1.0"; + }; instructions: [ { name: "createAmm"; + discriminator: [242, 91, 21, 170, 5, 68, 125, 64]; accounts: [ { name: "user"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "amm"; - isMut: true; - isSigner: false; + writable: true; }, { name: "lpMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "baseMint"; - isMut: false; - isSigner: false; }, { name: "quoteMint"; - isMut: false; - isSigner: false; }, { name: "vaultAtaBase"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultAtaQuote"; - isMut: true; - isSigner: false; + writable: true; }, { name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "args"; type: { - defined: "CreateAmmArgs"; + defined: { + name: "createAmmArgs"; + }; }; }, ]; }, { name: "addLiquidity"; + discriminator: [181, 157, 89, 67, 143, 182, 52, 72]; accounts: [ { name: "user"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "amm"; - isMut: true; - isSigner: false; + writable: true; }, { name: "lpMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userLpAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userBaseAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultAtaBase"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultAtaQuote"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "args"; type: { - defined: "AddLiquidityArgs"; + defined: { + name: "addLiquidityArgs"; + }; }; }, ]; }, { name: "removeLiquidity"; + discriminator: [80, 85, 209, 72, 24, 206, 177, 108]; accounts: [ { name: "user"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "amm"; - isMut: true; - isSigner: false; + writable: true; }, { name: "lpMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userLpAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userBaseAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultAtaBase"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultAtaQuote"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "args"; type: { - defined: "RemoveLiquidityArgs"; + defined: { + name: "removeLiquidityArgs"; + }; }; }, ]; }, { name: "swap"; + discriminator: [248, 198, 158, 145, 225, 117, 135, 200]; accounts: [ { name: "user"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "amm"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userBaseAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultAtaBase"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultAtaQuote"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "args"; type: { - defined: "SwapArgs"; + defined: { + name: "swapArgs"; + }; }; }, ]; }, { name: "crankThatTwap"; + discriminator: [220, 100, 25, 249, 0, 92, 195, 193]; accounts: [ { name: "amm"; - isMut: true; - isSigner: false; + writable: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; @@ -294,62 +264,126 @@ export type Amm = { 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"; - }, - ]; - }; + discriminator: [143, 245, 200, 17, 74, 214, 196, 135]; + }, + ]; + events: [ + { + name: "swapEvent"; + discriminator: [64, 198, 205, 232, 38, 8, 113, 226]; + }, + { + name: "addLiquidityEvent"; + discriminator: [27, 178, 153, 186, 47, 196, 140, 45]; + }, + { + name: "removeLiquidityEvent"; + discriminator: [141, 199, 182, 123, 159, 94, 215, 102]; + }, + { + name: "createAmmEvent"; + discriminator: [87, 213, 21, 39, 67, 210, 139, 177]; + }, + { + name: "crankThatTwapEvent"; + discriminator: [151, 40, 1, 219, 150, 58, 199, 212]; + }, + ]; + 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"; }, ]; types: [ { - name: "CommonFields"; + name: "commonFields"; type: { kind: "struct"; fields: [ @@ -363,11 +397,11 @@ export type Amm = { }, { name: "user"; - type: "publicKey"; + type: "pubkey"; }, { name: "amm"; - type: "publicKey"; + type: "pubkey"; }, { name: "postBaseReserves"; @@ -397,7 +431,7 @@ export type Amm = { }; }, { - name: "AddLiquidityArgs"; + name: "addLiquidityArgs"; type: { kind: "struct"; fields: [ @@ -420,7 +454,7 @@ export type Amm = { }; }, { - name: "CreateAmmArgs"; + name: "createAmmArgs"; type: { kind: "struct"; fields: [ @@ -440,7 +474,7 @@ export type Amm = { }; }, { - name: "RemoveLiquidityArgs"; + name: "removeLiquidityArgs"; type: { kind: "struct"; fields: [ @@ -460,14 +494,16 @@ export type Amm = { }; }, { - name: "SwapArgs"; + name: "swapArgs"; type: { kind: "struct"; fields: [ { name: "swapType"; type: { - defined: "SwapType"; + defined: { + name: "swapType"; + }; }; }, { @@ -482,7 +518,7 @@ export type Amm = { }; }, { - name: "TwapOracle"; + name: "twapOracle"; type: { kind: "struct"; fields: [ @@ -550,1098 +586,238 @@ export type Amm = { }; }, { - name: "SwapType"; + name: "swapType"; type: { kind: "enum"; variants: [ { - name: "Buy"; + name: "buy"; }, { - name: "Sell"; + 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: "amm"; + type: { + kind: "struct"; + fields: [ + { + name: "bump"; + type: "u8"; + }, + { + name: "createdAtSlot"; + type: "u64"; + }, + { + name: "lpMint"; + type: "pubkey"; + }, + { + name: "baseMint"; + type: "pubkey"; + }, + { + name: "quoteMint"; + type: "pubkey"; + }, + { + name: "baseMintDecimals"; + type: "u8"; + }, + { + name: "quoteMintDecimals"; + type: "u8"; + }, + { + name: "baseAmount"; + type: "u64"; + }, + { + name: "quoteAmount"; + type: "u64"; + }, + { + name: "oracle"; + type: { + defined: { + name: "twapOracle"; + }; + }; + }, + { + name: "seqNum"; + type: "u64"; + }, + ]; + }; }, { - 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: "swapEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "inputAmount"; + type: "u64"; + }, + { + name: "outputAmount"; + type: "u64"; + }, + { + name: "swapType"; + type: { + defined: { + name: "swapType"; + }; + }; + }, + ]; + }; }, { - 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.4.1", - 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", + name: "addLiquidityEvent"; type: { - kind: "struct", + 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", + name: "common"; type: { - defined: "TwapOracle", - }, - }, - { - name: "seqNum", - type: "u64", - }, - ], - }, - }, - ], - 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", + defined: { + name: "commonFields"; + }; + }; }, { - name: "oracleAggregator", - type: "u128", + name: "quoteAmount"; + type: "u64"; }, { - name: "seqNum", - type: "u64", + name: "maxBaseAmount"; + type: "u64"; }, - ], - }, - }, - { - name: "AddLiquidityArgs", - type: { - kind: "struct", - fields: [ { - name: "quoteAmount", - docs: ["How much quote token you will deposit to the pool"], - type: "u64", + name: "minLpTokens"; + type: "u64"; }, { - name: "maxBaseAmount", - docs: ["The maximum base token you will deposit to the pool"], - type: "u64", + name: "baseAmount"; + type: "u64"; }, { - name: "minLpTokens", - docs: ["The minimum LP token you will get back"], - type: "u64", + name: "lpTokensMinted"; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "CreateAmmArgs", + name: "removeLiquidityEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "twapInitialObservation", - type: "u128", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "twapMaxObservationChangePerUpdate", - type: "u128", + name: "lpTokensBurned"; + type: "u64"; }, { - name: "twapStartDelaySlots", - type: "u64", + name: "minQuoteAmount"; + type: "u64"; }, - ], - }, - }, - { - name: "RemoveLiquidityArgs", - type: { - kind: "struct", - fields: [ { - name: "lpTokensToBurn", - type: "u64", + name: "minBaseAmount"; + type: "u64"; }, { - name: "minQuoteAmount", - type: "u64", + name: "baseAmount"; + type: "u64"; }, { - name: "minBaseAmount", - type: "u64", + name: "quoteAmount"; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "SwapArgs", + name: "createAmmEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "swapType", + name: "common"; type: { - defined: "SwapType", - }, - }, - { - name: "inputAmount", - type: "u64", - }, - { - name: "outputAmountMin", - type: "u64", + defined: { + name: "commonFields"; + }; + }; }, - ], - }, - }, - { - name: "TwapOracle", - type: { - kind: "struct", - fields: [ { - name: "lastUpdatedSlot", - type: "u64", + name: "twapInitialObservation"; + type: "u128"; }, { - 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: "twapMaxObservationChangePerUpdate"; + 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: "lpMint"; + type: "pubkey"; }, { - 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: "baseMint"; + type: "pubkey"; }, { - name: "maxObservationChangePerUpdate", - docs: ["The most that an observation can change per update."], - type: "u128", + name: "quoteMint"; + type: "pubkey"; }, { - name: "initialObservation", - docs: ["What the initial `latest_observation` is set to."], - type: "u128", + name: "vaultAtaBase"; + type: "pubkey"; }, { - name: "startDelaySlots", - docs: [ - "Number of slots after amm.created_at_slot to start recording TWAP", - ], - type: "u64", + name: "vaultAtaQuote"; + type: "pubkey"; }, - ], - }, + ]; + }; }, { - name: "SwapType", + name: "crankThatTwapEvent"; type: { - kind: "enum", - variants: [ - { - name: "Buy", - }, + kind: "struct"; + fields: [ { - 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", + name: "common"; + type: { + defined: { + name: "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/amm/v0.4/types/index.ts b/sdk/src/amm/v0.4/types/index.ts index 5313bb6dd..c1153af51 100644 --- a/sdk/src/amm/v0.4/types/index.ts +++ b/sdk/src/amm/v0.4/types/index.ts @@ -1,16 +1,18 @@ -import { Amm as AmmProgram, IDL as AmmIDL } from "./amm.js"; -export { AmmProgram, AmmIDL }; +import type { Amm as AmmProgram } from "./amm.js"; +import ammIdl from "./amm.json" with { type: "json" }; +export type { AmmProgram }; +export const AmmIDL = ammIdl as AmmProgram; -import type { IdlAccounts, IdlEvents } from "@coral-xyz/anchor"; +import type { IdlAccounts, IdlEvents } from "@anchor-lang/core"; export type Amm = IdlAccounts["amm"]; -export type SwapEvent = IdlEvents["SwapEvent"]; -export type AddLiquidityEvent = IdlEvents["AddLiquidityEvent"]; +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"]; + IdlEvents["removeLiquidityEvent"]; +export type CreateAmmEvent = IdlEvents["createAmmEvent"]; +export type CrankThatTwapEvent = IdlEvents["crankThatTwapEvent"]; export type AmmEvent = | SwapEvent | AddLiquidityEvent diff --git a/sdk/src/amm/v0.5/AmmClient.ts b/sdk/src/amm/v0.5/AmmClient.ts index 55217368f..37ab21f3e 100644 --- a/sdk/src/amm/v0.5/AmmClient.ts +++ b/sdk/src/amm/v0.5/AmmClient.ts @@ -1,4 +1,4 @@ -import { AnchorProvider, IdlTypes, Program } from "@coral-xyz/anchor"; +import { AnchorProvider, IdlTypes, Program } from "@anchor-lang/core"; import { AccountInfo, AddressLookupTableAccount, @@ -6,7 +6,7 @@ import { PublicKey, } from "@solana/web3.js"; -import { Amm as AmmIDLType, IDL as AmmIDL } from "./types/amm.js"; +import { AmmProgram as AmmIDLType, AmmIDL } from "./types/index.js"; import BN from "bn.js"; import { AMM_V0_5_PROGRAM_ID } from "../../constants.js"; @@ -21,7 +21,7 @@ import { } from "@solana/spl-token"; import { AmmMath, PriceMath } from "../../priceMath.js"; -export type SwapType = LowercaseKeys["SwapType"]>; +export type SwapType = LowercaseKeys["swapType"]>; export type CreateAmmClientParams = { provider: AnchorProvider; @@ -39,7 +39,10 @@ export class AmmClient { luts: AddressLookupTableAccount[], ) { this.provider = provider; - this.program = new Program(AmmIDL, ammProgramId, provider); + this.program = new Program( + { ...AmmIDL, address: ammProgramId.toBase58() }, + provider, + ); this.luts = luts; } @@ -130,7 +133,7 @@ export class AmmClient { twapMaxObservationChangePerUpdate, twapStartDelaySlots, }) - .accounts({ + .accountsPartial({ user: this.provider.publicKey, amm, lpMint, @@ -237,7 +240,7 @@ export class AmmClient { maxBaseAmount, minLpTokens, }) - .accounts({ + .accountsPartial({ user, amm, lpMint, @@ -273,7 +276,7 @@ export class AmmClient { minBaseAmount, minQuoteAmount, }) - .accounts({ + .accountsPartial({ user: this.provider.publicKey, amm: ammAddr, lpMint, @@ -345,7 +348,7 @@ export class AmmClient { inputAmount, outputAmountMin, }) - .accounts({ + .accountsPartial({ user, amm, userBaseAccount: getAssociatedTokenAddressSync(baseMint, user, true), @@ -369,7 +372,7 @@ export class AmmClient { } crankThatTwapIx(amm: PublicKey) { - return this.program.methods.crankThatTwap().accounts({ + return this.program.methods.crankThatTwap().accountsPartial({ amm, }); } diff --git a/sdk/src/amm/v0.5/pda.ts b/sdk/src/amm/v0.5/pda.ts index 24f861c6b..fe38ebedf 100644 --- a/sdk/src/amm/v0.5/pda.ts +++ b/sdk/src/amm/v0.5/pda.ts @@ -1,5 +1,5 @@ import { PublicKey } from "@solana/web3.js"; -import { utils } from "@coral-xyz/anchor"; +import { utils } from "@anchor-lang/core"; import { AMM_V0_5_PROGRAM_ID } from "../../constants.js"; export const getAmmAddr = ( diff --git a/sdk/src/amm/v0.5/types/amm.json b/sdk/src/amm/v0.5/types/amm.json new file mode 100644 index 000000000..0595725b9 --- /dev/null +++ b/sdk/src/amm/v0.5/types/amm.json @@ -0,0 +1,933 @@ +{ + "address": "AMMJdEiCCa8mdugg6JPF7gFirmmxisTfDJoSNSUi5zDJ", + "metadata": { + "name": "amm", + "version": "0.5.0", + "spec": "0.1.0" + }, + "instructions": [ + { + "name": "create_amm", + "discriminator": [ + 242, + 91, + 21, + 170, + 5, + 68, + 125, + 64 + ], + "accounts": [ + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "amm", + "writable": true + }, + { + "name": "lp_mint", + "writable": true + }, + { + "name": "base_mint" + }, + { + "name": "quote_mint" + }, + { + "name": "vault_ata_base", + "writable": true + }, + { + "name": "vault_ata_quote", + "writable": true + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "CreateAmmArgs" + } + } + } + ] + }, + { + "name": "add_liquidity", + "discriminator": [ + 181, + 157, + 89, + 67, + 143, + 182, + 52, + 72 + ], + "accounts": [ + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "amm", + "writable": true + }, + { + "name": "lp_mint", + "writable": true + }, + { + "name": "user_lp_account", + "writable": true + }, + { + "name": "user_base_account", + "writable": true + }, + { + "name": "user_quote_account", + "writable": true + }, + { + "name": "vault_ata_base", + "writable": true + }, + { + "name": "vault_ata_quote", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "AddLiquidityArgs" + } + } + } + ] + }, + { + "name": "remove_liquidity", + "discriminator": [ + 80, + 85, + 209, + 72, + 24, + 206, + 177, + 108 + ], + "accounts": [ + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "amm", + "writable": true + }, + { + "name": "lp_mint", + "writable": true + }, + { + "name": "user_lp_account", + "writable": true + }, + { + "name": "user_base_account", + "writable": true + }, + { + "name": "user_quote_account", + "writable": true + }, + { + "name": "vault_ata_base", + "writable": true + }, + { + "name": "vault_ata_quote", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "RemoveLiquidityArgs" + } + } + } + ] + }, + { + "name": "swap", + "discriminator": [ + 248, + 198, + 158, + 145, + 225, + 117, + 135, + 200 + ], + "accounts": [ + { + "name": "user", + "writable": true, + "signer": true + }, + { + "name": "amm", + "writable": true + }, + { + "name": "user_base_account", + "writable": true + }, + { + "name": "user_quote_account", + "writable": true + }, + { + "name": "vault_ata_base", + "writable": true + }, + { + "name": "vault_ata_quote", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "SwapArgs" + } + } + } + ] + }, + { + "name": "crank_that_twap", + "discriminator": [ + 220, + 100, + 25, + 249, + 0, + 92, + 195, + 193 + ], + "accounts": [ + { + "name": "amm", + "writable": true + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + } + ], + "accounts": [ + { + "name": "Amm", + "discriminator": [ + 143, + 245, + 200, + 17, + 74, + 214, + 196, + 135 + ] + } + ], + "events": [ + { + "name": "SwapEvent", + "discriminator": [ + 64, + 198, + 205, + 232, + 38, + 8, + 113, + 226 + ] + }, + { + "name": "AddLiquidityEvent", + "discriminator": [ + 27, + 178, + 153, + 186, + 47, + 196, + 140, + 45 + ] + }, + { + "name": "RemoveLiquidityEvent", + "discriminator": [ + 141, + 199, + 182, + 123, + 159, + 94, + 215, + 102 + ] + }, + { + "name": "CreateAmmEvent", + "discriminator": [ + 87, + 213, + 21, + 39, + 67, + 210, + 139, + 177 + ] + }, + { + "name": "CrankThatTwapEvent", + "discriminator": [ + 151, + 40, + 1, + 219, + 150, + 58, + 199, + 212 + ] + } + ], + "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" + } + ], + "types": [ + { + "name": "CommonFields", + "type": { + "kind": "struct", + "fields": [ + { + "name": "slot", + "type": "u64" + }, + { + "name": "unix_timestamp", + "type": "i64" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "amm", + "type": "pubkey" + }, + { + "name": "post_base_reserves", + "type": "u64" + }, + { + "name": "post_quote_reserves", + "type": "u64" + }, + { + "name": "oracle_last_price", + "type": "u128" + }, + { + "name": "oracle_last_observation", + "type": "u128" + }, + { + "name": "oracle_aggregator", + "type": "u128" + }, + { + "name": "seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "AddLiquidityArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "quote_amount", + "docs": [ + "How much quote token you will deposit to the pool" + ], + "type": "u64" + }, + { + "name": "max_base_amount", + "docs": [ + "The maximum base token you will deposit to the pool" + ], + "type": "u64" + }, + { + "name": "min_lp_tokens", + "docs": [ + "The minimum LP token you will get back" + ], + "type": "u64" + } + ] + } + }, + { + "name": "CreateAmmArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "twap_initial_observation", + "type": "u128" + }, + { + "name": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "twap_start_delay_slots", + "type": "u64" + } + ] + } + }, + { + "name": "RemoveLiquidityArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "lp_tokens_to_burn", + "type": "u64" + }, + { + "name": "min_quote_amount", + "type": "u64" + }, + { + "name": "min_base_amount", + "type": "u64" + } + ] + } + }, + { + "name": "SwapArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "swap_type", + "type": { + "defined": { + "name": "SwapType" + } + } + }, + { + "name": "input_amount", + "type": "u64" + }, + { + "name": "output_amount_min", + "type": "u64" + } + ] + } + }, + { + "name": "TwapOracle", + "type": { + "kind": "struct", + "fields": [ + { + "name": "last_updated_slot", + "type": "u64" + }, + { + "name": "last_price", + "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": "last_observation", + "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": "max_observation_change_per_update", + "docs": [ + "The most that an observation can change per update." + ], + "type": "u128" + }, + { + "name": "initial_observation", + "docs": [ + "What the initial `latest_observation` is set to." + ], + "type": "u128" + }, + { + "name": "start_delay_slots", + "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" + } + ] + } + }, + { + "name": "Amm", + "type": { + "kind": "struct", + "fields": [ + { + "name": "bump", + "type": "u8" + }, + { + "name": "created_at_slot", + "type": "u64" + }, + { + "name": "lp_mint", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "base_mint_decimals", + "type": "u8" + }, + { + "name": "quote_mint_decimals", + "type": "u8" + }, + { + "name": "base_amount", + "type": "u64" + }, + { + "name": "quote_amount", + "type": "u64" + }, + { + "name": "oracle", + "type": { + "defined": { + "name": "TwapOracle" + } + } + }, + { + "name": "seq_num", + "type": "u64" + }, + { + "name": "vault_ata_base", + "type": "pubkey" + }, + { + "name": "vault_ata_quote", + "type": "pubkey" + } + ] + } + }, + { + "name": "SwapEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "input_amount", + "type": "u64" + }, + { + "name": "output_amount", + "type": "u64" + }, + { + "name": "swap_type", + "type": { + "defined": { + "name": "SwapType" + } + } + } + ] + } + }, + { + "name": "AddLiquidityEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "quote_amount", + "type": "u64" + }, + { + "name": "max_base_amount", + "type": "u64" + }, + { + "name": "min_lp_tokens", + "type": "u64" + }, + { + "name": "base_amount", + "type": "u64" + }, + { + "name": "lp_tokens_minted", + "type": "u64" + } + ] + } + }, + { + "name": "RemoveLiquidityEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "lp_tokens_burned", + "type": "u64" + }, + { + "name": "min_quote_amount", + "type": "u64" + }, + { + "name": "min_base_amount", + "type": "u64" + }, + { + "name": "base_amount", + "type": "u64" + }, + { + "name": "quote_amount", + "type": "u64" + } + ] + } + }, + { + "name": "CreateAmmEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "twap_initial_observation", + "type": "u128" + }, + { + "name": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "lp_mint", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "vault_ata_base", + "type": "pubkey" + }, + { + "name": "vault_ata_quote", + "type": "pubkey" + } + ] + } + }, + { + "name": "CrankThatTwapEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + } + ] + } + } + ] +} \ No newline at end of file diff --git a/sdk/src/amm/v0.5/types/amm.ts b/sdk/src/amm/v0.5/types/amm.ts index 6d36be8d8..77cab05e8 100644 --- a/sdk/src/amm/v0.5/types/amm.ts +++ b/sdk/src/amm/v0.5/types/amm.ts @@ -1,291 +1,261 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL was converted from the legacy format with `anchor idl convert` and lives in + * the `.json` file next to this one. + */ export type Amm = { - version: "0.5.0"; - name: "amm"; + address: "AMMJdEiCCa8mdugg6JPF7gFirmmxisTfDJoSNSUi5zDJ"; + metadata: { + name: "amm"; + version: "0.5.0"; + spec: "0.1.0"; + }; instructions: [ { name: "createAmm"; + discriminator: [242, 91, 21, 170, 5, 68, 125, 64]; accounts: [ { name: "user"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "amm"; - isMut: true; - isSigner: false; + writable: true; }, { name: "lpMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "baseMint"; - isMut: false; - isSigner: false; }, { name: "quoteMint"; - isMut: false; - isSigner: false; }, { name: "vaultAtaBase"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultAtaQuote"; - isMut: true; - isSigner: false; + writable: true; }, { name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "args"; type: { - defined: "CreateAmmArgs"; + defined: { + name: "createAmmArgs"; + }; }; }, ]; }, { name: "addLiquidity"; + discriminator: [181, 157, 89, 67, 143, 182, 52, 72]; accounts: [ { name: "user"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "amm"; - isMut: true; - isSigner: false; + writable: true; }, { name: "lpMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userLpAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userBaseAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultAtaBase"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultAtaQuote"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "args"; type: { - defined: "AddLiquidityArgs"; + defined: { + name: "addLiquidityArgs"; + }; }; }, ]; }, { name: "removeLiquidity"; + discriminator: [80, 85, 209, 72, 24, 206, 177, 108]; accounts: [ { name: "user"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "amm"; - isMut: true; - isSigner: false; + writable: true; }, { name: "lpMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userLpAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userBaseAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultAtaBase"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultAtaQuote"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "args"; type: { - defined: "RemoveLiquidityArgs"; + defined: { + name: "removeLiquidityArgs"; + }; }; }, ]; }, { name: "swap"; + discriminator: [248, 198, 158, 145, 225, 117, 135, 200]; accounts: [ { name: "user"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "amm"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userBaseAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultAtaBase"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultAtaQuote"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "args"; type: { - defined: "SwapArgs"; + defined: { + name: "swapArgs"; + }; }; }, ]; }, { name: "crankThatTwap"; + discriminator: [220, 100, 25, 249, 0, 92, 195, 193]; accounts: [ { name: "amm"; - isMut: true; - isSigner: false; + writable: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; @@ -294,70 +264,126 @@ export type Amm = { 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"; - }, - ]; - }; + discriminator: [143, 245, 200, 17, 74, 214, 196, 135]; + }, + ]; + events: [ + { + name: "swapEvent"; + discriminator: [64, 198, 205, 232, 38, 8, 113, 226]; + }, + { + name: "addLiquidityEvent"; + discriminator: [27, 178, 153, 186, 47, 196, 140, 45]; + }, + { + name: "removeLiquidityEvent"; + discriminator: [141, 199, 182, 123, 159, 94, 215, 102]; + }, + { + name: "createAmmEvent"; + discriminator: [87, 213, 21, 39, 67, 210, 139, 177]; + }, + { + name: "crankThatTwapEvent"; + discriminator: [151, 40, 1, 219, 150, 58, 199, 212]; + }, + ]; + 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"; }, ]; types: [ { - name: "CommonFields"; + name: "commonFields"; type: { kind: "struct"; fields: [ @@ -371,11 +397,11 @@ export type Amm = { }, { name: "user"; - type: "publicKey"; + type: "pubkey"; }, { name: "amm"; - type: "publicKey"; + type: "pubkey"; }, { name: "postBaseReserves"; @@ -405,7 +431,7 @@ export type Amm = { }; }, { - name: "AddLiquidityArgs"; + name: "addLiquidityArgs"; type: { kind: "struct"; fields: [ @@ -428,7 +454,7 @@ export type Amm = { }; }, { - name: "CreateAmmArgs"; + name: "createAmmArgs"; type: { kind: "struct"; fields: [ @@ -448,7 +474,7 @@ export type Amm = { }; }, { - name: "RemoveLiquidityArgs"; + name: "removeLiquidityArgs"; type: { kind: "struct"; fields: [ @@ -468,14 +494,16 @@ export type Amm = { }; }, { - name: "SwapArgs"; + name: "swapArgs"; type: { kind: "struct"; fields: [ { name: "swapType"; type: { - defined: "SwapType"; + defined: { + name: "swapType"; + }; }; }, { @@ -490,7 +518,7 @@ export type Amm = { }; }, { - name: "TwapOracle"; + name: "twapOracle"; type: { kind: "struct"; fields: [ @@ -558,1106 +586,246 @@ export type Amm = { }; }, { - name: "SwapType"; + name: "swapType"; type: { kind: "enum"; variants: [ { - name: "Buy"; + name: "buy"; }, { - name: "Sell"; + 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: "amm"; + type: { + kind: "struct"; + fields: [ + { + name: "bump"; + type: "u8"; + }, + { + name: "createdAtSlot"; + type: "u64"; + }, + { + name: "lpMint"; + type: "pubkey"; + }, + { + name: "baseMint"; + type: "pubkey"; + }, + { + name: "quoteMint"; + type: "pubkey"; + }, + { + name: "baseMintDecimals"; + type: "u8"; + }, + { + name: "quoteMintDecimals"; + type: "u8"; + }, + { + name: "baseAmount"; + type: "u64"; + }, + { + name: "quoteAmount"; + type: "u64"; + }, + { + name: "oracle"; + type: { + defined: { + name: "twapOracle"; + }; + }; + }, + { + name: "seqNum"; + type: "u64"; + }, + { + name: "vaultAtaBase"; + type: "pubkey"; + }, + { + name: "vaultAtaQuote"; + type: "pubkey"; + }, + ]; + }; }, { - 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: "swapEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "inputAmount"; + type: "u64"; + }, + { + name: "outputAmount"; + type: "u64"; + }, + { + name: "swapType"; + type: { + defined: { + name: "swapType"; + }; + }; + }, + ]; + }; }, { - 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", + name: "addLiquidityEvent"; type: { - kind: "struct", + 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", + name: "common"; 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", + defined: { + name: "commonFields"; + }; + }; }, { - name: "oracleAggregator", - type: "u128", + name: "quoteAmount"; + type: "u64"; }, { - name: "seqNum", - type: "u64", + name: "maxBaseAmount"; + type: "u64"; }, - ], - }, - }, - { - name: "AddLiquidityArgs", - type: { - kind: "struct", - fields: [ { - name: "quoteAmount", - docs: ["How much quote token you will deposit to the pool"], - type: "u64", + name: "minLpTokens"; + type: "u64"; }, { - name: "maxBaseAmount", - docs: ["The maximum base token you will deposit to the pool"], - type: "u64", + name: "baseAmount"; + type: "u64"; }, { - name: "minLpTokens", - docs: ["The minimum LP token you will get back"], - type: "u64", + name: "lpTokensMinted"; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "CreateAmmArgs", + name: "removeLiquidityEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "twapInitialObservation", - type: "u128", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "twapMaxObservationChangePerUpdate", - type: "u128", + name: "lpTokensBurned"; + type: "u64"; }, { - name: "twapStartDelaySlots", - type: "u64", + name: "minQuoteAmount"; + type: "u64"; }, - ], - }, - }, - { - name: "RemoveLiquidityArgs", - type: { - kind: "struct", - fields: [ { - name: "lpTokensToBurn", - type: "u64", + name: "minBaseAmount"; + type: "u64"; }, { - name: "minQuoteAmount", - type: "u64", + name: "baseAmount"; + type: "u64"; }, { - name: "minBaseAmount", - type: "u64", + name: "quoteAmount"; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "SwapArgs", + name: "createAmmEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "swapType", + name: "common"; type: { - defined: "SwapType", - }, - }, - { - name: "inputAmount", - type: "u64", + defined: { + name: "commonFields"; + }; + }; }, { - name: "outputAmountMin", - type: "u64", - }, - ], - }, - }, - { - name: "TwapOracle", - type: { - kind: "struct", - fields: [ - { - name: "lastUpdatedSlot", - type: "u64", + name: "twapInitialObservation"; + type: "u128"; }, { - 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: "twapMaxObservationChangePerUpdate"; + 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: "lpMint"; + type: "pubkey"; }, { - 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: "baseMint"; + type: "pubkey"; }, { - name: "maxObservationChangePerUpdate", - docs: ["The most that an observation can change per update."], - type: "u128", + name: "quoteMint"; + type: "pubkey"; }, { - name: "initialObservation", - docs: ["What the initial `latest_observation` is set to."], - type: "u128", + name: "vaultAtaBase"; + type: "pubkey"; }, { - name: "startDelaySlots", - docs: [ - "Number of slots after amm.created_at_slot to start recording TWAP", - ], - type: "u64", + name: "vaultAtaQuote"; + type: "pubkey"; }, - ], - }, + ]; + }; }, { - name: "SwapType", + name: "crankThatTwapEvent"; type: { - kind: "enum", - variants: [ - { - name: "Buy", - }, + kind: "struct"; + fields: [ { - 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", + name: "common"; + type: { + defined: { + name: "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/amm/v0.5/types/index.ts b/sdk/src/amm/v0.5/types/index.ts index 5313bb6dd..c1153af51 100644 --- a/sdk/src/amm/v0.5/types/index.ts +++ b/sdk/src/amm/v0.5/types/index.ts @@ -1,16 +1,18 @@ -import { Amm as AmmProgram, IDL as AmmIDL } from "./amm.js"; -export { AmmProgram, AmmIDL }; +import type { Amm as AmmProgram } from "./amm.js"; +import ammIdl from "./amm.json" with { type: "json" }; +export type { AmmProgram }; +export const AmmIDL = ammIdl as AmmProgram; -import type { IdlAccounts, IdlEvents } from "@coral-xyz/anchor"; +import type { IdlAccounts, IdlEvents } from "@anchor-lang/core"; export type Amm = IdlAccounts["amm"]; -export type SwapEvent = IdlEvents["SwapEvent"]; -export type AddLiquidityEvent = IdlEvents["AddLiquidityEvent"]; +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"]; + IdlEvents["removeLiquidityEvent"]; +export type CreateAmmEvent = IdlEvents["createAmmEvent"]; +export type CrankThatTwapEvent = IdlEvents["crankThatTwapEvent"]; export type AmmEvent = | SwapEvent | AddLiquidityEvent diff --git a/sdk/src/autocrat/v0.3/AutocratClient.ts b/sdk/src/autocrat/v0.3/AutocratClient.ts index ad058f541..28a20b0ed 100644 --- a/sdk/src/autocrat/v0.3/AutocratClient.ts +++ b/sdk/src/autocrat/v0.3/AutocratClient.ts @@ -1,4 +1,4 @@ -import { AnchorProvider, Program } from "@coral-xyz/anchor"; +import { AnchorProvider, Program } from "@anchor-lang/core"; import { AccountMeta, AddressLookupTableAccount, @@ -10,9 +10,9 @@ import { } from "@solana/web3.js"; import { PriceMath } from "../../priceMath.js"; import { - Autocrat as AutocratIDLType, - IDL as AutocratIDL, -} from "./types/autocrat.js"; + AutocratProgram as AutocratIDLType, + AutocratIDL, +} from "./types/index.js"; import { Dao, InitializeDaoParams, @@ -73,8 +73,7 @@ export class AutocratClient { ) { this.provider = provider; this.autocrat = new Program( - AutocratIDL, - autocratProgramId, + { ...AutocratIDL, address: autocratProgramId.toBase58() }, provider, ); this.vaultClient = ConditionalVaultClient.createClient({ @@ -244,7 +243,7 @@ export class AutocratClient { ) { return this.autocrat.methods .initializeDao(params) - .accounts({ + .accountsPartial({ dao: daoKeypair.publicKey, tokenMint, usdcMint, @@ -540,7 +539,7 @@ export class AutocratClient { failLpTokensToLock, nonce, }) - .accounts({ + .accountsPartial({ proposal, dao, baseVault, @@ -616,7 +615,7 @@ export class AutocratClient { failAmm, ); - return this.autocrat.methods.finalizeProposal().accounts({ + return this.autocrat.methods.finalizeProposal().accountsPartial({ proposal, passAmm, failAmm, @@ -654,7 +653,7 @@ export class AutocratClient { const [daoTreasury] = getDaoTreasuryAddr(this.autocrat.programId, dao); return this.autocrat.methods .executeProposal() - .accounts({ + .accountsPartial({ proposal, dao, }) diff --git a/sdk/src/autocrat/v0.3/pda.ts b/sdk/src/autocrat/v0.3/pda.ts index 1b1f01bc7..b7be2f32a 100644 --- a/sdk/src/autocrat/v0.3/pda.ts +++ b/sdk/src/autocrat/v0.3/pda.ts @@ -1,5 +1,5 @@ import { PublicKey } from "@solana/web3.js"; -import { utils } from "@coral-xyz/anchor"; +import { utils } from "@anchor-lang/core"; import BN from "bn.js"; import { AUTOCRAT_V0_3_PROGRAM_ID } from "../../constants.js"; diff --git a/sdk/src/autocrat/v0.3/types/autocrat.json b/sdk/src/autocrat/v0.3/types/autocrat.json new file mode 100644 index 000000000..c64e9ced1 --- /dev/null +++ b/sdk/src/autocrat/v0.3/types/autocrat.json @@ -0,0 +1,677 @@ +{ + "address": "autoQP9RmUNkzzKRXsMkWicDVZ3h29vvyMDcAYjCxxg", + "metadata": { + "name": "autocrat", + "version": "0.3.0", + "spec": "0.1.0" + }, + "instructions": [ + { + "name": "initialize_dao", + "discriminator": [ + 128, + 226, + 96, + 90, + 39, + 56, + 24, + 196 + ], + "accounts": [ + { + "name": "dao", + "writable": true, + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_mint" + }, + { + "name": "usdc_mint" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "InitializeDaoParams" + } + } + } + ] + }, + { + "name": "initialize_proposal", + "discriminator": [ + 50, + 73, + 156, + 98, + 129, + 149, + 21, + 158 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "dao", + "writable": true + }, + { + "name": "quote_vault" + }, + { + "name": "base_vault" + }, + { + "name": "pass_amm" + }, + { + "name": "pass_lp_mint" + }, + { + "name": "fail_lp_mint" + }, + { + "name": "fail_amm" + }, + { + "name": "pass_lp_user_account", + "writable": true + }, + { + "name": "fail_lp_user_account", + "writable": true + }, + { + "name": "pass_lp_vault_account", + "writable": true + }, + { + "name": "fail_lp_vault_account", + "writable": true + }, + { + "name": "proposer", + "writable": true, + "signer": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "InitializeProposalParams" + } + } + } + ] + }, + { + "name": "finalize_proposal", + "discriminator": [ + 23, + 68, + 51, + 167, + 109, + 173, + 187, + 164 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "pass_amm" + }, + { + "name": "fail_amm" + }, + { + "name": "dao" + }, + { + "name": "base_vault", + "writable": true + }, + { + "name": "quote_vault", + "writable": true + }, + { + "name": "treasury" + }, + { + "name": "pass_lp_user_account", + "writable": true + }, + { + "name": "fail_lp_user_account", + "writable": true + }, + { + "name": "pass_lp_vault_account", + "writable": true + }, + { + "name": "fail_lp_vault_account", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "vault_program" + } + ], + "args": [] + }, + { + "name": "execute_proposal", + "discriminator": [ + 186, + 60, + 116, + 133, + 108, + 128, + 111, + 28 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "dao" + } + ], + "args": [] + }, + { + "name": "update_dao", + "discriminator": [ + 131, + 72, + 75, + 25, + 112, + 210, + 109, + 2 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "treasury", + "signer": true + } + ], + "args": [ + { + "name": "dao_params", + "type": { + "defined": { + "name": "UpdateDaoParams" + } + } + } + ] + } + ], + "accounts": [ + { + "name": "Dao", + "discriminator": [ + 163, + 9, + 47, + 31, + 52, + 85, + 197, + 49 + ] + }, + { + "name": "Proposal", + "discriminator": [ + 26, + 94, + 189, + 187, + 116, + 136, + 53, + 33 + ] + } + ], + "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": "InvalidSettlementAuthority", + "msg": "One of the vaults has an invalid `settlement_authority`" + }, + { + "code": 6004, + "name": "ProposalTooYoung", + "msg": "Proposal is too young to be executed or rejected" + }, + { + "code": 6005, + "name": "MarketsTooYoung", + "msg": "Markets too young for proposal to be finalized. TWAP might need to be cranked" + }, + { + "code": 6006, + "name": "ProposalAlreadyFinalized", + "msg": "This proposal has already been finalized" + }, + { + "code": 6007, + "name": "InvalidVaultNonce", + "msg": "A conditional vault has an invalid nonce. A nonce should encode the proposal number" + }, + { + "code": 6008, + "name": "ProposalNotPassed", + "msg": "This proposal can't be executed because it isn't in the passed state" + }, + { + "code": 6009, + "name": "InsufficientLpTokenBalance", + "msg": "The proposer has fewer pass or fail LP tokens than they requested to lock" + }, + { + "code": 6010, + "name": "InsufficientLpTokenLock", + "msg": "The LP tokens passed in have less liquidity than the DAO's `min_quote_futarchic_liquidity` or `min_base_futachic_liquidity`" + } + ], + "types": [ + { + "name": "InitializeDaoParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "twap_initial_observation", + "type": "u128" + }, + { + "name": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "min_quote_futarchic_liquidity", + "type": "u64" + }, + { + "name": "min_base_futarchic_liquidity", + "type": "u64" + }, + { + "name": "pass_threshold_bps", + "type": { + "option": "u16" + } + }, + { + "name": "slots_per_proposal", + "type": { + "option": "u64" + } + } + ] + } + }, + { + "name": "InitializeProposalParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "description_url", + "type": "string" + }, + { + "name": "instruction", + "type": { + "defined": { + "name": "ProposalInstruction" + } + } + }, + { + "name": "pass_lp_tokens_to_lock", + "type": "u64" + }, + { + "name": "fail_lp_tokens_to_lock", + "type": "u64" + }, + { + "name": "nonce", + "type": "u64" + } + ] + } + }, + { + "name": "UpdateDaoParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pass_threshold_bps", + "type": { + "option": "u16" + } + }, + { + "name": "slots_per_proposal", + "type": { + "option": "u64" + } + }, + { + "name": "twap_initial_observation", + "type": { + "option": "u128" + } + }, + { + "name": "twap_max_observation_change_per_update", + "type": { + "option": "u128" + } + }, + { + "name": "min_quote_futarchic_liquidity", + "type": { + "option": "u64" + } + }, + { + "name": "min_base_futarchic_liquidity", + "type": { + "option": "u64" + } + } + ] + } + }, + { + "name": "ProposalAccount", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pubkey", + "type": "pubkey" + }, + { + "name": "is_signer", + "type": "bool" + }, + { + "name": "is_writable", + "type": "bool" + } + ] + } + }, + { + "name": "ProposalInstruction", + "type": { + "kind": "struct", + "fields": [ + { + "name": "program_id", + "type": "pubkey" + }, + { + "name": "accounts", + "type": { + "vec": { + "defined": { + "name": "ProposalAccount" + } + } + } + }, + { + "name": "data", + "type": "bytes" + } + ] + } + }, + { + "name": "ProposalState", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Pending" + }, + { + "name": "Passed" + }, + { + "name": "Failed" + }, + { + "name": "Executed" + } + ] + } + }, + { + "name": "Dao", + "type": { + "kind": "struct", + "fields": [ + { + "name": "treasury_pda_bump", + "type": "u8" + }, + { + "name": "treasury", + "type": "pubkey" + }, + { + "name": "token_mint", + "type": "pubkey" + }, + { + "name": "usdc_mint", + "type": "pubkey" + }, + { + "name": "proposal_count", + "type": "u32" + }, + { + "name": "pass_threshold_bps", + "type": "u16" + }, + { + "name": "slots_per_proposal", + "type": "u64" + }, + { + "name": "twap_initial_observation", + "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": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "min_quote_futarchic_liquidity", + "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": "min_base_futarchic_liquidity", + "type": "u64" + } + ] + } + }, + { + "name": "Proposal", + "type": { + "kind": "struct", + "fields": [ + { + "name": "number", + "type": "u32" + }, + { + "name": "proposer", + "type": "pubkey" + }, + { + "name": "description_url", + "type": "string" + }, + { + "name": "slot_enqueued", + "type": "u64" + }, + { + "name": "state", + "type": { + "defined": { + "name": "ProposalState" + } + } + }, + { + "name": "instruction", + "type": { + "defined": { + "name": "ProposalInstruction" + } + } + }, + { + "name": "pass_amm", + "type": "pubkey" + }, + { + "name": "fail_amm", + "type": "pubkey" + }, + { + "name": "base_vault", + "type": "pubkey" + }, + { + "name": "quote_vault", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "pass_lp_tokens_locked", + "type": "u64" + }, + { + "name": "fail_lp_tokens_locked", + "type": "u64" + }, + { + "name": "nonce", + "docs": [ + "We need to include a per-proposer nonce to prevent some weird proposal", + "front-running edge cases. Using a `u64` means that proposers are unlikely", + "to run into collisions, even if they generate nonces randomly - I've run", + "the math :D" + ], + "type": "u64" + }, + { + "name": "pda_bump", + "type": "u8" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/sdk/src/autocrat/v0.3/types/autocrat.ts b/sdk/src/autocrat/v0.3/types/autocrat.ts index e39706bc1..55b2636fe 100644 --- a/sdk/src/autocrat/v0.3/types/autocrat.ts +++ b/sdk/src/autocrat/v0.3/types/autocrat.ts @@ -1,239 +1,213 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL was converted from the legacy format with `anchor idl convert` and lives in + * the `.json` file next to this one. + */ export type Autocrat = { - version: "0.3.0"; - name: "autocrat"; + address: "autoQP9RmUNkzzKRXsMkWicDVZ3h29vvyMDcAYjCxxg"; + metadata: { + name: "autocrat"; + version: "0.3.0"; + spec: "0.1.0"; + }; instructions: [ { name: "initializeDao"; + discriminator: [128, 226, 96, 90, 39, 56, 24, 196]; accounts: [ { name: "dao"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "tokenMint"; - isMut: false; - isSigner: false; }, { name: "usdcMint"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "params"; type: { - defined: "InitializeDaoParams"; + defined: { + name: "initializeDaoParams"; + }; }; }, ]; }, { name: "initializeProposal"; + discriminator: [50, 73, 156, 98, 129, 149, 21, 158]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { 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; + writable: true; }, { name: "failLpUserAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "passLpVaultAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "failLpVaultAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "proposer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, ]; args: [ { name: "params"; type: { - defined: "InitializeProposalParams"; + defined: { + name: "initializeProposalParams"; + }; }; }, ]; }, { name: "finalizeProposal"; + discriminator: [23, 68, 51, 167, 109, 173, 187, 164]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "passAmm"; - isMut: false; - isSigner: false; }, { name: "failAmm"; - isMut: false; - isSigner: false; }, { name: "dao"; - isMut: false; - isSigner: false; }, { name: "baseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "quoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "treasury"; - isMut: false; - isSigner: false; }, { name: "passLpUserAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "failLpUserAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "passLpVaultAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "failLpVaultAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "vaultProgram"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "executeProposal"; + discriminator: [186, 60, 116, 133, 108, 128, 111, 28]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "updateDao"; + discriminator: [131, 72, 75, 25, 112, 210, 109, 2]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "treasury"; - isMut: false; - isSigner: true; + signer: true; }, ]; args: [ { name: "daoParams"; type: { - defined: "UpdateDaoParams"; + defined: { + name: "updateDaoParams"; + }; }; }, ]; @@ -242,162 +216,73 @@ export type Autocrat = { accounts: [ { name: "dao"; - type: { - kind: "struct"; - fields: [ - { - name: "treasuryPdaBump"; - type: "u8"; - }, - { - name: "treasury"; - type: "publicKey"; - }, - { - name: "tokenMint"; - type: "publicKey"; - }, - { - name: "usdcMint"; - 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: "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"; - }, - ]; - }; + discriminator: [163, 9, 47, 31, 52, 85, 197, 49]; }, { 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: "instruction"; - type: { - defined: "ProposalInstruction"; - }; - }, - { - 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: "nonce"; - docs: [ - "We need to include a per-proposer nonce to prevent some weird proposal", - "front-running edge cases. Using a `u64` means that proposers are unlikely", - "to run into collisions, even if they generate nonces randomly - I've run", - "the math :D", - ]; - type: "u64"; - }, - { - name: "pdaBump"; - type: "u8"; - }, - ]; - }; + discriminator: [26, 94, 189, 187, 116, 136, 53, 33]; + }, + ]; + 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: "invalidSettlementAuthority"; + msg: "One of the vaults has an invalid `settlement_authority`"; + }, + { + code: 6004; + name: "proposalTooYoung"; + msg: "Proposal is too young to be executed or rejected"; + }, + { + code: 6005; + name: "marketsTooYoung"; + msg: "Markets too young for proposal to be finalized. TWAP might need to be cranked"; + }, + { + code: 6006; + name: "proposalAlreadyFinalized"; + msg: "This proposal has already been finalized"; + }, + { + code: 6007; + name: "invalidVaultNonce"; + msg: "A conditional vault has an invalid nonce. A nonce should encode the proposal number"; + }, + { + code: 6008; + name: "proposalNotPassed"; + msg: "This proposal can't be executed because it isn't in the passed state"; + }, + { + code: 6009; + name: "insufficientLpTokenBalance"; + msg: "The proposer has fewer pass or fail LP tokens than they requested to lock"; + }, + { + code: 6010; + name: "insufficientLpTokenLock"; + msg: "The LP tokens passed in have less liquidity than the DAO's `min_quote_futarchic_liquidity` or `min_base_futachic_liquidity`"; }, ]; types: [ { - name: "InitializeDaoParams"; + name: "initializeDaoParams"; type: { kind: "struct"; fields: [ @@ -433,7 +318,7 @@ export type Autocrat = { }; }, { - name: "InitializeProposalParams"; + name: "initializeProposalParams"; type: { kind: "struct"; fields: [ @@ -444,7 +329,9 @@ export type Autocrat = { { name: "instruction"; type: { - defined: "ProposalInstruction"; + defined: { + name: "proposalInstruction"; + }; }; }, { @@ -463,7 +350,7 @@ export type Autocrat = { }; }, { - name: "UpdateDaoParams"; + name: "updateDaoParams"; type: { kind: "struct"; fields: [ @@ -507,13 +394,13 @@ export type Autocrat = { }; }, { - name: "ProposalAccount"; + name: "proposalAccount"; type: { kind: "struct"; fields: [ { name: "pubkey"; - type: "publicKey"; + type: "pubkey"; }, { name: "isSigner"; @@ -527,19 +414,21 @@ export type Autocrat = { }; }, { - name: "ProposalInstruction"; + name: "proposalInstruction"; type: { kind: "struct"; fields: [ { name: "programId"; - type: "publicKey"; + type: "pubkey"; }, { name: "accounts"; type: { vec: { - defined: "ProposalAccount"; + defined: { + name: "proposalAccount"; + }; }; }; }, @@ -551,362 +440,60 @@ export type Autocrat = { }; }, { - name: "ProposalState"; + name: "proposalState"; type: { kind: "enum"; variants: [ { - name: "Pending"; + name: "pending"; }, { - name: "Passed"; + name: "passed"; }, { - name: "Failed"; + name: "failed"; }, { - name: "Executed"; + name: "executed"; }, ]; }; }, - ]; - 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: "InvalidSettlementAuthority"; - msg: "One of the vaults has an invalid `settlement_authority`"; - }, - { - code: 6004; - name: "ProposalTooYoung"; - msg: "Proposal is too young to be executed or rejected"; - }, - { - code: 6005; - name: "MarketsTooYoung"; - msg: "Markets too young for proposal to be finalized. TWAP might need to be cranked"; - }, - { - code: 6006; - name: "ProposalAlreadyFinalized"; - msg: "This proposal has already been finalized"; - }, - { - code: 6007; - name: "InvalidVaultNonce"; - msg: "A conditional vault has an invalid nonce. A nonce should encode the proposal number"; - }, - { - code: 6008; - name: "ProposalNotPassed"; - msg: "This proposal can't be executed because it isn't in the passed state"; - }, - { - code: 6009; - name: "InsufficientLpTokenBalance"; - msg: "The proposer has fewer pass or fail LP tokens than they requested to lock"; - }, - { - code: 6010; - name: "InsufficientLpTokenLock"; - msg: "The LP tokens passed in have less liquidity than the DAO's `min_quote_futarchic_liquidity` or `min_base_futachic_liquidity`"; - }, - ]; -}; - -export const IDL: Autocrat = { - version: "0.3.0", - name: "autocrat", - instructions: [ - { - name: "initializeDao", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: true, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenMint", - isMut: false, - isSigner: false, - }, - { - name: "usdcMint", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "InitializeDaoParams", - }, - }, - ], - }, { - name: "initializeProposal", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: true, - 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: true, - isSigner: true, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "InitializeProposalParams", - }, - }, - ], - }, - { - name: "finalizeProposal", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "passAmm", - isMut: false, - isSigner: false, - }, - { - name: "failAmm", - isMut: false, - isSigner: false, - }, - { - name: "dao", - isMut: false, - isSigner: false, - }, - { - name: "baseVault", - isMut: true, - isSigner: false, - }, - { - name: "quoteVault", - isMut: true, - isSigner: false, - }, - { - name: "treasury", - 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: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "vaultProgram", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "executeProposal", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "updateDao", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "treasury", - isMut: false, - isSigner: true, - }, - ], - args: [ - { - name: "daoParams", - type: { - defined: "UpdateDaoParams", - }, - }, - ], - }, - ], - accounts: [ - { - name: "dao", + name: "dao"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "treasuryPdaBump", - type: "u8", + name: "treasuryPdaBump"; + type: "u8"; }, { - name: "treasury", - type: "publicKey", + name: "treasury"; + type: "pubkey"; }, { - name: "tokenMint", - type: "publicKey", + name: "tokenMint"; + type: "pubkey"; }, { - name: "usdcMint", - type: "publicKey", + name: "usdcMint"; + type: "pubkey"; }, { - name: "proposalCount", - type: "u32", + name: "proposalCount"; + type: "u32"; }, { - name: "passThresholdBps", - type: "u16", + name: "passThresholdBps"; + type: "u16"; }, { - name: "slotsPerProposal", - type: "u64", + name: "slotsPerProposal"; + type: "u64"; }, { - name: "twapInitialObservation", + 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", @@ -922,15 +509,15 @@ export const IDL: Autocrat = { "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", + ]; + type: "u128"; }, { - name: "twapMaxObservationChangePerUpdate", - type: "u128", + name: "twapMaxObservationChangePerUpdate"; + type: "u128"; }, { - name: "minQuoteFutarchicLiquidity", + 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.", @@ -938,326 +525,97 @@ export const IDL: Autocrat = { "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", + ]; + type: "u64"; }, { - name: "minBaseFutarchicLiquidity", - type: "u64", + name: "minBaseFutarchicLiquidity"; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "proposal", + name: "proposal"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "number", - type: "u32", + name: "number"; + type: "u32"; }, { - name: "proposer", - type: "publicKey", + name: "proposer"; + type: "pubkey"; }, { - name: "descriptionUrl", - type: "string", + name: "descriptionUrl"; + type: "string"; }, { - name: "slotEnqueued", - type: "u64", + name: "slotEnqueued"; + type: "u64"; }, { - name: "state", + name: "state"; type: { - defined: "ProposalState", - }, + defined: { + name: "proposalState"; + }; + }; }, { - name: "instruction", + name: "instruction"; type: { - defined: "ProposalInstruction", - }, + defined: { + name: "proposalInstruction"; + }; + }; }, { - name: "passAmm", - type: "publicKey", + name: "passAmm"; + type: "pubkey"; }, { - name: "failAmm", - type: "publicKey", + name: "failAmm"; + type: "pubkey"; }, { - name: "baseVault", - type: "publicKey", + name: "baseVault"; + type: "pubkey"; }, { - name: "quoteVault", - type: "publicKey", + name: "quoteVault"; + type: "pubkey"; }, { - name: "dao", - type: "publicKey", + name: "dao"; + type: "pubkey"; }, { - name: "passLpTokensLocked", - type: "u64", + name: "passLpTokensLocked"; + type: "u64"; }, { - name: "failLpTokensLocked", - type: "u64", + name: "failLpTokensLocked"; + type: "u64"; }, { - name: "nonce", + name: "nonce"; docs: [ "We need to include a per-proposer nonce to prevent some weird proposal", "front-running edge cases. Using a `u64` means that proposers are unlikely", "to run into collisions, even if they generate nonces randomly - I've run", "the math :D", - ], - type: "u64", - }, - { - name: "pdaBump", - type: "u8", - }, - ], - }, - }, - ], - types: [ - { - name: "InitializeDaoParams", - type: { - kind: "struct", - fields: [ - { - name: "twapInitialObservation", - type: "u128", - }, - { - name: "twapMaxObservationChangePerUpdate", - type: "u128", - }, - { - name: "minQuoteFutarchicLiquidity", - type: "u64", - }, - { - name: "minBaseFutarchicLiquidity", - type: "u64", - }, - { - name: "passThresholdBps", - type: { - option: "u16", - }, - }, - { - name: "slotsPerProposal", - type: { - option: "u64", - }, - }, - ], - }, - }, - { - name: "InitializeProposalParams", - type: { - kind: "struct", - fields: [ - { - name: "descriptionUrl", - type: "string", - }, - { - name: "instruction", - type: { - defined: "ProposalInstruction", - }, - }, - { - name: "passLpTokensToLock", - type: "u64", - }, - { - name: "failLpTokensToLock", - type: "u64", - }, - { - name: "nonce", - 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: "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: "ProposalState", - type: { - kind: "enum", - variants: [ - { - name: "Pending", - }, - { - name: "Passed", - }, - { - name: "Failed", + ]; + type: "u64"; }, { - name: "Executed", + name: "pdaBump"; + type: "u8"; }, - ], - }, - }, - ], - 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: "InvalidSettlementAuthority", - msg: "One of the vaults has an invalid `settlement_authority`", - }, - { - code: 6004, - name: "ProposalTooYoung", - msg: "Proposal is too young to be executed or rejected", - }, - { - code: 6005, - name: "MarketsTooYoung", - msg: "Markets too young for proposal to be finalized. TWAP might need to be cranked", - }, - { - code: 6006, - name: "ProposalAlreadyFinalized", - msg: "This proposal has already been finalized", - }, - { - code: 6007, - name: "InvalidVaultNonce", - msg: "A conditional vault has an invalid nonce. A nonce should encode the proposal number", - }, - { - code: 6008, - name: "ProposalNotPassed", - msg: "This proposal can't be executed because it isn't in the passed state", - }, - { - code: 6009, - name: "InsufficientLpTokenBalance", - msg: "The proposer has fewer pass or fail LP tokens than they requested to lock", - }, - { - code: 6010, - name: "InsufficientLpTokenLock", - msg: "The LP tokens passed in have less liquidity than the DAO's `min_quote_futarchic_liquidity` or `min_base_futachic_liquidity`", + ]; + }; }, - ], + ]; }; diff --git a/sdk/src/autocrat/v0.3/types/index.ts b/sdk/src/autocrat/v0.3/types/index.ts index 57d628b56..1f81ee247 100644 --- a/sdk/src/autocrat/v0.3/types/index.ts +++ b/sdk/src/autocrat/v0.3/types/index.ts @@ -1,13 +1,15 @@ -import { Autocrat as AutocratProgram, IDL as AutocratIDL } from "./autocrat.js"; -export { AutocratProgram, AutocratIDL }; +import type { Autocrat as AutocratProgram } from "./autocrat.js"; +import autocratIdl from "./autocrat.json" with { type: "json" }; +export type { AutocratProgram }; +export const AutocratIDL = autocratIdl as AutocratProgram; -import type { IdlAccounts, IdlTypes } from "@coral-xyz/anchor"; +import type { IdlAccounts, IdlTypes } from "@anchor-lang/core"; export type InitializeDaoParams = - IdlTypes["InitializeDaoParams"]; -export type UpdateDaoParams = IdlTypes["UpdateDaoParams"]; + IdlTypes["initializeDaoParams"]; +export type UpdateDaoParams = IdlTypes["updateDaoParams"]; export type ProposalInstruction = - IdlTypes["ProposalInstruction"]; + IdlTypes["proposalInstruction"]; export type Dao = IdlAccounts["dao"]; export type Proposal = IdlAccounts["proposal"]; diff --git a/sdk/src/autocrat/v0.4/AutocratClient.ts b/sdk/src/autocrat/v0.4/AutocratClient.ts index 3ab6384c2..46164c39b 100644 --- a/sdk/src/autocrat/v0.4/AutocratClient.ts +++ b/sdk/src/autocrat/v0.4/AutocratClient.ts @@ -1,4 +1,4 @@ -import { AnchorProvider, IdlTypes, Program } from "@coral-xyz/anchor"; +import { AnchorProvider, IdlTypes, Program } from "@anchor-lang/core"; import { AccountInfo, AccountMeta, @@ -13,7 +13,7 @@ import { import { PriceMath } from "../../priceMath.js"; import { ProposalInstruction, InitializeDaoParams } from "./types/index.js"; -import { Autocrat, IDL as AutocratIDL } from "./types/autocrat.js"; +import { AutocratProgram as Autocrat, AutocratIDL } from "./types/index.js"; import BN from "bn.js"; import { @@ -70,8 +70,7 @@ export class AutocratClient { ) { this.provider = provider; this.autocrat = new Program( - AutocratIDL, - autocratProgramId, + { ...AutocratIDL, address: autocratProgramId.toBase58() }, provider, ); this.vaultClient = ConditionalVaultClient.createClient({ @@ -290,7 +289,7 @@ export class AutocratClient { ) { return this.autocrat.methods .initializeDao(params) - .accounts({ + .accountsPartial({ dao: daoKeypair.publicKey, tokenMint, usdcMint, @@ -602,7 +601,7 @@ export class AutocratClient { failLpTokensToLock, nonce, }) - .accounts({ + .accountsPartial({ question, proposal, dao, @@ -685,7 +684,7 @@ export class AutocratClient { const [vaultEventAuthority] = getEventAuthorityAddr(vaultProgramId); - return this.autocrat.methods.finalizeProposal().accounts({ + return this.autocrat.methods.finalizeProposal().accountsPartial({ proposal, passAmm, failAmm, @@ -725,7 +724,7 @@ export class AutocratClient { const [daoTreasury] = getDaoTreasuryAddr(this.autocrat.programId, dao); return this.autocrat.methods .executeProposal() - .accounts({ + .accountsPartial({ proposal, dao, // daoTreasury, diff --git a/sdk/src/autocrat/v0.4/pda.ts b/sdk/src/autocrat/v0.4/pda.ts index 07e8ed636..bb37a82c2 100644 --- a/sdk/src/autocrat/v0.4/pda.ts +++ b/sdk/src/autocrat/v0.4/pda.ts @@ -1,5 +1,5 @@ import { PublicKey } from "@solana/web3.js"; -import { utils } from "@coral-xyz/anchor"; +import { utils } from "@anchor-lang/core"; import BN from "bn.js"; import { AUTOCRAT_V0_4_PROGRAM_ID } from "../../constants.js"; diff --git a/sdk/src/autocrat/v0.4/types/autocrat.json b/sdk/src/autocrat/v0.4/types/autocrat.json new file mode 100644 index 000000000..85b0acbca --- /dev/null +++ b/sdk/src/autocrat/v0.4/types/autocrat.json @@ -0,0 +1,1076 @@ +{ + "address": "autowMzCbM29YXMgVG3T62Hkgo7RcyrvgQQkd54fDQL", + "metadata": { + "name": "autocrat", + "version": "0.4.2", + "spec": "0.1.0" + }, + "instructions": [ + { + "name": "initialize_dao", + "discriminator": [ + 128, + 226, + 96, + 90, + 39, + 56, + 24, + 196 + ], + "accounts": [ + { + "name": "dao", + "writable": true, + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_mint" + }, + { + "name": "usdc_mint" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "InitializeDaoParams" + } + } + } + ] + }, + { + "name": "initialize_proposal", + "discriminator": [ + 50, + 73, + 156, + 98, + 129, + 149, + 21, + 158 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "dao", + "writable": true + }, + { + "name": "question" + }, + { + "name": "quote_vault" + }, + { + "name": "base_vault" + }, + { + "name": "pass_amm" + }, + { + "name": "pass_lp_mint" + }, + { + "name": "fail_lp_mint" + }, + { + "name": "fail_amm" + }, + { + "name": "pass_lp_user_account", + "writable": true + }, + { + "name": "fail_lp_user_account", + "writable": true + }, + { + "name": "pass_lp_vault_account", + "writable": true + }, + { + "name": "fail_lp_vault_account", + "writable": true + }, + { + "name": "proposer", + "writable": true, + "signer": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "InitializeProposalParams" + } + } + } + ] + }, + { + "name": "finalize_proposal", + "discriminator": [ + 23, + 68, + 51, + 167, + 109, + 173, + 187, + 164 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "pass_amm" + }, + { + "name": "fail_amm" + }, + { + "name": "dao" + }, + { + "name": "question", + "writable": true + }, + { + "name": "treasury" + }, + { + "name": "pass_lp_user_account", + "writable": true + }, + { + "name": "fail_lp_user_account", + "writable": true + }, + { + "name": "pass_lp_vault_account", + "writable": true + }, + { + "name": "fail_lp_vault_account", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "vault_program" + }, + { + "name": "vault_event_authority" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "execute_proposal", + "discriminator": [ + 186, + 60, + 116, + 133, + 108, + 128, + 111, + 28 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "dao" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "update_dao", + "discriminator": [ + 131, + 72, + 75, + 25, + 112, + 210, + 109, + 2 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "treasury", + "signer": true + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "dao_params", + "type": { + "defined": { + "name": "UpdateDaoParams" + } + } + } + ] + } + ], + "accounts": [ + { + "name": "Dao", + "discriminator": [ + 163, + 9, + 47, + 31, + 52, + 85, + 197, + 49 + ] + }, + { + "name": "Proposal", + "discriminator": [ + 26, + 94, + 189, + 187, + 116, + 136, + 53, + 33 + ] + } + ], + "events": [ + { + "name": "InitializeDaoEvent", + "discriminator": [ + 119, + 48, + 153, + 116, + 127, + 37, + 226, + 228 + ] + }, + { + "name": "UpdateDaoEvent", + "discriminator": [ + 12, + 58, + 244, + 224, + 171, + 25, + 33, + 56 + ] + }, + { + "name": "InitializeProposalEvent", + "discriminator": [ + 141, + 56, + 246, + 192, + 168, + 254, + 64, + 111 + ] + }, + { + "name": "FinalizeProposalEvent", + "discriminator": [ + 45, + 29, + 122, + 181, + 79, + 224, + 57, + 141 + ] + }, + { + "name": "ExecuteProposalEvent", + "discriminator": [ + 153, + 12, + 41, + 73, + 206, + 114, + 248, + 233 + ] + } + ], + "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`" + } + ], + "types": [ + { + "name": "CommonFields", + "type": { + "kind": "struct", + "fields": [ + { + "name": "slot", + "type": "u64" + }, + { + "name": "unix_timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "InitializeDaoParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "twap_initial_observation", + "type": "u128" + }, + { + "name": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "twap_start_delay_slots", + "type": "u64" + }, + { + "name": "min_quote_futarchic_liquidity", + "type": "u64" + }, + { + "name": "min_base_futarchic_liquidity", + "type": "u64" + }, + { + "name": "pass_threshold_bps", + "type": { + "option": "u16" + } + }, + { + "name": "slots_per_proposal", + "type": { + "option": "u64" + } + } + ] + } + }, + { + "name": "InitializeProposalParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "description_url", + "type": "string" + }, + { + "name": "instruction", + "type": { + "defined": { + "name": "ProposalInstruction" + } + } + }, + { + "name": "pass_lp_tokens_to_lock", + "type": "u64" + }, + { + "name": "fail_lp_tokens_to_lock", + "type": "u64" + }, + { + "name": "nonce", + "type": "u64" + } + ] + } + }, + { + "name": "UpdateDaoParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pass_threshold_bps", + "type": { + "option": "u16" + } + }, + { + "name": "slots_per_proposal", + "type": { + "option": "u64" + } + }, + { + "name": "twap_initial_observation", + "type": { + "option": "u128" + } + }, + { + "name": "twap_max_observation_change_per_update", + "type": { + "option": "u128" + } + }, + { + "name": "min_quote_futarchic_liquidity", + "type": { + "option": "u64" + } + }, + { + "name": "min_base_futarchic_liquidity", + "type": { + "option": "u64" + } + } + ] + } + }, + { + "name": "ProposalAccount", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pubkey", + "type": "pubkey" + }, + { + "name": "is_signer", + "type": "bool" + }, + { + "name": "is_writable", + "type": "bool" + } + ] + } + }, + { + "name": "ProposalInstruction", + "type": { + "kind": "struct", + "fields": [ + { + "name": "program_id", + "type": "pubkey" + }, + { + "name": "accounts", + "type": { + "vec": { + "defined": { + "name": "ProposalAccount" + } + } + } + }, + { + "name": "data", + "type": "bytes" + } + ] + } + }, + { + "name": "ProposalState", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Pending" + }, + { + "name": "Passed" + }, + { + "name": "Failed" + }, + { + "name": "Executed" + } + ] + } + }, + { + "name": "Dao", + "type": { + "kind": "struct", + "fields": [ + { + "name": "treasury_pda_bump", + "type": "u8" + }, + { + "name": "treasury", + "type": "pubkey" + }, + { + "name": "token_mint", + "type": "pubkey" + }, + { + "name": "usdc_mint", + "type": "pubkey" + }, + { + "name": "proposal_count", + "type": "u32" + }, + { + "name": "pass_threshold_bps", + "type": "u16" + }, + { + "name": "slots_per_proposal", + "type": "u64" + }, + { + "name": "twap_initial_observation", + "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": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "twap_start_delay_slots", + "docs": [ + "Forces TWAP calculation to start after amm.created_at_slot + twap_start_delay_slots" + ], + "type": "u64" + }, + { + "name": "min_quote_futarchic_liquidity", + "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": "min_base_futarchic_liquidity", + "type": "u64" + }, + { + "name": "seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "Proposal", + "type": { + "kind": "struct", + "fields": [ + { + "name": "number", + "type": "u32" + }, + { + "name": "proposer", + "type": "pubkey" + }, + { + "name": "description_url", + "type": "string" + }, + { + "name": "slot_enqueued", + "type": "u64" + }, + { + "name": "state", + "type": { + "defined": { + "name": "ProposalState" + } + } + }, + { + "name": "instruction", + "type": { + "defined": { + "name": "ProposalInstruction" + } + } + }, + { + "name": "pass_amm", + "type": "pubkey" + }, + { + "name": "fail_amm", + "type": "pubkey" + }, + { + "name": "base_vault", + "type": "pubkey" + }, + { + "name": "quote_vault", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "pass_lp_tokens_locked", + "type": "u64" + }, + { + "name": "fail_lp_tokens_locked", + "type": "u64" + }, + { + "name": "nonce", + "docs": [ + "We need to include a per-proposer nonce to prevent some weird proposal", + "front-running edge cases. Using a `u64` means that proposers are unlikely", + "to run into collisions, even if they generate nonces randomly - I've run", + "the math :D" + ], + "type": "u64" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "question", + "type": "pubkey" + }, + { + "name": "duration_in_slots", + "type": "u64" + } + ] + } + }, + { + "name": "InitializeDaoEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "token_mint", + "type": "pubkey" + }, + { + "name": "usdc_mint", + "type": "pubkey" + }, + { + "name": "treasury", + "type": "pubkey" + }, + { + "name": "pass_threshold_bps", + "type": "u16" + }, + { + "name": "slots_per_proposal", + "type": "u64" + }, + { + "name": "twap_initial_observation", + "type": "u128" + }, + { + "name": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "min_quote_futarchic_liquidity", + "type": "u64" + }, + { + "name": "min_base_futarchic_liquidity", + "type": "u64" + } + ] + } + }, + { + "name": "UpdateDaoEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "pass_threshold_bps", + "type": "u16" + }, + { + "name": "slots_per_proposal", + "type": "u64" + }, + { + "name": "twap_initial_observation", + "type": "u128" + }, + { + "name": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "min_quote_futarchic_liquidity", + "type": "u64" + }, + { + "name": "min_base_futarchic_liquidity", + "type": "u64" + } + ] + } + }, + { + "name": "InitializeProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "question", + "type": "pubkey" + }, + { + "name": "quote_vault", + "type": "pubkey" + }, + { + "name": "base_vault", + "type": "pubkey" + }, + { + "name": "pass_amm", + "type": "pubkey" + }, + { + "name": "fail_amm", + "type": "pubkey" + }, + { + "name": "pass_lp_mint", + "type": "pubkey" + }, + { + "name": "fail_lp_mint", + "type": "pubkey" + }, + { + "name": "proposer", + "type": "pubkey" + }, + { + "name": "nonce", + "type": "u64" + }, + { + "name": "number", + "type": "u32" + }, + { + "name": "pass_lp_tokens_locked", + "type": "u64" + }, + { + "name": "fail_lp_tokens_locked", + "type": "u64" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "instruction", + "type": { + "defined": { + "name": "ProposalInstruction" + } + } + }, + { + "name": "duration_in_slots", + "type": "u64" + } + ] + } + }, + { + "name": "FinalizeProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "pass_market_twap", + "type": "u128" + }, + { + "name": "fail_market_twap", + "type": "u128" + }, + { + "name": "threshold", + "type": "u128" + }, + { + "name": "state", + "type": { + "defined": { + "name": "ProposalState" + } + } + } + ] + } + }, + { + "name": "ExecuteProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/sdk/src/autocrat/v0.4/types/autocrat.ts b/sdk/src/autocrat/v0.4/types/autocrat.ts index c1d8a3f89..ef784ba43 100644 --- a/sdk/src/autocrat/v0.4/types/autocrat.ts +++ b/sdk/src/autocrat/v0.4/types/autocrat.ts @@ -1,294 +1,245 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL was converted from the legacy format with `anchor idl convert` and lives in + * the `.json` file next to this one. + */ export type Autocrat = { - version: "0.4.2"; - name: "autocrat"; + address: "autowMzCbM29YXMgVG3T62Hkgo7RcyrvgQQkd54fDQL"; + metadata: { + name: "autocrat"; + version: "0.4.2"; + spec: "0.1.0"; + }; instructions: [ { name: "initializeDao"; + discriminator: [128, 226, 96, 90, 39, 56, 24, 196]; accounts: [ { name: "dao"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "tokenMint"; - isMut: false; - isSigner: false; }, { name: "usdcMint"; - isMut: false; - isSigner: false; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "params"; type: { - defined: "InitializeDaoParams"; + defined: { + name: "initializeDaoParams"; + }; }; }, ]; }, { name: "initializeProposal"; + discriminator: [50, 73, 156, 98, 129, 149, 21, 158]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { 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; + writable: true; }, { name: "failLpUserAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "passLpVaultAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "failLpVaultAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "proposer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "params"; type: { - defined: "InitializeProposalParams"; + defined: { + name: "initializeProposalParams"; + }; }; }, ]; }, { name: "finalizeProposal"; + discriminator: [23, 68, 51, 167, 109, 173, 187, 164]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "passAmm"; - isMut: false; - isSigner: false; }, { name: "failAmm"; - isMut: false; - isSigner: false; }, { name: "dao"; - isMut: false; - isSigner: false; }, { name: "question"; - isMut: true; - isSigner: false; + writable: true; }, { name: "treasury"; - isMut: false; - isSigner: false; }, { name: "passLpUserAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "failLpUserAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "passLpVaultAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "failLpVaultAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { 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: "executeProposal"; + discriminator: [186, 60, 116, 133, 108, 128, 111, 28]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: false; - isSigner: false; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "updateDao"; + discriminator: [131, 72, 75, 25, 112, 210, 109, 2]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "treasury"; - isMut: false; - isSigner: true; + signer: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "daoParams"; type: { - defined: "UpdateDaoParams"; + defined: { + name: "updateDaoParams"; + }; }; }, ]; @@ -297,181 +248,100 @@ export type Autocrat = { accounts: [ { name: "dao"; - type: { - kind: "struct"; - fields: [ - { - name: "treasuryPdaBump"; - type: "u8"; - }, - { - name: "treasury"; - type: "publicKey"; - }, - { - name: "tokenMint"; - type: "publicKey"; - }, - { - name: "usdcMint"; - 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"; - }, - ]; - }; + discriminator: [163, 9, 47, 31, 52, 85, 197, 49]; }, { 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: "instruction"; - type: { - defined: "ProposalInstruction"; - }; - }, - { - 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: "nonce"; - docs: [ - "We need to include a per-proposer nonce to prevent some weird proposal", - "front-running edge cases. Using a `u64` means that proposers are unlikely", - "to run into collisions, even if they generate nonces randomly - I've run", - "the math :D", - ]; - type: "u64"; - }, - { - name: "pdaBump"; - type: "u8"; - }, - { - name: "question"; - type: "publicKey"; - }, - { - name: "durationInSlots"; - type: "u64"; - }, - ]; - }; + discriminator: [26, 94, 189, 187, 116, 136, 53, 33]; + }, + ]; + events: [ + { + name: "initializeDaoEvent"; + discriminator: [119, 48, 153, 116, 127, 37, 226, 228]; + }, + { + name: "updateDaoEvent"; + discriminator: [12, 58, 244, 224, 171, 25, 33, 56]; + }, + { + name: "initializeProposalEvent"; + discriminator: [141, 56, 246, 192, 168, 254, 64, 111]; + }, + { + name: "finalizeProposalEvent"; + discriminator: [45, 29, 122, 181, 79, 224, 57, 141]; + }, + { + name: "executeProposalEvent"; + discriminator: [153, 12, 41, 73, 206, 114, 248, 233]; + }, + ]; + 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`"; }, ]; types: [ { - name: "CommonFields"; + name: "commonFields"; type: { kind: "struct"; fields: [ @@ -487,7 +357,7 @@ export type Autocrat = { }; }, { - name: "InitializeDaoParams"; + name: "initializeDaoParams"; type: { kind: "struct"; fields: [ @@ -527,7 +397,7 @@ export type Autocrat = { }; }, { - name: "InitializeProposalParams"; + name: "initializeProposalParams"; type: { kind: "struct"; fields: [ @@ -538,7 +408,9 @@ export type Autocrat = { { name: "instruction"; type: { - defined: "ProposalInstruction"; + defined: { + name: "proposalInstruction"; + }; }; }, { @@ -557,7 +429,7 @@ export type Autocrat = { }; }, { - name: "UpdateDaoParams"; + name: "updateDaoParams"; type: { kind: "struct"; fields: [ @@ -601,13 +473,13 @@ export type Autocrat = { }; }, { - name: "ProposalAccount"; + name: "proposalAccount"; type: { kind: "struct"; fields: [ { name: "pubkey"; - type: "publicKey"; + type: "pubkey"; }, { name: "isSigner"; @@ -621,19 +493,21 @@ export type Autocrat = { }; }, { - name: "ProposalInstruction"; + name: "proposalInstruction"; type: { kind: "struct"; fields: [ { name: "programId"; - type: "publicKey"; + type: "pubkey"; }, { name: "accounts"; type: { vec: { - defined: "ProposalAccount"; + defined: { + name: "proposalAccount"; + }; }; }; }, @@ -645,698 +519,60 @@ export type Autocrat = { }; }, { - name: "ProposalState"; + name: "proposalState"; type: { kind: "enum"; variants: [ { - name: "Pending"; + name: "pending"; }, { - name: "Passed"; + name: "passed"; }, { - name: "Failed"; + name: "failed"; }, { - name: "Executed"; + name: "executed"; }, ]; }; }, - ]; - events: [ - { - name: "InitializeDaoEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "tokenMint"; - type: "publicKey"; - index: false; - }, - { - name: "usdcMint"; - type: "publicKey"; - index: false; - }, - { - name: "treasury"; - 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: "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: "nonce"; - type: "u64"; - 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: "instruction"; - type: { - defined: "ProposalInstruction"; - }; - index: false; - }, - { - name: "durationInSlots"; - type: "u64"; - 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: "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`"; - }, - ]; -}; - -export const IDL: Autocrat = { - version: "0.4.2", - name: "autocrat", - instructions: [ - { - name: "initializeDao", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: true, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenMint", - isMut: false, - isSigner: false, - }, - { - name: "usdcMint", - 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: "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: true, - isSigner: true, - }, - { - 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: "InitializeProposalParams", - }, - }, - ], - }, - { - name: "finalizeProposal", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "passAmm", - isMut: false, - isSigner: false, - }, - { - name: "failAmm", - isMut: false, - isSigner: false, - }, - { - name: "dao", - isMut: false, - isSigner: false, - }, - { - name: "question", - isMut: true, - isSigner: false, - }, - { - name: "treasury", - 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: "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: "executeProposal", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "dao", - 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: "treasury", - isMut: false, - isSigner: true, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "daoParams", - type: { - defined: "UpdateDaoParams", - }, - }, - ], - }, - ], - accounts: [ - { - name: "dao", + name: "dao"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "treasuryPdaBump", - type: "u8", + name: "treasuryPdaBump"; + type: "u8"; }, { - name: "treasury", - type: "publicKey", + name: "treasury"; + type: "pubkey"; }, { - name: "tokenMint", - type: "publicKey", + name: "tokenMint"; + type: "pubkey"; }, { - name: "usdcMint", - type: "publicKey", + name: "usdcMint"; + type: "pubkey"; }, { - name: "proposalCount", - type: "u32", + name: "proposalCount"; + type: "u32"; }, { - name: "passThresholdBps", - type: "u16", + name: "passThresholdBps"; + type: "u16"; }, { - name: "slotsPerProposal", - type: "u64", + name: "slotsPerProposal"; + type: "u64"; }, { - name: "twapInitialObservation", + 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", @@ -1352,22 +588,22 @@ export const IDL: Autocrat = { "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", + ]; + type: "u128"; }, { - name: "twapMaxObservationChangePerUpdate", - type: "u128", + name: "twapMaxObservationChangePerUpdate"; + type: "u128"; }, { - name: "twapStartDelaySlots", + name: "twapStartDelaySlots"; docs: [ "Forces TWAP calculation to start after amm.created_at_slot + twap_start_delay_slots", - ], - type: "u64", + ]; + type: "u64"; }, { - name: "minQuoteFutarchicLiquidity", + 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.", @@ -1375,639 +611,365 @@ export const IDL: Autocrat = { "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", + ]; + type: "u64"; }, { - name: "minBaseFutarchicLiquidity", - type: "u64", + name: "minBaseFutarchicLiquidity"; + type: "u64"; }, { - name: "seqNum", - type: "u64", + name: "seqNum"; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "proposal", + name: "proposal"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "number", - type: "u32", + name: "number"; + type: "u32"; }, { - name: "proposer", - type: "publicKey", + name: "proposer"; + type: "pubkey"; }, { - name: "descriptionUrl", - type: "string", + name: "descriptionUrl"; + type: "string"; }, { - name: "slotEnqueued", - type: "u64", + name: "slotEnqueued"; + type: "u64"; }, { - name: "state", + name: "state"; type: { - defined: "ProposalState", - }, + defined: { + name: "proposalState"; + }; + }; }, { - name: "instruction", + name: "instruction"; type: { - defined: "ProposalInstruction", - }, + defined: { + name: "proposalInstruction"; + }; + }; }, { - name: "passAmm", - type: "publicKey", + name: "passAmm"; + type: "pubkey"; }, { - name: "failAmm", - type: "publicKey", + name: "failAmm"; + type: "pubkey"; }, { - name: "baseVault", - type: "publicKey", + name: "baseVault"; + type: "pubkey"; }, { - name: "quoteVault", - type: "publicKey", + name: "quoteVault"; + type: "pubkey"; }, { - name: "dao", - type: "publicKey", + name: "dao"; + type: "pubkey"; }, { - name: "passLpTokensLocked", - type: "u64", + name: "passLpTokensLocked"; + type: "u64"; }, { - name: "failLpTokensLocked", - type: "u64", + name: "failLpTokensLocked"; + type: "u64"; }, { - name: "nonce", + name: "nonce"; docs: [ "We need to include a per-proposer nonce to prevent some weird proposal", "front-running edge cases. Using a `u64` means that proposers are unlikely", "to run into collisions, even if they generate nonces randomly - I've run", "the math :D", - ], - type: "u64", + ]; + type: "u64"; + }, + { + name: "pdaBump"; + type: "u8"; + }, + { + name: "question"; + type: "pubkey"; + }, + { + name: "durationInSlots"; + type: "u64"; + }, + ]; + }; + }, + { + name: "initializeDaoEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "dao"; + type: "pubkey"; + }, + { + name: "tokenMint"; + type: "pubkey"; }, { - name: "pdaBump", - type: "u8", + name: "usdcMint"; + type: "pubkey"; + }, + { + name: "treasury"; + type: "pubkey"; + }, + { + name: "passThresholdBps"; + type: "u16"; + }, + { + name: "slotsPerProposal"; + type: "u64"; }, { - name: "question", - type: "publicKey", + name: "twapInitialObservation"; + type: "u128"; }, { - name: "durationInSlots", - type: "u64", + name: "twapMaxObservationChangePerUpdate"; + type: "u128"; }, - ], - }, - }, - ], - types: [ - { - name: "CommonFields", - type: { - kind: "struct", - fields: [ { - name: "slot", - type: "u64", + name: "minQuoteFutarchicLiquidity"; + type: "u64"; }, { - name: "unixTimestamp", - type: "i64", + name: "minBaseFutarchicLiquidity"; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "InitializeDaoParams", + name: "updateDaoEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "twapInitialObservation", - type: "u128", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "twapMaxObservationChangePerUpdate", - type: "u128", + name: "dao"; + type: "pubkey"; }, { - name: "twapStartDelaySlots", - type: "u64", + name: "passThresholdBps"; + type: "u16"; }, { - name: "minQuoteFutarchicLiquidity", - type: "u64", + name: "slotsPerProposal"; + type: "u64"; }, { - name: "minBaseFutarchicLiquidity", - type: "u64", + name: "twapInitialObservation"; + type: "u128"; }, { - name: "passThresholdBps", - type: { - option: "u16", - }, + name: "twapMaxObservationChangePerUpdate"; + type: "u128"; }, { - name: "slotsPerProposal", - type: { - option: "u64", - }, + name: "minQuoteFutarchicLiquidity"; + type: "u64"; }, - ], - }, + { + name: "minBaseFutarchicLiquidity"; + type: "u64"; + }, + ]; + }; }, { - name: "InitializeProposalParams", + name: "initializeProposalEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "descriptionUrl", - type: "string", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "instruction", - type: { - defined: "ProposalInstruction", - }, + name: "proposal"; + type: "pubkey"; }, { - name: "passLpTokensToLock", - type: "u64", + name: "dao"; + type: "pubkey"; }, { - name: "failLpTokensToLock", - type: "u64", + name: "question"; + type: "pubkey"; }, { - name: "nonce", - type: "u64", + name: "quoteVault"; + type: "pubkey"; }, - ], - }, - }, - { - name: "UpdateDaoParams", - type: { - kind: "struct", - fields: [ { - name: "passThresholdBps", - type: { - option: "u16", - }, + name: "baseVault"; + type: "pubkey"; }, { - name: "slotsPerProposal", - type: { - option: "u64", - }, + name: "passAmm"; + type: "pubkey"; }, { - name: "twapInitialObservation", - type: { - option: "u128", - }, + name: "failAmm"; + type: "pubkey"; }, { - name: "twapMaxObservationChangePerUpdate", - type: { - option: "u128", - }, + name: "passLpMint"; + type: "pubkey"; }, { - name: "minQuoteFutarchicLiquidity", - type: { - option: "u64", - }, + name: "failLpMint"; + type: "pubkey"; }, { - name: "minBaseFutarchicLiquidity", - type: { - option: "u64", - }, + name: "proposer"; + type: "pubkey"; }, - ], - }, - }, - { - name: "ProposalAccount", - type: { - kind: "struct", - fields: [ { - name: "pubkey", - type: "publicKey", + name: "nonce"; + type: "u64"; }, { - name: "isSigner", - type: "bool", + name: "number"; + type: "u32"; }, { - name: "isWritable", - type: "bool", + name: "passLpTokensLocked"; + type: "u64"; + }, + { + name: "failLpTokensLocked"; + type: "u64"; }, - ], - }, - }, - { - name: "ProposalInstruction", - type: { - kind: "struct", - fields: [ { - name: "programId", - type: "publicKey", + name: "pdaBump"; + type: "u8"; }, { - name: "accounts", + name: "instruction"; type: { - vec: { - defined: "ProposalAccount", - }, - }, + defined: { + name: "proposalInstruction"; + }; + }; }, { - name: "data", - type: "bytes", + name: "durationInSlots"; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "ProposalState", + name: "finalizeProposalEvent"; type: { - kind: "enum", - variants: [ + kind: "struct"; + fields: [ { - name: "Pending", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "Passed", + name: "proposal"; + type: "pubkey"; }, { - name: "Failed", + name: "dao"; + type: "pubkey"; }, { - name: "Executed", - }, - ], - }, - }, - ], - events: [ - { - name: "InitializeDaoEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "passMarketTwap"; + type: "u128"; }, - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "tokenMint", - type: "publicKey", - index: false, - }, - { - name: "usdcMint", - type: "publicKey", - index: false, - }, - { - name: "treasury", - 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: "UpdateDaoEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "failMarketTwap"; + type: "u128"; }, - 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", + { + name: "threshold"; + type: "u128"; }, - 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: "nonce", - type: "u64", - 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: "instruction", - type: { - defined: "ProposalInstruction", + { + name: "state"; + type: { + defined: { + name: "proposalState"; + }; + }; }, - index: false, - }, - { - name: "durationInSlots", - type: "u64", - index: false, - }, - ], + ]; + }; }, { - name: "FinalizeProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "executeProposalEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "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", + { + name: "proposal"; + type: "pubkey"; }, - index: false, - }, - ], - }, - { - name: "ExecuteProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "dao"; + type: "pubkey"; }, - 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`", + ]; + }; }, - ], + ]; }; diff --git a/sdk/src/autocrat/v0.4/types/index.ts b/sdk/src/autocrat/v0.4/types/index.ts index 8cc574a57..183c046de 100644 --- a/sdk/src/autocrat/v0.4/types/index.ts +++ b/sdk/src/autocrat/v0.4/types/index.ts @@ -1,26 +1,28 @@ -import { Autocrat as AutocratProgram, IDL as AutocratIDL } from "./autocrat.js"; -export { AutocratProgram, AutocratIDL }; +import type { Autocrat as AutocratProgram } from "./autocrat.js"; +import autocratIdl from "./autocrat.json" with { type: "json" }; +export type { AutocratProgram }; +export const AutocratIDL = autocratIdl as AutocratProgram; -import type { IdlAccounts, IdlTypes, IdlEvents } from "@coral-xyz/anchor"; +import type { IdlAccounts, IdlTypes, IdlEvents } from "@anchor-lang/core"; export type InitializeDaoParams = - IdlTypes["InitializeDaoParams"]; -export type UpdateDaoParams = IdlTypes["UpdateDaoParams"]; + IdlTypes["initializeDaoParams"]; +export type UpdateDaoParams = IdlTypes["updateDaoParams"]; export type ProposalInstruction = - IdlTypes["ProposalInstruction"]; + IdlTypes["proposalInstruction"]; export type Dao = IdlAccounts["dao"]; export type Proposal = IdlAccounts["proposal"]; export type InitializeDaoEvent = - IdlEvents["InitializeDaoEvent"]; -export type UpdateDaoEvent = IdlEvents["UpdateDaoEvent"]; + IdlEvents["initializeDaoEvent"]; +export type UpdateDaoEvent = IdlEvents["updateDaoEvent"]; export type InitializeProposalEvent = - IdlEvents["InitializeProposalEvent"]; + IdlEvents["initializeProposalEvent"]; export type FinalizeProposalEvent = - IdlEvents["FinalizeProposalEvent"]; + IdlEvents["finalizeProposalEvent"]; export type ExecuteProposalEvent = - IdlEvents["ExecuteProposalEvent"]; + IdlEvents["executeProposalEvent"]; export type AutocratEvent = | InitializeDaoEvent | UpdateDaoEvent diff --git a/sdk/src/autocrat/v0.5/AutocratClient.ts b/sdk/src/autocrat/v0.5/AutocratClient.ts index bcc93140d..42daafef4 100644 --- a/sdk/src/autocrat/v0.5/AutocratClient.ts +++ b/sdk/src/autocrat/v0.5/AutocratClient.ts @@ -1,4 +1,4 @@ -import { AnchorProvider, IdlTypes, Program } from "@coral-xyz/anchor"; +import { AnchorProvider, IdlTypes, Program } from "@anchor-lang/core"; import { AccountInfo, AccountMeta, @@ -12,7 +12,7 @@ import { } from "@solana/web3.js"; import { InitializeDaoParams, UpdateDaoParams } from "./types/index.js"; -import { Autocrat, IDL as AutocratIDL } from "./types/autocrat.js"; +import { AutocratProgram as Autocrat, AutocratIDL } from "./types/index.js"; import BN from "bn.js"; import { @@ -74,8 +74,7 @@ export class AutocratClient { ) { this.provider = provider; this.autocrat = new Program( - AutocratIDL, - autocratProgramId, + { ...AutocratIDL, address: autocratProgramId.toBase58() }, provider, ); this.vaultClient = ConditionalVaultClient.createClient({ @@ -312,7 +311,7 @@ export class AutocratClient { createKey: dao, })[0]; - return this.autocrat.methods.initializeDao(params).accounts({ + return this.autocrat.methods.initializeDao(params).accountsPartial({ dao, baseMint, quoteMint, @@ -484,7 +483,7 @@ export class AutocratClient { passLpTokensToLock, failLpTokensToLock, }) - .accounts({ + .accountsPartial({ question, proposal, squadsProposal, @@ -555,7 +554,7 @@ export class AutocratClient { const [vaultEventAuthority] = getEventAuthorityAddr(vaultProgramId); - return this.autocrat.methods.finalizeProposal().accounts({ + return this.autocrat.methods.finalizeProposal().accountsPartial({ proposal, passAmm, failAmm, @@ -589,7 +588,7 @@ export class AutocratClient { // const [daoTreasury] = getDaoTreasuryAddr(this.autocrat.programId, dao); // return this.autocrat.methods // .executeProposal() - // .accounts({ + // .accountsPartial({ // proposal, // dao, // // daoTreasury, @@ -616,7 +615,7 @@ export class AutocratClient { index: 0, })[0]; - return this.autocrat.methods.updateDao(params).accounts({ + return this.autocrat.methods.updateDao(params).accountsPartial({ dao, squadsMultisigVault, }); diff --git a/sdk/src/autocrat/v0.5/pda.ts b/sdk/src/autocrat/v0.5/pda.ts index 3ad8c896f..bc41d416d 100644 --- a/sdk/src/autocrat/v0.5/pda.ts +++ b/sdk/src/autocrat/v0.5/pda.ts @@ -1,5 +1,5 @@ import { PublicKey } from "@solana/web3.js"; -import { utils } from "@coral-xyz/anchor"; +import { utils } from "@anchor-lang/core"; import BN from "bn.js"; import { AUTOCRAT_V0_5_PROGRAM_ID } from "../../constants.js"; diff --git a/sdk/src/autocrat/v0.5/types/autocrat.json b/sdk/src/autocrat/v0.5/types/autocrat.json new file mode 100644 index 000000000..53ef0559d --- /dev/null +++ b/sdk/src/autocrat/v0.5/types/autocrat.json @@ -0,0 +1,1105 @@ +{ + "address": "auToUr3CQza3D4qreT6Std2MTomfzvrEeCC5qh7ivW5", + "metadata": { + "name": "autocrat", + "version": "0.5.0", + "spec": "0.1.0" + }, + "instructions": [ + { + "name": "initialize_dao", + "discriminator": [ + 128, + 226, + 96, + 90, + 39, + 56, + 24, + 196 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "dao_creator", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "base_mint" + }, + { + "name": "quote_mint" + }, + { + "name": "squads_multisig", + "writable": true + }, + { + "name": "squads_multisig_vault" + }, + { + "name": "squads_program" + }, + { + "name": "squads_program_config" + }, + { + "name": "squads_program_config_treasury", + "writable": true + }, + { + "name": "spending_limit", + "writable": true + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "InitializeDaoParams" + } + } + } + ] + }, + { + "name": "initialize_proposal", + "discriminator": [ + 50, + 73, + 156, + 98, + 129, + 149, + 21, + 158 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "squads_proposal" + }, + { + "name": "dao", + "writable": true + }, + { + "name": "question" + }, + { + "name": "quote_vault" + }, + { + "name": "base_vault" + }, + { + "name": "pass_amm" + }, + { + "name": "pass_lp_mint" + }, + { + "name": "fail_lp_mint" + }, + { + "name": "fail_amm" + }, + { + "name": "pass_lp_user_account", + "writable": true + }, + { + "name": "fail_lp_user_account", + "writable": true + }, + { + "name": "pass_lp_vault_account", + "writable": true + }, + { + "name": "fail_lp_vault_account", + "writable": true + }, + { + "name": "proposer", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "InitializeProposalParams" + } + } + } + ] + }, + { + "name": "finalize_proposal", + "discriminator": [ + 23, + 68, + 51, + 167, + 109, + 173, + 187, + 164 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "squads_proposal", + "writable": true + }, + { + "name": "squads_multisig_program" + }, + { + "name": "squads_multisig" + }, + { + "name": "pass_amm" + }, + { + "name": "fail_amm" + }, + { + "name": "dao", + "writable": true + }, + { + "name": "question", + "writable": true + }, + { + "name": "pass_lp_user_account", + "writable": true + }, + { + "name": "fail_lp_user_account", + "writable": true + }, + { + "name": "pass_lp_vault_account", + "writable": true + }, + { + "name": "fail_lp_vault_account", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "vault_program" + }, + { + "name": "vault_event_authority" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "update_dao", + "discriminator": [ + 131, + 72, + 75, + 25, + 112, + 210, + 109, + 2 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "squads_multisig_vault", + "signer": true + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "dao_params", + "type": { + "defined": { + "name": "UpdateDaoParams" + } + } + } + ] + } + ], + "accounts": [ + { + "name": "Dao", + "discriminator": [ + 163, + 9, + 47, + 31, + 52, + 85, + 197, + 49 + ] + }, + { + "name": "Proposal", + "discriminator": [ + 26, + 94, + 189, + 187, + 116, + 136, + 53, + 33 + ] + } + ], + "events": [ + { + "name": "InitializeDaoEvent", + "discriminator": [ + 119, + 48, + 153, + 116, + 127, + 37, + 226, + 228 + ] + }, + { + "name": "UpdateDaoEvent", + "discriminator": [ + 12, + 58, + 244, + 224, + 171, + 25, + 33, + 56 + ] + }, + { + "name": "InitializeProposalEvent", + "discriminator": [ + 141, + 56, + 246, + 192, + 168, + 254, + 64, + 111 + ] + }, + { + "name": "FinalizeProposalEvent", + "discriminator": [ + 45, + 29, + 122, + 181, + 79, + 224, + 57, + 141 + ] + }, + { + "name": "ExecuteProposalEvent", + "discriminator": [ + 153, + 12, + 41, + 73, + 206, + 114, + 248, + 233 + ] + } + ], + "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" + } + ], + "types": [ + { + "name": "CommonFields", + "type": { + "kind": "struct", + "fields": [ + { + "name": "slot", + "type": "u64" + }, + { + "name": "unix_timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "InitializeDaoParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "twap_initial_observation", + "type": "u128" + }, + { + "name": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "twap_start_delay_slots", + "type": "u64" + }, + { + "name": "min_quote_futarchic_liquidity", + "type": "u64" + }, + { + "name": "min_base_futarchic_liquidity", + "type": "u64" + }, + { + "name": "pass_threshold_bps", + "type": "u16" + }, + { + "name": "slots_per_proposal", + "type": "u64" + }, + { + "name": "nonce", + "type": "u64" + }, + { + "name": "initial_spending_limit", + "type": { + "option": { + "defined": { + "name": "InitialSpendingLimit" + } + } + } + } + ] + } + }, + { + "name": "InitializeProposalParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "description_url", + "type": "string" + }, + { + "name": "pass_lp_tokens_to_lock", + "type": "u64" + }, + { + "name": "fail_lp_tokens_to_lock", + "type": "u64" + } + ] + } + }, + { + "name": "UpdateDaoParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pass_threshold_bps", + "type": { + "option": "u16" + } + }, + { + "name": "slots_per_proposal", + "type": { + "option": "u64" + } + }, + { + "name": "twap_initial_observation", + "type": { + "option": "u128" + } + }, + { + "name": "twap_max_observation_change_per_update", + "type": { + "option": "u128" + } + }, + { + "name": "min_quote_futarchic_liquidity", + "type": { + "option": "u64" + } + }, + { + "name": "min_base_futarchic_liquidity", + "type": { + "option": "u64" + } + } + ] + } + }, + { + "name": "InitialSpendingLimit", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amount_per_month", + "type": "u64" + }, + { + "name": "members", + "type": { + "vec": "pubkey" + } + } + ] + } + }, + { + "name": "ProposalState", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Pending" + }, + { + "name": "Passed" + }, + { + "name": "Failed" + } + ] + } + }, + { + "name": "Dao", + "type": { + "kind": "struct", + "fields": [ + { + "name": "nonce", + "docs": [ + "`nonce` + `dao_creator` are PDA seeds" + ], + "type": "u64" + }, + { + "name": "dao_creator", + "type": "pubkey" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "squads_multisig", + "type": "pubkey" + }, + { + "name": "squads_multisig_vault", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "proposal_count", + "type": "u32" + }, + { + "name": "pass_threshold_bps", + "type": "u16" + }, + { + "name": "slots_per_proposal", + "type": "u64" + }, + { + "name": "twap_initial_observation", + "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": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "twap_start_delay_slots", + "docs": [ + "Forces TWAP calculation to start after amm.created_at_slot + twap_start_delay_slots" + ], + "type": "u64" + }, + { + "name": "min_quote_futarchic_liquidity", + "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": "min_base_futarchic_liquidity", + "type": "u64" + }, + { + "name": "seq_num", + "type": "u64" + }, + { + "name": "initial_spending_limit", + "type": { + "option": { + "defined": { + "name": "InitialSpendingLimit" + } + } + } + } + ] + } + }, + { + "name": "Proposal", + "type": { + "kind": "struct", + "fields": [ + { + "name": "number", + "type": "u32" + }, + { + "name": "proposer", + "type": "pubkey" + }, + { + "name": "description_url", + "type": "string" + }, + { + "name": "slot_enqueued", + "type": "u64" + }, + { + "name": "state", + "type": { + "defined": { + "name": "ProposalState" + } + } + }, + { + "name": "pass_amm", + "type": "pubkey" + }, + { + "name": "fail_amm", + "type": "pubkey" + }, + { + "name": "base_vault", + "type": "pubkey" + }, + { + "name": "quote_vault", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "pass_lp_tokens_locked", + "type": "u64" + }, + { + "name": "fail_lp_tokens_locked", + "type": "u64" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "question", + "type": "pubkey" + }, + { + "name": "duration_in_slots", + "type": "u64" + }, + { + "name": "squads_proposal", + "type": "pubkey" + } + ] + } + }, + { + "name": "InitializeDaoEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "pass_threshold_bps", + "type": "u16" + }, + { + "name": "slots_per_proposal", + "type": "u64" + }, + { + "name": "twap_initial_observation", + "type": "u128" + }, + { + "name": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "min_quote_futarchic_liquidity", + "type": "u64" + }, + { + "name": "min_base_futarchic_liquidity", + "type": "u64" + }, + { + "name": "initial_spending_limit", + "type": { + "option": { + "defined": { + "name": "InitialSpendingLimit" + } + } + } + }, + { + "name": "squads_multisig", + "type": "pubkey" + }, + { + "name": "squads_multisig_vault", + "type": "pubkey" + } + ] + } + }, + { + "name": "UpdateDaoEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "pass_threshold_bps", + "type": "u16" + }, + { + "name": "slots_per_proposal", + "type": "u64" + }, + { + "name": "twap_initial_observation", + "type": "u128" + }, + { + "name": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "min_quote_futarchic_liquidity", + "type": "u64" + }, + { + "name": "min_base_futarchic_liquidity", + "type": "u64" + } + ] + } + }, + { + "name": "InitializeProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "question", + "type": "pubkey" + }, + { + "name": "quote_vault", + "type": "pubkey" + }, + { + "name": "base_vault", + "type": "pubkey" + }, + { + "name": "pass_amm", + "type": "pubkey" + }, + { + "name": "fail_amm", + "type": "pubkey" + }, + { + "name": "pass_lp_mint", + "type": "pubkey" + }, + { + "name": "fail_lp_mint", + "type": "pubkey" + }, + { + "name": "proposer", + "type": "pubkey" + }, + { + "name": "number", + "type": "u32" + }, + { + "name": "pass_lp_tokens_locked", + "type": "u64" + }, + { + "name": "fail_lp_tokens_locked", + "type": "u64" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "duration_in_slots", + "type": "u64" + }, + { + "name": "squads_proposal", + "type": "pubkey" + }, + { + "name": "squads_multisig", + "type": "pubkey" + }, + { + "name": "squads_multisig_vault", + "type": "pubkey" + } + ] + } + }, + { + "name": "FinalizeProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "pass_market_twap", + "type": "u128" + }, + { + "name": "fail_market_twap", + "type": "u128" + }, + { + "name": "threshold", + "type": "u128" + }, + { + "name": "state", + "type": { + "defined": { + "name": "ProposalState" + } + } + }, + { + "name": "squads_proposal", + "type": "pubkey" + }, + { + "name": "squads_multisig", + "type": "pubkey" + } + ] + } + }, + { + "name": "ExecuteProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/sdk/src/autocrat/v0.5/types/autocrat.ts b/sdk/src/autocrat/v0.5/types/autocrat.ts index 48334f703..097c5c467 100644 --- a/sdk/src/autocrat/v0.5/types/autocrat.ts +++ b/sdk/src/autocrat/v0.5/types/autocrat.ts @@ -1,334 +1,548 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL was converted from the legacy format with `anchor idl convert` and lives in + * the `.json` file next to this one. + */ export type Autocrat = { - version: "0.5.0"; - name: "autocrat"; + address: "auToUr3CQza3D4qreT6Std2MTomfzvrEeCC5qh7ivW5"; + metadata: { + name: "autocrat"; + version: "0.5.0"; + spec: "0.1.0"; + }; instructions: [ { name: "initializeDao"; + discriminator: [128, 226, 96, 90, 39, 56, 24, 196]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "daoCreator"; - isMut: false; - isSigner: true; + signer: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "baseMint"; - isMut: false; - isSigner: false; }, { name: "quoteMint"; - isMut: false; - isSigner: false; }, { name: "squadsMultisig"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisigVault"; - isMut: false; - isSigner: false; }, { name: "squadsProgram"; - isMut: false; - isSigner: false; }, { name: "squadsProgramConfig"; - isMut: false; - isSigner: false; }, { name: "squadsProgramConfigTreasury"; - isMut: true; - isSigner: false; + writable: true; }, { name: "spendingLimit"; - isMut: true; - isSigner: false; + writable: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "params"; type: { - defined: "InitializeDaoParams"; + defined: { + name: "initializeDaoParams"; + }; }; }, ]; }, { name: "initializeProposal"; + discriminator: [50, 73, 156, 98, 129, 149, 21, 158]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsProposal"; - isMut: false; - isSigner: false; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { 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; + writable: true; }, { name: "failLpUserAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "passLpVaultAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "failLpVaultAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "proposer"; - isMut: false; - isSigner: true; + signer: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "params"; type: { - defined: "InitializeProposalParams"; + defined: { + name: "initializeProposalParams"; + }; }; }, ]; }, { name: "finalizeProposal"; + discriminator: [23, 68, 51, 167, 109, 173, 187, 164]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsProposal"; - isMut: true; - isSigner: false; + writable: true; }, { 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; + writable: true; }, { name: "question"; - isMut: true; - isSigner: false; + writable: true; }, { name: "passLpUserAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "failLpUserAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "passLpVaultAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "failLpVaultAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { 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"; + discriminator: [131, 72, 75, 25, 112, 210, 109, 2]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisigVault"; - isMut: false; - isSigner: true; + signer: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "daoParams"; type: { - defined: "UpdateDaoParams"; + defined: { + name: "updateDaoParams"; + }; }; }, ]; }, ]; accounts: [ + { + name: "dao"; + discriminator: [163, 9, 47, 31, 52, 85, 197, 49]; + }, + { + name: "proposal"; + discriminator: [26, 94, 189, 187, 116, 136, 53, 33]; + }, + ]; + events: [ + { + name: "initializeDaoEvent"; + discriminator: [119, 48, 153, 116, 127, 37, 226, 228]; + }, + { + name: "updateDaoEvent"; + discriminator: [12, 58, 244, 224, 171, 25, 33, 56]; + }, + { + name: "initializeProposalEvent"; + discriminator: [141, 56, 246, 192, 168, 254, 64, 111]; + }, + { + name: "finalizeProposalEvent"; + discriminator: [45, 29, 122, 181, 79, 224, 57, 141]; + }, + { + name: "executeProposalEvent"; + discriminator: [153, 12, 41, 73, 206, 114, 248, 233]; + }, + ]; + 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"; + }, + ]; + 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: { + name: "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: "pubkey"; + }; + }, + ]; + }; + }, + { + name: "proposalState"; + type: { + kind: "enum"; + variants: [ + { + name: "pending"; + }, + { + name: "passed"; + }, + { + name: "failed"; + }, + ]; + }; + }, { name: "dao"; type: { @@ -341,7 +555,7 @@ export type Autocrat = { }, { name: "daoCreator"; - type: "publicKey"; + type: "pubkey"; }, { name: "pdaBump"; @@ -349,19 +563,19 @@ export type Autocrat = { }, { name: "squadsMultisig"; - type: "publicKey"; + type: "pubkey"; }, { name: "squadsMultisigVault"; - type: "publicKey"; + type: "pubkey"; }, { name: "baseMint"; - type: "publicKey"; + type: "pubkey"; }, { name: "quoteMint"; - type: "publicKey"; + type: "pubkey"; }, { name: "proposalCount"; @@ -430,7 +644,9 @@ export type Autocrat = { name: "initialSpendingLimit"; type: { option: { - defined: "InitialSpendingLimit"; + defined: { + name: "initialSpendingLimit"; + }; }; }; }, @@ -448,7 +664,7 @@ export type Autocrat = { }, { name: "proposer"; - type: "publicKey"; + type: "pubkey"; }, { name: "descriptionUrl"; @@ -461,28 +677,30 @@ export type Autocrat = { { name: "state"; type: { - defined: "ProposalState"; + defined: { + name: "proposalState"; + }; }; }, { name: "passAmm"; - type: "publicKey"; + type: "pubkey"; }, { name: "failAmm"; - type: "publicKey"; + type: "pubkey"; }, { name: "baseVault"; - type: "publicKey"; + type: "pubkey"; }, { name: "quoteVault"; - type: "publicKey"; + type: "pubkey"; }, { name: "dao"; - type: "publicKey"; + type: "pubkey"; }, { name: "passLpTokensLocked"; @@ -498,7 +716,7 @@ export type Autocrat = { }, { name: "question"; - type: "publicKey"; + type: "pubkey"; }, { name: "durationInSlots"; @@ -506,1616 +724,288 @@ export type Autocrat = { }, { name: "squadsProposal"; - type: "publicKey"; + type: "pubkey"; }, ]; }; }, - ]; - types: [ { - name: "CommonFields"; + name: "initializeDaoEvent"; type: { kind: "struct"; fields: [ { - name: "slot"; - type: "u64"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "unixTimestamp"; - type: "i64"; + name: "dao"; + type: "pubkey"; }, - ]; - }; - }, - { - name: "InitializeDaoParams"; - type: { - kind: "struct"; - fields: [ { - name: "twapInitialObservation"; - type: "u128"; + name: "baseMint"; + type: "pubkey"; }, { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; + name: "quoteMint"; + type: "pubkey"; }, { - name: "twapStartDelaySlots"; - type: "u64"; + name: "passThresholdBps"; + type: "u16"; }, { - name: "minQuoteFutarchicLiquidity"; + name: "slotsPerProposal"; type: "u64"; }, { - name: "minBaseFutarchicLiquidity"; - type: "u64"; + name: "twapInitialObservation"; + type: "u128"; }, { - name: "passThresholdBps"; - type: "u16"; + name: "twapMaxObservationChangePerUpdate"; + type: "u128"; }, { - name: "slotsPerProposal"; + name: "minQuoteFutarchicLiquidity"; type: "u64"; }, { - name: "nonce"; + name: "minBaseFutarchicLiquidity"; type: "u64"; }, { name: "initialSpendingLimit"; type: { option: { - defined: "InitialSpendingLimit"; + defined: { + name: "initialSpendingLimit"; + }; }; }; }, + { + name: "squadsMultisig"; + type: "pubkey"; + }, + { + name: "squadsMultisigVault"; + type: "pubkey"; + }, ]; }; }, { - name: "InitializeProposalParams"; + name: "updateDaoEvent"; type: { kind: "struct"; fields: [ { - name: "descriptionUrl"; - type: "string"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "passLpTokensToLock"; + name: "dao"; + type: "pubkey"; + }, + { + name: "passThresholdBps"; + type: "u16"; + }, + { + name: "slotsPerProposal"; type: "u64"; }, { - name: "failLpTokensToLock"; + name: "twapInitialObservation"; + type: "u128"; + }, + { + name: "twapMaxObservationChangePerUpdate"; + type: "u128"; + }, + { + name: "minQuoteFutarchicLiquidity"; + type: "u64"; + }, + { + name: "minBaseFutarchicLiquidity"; type: "u64"; }, ]; }; }, { - name: "UpdateDaoParams"; + name: "initializeProposalEvent"; type: { kind: "struct"; fields: [ { - name: "passThresholdBps"; + name: "common"; type: { - option: "u16"; + defined: { + name: "commonFields"; + }; }; }, { - name: "slotsPerProposal"; - type: { - option: "u64"; - }; + name: "proposal"; + type: "pubkey"; }, { - name: "twapInitialObservation"; - type: { - option: "u128"; - }; + name: "dao"; + type: "pubkey"; }, { - name: "twapMaxObservationChangePerUpdate"; - type: { - option: "u128"; - }; + name: "question"; + type: "pubkey"; }, { - name: "minQuoteFutarchicLiquidity"; - type: { - option: "u64"; - }; + name: "quoteVault"; + type: "pubkey"; }, { - name: "minBaseFutarchicLiquidity"; - type: { - option: "u64"; - }; + name: "baseVault"; + type: "pubkey"; + }, + { + name: "passAmm"; + type: "pubkey"; + }, + { + name: "failAmm"; + type: "pubkey"; + }, + { + name: "passLpMint"; + type: "pubkey"; + }, + { + name: "failLpMint"; + type: "pubkey"; + }, + { + name: "proposer"; + type: "pubkey"; + }, + { + name: "number"; + type: "u32"; + }, + { + name: "passLpTokensLocked"; + type: "u64"; + }, + { + name: "failLpTokensLocked"; + type: "u64"; + }, + { + name: "pdaBump"; + type: "u8"; + }, + { + name: "durationInSlots"; + type: "u64"; + }, + { + name: "squadsProposal"; + type: "pubkey"; + }, + { + name: "squadsMultisig"; + type: "pubkey"; + }, + { + name: "squadsMultisigVault"; + type: "pubkey"; }, ]; }; }, { - name: "InitialSpendingLimit"; + name: "finalizeProposalEvent"; type: { kind: "struct"; fields: [ { - name: "amountPerMonth"; - type: "u64"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "members"; + name: "proposal"; + type: "pubkey"; + }, + { + name: "dao"; + type: "pubkey"; + }, + { + name: "passMarketTwap"; + type: "u128"; + }, + { + name: "failMarketTwap"; + type: "u128"; + }, + { + name: "threshold"; + type: "u128"; + }, + { + name: "state"; type: { - vec: "publicKey"; + defined: { + name: "proposalState"; + }; }; }, + { + name: "squadsProposal"; + type: "pubkey"; + }, + { + name: "squadsMultisig"; + type: "pubkey"; + }, ]; }; }, { - name: "ProposalState"; + name: "executeProposalEvent"; type: { - kind: "enum"; - variants: [ + kind: "struct"; + fields: [ { - name: "Pending"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "Passed"; + name: "proposal"; + type: "pubkey"; }, { - name: "Failed"; + name: "dao"; + type: "pubkey"; }, ]; }; }, ]; - 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"; - }, - ]; -}; - -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", - }, - }, - ], - }, - ], - 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", - }, - ], }; diff --git a/sdk/src/autocrat/v0.5/types/index.ts b/sdk/src/autocrat/v0.5/types/index.ts index 68306d748..1f07a1835 100644 --- a/sdk/src/autocrat/v0.5/types/index.ts +++ b/sdk/src/autocrat/v0.5/types/index.ts @@ -1,24 +1,26 @@ -import { Autocrat as AutocratProgram, IDL as AutocratIDL } from "./autocrat.js"; -export { AutocratProgram, AutocratIDL }; +import type { Autocrat as AutocratProgram } from "./autocrat.js"; +import autocratIdl from "./autocrat.json" with { type: "json" }; +export type { AutocratProgram }; +export const AutocratIDL = autocratIdl as AutocratProgram; -import type { IdlAccounts, IdlTypes, IdlEvents } from "@coral-xyz/anchor"; +import type { IdlAccounts, IdlTypes, IdlEvents } from "@anchor-lang/core"; export type InitializeDaoParams = - IdlTypes["InitializeDaoParams"]; -export type UpdateDaoParams = IdlTypes["UpdateDaoParams"]; + 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"]; + IdlEvents["initializeDaoEvent"]; +export type UpdateDaoEvent = IdlEvents["updateDaoEvent"]; export type InitializeProposalEvent = - IdlEvents["InitializeProposalEvent"]; + IdlEvents["initializeProposalEvent"]; export type FinalizeProposalEvent = - IdlEvents["FinalizeProposalEvent"]; + IdlEvents["finalizeProposalEvent"]; export type ExecuteProposalEvent = - IdlEvents["ExecuteProposalEvent"]; + IdlEvents["executeProposalEvent"]; export type AutocratEvent = | InitializeDaoEvent | UpdateDaoEvent diff --git a/sdk/src/bid_wall/v0.7/BidWallClient.ts b/sdk/src/bid_wall/v0.7/BidWallClient.ts index da56f78ee..86efb26ce 100644 --- a/sdk/src/bid_wall/v0.7/BidWallClient.ts +++ b/sdk/src/bid_wall/v0.7/BidWallClient.ts @@ -1,4 +1,4 @@ -import { AnchorProvider, Program } from "@coral-xyz/anchor"; +import { AnchorProvider, Program } from "@anchor-lang/core"; import { AccountInfo, PublicKey, SystemProgram } from "@solana/web3.js"; import { MAINNET_USDC, @@ -29,8 +29,7 @@ export class BidWallClient { this.provider = provider; this.programId = bidWallProgramId; this.bidWallProgram = new Program( - BidWallIDL, - bidWallProgramId, + { ...BidWallIDL, address: bidWallProgramId.toBase58() }, provider, ); } @@ -103,7 +102,7 @@ export class BidWallClient { durationSeconds, initialAmmQuoteReserves: new BN(initialAmmQuoteReserves), }) - .accounts({ + .accountsPartial({ bidWall, payer, bidWallQuoteTokenAccount, @@ -166,7 +165,7 @@ export class BidWallClient { amountIn: new BN(amount), minAmountOut: new BN(minAmountOut), }) - .accounts({ + .accountsPartial({ bidWall, user, userTokenAccount, @@ -201,7 +200,7 @@ export class BidWallClient { true, ); - return this.bidWallProgram.methods.collectFees().accounts({ + return this.bidWallProgram.methods.collectFees().accountsPartial({ bidWall, cranker: admin, bidWallQuoteTokenAccount, @@ -240,7 +239,7 @@ export class BidWallClient { true, ); - return this.bidWallProgram.methods.closeBidWall().accounts({ + return this.bidWallProgram.methods.closeBidWall().accountsPartial({ bidWall, authority, feeRecipient, @@ -285,7 +284,7 @@ export class BidWallClient { true, ); - return this.bidWallProgram.methods.cancelBidWall().accounts({ + return this.bidWallProgram.methods.cancelBidWall().accountsPartial({ bidWall, payer, authority, diff --git a/sdk/src/bid_wall/v0.7/pda.ts b/sdk/src/bid_wall/v0.7/pda.ts index a599a3d90..1f9510d7e 100644 --- a/sdk/src/bid_wall/v0.7/pda.ts +++ b/sdk/src/bid_wall/v0.7/pda.ts @@ -1,4 +1,4 @@ -import { BN } from "@coral-xyz/anchor"; +import { BN } from "@anchor-lang/core"; import { PublicKey } from "@solana/web3.js"; import { BID_WALL_V0_7_PROGRAM_ID } from "../../constants.js"; diff --git a/sdk/src/bid_wall/v0.7/types/bid_wall.json b/sdk/src/bid_wall/v0.7/types/bid_wall.json new file mode 100644 index 000000000..828cd3dd3 --- /dev/null +++ b/sdk/src/bid_wall/v0.7/types/bid_wall.json @@ -0,0 +1,2205 @@ +{ + "address": "WALL8ucBuUyL46QYxwYJjidaFYhdvxUFrgvBxPshERx", + "metadata": { + "name": "bid_wall", + "version": "0.7.0", + "spec": "0.1.0", + "description": "A big wall of cash sitting at NAV, ready to take tokens from weak hands and burn them." + }, + "instructions": [ + { + "name": "cancel_bid_wall", + "discriminator": [ + 61, + 200, + 60, + 115, + 213, + 88, + 115, + 138 + ], + "accounts": [ + { + "name": "bid_wall", + "writable": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "authority", + "signer": true, + "relations": [ + "bid_wall" + ] + }, + { + "name": "fee_recipient", + "address": "6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf" + }, + { + "name": "bid_wall_quote_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bid_wall" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "authority_quote_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "authority" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "fee_recipient_quote_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "fee_recipient" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "base_mint" + }, + { + "name": "quote_mint", + "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "close_bid_wall", + "discriminator": [ + 58, + 249, + 140, + 44, + 227, + 80, + 109, + 78 + ], + "accounts": [ + { + "name": "bid_wall", + "writable": true + }, + { + "name": "authority", + "writable": true, + "relations": [ + "bid_wall" + ] + }, + { + "name": "fee_recipient", + "address": "6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf" + }, + { + "name": "bid_wall_quote_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bid_wall" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "authority_quote_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "authority" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "fee_recipient_quote_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "fee_recipient" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "base_mint" + }, + { + "name": "quote_mint", + "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "collect_fees", + "discriminator": [ + 164, + 152, + 207, + 99, + 30, + 186, + 19, + 182 + ], + "accounts": [ + { + "name": "bid_wall", + "writable": true + }, + { + "name": "cranker", + "signer": true + }, + { + "name": "bid_wall_quote_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bid_wall" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "fee_recipient_quote_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 82, + 252, + 193, + 172, + 131, + 78, + 181, + 126, + 228, + 156, + 201, + 238, + 216, + 61, + 22, + 232, + 177, + 119, + 80, + 4, + 10, + 174, + 136, + 68, + 116, + 84, + 24, + 244, + 205, + 59, + 72, + 150 + ] + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "quote_mint", + "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "initialize_bid_wall", + "discriminator": [ + 255, + 36, + 136, + 45, + 188, + 82, + 221, + 218 + ], + "accounts": [ + { + "name": "bid_wall", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 98, + 105, + 100, + 95, + 119, + 97, + 108, + 108 + ] + }, + { + "kind": "account", + "path": "base_mint" + }, + { + "kind": "account", + "path": "creator" + }, + { + "kind": "arg", + "path": "args.nonce" + } + ] + } + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "fee_recipient", + "address": "6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf" + }, + { + "name": "creator", + "signer": true + }, + { + "name": "authority" + }, + { + "name": "bid_wall_quote_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bid_wall" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "creator_quote_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "creator" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "dao_treasury" + }, + { + "name": "base_mint" + }, + { + "name": "quote_mint", + "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "InitializeBidWallArgs" + } + } + } + ] + }, + { + "name": "sell_tokens", + "discriminator": [ + 114, + 242, + 25, + 12, + 62, + 126, + 92, + 2 + ], + "accounts": [ + { + "name": "bid_wall", + "writable": true + }, + { + "name": "user", + "signer": true + }, + { + "name": "user_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "user" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "user_quote_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "user" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "bid_wall_quote_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "bid_wall" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "dao_treasury" + }, + { + "name": "dao_treasury_quote_token_account", + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao_treasury" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "base_mint", + "writable": true, + "relations": [ + "bid_wall" + ] + }, + { + "name": "quote_mint", + "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "SellTokensArgs" + } + } + } + ] + } + ], + "accounts": [ + { + "name": "BidWall", + "discriminator": [ + 61, + 136, + 53, + 25, + 97, + 70, + 228, + 176 + ] + } + ], + "events": [ + { + "name": "BidWallCanceledEvent", + "discriminator": [ + 184, + 235, + 84, + 224, + 65, + 67, + 5, + 82 + ] + }, + { + "name": "BidWallClosedEvent", + "discriminator": [ + 184, + 167, + 138, + 68, + 201, + 210, + 121, + 77 + ] + }, + { + "name": "BidWallFeesCollectedEvent", + "discriminator": [ + 155, + 195, + 135, + 59, + 213, + 142, + 137, + 41 + ] + }, + { + "name": "BidWallInitializedEvent", + "discriminator": [ + 62, + 174, + 125, + 214, + 55, + 40, + 12, + 76 + ] + }, + { + "name": "BidWallTokensSoldEvent", + "discriminator": [ + 113, + 125, + 131, + 85, + 252, + 189, + 79, + 96 + ] + } + ], + "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" + }, + { + "code": 6003, + "name": "InsufficientQuoteReserves", + "msg": "Insufficient quote reserves" + }, + { + "code": 6004, + "name": "BidWallDepleted", + "msg": "Bid wall depleted" + }, + { + "code": 6005, + "name": "InvalidInputAmount", + "msg": "Invalid input amount" + }, + { + "code": 6006, + "name": "InvalidCrankAddress", + "msg": "Invalid crank address" + }, + { + "code": 6007, + "name": "InsufficientOutputAmount", + "msg": "Insufficient output amount" + } + ], + "types": [ + { + "name": "BidWall", + "type": { + "kind": "struct", + "fields": [ + { + "name": "nonce", + "docs": [ + "The nonce of the bid wall." + ], + "type": "u64" + }, + { + "name": "created_timestamp", + "docs": [ + "When the bid wall was created." + ], + "type": "i64" + }, + { + "name": "initial_amm_quote_reserves", + "docs": [ + "The initial quote (USDC) reserves of the Futarchy AMM." + ], + "type": "u64" + }, + { + "name": "quote_amount", + "docs": [ + "The current amount of quote tokens assigned to the bid wall.", + "This is different from the amount in the bid wall quote token account,", + "because anyone can transfer quote tokens to the bid wall, and we don't want that to affect the bid wall's NAV calculation." + ], + "type": "u64" + }, + { + "name": "fees_collected", + "docs": [ + "The fees collected by the bid wall." + ], + "type": "u64" + }, + { + "name": "base_bought_amount", + "docs": [ + "The amount of base tokens bought up by the bid wall." + ], + "type": "u64" + }, + { + "name": "seq_num", + "docs": [ + "The event sequence number of the bid wall." + ], + "type": "u64" + }, + { + "name": "creator", + "docs": [ + "The authority of the bid wall." + ], + "type": "pubkey" + }, + { + "name": "authority", + "docs": [ + "The authority of the bid wall." + ], + "type": "pubkey" + }, + { + "name": "dao_treasury", + "docs": [ + "The DAO treasury address." + ], + "type": "pubkey" + }, + { + "name": "base_mint", + "docs": [ + "The mint of the token being sold into the bid wall." + ], + "type": "pubkey" + }, + { + "name": "fee_recipient", + "docs": [ + "The recipient of the fees collected by the bid wall." + ], + "type": "pubkey" + }, + { + "name": "duration_seconds", + "docs": [ + "The minimum duration in seconds before the bid wall can be closed." + ], + "type": "u32" + }, + { + "name": "pda_bump", + "docs": [ + "The PDA bump." + ], + "type": "u8" + } + ] + } + }, + { + "name": "BidWallCanceledEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "bid_wall", + "type": "pubkey" + } + ] + } + }, + { + "name": "BidWallClosedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "bid_wall", + "type": "pubkey" + } + ] + } + }, + { + "name": "BidWallFeesCollectedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "bid_wall", + "type": "pubkey" + }, + { + "name": "fees_collected", + "type": "u64" + }, + { + "name": "post_bid_wall_quote_token_account_amount", + "type": "u64" + } + ] + } + }, + { + "name": "BidWallInitializedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "bid_wall", + "type": "pubkey" + }, + { + "name": "nonce", + "type": "u64" + }, + { + "name": "initial_amm_quote_reserves", + "type": "u64" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "creator", + "type": "pubkey" + }, + { + "name": "authority", + "type": "pubkey" + }, + { + "name": "dao_treasury", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "fee_recipient", + "type": "pubkey" + }, + { + "name": "duration_seconds", + "type": "u32" + }, + { + "name": "pda_bump", + "type": "u8" + } + ] + } + }, + { + "name": "BidWallTokensSoldEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "bid_wall", + "type": "pubkey" + }, + { + "name": "amount_in", + "type": "u64" + }, + { + "name": "amount_out", + "type": "u64" + }, + { + "name": "fee", + "type": "u64" + }, + { + "name": "post_bid_wall_quote_token_account_amount", + "type": "u64" + }, + { + "name": "post_bid_wall_base_bought_amount", + "type": "u64" + }, + { + "name": "user", + "type": "pubkey" + } + ] + } + }, + { + "name": "CommonFields", + "type": { + "kind": "struct", + "fields": [ + { + "name": "slot", + "type": "u64" + }, + { + "name": "unix_timestamp", + "type": "i64" + }, + { + "name": "bid_wall_seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "InitializeBidWallArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amount", + "type": "u64" + }, + { + "name": "nonce", + "type": "u64" + }, + { + "name": "initial_amm_quote_reserves", + "type": "u64" + }, + { + "name": "duration_seconds", + "type": "u32" + } + ] + } + }, + { + "name": "SellTokensArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amount_in", + "type": "u64" + }, + { + "name": "min_amount_out", + "type": "u64" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/sdk/src/bid_wall/v0.7/types/bid_wall.ts b/sdk/src/bid_wall/v0.7/types/bid_wall.ts index d54b464bd..59bdd5d4e 100644 --- a/sdk/src/bid_wall/v0.7/types/bid_wall.ts +++ b/sdk/src/bid_wall/v0.7/types/bid_wall.ts @@ -1,353 +1,1758 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL can be found at `target/idl/bid_wall.json`. + */ export type BidWall = { - version: "0.7.0"; - name: "bid_wall"; + address: "WALL8ucBuUyL46QYxwYJjidaFYhdvxUFrgvBxPshERx"; + metadata: { + name: "bidWall"; + version: "0.7.0"; + spec: "0.1.0"; + description: "A big wall of cash sitting at NAV, ready to take tokens from weak hands and burn them."; + }; instructions: [ { - name: "initializeBidWall"; + name: "cancelBidWall"; + discriminator: [61, 200, 60, 115, 213, 88, 115, 138]; accounts: [ { name: "bidWall"; - isMut: true; - isSigner: false; + writable: true; }, { name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "feeRecipient"; - isMut: false; - isSigner: false; + writable: true; + signer: true; }, { - name: "creator"; - isMut: false; - isSigner: true; + name: "authority"; + signer: true; + relations: ["bidWall"]; }, { - name: "authority"; - isMut: false; - isSigner: false; + name: "feeRecipient"; + address: "6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf"; }, { name: "bidWallQuoteTokenAccount"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "bidWall"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "creatorQuoteTokenAccount"; - isMut: true; - isSigner: false; + name: "authorityQuoteTokenAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "authority"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "daoTreasury"; - isMut: false; - isSigner: false; + name: "feeRecipientQuoteTokenAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "feeRecipient"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "baseMint"; - isMut: false; - isSigner: false; }, { name: "quoteMint"; - isMut: false; - isSigner: false; + address: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "InitializeBidWallArgs"; - }; }, ]; + args: []; }, { name: "closeBidWall"; + discriminator: [58, 249, 140, 44, 227, 80, 109, 78]; accounts: [ { name: "bidWall"; - isMut: true; - isSigner: false; + writable: true; }, { name: "authority"; - isMut: true; - isSigner: false; + writable: true; + relations: ["bidWall"]; }, { name: "feeRecipient"; - isMut: false; - isSigner: false; + address: "6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf"; }, { name: "bidWallQuoteTokenAccount"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "bidWall"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "authorityQuoteTokenAccount"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "authority"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "feeRecipientQuoteTokenAccount"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "feeRecipient"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "baseMint"; - isMut: false; - isSigner: false; }, { name: "quoteMint"; - isMut: false; - isSigner: false; + address: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { - name: "sellTokens"; + name: "collectFees"; + discriminator: [164, 152, 207, 99, 30, 186, 19, 182]; accounts: [ { name: "bidWall"; - isMut: true; - isSigner: false; - }, - { - name: "user"; - isMut: false; - isSigner: true; - }, - { - name: "userTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { - name: "userQuoteTokenAccount"; - isMut: true; - isSigner: false; + name: "cranker"; + signer: true; }, { name: "bidWallQuoteTokenAccount"; - isMut: true; - isSigner: false; - }, - { - name: "daoTreasury"; - isMut: false; - isSigner: false; - }, - { - name: "daoTreasuryQuoteTokenAccount"; - isMut: false; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "bidWall"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "baseMint"; - isMut: true; - isSigner: false; + name: "feeRecipientQuoteTokenAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 82, + 252, + 193, + 172, + 131, + 78, + 181, + 126, + 228, + 156, + 201, + 238, + 216, + 61, + 22, + 232, + 177, + 119, + 80, + 4, + 10, + 174, + 136, + 68, + 116, + 84, + 24, + 244, + 205, + 59, + 72, + 150, + ]; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "quoteMint"; - isMut: false; - isSigner: false; + address: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "SellTokensArgs"; - }; }, ]; + args: []; }, { - name: "collectFees"; + name: "initializeBidWall"; + discriminator: [255, 36, 136, 45, 188, 82, 221, 218]; accounts: [ { name: "bidWall"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [98, 105, 100, 95, 119, 97, 108, 108]; + }, + { + kind: "account"; + path: "baseMint"; + }, + { + kind: "account"; + path: "creator"; + }, + { + kind: "arg"; + path: "args.nonce"; + }, + ]; + }; }, { - name: "cranker"; - isMut: false; - isSigner: true; + name: "payer"; + writable: true; + signer: true; + }, + { + name: "feeRecipient"; + address: "6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf"; + }, + { + name: "creator"; + signer: true; + }, + { + name: "authority"; }, { name: "bidWallQuoteTokenAccount"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "bidWall"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "feeRecipientQuoteTokenAccount"; - isMut: true; - isSigner: false; + name: "creatorQuoteTokenAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "creator"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; + }, + { + name: "daoTreasury"; + }, + { + name: "baseMint"; }, { name: "quoteMint"; - isMut: false; - isSigner: false; + address: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; + }, + { + name: "associatedTokenProgram"; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; + }, + { + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; - args: []; + args: [ + { + name: "args"; + type: { + defined: { + name: "initializeBidWallArgs"; + }; + }; + }, + ]; }, { - name: "cancelBidWall"; + name: "sellTokens"; + discriminator: [114, 242, 25, 12, 62, 126, 92, 2]; accounts: [ { name: "bidWall"; - isMut: true; - isSigner: false; + writable: true; }, { - name: "payer"; - isMut: true; - isSigner: true; + name: "user"; + signer: true; }, { - name: "authority"; - isMut: false; - isSigner: true; + name: "userTokenAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "user"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "feeRecipient"; - isMut: false; - isSigner: false; + name: "userQuoteTokenAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "user"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "bidWallQuoteTokenAccount"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "bidWall"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "authorityQuoteTokenAccount"; - isMut: true; - isSigner: false; + name: "daoTreasury"; }, { - name: "feeRecipientQuoteTokenAccount"; - isMut: true; - isSigner: false; + name: "daoTreasuryQuoteTokenAccount"; + pda: { + seeds: [ + { + kind: "account"; + path: "daoTreasury"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "baseMint"; - isMut: false; - isSigner: false; + writable: true; + relations: ["bidWall"]; }, { name: "quoteMint"; - isMut: false; - isSigner: false; + address: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; - args: []; + args: [ + { + name: "args"; + type: { + defined: { + name: "sellTokensArgs"; + }; + }; + }, + ]; }, ]; accounts: [ + { + name: "bidWall"; + discriminator: [61, 136, 53, 25, 97, 70, 228, 176]; + }, + ]; + events: [ + { + name: "bidWallCanceledEvent"; + discriminator: [184, 235, 84, 224, 65, 67, 5, 82]; + }, + { + name: "bidWallClosedEvent"; + discriminator: [184, 167, 138, 68, 201, 210, 121, 77]; + }, + { + name: "bidWallFeesCollectedEvent"; + discriminator: [155, 195, 135, 59, 213, 142, 137, 41]; + }, + { + name: "bidWallInitializedEvent"; + discriminator: [62, 174, 125, 214, 55, 40, 12, 76]; + }, + { + name: "bidWallTokensSoldEvent"; + discriminator: [113, 125, 131, 85, 252, 189, 79, 96]; + }, + ]; + 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"; + }, + { + code: 6003; + name: "insufficientQuoteReserves"; + msg: "Insufficient quote reserves"; + }, + { + code: 6004; + name: "bidWallDepleted"; + msg: "Bid wall depleted"; + }, + { + code: 6005; + name: "invalidInputAmount"; + msg: "Invalid input amount"; + }, + { + code: 6006; + name: "invalidCrankAddress"; + msg: "Invalid crank address"; + }, + { + code: 6007; + name: "insufficientOutputAmount"; + msg: "Insufficient output amount"; + }, + ]; + types: [ { name: "bidWall"; type: { @@ -395,27 +1800,27 @@ export type BidWall = { { name: "creator"; docs: ["The authority of the bid wall."]; - type: "publicKey"; + type: "pubkey"; }, { name: "authority"; docs: ["The authority of the bid wall."]; - type: "publicKey"; + type: "pubkey"; }, { name: "daoTreasury"; docs: ["The DAO treasury address."]; - type: "publicKey"; + type: "pubkey"; }, { name: "baseMint"; docs: ["The mint of the token being sold into the bid wall."]; - type: "publicKey"; + type: "pubkey"; }, { name: "feeRecipient"; docs: ["The recipient of the fees collected by the bid wall."]; - type: "publicKey"; + type: "pubkey"; }, { name: "durationSeconds"; @@ -432,1004 +1837,237 @@ export type BidWall = { ]; }; }, - ]; - types: [ { - name: "CommonFields"; + name: "bidWallCanceledEvent"; type: { kind: "struct"; fields: [ { - name: "slot"; - type: "u64"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "unixTimestamp"; - type: "i64"; + name: "bidWall"; + type: "pubkey"; + }, + ]; + }; + }, + { + name: "bidWallClosedEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "bidWallSeqNum"; - type: "u64"; + name: "bidWall"; + type: "pubkey"; }, ]; }; }, { - name: "InitializeBidWallArgs"; + name: "bidWallFeesCollectedEvent"; type: { kind: "struct"; fields: [ { - name: "amount"; - type: "u64"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "nonce"; - type: "u64"; + name: "bidWall"; + type: "pubkey"; }, { - name: "initialAmmQuoteReserves"; + name: "feesCollected"; type: "u64"; }, { - name: "durationSeconds"; - type: "u32"; + name: "postBidWallQuoteTokenAccountAmount"; + type: "u64"; }, ]; }; }, { - name: "SellTokensArgs"; + name: "bidWallInitializedEvent"; type: { kind: "struct"; fields: [ { - name: "amountIn"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "bidWall"; + type: "pubkey"; + }, + { + name: "nonce"; type: "u64"; }, { - name: "minAmountOut"; + name: "initialAmmQuoteReserves"; type: "u64"; }, - ]; - }; - }, - ]; - events: [ - { - name: "BidWallInitializedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "bidWall"; - type: "publicKey"; - index: false; - }, - { - name: "nonce"; - type: "u64"; - index: false; - }, - { - name: "initialAmmQuoteReserves"; - type: "u64"; - index: false; - }, - { - name: "amount"; - type: "u64"; - index: false; - }, - { - name: "creator"; - type: "publicKey"; - index: false; - }, - { - name: "authority"; - type: "publicKey"; - index: false; - }, - { - name: "daoTreasury"; - type: "publicKey"; - index: false; - }, - { - name: "baseMint"; - type: "publicKey"; - index: false; - }, - { - name: "feeRecipient"; - type: "publicKey"; - index: false; - }, - { - name: "durationSeconds"; - type: "u32"; - index: false; - }, - { - name: "pdaBump"; - type: "u8"; - index: false; - }, - ]; - }, - { - name: "BidWallTokensSoldEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "bidWall"; - type: "publicKey"; - index: false; - }, - { - name: "amountIn"; - type: "u64"; - index: false; - }, - { - name: "amountOut"; - type: "u64"; - index: false; - }, - { - name: "fee"; - type: "u64"; - index: false; - }, - { - name: "postBidWallQuoteTokenAccountAmount"; - type: "u64"; - index: false; - }, - { - name: "postBidWallBaseBoughtAmount"; - type: "u64"; - index: false; - }, - { - name: "user"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "BidWallFeesCollectedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "bidWall"; - type: "publicKey"; - index: false; - }, - { - name: "feesCollected"; - type: "u64"; - index: false; - }, - { - name: "postBidWallQuoteTokenAccountAmount"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "BidWallClosedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "bidWall"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "BidWallCanceledEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "bidWall"; - type: "publicKey"; - index: false; - }, - ]; - }, - ]; - 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"; - }, - { - code: 6003; - name: "InsufficientQuoteReserves"; - msg: "Insufficient quote reserves"; - }, - { - code: 6004; - name: "BidWallDepleted"; - msg: "Bid wall depleted"; - }, - { - code: 6005; - name: "InvalidInputAmount"; - msg: "Invalid input amount"; - }, - { - code: 6006; - name: "InvalidCrankAddress"; - msg: "Invalid crank address"; - }, - { - code: 6007; - name: "InsufficientOutputAmount"; - msg: "Insufficient output amount"; - }, - ]; -}; - -export const IDL: BidWall = { - version: "0.7.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: "amount"; + type: "u64"; }, - }, - ], - }, - { - name: "closeBidWall", - accounts: [ - { - name: "bidWall", - isMut: true, - isSigner: false, - }, - { - name: "authority", - isMut: true, - 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: false, - 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: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "SellTokensArgs", + { + name: "creator"; + type: "pubkey"; }, - }, - ], - }, - { - name: "collectFees", - accounts: [ - { - name: "bidWall", - isMut: true, - isSigner: false, - }, - { - name: "cranker", - isMut: false, - isSigner: true, - }, - { - name: "bidWallQuoteTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "feeRecipientQuoteTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - 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: "authority"; + type: "pubkey"; }, { - name: "createdTimestamp", - docs: ["When the bid wall was created."], - type: "i64", + name: "daoTreasury"; + type: "pubkey"; }, { - name: "initialAmmQuoteReserves", - docs: ["The initial quote (USDC) reserves of the Futarchy AMM."], - type: "u64", + name: "baseMint"; + type: "pubkey"; }, { - name: "quoteAmount", - docs: [ - "The current amount of quote tokens assigned to the bid wall.", - "This is different from the amount in the bid wall quote token account,", - "because anyone can transfer quote tokens to the bid wall, and we don't want that to affect the bid wall's NAV calculation.", - ], - type: "u64", + name: "feeRecipient"; + type: "pubkey"; }, { - name: "feesCollected", - docs: ["The fees collected by the bid wall."], - type: "u64", + name: "durationSeconds"; + type: "u32"; }, { - name: "baseBoughtAmount", - docs: ["The amount of base tokens bought up by the bid wall."], - type: "u64", + name: "pdaBump"; + type: "u8"; }, + ]; + }; + }, + { + name: "bidWallTokensSoldEvent"; + type: { + kind: "struct"; + fields: [ { - name: "seqNum", - docs: ["The event sequence number of the bid wall."], - type: "u64", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "creator", - docs: ["The authority of the bid wall."], - type: "publicKey", + name: "bidWall"; + type: "pubkey"; }, { - name: "authority", - docs: ["The authority of the bid wall."], - type: "publicKey", + name: "amountIn"; + type: "u64"; }, { - name: "daoTreasury", - docs: ["The DAO treasury address."], - type: "publicKey", + name: "amountOut"; + type: "u64"; }, { - name: "baseMint", - docs: ["The mint of the token being sold into the bid wall."], - type: "publicKey", + name: "fee"; + type: "u64"; }, { - name: "feeRecipient", - docs: ["The recipient of the fees collected by the bid wall."], - type: "publicKey", + name: "postBidWallQuoteTokenAccountAmount"; + type: "u64"; }, { - name: "durationSeconds", - docs: [ - "The minimum duration in seconds before the bid wall can be closed.", - ], - type: "u32", + name: "postBidWallBaseBoughtAmount"; + type: "u64"; }, { - name: "pdaBump", - docs: ["The PDA bump."], - type: "u8", + name: "user"; + type: "pubkey"; }, - ], - }, + ]; + }; }, - ], - types: [ { - name: "CommonFields", + name: "commonFields"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "slot", - type: "u64", + name: "slot"; + type: "u64"; }, { - name: "unixTimestamp", - type: "i64", + name: "unixTimestamp"; + type: "i64"; }, { - name: "bidWallSeqNum", - type: "u64", + name: "bidWallSeqNum"; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "InitializeBidWallArgs", + name: "initializeBidWallArgs"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "amount", - type: "u64", + name: "amount"; + type: "u64"; }, { - name: "nonce", - type: "u64", + name: "nonce"; + type: "u64"; }, { - name: "initialAmmQuoteReserves", - type: "u64", + name: "initialAmmQuoteReserves"; + type: "u64"; }, { - name: "durationSeconds", - type: "u32", + name: "durationSeconds"; + type: "u32"; }, - ], - }, + ]; + }; }, { - name: "SellTokensArgs", + name: "sellTokensArgs"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "amountIn", - type: "u64", + name: "amountIn"; + type: "u64"; }, { - name: "minAmountOut", - type: "u64", - }, - ], - }, - }, - ], - events: [ - { - name: "BidWallInitializedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "bidWall", - type: "publicKey", - index: false, - }, - { - name: "nonce", - type: "u64", - index: false, - }, - { - name: "initialAmmQuoteReserves", - type: "u64", - index: false, - }, - { - name: "amount", - type: "u64", - index: false, - }, - { - name: "creator", - type: "publicKey", - index: false, - }, - { - name: "authority", - type: "publicKey", - index: false, - }, - { - name: "daoTreasury", - type: "publicKey", - index: false, - }, - { - name: "baseMint", - type: "publicKey", - index: false, - }, - { - name: "feeRecipient", - type: "publicKey", - index: false, - }, - { - name: "durationSeconds", - type: "u32", - index: false, - }, - { - name: "pdaBump", - type: "u8", - index: false, - }, - ], - }, - { - name: "BidWallTokensSoldEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "bidWall", - type: "publicKey", - index: false, - }, - { - name: "amountIn", - type: "u64", - index: false, - }, - { - name: "amountOut", - type: "u64", - index: false, - }, - { - name: "fee", - type: "u64", - index: false, - }, - { - name: "postBidWallQuoteTokenAccountAmount", - type: "u64", - index: false, - }, - { - name: "postBidWallBaseBoughtAmount", - type: "u64", - index: false, - }, - { - name: "user", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "BidWallFeesCollectedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "bidWall", - type: "publicKey", - index: false, - }, - { - name: "feesCollected", - type: "u64", - index: false, - }, - { - name: "postBidWallQuoteTokenAccountAmount", - type: "u64", - index: false, - }, - ], - }, - { - name: "BidWallClosedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "bidWall", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "BidWallCanceledEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "minAmountOut"; + type: "u64"; }, - index: false, - }, - { - name: "bidWall", - type: "publicKey", - index: false, - }, - ], - }, - ], - 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", - }, - { - code: 6003, - name: "InsufficientQuoteReserves", - msg: "Insufficient quote reserves", - }, - { - code: 6004, - name: "BidWallDepleted", - msg: "Bid wall depleted", - }, - { - code: 6005, - name: "InvalidInputAmount", - msg: "Invalid input amount", - }, - { - code: 6006, - name: "InvalidCrankAddress", - msg: "Invalid crank address", - }, - { - code: 6007, - name: "InsufficientOutputAmount", - msg: "Insufficient output amount", + ]; + }; }, - ], + ]; }; diff --git a/sdk/src/bid_wall/v0.7/types/index.ts b/sdk/src/bid_wall/v0.7/types/index.ts index 4403d9092..c3bc00a95 100644 --- a/sdk/src/bid_wall/v0.7/types/index.ts +++ b/sdk/src/bid_wall/v0.7/types/index.ts @@ -1,21 +1,22 @@ -import { IdlAccounts, IdlEvents } from "@coral-xyz/anchor"; +import { IdlAccounts, IdlEvents } from "@anchor-lang/core"; -import { BidWall as BidWallProgram, IDL as BidWallIDL } from "./bid_wall.js"; - -export { BidWallProgram, BidWallIDL }; +import type { BidWall as BidWallProgram } from "./bid_wall.js"; +import bidWallIdl from "./bid_wall.json" with { type: "json" }; +export type { BidWallProgram }; +export const BidWallIDL = bidWallIdl as BidWallProgram; export type BidWall = IdlAccounts["bidWall"]; export type BidWallInitializedEvent = - IdlEvents["BidWallInitializedEvent"]; + IdlEvents["bidWallInitializedEvent"]; export type BidWallTokensSoldEvent = - IdlEvents["BidWallTokensSoldEvent"]; + IdlEvents["bidWallTokensSoldEvent"]; export type BidWallFeesCollectedEvent = - IdlEvents["BidWallFeesCollectedEvent"]; + IdlEvents["bidWallFeesCollectedEvent"]; export type BidWallClosedEvent = - IdlEvents["BidWallClosedEvent"]; + IdlEvents["bidWallClosedEvent"]; export type BidWallCanceledEvent = - IdlEvents["BidWallCanceledEvent"]; + IdlEvents["bidWallCanceledEvent"]; export type BidWallEvent = | BidWallInitializedEvent | BidWallTokensSoldEvent diff --git a/sdk/src/conditional_vault/v0.3/ConditionalVaultClient.ts b/sdk/src/conditional_vault/v0.3/ConditionalVaultClient.ts index c87043c75..dc58412f2 100644 --- a/sdk/src/conditional_vault/v0.3/ConditionalVaultClient.ts +++ b/sdk/src/conditional_vault/v0.3/ConditionalVaultClient.ts @@ -1,10 +1,10 @@ -import { AnchorProvider, Program } from "@coral-xyz/anchor"; +import { AnchorProvider, Program } from "@anchor-lang/core"; import { AddressLookupTableAccount, Keypair, PublicKey } from "@solana/web3.js"; import { - ConditionalVault as ConditionalVaultIDLType, - IDL as ConditionalVaultIDL, -} from "./types/conditional_vault.js"; + ConditionalVaultProgram as ConditionalVaultIDLType, + ConditionalVaultIDL, +} from "./types/index.js"; import BN from "bn.js"; import { @@ -39,8 +39,7 @@ export class ConditionalVaultClient { ) { this.provider = provider; this.vaultProgram = new Program( - ConditionalVaultIDL, - conditionalVaultProgramId, + { ...ConditionalVaultIDL, address: conditionalVaultProgramId.toBase58() }, provider, ); this.luts = luts; @@ -107,7 +106,7 @@ export class ConditionalVaultClient { let ix = this.vaultProgram.methods .mintConditionalTokens(amount) - .accounts({ + .accountsPartial({ authority: user, vault, vaultUnderlyingTokenAccount: getAssociatedTokenAddressSync( @@ -171,7 +170,7 @@ export class ConditionalVaultClient { return this.vaultProgram.methods .initializeConditionalVault({ settlementAuthority }) - .accounts({ + .accountsPartial({ vault, underlyingTokenMint, vaultUnderlyingTokenAccount, @@ -221,7 +220,7 @@ export class ConditionalVaultClient { onFinalizeUri, onRevertUri, }) - .accounts({ + .accountsPartial({ payer, vault, underlyingTokenMint, @@ -250,7 +249,7 @@ export class ConditionalVaultClient { return this.vaultProgram.methods .redeemConditionalTokensForUnderlyingTokens() - .accounts({ + .accountsPartial({ authority: user, vault, vaultUnderlyingTokenAccount: getAssociatedTokenAddressSync( @@ -293,7 +292,7 @@ export class ConditionalVaultClient { return this.vaultProgram.methods .mergeConditionalTokensForUnderlyingTokens(amount) - .accounts({ + .accountsPartial({ authority: user, vault, vaultUnderlyingTokenAccount: getAssociatedTokenAddressSync( diff --git a/sdk/src/conditional_vault/v0.3/pda.ts b/sdk/src/conditional_vault/v0.3/pda.ts index e93bec9af..04a3ccc6f 100644 --- a/sdk/src/conditional_vault/v0.3/pda.ts +++ b/sdk/src/conditional_vault/v0.3/pda.ts @@ -1,5 +1,5 @@ import { PublicKey } from "@solana/web3.js"; -import { utils } from "@coral-xyz/anchor"; +import { utils } from "@anchor-lang/core"; import { CONDITIONAL_VAULT_V0_3_PROGRAM_ID } from "../../constants.js"; export const getVaultAddr = ( diff --git a/sdk/src/conditional_vault/v0.3/types/conditional_vault.json b/sdk/src/conditional_vault/v0.3/types/conditional_vault.json new file mode 100644 index 000000000..2102b390a --- /dev/null +++ b/sdk/src/conditional_vault/v0.3/types/conditional_vault.json @@ -0,0 +1,482 @@ +{ + "address": "VAU1T7S5UuEHmMvXtXMVmpEoQtZ2ya7eRb7gcN47wDp", + "metadata": { + "name": "conditional_vault", + "version": "0.3.0", + "spec": "0.1.0" + }, + "instructions": [ + { + "name": "initialize_conditional_vault", + "discriminator": [ + 37, + 88, + 250, + 212, + 54, + 218, + 227, + 175 + ], + "accounts": [ + { + "name": "vault", + "writable": true + }, + { + "name": "underlying_token_mint" + }, + { + "name": "conditional_on_finalize_token_mint", + "writable": true + }, + { + "name": "conditional_on_revert_token_mint", + "writable": true + }, + { + "name": "vault_underlying_token_account" + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "InitializeConditionalVaultArgs" + } + } + } + ] + }, + { + "name": "add_metadata_to_conditional_tokens", + "discriminator": [ + 133, + 20, + 169, + 231, + 114, + 112, + 45, + 1 + ], + "accounts": [ + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "vault", + "writable": true + }, + { + "name": "underlying_token_mint", + "writable": true + }, + { + "name": "underlying_token_metadata" + }, + { + "name": "conditional_on_finalize_token_mint", + "writable": true + }, + { + "name": "conditional_on_revert_token_mint", + "writable": true + }, + { + "name": "conditional_on_finalize_token_metadata", + "writable": true + }, + { + "name": "conditional_on_revert_token_metadata", + "writable": true + }, + { + "name": "token_metadata_program" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "rent", + "address": "SysvarRent111111111111111111111111111111111" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "AddMetadataToConditionalTokensArgs" + } + } + } + ] + }, + { + "name": "settle_conditional_vault", + "discriminator": [ + 119, + 121, + 76, + 31, + 130, + 158, + 252, + 103 + ], + "accounts": [ + { + "name": "settlement_authority", + "signer": true + }, + { + "name": "vault", + "writable": true + } + ], + "args": [ + { + "name": "new_status", + "type": { + "defined": { + "name": "VaultStatus" + } + } + } + ] + }, + { + "name": "merge_conditional_tokens_for_underlying_tokens", + "discriminator": [ + 217, + 250, + 121, + 158, + 129, + 16, + 63, + 240 + ], + "accounts": [ + { + "name": "vault" + }, + { + "name": "conditional_on_finalize_token_mint", + "writable": true + }, + { + "name": "conditional_on_revert_token_mint", + "writable": true + }, + { + "name": "vault_underlying_token_account", + "writable": true + }, + { + "name": "authority", + "signer": true + }, + { + "name": "user_conditional_on_finalize_token_account", + "writable": true + }, + { + "name": "user_conditional_on_revert_token_account", + "writable": true + }, + { + "name": "user_underlying_token_account", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + } + ], + "args": [ + { + "name": "amount", + "type": "u64" + } + ] + }, + { + "name": "mint_conditional_tokens", + "discriminator": [ + 63, + 20, + 202, + 25, + 179, + 103, + 54, + 128 + ], + "accounts": [ + { + "name": "vault" + }, + { + "name": "conditional_on_finalize_token_mint", + "writable": true + }, + { + "name": "conditional_on_revert_token_mint", + "writable": true + }, + { + "name": "vault_underlying_token_account", + "writable": true + }, + { + "name": "authority", + "signer": true + }, + { + "name": "user_conditional_on_finalize_token_account", + "writable": true + }, + { + "name": "user_conditional_on_revert_token_account", + "writable": true + }, + { + "name": "user_underlying_token_account", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + } + ], + "args": [ + { + "name": "amount", + "type": "u64" + } + ] + }, + { + "name": "redeem_conditional_tokens_for_underlying_tokens", + "discriminator": [ + 88, + 122, + 227, + 150, + 217, + 183, + 89, + 81 + ], + "accounts": [ + { + "name": "vault" + }, + { + "name": "conditional_on_finalize_token_mint", + "writable": true + }, + { + "name": "conditional_on_revert_token_mint", + "writable": true + }, + { + "name": "vault_underlying_token_account", + "writable": true + }, + { + "name": "authority", + "signer": true + }, + { + "name": "user_conditional_on_finalize_token_account", + "writable": true + }, + { + "name": "user_conditional_on_revert_token_account", + "writable": true + }, + { + "name": "user_underlying_token_account", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + } + ], + "args": [] + } + ], + "accounts": [ + { + "name": "ConditionalVault", + "discriminator": [ + 63, + 132, + 87, + 98, + 36, + 51, + 175, + 247 + ] + } + ], + "errors": [ + { + "code": 6000, + "name": "InsufficientUnderlyingTokens", + "msg": "Insufficient underlying token balance to mint this amount of conditional tokens" + }, + { + "code": 6001, + "name": "InvalidVaultUnderlyingTokenAccount", + "msg": "This `vault_underlying_token_account` is not this vault's `underlying_token_account`" + }, + { + "code": 6002, + "name": "InvalidConditionalTokenMint", + "msg": "This conditional token mint is not this vault's conditional token mint" + }, + { + "code": 6003, + "name": "CantRedeemConditionalTokens", + "msg": "Vault needs to be settled as finalized before users can redeem conditional tokens for underlying tokens" + }, + { + "code": 6004, + "name": "VaultAlreadySettled", + "msg": "Once a vault has been settled, its status as either finalized or reverted cannot be changed" + } + ], + "types": [ + { + "name": "AddMetadataToConditionalTokensArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "proposal_number", + "type": "u64" + }, + { + "name": "on_finalize_uri", + "type": "string" + }, + { + "name": "on_revert_uri", + "type": "string" + } + ] + } + }, + { + "name": "InitializeConditionalVaultArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "settlement_authority", + "type": "pubkey" + } + ] + } + }, + { + "name": "VaultStatus", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Active" + }, + { + "name": "Finalized" + }, + { + "name": "Reverted" + } + ] + } + }, + { + "name": "ConditionalVault", + "type": { + "kind": "struct", + "fields": [ + { + "name": "status", + "type": { + "defined": { + "name": "VaultStatus" + } + } + }, + { + "name": "settlement_authority", + "docs": [ + "The account that can either finalize the vault to make conditional tokens", + "redeemable for underlying tokens or revert the vault to make deposit", + "slips redeemable for underlying tokens." + ], + "type": "pubkey" + }, + { + "name": "underlying_token_mint", + "docs": [ + "The mint of the tokens that are deposited into the vault." + ], + "type": "pubkey" + }, + { + "name": "underlying_token_account", + "docs": [ + "The vault's storage account for deposited funds." + ], + "type": "pubkey" + }, + { + "name": "conditional_on_finalize_token_mint", + "type": "pubkey" + }, + { + "name": "conditional_on_revert_token_mint", + "type": "pubkey" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "decimals", + "type": "u8" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/sdk/src/conditional_vault/v0.3/types/conditional_vault.ts b/sdk/src/conditional_vault/v0.3/types/conditional_vault.ts index 4f7d69b99..7d829b155 100644 --- a/sdk/src/conditional_vault/v0.3/types/conditional_vault.ts +++ b/sdk/src/conditional_vault/v0.3/types/conditional_vault.ts @@ -1,203 +1,190 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL was converted from the legacy format with `anchor idl convert` and lives in + * the `.json` file next to this one. + */ export type ConditionalVault = { - version: "0.3.0"; - name: "conditional_vault"; + address: "VAU1T7S5UuEHmMvXtXMVmpEoQtZ2ya7eRb7gcN47wDp"; + metadata: { + name: "conditionalVault"; + version: "0.3.0"; + spec: "0.1.0"; + }; instructions: [ { name: "initializeConditionalVault"; + discriminator: [37, 88, 250, 212, 54, 218, 227, 175]; accounts: [ { name: "vault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "underlyingTokenMint"; - isMut: false; - isSigner: false; }, { name: "conditionalOnFinalizeTokenMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "conditionalOnRevertTokenMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultUnderlyingTokenAccount"; - isMut: false; - isSigner: false; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, ]; args: [ { name: "args"; type: { - defined: "InitializeConditionalVaultArgs"; + defined: { + name: "initializeConditionalVaultArgs"; + }; }; }, ]; }, { name: "addMetadataToConditionalTokens"; + discriminator: [133, 20, 169, 231, 114, 112, 45, 1]; accounts: [ { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "vault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "underlyingTokenMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "underlyingTokenMetadata"; - isMut: false; - isSigner: false; }, { name: "conditionalOnFinalizeTokenMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "conditionalOnRevertTokenMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "conditionalOnFinalizeTokenMetadata"; - isMut: true; - isSigner: false; + writable: true; }, { name: "conditionalOnRevertTokenMetadata"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenMetadataProgram"; - isMut: false; - isSigner: false; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "rent"; - isMut: false; - isSigner: false; + address: "SysvarRent111111111111111111111111111111111"; }, ]; args: [ { name: "args"; type: { - defined: "AddMetadataToConditionalTokensArgs"; + defined: { + name: "addMetadataToConditionalTokensArgs"; + }; }; }, ]; }, { name: "settleConditionalVault"; + discriminator: [119, 121, 76, 31, 130, 158, 252, 103]; accounts: [ { name: "settlementAuthority"; - isMut: false; - isSigner: true; + signer: true; }, { name: "vault"; - isMut: true; - isSigner: false; + writable: true; }, ]; args: [ { name: "newStatus"; type: { - defined: "VaultStatus"; + defined: { + name: "vaultStatus"; + }; }; }, ]; }, { name: "mergeConditionalTokensForUnderlyingTokens"; + discriminator: [217, 250, 121, 158, 129, 16, 63, 240]; accounts: [ { name: "vault"; - isMut: false; - isSigner: false; }, { name: "conditionalOnFinalizeTokenMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "conditionalOnRevertTokenMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "authority"; - isMut: false; - isSigner: true; + signer: true; }, { name: "userConditionalOnFinalizeTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userConditionalOnRevertTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, ]; args: [ @@ -209,51 +196,42 @@ export type ConditionalVault = { }, { name: "mintConditionalTokens"; + discriminator: [63, 20, 202, 25, 179, 103, 54, 128]; accounts: [ { name: "vault"; - isMut: false; - isSigner: false; }, { name: "conditionalOnFinalizeTokenMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "conditionalOnRevertTokenMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "authority"; - isMut: false; - isSigner: true; + signer: true; }, { name: "userConditionalOnFinalizeTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userConditionalOnRevertTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, ]; args: [ @@ -265,51 +243,42 @@ export type ConditionalVault = { }, { name: "redeemConditionalTokensForUnderlyingTokens"; + discriminator: [88, 122, 227, 150, 217, 183, 89, 81]; accounts: [ { name: "vault"; - isMut: false; - isSigner: false; }, { name: "conditionalOnFinalizeTokenMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "conditionalOnRevertTokenMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "authority"; - isMut: false; - isSigner: true; + signer: true; }, { name: "userConditionalOnFinalizeTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userConditionalOnRevertTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, ]; args: []; @@ -318,57 +287,39 @@ export type ConditionalVault = { accounts: [ { name: "conditionalVault"; - type: { - kind: "struct"; - fields: [ - { - name: "status"; - type: { - defined: "VaultStatus"; - }; - }, - { - name: "settlementAuthority"; - docs: [ - "The account that can either finalize the vault to make conditional tokens", - "redeemable for underlying tokens or revert the vault to make deposit", - "slips redeemable for underlying tokens.", - ]; - type: "publicKey"; - }, - { - name: "underlyingTokenMint"; - docs: ["The mint of the tokens that are deposited into the vault."]; - type: "publicKey"; - }, - { - name: "underlyingTokenAccount"; - docs: ["The vault's storage account for deposited funds."]; - type: "publicKey"; - }, - { - name: "conditionalOnFinalizeTokenMint"; - type: "publicKey"; - }, - { - name: "conditionalOnRevertTokenMint"; - type: "publicKey"; - }, - { - name: "pdaBump"; - type: "u8"; - }, - { - name: "decimals"; - type: "u8"; - }, - ]; - }; + discriminator: [63, 132, 87, 98, 36, 51, 175, 247]; + }, + ]; + errors: [ + { + code: 6000; + name: "insufficientUnderlyingTokens"; + msg: "Insufficient underlying token balance to mint this amount of conditional tokens"; + }, + { + code: 6001; + name: "invalidVaultUnderlyingTokenAccount"; + msg: "This `vault_underlying_token_account` is not this vault's `underlying_token_account`"; + }, + { + code: 6002; + name: "invalidConditionalTokenMint"; + msg: "This conditional token mint is not this vault's conditional token mint"; + }, + { + code: 6003; + name: "cantRedeemConditionalTokens"; + msg: "Vault needs to be settled as finalized before users can redeem conditional tokens for underlying tokens"; + }, + { + code: 6004; + name: "vaultAlreadySettled"; + msg: "Once a vault has been settled, its status as either finalized or reverted cannot be changed"; }, ]; types: [ { - name: "AddMetadataToConditionalTokensArgs"; + name: "addMetadataToConditionalTokensArgs"; type: { kind: "struct"; fields: [ @@ -388,508 +339,84 @@ export type ConditionalVault = { }; }, { - name: "InitializeConditionalVaultArgs"; + name: "initializeConditionalVaultArgs"; type: { kind: "struct"; fields: [ { name: "settlementAuthority"; - type: "publicKey"; + type: "pubkey"; }, ]; }; }, { - name: "VaultStatus"; + name: "vaultStatus"; type: { kind: "enum"; variants: [ { - name: "Active"; + name: "active"; }, { - name: "Finalized"; + name: "finalized"; }, { - name: "Reverted"; + name: "reverted"; }, ]; }; }, - ]; - errors: [ { - code: 6000; - name: "InsufficientUnderlyingTokens"; - msg: "Insufficient underlying token balance to mint this amount of conditional tokens"; - }, - { - code: 6001; - name: "InvalidVaultUnderlyingTokenAccount"; - msg: "This `vault_underlying_token_account` is not this vault's `underlying_token_account`"; - }, - { - code: 6002; - name: "InvalidConditionalTokenMint"; - msg: "This conditional token mint is not this vault's conditional token mint"; - }, - { - code: 6003; - name: "CantRedeemConditionalTokens"; - msg: "Vault needs to be settled as finalized before users can redeem conditional tokens for underlying tokens"; - }, - { - code: 6004; - name: "VaultAlreadySettled"; - msg: "Once a vault has been settled, its status as either finalized or reverted cannot be changed"; - }, - ]; -}; - -export const IDL: ConditionalVault = { - version: "0.3.0", - name: "conditional_vault", - instructions: [ - { - name: "initializeConditionalVault", - accounts: [ - { - name: "vault", - isMut: true, - isSigner: false, - }, - { - name: "underlyingTokenMint", - isMut: false, - isSigner: false, - }, - { - name: "conditionalOnFinalizeTokenMint", - isMut: true, - isSigner: false, - }, - { - name: "conditionalOnRevertTokenMint", - isMut: true, - 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, - }, - ], - args: [ - { - name: "args", - type: { - defined: "InitializeConditionalVaultArgs", - }, - }, - ], - }, - { - name: "addMetadataToConditionalTokens", - accounts: [ - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "vault", - isMut: true, - isSigner: false, - }, - { - name: "underlyingTokenMint", - isMut: true, - isSigner: false, - }, - { - name: "underlyingTokenMetadata", - isMut: false, - isSigner: false, - }, - { - name: "conditionalOnFinalizeTokenMint", - isMut: true, - isSigner: false, - }, - { - name: "conditionalOnRevertTokenMint", - isMut: true, - isSigner: false, - }, - { - name: "conditionalOnFinalizeTokenMetadata", - isMut: true, - isSigner: false, - }, - { - name: "conditionalOnRevertTokenMetadata", - isMut: true, - isSigner: false, - }, - { - name: "tokenMetadataProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "rent", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "AddMetadataToConditionalTokensArgs", - }, - }, - ], - }, - { - name: "settleConditionalVault", - accounts: [ - { - name: "settlementAuthority", - isMut: false, - isSigner: true, - }, - { - name: "vault", - isMut: true, - isSigner: false, - }, - ], - args: [ - { - name: "newStatus", - type: { - defined: "VaultStatus", - }, - }, - ], - }, - { - name: "mergeConditionalTokensForUnderlyingTokens", - accounts: [ - { - name: "vault", - isMut: false, - isSigner: false, - }, - { - name: "conditionalOnFinalizeTokenMint", - isMut: true, - isSigner: false, - }, - { - name: "conditionalOnRevertTokenMint", - isMut: true, - isSigner: false, - }, - { - name: "vaultUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "userConditionalOnFinalizeTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "userConditionalOnRevertTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "userUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "amount", - type: "u64", - }, - ], - }, - { - name: "mintConditionalTokens", - accounts: [ - { - name: "vault", - isMut: false, - isSigner: false, - }, - { - name: "conditionalOnFinalizeTokenMint", - isMut: true, - isSigner: false, - }, - { - name: "conditionalOnRevertTokenMint", - isMut: true, - isSigner: false, - }, - { - name: "vaultUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "userConditionalOnFinalizeTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "userConditionalOnRevertTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "userUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "amount", - type: "u64", - }, - ], - }, - { - name: "redeemConditionalTokensForUnderlyingTokens", - accounts: [ - { - name: "vault", - isMut: false, - isSigner: false, - }, - { - name: "conditionalOnFinalizeTokenMint", - isMut: true, - isSigner: false, - }, - { - name: "conditionalOnRevertTokenMint", - isMut: true, - isSigner: false, - }, - { - name: "vaultUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "userConditionalOnFinalizeTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "userConditionalOnRevertTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "userUnderlyingTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "conditionalVault", + name: "conditionalVault"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "status", + name: "status"; type: { - defined: "VaultStatus", - }, + defined: { + name: "vaultStatus"; + }; + }; }, { - name: "settlementAuthority", + name: "settlementAuthority"; docs: [ "The account that can either finalize the vault to make conditional tokens", "redeemable for underlying tokens or revert the vault to make deposit", "slips redeemable for underlying tokens.", - ], - type: "publicKey", - }, - { - name: "underlyingTokenMint", - docs: ["The mint of the tokens that are deposited into the vault."], - type: "publicKey", - }, - { - name: "underlyingTokenAccount", - docs: ["The vault's storage account for deposited funds."], - type: "publicKey", - }, - { - name: "conditionalOnFinalizeTokenMint", - type: "publicKey", - }, - { - name: "conditionalOnRevertTokenMint", - type: "publicKey", - }, - { - name: "pdaBump", - type: "u8", - }, - { - name: "decimals", - type: "u8", - }, - ], - }, - }, - ], - types: [ - { - name: "AddMetadataToConditionalTokensArgs", - type: { - kind: "struct", - fields: [ - { - name: "proposalNumber", - type: "u64", + ]; + type: "pubkey"; }, { - name: "onFinalizeUri", - type: "string", + name: "underlyingTokenMint"; + docs: ["The mint of the tokens that are deposited into the vault."]; + type: "pubkey"; }, { - name: "onRevertUri", - type: "string", + name: "underlyingTokenAccount"; + docs: ["The vault's storage account for deposited funds."]; + type: "pubkey"; }, - ], - }, - }, - { - name: "InitializeConditionalVaultArgs", - type: { - kind: "struct", - fields: [ { - name: "settlementAuthority", - type: "publicKey", + name: "conditionalOnFinalizeTokenMint"; + type: "pubkey"; }, - ], - }, - }, - { - name: "VaultStatus", - type: { - kind: "enum", - variants: [ { - name: "Active", + name: "conditionalOnRevertTokenMint"; + type: "pubkey"; }, { - name: "Finalized", + name: "pdaBump"; + type: "u8"; }, { - name: "Reverted", + name: "decimals"; + type: "u8"; }, - ], - }, - }, - ], - errors: [ - { - code: 6000, - name: "InsufficientUnderlyingTokens", - msg: "Insufficient underlying token balance to mint this amount of conditional tokens", - }, - { - code: 6001, - name: "InvalidVaultUnderlyingTokenAccount", - msg: "This `vault_underlying_token_account` is not this vault's `underlying_token_account`", - }, - { - code: 6002, - name: "InvalidConditionalTokenMint", - msg: "This conditional token mint is not this vault's conditional token mint", - }, - { - code: 6003, - name: "CantRedeemConditionalTokens", - msg: "Vault needs to be settled as finalized before users can redeem conditional tokens for underlying tokens", - }, - { - code: 6004, - name: "VaultAlreadySettled", - msg: "Once a vault has been settled, its status as either finalized or reverted cannot be changed", + ]; + }; }, - ], + ]; }; diff --git a/sdk/src/conditional_vault/v0.3/types/index.ts b/sdk/src/conditional_vault/v0.3/types/index.ts index 17d3471ab..ec227e214 100644 --- a/sdk/src/conditional_vault/v0.3/types/index.ts +++ b/sdk/src/conditional_vault/v0.3/types/index.ts @@ -1,10 +1,10 @@ -import { - ConditionalVault as ConditionalVaultProgram, - IDL as ConditionalVaultIDL, -} from "./conditional_vault.js"; -export { ConditionalVaultProgram, ConditionalVaultIDL }; +import type { ConditionalVault as ConditionalVaultProgram } from "./conditional_vault.js"; +import conditionalVaultIdl from "./conditional_vault.json" with { type: "json" }; +export type { ConditionalVaultProgram }; +export const ConditionalVaultIDL = + conditionalVaultIdl as ConditionalVaultProgram; -import type { IdlAccounts } from "@coral-xyz/anchor"; +import type { IdlAccounts } from "@anchor-lang/core"; export type ConditionalVault = IdlAccounts["conditionalVault"]; diff --git a/sdk/src/conditional_vault/v0.4/ConditionalVaultClient.ts b/sdk/src/conditional_vault/v0.4/ConditionalVaultClient.ts index 8831195c4..02477dea1 100644 --- a/sdk/src/conditional_vault/v0.4/ConditionalVaultClient.ts +++ b/sdk/src/conditional_vault/v0.4/ConditionalVaultClient.ts @@ -1,4 +1,4 @@ -import { AnchorProvider, Program } from "@coral-xyz/anchor"; +import { AnchorProvider, Program } from "@anchor-lang/core"; import { AccountInfo, Keypair, PublicKey } from "@solana/web3.js"; import { ConditionalVaultProgram, ConditionalVaultIDL } from "./types/index.js"; @@ -33,8 +33,7 @@ export class ConditionalVaultClient { constructor(provider: AnchorProvider, conditionalVaultProgramId: PublicKey) { this.provider = provider; this.vaultProgram = new Program( - ConditionalVaultIDL, - conditionalVaultProgramId, + { ...ConditionalVaultIDL, address: conditionalVaultProgramId.toBase58() }, provider, ); } @@ -94,7 +93,7 @@ export class ConditionalVaultClient { oracle, numOutcomes, }) - .accounts({ + .accountsPartial({ question, }); } @@ -146,7 +145,7 @@ export class ConditionalVaultClient { return this.vaultProgram.methods .initializeConditionalVault() - .accounts({ + .accountsPartial({ vault, question, underlyingTokenMint, @@ -195,7 +194,7 @@ export class ConditionalVaultClient { .resolveQuestion({ payoutNumerators, }) - .accounts({ + .accountsPartial({ question, oracle: oracle.publicKey, }) @@ -279,7 +278,7 @@ export class ConditionalVaultClient { return this.vaultProgram.methods .splitTokens(amount) - .accounts({ + .accountsPartial({ question, authority: user, vault, @@ -321,7 +320,7 @@ export class ConditionalVaultClient { let ix = this.vaultProgram.methods .mergeTokens(amount) - .accounts({ + .accountsPartial({ question, authority: user, vault, @@ -388,7 +387,7 @@ export class ConditionalVaultClient { let ix = this.vaultProgram.methods .redeemTokens() - .accounts({ + .accountsPartial({ question, authority: user, vault, @@ -450,7 +449,7 @@ export class ConditionalVaultClient { symbol, uri, }) - .accounts({ + .accountsPartial({ payer, vault, conditionalTokenMint, diff --git a/sdk/src/conditional_vault/v0.4/pda.ts b/sdk/src/conditional_vault/v0.4/pda.ts index 2e52277b2..d8faa3abd 100644 --- a/sdk/src/conditional_vault/v0.4/pda.ts +++ b/sdk/src/conditional_vault/v0.4/pda.ts @@ -1,5 +1,5 @@ import { PublicKey } from "@solana/web3.js"; -import { utils } from "@coral-xyz/anchor"; +import { utils } from "@anchor-lang/core"; import BN from "bn.js"; export const getQuestionAddr = ( diff --git a/sdk/src/conditional_vault/v0.4/types/conditional_vault.json b/sdk/src/conditional_vault/v0.4/types/conditional_vault.json new file mode 100644 index 000000000..6d98ca4f1 --- /dev/null +++ b/sdk/src/conditional_vault/v0.4/types/conditional_vault.json @@ -0,0 +1,1354 @@ +{ + "address": "VLTX1ishMBbcX3rdBWGssxawAo1Q2X2qxYFYqiGodVg", + "metadata": { + "name": "conditional_vault", + "version": "0.4.0", + "spec": "0.1.0", + "description": "SVM-based program for minting conditional tokens" + }, + "instructions": [ + { + "name": "add_metadata_to_conditional_tokens", + "discriminator": [ + 133, + 20, + 169, + 231, + 114, + 112, + 45, + 1 + ], + "accounts": [ + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "vault", + "writable": true + }, + { + "name": "conditional_token_mint" + }, + { + "name": "conditional_token_metadata", + "writable": true + }, + { + "name": "token_metadata_program", + "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "rent", + "address": "SysvarRent111111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "AddMetadataToConditionalTokensArgs" + } + } + } + ] + }, + { + "name": "initialize_conditional_vault", + "discriminator": [ + 37, + 88, + 250, + 212, + 54, + 218, + 227, + 175 + ], + "accounts": [ + { + "name": "vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 99, + 111, + 110, + 100, + 105, + 116, + 105, + 111, + 110, + 97, + 108, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "question" + }, + { + "kind": "account", + "path": "underlying_token_mint" + } + ] + } + }, + { + "name": "question" + }, + { + "name": "underlying_token_mint" + }, + { + "name": "vault_underlying_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "vault" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "underlying_token_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "initialize_question", + "discriminator": [ + 245, + 151, + 106, + 188, + 88, + 44, + 65, + 212 + ], + "accounts": [ + { + "name": "question", + "writable": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "InitializeQuestionArgs" + } + } + } + ] + }, + { + "name": "merge_tokens", + "discriminator": [ + 226, + 89, + 251, + 121, + 225, + 130, + 180, + 14 + ], + "accounts": [ + { + "name": "question", + "relations": [ + "vault" + ] + }, + { + "name": "vault", + "writable": true + }, + { + "name": "vault_underlying_token_account", + "writable": true + }, + { + "name": "authority", + "signer": true + }, + { + "name": "user_underlying_token_account", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "amount", + "type": "u64" + } + ] + }, + { + "name": "redeem_tokens", + "discriminator": [ + 246, + 98, + 134, + 41, + 152, + 33, + 120, + 69 + ], + "accounts": [ + { + "name": "question", + "relations": [ + "vault" + ] + }, + { + "name": "vault", + "writable": true + }, + { + "name": "vault_underlying_token_account", + "writable": true + }, + { + "name": "authority", + "signer": true + }, + { + "name": "user_underlying_token_account", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "resolve_question", + "discriminator": [ + 52, + 32, + 224, + 179, + 180, + 8, + 0, + 246 + ], + "accounts": [ + { + "name": "question", + "writable": true + }, + { + "name": "oracle", + "signer": true, + "relations": [ + "question" + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "ResolveQuestionArgs" + } + } + } + ] + }, + { + "name": "split_tokens", + "discriminator": [ + 79, + 195, + 116, + 0, + 140, + 176, + 73, + 179 + ], + "accounts": [ + { + "name": "question", + "relations": [ + "vault" + ] + }, + { + "name": "vault", + "writable": true + }, + { + "name": "vault_underlying_token_account", + "writable": true + }, + { + "name": "authority", + "signer": true + }, + { + "name": "user_underlying_token_account", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "amount", + "type": "u64" + } + ] + } + ], + "accounts": [ + { + "name": "ConditionalVault", + "discriminator": [ + 63, + 132, + 87, + 98, + 36, + 51, + 175, + 247 + ] + }, + { + "name": "Question", + "discriminator": [ + 111, + 22, + 150, + 220, + 181, + 122, + 118, + 127 + ] + } + ], + "events": [ + { + "name": "AddMetadataToConditionalTokensEvent", + "discriminator": [ + 185, + 201, + 129, + 156, + 179, + 177, + 111, + 50 + ] + }, + { + "name": "InitializeConditionalVaultEvent", + "discriminator": [ + 62, + 212, + 201, + 253, + 217, + 193, + 232, + 182 + ] + }, + { + "name": "InitializeQuestionEvent", + "discriminator": [ + 89, + 199, + 242, + 209, + 55, + 67, + 183, + 201 + ] + }, + { + "name": "MergeTokensEvent", + "discriminator": [ + 34, + 107, + 222, + 189, + 126, + 194, + 10, + 90 + ] + }, + { + "name": "RedeemTokensEvent", + "discriminator": [ + 36, + 211, + 53, + 194, + 23, + 5, + 75, + 90 + ] + }, + { + "name": "ResolveQuestionEvent", + "discriminator": [ + 0, + 175, + 131, + 95, + 5, + 84, + 50, + 29 + ] + }, + { + "name": "SplitTokensEvent", + "discriminator": [ + 42, + 188, + 142, + 203, + 78, + 60, + 242, + 149 + ] + } + ], + "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" + }, + { + "code": 6017, + "name": "InvalidPayoutNumerators", + "msg": "Payout numerators are too large, causing an overflow" + }, + { + "code": 6018, + "name": "TooManyOutcomes", + "msg": "Questions can only have up to 10 outcomes" + } + ], + "types": [ + { + "name": "AddMetadataToConditionalTokensArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "name", + "type": "string" + }, + { + "name": "symbol", + "type": "string" + }, + { + "name": "uri", + "type": "string" + } + ] + } + }, + { + "name": "AddMetadataToConditionalTokensEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "vault", + "type": "pubkey" + }, + { + "name": "conditional_token_mint", + "type": "pubkey" + }, + { + "name": "conditional_token_metadata", + "type": "pubkey" + }, + { + "name": "name", + "type": "string" + }, + { + "name": "symbol", + "type": "string" + }, + { + "name": "uri", + "type": "string" + }, + { + "name": "seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "CommonFields", + "type": { + "kind": "struct", + "fields": [ + { + "name": "slot", + "type": "u64" + }, + { + "name": "unix_timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "ConditionalVault", + "type": { + "kind": "struct", + "fields": [ + { + "name": "question", + "type": "pubkey" + }, + { + "name": "underlying_token_mint", + "type": "pubkey" + }, + { + "name": "underlying_token_account", + "type": "pubkey" + }, + { + "name": "conditional_token_mints", + "type": { + "vec": "pubkey" + } + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "decimals", + "type": "u8" + }, + { + "name": "seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "InitializeConditionalVaultEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "vault", + "type": "pubkey" + }, + { + "name": "question", + "type": "pubkey" + }, + { + "name": "underlying_token_mint", + "type": "pubkey" + }, + { + "name": "vault_underlying_token_account", + "type": "pubkey" + }, + { + "name": "conditional_token_mints", + "type": { + "vec": "pubkey" + } + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "InitializeQuestionArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "question_id", + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "oracle", + "type": "pubkey" + }, + { + "name": "num_outcomes", + "type": "u8" + } + ] + } + }, + { + "name": "InitializeQuestionEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "question_id", + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "oracle", + "type": "pubkey" + }, + { + "name": "num_outcomes", + "type": "u8" + }, + { + "name": "question", + "type": "pubkey" + } + ] + } + }, + { + "name": "MergeTokensEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "vault", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "post_user_underlying_balance", + "type": "u64" + }, + { + "name": "post_vault_underlying_balance", + "type": "u64" + }, + { + "name": "post_user_conditional_token_balances", + "type": { + "vec": "u64" + } + }, + { + "name": "post_conditional_token_supplies", + "type": { + "vec": "u64" + } + }, + { + "name": "seq_num", + "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": "question_id", + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "oracle", + "type": "pubkey" + }, + { + "name": "payout_numerators", + "type": { + "vec": "u32" + } + }, + { + "name": "payout_denominator", + "type": "u32" + } + ] + } + }, + { + "name": "RedeemTokensEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "vault", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "post_user_underlying_balance", + "type": "u64" + }, + { + "name": "post_vault_underlying_balance", + "type": "u64" + }, + { + "name": "post_conditional_token_supplies", + "type": { + "vec": "u64" + } + }, + { + "name": "seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "ResolveQuestionArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "payout_numerators", + "type": { + "vec": "u32" + } + } + ] + } + }, + { + "name": "ResolveQuestionEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "question", + "type": "pubkey" + }, + { + "name": "payout_numerators", + "type": { + "vec": "u32" + } + } + ] + } + }, + { + "name": "SplitTokensEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "vault", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "post_user_underlying_balance", + "type": "u64" + }, + { + "name": "post_vault_underlying_balance", + "type": "u64" + }, + { + "name": "post_user_conditional_token_balances", + "type": { + "vec": "u64" + } + }, + { + "name": "post_conditional_token_supplies", + "type": { + "vec": "u64" + } + }, + { + "name": "seq_num", + "type": "u64" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/sdk/src/conditional_vault/v0.4/types/conditional_vault.ts b/sdk/src/conditional_vault/v0.4/types/conditional_vault.ts index aae14616a..f58a6b327 100644 --- a/sdk/src/conditional_vault/v0.4/types/conditional_vault.ts +++ b/sdk/src/conditional_vault/v0.4/types/conditional_vault.ts @@ -1,227 +1,404 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL can be found at `target/idl/conditional_vault.json`. + */ export type ConditionalVault = { - version: "0.4.0"; - name: "conditional_vault"; + address: "VLTX1ishMBbcX3rdBWGssxawAo1Q2X2qxYFYqiGodVg"; + metadata: { + name: "conditionalVault"; + version: "0.4.0"; + spec: "0.1.0"; + description: "SVM-based program for minting conditional tokens"; + }; instructions: [ { - name: "initializeQuestion"; + name: "addMetadataToConditionalTokens"; + discriminator: [133, 20, 169, 231, 114, 112, 45, 1]; accounts: [ - { - name: "question"; - isMut: true; - isSigner: false; - }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { - name: "systemProgram"; - isMut: false; - isSigner: false; + name: "vault"; + writable: true; }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + name: "conditionalTokenMint"; }, { - name: "program"; - isMut: false; - isSigner: false; + name: "conditionalTokenMetadata"; + writable: true; }, - ]; - args: [ { - name: "args"; - type: { - defined: "InitializeQuestionArgs"; - }; + name: "tokenMetadataProgram"; + address: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"; }, - ]; - }, - { - name: "resolveQuestion"; - accounts: [ { - name: "question"; - isMut: true; - isSigner: false; + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, { - name: "oracle"; - isMut: false; - isSigner: true; + name: "rent"; + address: "SysvarRent111111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "args"; type: { - defined: "ResolveQuestionArgs"; + defined: { + name: "addMetadataToConditionalTokensArgs"; + }; }; }, ]; }, { name: "initializeConditionalVault"; + discriminator: [37, 88, 250, 212, 54, 218, 227, 175]; accounts: [ { name: "vault"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 99, + 111, + 110, + 100, + 105, + 116, + 105, + 111, + 110, + 97, + 108, + 95, + 118, + 97, + 117, + 108, + 116, + ]; + }, + { + kind: "account"; + path: "question"; + }, + { + kind: "account"; + path: "underlyingTokenMint"; + }, + ]; + }; }, { name: "question"; - isMut: false; - isSigner: false; }, { name: "underlyingTokenMint"; - isMut: false; - isSigner: false; }, { name: "vaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "vault"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "underlyingTokenMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { - name: "splitTokens"; + name: "initializeQuestion"; + discriminator: [245, 151, 106, 188, 88, 44, 65, 212]; accounts: [ { name: "question"; - isMut: false; - isSigner: false; - }, - { - name: "vault"; - isMut: true; - isSigner: false; - }, - { - name: "vaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { - name: "authority"; - isMut: false; - isSigner: true; - }, - { - name: "userUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + name: "payer"; + writable: true; + signer: true; }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { - name: "amount"; - type: "u64"; + name: "args"; + type: { + defined: { + name: "initializeQuestionArgs"; + }; + }; }, ]; }, { name: "mergeTokens"; + discriminator: [226, 89, 251, 121, 225, 130, 180, 14]; accounts: [ { name: "question"; - isMut: false; - isSigner: false; + relations: ["vault"]; }, { name: "vault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "authority"; - isMut: false; - isSigner: true; + signer: true; }, { name: "userUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ @@ -233,105 +410,189 @@ export type ConditionalVault = { }, { name: "redeemTokens"; + discriminator: [246, 98, 134, 41, 152, 33, 120, 69]; accounts: [ { name: "question"; - isMut: false; - isSigner: false; + relations: ["vault"]; }, { name: "vault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "authority"; - isMut: false; - isSigner: true; + signer: true; }, { name: "userUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { - name: "addMetadataToConditionalTokens"; + name: "resolveQuestion"; + discriminator: [52, 32, 224, 179, 180, 8, 0, 246]; accounts: [ { - name: "payer"; - isMut: true; - isSigner: true; + name: "question"; + writable: true; }, { - name: "vault"; - isMut: true; - isSigner: false; + name: "oracle"; + signer: true; + relations: ["question"]; }, { - name: "conditionalTokenMint"; - isMut: false; - isSigner: false; + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { - name: "conditionalTokenMetadata"; - isMut: true; - isSigner: false; + name: "program"; }, + ]; + args: [ { - name: "tokenMetadataProgram"; - isMut: false; - isSigner: false; + name: "args"; + type: { + defined: { + name: "resolveQuestionArgs"; + }; + }; }, + ]; + }, + { + name: "splitTokens"; + discriminator: [79, 195, 116, 0, 140, 176, 73, 179]; + accounts: [ { - name: "systemProgram"; - isMut: false; - isSigner: false; + name: "question"; + relations: ["vault"]; }, { - name: "rent"; - isMut: false; - isSigner: false; + name: "vault"; + writable: true; + }, + { + name: "vaultUnderlyingTokenAccount"; + writable: true; + }, + { + name: "authority"; + signer: true; + }, + { + name: "userUnderlyingTokenAccount"; + writable: true; + }, + { + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { - name: "args"; - type: { - defined: "AddMetadataToConditionalTokensArgs"; - }; + name: "amount"; + type: "u64"; }, ]; }, @@ -339,34 +600,197 @@ export type ConditionalVault = { accounts: [ { name: "conditionalVault"; + discriminator: [63, 132, 87, 98, 36, 51, 175, 247]; + }, + { + name: "question"; + discriminator: [111, 22, 150, 220, 181, 122, 118, 127]; + }, + ]; + events: [ + { + name: "addMetadataToConditionalTokensEvent"; + discriminator: [185, 201, 129, 156, 179, 177, 111, 50]; + }, + { + name: "initializeConditionalVaultEvent"; + discriminator: [62, 212, 201, 253, 217, 193, 232, 182]; + }, + { + name: "initializeQuestionEvent"; + discriminator: [89, 199, 242, 209, 55, 67, 183, 201]; + }, + { + name: "mergeTokensEvent"; + discriminator: [34, 107, 222, 189, 126, 194, 10, 90]; + }, + { + name: "redeemTokensEvent"; + discriminator: [36, 211, 53, 194, 23, 5, 75, 90]; + }, + { + name: "resolveQuestionEvent"; + discriminator: [0, 175, 131, 95, 5, 84, 50, 29]; + }, + { + name: "splitTokensEvent"; + discriminator: [42, 188, 142, 203, 78, 60, 242, 149]; + }, + ]; + 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"; + }, + { + code: 6017; + name: "invalidPayoutNumerators"; + msg: "Payout numerators are too large, causing an overflow"; + }, + { + code: 6018; + name: "tooManyOutcomes"; + msg: "Questions can only have up to 10 outcomes"; + }, + ]; + types: [ + { + name: "addMetadataToConditionalTokensArgs"; type: { kind: "struct"; fields: [ { - name: "question"; - type: "publicKey"; + name: "name"; + type: "string"; }, { - name: "underlyingTokenMint"; - type: "publicKey"; + name: "symbol"; + type: "string"; }, { - name: "underlyingTokenAccount"; - type: "publicKey"; + name: "uri"; + type: "string"; }, + ]; + }; + }, + { + name: "addMetadataToConditionalTokensEvent"; + type: { + kind: "struct"; + fields: [ { - name: "conditionalTokenMints"; + name: "common"; type: { - vec: "publicKey"; + defined: { + name: "commonFields"; + }; }; }, { - name: "pdaBump"; - type: "u8"; + name: "vault"; + type: "pubkey"; }, { - name: "decimals"; - type: "u8"; + name: "conditionalTokenMint"; + type: "pubkey"; + }, + { + name: "conditionalTokenMetadata"; + type: "pubkey"; + }, + { + name: "name"; + type: "string"; + }, + { + name: "symbol"; + type: "string"; + }, + { + name: "uri"; + type: "string"; }, { name: "seqNum"; @@ -376,98 +800,140 @@ export type ConditionalVault = { }; }, { - 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.", - ]; + name: "commonFields"; type: { kind: "struct"; fields: [ { - name: "questionId"; - type: { - array: ["u8", 32]; - }; + name: "slot"; + type: "u64"; }, { - name: "oracle"; - type: "publicKey"; + name: "unixTimestamp"; + type: "i64"; + }, + ]; + }; + }, + { + name: "conditionalVault"; + type: { + kind: "struct"; + fields: [ + { + name: "question"; + type: "pubkey"; }, { - name: "payoutNumerators"; + name: "underlyingTokenMint"; + type: "pubkey"; + }, + { + name: "underlyingTokenAccount"; + type: "pubkey"; + }, + { + name: "conditionalTokenMints"; type: { - vec: "u32"; + vec: "pubkey"; }; }, { - name: "payoutDenominator"; - type: "u32"; + name: "pdaBump"; + type: "u8"; + }, + { + name: "decimals"; + type: "u8"; + }, + { + name: "seqNum"; + type: "u64"; }, ]; }; }, - ]; - types: [ { - name: "CommonFields"; + name: "initializeConditionalVaultEvent"; type: { kind: "struct"; fields: [ { - name: "slot"; - type: "u64"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "unixTimestamp"; - type: "i64"; + name: "vault"; + type: "pubkey"; + }, + { + name: "question"; + type: "pubkey"; + }, + { + name: "underlyingTokenMint"; + type: "pubkey"; + }, + { + name: "vaultUnderlyingTokenAccount"; + type: "pubkey"; + }, + { + name: "conditionalTokenMints"; + type: { + vec: "pubkey"; + }; + }, + { + name: "pdaBump"; + type: "u8"; + }, + { + name: "seqNum"; + type: "u64"; }, ]; }; }, { - name: "AddMetadataToConditionalTokensArgs"; + name: "initializeQuestionArgs"; type: { kind: "struct"; fields: [ { - name: "name"; - type: "string"; + name: "questionId"; + type: { + array: ["u8", 32]; + }; }, { - name: "symbol"; - type: "string"; + name: "oracle"; + type: "pubkey"; }, { - name: "uri"; - type: "string"; + name: "numOutcomes"; + type: "u8"; }, ]; }; }, { - name: "InitializeQuestionArgs"; + name: "initializeQuestionEvent"; type: { kind: "struct"; fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, { name: "questionId"; type: { @@ -476,825 +942,73 @@ export type ConditionalVault = { }, { name: "oracle"; - type: "publicKey"; + type: "pubkey"; }, { name: "numOutcomes"; type: "u8"; }, + { + name: "question"; + type: "pubkey"; + }, ]; }; }, { - name: "ResolveQuestionArgs"; + name: "mergeTokensEvent"; type: { kind: "struct"; fields: [ { - name: "payoutNumerators"; + name: "common"; type: { - vec: "u32"; + defined: { + name: "commonFields"; + }; }; }, - ]; - }; - }, - ]; - 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"; - }, - { - code: 6017; - name: "InvalidPayoutNumerators"; - msg: "Payout numerators are too large, causing an overflow"; - }, - { - code: 6018; - name: "TooManyOutcomes"; - msg: "Questions can only have up to 10 outcomes"; - }, - ]; -}; - -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: 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: "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: false, - 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", + { + name: "user"; + type: "pubkey"; }, - }, - ], - }, - ], - accounts: [ - { - name: "conditionalVault", - type: { - kind: "struct", - fields: [ { - name: "question", - type: "publicKey", + name: "vault"; + type: "pubkey"; }, { - name: "underlyingTokenMint", - type: "publicKey", + name: "amount"; + type: "u64"; }, { - name: "underlyingTokenAccount", - type: "publicKey", + name: "postUserUnderlyingBalance"; + type: "u64"; }, { - name: "conditionalTokenMints", - type: { - vec: "publicKey", - }, + name: "postVaultUnderlyingBalance"; + type: "u64"; }, { - name: "pdaBump", - type: "u8", + name: "postUserConditionalTokenBalances"; + type: { + vec: "u64"; + }; }, { - name: "decimals", - type: "u8", + name: "postConditionalTokenSupplies"; + type: { + vec: "u64"; + }; }, { - name: "seqNum", - type: "u64", + name: "seqNum"; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "question", + name: "question"; docs: [ "Questions represent statements about future events.", "", @@ -1316,520 +1030,170 @@ export const IDL: ConditionalVault = { "outcome would resolve to 0.3.", "", "Once resolved, the sum of all outcome resolutions is exactly 1.", - ], + ]; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "questionId", + name: "questionId"; type: { - array: ["u8", 32], - }, + array: ["u8", 32]; + }; }, { - name: "oracle", - type: "publicKey", + name: "oracle"; + type: "pubkey"; }, { - name: "payoutNumerators", + name: "payoutNumerators"; type: { - vec: "u32", - }, + vec: "u32"; + }; }, { - name: "payoutDenominator", - type: "u32", + name: "payoutDenominator"; + type: "u32"; }, - ], - }, + ]; + }; }, - ], - types: [ { - name: "CommonFields", + name: "redeemTokensEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "slot", - type: "u64", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "unixTimestamp", - type: "i64", + name: "user"; + type: "pubkey"; }, - ], - }, - }, - { - name: "AddMetadataToConditionalTokensArgs", - type: { - kind: "struct", - fields: [ { - name: "name", - type: "string", + name: "vault"; + type: "pubkey"; }, { - name: "symbol", - type: "string", + name: "amount"; + type: "u64"; }, { - name: "uri", - type: "string", + name: "postUserUnderlyingBalance"; + type: "u64"; }, - ], - }, - }, - { - name: "InitializeQuestionArgs", - type: { - kind: "struct", - fields: [ { - name: "questionId", - type: { - array: ["u8", 32], - }, + name: "postVaultUnderlyingBalance"; + type: "u64"; }, { - name: "oracle", - type: "publicKey", + name: "postConditionalTokenSupplies"; + type: { + vec: "u64"; + }; }, { - name: "numOutcomes", - type: "u8", + name: "seqNum"; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "ResolveQuestionArgs", + name: "resolveQuestionArgs"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "payoutNumerators", + name: "payoutNumerators"; type: { - vec: "u32", - }, - }, - ], - }, - }, - ], - events: [ - { - name: "AddMetadataToConditionalTokensEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + vec: "u32"; + }; }, - 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", + name: "resolveQuestionEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, - index: false, - }, - { - name: "pdaBump", - type: "u8", - index: false, - }, - { - name: "seqNum", - type: "u64", - index: false, - }, - ], - }, - { - name: "InitializeQuestionEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "question"; + type: "pubkey"; }, - index: false, - }, - { - name: "questionId", - type: { - array: ["u8", 32], + { + name: "payoutNumerators"; + type: { + vec: "u32"; + }; }, - 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", + name: "splitTokensEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, - index: false, - }, - { - name: "postConditionalTokenSupplies", - type: { - vec: "u64", + { + name: "user"; + type: "pubkey"; }, - index: false, - }, - { - name: "seqNum", - type: "u64", - index: false, - }, - ], - }, - { - name: "RedeemTokensEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "vault"; + type: "pubkey"; }, - 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", + { + name: "amount"; + type: "u64"; }, - index: false, - }, - { - name: "seqNum", - type: "u64", - index: false, - }, - ], - }, - { - name: "ResolveQuestionEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "postUserUnderlyingBalance"; + type: "u64"; }, - index: false, - }, - { - name: "question", - type: "publicKey", - index: false, - }, - { - name: "payoutNumerators", - type: { - vec: "u32", + { + name: "postVaultUnderlyingBalance"; + type: "u64"; }, - index: false, - }, - ], - }, - { - name: "SplitTokensEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "postUserConditionalTokenBalances"; + type: { + vec: "u64"; + }; }, - 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", + { + name: "postConditionalTokenSupplies"; + type: { + vec: "u64"; + }; }, - index: false, - }, - { - name: "postConditionalTokenSupplies", - type: { - vec: "u64", + { + name: "seqNum"; + type: "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", - }, - { - code: 6017, - name: "InvalidPayoutNumerators", - msg: "Payout numerators are too large, causing an overflow", - }, - { - code: 6018, - name: "TooManyOutcomes", - msg: "Questions can only have up to 10 outcomes", + ]; + }; }, - ], + ]; }; diff --git a/sdk/src/conditional_vault/v0.4/types/index.ts b/sdk/src/conditional_vault/v0.4/types/index.ts index b308696ed..d456f5cc7 100644 --- a/sdk/src/conditional_vault/v0.4/types/index.ts +++ b/sdk/src/conditional_vault/v0.4/types/index.ts @@ -1,29 +1,29 @@ -import { - ConditionalVault as ConditionalVaultProgram, - IDL as ConditionalVaultIDL, -} from "./conditional_vault.js"; -export { ConditionalVaultProgram, ConditionalVaultIDL }; +import type { ConditionalVault as ConditionalVaultProgram } from "./conditional_vault.js"; +import conditionalVaultIdl from "./conditional_vault.json" with { type: "json" }; +export type { ConditionalVaultProgram }; +export const ConditionalVaultIDL = + conditionalVaultIdl as ConditionalVaultProgram; -import type { IdlAccounts, IdlEvents } from "@coral-xyz/anchor"; +import type { IdlAccounts, IdlEvents } from "@anchor-lang/core"; export type Question = IdlAccounts["question"]; export type ConditionalVault = IdlAccounts["conditionalVault"]; export type AddMetadataToConditionalTokensEvent = - IdlEvents["AddMetadataToConditionalTokensEvent"]; + IdlEvents["addMetadataToConditionalTokensEvent"]; export type InitializeConditionalVaultEvent = - IdlEvents["InitializeConditionalVaultEvent"]; + IdlEvents["initializeConditionalVaultEvent"]; export type InitializeQuestionEvent = - IdlEvents["InitializeQuestionEvent"]; + IdlEvents["initializeQuestionEvent"]; export type MergeTokensEvent = - IdlEvents["MergeTokensEvent"]; + IdlEvents["mergeTokensEvent"]; export type RedeemTokensEvent = - IdlEvents["RedeemTokensEvent"]; + IdlEvents["redeemTokensEvent"]; export type ResolveQuestionEvent = - IdlEvents["ResolveQuestionEvent"]; + IdlEvents["resolveQuestionEvent"]; export type SplitTokensEvent = - IdlEvents["SplitTokensEvent"]; + IdlEvents["splitTokensEvent"]; export type ConditionalVaultEvent = | AddMetadataToConditionalTokensEvent | InitializeConditionalVaultEvent diff --git a/sdk/src/constants.ts b/sdk/src/constants.ts index a9e431a81..f03ea4d80 100644 --- a/sdk/src/constants.ts +++ b/sdk/src/constants.ts @@ -1,5 +1,5 @@ import { Keypair, PublicKey } from "@solana/web3.js"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { BN } from "bn.js"; export const AUTOCRAT_V0_3_PROGRAM_ID = new PublicKey( diff --git a/sdk/src/futarchy/v0.6/FutarchyClient.ts b/sdk/src/futarchy/v0.6/FutarchyClient.ts index 53cae9815..d7b73ae6c 100644 --- a/sdk/src/futarchy/v0.6/FutarchyClient.ts +++ b/sdk/src/futarchy/v0.6/FutarchyClient.ts @@ -1,4 +1,4 @@ -import { AnchorProvider, Program } from "@coral-xyz/anchor"; +import { AnchorProvider, Program } from "@anchor-lang/core"; import { AccountInfo, AddressLookupTableAccount, @@ -46,15 +46,14 @@ import { SetSpendingLimitArgs, SpendingLimitAction, } 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 { - Futarchy as v0_6_1_futarchy, - IDL as v0_6_1_futarchyIDL, -} from "./types/v0.6.1-futarchy.js"; + FutarchyProgram as Futarchy, + FutarchyIDL, + v0_6_0_Futarchy as v0_6_0_futarchy, + v0_6_0_FutarchyIDL as v0_6_0_futarchyIDL, + v0_6_1_Futarchy as v0_6_1_futarchy, + v0_6_1_FutarchyIDL as v0_6_1_futarchyIDL, +} from "./types/index.js"; import { getDaoAddr, getEnqueuedMultisigProposalApprovalAddr, @@ -107,18 +106,15 @@ export class FutarchyClient { ) { this.provider = provider; this.futarchy = new Program( - FutarchyIDL, - futarchyProgramId, + { ...FutarchyIDL, address: futarchyProgramId.toBase58() }, provider, ); this.v0_6_0_futarchy = new Program( - v0_6_0_futarchyIDL, - futarchyProgramId, + { ...v0_6_0_futarchyIDL, address: futarchyProgramId.toBase58() }, provider, ); this.v0_6_1_futarchy = new Program( - v0_6_1_futarchyIDL, - futarchyProgramId, + { ...v0_6_1_futarchyIDL, address: futarchyProgramId.toBase58() }, provider, ); this.vaultClient = ConditionalVaultClient.createClient({ @@ -282,7 +278,7 @@ export class FutarchyClient { createKey: dao, })[0]; - return this.futarchy.methods.initializeDao(params).accounts({ + return this.futarchy.methods.initializeDao(params).accountsPartial({ dao, baseMint, quoteMint, @@ -377,7 +373,7 @@ export class FutarchyClient { return this.futarchy.methods .launchProposal() - .accounts({ + .accountsPartial({ proposal, dao, baseVault, @@ -448,7 +444,7 @@ export class FutarchyClient { inputAmount, minOutputAmount, }) - .accounts({ + .accountsPartial({ dao, userBaseAccount: getAssociatedTokenAddressSync(baseMint, trader, true), userQuoteAccount: getAssociatedTokenAddressSync( @@ -511,7 +507,7 @@ export class FutarchyClient { minLiquidity, positionAuthority, }) - .accounts({ + .accountsPartial({ dao, liquidityProvider, liquidityProviderBaseAccount: getAssociatedTokenAddressSync( @@ -606,7 +602,7 @@ export class FutarchyClient { inputAmount, minOutputAmount, }) - .accounts({ + .accountsPartial({ dao, proposal, ammBaseVault: getAssociatedTokenAddressSync(baseMint, dao, true), @@ -839,7 +835,7 @@ export class FutarchyClient { return this.futarchy.methods .initializeProposal() - .accounts({ + .accountsPartial({ question, proposal, squadsProposal, @@ -1060,7 +1056,7 @@ export class FutarchyClient { }) { return this.futarchy.methods .initializeLargeSpendProposal({ amount }) - .accounts({ + .accountsPartial({ typedInitializeAccounts: this.typedInitializeAccounts({ dao, baseMint, @@ -1158,7 +1154,7 @@ export class FutarchyClient { return this.futarchy.methods .initializeMintTokensProposal({ amount, recipient }) - .accounts({ + .accountsPartial({ typedInitializeAccounts: this.typedInitializeAccounts({ dao, baseMint, @@ -1219,7 +1215,7 @@ export class FutarchyClient { }) { return this.futarchy.methods .initializeSpendingLimitChangeProposal({ config }) - .accounts({ + .accountsPartial({ typedInitializeAccounts: this.typedInitializeAccounts({ dao, baseMint, @@ -1286,7 +1282,7 @@ export class FutarchyClient { newTeamAddress, spendingLimitAction, }) - .accounts({ + .accountsPartial({ typedInitializeAccounts: this.typedInitializeAccounts({ dao, baseMint, @@ -1345,7 +1341,7 @@ export class FutarchyClient { }) { return this.futarchy.methods .initializeHostileLiquidateProposal({ liquidator }) - .accounts({ + .accountsPartial({ typedInitializeAccounts: this.typedInitializeAccounts({ dao, baseMint, @@ -1436,7 +1432,7 @@ export class FutarchyClient { minPrice, maxPrice, }) - .accounts({ + .accountsPartial({ typedInitializeAccounts: this.typedInitializeAccounts({ dao, baseMint, @@ -1511,7 +1507,7 @@ export class FutarchyClient { return this.futarchy.methods .finalizeProposal() - .accounts({ + .accountsPartial({ proposal, dao, squadsProposal, @@ -1573,7 +1569,7 @@ export class FutarchyClient { return this.futarchy.methods .updateDao({ ...params, deprecatedIsOptimisticGovernanceEnabled: null }) - .accounts({ + .accountsPartial({ dao, squadsMultisigVault, }); @@ -1592,7 +1588,7 @@ export class FutarchyClient { index: 0, })[0]; - return this.futarchy.methods.setSpendingLimit({ config }).accounts({ + return this.futarchy.methods.setSpendingLimit({ config }).accountsPartial({ dao, squadsMultisigVault, }); @@ -1608,7 +1604,7 @@ export class FutarchyClient { const multisigPda = multisig.getMultisigPda({ createKey: dao })[0]; const [spendingLimit] = getSpendingLimitAddr({ dao }); - return this.futarchy.methods.syncSpendingLimit().accounts({ + return this.futarchy.methods.syncSpendingLimit().accountsPartial({ dao, squadsMultisig: multisigPda, spendingLimit, @@ -1626,7 +1622,7 @@ export class FutarchyClient { }) { const [spendingLimit] = getSpendingLimitAddr({ dao }); - return this.futarchy.methods.resizeDao().accounts({ + return this.futarchy.methods.resizeDao().accountsPartial({ dao, spendingLimit, payer, @@ -1656,7 +1652,7 @@ export class FutarchyClient { return this.futarchy.methods .stakeToProposal({ amount }) - .accounts({ + .accountsPartial({ proposal, dao, stakerBaseAccount: getAssociatedTokenAddressSync( @@ -1710,20 +1706,26 @@ export class FutarchyClient { staker, )[0]; - return this.futarchy.methods.unstakeFromProposal({ amount }).accounts({ - proposal, - dao, - stakerBaseAccount: getAssociatedTokenAddressSync(baseMint, staker, true), - proposalBaseAccount: getAssociatedTokenAddressSync( - baseMint, + return this.futarchy.methods + .unstakeFromProposal({ amount }) + .accountsPartial({ proposal, - true, - ), - stakeAccount, - staker, - baseMint, - tokenProgram: TOKEN_PROGRAM_ID, - }); + dao, + stakerBaseAccount: getAssociatedTokenAddressSync( + baseMint, + staker, + true, + ), + proposalBaseAccount: getAssociatedTokenAddressSync( + baseMint, + proposal, + true, + ), + stakeAccount, + staker, + baseMint, + tokenProgram: TOKEN_PROGRAM_ID, + }); } collectFeesIx({ @@ -1747,7 +1749,7 @@ export class FutarchyClient { true, ); - return this.futarchy.methods.collectFees().accounts({ + return this.futarchy.methods.collectFees().accountsPartial({ dao, admin: this.provider.publicKey, ammBaseVault: getAssociatedTokenAddressSync(baseMint, dao, true), @@ -1766,7 +1768,7 @@ export class FutarchyClient { dao: PublicKey; teamAddress?: PublicKey; }) { - return this.futarchy.methods.sponsorProposal().accounts({ + return this.futarchy.methods.sponsorProposal().accountsPartial({ proposal, dao, teamAddress, @@ -1788,7 +1790,7 @@ export class FutarchyClient { }) { return this.futarchy.methods .adminUpdateProposalParams({ durationInSeconds, passThresholdBps }) - .accounts({ + .accountsPartial({ dao, proposal, admin, @@ -1815,7 +1817,7 @@ export class FutarchyClient { .adminEnqueueMultisigProposalApproval({ transactionIndex: new BN(transactionIndex.toString()), }) - .accounts({ + .accountsPartial({ dao, admin, squadsMultisig, @@ -1840,14 +1842,16 @@ export class FutarchyClient { transactionIndex, }); - return this.futarchy.methods.executeMultisigProposalApproval().accounts({ - dao, - rentReceiver, - squadsMultisig, - squadsMultisigProposal: squadsProposal, - enqueuedApproval, - squadsMultisigProgram: SQUADS_PROGRAM_ID, - }); + return this.futarchy.methods + .executeMultisigProposalApproval() + .accountsPartial({ + dao, + rentReceiver, + squadsMultisig, + squadsMultisigProposal: squadsProposal, + enqueuedApproval, + squadsMultisigProgram: SQUADS_PROGRAM_ID, + }); } adminEnqueueMultisigProposalCancellationIx({ @@ -1870,7 +1874,7 @@ export class FutarchyClient { .adminEnqueueMultisigProposalCancellation({ transactionIndex: new BN(transactionIndex.toString()), }) - .accounts({ + .accountsPartial({ dao, admin, squadsMultisig, @@ -1897,7 +1901,7 @@ export class FutarchyClient { return this.futarchy.methods .executeMultisigProposalCancellation() - .accounts({ + .accountsPartial({ dao, rentReceiver, squadsMultisig, @@ -2020,7 +2024,7 @@ export class FutarchyClient { const [dammV2EventAuthority] = getEventAuthorityAddr(DAMM_V2_PROGRAM_ID); - return this.futarchy.methods.collectMeteoraDammFees().accounts({ + return this.futarchy.methods.collectMeteoraDammFees().accountsPartial({ dao, admin, squadsMultisig: multisigPda, diff --git a/sdk/src/futarchy/v0.6/pda.ts b/sdk/src/futarchy/v0.6/pda.ts index eb28f9253..bf472f4f4 100644 --- a/sdk/src/futarchy/v0.6/pda.ts +++ b/sdk/src/futarchy/v0.6/pda.ts @@ -1,4 +1,4 @@ -import { utils } from "@coral-xyz/anchor"; +import { utils } from "@anchor-lang/core"; import { PublicKey } from "@solana/web3.js"; import BN from "bn.js"; import * as multisig from "@sqds/multisig"; diff --git a/sdk/src/futarchy/v0.6/types/futarchy.json b/sdk/src/futarchy/v0.6/types/futarchy.json new file mode 100644 index 000000000..e29d781aa --- /dev/null +++ b/sdk/src/futarchy/v0.6/types/futarchy.json @@ -0,0 +1,11642 @@ +{ + "address": "FUTARELBfJfQ8RDGhg1wdhddq1odMAJUePHFuBYfUxKq", + "metadata": { + "name": "futarchy", + "version": "0.6.2", + "spec": "0.1.0", + "description": "SVM-based program for running futarchy" + }, + "instructions": [ + { + "name": "admin_cancel_proposal", + "discriminator": [ + 95, + 233, + 121, + 193, + 90, + 80, + 147, + 255 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "dao", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "question", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "squads_proposal", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "squads_multisig", + "relations": [ + "dao" + ] + }, + { + "name": "squads_multisig_program", + "address": "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf" + }, + { + "name": "amm_pass_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "proposal.pass_base_mint", + "account": "Proposal" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_pass_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "proposal.pass_quote_mint", + "account": "Proposal" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_fail_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "proposal.fail_base_mint", + "account": "Proposal" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_fail_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "proposal.fail_quote_mint", + "account": "Proposal" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "dao.base_mint", + "account": "Dao" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "dao.quote_mint", + "account": "Dao" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "vault_program", + "address": "VLTX1ishMBbcX3rdBWGssxawAo1Q2X2qxYFYqiGodVg" + }, + { + "name": "vault_event_authority" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "quote_vault", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "quote_vault_underlying_token_account", + "writable": true + }, + { + "name": "pass_quote_mint", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "fail_quote_mint", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "pass_base_mint", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "fail_base_mint", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "base_vault", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "base_vault_underlying_token_account", + "writable": true + }, + { + "name": "admin", + "signer": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "admin_enqueue_multisig_proposal_approval", + "discriminator": [ + 61, + 199, + 241, + 100, + 238, + 220, + 84, + 78 + ], + "accounts": [ + { + "name": "dao" + }, + { + "name": "admin", + "writable": true, + "signer": true + }, + { + "name": "squads_multisig", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "dao" + } + ], + "program": { + "kind": "const", + "value": [ + 6, + 129, + 196, + 206, + 71, + 226, + 35, + 104, + 184, + 177, + 85, + 94, + 200, + 135, + 175, + 9, + 46, + 252, + 126, + 251, + 182, + 108, + 163, + 245, + 47, + 191, + 104, + 212, + 172, + 156, + 183, + 168 + ] + } + }, + "relations": [ + "dao" + ] + }, + { + "name": "squads_multisig_proposal", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "squads_multisig" + }, + { + "kind": "const", + "value": [ + 116, + 114, + 97, + 110, + 115, + 97, + 99, + 116, + 105, + 111, + 110 + ] + }, + { + "kind": "arg", + "path": "args.transaction_index" + }, + { + "kind": "const", + "value": [ + 112, + 114, + 111, + 112, + 111, + 115, + 97, + 108 + ] + } + ], + "program": { + "kind": "const", + "value": [ + 6, + 129, + 196, + 206, + 71, + 226, + 35, + 104, + 184, + 177, + 85, + 94, + 200, + 135, + 175, + 9, + 46, + 252, + 126, + 251, + 182, + 108, + 163, + 245, + 47, + 191, + 104, + 212, + 172, + 156, + 183, + 168 + ] + } + } + }, + { + "name": "enqueued_approval", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 101, + 110, + 113, + 117, + 101, + 117, + 101, + 100, + 95, + 97, + 112, + 112, + 114, + 111, + 118, + 97, + 108 + ] + }, + { + "kind": "account", + "path": "dao" + }, + { + "kind": "arg", + "path": "args.transaction_index" + } + ] + } + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "AdminEnqueueMultisigProposalApprovalArgs" + } + } + } + ] + }, + { + "name": "admin_enqueue_multisig_proposal_cancellation", + "discriminator": [ + 130, + 141, + 11, + 45, + 40, + 95, + 131, + 2 + ], + "accounts": [ + { + "name": "dao" + }, + { + "name": "admin", + "writable": true, + "signer": true + }, + { + "name": "squads_multisig", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "dao" + } + ], + "program": { + "kind": "const", + "value": [ + 6, + 129, + 196, + 206, + 71, + 226, + 35, + 104, + 184, + 177, + 85, + 94, + 200, + 135, + 175, + 9, + 46, + 252, + 126, + 251, + 182, + 108, + 163, + 245, + 47, + 191, + 104, + 212, + 172, + 156, + 183, + 168 + ] + } + }, + "relations": [ + "dao" + ] + }, + { + "name": "squads_multisig_proposal", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "squads_multisig" + }, + { + "kind": "const", + "value": [ + 116, + 114, + 97, + 110, + 115, + 97, + 99, + 116, + 105, + 111, + 110 + ] + }, + { + "kind": "arg", + "path": "args.transaction_index" + }, + { + "kind": "const", + "value": [ + 112, + 114, + 111, + 112, + 111, + 115, + 97, + 108 + ] + } + ], + "program": { + "kind": "const", + "value": [ + 6, + 129, + 196, + 206, + 71, + 226, + 35, + 104, + 184, + 177, + 85, + 94, + 200, + 135, + 175, + 9, + 46, + 252, + 126, + 251, + 182, + 108, + 163, + 245, + 47, + 191, + 104, + 212, + 172, + 156, + 183, + 168 + ] + } + } + }, + { + "name": "enqueued_cancellation", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 101, + 110, + 113, + 117, + 101, + 117, + 101, + 100, + 95, + 99, + 97, + 110, + 99, + 101, + 108, + 108, + 97, + 116, + 105, + 111, + 110 + ] + }, + { + "kind": "account", + "path": "dao" + }, + { + "kind": "arg", + "path": "args.transaction_index" + } + ] + } + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "AdminEnqueueMultisigProposalCancellationArgs" + } + } + } + ] + }, + { + "name": "admin_execute_multisig_proposal", + "discriminator": [ + 226, + 221, + 40, + 160, + 169, + 90, + 48, + 42 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "admin", + "writable": true, + "signer": true + }, + { + "name": "squads_multisig", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "dao" + } + ], + "program": { + "kind": "account", + "path": "squads_multisig_program" + } + }, + "relations": [ + "dao" + ] + }, + { + "name": "squads_multisig_proposal", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "squads_multisig" + }, + { + "kind": "const", + "value": [ + 116, + 114, + 97, + 110, + 115, + 97, + 99, + 116, + 105, + 111, + 110 + ] + }, + { + "kind": "account", + "path": "squads_multisig_vault_transaction.index", + "account": "SquadsVaultTransaction" + }, + { + "kind": "const", + "value": [ + 112, + 114, + 111, + 112, + 111, + 115, + 97, + 108 + ] + } + ], + "program": { + "kind": "account", + "path": "squads_multisig_program" + } + } + }, + { + "name": "squads_multisig_vault_transaction", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "squads_multisig" + }, + { + "kind": "const", + "value": [ + 116, + 114, + 97, + 110, + 115, + 97, + 99, + 116, + 105, + 111, + 110 + ] + }, + { + "kind": "account", + "path": "squads_multisig_vault_transaction.index", + "account": "SquadsVaultTransaction" + } + ], + "program": { + "kind": "account", + "path": "squads_multisig_program" + } + } + }, + { + "name": "squads_multisig_program", + "address": "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf" + } + ], + "args": [] + }, + { + "name": "admin_remove_proposal", + "discriminator": [ + 242, + 199, + 27, + 28, + 7, + 108, + 122, + 73 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "dao", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "admin", + "writable": true, + "signer": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "admin_update_proposal_params", + "discriminator": [ + 147, + 207, + 200, + 2, + 66, + 7, + 119, + 180 + ], + "accounts": [ + { + "name": "dao", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "proposal", + "writable": true + }, + { + "name": "admin", + "signer": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "AdminUpdateProposalParamsArgs" + } + } + } + ] + }, + { + "name": "collect_fees", + "discriminator": [ + 164, + 152, + 207, + 99, + 30, + 186, + 19, + 182 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "admin", + "signer": true + }, + { + "name": "base_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 82, + 252, + 193, + 172, + 131, + 78, + 181, + 126, + 228, + 156, + 201, + 238, + 216, + 61, + 22, + 232, + 177, + 119, + 80, + 4, + 10, + 174, + 136, + 68, + 116, + 84, + 24, + 244, + 205, + 59, + 72, + 150 + ] + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "dao.base_mint", + "account": "Dao" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "quote_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 82, + 252, + 193, + 172, + 131, + 78, + 181, + 126, + 228, + 156, + 201, + 238, + 216, + 61, + 22, + 232, + 177, + 119, + 80, + 4, + 10, + 174, + 136, + 68, + 116, + 84, + 24, + 244, + 205, + 59, + 72, + 150 + ] + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "dao.quote_mint", + "account": "Dao" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "dao.base_mint", + "account": "Dao" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "dao.quote_mint", + "account": "Dao" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "collect_meteora_damm_fees", + "discriminator": [ + 139, + 212, + 105, + 118, + 126, + 54, + 214, + 143 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "admin", + "writable": true, + "signer": true + }, + { + "name": "squads_multisig", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "dao" + } + ], + "program": { + "kind": "account", + "path": "squads_program" + } + } + }, + { + "name": "squads_multisig_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "squads_multisig" + }, + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "const", + "value": [ + 0 + ] + } + ], + "program": { + "kind": "account", + "path": "squads_program" + } + } + }, + { + "name": "squads_multisig_vault_transaction", + "writable": true + }, + { + "name": "squads_multisig_proposal", + "writable": true + }, + { + "name": "squads_multisig_permissionless_account", + "signer": true, + "address": "EP3SoC2SvR3d4c2eXVBvhEMWSr2j3YtoCY3UMiQV7BPD" + }, + { + "name": "meteora_claim_position_fees_accounts", + "accounts": [ + { + "name": "damm_v2_program", + "address": "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG" + }, + { + "name": "damm_v2_event_authority" + }, + { + "name": "pool_authority", + "address": "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC" + }, + { + "name": "pool" + }, + { + "name": "position", + "writable": true + }, + { + "name": "token_a_account", + "docs": [ + "Token account of base tokens recipient" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 82, + 252, + 193, + 172, + 131, + 78, + 181, + 126, + 228, + 156, + 201, + 238, + 216, + 61, + 22, + 232, + 177, + 119, + 80, + 4, + 10, + 174, + 136, + 68, + 116, + 84, + 24, + 244, + 205, + 59, + 72, + 150 + ] + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "token_a_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "token_b_account", + "docs": [ + "Token account of quote tokens recipient" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 82, + 252, + 193, + 172, + 131, + 78, + 181, + 126, + 228, + 156, + 201, + 238, + 216, + 61, + 22, + 232, + 177, + 119, + 80, + 4, + 10, + 174, + 136, + 68, + 116, + 84, + 24, + 244, + 205, + 59, + 72, + 150 + ] + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "token_b_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "token_a_vault", + "writable": true + }, + { + "name": "token_b_vault", + "writable": true + }, + { + "name": "token_a_mint" + }, + { + "name": "token_b_mint" + }, + { + "name": "position_nft_account" + }, + { + "name": "owner" + }, + { + "name": "token_a_program" + }, + { + "name": "token_b_program" + } + ] + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "squads_program", + "address": "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "conditional_swap", + "discriminator": [ + 194, + 136, + 220, + 89, + 242, + 169, + 130, + 157 + ], + "accounts": [ + { + "name": "dao", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "amm_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "dao.base_mint", + "account": "Dao" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "dao.quote_mint", + "account": "Dao" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "proposal" + }, + { + "name": "amm_pass_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "proposal.pass_base_mint", + "account": "Proposal" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_pass_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "proposal.pass_quote_mint", + "account": "Proposal" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_fail_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "proposal.fail_base_mint", + "account": "Proposal" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_fail_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "proposal.fail_quote_mint", + "account": "Proposal" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "trader", + "signer": true + }, + { + "name": "user_input_account", + "writable": true + }, + { + "name": "user_output_account", + "writable": true + }, + { + "name": "base_vault", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "base_vault_underlying_token_account", + "writable": true + }, + { + "name": "quote_vault", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "quote_vault_underlying_token_account", + "writable": true + }, + { + "name": "pass_base_mint", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "fail_base_mint", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "pass_quote_mint", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "fail_quote_mint", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "conditional_vault_program", + "address": "VLTX1ishMBbcX3rdBWGssxawAo1Q2X2qxYFYqiGodVg" + }, + { + "name": "vault_event_authority" + }, + { + "name": "question", + "relations": [ + "proposal" + ] + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "ConditionalSwapParams" + } + } + } + ] + }, + { + "name": "execute_multisig_proposal_approval", + "discriminator": [ + 124, + 144, + 201, + 164, + 182, + 226, + 193, + 224 + ], + "accounts": [ + { + "name": "dao", + "writable": true, + "relations": [ + "enqueued_approval" + ] + }, + { + "name": "rent_receiver", + "writable": true, + "signer": true + }, + { + "name": "squads_multisig", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "dao" + } + ], + "program": { + "kind": "const", + "value": [ + 6, + 129, + 196, + 206, + 71, + 226, + 35, + 104, + 184, + 177, + 85, + 94, + 200, + 135, + 175, + 9, + 46, + 252, + 126, + 251, + 182, + 108, + 163, + 245, + 47, + 191, + 104, + 212, + 172, + 156, + 183, + 168 + ] + } + }, + "relations": [ + "dao" + ] + }, + { + "name": "squads_multisig_proposal", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "squads_multisig" + }, + { + "kind": "const", + "value": [ + 116, + 114, + 97, + 110, + 115, + 97, + 99, + 116, + 105, + 111, + 110 + ] + }, + { + "kind": "account", + "path": "enqueued_approval.transaction_index", + "account": "EnqueuedMultisigProposalApproval" + }, + { + "kind": "const", + "value": [ + 112, + 114, + 111, + 112, + 111, + 115, + 97, + 108 + ] + } + ], + "program": { + "kind": "const", + "value": [ + 6, + 129, + 196, + 206, + 71, + 226, + 35, + 104, + 184, + 177, + 85, + 94, + 200, + 135, + 175, + 9, + 46, + 252, + 126, + 251, + 182, + 108, + 163, + 245, + 47, + 191, + 104, + 212, + 172, + 156, + 183, + 168 + ] + } + } + }, + { + "name": "enqueued_approval", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 101, + 110, + 113, + 117, + 101, + 117, + 101, + 100, + 95, + 97, + 112, + 112, + 114, + 111, + 118, + 97, + 108 + ] + }, + { + "kind": "account", + "path": "dao" + }, + { + "kind": "account", + "path": "enqueued_approval.transaction_index", + "account": "EnqueuedMultisigProposalApproval" + } + ] + } + }, + { + "name": "squads_multisig_program", + "address": "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf" + } + ], + "args": [] + }, + { + "name": "execute_multisig_proposal_cancellation", + "discriminator": [ + 249, + 69, + 159, + 255, + 236, + 21, + 243, + 30 + ], + "accounts": [ + { + "name": "dao", + "writable": true, + "relations": [ + "enqueued_cancellation" + ] + }, + { + "name": "rent_receiver", + "writable": true, + "signer": true + }, + { + "name": "squads_multisig", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "dao" + } + ], + "program": { + "kind": "const", + "value": [ + 6, + 129, + 196, + 206, + 71, + 226, + 35, + 104, + 184, + 177, + 85, + 94, + 200, + 135, + 175, + 9, + 46, + 252, + 126, + 251, + 182, + 108, + 163, + 245, + 47, + 191, + 104, + 212, + 172, + 156, + 183, + 168 + ] + } + }, + "relations": [ + "dao" + ] + }, + { + "name": "squads_multisig_proposal", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "squads_multisig" + }, + { + "kind": "const", + "value": [ + 116, + 114, + 97, + 110, + 115, + 97, + 99, + 116, + 105, + 111, + 110 + ] + }, + { + "kind": "account", + "path": "enqueued_cancellation.transaction_index", + "account": "EnqueuedMultisigProposalCancellation" + }, + { + "kind": "const", + "value": [ + 112, + 114, + 111, + 112, + 111, + 115, + 97, + 108 + ] + } + ], + "program": { + "kind": "const", + "value": [ + 6, + 129, + 196, + 206, + 71, + 226, + 35, + 104, + 184, + 177, + 85, + 94, + 200, + 135, + 175, + 9, + 46, + 252, + 126, + 251, + 182, + 108, + 163, + 245, + 47, + 191, + 104, + 212, + 172, + 156, + 183, + 168 + ] + } + } + }, + { + "name": "enqueued_cancellation", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 101, + 110, + 113, + 117, + 101, + 117, + 101, + 100, + 95, + 99, + 97, + 110, + 99, + 101, + 108, + 108, + 97, + 116, + 105, + 111, + 110 + ] + }, + { + "kind": "account", + "path": "dao" + }, + { + "kind": "account", + "path": "enqueued_cancellation.transaction_index", + "account": "EnqueuedMultisigProposalCancellation" + } + ] + } + }, + { + "name": "squads_multisig_program", + "address": "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf" + } + ], + "args": [] + }, + { + "name": "finalize_proposal", + "discriminator": [ + 23, + 68, + 51, + 167, + 109, + 173, + 187, + 164 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "dao", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "question", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "squads_proposal", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "squads_multisig", + "relations": [ + "dao" + ] + }, + { + "name": "squads_multisig_program", + "address": "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf" + }, + { + "name": "amm_pass_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "proposal.pass_base_mint", + "account": "Proposal" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_pass_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "proposal.pass_quote_mint", + "account": "Proposal" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_fail_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "proposal.fail_base_mint", + "account": "Proposal" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_fail_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "proposal.fail_quote_mint", + "account": "Proposal" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "dao.base_mint", + "account": "Dao" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "dao.quote_mint", + "account": "Dao" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "vault_program", + "address": "VLTX1ishMBbcX3rdBWGssxawAo1Q2X2qxYFYqiGodVg" + }, + { + "name": "vault_event_authority" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "quote_vault", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "quote_vault_underlying_token_account", + "writable": true + }, + { + "name": "pass_quote_mint", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "fail_quote_mint", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "pass_base_mint", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "fail_base_mint", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "base_vault", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "base_vault_underlying_token_account", + "writable": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "initialize_buyback_token_proposal", + "discriminator": [ + 78, + 26, + 73, + 211, + 28, + 51, + 142, + 107 + ], + "accounts": [ + { + "name": "typed_initialize_accounts", + "accounts": [ + { + "name": "proposal", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 114, + 111, + 112, + 111, + 115, + 97, + 108 + ] + }, + { + "kind": "account", + "path": "squads_proposal" + } + ] + } + }, + { + "name": "dao", + "writable": true + }, + { + "name": "squads_multisig", + "writable": true, + "relations": [ + "dao" + ] + }, + { + "name": "squads_transaction", + "docs": [ + "and enforces that it is the transaction PDA for the next transaction index" + ], + "writable": true + }, + { + "name": "squads_proposal", + "docs": [ + "enforces that it is the proposal PDA for the next transaction index" + ], + "writable": true + }, + { + "name": "question", + "relations": [ + "base_vault", + "quote_vault" + ] + }, + { + "name": "base_vault" + }, + { + "name": "quote_vault" + }, + { + "name": "proposer", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "permissionless_account", + "docs": [ + "The Squads-side creator of the vault transaction and proposal, an", + "Initiate | Execute member of every DAO multisig. Its keypair ships in", + "the SDK, so anyone can provide this signature." + ], + "signer": true, + "address": "EP3SoC2SvR3d4c2eXVBvhEMWSr2j3YtoCY3UMiQV7BPD" + }, + { + "name": "squads_program", + "address": "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + } + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "InitializeBuybackTokenProposalArgs" + } + } + } + ] + }, + { + "name": "initialize_dao", + "discriminator": [ + 128, + 226, + 96, + 90, + 39, + 56, + 24, + 196 + ], + "accounts": [ + { + "name": "dao", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 100, + 97, + 111 + ] + }, + { + "kind": "account", + "path": "dao_creator" + }, + { + "kind": "arg", + "path": "params.nonce" + } + ] + } + }, + { + "name": "dao_creator", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "base_mint" + }, + { + "name": "quote_mint" + }, + { + "name": "squads_multisig", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "dao" + } + ], + "program": { + "kind": "account", + "path": "squads_program" + } + } + }, + { + "name": "squads_multisig_vault", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "squads_multisig" + }, + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "const", + "value": [ + 0 + ] + } + ], + "program": { + "kind": "account", + "path": "squads_program" + } + } + }, + { + "name": "squads_program", + "address": "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf" + }, + { + "name": "squads_program_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "const", + "value": [ + 112, + 114, + 111, + 103, + 114, + 97, + 109, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + } + ], + "program": { + "kind": "account", + "path": "squads_program" + } + } + }, + { + "name": "squads_program_config_treasury", + "writable": true + }, + { + "name": "spending_limit", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "squads_multisig" + }, + { + "kind": "const", + "value": [ + 115, + 112, + 101, + 110, + 100, + 105, + 110, + 103, + 95, + 108, + 105, + 109, + 105, + 116 + ] + }, + { + "kind": "account", + "path": "dao" + } + ], + "program": { + "kind": "account", + "path": "squads_program" + } + } + }, + { + "name": "futarchy_amm_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "futarchy_amm_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "InitializeDaoParams" + } + } + } + ] + }, + { + "name": "initialize_hostile_liquidate_proposal", + "discriminator": [ + 16, + 196, + 240, + 71, + 224, + 103, + 82, + 202 + ], + "accounts": [ + { + "name": "typed_initialize_accounts", + "accounts": [ + { + "name": "proposal", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 114, + 111, + 112, + 111, + 115, + 97, + 108 + ] + }, + { + "kind": "account", + "path": "squads_proposal" + } + ] + } + }, + { + "name": "dao", + "writable": true + }, + { + "name": "squads_multisig", + "writable": true, + "relations": [ + "dao" + ] + }, + { + "name": "squads_transaction", + "docs": [ + "and enforces that it is the transaction PDA for the next transaction index" + ], + "writable": true + }, + { + "name": "squads_proposal", + "docs": [ + "enforces that it is the proposal PDA for the next transaction index" + ], + "writable": true + }, + { + "name": "question", + "relations": [ + "base_vault", + "quote_vault" + ] + }, + { + "name": "base_vault" + }, + { + "name": "quote_vault" + }, + { + "name": "proposer", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "permissionless_account", + "docs": [ + "The Squads-side creator of the vault transaction and proposal, an", + "Initiate | Execute member of every DAO multisig. Its keypair ships in", + "the SDK, so anyone can provide this signature." + ], + "signer": true, + "address": "EP3SoC2SvR3d4c2eXVBvhEMWSr2j3YtoCY3UMiQV7BPD" + }, + { + "name": "squads_program", + "address": "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + } + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "InitializeHostileLiquidateProposalArgs" + } + } + } + ] + }, + { + "name": "initialize_hostile_takeover_proposal", + "discriminator": [ + 10, + 6, + 136, + 25, + 198, + 217, + 241, + 40 + ], + "accounts": [ + { + "name": "typed_initialize_accounts", + "accounts": [ + { + "name": "proposal", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 114, + 111, + 112, + 111, + 115, + 97, + 108 + ] + }, + { + "kind": "account", + "path": "squads_proposal" + } + ] + } + }, + { + "name": "dao", + "writable": true + }, + { + "name": "squads_multisig", + "writable": true, + "relations": [ + "dao" + ] + }, + { + "name": "squads_transaction", + "docs": [ + "and enforces that it is the transaction PDA for the next transaction index" + ], + "writable": true + }, + { + "name": "squads_proposal", + "docs": [ + "enforces that it is the proposal PDA for the next transaction index" + ], + "writable": true + }, + { + "name": "question", + "relations": [ + "base_vault", + "quote_vault" + ] + }, + { + "name": "base_vault" + }, + { + "name": "quote_vault" + }, + { + "name": "proposer", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "permissionless_account", + "docs": [ + "The Squads-side creator of the vault transaction and proposal, an", + "Initiate | Execute member of every DAO multisig. Its keypair ships in", + "the SDK, so anyone can provide this signature." + ], + "signer": true, + "address": "EP3SoC2SvR3d4c2eXVBvhEMWSr2j3YtoCY3UMiQV7BPD" + }, + { + "name": "squads_program", + "address": "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + } + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "InitializeHostileTakeoverProposalArgs" + } + } + } + ] + }, + { + "name": "initialize_large_spend_proposal", + "discriminator": [ + 215, + 213, + 32, + 17, + 217, + 208, + 27, + 106 + ], + "accounts": [ + { + "name": "typed_initialize_accounts", + "accounts": [ + { + "name": "proposal", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 114, + 111, + 112, + 111, + 115, + 97, + 108 + ] + }, + { + "kind": "account", + "path": "squads_proposal" + } + ] + } + }, + { + "name": "dao", + "writable": true + }, + { + "name": "squads_multisig", + "writable": true, + "relations": [ + "dao" + ] + }, + { + "name": "squads_transaction", + "docs": [ + "and enforces that it is the transaction PDA for the next transaction index" + ], + "writable": true + }, + { + "name": "squads_proposal", + "docs": [ + "enforces that it is the proposal PDA for the next transaction index" + ], + "writable": true + }, + { + "name": "question", + "relations": [ + "base_vault", + "quote_vault" + ] + }, + { + "name": "base_vault" + }, + { + "name": "quote_vault" + }, + { + "name": "proposer", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "permissionless_account", + "docs": [ + "The Squads-side creator of the vault transaction and proposal, an", + "Initiate | Execute member of every DAO multisig. Its keypair ships in", + "the SDK, so anyone can provide this signature." + ], + "signer": true, + "address": "EP3SoC2SvR3d4c2eXVBvhEMWSr2j3YtoCY3UMiQV7BPD" + }, + { + "name": "squads_program", + "address": "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + } + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "InitializeLargeSpendProposalArgs" + } + } + } + ] + }, + { + "name": "initialize_mint_tokens_proposal", + "discriminator": [ + 15, + 181, + 2, + 221, + 93, + 107, + 219, + 13 + ], + "accounts": [ + { + "name": "typed_initialize_accounts", + "accounts": [ + { + "name": "proposal", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 114, + 111, + 112, + 111, + 115, + 97, + 108 + ] + }, + { + "kind": "account", + "path": "squads_proposal" + } + ] + } + }, + { + "name": "dao", + "writable": true + }, + { + "name": "squads_multisig", + "writable": true, + "relations": [ + "dao" + ] + }, + { + "name": "squads_transaction", + "docs": [ + "and enforces that it is the transaction PDA for the next transaction index" + ], + "writable": true + }, + { + "name": "squads_proposal", + "docs": [ + "enforces that it is the proposal PDA for the next transaction index" + ], + "writable": true + }, + { + "name": "question", + "relations": [ + "base_vault", + "quote_vault" + ] + }, + { + "name": "base_vault" + }, + { + "name": "quote_vault" + }, + { + "name": "proposer", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "permissionless_account", + "docs": [ + "The Squads-side creator of the vault transaction and proposal, an", + "Initiate | Execute member of every DAO multisig. Its keypair ships in", + "the SDK, so anyone can provide this signature." + ], + "signer": true, + "address": "EP3SoC2SvR3d4c2eXVBvhEMWSr2j3YtoCY3UMiQV7BPD" + }, + { + "name": "squads_program", + "address": "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + } + ] + }, + { + "name": "base_mint" + }, + { + "name": "mint_governor", + "docs": [ + "Only for governed mints (v0.8 launches): the `MintGovernor` holding the", + "base mint's authority." + ], + "optional": true + }, + { + "name": "mint_authority", + "docs": [ + "Only for governed mints: the vault's minting rights on `mint_governor`." + ], + "optional": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "InitializeMintTokensProposalArgs" + } + } + } + ] + }, + { + "name": "initialize_proposal", + "discriminator": [ + 50, + 73, + 156, + 98, + 129, + 149, + 21, + 158 + ], + "accounts": [ + { + "name": "proposal", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 114, + 111, + 112, + 111, + 115, + 97, + 108 + ] + }, + { + "kind": "account", + "path": "squads_proposal" + } + ] + } + }, + { + "name": "squads_proposal" + }, + { + "name": "squads_multisig", + "relations": [ + "dao" + ] + }, + { + "name": "squads_vault_transaction", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "squads_multisig" + }, + { + "kind": "const", + "value": [ + 116, + 114, + 97, + 110, + 115, + 97, + 99, + 116, + 105, + 111, + 110 + ] + }, + { + "kind": "account", + "path": "squads_proposal.transaction_index", + "account": "SquadsProposal" + } + ], + "program": { + "kind": "const", + "value": [ + 6, + 129, + 196, + 206, + 71, + 226, + 35, + 104, + 184, + 177, + 85, + 94, + 200, + 135, + 175, + 9, + 46, + 252, + 126, + 251, + 182, + 108, + 163, + 245, + 47, + 191, + 104, + 212, + 172, + 156, + 183, + 168 + ] + } + } + }, + { + "name": "dao", + "writable": true + }, + { + "name": "question", + "relations": [ + "quote_vault", + "base_vault" + ] + }, + { + "name": "quote_vault" + }, + { + "name": "base_vault" + }, + { + "name": "proposer", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "initialize_spending_limit_change_proposal", + "discriminator": [ + 119, + 145, + 71, + 234, + 49, + 54, + 124, + 66 + ], + "accounts": [ + { + "name": "typed_initialize_accounts", + "accounts": [ + { + "name": "proposal", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 114, + 111, + 112, + 111, + 115, + 97, + 108 + ] + }, + { + "kind": "account", + "path": "squads_proposal" + } + ] + } + }, + { + "name": "dao", + "writable": true + }, + { + "name": "squads_multisig", + "writable": true, + "relations": [ + "dao" + ] + }, + { + "name": "squads_transaction", + "docs": [ + "and enforces that it is the transaction PDA for the next transaction index" + ], + "writable": true + }, + { + "name": "squads_proposal", + "docs": [ + "enforces that it is the proposal PDA for the next transaction index" + ], + "writable": true + }, + { + "name": "question", + "relations": [ + "base_vault", + "quote_vault" + ] + }, + { + "name": "base_vault" + }, + { + "name": "quote_vault" + }, + { + "name": "proposer", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "permissionless_account", + "docs": [ + "The Squads-side creator of the vault transaction and proposal, an", + "Initiate | Execute member of every DAO multisig. Its keypair ships in", + "the SDK, so anyone can provide this signature." + ], + "signer": true, + "address": "EP3SoC2SvR3d4c2eXVBvhEMWSr2j3YtoCY3UMiQV7BPD" + }, + { + "name": "squads_program", + "address": "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + } + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "InitializeSpendingLimitChangeProposalArgs" + } + } + } + ] + }, + { + "name": "launch_proposal", + "discriminator": [ + 16, + 211, + 189, + 119, + 245, + 72, + 0, + 229 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "base_vault", + "relations": [ + "proposal" + ] + }, + { + "name": "quote_vault", + "relations": [ + "proposal" + ] + }, + { + "name": "pass_base_mint" + }, + { + "name": "pass_quote_mint" + }, + { + "name": "fail_base_mint" + }, + { + "name": "fail_quote_mint" + }, + { + "name": "dao", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "amm_pass_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "pass_base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_pass_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "pass_quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_fail_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "fail_base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_fail_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "fail_quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "squads_multisig", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "dao" + } + ], + "program": { + "kind": "const", + "value": [ + 6, + 129, + 196, + 206, + 71, + 226, + 35, + 104, + 184, + 177, + 85, + 94, + 200, + 135, + 175, + 9, + 46, + 252, + 126, + 251, + 182, + 108, + 163, + 245, + 47, + 191, + 104, + 212, + 172, + 156, + 183, + 168 + ] + } + }, + "relations": [ + "dao" + ] + }, + { + "name": "squads_proposal", + "relations": [ + "proposal" + ] + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "provide_liquidity", + "discriminator": [ + 40, + 110, + 107, + 116, + 174, + 127, + 97, + 204 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "liquidity_provider", + "signer": true + }, + { + "name": "liquidity_provider_base_account", + "writable": true + }, + { + "name": "liquidity_provider_quote_account", + "writable": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "amm_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "dao.base_mint", + "account": "Dao" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "dao.quote_mint", + "account": "Dao" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_position", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 97, + 109, + 109, + 95, + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110 + ] + }, + { + "kind": "account", + "path": "dao" + }, + { + "kind": "arg", + "path": "params.position_authority" + } + ] + } + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "ProvideLiquidityParams" + } + } + } + ] + }, + { + "name": "resize_dao", + "discriminator": [ + 142, + 52, + 68, + 81, + 113, + 14, + 90, + 40 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "spending_limit", + "docs": [ + "spending-limit PDA (`create_key` is always the DAO); read-only and may", + "not exist" + ] + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + } + ], + "args": [] + }, + { + "name": "resize_proposal", + "discriminator": [ + 40, + 213, + 88, + 206, + 213, + 184, + 30, + 181 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "dao", + "docs": [ + "The proposal's DAO, checked against the deserialized proposal in the", + "handler." + ] + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + } + ], + "args": [] + }, + { + "name": "set_spending_limit", + "discriminator": [ + 39, + 48, + 237, + 161, + 49, + 171, + 155, + 208 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "squads_multisig_vault", + "signer": true, + "relations": [ + "dao" + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "SetSpendingLimitArgs" + } + } + } + ] + }, + { + "name": "sponsor_proposal", + "discriminator": [ + 193, + 57, + 170, + 136, + 101, + 196, + 58, + 173 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "dao", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "team_address", + "signer": true, + "relations": [ + "dao" + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "spot_swap", + "discriminator": [ + 167, + 97, + 12, + 231, + 237, + 78, + 166, + 251 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "user_base_account", + "writable": true + }, + { + "name": "user_quote_account", + "writable": true + }, + { + "name": "amm_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "dao.base_mint", + "account": "Dao" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "dao.quote_mint", + "account": "Dao" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "user", + "signer": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "SpotSwapParams" + } + } + } + ] + }, + { + "name": "stake_to_proposal", + "discriminator": [ + 10, + 169, + 175, + 238, + 80, + 221, + 37, + 16 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "dao", + "writable": true + }, + { + "name": "staker_base_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "staker" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "dao.base_mint", + "account": "Dao" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "proposal_base_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "proposal" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "dao.base_mint", + "account": "Dao" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "stake_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 115, + 116, + 97, + 107, + 101 + ] + }, + { + "kind": "account", + "path": "proposal" + }, + { + "kind": "account", + "path": "staker" + } + ] + } + }, + { + "name": "staker", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "StakeToProposalParams" + } + } + } + ] + }, + { + "name": "sync_spending_limit", + "discriminator": [ + 24, + 110, + 161, + 237, + 185, + 161, + 169, + 141 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "squads_multisig", + "writable": true, + "relations": [ + "dao" + ] + }, + { + "name": "spending_limit", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "squads_multisig" + }, + { + "kind": "const", + "value": [ + 115, + 112, + 101, + 110, + 100, + 105, + 110, + 103, + 95, + 108, + 105, + 109, + 105, + 116 + ] + }, + { + "kind": "account", + "path": "dao" + } + ], + "program": { + "kind": "account", + "path": "squads_program" + } + } + }, + { + "name": "rent_payer", + "docs": [ + "Pays rent when the limit is recreated and receives freed rent when it is removed." + ], + "writable": true, + "signer": true + }, + { + "name": "squads_program", + "address": "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "unstake_from_proposal", + "discriminator": [ + 179, + 220, + 186, + 86, + 2, + 96, + 50, + 161 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "dao", + "writable": true, + "relations": [ + "proposal" + ] + }, + { + "name": "staker_base_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "staker" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "proposal_base_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "proposal" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "stake_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 115, + 116, + 97, + 107, + 101 + ] + }, + { + "kind": "account", + "path": "proposal" + }, + { + "kind": "account", + "path": "staker" + } + ] + } + }, + { + "name": "base_mint", + "relations": [ + "dao" + ] + }, + { + "name": "staker", + "writable": true, + "signer": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "UnstakeFromProposalParams" + } + } + } + ] + }, + { + "name": "update_dao", + "discriminator": [ + 131, + 72, + 75, + 25, + 112, + 210, + 109, + 2 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "squads_multisig_vault", + "signer": true, + "relations": [ + "dao" + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "dao_params", + "type": { + "defined": { + "name": "UpdateDaoParams" + } + } + } + ] + }, + { + "name": "withdraw_liquidity", + "discriminator": [ + 149, + 158, + 33, + 185, + 47, + 243, + 253, + 31 + ], + "accounts": [ + { + "name": "dao", + "writable": true, + "relations": [ + "amm_position" + ] + }, + { + "name": "position_authority", + "signer": true, + "relations": [ + "amm_position" + ] + }, + { + "name": "liquidity_provider_base_account", + "writable": true + }, + { + "name": "liquidity_provider_quote_account", + "writable": true + }, + { + "name": "amm_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "dao.base_mint", + "account": "Dao" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "dao" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "dao.quote_mint", + "account": "Dao" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "amm_position", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 97, + 109, + 109, + 95, + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110 + ] + }, + { + "kind": "account", + "path": "dao" + }, + { + "kind": "account", + "path": "position_authority" + } + ] + } + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "WithdrawLiquidityParams" + } + } + } + ] + } + ], + "accounts": [ + { + "name": "AmmPosition", + "discriminator": [ + 34, + 97, + 105, + 74, + 17, + 226, + 212, + 0 + ] + }, + { + "name": "ConditionalVault", + "discriminator": [ + 63, + 132, + 87, + 98, + 36, + 51, + 175, + 247 + ] + }, + { + "name": "Dao", + "discriminator": [ + 163, + 9, + 47, + 31, + 52, + 85, + 197, + 49 + ] + }, + { + "name": "EnqueuedMultisigProposalApproval", + "discriminator": [ + 172, + 225, + 237, + 72, + 8, + 241, + 28, + 124 + ] + }, + { + "name": "EnqueuedMultisigProposalCancellation", + "discriminator": [ + 18, + 48, + 13, + 143, + 11, + 244, + 203, + 114 + ] + }, + { + "name": "MintAuthority", + "discriminator": [ + 148, + 0, + 219, + 228, + 254, + 237, + 76, + 128 + ] + }, + { + "name": "MintGovernor", + "discriminator": [ + 110, + 173, + 19, + 114, + 217, + 193, + 37, + 71 + ] + }, + { + "name": "Proposal", + "discriminator": [ + 26, + 94, + 189, + 187, + 116, + 136, + 53, + 33 + ] + }, + { + "name": "Question", + "discriminator": [ + 111, + 22, + 150, + 220, + 181, + 122, + 118, + 127 + ] + }, + { + "name": "StakeAccount", + "discriminator": [ + 80, + 158, + 67, + 124, + 50, + 189, + 192, + 255 + ] + } + ], + "events": [ + { + "name": "AdminCancelProposalEvent", + "discriminator": [ + 118, + 2, + 87, + 75, + 91, + 217, + 71, + 124 + ] + }, + { + "name": "AdminFixPositionAuthorityEvent", + "discriminator": [ + 174, + 79, + 62, + 1, + 150, + 182, + 236, + 147 + ] + }, + { + "name": "AdminUpdateProposalParamsEvent", + "discriminator": [ + 20, + 195, + 243, + 106, + 255, + 93, + 238, + 187 + ] + }, + { + "name": "CollectFeesEvent", + "discriminator": [ + 226, + 2, + 53, + 67, + 132, + 158, + 125, + 173 + ] + }, + { + "name": "CollectMeteoraDammFeesEvent", + "discriminator": [ + 193, + 114, + 225, + 241, + 209, + 213, + 175, + 85 + ] + }, + { + "name": "ConditionalSwapEvent", + "discriminator": [ + 2, + 166, + 200, + 160, + 94, + 212, + 68, + 45 + ] + }, + { + "name": "FinalizeProposalEvent", + "discriminator": [ + 45, + 29, + 122, + 181, + 79, + 224, + 57, + 141 + ] + }, + { + "name": "InitializeDaoEvent", + "discriminator": [ + 119, + 48, + 153, + 116, + 127, + 37, + 226, + 228 + ] + }, + { + "name": "InitializeProposalEvent", + "discriminator": [ + 141, + 56, + 246, + 192, + 168, + 254, + 64, + 111 + ] + }, + { + "name": "LaunchProposalEvent", + "discriminator": [ + 177, + 55, + 191, + 93, + 203, + 124, + 184, + 11 + ] + }, + { + "name": "ProvideLiquidityEvent", + "discriminator": [ + 38, + 2, + 37, + 238, + 229, + 214, + 255, + 235 + ] + }, + { + "name": "RemoveProposalEvent", + "discriminator": [ + 135, + 152, + 254, + 224, + 208, + 81, + 197, + 215 + ] + }, + { + "name": "SetSpendingLimitEvent", + "discriminator": [ + 242, + 139, + 252, + 83, + 95, + 147, + 15, + 58 + ] + }, + { + "name": "SponsorProposalEvent", + "discriminator": [ + 202, + 190, + 250, + 176, + 79, + 235, + 77, + 194 + ] + }, + { + "name": "SpotSwapEvent", + "discriminator": [ + 29, + 253, + 121, + 255, + 82, + 60, + 148, + 195 + ] + }, + { + "name": "StakeToProposalEvent", + "discriminator": [ + 94, + 69, + 68, + 151, + 90, + 149, + 240, + 191 + ] + }, + { + "name": "SyncSpendingLimitEvent", + "discriminator": [ + 155, + 35, + 236, + 84, + 219, + 60, + 115, + 167 + ] + }, + { + "name": "UnstakeFromProposalEvent", + "discriminator": [ + 89, + 129, + 63, + 211, + 55, + 33, + 194, + 171 + ] + }, + { + "name": "UpdateDaoEvent", + "discriminator": [ + 12, + 58, + 244, + 224, + 171, + 25, + 33, + 56 + ] + }, + { + "name": "WithdrawLiquidityEvent", + "discriminator": [ + 214, + 6, + 161, + 45, + 191, + 142, + 124, + 186 + ] + } + ], + "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 Active 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": "InvalidMint", + "msg": "Base mint and quote mint must be different" + }, + { + "code": 6037, + "name": "ProposalNotReadyToUnstake", + "msg": "Proposal is not ready to be unstaked" + }, + { + "code": 6038, + "name": "OptimisticGovernanceDisabled", + "msg": "Optimistic governance is disabled" + }, + { + "code": 6039, + "name": "ActiveOptimisticProposalAlreadyEnqueued", + "msg": "An active optimistic proposal is already enqueued" + }, + { + "code": 6040, + "name": "OptimisticProposalAlreadyPassed", + "msg": "Optimistic proposal has already passed" + }, + { + "code": 6041, + "name": "InvalidSpendingLimitMint", + "msg": "Invalid spending limit mint. Must be the same as the DAO's quote mint" + }, + { + "code": 6042, + "name": "NoActiveOptimisticProposal", + "msg": "No active optimistic proposal" + }, + { + "code": 6043, + "name": "DaoLiquidated", + "msg": "This DAO has been liquidated" + }, + { + "code": 6044, + "name": "ProposalKindCooldownActive", + "msg": "A proposal of this kind finalized recently, so the cooldown must elapse first" + }, + { + "code": 6045, + "name": "NoSpendingLimit", + "msg": "The DAO has no spending limit" + }, + { + "code": 6046, + "name": "SpendCapExceeded", + "msg": "Amount exceeds the cap of 3x the monthly spending limit" + }, + { + "code": 6047, + "name": "UnknownMintAuthority", + "msg": "The base mint's authority is neither the treasury vault nor a mint governor" + }, + { + "code": 6048, + "name": "ProposalNotTeamSponsored", + "msg": "This proposal kind must be team-sponsored before it can launch" + }, + { + "code": 6049, + "name": "SpendingLimitNotDirty", + "msg": "The spending limit record hasn't changed, so there is nothing to sync" + }, + { + "code": 6050, + "name": "InvalidProposalKind", + "msg": "Wrong proposal kind for this instruction" + }, + { + "code": 6051, + "name": "TooManySpendingLimitMembers", + "msg": "A spending limit can have at most 10 members" + }, + { + "code": 6052, + "name": "InvalidLiquidator", + "msg": "Invalid liquidator" + }, + { + "code": 6053, + "name": "InvalidProposalPassThreshold", + "msg": "Pass threshold must be between -99.99% and 99.99%" + }, + { + "code": 6054, + "name": "EmptyProposalParamsUpdate", + "msg": "A proposal params update must set at least one field" + }, + { + "code": 6055, + "name": "BuybackCapExceeded", + "msg": "Buyback amount exceeds 25% of the treasury" + }, + { + "code": 6056, + "name": "InvalidBuybackAmount", + "msg": "Buyback total must be non-zero" + }, + { + "code": 6057, + "name": "InvalidBuybackCycleFrequency", + "msg": "Cycle frequency must be between 60 seconds and 1 year" + }, + { + "code": 6058, + "name": "InvalidBuybackStartDelay", + "msg": "Start delay must be at most 30 days" + }, + { + "code": 6059, + "name": "InvalidBuybackPriceBand", + "msg": "min_price must be no greater than max_price" + }, + { + "code": 6060, + "name": "InvalidTreasuryAccount", + "msg": "A treasury account is neither a vault-owned quote account nor the treasury's AMM position" + }, + { + "code": 6061, + "name": "TreasuryAccountsNotSorted", + "msg": "Treasury accounts must be in strictly ascending key order" + }, + { + "code": 6062, + "name": "UnexpectedLaunchAccounts", + "msg": "This proposal kind's launch takes no extra accounts" + }, + { + "code": 6063, + "name": "InvalidSpendingLimitAccount", + "msg": "Spending limit account is not the canonical spending-limit PDA" + }, + { + "code": 6064, + "name": "StaleTeamAddress", + "msg": "The DAO's team has changed since this draft was created" + }, + { + "code": 6065, + "name": "AccountNotMigrated", + "msg": "Account is not migrated to latest layout" + }, + { + "code": 6066, + "name": "InvalidSpendingLimitAmount", + "msg": "A spending limit's monthly amount must be non-zero" + }, + { + "code": 6067, + "name": "EmptySpendingLimitMembers", + "msg": "A spending limit must have at least one member" + }, + { + "code": 6068, + "name": "DuplicateSpendingLimitMember", + "msg": "A spending limit's members must be unique" + }, + { + "code": 6069, + "name": "InvalidBuybackCycleCount", + "msg": "A buyback must run at least two cycles" + }, + { + "code": 6070, + "name": "InvalidTeamAddress", + "msg": "Invalid team address" + }, + { + "code": 6071, + "name": "TeamSponsorshipForbidden", + "msg": "This proposal kind cannot be team-sponsored" + }, + { + "code": 6072, + "name": "SquadsProposalNotApproved", + "msg": "Squads proposal must be in Approved status to be cancelled" + }, + { + "code": 6073, + "name": "TypedProposalsDisabled", + "msg": "This DAO has not opted into typed proposals" + }, + { + "code": 6074, + "name": "TypedProposalsCannotBeDisabled", + "msg": "Typed proposals cannot be disabled" + }, + { + "code": 6075, + "name": "UnfrozenAddressLookupTable", + "msg": "Address lookup tables referenced by the vault transaction must be frozen" + }, + { + "code": 6076, + "name": "InvalidAddressLookupTable", + "msg": "Lookup table accounts must match the vault transaction's address table lookups" + }, + { + "code": 6077, + "name": "InvalidSquadsVaultTransaction", + "msg": "Expected the proposal's Squads vault transaction as the first launch account" + } + ], + "types": [ + { + "name": "AdminCancelProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "post_amm_state", + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + } + ] + } + }, + { + "name": "AdminEnqueueMultisigProposalApprovalArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "transaction_index", + "type": "u64" + } + ] + } + }, + { + "name": "AdminEnqueueMultisigProposalCancellationArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "transaction_index", + "type": "u64" + } + ] + } + }, + { + "name": "AdminFixPositionAuthorityEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "amm_position", + "type": "pubkey" + }, + { + "name": "old_authority", + "type": "pubkey" + }, + { + "name": "new_authority", + "type": "pubkey" + } + ] + } + }, + { + "name": "AdminUpdateProposalParamsArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "duration_in_seconds", + "type": { + "option": "u32" + } + }, + { + "name": "pass_threshold_bps", + "type": { + "option": "i16" + } + } + ] + } + }, + { + "name": "AdminUpdateProposalParamsEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "old_duration_in_seconds", + "type": "u32" + }, + { + "name": "new_duration_in_seconds", + "type": "u32" + }, + { + "name": "old_pass_threshold_bps", + "type": "i16" + }, + { + "name": "new_pass_threshold_bps", + "type": "i16" + } + ] + } + }, + { + "name": "AmmPosition", + "type": { + "kind": "struct", + "fields": [ + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "position_authority", + "type": "pubkey" + }, + { + "name": "liquidity", + "type": "u128" + } + ] + } + }, + { + "name": "CollectFeesEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "base_token_account", + "type": "pubkey" + }, + { + "name": "quote_token_account", + "type": "pubkey" + }, + { + "name": "amm_base_vault", + "type": "pubkey" + }, + { + "name": "amm_quote_vault", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_fees_collected", + "type": "u64" + }, + { + "name": "base_fees_collected", + "type": "u64" + }, + { + "name": "post_amm_state", + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + } + ] + } + }, + { + "name": "CollectMeteoraDammFeesEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "base_token_account", + "type": "pubkey" + }, + { + "name": "quote_token_account", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_fees_collected", + "type": "u64" + }, + { + "name": "base_fees_collected", + "type": "u64" + } + ] + } + }, + { + "name": "CommonFields", + "type": { + "kind": "struct", + "fields": [ + { + "name": "slot", + "type": "u64" + }, + { + "name": "unix_timestamp", + "type": "i64" + }, + { + "name": "dao_seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "ConditionalSwapEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "trader", + "type": "pubkey" + }, + { + "name": "market", + "type": { + "defined": { + "name": "Market" + } + } + }, + { + "name": "swap_type", + "type": { + "defined": { + "name": "SwapType" + } + } + }, + { + "name": "input_amount", + "type": "u64" + }, + { + "name": "output_amount", + "type": "u64" + }, + { + "name": "min_output_amount", + "type": "u64" + }, + { + "name": "post_amm_state", + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + } + ] + } + }, + { + "name": "ConditionalSwapParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "market", + "type": { + "defined": { + "name": "Market" + } + } + }, + { + "name": "swap_type", + "type": { + "defined": { + "name": "SwapType" + } + } + }, + { + "name": "input_amount", + "type": "u64" + }, + { + "name": "min_output_amount", + "type": "u64" + } + ] + } + }, + { + "name": "ConditionalVault", + "type": { + "kind": "struct", + "fields": [ + { + "name": "question", + "type": "pubkey" + }, + { + "name": "underlying_token_mint", + "type": "pubkey" + }, + { + "name": "underlying_token_account", + "type": "pubkey" + }, + { + "name": "conditional_token_mints", + "type": { + "vec": "pubkey" + } + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "decimals", + "type": "u8" + }, + { + "name": "seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "Dao", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amm", + "docs": [ + "Embedded FutarchyAmm - 1:1 relationship" + ], + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + }, + { + "name": "nonce", + "docs": [ + "`nonce` + `dao_creator` are PDA seeds" + ], + "type": "u64" + }, + { + "name": "dao_creator", + "type": "pubkey" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "squads_multisig", + "type": "pubkey" + }, + { + "name": "squads_multisig_vault", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "proposal_count", + "type": "u32" + }, + { + "name": "pass_threshold_bps", + "type": "u16" + }, + { + "name": "seconds_per_proposal", + "type": "u32" + }, + { + "name": "twap_initial_observation", + "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": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "twap_start_delay_seconds", + "docs": [ + "Forces TWAP calculation to start after `twap_start_delay_seconds` seconds" + ], + "type": "u32" + }, + { + "name": "min_quote_futarchic_liquidity", + "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": "min_base_futarchic_liquidity", + "type": "u64" + }, + { + "name": "base_to_stake", + "docs": [ + "Minimum amount of base tokens that must be staked to launch a proposal" + ], + "type": "u64" + }, + { + "name": "seq_num", + "type": "u64" + }, + { + "name": "initial_spending_limit", + "docs": [ + "The authoritative record of what the Squads spending limit should be.", + "`None` = no limit. Kept in sync with the Squads-side account by", + "`sync_spending_limit`. (Named for its original init-only role)" + ], + "type": { + "option": { + "defined": { + "name": "InitialSpendingLimit" + } + } + } + }, + { + "name": "team_sponsored_pass_threshold_bps", + "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": "team_address", + "type": "pubkey" + }, + { + "name": "optimistic_proposal", + "docs": [ + "Deprecated in favor of typed proposals" + ], + "type": { + "option": { + "defined": { + "name": "OptimisticProposal" + } + } + } + }, + { + "name": "is_optimistic_governance_enabled", + "docs": [ + "Deprecated in favor of typed proposals" + ], + "type": "bool" + }, + { + "name": "liquidator", + "docs": [ + "`Some` means the DAO has been liquidated, and holds who runs the estate.", + "Set once by `finalize_proposal` the moment a hostile liquidation", + "passes, never cleared." + ], + "type": { + "option": "pubkey" + } + }, + { + "name": "last_failed_takeover_at", + "docs": [ + "Unix time of the last failed hostile takeover. 0 = never." + ], + "type": "i64" + }, + { + "name": "last_failed_liquidation_at", + "docs": [ + "Unix time of the last failed hostile liquidation. 0 = never." + ], + "type": "i64" + }, + { + "name": "spending_limit_dirty", + "docs": [ + "Set by every write to the spending-limit record (`initial_spending_limit`),", + "consumed by `sync_spending_limit`." + ], + "type": "bool" + }, + { + "name": "last_buyback_finalized_at", + "docs": [ + "Unix time of the last buyback finalization. 0 = never." + ], + "type": "i64" + }, + { + "name": "typed_proposals_enabled", + "docs": [ + "Whether the DAO runs on the mini-instructions catalog. Never turns off." + ], + "type": "bool" + } + ] + } + }, + { + "name": "EnqueuedMultisigProposalApproval", + "type": { + "kind": "struct", + "fields": [ + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "transaction_index", + "type": "u64" + }, + { + "name": "pda_bump", + "type": "u8" + } + ] + } + }, + { + "name": "EnqueuedMultisigProposalCancellation", + "type": { + "kind": "struct", + "fields": [ + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "transaction_index", + "type": "u64" + }, + { + "name": "pda_bump", + "type": "u8" + } + ] + } + }, + { + "name": "FinalizeProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "pass_market_twap", + "type": "u128" + }, + { + "name": "fail_market_twap", + "type": "u128" + }, + { + "name": "threshold", + "type": "u128" + }, + { + "name": "state", + "type": { + "defined": { + "name": "ProposalState" + } + } + }, + { + "name": "squads_proposal", + "type": "pubkey" + }, + { + "name": "squads_multisig", + "type": "pubkey" + }, + { + "name": "post_amm_state", + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + }, + { + "name": "is_team_sponsored", + "type": "bool" + } + ] + } + }, + { + "name": "FutarchyAmm", + "type": { + "kind": "struct", + "fields": [ + { + "name": "state", + "type": { + "defined": { + "name": "PoolState" + } + } + }, + { + "name": "total_liquidity", + "type": "u128" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "amm_base_vault", + "type": "pubkey" + }, + { + "name": "amm_quote_vault", + "type": "pubkey" + } + ] + } + }, + { + "name": "InitialSpendingLimit", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amount_per_month", + "type": "u64" + }, + { + "name": "members", + "type": { + "vec": "pubkey" + } + } + ] + } + }, + { + "name": "InitializeBuybackTokenProposalArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "quote_amount", + "type": "u64" + }, + { + "name": "cycle_count", + "type": "u32" + }, + { + "name": "cycle_frequency_seconds", + "type": "u32" + }, + { + "name": "start_delay_seconds", + "type": "u32" + }, + { + "name": "min_price", + "type": { + "option": "u64" + } + }, + { + "name": "max_price", + "type": { + "option": "u64" + } + } + ] + } + }, + { + "name": "InitializeDaoEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "pass_threshold_bps", + "type": "u16" + }, + { + "name": "seconds_per_proposal", + "type": "u32" + }, + { + "name": "twap_initial_observation", + "type": "u128" + }, + { + "name": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "twap_start_delay_seconds", + "type": "u32" + }, + { + "name": "min_quote_futarchic_liquidity", + "type": "u64" + }, + { + "name": "min_base_futarchic_liquidity", + "type": "u64" + }, + { + "name": "base_to_stake", + "type": "u64" + }, + { + "name": "initial_spending_limit", + "type": { + "option": { + "defined": { + "name": "InitialSpendingLimit" + } + } + } + }, + { + "name": "squads_multisig", + "type": "pubkey" + }, + { + "name": "squads_multisig_vault", + "type": "pubkey" + }, + { + "name": "team_sponsored_pass_threshold_bps", + "type": "i16" + }, + { + "name": "team_address", + "type": "pubkey" + }, + { + "name": "typed_proposals_enabled", + "type": "bool" + } + ] + } + }, + { + "name": "InitializeDaoParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "twap_initial_observation", + "type": "u128" + }, + { + "name": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "twap_start_delay_seconds", + "type": "u32" + }, + { + "name": "min_quote_futarchic_liquidity", + "type": "u64" + }, + { + "name": "min_base_futarchic_liquidity", + "type": "u64" + }, + { + "name": "base_to_stake", + "type": "u64" + }, + { + "name": "pass_threshold_bps", + "type": "u16" + }, + { + "name": "seconds_per_proposal", + "type": "u32" + }, + { + "name": "nonce", + "type": "u64" + }, + { + "name": "initial_spending_limit", + "type": { + "option": { + "defined": { + "name": "InitialSpendingLimit" + } + } + } + }, + { + "name": "team_sponsored_pass_threshold_bps", + "type": "i16" + }, + { + "name": "team_address", + "type": "pubkey" + } + ] + } + }, + { + "name": "InitializeHostileLiquidateProposalArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "liquidator", + "type": "pubkey" + } + ] + } + }, + { + "name": "InitializeHostileTakeoverProposalArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "new_team_address", + "type": "pubkey" + }, + { + "name": "spending_limit_action", + "type": { + "defined": { + "name": "SpendingLimitAction" + } + } + } + ] + } + }, + { + "name": "InitializeLargeSpendProposalArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amount", + "type": "u64" + } + ] + } + }, + { + "name": "InitializeMintTokensProposalArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amount", + "type": "u64" + }, + { + "name": "recipient", + "type": "pubkey" + } + ] + } + }, + { + "name": "InitializeProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "question", + "type": "pubkey" + }, + { + "name": "quote_vault", + "type": "pubkey" + }, + { + "name": "base_vault", + "type": "pubkey" + }, + { + "name": "proposer", + "type": "pubkey" + }, + { + "name": "number", + "type": "u32" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "duration_in_seconds", + "type": "u32" + }, + { + "name": "squads_proposal", + "type": "pubkey" + }, + { + "name": "squads_multisig", + "type": "pubkey" + }, + { + "name": "squads_multisig_vault", + "type": "pubkey" + }, + { + "name": "action", + "type": { + "defined": { + "name": "ProposalAction" + } + } + } + ] + } + }, + { + "name": "InitializeSpendingLimitChangeProposalArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "config", + "docs": [ + "`Some` replaces the record, `None` removes it." + ], + "type": { + "option": { + "defined": { + "name": "InitialSpendingLimit" + } + } + } + } + ] + } + }, + { + "name": "LaunchProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "timestamp_enqueued", + "type": "i64" + }, + { + "name": "total_staked", + "type": "u64" + }, + { + "name": "post_amm_state", + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + }, + { + "name": "duration_in_seconds", + "docs": [ + "The terms the market opened with, as written by launch." + ], + "type": "u32" + }, + { + "name": "pass_threshold_bps", + "type": "i16" + }, + { + "name": "is_team_sponsored", + "type": "bool" + } + ] + } + }, + { + "name": "Market", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Spot" + }, + { + "name": "Pass" + }, + { + "name": "Fail" + } + ] + } + }, + { + "name": "MintAuthority", + "type": { + "kind": "struct", + "fields": [ + { + "name": "mint_governor", + "type": "pubkey" + }, + { + "name": "authorized_minter", + "type": "pubkey" + }, + { + "name": "max_total", + "type": { + "option": "u64" + } + }, + { + "name": "total_minted", + "type": "u64" + }, + { + "name": "bump", + "type": "u8" + } + ] + } + }, + { + "name": "MintGovernor", + "type": { + "kind": "struct", + "fields": [ + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "create_key", + "type": "pubkey" + }, + { + "name": "seq_num", + "type": "u64" + }, + { + "name": "bump", + "type": "u8" + } + ] + } + }, + { + "name": "OptimisticProposal", + "type": { + "kind": "struct", + "fields": [ + { + "name": "squads_proposal", + "docs": [ + "The squads proposal currently enqueued for execution if not challenged by a new proposal." + ], + "type": "pubkey" + }, + { + "name": "enqueued_timestamp", + "docs": [ + "The timestamp when the active optimistic squads proposal was enqueued." + ], + "type": "i64" + } + ] + } + }, + { + "name": "Pool", + "type": { + "kind": "struct", + "fields": [ + { + "name": "oracle", + "type": { + "defined": { + "name": "TwapOracle" + } + } + }, + { + "name": "quote_reserves", + "type": "u64" + }, + { + "name": "base_reserves", + "type": "u64" + }, + { + "name": "quote_protocol_fee_balance", + "type": "u64" + }, + { + "name": "base_protocol_fee_balance", + "type": "u64" + } + ] + } + }, + { + "name": "PoolState", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Spot", + "fields": [ + { + "name": "spot", + "type": { + "defined": { + "name": "Pool" + } + } + } + ] + }, + { + "name": "Futarchy", + "fields": [ + { + "name": "spot", + "type": { + "defined": { + "name": "Pool" + } + } + }, + { + "name": "pass", + "type": { + "defined": { + "name": "Pool" + } + } + }, + { + "name": "fail", + "type": { + "defined": { + "name": "Pool" + } + } + } + ] + } + ] + } + }, + { + "name": "Proposal", + "type": { + "kind": "struct", + "fields": [ + { + "name": "number", + "type": "u32" + }, + { + "name": "proposer", + "type": "pubkey" + }, + { + "name": "timestamp_enqueued", + "type": "i64" + }, + { + "name": "state", + "type": { + "defined": { + "name": "ProposalState" + } + } + }, + { + "name": "base_vault", + "type": "pubkey" + }, + { + "name": "quote_vault", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "question", + "type": "pubkey" + }, + { + "name": "duration_in_seconds", + "type": "u32" + }, + { + "name": "squads_proposal", + "type": "pubkey" + }, + { + "name": "pass_base_mint", + "type": "pubkey" + }, + { + "name": "pass_quote_mint", + "type": "pubkey" + }, + { + "name": "fail_base_mint", + "type": "pubkey" + }, + { + "name": "fail_quote_mint", + "type": "pubkey" + }, + { + "name": "sponsored_by", + "docs": [ + "The team that last sponsored the proposal. `None` = never sponsored." + ], + "type": { + "option": "pubkey" + } + }, + { + "name": "pass_threshold_bps", + "type": "i16" + }, + { + "name": "council_can_block", + "docs": [ + "Snapshot of the kind's blockable flag at create." + ], + "type": "bool" + }, + { + "name": "action", + "docs": [ + "The typed action parameters." + ], + "type": { + "defined": { + "name": "ProposalAction" + } + } + }, + { + "name": "params_overridden", + "docs": [ + "Set by `admin_update_proposal_params`. `launch_proposal` then leaves the", + "duration and threshold alone." + ], + "type": "bool" + } + ] + } + }, + { + "name": "ProposalAction", + "docs": [ + "The typed action parameters, stored on the proposal. The borsh variant tag", + "is the proposal's kind discriminator, so variants are append-only — the", + "variant index is the wire tag." + ], + "type": { + "kind": "enum", + "variants": [ + { + "name": "LargeSpend", + "fields": [ + { + "name": "amount", + "type": "u64" + }, + { + "name": "team_address", + "docs": [ + "The team the baked transfer pays, snapshotted at create. Launch", + "requires it to still be the DAO's team." + ], + "type": "pubkey" + } + ] + }, + { + "name": "MintTokens", + "fields": [ + { + "name": "amount", + "type": "u64" + }, + { + "name": "recipient", + "type": "pubkey" + } + ] + }, + { + "name": "SpendingLimitChange", + "fields": [ + { + "name": "config", + "type": { + "option": { + "defined": { + "name": "InitialSpendingLimit" + } + } + } + } + ] + }, + { + "name": "ExecuteArbitrary" + }, + { + "name": "HostileTakeover", + "fields": [ + { + "name": "new_team_address", + "docs": [ + "The team to install. Launch requires it to still differ from the", + "DAO's team." + ], + "type": "pubkey" + }, + { + "name": "spending_limit_action", + "type": { + "defined": { + "name": "SpendingLimitAction" + } + } + } + ] + }, + { + "name": "HostileLiquidate", + "fields": [ + { + "name": "liquidator", + "type": "pubkey" + } + ] + }, + { + "name": "BuybackToken", + "fields": [ + { + "name": "quote_amount", + "docs": [ + "Total quote to deploy. Capped at 25% of the treasury." + ], + "type": "u64" + }, + { + "name": "cycle_count", + "docs": [ + "Orders the total is split across. At least 2." + ], + "type": "u32" + }, + { + "name": "cycle_frequency_seconds", + "docs": [ + "Seconds between orders." + ], + "type": "u32" + }, + { + "name": "start_delay_seconds", + "docs": [ + "Seconds after execution before the first order. 0 = immediately." + ], + "type": "u32" + }, + { + "name": "min_price", + "docs": [ + "Optional price band, in quote native units per whole base token:", + "1_600_000 = 1.6 USDC per token.", + "`None` = unguarded." + ], + "type": { + "option": "u64" + } + }, + { + "name": "max_price", + "type": { + "option": "u64" + } + } + ] + } + ] + } + }, + { + "name": "ProposalState", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Draft", + "fields": [ + { + "name": "amount_staked", + "type": "u64" + } + ] + }, + { + "name": "Pending" + }, + { + "name": "Passed" + }, + { + "name": "Failed" + }, + { + "name": "Removed" + } + ] + } + }, + { + "name": "ProvideLiquidityEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "liquidity_provider", + "type": "pubkey" + }, + { + "name": "position_authority", + "type": "pubkey" + }, + { + "name": "quote_amount", + "type": "u64" + }, + { + "name": "base_amount", + "type": "u64" + }, + { + "name": "liquidity_minted", + "type": "u128" + }, + { + "name": "min_liquidity", + "type": "u128" + }, + { + "name": "post_amm_state", + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + } + ] + } + }, + { + "name": "ProvideLiquidityParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "quote_amount", + "docs": [ + "How much quote token you will deposit to the pool" + ], + "type": "u64" + }, + { + "name": "max_base_amount", + "docs": [ + "The maximum base token you will deposit to the pool" + ], + "type": "u64" + }, + { + "name": "min_liquidity", + "docs": [ + "The minimum liquidity you will be assigned" + ], + "type": "u128" + }, + { + "name": "position_authority", + "docs": [ + "The account that will own the LP position, usually the same as the", + "liquidity provider" + ], + "type": "pubkey" + } + ] + } + }, + { + "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": "question_id", + "type": { + "array": [ + "u8", + 32 + ] + } + }, + { + "name": "oracle", + "type": "pubkey" + }, + { + "name": "payout_numerators", + "type": { + "vec": "u32" + } + }, + { + "name": "payout_denominator", + "type": "u32" + } + ] + } + }, + { + "name": "RemoveProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "admin", + "type": "pubkey" + } + ] + } + }, + { + "name": "SetSpendingLimitArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "config", + "docs": [ + "`Some` becomes the new record verbatim; `None` deletes it." + ], + "type": { + "option": { + "defined": { + "name": "InitialSpendingLimit" + } + } + } + } + ] + } + }, + { + "name": "SetSpendingLimitEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "config", + "type": { + "option": { + "defined": { + "name": "InitialSpendingLimit" + } + } + } + } + ] + } + }, + { + "name": "SpendingLimitAction", + "docs": [ + "What a hostile takeover declares for the spending limit." + ], + "type": { + "kind": "enum", + "variants": [ + { + "name": "Keep" + }, + { + "name": "Remove" + }, + { + "name": "Set", + "fields": [ + { + "defined": { + "name": "InitialSpendingLimit" + } + } + ] + } + ] + } + }, + { + "name": "SponsorProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "team_address", + "type": "pubkey" + } + ] + } + }, + { + "name": "SpotSwapEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "swap_type", + "type": { + "defined": { + "name": "SwapType" + } + } + }, + { + "name": "input_amount", + "type": "u64" + }, + { + "name": "output_amount", + "type": "u64" + }, + { + "name": "min_output_amount", + "type": "u64" + }, + { + "name": "post_amm_state", + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + } + ] + } + }, + { + "name": "SpotSwapParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "input_amount", + "type": "u64" + }, + { + "name": "swap_type", + "type": { + "defined": { + "name": "SwapType" + } + } + }, + { + "name": "min_output_amount", + "type": "u64" + } + ] + } + }, + { + "name": "StakeAccount", + "type": { + "kind": "struct", + "fields": [ + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "staker", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "bump", + "type": "u8" + } + ] + } + }, + { + "name": "StakeToProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "staker", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "total_staked", + "type": "u64" + } + ] + } + }, + { + "name": "StakeToProposalParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amount", + "type": "u64" + } + ] + } + }, + { + "name": "SwapType", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Buy" + }, + { + "name": "Sell" + } + ] + } + }, + { + "name": "SyncSpendingLimitEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "spending_limit", + "docs": [ + "The Squads-side SpendingLimit PDA the record was projected onto." + ], + "type": "pubkey" + }, + { + "name": "config", + "docs": [ + "The projected record — the Squads-side end-state after the sync.", + "`None` = no limit (removed or never existed)." + ], + "type": { + "option": { + "defined": { + "name": "InitialSpendingLimit" + } + } + } + } + ] + } + }, + { + "name": "TwapOracle", + "type": { + "kind": "struct", + "fields": [ + { + "name": "aggregator", + "docs": [ + "Running sum of seconds_since_last_update * last_observation.", + "", + "Assuming latest observations are as big as possible (u64::MAX * 1e12),", + "we can store 18 million seconds worth of observations, which turns out to", + "be ~213 days.", + "", + "Assuming that latest observations are 100x smaller than they could theoretically", + "be, we can store ~57 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.", + "", + "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": "last_updated_timestamp", + "type": "i64" + }, + { + "name": "created_at_timestamp", + "type": "i64" + }, + { + "name": "last_price", + "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": "last_observation", + "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": "max_observation_change_per_update", + "docs": [ + "The most that an observation can change per update." + ], + "type": "u128" + }, + { + "name": "initial_observation", + "docs": [ + "What the initial `latest_observation` is set to." + ], + "type": "u128" + }, + { + "name": "start_delay_seconds", + "docs": [ + "Number of seconds after amm.created_at_slot to start recording TWAP" + ], + "type": "u32" + } + ] + } + }, + { + "name": "UnstakeFromProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "staker", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "total_staked", + "type": "u64" + } + ] + } + }, + { + "name": "UnstakeFromProposalParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amount", + "type": "u64" + } + ] + } + }, + { + "name": "UpdateDaoEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "pass_threshold_bps", + "type": "u16" + }, + { + "name": "seconds_per_proposal", + "type": "u32" + }, + { + "name": "twap_initial_observation", + "type": "u128" + }, + { + "name": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "twap_start_delay_seconds", + "type": "u32" + }, + { + "name": "min_quote_futarchic_liquidity", + "type": "u64" + }, + { + "name": "min_base_futarchic_liquidity", + "type": "u64" + }, + { + "name": "base_to_stake", + "type": "u64" + }, + { + "name": "team_sponsored_pass_threshold_bps", + "type": "i16" + }, + { + "name": "team_address", + "type": "pubkey" + }, + { + "name": "is_optimistic_governance_enabled", + "type": "bool" + }, + { + "name": "typed_proposals_enabled", + "type": "bool" + } + ] + } + }, + { + "name": "UpdateDaoParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pass_threshold_bps", + "type": { + "option": "u16" + } + }, + { + "name": "seconds_per_proposal", + "type": { + "option": "u32" + } + }, + { + "name": "twap_initial_observation", + "type": { + "option": "u128" + } + }, + { + "name": "twap_max_observation_change_per_update", + "type": { + "option": "u128" + } + }, + { + "name": "twap_start_delay_seconds", + "type": { + "option": "u32" + } + }, + { + "name": "min_quote_futarchic_liquidity", + "type": { + "option": "u64" + } + }, + { + "name": "min_base_futarchic_liquidity", + "type": { + "option": "u64" + } + }, + { + "name": "base_to_stake", + "type": { + "option": "u64" + } + }, + { + "name": "team_sponsored_pass_threshold_bps", + "type": { + "option": "i16" + } + }, + { + "name": "team_address", + "type": { + "option": "pubkey" + } + }, + { + "name": "_deprecated_is_optimistic_governance_enabled", + "docs": [ + "Ignored. The retired optimistic-governance flag, kept in place so", + "payloads encoded before the upgrade are refused, not reinterpreted." + ], + "type": { + "option": "bool" + } + }, + { + "name": "typed_proposals_enabled", + "docs": [ + "`Some(true)` turns typed proposals on for this DAO. `None` leaves them", + "as they are. `Some(false)` is refused: there is no way to turn them off." + ], + "type": { + "option": "bool" + } + } + ] + } + }, + { + "name": "WithdrawLiquidityEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "liquidity_provider", + "type": "pubkey" + }, + { + "name": "liquidity_withdrawn", + "type": "u128" + }, + { + "name": "min_base_amount", + "type": "u64" + }, + { + "name": "min_quote_amount", + "type": "u64" + }, + { + "name": "base_amount", + "type": "u64" + }, + { + "name": "quote_amount", + "type": "u64" + }, + { + "name": "post_amm_state", + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + } + ] + } + }, + { + "name": "WithdrawLiquidityParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "liquidity_to_withdraw", + "docs": [ + "How much liquidity to withdraw" + ], + "type": "u128" + }, + { + "name": "min_base_amount", + "docs": [ + "Minimum base tokens to receive" + ], + "type": "u64" + }, + { + "name": "min_quote_amount", + "docs": [ + "Minimum quote tokens to receive" + ], + "type": "u64" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/sdk/src/futarchy/v0.6/types/futarchy.ts b/sdk/src/futarchy/v0.6/types/futarchy.ts index b689da892..d2569bc80 100644 --- a/sdk/src/futarchy/v0.6/types/futarchy.ts +++ b/sdk/src/futarchy/v0.6/types/futarchy.ts @@ -1,7948 +1,8469 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL can be found at `target/idl/futarchy.json`. + */ export type Futarchy = { - version: "0.6.2"; - name: "futarchy"; + address: "FUTARELBfJfQ8RDGhg1wdhddq1odMAJUePHFuBYfUxKq"; + metadata: { + name: "futarchy"; + version: "0.6.2"; + spec: "0.1.0"; + description: "SVM-based program for running futarchy"; + }; instructions: [ { - name: "initializeDao"; + name: "adminCancelProposal"; + discriminator: [95, 233, 121, 193, 90, 80, 147, 255]; accounts: [ { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "daoCreator"; - isMut: false; - isSigner: true; - }, - { - name: "payer"; - isMut: true; - isSigner: true; + name: "proposal"; + writable: true; }, { - name: "systemProgram"; - isMut: false; - isSigner: false; + name: "dao"; + writable: true; + relations: ["proposal"]; }, { - name: "baseMint"; - isMut: false; - isSigner: false; + name: "question"; + writable: true; + relations: ["proposal"]; }, { - name: "quoteMint"; - isMut: false; - isSigner: false; + name: "squadsProposal"; + writable: true; + relations: ["proposal"]; }, { name: "squadsMultisig"; - isMut: true; - isSigner: false; + relations: ["dao"]; }, { - 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: "squadsMultisigProgram"; + address: "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf"; }, { - name: "spendingLimit"; - isMut: true; - isSigner: false; + name: "ammPassBaseVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "proposal.pass_base_mint"; + account: "proposal"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "futarchyAmmBaseVault"; - isMut: true; - isSigner: false; + name: "ammPassQuoteVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "proposal.pass_quote_mint"; + account: "proposal"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "futarchyAmmQuoteVault"; - isMut: true; - isSigner: false; + name: "ammFailBaseVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "proposal.fail_base_mint"; + account: "proposal"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + name: "ammFailQuoteVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "proposal.fail_quote_mint"; + account: "proposal"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + name: "ammBaseVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "dao.base_mint"; + account: "dao"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + name: "ammQuoteVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "dao.quote_mint"; + account: "dao"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "program"; - isMut: false; - isSigner: false; + name: "vaultProgram"; + address: "VLTX1ishMBbcX3rdBWGssxawAo1Q2X2qxYFYqiGodVg"; }, - ]; - args: [ { - name: "params"; - type: { - defined: "InitializeDaoParams"; - }; + name: "vaultEventAuthority"; }, - ]; - }, - { - name: "initializeProposal"; - accounts: [ { - name: "proposal"; - isMut: true; - isSigner: false; + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { - name: "squadsProposal"; - isMut: false; - isSigner: false; + name: "quoteVault"; + writable: true; + relations: ["proposal"]; }, { - name: "squadsMultisig"; - isMut: false; - isSigner: false; + name: "quoteVaultUnderlyingTokenAccount"; + writable: true; }, { - name: "squadsVaultTransaction"; - isMut: false; - isSigner: false; + name: "passQuoteMint"; + writable: true; + relations: ["proposal"]; }, { - name: "dao"; - isMut: true; - isSigner: false; + name: "failQuoteMint"; + writable: true; + relations: ["proposal"]; }, { - name: "question"; - isMut: false; - isSigner: false; + name: "passBaseMint"; + writable: true; + relations: ["proposal"]; }, { - name: "quoteVault"; - isMut: false; - isSigner: false; + name: "failBaseMint"; + writable: true; + relations: ["proposal"]; }, { name: "baseVault"; - isMut: false; - isSigner: false; + writable: true; + relations: ["proposal"]; }, { - name: "proposer"; - isMut: false; - isSigner: true; - }, - { - name: "payer"; - isMut: true; - isSigner: true; + name: "baseVaultUnderlyingTokenAccount"; + writable: true; }, { - name: "systemProgram"; - isMut: false; - isSigner: false; + name: "admin"; + signer: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { - name: "initializeLargeSpendProposal"; + name: "adminEnqueueMultisigProposalApproval"; + discriminator: [61, 199, 241, 100, 238, 220, 84, 78]; accounts: [ { - name: "typedInitializeAccounts"; - accounts: [ - { - name: "proposal"; - isMut: true; - isSigner: false; - }, - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisig"; - isMut: true; - isSigner: false; - }, - { - name: "squadsTransaction"; - isMut: true; - isSigner: false; - docs: [ - "and enforces that it is the transaction PDA for the next transaction index", - ]; - }, - { - name: "squadsProposal"; - isMut: true; - isSigner: false; - docs: [ - "enforces that it is the proposal PDA for the next transaction index", + name: "dao"; + }, + { + name: "admin"; + writable: true; + signer: true; + }, + { + name: "squadsMultisig"; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "account"; + path: "dao"; + }, + ]; + program: { + kind: "const"; + value: [ + 6, + 129, + 196, + 206, + 71, + 226, + 35, + 104, + 184, + 177, + 85, + 94, + 200, + 135, + 175, + 9, + 46, + 252, + 126, + 251, + 182, + 108, + 163, + 245, + 47, + 191, + 104, + 212, + 172, + 156, + 183, + 168, ]; - }, - { - name: "question"; - isMut: false; - isSigner: false; - }, - { - name: "baseVault"; - isMut: false; - isSigner: false; - }, - { - name: "quoteVault"; - isMut: false; - isSigner: false; - }, - { - name: "proposer"; - isMut: false; - isSigner: true; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "permissionlessAccount"; - isMut: false; - isSigner: true; - docs: [ - "The Squads-side creator of the vault transaction and proposal, an", - "Initiate | Execute member of every DAO multisig. Its keypair ships in", - "the SDK, so anyone can provide this signature.", + }; + }; + relations: ["dao"]; + }, + { + name: "squadsMultisigProposal"; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "account"; + path: "squadsMultisig"; + }, + { + kind: "const"; + value: [116, 114, 97, 110, 115, 97, 99, 116, 105, 111, 110]; + }, + { + kind: "arg"; + path: "args.transaction_index"; + }, + { + kind: "const"; + value: [112, 114, 111, 112, 111, 115, 97, 108]; + }, + ]; + program: { + kind: "const"; + value: [ + 6, + 129, + 196, + 206, + 71, + 226, + 35, + 104, + 184, + 177, + 85, + 94, + 200, + 135, + 175, + 9, + 46, + 252, + 126, + 251, + 182, + 108, + 163, + 245, + 47, + 191, + 104, + 212, + 172, + 156, + 183, + 168, ]; - }, - { - name: "squadsProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - ]; + }; + }; }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + name: "enqueuedApproval"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 101, + 110, + 113, + 117, + 101, + 117, + 101, + 100, + 95, + 97, + 112, + 112, + 114, + 111, + 118, + 97, + 108, + ]; + }, + { + kind: "account"; + path: "dao"; + }, + { + kind: "arg"; + path: "args.transaction_index"; + }, + ]; + }; }, { - name: "program"; - isMut: false; - isSigner: false; + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, ]; args: [ { name: "args"; type: { - defined: "InitializeLargeSpendProposalArgs"; + defined: { + name: "adminEnqueueMultisigProposalApprovalArgs"; + }; }; }, ]; }, { - name: "initializeMintTokensProposal"; + name: "adminEnqueueMultisigProposalCancellation"; + discriminator: [130, 141, 11, 45, 40, 95, 131, 2]; accounts: [ { - name: "typedInitializeAccounts"; - accounts: [ - { - name: "proposal"; - isMut: true; - isSigner: false; - }, - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisig"; - isMut: true; - isSigner: false; - }, - { - name: "squadsTransaction"; - isMut: true; - isSigner: false; - docs: [ - "and enforces that it is the transaction PDA for the next transaction index", - ]; - }, - { - name: "squadsProposal"; - isMut: true; - isSigner: false; - docs: [ - "enforces that it is the proposal PDA for the next transaction index", - ]; - }, - { - name: "question"; - isMut: false; - isSigner: false; - }, - { - name: "baseVault"; - isMut: false; - isSigner: false; - }, - { - name: "quoteVault"; - isMut: false; - isSigner: false; - }, - { - name: "proposer"; - isMut: false; - isSigner: true; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "permissionlessAccount"; - isMut: false; - isSigner: true; - docs: [ - "The Squads-side creator of the vault transaction and proposal, an", - "Initiate | Execute member of every DAO multisig. Its keypair ships in", - "the SDK, so anyone can provide this signature.", - ]; - }, - { - name: "squadsProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - ]; + name: "dao"; }, { - name: "baseMint"; - isMut: false; - isSigner: false; + name: "admin"; + writable: true; + signer: true; }, { - name: "mintGovernor"; - isMut: false; - isSigner: false; - isOptional: true; - docs: [ - "Only for governed mints (v0.8 launches): the `MintGovernor` holding the", - "base mint's authority.", - ]; + name: "squadsMultisig"; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "account"; + path: "dao"; + }, + ]; + program: { + kind: "const"; + value: [ + 6, + 129, + 196, + 206, + 71, + 226, + 35, + 104, + 184, + 177, + 85, + 94, + 200, + 135, + 175, + 9, + 46, + 252, + 126, + 251, + 182, + 108, + 163, + 245, + 47, + 191, + 104, + 212, + 172, + 156, + 183, + 168, + ]; + }; + }; + relations: ["dao"]; }, { - name: "mintAuthority"; - isMut: false; - isSigner: false; - isOptional: true; - docs: [ - "Only for governed mints: the vault's minting rights on `mint_governor`.", - ]; + name: "squadsMultisigProposal"; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "account"; + path: "squadsMultisig"; + }, + { + kind: "const"; + value: [116, 114, 97, 110, 115, 97, 99, 116, 105, 111, 110]; + }, + { + kind: "arg"; + path: "args.transaction_index"; + }, + { + kind: "const"; + value: [112, 114, 111, 112, 111, 115, 97, 108]; + }, + ]; + program: { + kind: "const"; + value: [ + 6, + 129, + 196, + 206, + 71, + 226, + 35, + 104, + 184, + 177, + 85, + 94, + 200, + 135, + 175, + 9, + 46, + 252, + 126, + 251, + 182, + 108, + 163, + 245, + 47, + 191, + 104, + 212, + 172, + 156, + 183, + 168, + ]; + }; + }; }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + name: "enqueuedCancellation"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 101, + 110, + 113, + 117, + 101, + 117, + 101, + 100, + 95, + 99, + 97, + 110, + 99, + 101, + 108, + 108, + 97, + 116, + 105, + 111, + 110, + ]; + }, + { + kind: "account"; + path: "dao"; + }, + { + kind: "arg"; + path: "args.transaction_index"; + }, + ]; + }; }, { - name: "program"; - isMut: false; - isSigner: false; + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, ]; args: [ { name: "args"; type: { - defined: "InitializeMintTokensProposalArgs"; + defined: { + name: "adminEnqueueMultisigProposalCancellationArgs"; + }; }; }, ]; }, { - name: "initializeSpendingLimitChangeProposal"; + name: "adminExecuteMultisigProposal"; + discriminator: [226, 221, 40, 160, 169, 90, 48, 42]; accounts: [ { - name: "typedInitializeAccounts"; - accounts: [ - { - name: "proposal"; - isMut: true; - isSigner: false; - }, - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisig"; - isMut: true; - isSigner: false; - }, - { - name: "squadsTransaction"; - isMut: true; - isSigner: false; - docs: [ - "and enforces that it is the transaction PDA for the next transaction index", - ]; - }, - { - name: "squadsProposal"; - isMut: true; - isSigner: false; - docs: [ - "enforces that it is the proposal PDA for the next transaction index", - ]; - }, - { - name: "question"; - isMut: false; - isSigner: false; - }, - { - name: "baseVault"; - isMut: false; - isSigner: false; - }, - { - name: "quoteVault"; - isMut: false; - isSigner: false; - }, - { - name: "proposer"; - isMut: false; - isSigner: true; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "permissionlessAccount"; - isMut: false; - isSigner: true; - docs: [ - "The Squads-side creator of the vault transaction and proposal, an", - "Initiate | Execute member of every DAO multisig. Its keypair ships in", - "the SDK, so anyone can provide this signature.", - ]; - }, - { - name: "squadsProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - ]; + name: "dao"; + writable: true; + }, + { + name: "admin"; + writable: true; + signer: true; + }, + { + name: "squadsMultisig"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "account"; + path: "dao"; + }, + ]; + program: { + kind: "account"; + path: "squadsMultisigProgram"; + }; + }; + relations: ["dao"]; + }, + { + name: "squadsMultisigProposal"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "account"; + path: "squadsMultisig"; + }, + { + kind: "const"; + value: [116, 114, 97, 110, 115, 97, 99, 116, 105, 111, 110]; + }, + { + kind: "account"; + path: "squads_multisig_vault_transaction.index"; + account: "squadsVaultTransaction"; + }, + { + kind: "const"; + value: [112, 114, 111, 112, 111, 115, 97, 108]; + }, + ]; + program: { + kind: "account"; + path: "squadsMultisigProgram"; + }; + }; + }, + { + name: "squadsMultisigVaultTransaction"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "account"; + path: "squadsMultisig"; + }, + { + kind: "const"; + value: [116, 114, 97, 110, 115, 97, 99, 116, 105, 111, 110]; + }, + { + kind: "account"; + path: "squads_multisig_vault_transaction.index"; + account: "squadsVaultTransaction"; + }, + ]; + program: { + kind: "account"; + path: "squadsMultisigProgram"; + }; + }; + }, + { + name: "squadsMultisigProgram"; + address: "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf"; + }, + ]; + args: []; + }, + { + name: "adminRemoveProposal"; + discriminator: [242, 199, 27, 28, 7, 108, 122, 73]; + accounts: [ + { + name: "proposal"; + writable: true; + }, + { + name: "dao"; + writable: true; + relations: ["proposal"]; + }, + { + name: "admin"; + writable: true; + signer: true; + }, + { + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; + }, + { + name: "program"; + }, + ]; + args: []; + }, + { + name: "adminUpdateProposalParams"; + discriminator: [147, 207, 200, 2, 66, 7, 119, 180]; + accounts: [ + { + name: "dao"; + writable: true; + relations: ["proposal"]; + }, + { + name: "proposal"; + writable: true; + }, + { + name: "admin"; + signer: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "args"; type: { - defined: "InitializeSpendingLimitChangeProposalArgs"; + defined: { + name: "adminUpdateProposalParamsArgs"; + }; }; }, ]; }, { - name: "initializeHostileTakeoverProposal"; + name: "collectFees"; + discriminator: [164, 152, 207, 99, 30, 186, 19, 182]; accounts: [ { - name: "typedInitializeAccounts"; - accounts: [ - { - name: "proposal"; - isMut: true; - isSigner: false; - }, - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisig"; - isMut: true; - isSigner: false; - }, - { - name: "squadsTransaction"; - isMut: true; - isSigner: false; - docs: [ - "and enforces that it is the transaction PDA for the next transaction index", + name: "dao"; + writable: true; + }, + { + name: "admin"; + signer: true; + }, + { + name: "baseTokenAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 82, + 252, + 193, + 172, + 131, + 78, + 181, + 126, + 228, + 156, + 201, + 238, + 216, + 61, + 22, + 232, + 177, + 119, + 80, + 4, + 10, + 174, + 136, + 68, + 116, + 84, + 24, + 244, + 205, + 59, + 72, + 150, + ]; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "dao.base_mint"; + account: "dao"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, ]; - }, - { - name: "squadsProposal"; - isMut: true; - isSigner: false; - docs: [ - "enforces that it is the proposal PDA for the next transaction index", + }; + }; + }, + { + name: "quoteTokenAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 82, + 252, + 193, + 172, + 131, + 78, + 181, + 126, + 228, + 156, + 201, + 238, + 216, + 61, + 22, + 232, + 177, + 119, + 80, + 4, + 10, + 174, + 136, + 68, + 116, + 84, + 24, + 244, + 205, + 59, + 72, + 150, + ]; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "dao.quote_mint"; + account: "dao"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, ]; - }, - { - name: "question"; - isMut: false; - isSigner: false; - }, - { - name: "baseVault"; - isMut: false; - isSigner: false; - }, - { - name: "quoteVault"; - isMut: false; - isSigner: false; - }, - { - name: "proposer"; - isMut: false; - isSigner: true; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "permissionlessAccount"; - isMut: false; - isSigner: true; - docs: [ - "The Squads-side creator of the vault transaction and proposal, an", - "Initiate | Execute member of every DAO multisig. Its keypair ships in", - "the SDK, so anyone can provide this signature.", + }; + }; + }, + { + name: "ammBaseVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "dao.base_mint"; + account: "dao"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, ]; - }, - { - name: "squadsProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - ]; + }; + }; }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + name: "ammQuoteVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "dao.quote_mint"; + account: "dao"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "program"; - isMut: false; - isSigner: false; + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, - ]; - args: [ { - name: "args"; - type: { - defined: "InitializeHostileTakeoverProposalArgs"; + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; }; }, + { + name: "program"; + }, ]; + args: []; }, { - name: "initializeHostileLiquidateProposal"; + name: "collectMeteoraDammFees"; + discriminator: [139, 212, 105, 118, 126, 54, 214, 143]; accounts: [ { - name: "typedInitializeAccounts"; + name: "dao"; + writable: true; + }, + { + name: "admin"; + writable: true; + signer: true; + }, + { + name: "squadsMultisig"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "account"; + path: "dao"; + }, + ]; + program: { + kind: "account"; + path: "squadsProgram"; + }; + }; + }, + { + name: "squadsMultisigVault"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "account"; + path: "squadsMultisig"; + }, + { + kind: "const"; + value: [118, 97, 117, 108, 116]; + }, + { + kind: "const"; + value: [0]; + }, + ]; + program: { + kind: "account"; + path: "squadsProgram"; + }; + }; + }, + { + name: "squadsMultisigVaultTransaction"; + writable: true; + }, + { + name: "squadsMultisigProposal"; + writable: true; + }, + { + name: "squadsMultisigPermissionlessAccount"; + signer: true; + address: "EP3SoC2SvR3d4c2eXVBvhEMWSr2j3YtoCY3UMiQV7BPD"; + }, + { + name: "meteoraClaimPositionFeesAccounts"; accounts: [ { - name: "proposal"; - isMut: true; - isSigner: false; + name: "dammV2Program"; + address: "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG"; }, { - name: "dao"; - isMut: true; - isSigner: false; + name: "dammV2EventAuthority"; }, { - name: "squadsMultisig"; - isMut: true; - isSigner: false; + name: "poolAuthority"; + address: "HLnpSz9h2S4hiLQ43rnSD9XkcUThA7B8hQMKmDaiTLcC"; }, { - name: "squadsTransaction"; - isMut: true; - isSigner: false; - docs: [ - "and enforces that it is the transaction PDA for the next transaction index", - ]; + name: "pool"; }, { - name: "squadsProposal"; - isMut: true; - isSigner: false; - docs: [ - "enforces that it is the proposal PDA for the next transaction index", - ]; + name: "position"; + writable: true; }, { - name: "question"; - isMut: false; - isSigner: false; + name: "tokenAAccount"; + docs: ["Token account of base tokens recipient"]; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 82, + 252, + 193, + 172, + 131, + 78, + 181, + 126, + 228, + 156, + 201, + 238, + 216, + 61, + 22, + 232, + 177, + 119, + 80, + 4, + 10, + 174, + 136, + 68, + 116, + 84, + 24, + 244, + 205, + 59, + 72, + 150, + ]; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "tokenAMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "baseVault"; - isMut: false; - isSigner: false; + name: "tokenBAccount"; + docs: ["Token account of quote tokens recipient"]; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 82, + 252, + 193, + 172, + 131, + 78, + 181, + 126, + 228, + 156, + 201, + 238, + 216, + 61, + 22, + 232, + 177, + 119, + 80, + 4, + 10, + 174, + 136, + 68, + 116, + 84, + 24, + 244, + 205, + 59, + 72, + 150, + ]; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "tokenBMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "quoteVault"; - isMut: false; - isSigner: false; + name: "tokenAVault"; + writable: true; }, { - name: "proposer"; - isMut: false; - isSigner: true; + name: "tokenBVault"; + writable: true; }, { - name: "payer"; - isMut: true; - isSigner: true; + name: "tokenAMint"; }, { - name: "permissionlessAccount"; - isMut: false; - isSigner: true; - docs: [ - "The Squads-side creator of the vault transaction and proposal, an", - "Initiate | Execute member of every DAO multisig. Its keypair ships in", - "the SDK, so anyone can provide this signature.", - ]; + name: "tokenBMint"; }, { - name: "squadsProgram"; - isMut: false; - isSigner: false; + name: "positionNftAccount"; }, { - name: "systemProgram"; - isMut: false; - isSigner: false; + name: "owner"; + }, + { + name: "tokenAProgram"; + }, + { + name: "tokenBProgram"; }, ]; }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, { - name: "program"; - isMut: false; - isSigner: false; + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, - ]; - args: [ { - name: "args"; - type: { - defined: "InitializeHostileLiquidateProposalArgs"; + name: "squadsProgram"; + address: "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf"; + }, + { + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; }; }, + { + name: "program"; + }, ]; + args: []; }, { - name: "initializeBuybackTokenProposal"; + name: "conditionalSwap"; + discriminator: [194, 136, 220, 89, 242, 169, 130, 157]; accounts: [ { - name: "typedInitializeAccounts"; - accounts: [ - { - name: "proposal"; - isMut: true; - isSigner: false; - }, - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisig"; - isMut: true; - isSigner: false; - }, - { - name: "squadsTransaction"; - isMut: true; - isSigner: false; - docs: [ - "and enforces that it is the transaction PDA for the next transaction index", - ]; - }, - { - name: "squadsProposal"; - isMut: true; - isSigner: false; - docs: [ - "enforces that it is the proposal PDA for the next transaction index", - ]; - }, - { - name: "question"; - isMut: false; - isSigner: false; - }, - { - name: "baseVault"; - isMut: false; - isSigner: false; - }, - { - name: "quoteVault"; - isMut: false; - isSigner: false; - }, - { - name: "proposer"; - isMut: false; - isSigner: true; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "permissionlessAccount"; - isMut: false; - isSigner: true; - docs: [ - "The Squads-side creator of the vault transaction and proposal, an", - "Initiate | Execute member of every DAO multisig. Its keypair ships in", - "the SDK, so anyone can provide this signature.", - ]; - }, - { - name: "squadsProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - ]; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; + name: "dao"; + writable: true; + relations: ["proposal"]; }, { - name: "program"; - isMut: false; - isSigner: false; + name: "ammBaseVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "dao.base_mint"; + account: "dao"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, - ]; - args: [ { - name: "args"; - type: { - defined: "InitializeBuybackTokenProposalArgs"; + name: "ammQuoteVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "dao.quote_mint"; + account: "dao"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; }; }, - ]; - }, - { - name: "stakeToProposal"; - accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; }, { - name: "dao"; - isMut: true; - isSigner: false; + name: "ammPassBaseVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "proposal.pass_base_mint"; + account: "proposal"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "stakerBaseAccount"; - isMut: true; - isSigner: false; + name: "ammPassQuoteVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "proposal.pass_quote_mint"; + account: "proposal"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "proposalBaseAccount"; - isMut: true; - isSigner: false; + name: "ammFailBaseVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "proposal.fail_base_mint"; + account: "proposal"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "stakeAccount"; - isMut: true; - isSigner: false; + name: "ammFailQuoteVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "proposal.fail_quote_mint"; + account: "proposal"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "staker"; - isMut: false; - isSigner: true; + name: "trader"; + signer: true; }, { - name: "payer"; - isMut: true; - isSigner: true; + name: "userInputAccount"; + writable: true; }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + name: "userOutputAccount"; + writable: true; }, { - name: "systemProgram"; - isMut: false; - isSigner: false; + name: "baseVault"; + writable: true; + relations: ["proposal"]; }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + name: "baseVaultUnderlyingTokenAccount"; + writable: true; }, { - name: "program"; - isMut: false; - isSigner: false; + name: "quoteVault"; + writable: true; + relations: ["proposal"]; }, - ]; - args: [ { - name: "params"; - type: { - defined: "StakeToProposalParams"; - }; + name: "quoteVaultUnderlyingTokenAccount"; + writable: true; }, - ]; - }, - { - name: "unstakeFromProposal"; - accounts: [ { - name: "proposal"; - isMut: true; - isSigner: false; + name: "passBaseMint"; + writable: true; + relations: ["proposal"]; }, { - name: "dao"; - isMut: true; - isSigner: false; + name: "failBaseMint"; + writable: true; + relations: ["proposal"]; }, { - name: "stakerBaseAccount"; - isMut: true; - isSigner: false; + name: "passQuoteMint"; + writable: true; + relations: ["proposal"]; }, { - name: "proposalBaseAccount"; - isMut: true; - isSigner: false; + name: "failQuoteMint"; + writable: true; + relations: ["proposal"]; }, { - name: "stakeAccount"; - isMut: true; - isSigner: false; + name: "conditionalVaultProgram"; + address: "VLTX1ishMBbcX3rdBWGssxawAo1Q2X2qxYFYqiGodVg"; }, { - name: "baseMint"; - isMut: false; - isSigner: false; + name: "vaultEventAuthority"; }, { - name: "staker"; - isMut: true; - isSigner: true; + name: "question"; + relations: ["proposal"]; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "params"; type: { - defined: "UnstakeFromProposalParams"; + defined: { + name: "conditionalSwapParams"; + }; }; }, ]; }, { - name: "launchProposal"; + name: "executeMultisigProposalApproval"; + discriminator: [124, 144, 201, 164, 182, 226, 193, 224]; accounts: [ { - name: "proposal"; - isMut: true; - isSigner: false; - }, - { - name: "baseVault"; - isMut: false; - isSigner: false; + name: "dao"; + writable: true; + relations: ["enqueuedApproval"]; }, { - name: "quoteVault"; - isMut: false; - isSigner: false; + name: "rentReceiver"; + writable: true; + signer: true; }, { - name: "passBaseMint"; - isMut: false; - isSigner: false; + name: "squadsMultisig"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "account"; + path: "dao"; + }, + ]; + program: { + kind: "const"; + value: [ + 6, + 129, + 196, + 206, + 71, + 226, + 35, + 104, + 184, + 177, + 85, + 94, + 200, + 135, + 175, + 9, + 46, + 252, + 126, + 251, + 182, + 108, + 163, + 245, + 47, + 191, + 104, + 212, + 172, + 156, + 183, + 168, + ]; + }; + }; + relations: ["dao"]; }, { - name: "passQuoteMint"; - isMut: false; - isSigner: false; + name: "squadsMultisigProposal"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "account"; + path: "squadsMultisig"; + }, + { + kind: "const"; + value: [116, 114, 97, 110, 115, 97, 99, 116, 105, 111, 110]; + }, + { + kind: "account"; + path: "enqueued_approval.transaction_index"; + account: "enqueuedMultisigProposalApproval"; + }, + { + kind: "const"; + value: [112, 114, 111, 112, 111, 115, 97, 108]; + }, + ]; + program: { + kind: "const"; + value: [ + 6, + 129, + 196, + 206, + 71, + 226, + 35, + 104, + 184, + 177, + 85, + 94, + 200, + 135, + 175, + 9, + 46, + 252, + 126, + 251, + 182, + 108, + 163, + 245, + 47, + 191, + 104, + 212, + 172, + 156, + 183, + 168, + ]; + }; + }; }, { - name: "failBaseMint"; - isMut: false; - isSigner: false; + name: "enqueuedApproval"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 101, + 110, + 113, + 117, + 101, + 117, + 101, + 100, + 95, + 97, + 112, + 112, + 114, + 111, + 118, + 97, + 108, + ]; + }, + { + kind: "account"; + path: "dao"; + }, + { + kind: "account"; + path: "enqueued_approval.transaction_index"; + account: "enqueuedMultisigProposalApproval"; + }, + ]; + }; }, { - name: "failQuoteMint"; - isMut: false; - isSigner: false; + name: "squadsMultisigProgram"; + address: "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf"; }, + ]; + args: []; + }, + { + name: "executeMultisigProposalCancellation"; + discriminator: [249, 69, 159, 255, 236, 21, 243, 30]; + accounts: [ { 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; + writable: true; + relations: ["enqueuedCancellation"]; }, { - name: "ammFailQuoteVault"; - isMut: true; - isSigner: false; + name: "rentReceiver"; + writable: true; + signer: true; }, { name: "squadsMultisig"; - isMut: false; - isSigner: false; - }, - { - name: "squadsProposal"; - isMut: false; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "account"; + path: "dao"; + }, + ]; + program: { + kind: "const"; + value: [ + 6, + 129, + 196, + 206, + 71, + 226, + 35, + 104, + 184, + 177, + 85, + 94, + 200, + 135, + 175, + 9, + 46, + 252, + 126, + 251, + 182, + 108, + 163, + 245, + 47, + 191, + 104, + 212, + 172, + 156, + 183, + 168, + ]; + }; + }; + relations: ["dao"]; }, { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + name: "squadsMultisigProposal"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "account"; + path: "squadsMultisig"; + }, + { + kind: "const"; + value: [116, 114, 97, 110, 115, 97, 99, 116, 105, 111, 110]; + }, + { + kind: "account"; + path: "enqueued_cancellation.transaction_index"; + account: "enqueuedMultisigProposalCancellation"; + }, + { + kind: "const"; + value: [112, 114, 111, 112, 111, 115, 97, 108]; + }, + ]; + program: { + kind: "const"; + value: [ + 6, + 129, + 196, + 206, + 71, + 226, + 35, + 104, + 184, + 177, + 85, + 94, + 200, + 135, + 175, + 9, + 46, + 252, + 126, + 251, + 182, + 108, + 163, + 245, + 47, + 191, + 104, + 212, + 172, + 156, + 183, + 168, + ]; + }; + }; }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + name: "enqueuedCancellation"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 101, + 110, + 113, + 117, + 101, + 117, + 101, + 100, + 95, + 99, + 97, + 110, + 99, + 101, + 108, + 108, + 97, + 116, + 105, + 111, + 110, + ]; + }, + { + kind: "account"; + path: "dao"; + }, + { + kind: "account"; + path: "enqueued_cancellation.transaction_index"; + account: "enqueuedMultisigProposalCancellation"; + }, + ]; + }; }, { - name: "program"; - isMut: false; - isSigner: false; + name: "squadsMultisigProgram"; + address: "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf"; }, ]; args: []; }, { name: "finalizeProposal"; + discriminator: [23, 68, 51, 167, 109, 173, 187, 164]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; + relations: ["proposal"]; }, { name: "question"; - isMut: true; - isSigner: false; + writable: true; + relations: ["proposal"]; }, { name: "squadsProposal"; - isMut: true; - isSigner: false; + writable: true; + relations: ["proposal"]; }, { name: "squadsMultisig"; - isMut: false; - isSigner: false; + relations: ["dao"]; }, { name: "squadsMultisigProgram"; - isMut: false; - isSigner: false; + address: "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf"; }, { name: "ammPassBaseVault"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "proposal.pass_base_mint"; + account: "proposal"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "ammPassQuoteVault"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "proposal.pass_quote_mint"; + account: "proposal"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "ammFailBaseVault"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "proposal.fail_base_mint"; + account: "proposal"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "ammFailQuoteVault"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "proposal.fail_quote_mint"; + account: "proposal"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "ammBaseVault"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "dao.base_mint"; + account: "dao"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "ammQuoteVault"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "dao.quote_mint"; + account: "dao"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "vaultProgram"; - isMut: false; - isSigner: false; + address: "VLTX1ishMBbcX3rdBWGssxawAo1Q2X2qxYFYqiGodVg"; }, { name: "vaultEventAuthority"; - isMut: false; - isSigner: false; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "quoteVault"; - isMut: true; - isSigner: false; + writable: true; + relations: ["proposal"]; }, { name: "quoteVaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "passQuoteMint"; - isMut: true; - isSigner: false; + writable: true; + relations: ["proposal"]; }, { name: "failQuoteMint"; - isMut: true; - isSigner: false; + writable: true; + relations: ["proposal"]; }, { name: "passBaseMint"; - isMut: true; - isSigner: false; + writable: true; + relations: ["proposal"]; }, { name: "failBaseMint"; - isMut: true; - isSigner: false; + writable: true; + relations: ["proposal"]; }, { name: "baseVault"; - isMut: true; - isSigner: false; + writable: true; + relations: ["proposal"]; }, { name: "baseVaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { - name: "updateDao"; + name: "initializeBuybackTokenProposal"; + discriminator: [78, 26, 73, 211, 28, 51, 142, 107]; accounts: [ { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigVault"; - isMut: false; - isSigner: true; + name: "typedInitializeAccounts"; + accounts: [ + { + name: "proposal"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [112, 114, 111, 112, 111, 115, 97, 108]; + }, + { + kind: "account"; + path: "squadsProposal"; + }, + ]; + }; + }, + { + name: "dao"; + writable: true; + }, + { + name: "squadsMultisig"; + writable: true; + relations: ["dao"]; + }, + { + name: "squadsTransaction"; + docs: [ + "and enforces that it is the transaction PDA for the next transaction index", + ]; + writable: true; + }, + { + name: "squadsProposal"; + docs: [ + "enforces that it is the proposal PDA for the next transaction index", + ]; + writable: true; + }, + { + name: "question"; + relations: ["baseVault", "quoteVault"]; + }, + { + name: "baseVault"; + }, + { + name: "quoteVault"; + }, + { + name: "proposer"; + signer: true; + }, + { + name: "payer"; + writable: true; + signer: true; + }, + { + name: "permissionlessAccount"; + docs: [ + "The Squads-side creator of the vault transaction and proposal, an", + "Initiate | Execute member of every DAO multisig. Its keypair ships in", + "the SDK, so anyone can provide this signature.", + ]; + signer: true; + address: "EP3SoC2SvR3d4c2eXVBvhEMWSr2j3YtoCY3UMiQV7BPD"; + }, + { + name: "squadsProgram"; + address: "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf"; + }, + { + name: "systemProgram"; + address: "11111111111111111111111111111111"; + }, + ]; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { - name: "daoParams"; + name: "args"; type: { - defined: "UpdateDaoParams"; + defined: { + name: "initializeBuybackTokenProposalArgs"; + }; }; }, ]; }, { - name: "setSpendingLimit"; + name: "initializeDao"; + discriminator: [128, 226, 96, 90, 39, 56, 24, 196]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [100, 97, 111]; + }, + { + kind: "account"; + path: "daoCreator"; + }, + { + kind: "arg"; + path: "params.nonce"; + }, + ]; + }; }, { - name: "squadsMultisigVault"; - isMut: false; - isSigner: true; + name: "daoCreator"; + signer: true; }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + name: "payer"; + writable: true; + signer: true; }, { - name: "program"; - isMut: false; - isSigner: false; + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, - ]; - args: [ { - name: "args"; - type: { - defined: "SetSpendingLimitArgs"; - }; + name: "baseMint"; }, - ]; - }, - { - name: "syncSpendingLimit"; - accounts: [ { - name: "dao"; - isMut: true; - isSigner: false; + name: "quoteMint"; }, { name: "squadsMultisig"; - isMut: true; - isSigner: false; - }, - { - name: "spendingLimit"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "account"; + path: "dao"; + }, + ]; + program: { + kind: "account"; + path: "squadsProgram"; + }; + }; }, { - name: "rentPayer"; - isMut: true; - isSigner: true; - docs: [ - "Pays rent when the limit is recreated and receives freed rent when it is removed.", - ]; + name: "squadsMultisigVault"; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "account"; + path: "squadsMultisig"; + }, + { + kind: "const"; + value: [118, 97, 117, 108, 116]; + }, + { + kind: "const"; + value: [0]; + }, + ]; + program: { + kind: "account"; + path: "squadsProgram"; + }; + }; }, { name: "squadsProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; + address: "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf"; }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + name: "squadsProgramConfig"; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "const"; + value: [ + 112, + 114, + 111, + 103, + 114, + 97, + 109, + 95, + 99, + 111, + 110, + 102, + 105, + 103, + ]; + }, + ]; + program: { + kind: "account"; + path: "squadsProgram"; + }; + }; }, { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "resizeDao"; - accounts: [ - { - name: "dao"; - isMut: true; - isSigner: false; + name: "squadsProgramConfigTreasury"; + writable: true; }, { name: "spendingLimit"; - isMut: false; - isSigner: false; - docs: [ - "spending-limit PDA (`create_key` is always the DAO); read-only and may", - "not exist", - ]; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "resizeProposal"; - accounts: [ - { - name: "proposal"; - isMut: true; - isSigner: false; - }, - { - name: "dao"; - isMut: false; - isSigner: false; - docs: [ - "The proposal's DAO, checked against the deserialized proposal in the", - "handler.", - ]; - }, - { - 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; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "account"; + path: "squadsMultisig"; + }, + { + kind: "const"; + value: [ + 115, + 112, + 101, + 110, + 100, + 105, + 110, + 103, + 95, + 108, + 105, + 109, + 105, + 116, + ]; + }, + { + kind: "account"; + path: "dao"; + }, + ]; + program: { + kind: "account"; + path: "squadsProgram"; + }; + }; }, { - name: "ammBaseVault"; - isMut: true; - isSigner: false; + name: "futarchyAmmBaseVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "ammQuoteVault"; - isMut: true; - isSigner: false; + name: "futarchyAmmQuoteVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "user"; - isMut: false; - isSigner: true; + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + name: "associatedTokenProgram"; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "params"; type: { - defined: "SpotSwapParams"; + defined: { + name: "initializeDaoParams"; + }; }; }, ]; }, { - name: "conditionalSwap"; + name: "initializeHostileLiquidateProposal"; + discriminator: [16, 196, 240, 71, 224, 103, 82, 202]; 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: "typedInitializeAccounts"; + accounts: [ + { + name: "proposal"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [112, 114, 111, 112, 111, 115, 97, 108]; + }, + { + kind: "account"; + path: "squadsProposal"; + }, + ]; + }; + }, + { + name: "dao"; + writable: true; + }, + { + name: "squadsMultisig"; + writable: true; + relations: ["dao"]; + }, + { + name: "squadsTransaction"; + docs: [ + "and enforces that it is the transaction PDA for the next transaction index", + ]; + writable: true; + }, + { + name: "squadsProposal"; + docs: [ + "enforces that it is the proposal PDA for the next transaction index", + ]; + writable: true; + }, + { + name: "question"; + relations: ["baseVault", "quoteVault"]; + }, + { + name: "baseVault"; + }, + { + name: "quoteVault"; + }, + { + name: "proposer"; + signer: true; + }, + { + name: "payer"; + writable: true; + signer: true; + }, + { + name: "permissionlessAccount"; + docs: [ + "The Squads-side creator of the vault transaction and proposal, an", + "Initiate | Execute member of every DAO multisig. Its keypair ships in", + "the SDK, so anyone can provide this signature.", + ]; + signer: true; + address: "EP3SoC2SvR3d4c2eXVBvhEMWSr2j3YtoCY3UMiQV7BPD"; + }, + { + name: "squadsProgram"; + address: "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf"; + }, + { + name: "systemProgram"; + address: "11111111111111111111111111111111"; + }, + ]; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { - name: "params"; + name: "args"; type: { - defined: "ConditionalSwapParams"; + defined: { + name: "initializeHostileLiquidateProposalArgs"; + }; }; }, ]; }, { - name: "provideLiquidity"; + name: "initializeHostileTakeoverProposal"; + discriminator: [10, 6, 136, 25, 198, 217, 241, 40]; 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: "typedInitializeAccounts"; + accounts: [ + { + name: "proposal"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [112, 114, 111, 112, 111, 115, 97, 108]; + }, + { + kind: "account"; + path: "squadsProposal"; + }, + ]; + }; + }, + { + name: "dao"; + writable: true; + }, + { + name: "squadsMultisig"; + writable: true; + relations: ["dao"]; + }, + { + name: "squadsTransaction"; + docs: [ + "and enforces that it is the transaction PDA for the next transaction index", + ]; + writable: true; + }, + { + name: "squadsProposal"; + docs: [ + "enforces that it is the proposal PDA for the next transaction index", + ]; + writable: true; + }, + { + name: "question"; + relations: ["baseVault", "quoteVault"]; + }, + { + name: "baseVault"; + }, + { + name: "quoteVault"; + }, + { + name: "proposer"; + signer: true; + }, + { + name: "payer"; + writable: true; + signer: true; + }, + { + name: "permissionlessAccount"; + docs: [ + "The Squads-side creator of the vault transaction and proposal, an", + "Initiate | Execute member of every DAO multisig. Its keypair ships in", + "the SDK, so anyone can provide this signature.", + ]; + signer: true; + address: "EP3SoC2SvR3d4c2eXVBvhEMWSr2j3YtoCY3UMiQV7BPD"; + }, + { + name: "squadsProgram"; + address: "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf"; + }, + { + name: "systemProgram"; + address: "11111111111111111111111111111111"; + }, + ]; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { - name: "params"; + name: "args"; type: { - defined: "ProvideLiquidityParams"; + defined: { + name: "initializeHostileTakeoverProposalArgs"; + }; }; }, ]; }, { - name: "withdrawLiquidity"; + name: "initializeLargeSpendProposal"; + discriminator: [215, 213, 32, 17, 217, 208, 27, 106]; accounts: [ { - name: "dao"; - isMut: true; - isSigner: false; + name: "typedInitializeAccounts"; + accounts: [ + { + name: "proposal"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [112, 114, 111, 112, 111, 115, 97, 108]; + }, + { + kind: "account"; + path: "squadsProposal"; + }, + ]; + }; + }, + { + name: "dao"; + writable: true; + }, + { + name: "squadsMultisig"; + writable: true; + relations: ["dao"]; + }, + { + name: "squadsTransaction"; + docs: [ + "and enforces that it is the transaction PDA for the next transaction index", + ]; + writable: true; + }, + { + name: "squadsProposal"; + docs: [ + "enforces that it is the proposal PDA for the next transaction index", + ]; + writable: true; + }, + { + name: "question"; + relations: ["baseVault", "quoteVault"]; + }, + { + name: "baseVault"; + }, + { + name: "quoteVault"; + }, + { + name: "proposer"; + signer: true; + }, + { + name: "payer"; + writable: true; + signer: true; + }, + { + name: "permissionlessAccount"; + docs: [ + "The Squads-side creator of the vault transaction and proposal, an", + "Initiate | Execute member of every DAO multisig. Its keypair ships in", + "the SDK, so anyone can provide this signature.", + ]; + signer: true; + address: "EP3SoC2SvR3d4c2eXVBvhEMWSr2j3YtoCY3UMiQV7BPD"; + }, + { + name: "squadsProgram"; + address: "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf"; + }, + { + name: "systemProgram"; + address: "11111111111111111111111111111111"; + }, + ]; }, { - name: "positionAuthority"; - isMut: false; - isSigner: true; + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { - name: "liquidityProviderBaseAccount"; - isMut: true; - isSigner: false; + name: "program"; }, + ]; + args: [ { - name: "liquidityProviderQuoteAccount"; - isMut: true; - isSigner: false; + name: "args"; + type: { + defined: { + name: "initializeLargeSpendProposalArgs"; + }; + }; }, + ]; + }, + { + name: "initializeMintTokensProposal"; + discriminator: [15, 181, 2, 221, 93, 107, 219, 13]; + accounts: [ { - name: "ammBaseVault"; - isMut: true; - isSigner: false; + name: "typedInitializeAccounts"; + accounts: [ + { + name: "proposal"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [112, 114, 111, 112, 111, 115, 97, 108]; + }, + { + kind: "account"; + path: "squadsProposal"; + }, + ]; + }; + }, + { + name: "dao"; + writable: true; + }, + { + name: "squadsMultisig"; + writable: true; + relations: ["dao"]; + }, + { + name: "squadsTransaction"; + docs: [ + "and enforces that it is the transaction PDA for the next transaction index", + ]; + writable: true; + }, + { + name: "squadsProposal"; + docs: [ + "enforces that it is the proposal PDA for the next transaction index", + ]; + writable: true; + }, + { + name: "question"; + relations: ["baseVault", "quoteVault"]; + }, + { + name: "baseVault"; + }, + { + name: "quoteVault"; + }, + { + name: "proposer"; + signer: true; + }, + { + name: "payer"; + writable: true; + signer: true; + }, + { + name: "permissionlessAccount"; + docs: [ + "The Squads-side creator of the vault transaction and proposal, an", + "Initiate | Execute member of every DAO multisig. Its keypair ships in", + "the SDK, so anyone can provide this signature.", + ]; + signer: true; + address: "EP3SoC2SvR3d4c2eXVBvhEMWSr2j3YtoCY3UMiQV7BPD"; + }, + { + name: "squadsProgram"; + address: "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf"; + }, + { + name: "systemProgram"; + address: "11111111111111111111111111111111"; + }, + ]; }, { - name: "ammQuoteVault"; - isMut: true; - isSigner: false; + name: "baseMint"; }, { - name: "ammPosition"; - isMut: true; - isSigner: false; + name: "mintGovernor"; + docs: [ + "Only for governed mints (v0.8 launches): the `MintGovernor` holding the", + "base mint's authority.", + ]; + optional: true; }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + name: "mintAuthority"; + docs: [ + "Only for governed mints: the vault's minting rights on `mint_governor`.", + ]; + optional: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { - name: "params"; + name: "args"; type: { - defined: "WithdrawLiquidityParams"; + defined: { + name: "initializeMintTokensProposalArgs"; + }; }; }, ]; }, { - name: "collectFees"; + name: "initializeProposal"; + discriminator: [50, 73, 156, 98, 129, 149, 21, 158]; 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: "proposal"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [112, 114, 111, 112, 111, 115, 97, 108]; + }, + { + kind: "account"; + path: "squadsProposal"; + }, + ]; + }; }, { - name: "ammQuoteVault"; - isMut: true; - isSigner: false; + name: "squadsProposal"; }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + name: "squadsMultisig"; + relations: ["dao"]; }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "sponsorProposal"; - accounts: [ - { - name: "proposal"; - isMut: true; - isSigner: false; + name: "squadsVaultTransaction"; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "account"; + path: "squadsMultisig"; + }, + { + kind: "const"; + value: [116, 114, 97, 110, 115, 97, 99, 116, 105, 111, 110]; + }, + { + kind: "account"; + path: "squads_proposal.transaction_index"; + account: "squadsProposal"; + }, + ]; + program: { + kind: "const"; + value: [ + 6, + 129, + 196, + 206, + 71, + 226, + 35, + 104, + 184, + 177, + 85, + 94, + 200, + 135, + 175, + 9, + 46, + 252, + 126, + 251, + 182, + 108, + 163, + 245, + 47, + 191, + 104, + 212, + 172, + 156, + 183, + 168, + ]; + }; + }; }, { name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "teamAddress"; - isMut: false; - isSigner: true; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; + writable: true; }, { - name: "program"; - isMut: false; - isSigner: false; + name: "question"; + relations: ["quoteVault", "baseVault"]; }, - ]; - args: []; - }, - { - name: "collectMeteoraDammFees"; - accounts: [ { - name: "dao"; - isMut: true; - isSigner: false; + name: "quoteVault"; }, { - name: "admin"; - isMut: true; - isSigner: true; + name: "baseVault"; }, { - name: "squadsMultisig"; - isMut: true; - isSigner: false; + name: "proposer"; + signer: true; }, { - name: "squadsMultisigVault"; - isMut: true; - isSigner: false; + name: "payer"; + writable: true; + signer: true; }, { - name: "squadsMultisigVaultTransaction"; - isMut: true; - isSigner: false; + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, { - name: "squadsMultisigProposal"; - isMut: true; - isSigner: false; + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { - name: "squadsMultisigPermissionlessAccount"; - isMut: false; - isSigner: true; + name: "program"; }, + ]; + args: []; + }, + { + name: "initializeSpendingLimitChangeProposal"; + discriminator: [119, 145, 71, 234, 49, 54, 124, 66]; + accounts: [ { - name: "meteoraClaimPositionFeesAccounts"; + name: "typedInitializeAccounts"; accounts: [ { - name: "dammV2Program"; - isMut: false; - isSigner: false; - }, - { - name: "dammV2EventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "poolAuthority"; - isMut: false; - isSigner: false; + name: "proposal"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [112, 114, 111, 112, 111, 115, 97, 108]; + }, + { + kind: "account"; + path: "squadsProposal"; + }, + ]; + }; }, { - name: "pool"; - isMut: false; - isSigner: false; + name: "dao"; + writable: true; }, { - name: "position"; - isMut: true; - isSigner: false; + name: "squadsMultisig"; + writable: true; + relations: ["dao"]; }, { - name: "tokenAAccount"; - isMut: true; - isSigner: false; - docs: ["Token account of base tokens recipient"]; + name: "squadsTransaction"; + docs: [ + "and enforces that it is the transaction PDA for the next transaction index", + ]; + writable: true; }, { - name: "tokenBAccount"; - isMut: true; - isSigner: false; - docs: ["Token account of quote tokens recipient"]; + name: "squadsProposal"; + docs: [ + "enforces that it is the proposal PDA for the next transaction index", + ]; + writable: true; }, { - name: "tokenAVault"; - isMut: true; - isSigner: false; + name: "question"; + relations: ["baseVault", "quoteVault"]; }, { - name: "tokenBVault"; - isMut: true; - isSigner: false; + name: "baseVault"; }, { - name: "tokenAMint"; - isMut: false; - isSigner: false; + name: "quoteVault"; }, { - name: "tokenBMint"; - isMut: false; - isSigner: false; + name: "proposer"; + signer: true; }, { - name: "positionNftAccount"; - isMut: false; - isSigner: false; + name: "payer"; + writable: true; + signer: true; }, { - name: "owner"; - isMut: false; - isSigner: false; + name: "permissionlessAccount"; + docs: [ + "The Squads-side creator of the vault transaction and proposal, an", + "Initiate | Execute member of every DAO multisig. Its keypair ships in", + "the SDK, so anyone can provide this signature.", + ]; + signer: true; + address: "EP3SoC2SvR3d4c2eXVBvhEMWSr2j3YtoCY3UMiQV7BPD"; }, { - name: "tokenAProgram"; - isMut: false; - isSigner: false; + name: "squadsProgram"; + address: "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf"; }, { - name: "tokenBProgram"; - isMut: false; - isSigner: false; + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, ]; }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "squadsProgram"; - isMut: false; - isSigner: false; - }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "adminEnqueueMultisigProposalApproval"; - accounts: [ - { - name: "dao"; - isMut: false; - isSigner: false; - }, - { - name: "admin"; - isMut: true; - isSigner: true; - }, - { - name: "squadsMultisig"; - isMut: false; - isSigner: false; - }, - { - name: "squadsMultisigProposal"; - isMut: false; - isSigner: false; - }, - { - name: "enqueuedApproval"; - isMut: true; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "args"; type: { - defined: "AdminEnqueueMultisigProposalApprovalArgs"; + defined: { + name: "initializeSpendingLimitChangeProposalArgs"; + }; }; }, ]; }, { - name: "executeMultisigProposalApproval"; + name: "launchProposal"; + discriminator: [16, 211, 189, 119, 245, 72, 0, 229]; accounts: [ { - name: "dao"; - isMut: true; - isSigner: false; + name: "proposal"; + writable: true; }, { - name: "rentReceiver"; - isMut: true; - isSigner: true; + name: "baseVault"; + relations: ["proposal"]; }, { - name: "squadsMultisig"; - isMut: true; - isSigner: false; + name: "quoteVault"; + relations: ["proposal"]; }, { - name: "squadsMultisigProposal"; - isMut: true; - isSigner: false; + name: "passBaseMint"; }, { - name: "enqueuedApproval"; - isMut: true; - isSigner: false; + name: "passQuoteMint"; }, { - name: "squadsMultisigProgram"; - isMut: false; - isSigner: false; + name: "failBaseMint"; }, - ]; - args: []; - }, - { - name: "adminEnqueueMultisigProposalCancellation"; - accounts: [ { - name: "dao"; - isMut: false; - isSigner: false; + name: "failQuoteMint"; }, { - name: "admin"; - isMut: true; - isSigner: true; + name: "dao"; + writable: true; + relations: ["proposal"]; }, { - name: "squadsMultisig"; - isMut: false; - isSigner: false; + name: "payer"; + writable: true; + signer: true; }, { - name: "squadsMultisigProposal"; - isMut: false; - isSigner: false; + name: "ammPassBaseVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "passBaseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "enqueuedCancellation"; - isMut: true; - isSigner: false; + name: "ammPassQuoteVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "passQuoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "systemProgram"; - isMut: false; - isSigner: false; + name: "ammFailBaseVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "failBaseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, - ]; - args: [ { - name: "args"; - type: { - defined: "AdminEnqueueMultisigProposalCancellationArgs"; + name: "ammFailQuoteVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "failQuoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; }; }, - ]; - }, - { - name: "executeMultisigProposalCancellation"; - accounts: [ { - name: "dao"; - isMut: true; - isSigner: false; + name: "squadsMultisig"; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "account"; + path: "dao"; + }, + ]; + program: { + kind: "const"; + value: [ + 6, + 129, + 196, + 206, + 71, + 226, + 35, + 104, + 184, + 177, + 85, + 94, + 200, + 135, + 175, + 9, + 46, + 252, + 126, + 251, + 182, + 108, + 163, + 245, + 47, + 191, + 104, + 212, + 172, + 156, + 183, + 168, + ]; + }; + }; + relations: ["dao"]; }, { - name: "rentReceiver"; - isMut: true; - isSigner: true; + name: "squadsProposal"; + relations: ["proposal"]; }, { - name: "squadsMultisig"; - isMut: true; - isSigner: false; + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, { - name: "squadsMultisigProposal"; - isMut: true; - isSigner: false; - }, - { - name: "enqueuedCancellation"; - isMut: true; - isSigner: false; - }, - { - name: "squadsMultisigProgram"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "adminExecuteMultisigProposal"; - accounts: [ - { - name: "dao"; - isMut: true; - isSigner: false; - }, - { - name: "admin"; - isMut: true; - isSigner: true; - }, - { - name: "squadsMultisig"; - isMut: true; - isSigner: false; + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { - name: "squadsMultisigProposal"; - isMut: true; - isSigner: false; + name: "associatedTokenProgram"; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { - name: "squadsMultisigVaultTransaction"; - isMut: true; - isSigner: false; + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { - name: "squadsMultisigProgram"; - isMut: false; - isSigner: false; + name: "program"; }, ]; args: []; }, { - name: "adminCancelProposal"; + name: "provideLiquidity"; + discriminator: [40, 110, 107, 116, 174, 127, 97, 204]; accounts: [ - { - name: "proposal"; - isMut: true; - isSigner: false; - }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { - name: "question"; - isMut: true; - isSigner: false; + name: "liquidityProvider"; + signer: true; }, { - name: "squadsProposal"; - isMut: true; - isSigner: false; + name: "liquidityProviderBaseAccount"; + writable: true; }, { - name: "squadsMultisig"; - isMut: false; - isSigner: false; + name: "liquidityProviderQuoteAccount"; + writable: true; }, { - name: "squadsMultisigProgram"; - isMut: false; - isSigner: false; + name: "payer"; + writable: true; + signer: true; }, { - name: "ammPassBaseVault"; - isMut: true; - isSigner: false; + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, { - name: "ammPassQuoteVault"; - isMut: true; - isSigner: false; + name: "ammBaseVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "dao.base_mint"; + account: "dao"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "ammFailBaseVault"; - isMut: true; - isSigner: false; + name: "ammQuoteVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "dao.quote_mint"; + account: "dao"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "ammFailQuoteVault"; - isMut: true; - isSigner: false; + name: "ammPosition"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 97, + 109, + 109, + 95, + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110, + ]; + }, + { + kind: "account"; + path: "dao"; + }, + { + kind: "arg"; + path: "params.position_authority"; + }, + ]; + }; }, { - name: "ammBaseVault"; - isMut: true; - isSigner: false; + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { - name: "ammQuoteVault"; - isMut: true; - isSigner: false; + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { - name: "vaultProgram"; - isMut: false; - isSigner: false; + name: "program"; }, + ]; + args: [ { - name: "vaultEventAuthority"; - isMut: false; - isSigner: false; + name: "params"; + type: { + defined: { + name: "provideLiquidityParams"; + }; + }; }, + ]; + }, + { + name: "resizeDao"; + discriminator: [142, 52, 68, 81, 113, 14, 90, 40]; + accounts: [ { - name: "tokenProgram"; - isMut: false; - isSigner: false; + name: "dao"; + writable: true; }, { - name: "quoteVault"; - isMut: true; - isSigner: false; + name: "spendingLimit"; + docs: [ + "spending-limit PDA (`create_key` is always the DAO); read-only and may", + "not exist", + ]; }, { - name: "quoteVaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + name: "payer"; + writable: true; + signer: true; }, { - name: "passQuoteMint"; - isMut: true; - isSigner: false; + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, + ]; + args: []; + }, + { + name: "resizeProposal"; + discriminator: [40, 213, 88, 206, 213, 184, 30, 181]; + accounts: [ { - name: "failQuoteMint"; - isMut: true; - isSigner: false; + name: "proposal"; + writable: true; }, { - name: "passBaseMint"; - isMut: true; - isSigner: false; + name: "dao"; + docs: [ + "The proposal's DAO, checked against the deserialized proposal in the", + "handler.", + ]; }, { - name: "failBaseMint"; - isMut: true; - isSigner: false; + name: "payer"; + writable: true; + signer: true; }, { - name: "baseVault"; - isMut: true; - isSigner: false; + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, + ]; + args: []; + }, + { + name: "setSpendingLimit"; + discriminator: [39, 48, 237, 161, 49, 171, 155, 208]; + accounts: [ { - name: "baseVaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + name: "dao"; + writable: true; }, { - name: "admin"; - isMut: false; - isSigner: true; + name: "squadsMultisigVault"; + signer: true; + relations: ["dao"]; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; - args: []; + args: [ + { + name: "args"; + type: { + defined: { + name: "setSpendingLimitArgs"; + }; + }; + }, + ]; }, { - name: "adminRemoveProposal"; + name: "sponsorProposal"; + discriminator: [193, 57, 170, 136, 101, 196, 58, 173]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; + relations: ["proposal"]; }, { - name: "admin"; - isMut: true; - isSigner: true; + name: "teamAddress"; + signer: true; + relations: ["dao"]; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { - name: "adminUpdateProposalParams"; + name: "spotSwap"; + discriminator: [167, 97, 12, 231, 237, 78, 166, 251]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { - name: "proposal"; - isMut: true; - isSigner: false; + name: "userBaseAccount"; + writable: true; }, { - name: "admin"; - isMut: false; - isSigner: true; + name: "userQuoteAccount"; + writable: true; + }, + { + name: "ammBaseVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "dao.base_mint"; + account: "dao"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; + }, + { + name: "ammQuoteVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "dao.quote_mint"; + account: "dao"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; + }, + { + name: "user"; + signer: true; + }, + { + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { - name: "args"; + name: "params"; type: { - defined: "AdminUpdateProposalParamsArgs"; + defined: { + name: "spotSwapParams"; + }; }; }, ]; }, - ]; - 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"; - docs: [ - "The authoritative record of what the Squads spending limit should be.", - "`None` = no limit. Kept in sync with the Squads-side account by", - "`sync_spending_limit`. (Named for its original init-only role)", - ]; - 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"; - docs: ["Deprecated in favor of typed proposals"]; - type: { - option: { - defined: "OptimisticProposal"; - }; - }; - }, - { - name: "isOptimisticGovernanceEnabled"; - docs: ["Deprecated in favor of typed proposals"]; - type: "bool"; - }, - { - name: "liquidator"; - docs: [ - "`Some` means the DAO has been liquidated, and holds who runs the estate.", - "Set once by `finalize_proposal` the moment a hostile liquidation", - "passes, never cleared.", - ]; - type: { - option: "publicKey"; - }; - }, - { - name: "lastFailedTakeoverAt"; - docs: ["Unix time of the last failed hostile takeover. 0 = never."]; - type: "i64"; - }, - { - name: "lastFailedLiquidationAt"; - docs: [ - "Unix time of the last failed hostile liquidation. 0 = never.", - ]; - type: "i64"; - }, - { - name: "spendingLimitDirty"; - docs: [ - "Set by every write to the spending-limit record (`initial_spending_limit`),", - "consumed by `sync_spending_limit`.", - ]; - type: "bool"; - }, - { - name: "lastBuybackFinalizedAt"; - docs: ["Unix time of the last buyback finalization. 0 = never."]; - type: "i64"; - }, - { - name: "typedProposalsEnabled"; - docs: [ - "Whether the DAO runs on the mini-instructions catalog. Never turns off.", - ]; - 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: "optimisticProposal"; - type: { - option: { - defined: "OptimisticProposal"; - }; - }; - }, - { - name: "isOptimisticGovernanceEnabled"; - type: "bool"; - }, - ]; - }; - }, - { - name: "enqueuedMultisigProposalApproval"; - type: { - kind: "struct"; - fields: [ - { - name: "dao"; - type: "publicKey"; - }, - { - name: "transactionIndex"; - type: "u64"; - }, - { - name: "pdaBump"; - type: "u8"; - }, - ]; - }; - }, - { - name: "enqueuedMultisigProposalCancellation"; - type: { - kind: "struct"; - fields: [ - { - name: "dao"; - type: "publicKey"; - }, - { - name: "transactionIndex"; - type: "u64"; - }, - { - name: "pdaBump"; - type: "u8"; - }, - ]; - }; - }, - { - 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: "sponsoredBy"; - docs: [ - "The team that last sponsored the proposal. `None` = never sponsored.", - ]; - type: { - option: "publicKey"; - }; - }, - { - name: "passThresholdBps"; - type: "i16"; - }, - { - name: "councilCanBlock"; - docs: ["Snapshot of the kind's blockable flag at create."]; - type: "bool"; - }, - { - name: "action"; - docs: ["The typed action parameters."]; - type: { - defined: "ProposalAction"; - }; - }, - { - name: "paramsOverridden"; - docs: [ - "Set by `admin_update_proposal_params`. `launch_proposal` then leaves the", - "duration and threshold alone.", - ]; - type: "bool"; - }, - ]; - }; - }, - { - name: "oldProposal"; - 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: "AdminEnqueueMultisigProposalApprovalArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "transactionIndex"; - type: "u64"; - }, - ]; - }; - }, - { - name: "AdminEnqueueMultisigProposalCancellationArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "transactionIndex"; - type: "u64"; - }, - ]; - }; - }, - { - name: "AdminUpdateProposalParamsArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "durationInSeconds"; - type: { - option: "u32"; - }; - }, - { - name: "passThresholdBps"; - type: { - option: "i16"; - }; - }, - ]; - }; - }, - { - 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: "InitializeBuybackTokenProposalArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "quoteAmount"; - type: "u64"; - }, - { - name: "cycleCount"; - type: "u32"; - }, - { - name: "cycleFrequencySeconds"; - type: "u32"; - }, - { - name: "startDelaySeconds"; - type: "u32"; - }, - { - name: "minPrice"; - type: { - option: "u64"; - }; - }, - { - name: "maxPrice"; - type: { - option: "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: "InitializeHostileLiquidateProposalArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "liquidator"; - type: "publicKey"; - }, - ]; - }; - }, - { - name: "InitializeHostileTakeoverProposalArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "newTeamAddress"; - type: "publicKey"; - }, - { - name: "spendingLimitAction"; - type: { - defined: "SpendingLimitAction"; - }; - }, - ]; - }; - }, - { - name: "InitializeLargeSpendProposalArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "amount"; - type: "u64"; - }, - ]; - }; - }, - { - name: "InitializeMintTokensProposalArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "amount"; - type: "u64"; - }, - { - name: "recipient"; - type: "publicKey"; - }, - ]; - }; - }, - { - name: "InitializeSpendingLimitChangeProposalArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "config"; - docs: ["`Some` replaces the record, `None` removes it."]; - type: { - option: { - defined: "InitialSpendingLimit"; - }; - }; - }, - ]; - }; - }, - { - 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: "SetSpendingLimitArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "config"; - docs: [ - "`Some` becomes the new record verbatim; `None` deletes it.", - ]; - type: { - option: { - defined: "InitialSpendingLimit"; - }; - }; - }, - ]; - }; - }, - { - 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: "deprecatedIsOptimisticGovernanceEnabled"; - docs: [ - "Ignored. The retired optimistic-governance flag, kept in place so", - "payloads encoded before the upgrade are refused, not reinterpreted.", - ]; - type: { - option: "bool"; - }; - }, - { - name: "typedProposalsEnabled"; - docs: [ - "`Some(true)` turns typed proposals on for this DAO. `None` leaves them", - "as they are. `Some(false)` is refused: there is no way to turn them off.", - ]; - 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 seconds_since_last_update * last_observation.", - "", - "Assuming latest observations are as big as possible (u64::MAX * 1e12),", - "we can store 18 million seconds worth of observations, which turns out to", - "be ~213 days.", - "", - "Assuming that latest observations are 100x smaller than they could theoretically", - "be, we can store ~57 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.", - "", - "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: "InstructionParams"; - type: { - kind: "struct"; - fields: [ - { - name: "durationSeconds"; - type: "u32"; - }, - { - name: "passThresholdBps"; - docs: [ - "Signed: a negative threshold lets a proposal pass even when the pass", - "price is below the fail price.", - ]; - type: "i16"; - }, - { - name: "teamSponsorshipPolicy"; - docs: ["Sponsorship policy"]; - type: { - defined: "TeamSponsorshipPolicy"; - }; - }, - { - name: "councilCanBlock"; - type: "bool"; - }, - { - name: "cooldownSeconds"; - docs: ["Cooldown checked at launch. 0 = none."]; - type: "u32"; - }, - { - name: "twapStartDelaySeconds"; - docs: ["Delay before the conditional TWAPs start to accumulate"]; - type: "u32"; - }, - ]; - }; - }, - { - 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: "TeamSponsorshipPolicy"; - type: { - kind: "enum"; - variants: [ - { - name: "Required"; - }, - { - name: "Optional"; - }, - { - name: "Forbidden"; - }, - ]; - }; - }, - { - name: "SpendingLimitAction"; - docs: ["What a hostile takeover declares for the spending limit."]; - type: { - kind: "enum"; - variants: [ - { - name: "Keep"; - }, - { - name: "Remove"; - }, - { - name: "Set"; - fields: [ - { - defined: "InitialSpendingLimit"; - }, - ]; - }, - ]; - }; - }, - { - name: "ProposalAction"; - docs: [ - "The typed action parameters, stored on the proposal. The borsh variant tag", - "is the proposal's kind discriminator, so variants are append-only — the", - "variant index is the wire tag.", - ]; - type: { - kind: "enum"; - variants: [ - { - name: "LargeSpend"; - fields: [ - { - name: "amount"; - type: "u64"; - }, - { - name: "teamAddress"; - docs: [ - "The team the baked transfer pays, snapshotted at create. Launch", - "requires it to still be the DAO's team.", - ]; - type: "publicKey"; - }, - ]; - }, - { - name: "MintTokens"; - fields: [ - { - name: "amount"; - type: "u64"; - }, - { - name: "recipient"; - type: "publicKey"; - }, - ]; - }, - { - name: "SpendingLimitChange"; - fields: [ - { - name: "config"; - type: { - option: { - defined: "InitialSpendingLimit"; - }; - }; - }, - ]; - }, - { - name: "ExecuteArbitrary"; - }, - { - name: "HostileTakeover"; - fields: [ - { - name: "newTeamAddress"; - docs: [ - "The team to install. Launch requires it to still differ from the", - "DAO's team.", - ]; - type: "publicKey"; - }, - { - name: "spendingLimitAction"; - type: { - defined: "SpendingLimitAction"; - }; - }, - ]; - }, - { - name: "HostileLiquidate"; - fields: [ - { - name: "liquidator"; - type: "publicKey"; - }, - ]; - }, - { - name: "BuybackToken"; - fields: [ - { - name: "quoteAmount"; - docs: ["Total quote to deploy. Capped at 25% of the treasury."]; - type: "u64"; - }, - { - name: "cycleCount"; - docs: ["Orders the total is split across. At least 2."]; - type: "u32"; - }, - { - name: "cycleFrequencySeconds"; - docs: ["Seconds between orders."]; - type: "u32"; - }, - { - name: "startDelaySeconds"; - docs: [ - "Seconds after execution before the first order. 0 = immediately.", - ]; - type: "u32"; - }, - { - name: "minPrice"; - docs: [ - "Optional price band, in quote native units per whole base token:", - "1_600_000 = 1.6 USDC per token.", - "`None` = unguarded.", - ]; - type: { - option: "u64"; - }; - }, - { - name: "maxPrice"; - type: { - option: "u64"; - }; - }, - ]; - }, - ]; - }; - }, - { - name: "ProposalState"; - type: { - kind: "enum"; - variants: [ - { - name: "Draft"; - fields: [ - { - name: "amountStaked"; - type: "u64"; - }, - ]; - }, - { - name: "Pending"; - }, - { - name: "Passed"; - }, - { - name: "Failed"; - }, - { - name: "Removed"; - }, - ]; - }; - }, - ]; - 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: "typedProposalsEnabled"; - type: "bool"; - 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: "typedProposalsEnabled"; - 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: "action"; - type: { - defined: "ProposalAction"; - }; - 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: "durationInSeconds"; - type: "u32"; - index: false; - }, - { - name: "passThresholdBps"; - type: "i16"; - index: false; - }, - { - name: "isTeamSponsored"; - type: "bool"; - index: false; - }, - ]; - }, - { - name: "FinalizeProposalEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, + name: "stakeToProposal"; + discriminator: [10, 169, 175, 238, 80, 221, 37, 16]; + accounts: [ { 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; + writable: true; }, { 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; + writable: true; }, { - name: "swapType"; - type: { - defined: "SwapType"; + name: "stakerBaseAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "staker"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "dao.base_mint"; + account: "dao"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; }; - 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"; + name: "proposalBaseAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "proposal"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "dao.base_mint"; + account: "dao"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; }; - index: false; }, - ]; - }, - { - name: "ProvideLiquidityEvent"; - fields: [ { - name: "common"; - type: { - defined: "CommonFields"; + name: "stakeAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [115, 116, 97, 107, 101]; + }, + { + kind: "account"; + path: "proposal"; + }, + { + kind: "account"; + path: "staker"; + }, + ]; }; - index: false; }, { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "liquidityProvider"; - type: "publicKey"; - index: false; + name: "staker"; + signer: true; }, { - name: "positionAuthority"; - type: "publicKey"; - index: false; + name: "payer"; + writable: true; + signer: true; }, { - name: "quoteAmount"; - type: "u64"; - index: false; + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { - name: "baseAmount"; - type: "u64"; - index: false; + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, { - name: "liquidityMinted"; - type: "u128"; - index: false; + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { - name: "minLiquidity"; - type: "u128"; - index: false; + name: "program"; }, + ]; + args: [ { - name: "postAmmState"; + name: "params"; type: { - defined: "FutarchyAmm"; + defined: { + name: "stakeToProposalParams"; + }; }; - index: false; }, ]; }, { - name: "WithdrawLiquidityEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, + name: "syncSpendingLimit"; + discriminator: [24, 110, 161, 237, 185, 161, 169, 141]; + accounts: [ { name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "liquidityProvider"; - type: "publicKey"; - index: false; - }, - { - name: "liquidityWithdrawn"; - type: "u128"; - index: false; + writable: true; }, { - name: "minBaseAmount"; - type: "u64"; - index: false; + name: "squadsMultisig"; + writable: true; + relations: ["dao"]; }, { - name: "minQuoteAmount"; - type: "u64"; - index: false; + name: "spendingLimit"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "account"; + path: "squadsMultisig"; + }, + { + kind: "const"; + value: [ + 115, + 112, + 101, + 110, + 100, + 105, + 110, + 103, + 95, + 108, + 105, + 109, + 105, + 116, + ]; + }, + { + kind: "account"; + path: "dao"; + }, + ]; + program: { + kind: "account"; + path: "squadsProgram"; + }; + }; }, { - name: "baseAmount"; - type: "u64"; - index: false; + name: "rentPayer"; + docs: [ + "Pays rent when the limit is recreated and receives freed rent when it is removed.", + ]; + writable: true; + signer: true; }, { - name: "quoteAmount"; - type: "u64"; - index: false; + name: "squadsProgram"; + address: "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf"; }, { - name: "postAmmState"; - type: { - defined: "FutarchyAmm"; - }; - index: false; + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, - ]; - }, - { - name: "SponsorProposalEvent"; - fields: [ { - name: "common"; - type: { - defined: "CommonFields"; + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; }; - index: false; - }, - { - name: "proposal"; - type: "publicKey"; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; }, { - name: "teamAddress"; - type: "publicKey"; - index: false; + name: "program"; }, ]; + args: []; }, { - name: "RemoveProposalEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, + name: "unstakeFromProposal"; + discriminator: [179, 220, 186, 86, 2, 96, 50, 161]; + accounts: [ { name: "proposal"; - type: "publicKey"; - index: false; + writable: true; }, { name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "admin"; - type: "publicKey"; - index: false; + writable: true; + relations: ["proposal"]; }, - ]; - }, - { - name: "AdminUpdateProposalParamsEvent"; - fields: [ { - name: "common"; - type: { - defined: "CommonFields"; + name: "stakerBaseAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "staker"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; }; - index: false; }, { - name: "dao"; - type: "publicKey"; - index: false; + name: "proposalBaseAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "proposal"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "proposal"; - type: "publicKey"; - index: false; + name: "stakeAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [115, 116, 97, 107, 101]; + }, + { + kind: "account"; + path: "proposal"; + }, + { + kind: "account"; + path: "staker"; + }, + ]; + }; }, { - name: "admin"; - type: "publicKey"; - index: false; + name: "baseMint"; + relations: ["dao"]; }, { - name: "oldDurationInSeconds"; - type: "u32"; - index: false; + name: "staker"; + writable: true; + signer: true; }, { - name: "newDurationInSeconds"; - type: "u32"; - index: false; + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { - name: "oldPassThresholdBps"; - type: "i16"; - index: false; + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, { - name: "newPassThresholdBps"; - type: "i16"; - index: false; + name: "associatedTokenProgram"; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, - ]; - }, - { - name: "AdminCancelProposalEvent"; - fields: [ { - name: "common"; - type: { - defined: "CommonFields"; + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; }; - index: false; - }, - { - name: "proposal"; - type: "publicKey"; - index: false; }, { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "admin"; - type: "publicKey"; - index: false; + name: "program"; }, + ]; + args: [ { - name: "postAmmState"; + name: "params"; type: { - defined: "FutarchyAmm"; + defined: { + name: "unstakeFromProposalParams"; + }; }; - index: false; }, ]; }, { - name: "CollectMeteoraDammFeesEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, + name: "updateDao"; + discriminator: [131, 72, 75, 25, 112, 210, 109, 2]; + accounts: [ { 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; + writable: true; }, { - name: "baseMint"; - type: "publicKey"; - index: false; + name: "squadsMultisigVault"; + signer: true; + relations: ["dao"]; }, { - name: "quoteFeesCollected"; - type: "u64"; - index: false; + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { - name: "baseFeesCollected"; - type: "u64"; - index: false; + name: "program"; }, ]; - }, - { - name: "AdminFixPositionAuthorityEvent"; - fields: [ + args: [ { - name: "common"; + name: "daoParams"; type: { - defined: "CommonFields"; + defined: { + name: "updateDaoParams"; + }; }; - index: false; }, + ]; + }, + { + name: "withdrawLiquidity"; + discriminator: [149, 158, 33, 185, 47, 243, 253, 31]; + accounts: [ { name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "admin"; - type: "publicKey"; - index: false; + writable: true; + relations: ["ammPosition"]; }, { - name: "ammPosition"; - type: "publicKey"; - index: false; + name: "positionAuthority"; + signer: true; + relations: ["ammPosition"]; }, { - name: "oldAuthority"; - type: "publicKey"; - index: false; + name: "liquidityProviderBaseAccount"; + writable: true; }, { - name: "newAuthority"; - type: "publicKey"; - index: false; + name: "liquidityProviderQuoteAccount"; + writable: true; }, - ]; - }, - { - name: "SetSpendingLimitEvent"; - fields: [ { - name: "common"; - type: { - defined: "CommonFields"; + name: "ammBaseVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "dao.base_mint"; + account: "dao"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; }; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; }, { - name: "config"; - type: { - option: { - defined: "InitialSpendingLimit"; + name: "ammQuoteVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "dao"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "dao.quote_mint"; + account: "dao"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; }; }; - index: false; }, - ]; - }, - { - name: "SyncSpendingLimitEvent"; - fields: [ { - name: "common"; - type: { - defined: "CommonFields"; + name: "ammPosition"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 97, + 109, + 109, + 95, + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110, + ]; + }, + { + kind: "account"; + path: "dao"; + }, + { + kind: "account"; + path: "positionAuthority"; + }, + ]; }; - index: false; }, { - name: "dao"; - type: "publicKey"; - index: false; + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; + }, + { + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { - name: "spendingLimit"; - type: "publicKey"; - index: false; + name: "program"; }, + ]; + args: [ { - name: "config"; + name: "params"; type: { - option: { - defined: "InitialSpendingLimit"; + defined: { + name: "withdrawLiquidityParams"; }; }; - index: false; }, ]; }, ]; + accounts: [ + { + name: "ammPosition"; + discriminator: [34, 97, 105, 74, 17, 226, 212, 0]; + }, + { + name: "conditionalVault"; + discriminator: [63, 132, 87, 98, 36, 51, 175, 247]; + }, + { + name: "dao"; + discriminator: [163, 9, 47, 31, 52, 85, 197, 49]; + }, + { + name: "enqueuedMultisigProposalApproval"; + discriminator: [172, 225, 237, 72, 8, 241, 28, 124]; + }, + { + name: "enqueuedMultisigProposalCancellation"; + discriminator: [18, 48, 13, 143, 11, 244, 203, 114]; + }, + { + name: "mintAuthority"; + discriminator: [148, 0, 219, 228, 254, 237, 76, 128]; + }, + { + name: "mintGovernor"; + discriminator: [110, 173, 19, 114, 217, 193, 37, 71]; + }, + { + name: "proposal"; + discriminator: [26, 94, 189, 187, 116, 136, 53, 33]; + }, + { + name: "question"; + discriminator: [111, 22, 150, 220, 181, 122, 118, 127]; + }, + { + name: "stakeAccount"; + discriminator: [80, 158, 67, 124, 50, 189, 192, 255]; + }, + ]; + events: [ + { + name: "adminCancelProposalEvent"; + discriminator: [118, 2, 87, 75, 91, 217, 71, 124]; + }, + { + name: "adminFixPositionAuthorityEvent"; + discriminator: [174, 79, 62, 1, 150, 182, 236, 147]; + }, + { + name: "adminUpdateProposalParamsEvent"; + discriminator: [20, 195, 243, 106, 255, 93, 238, 187]; + }, + { + name: "collectFeesEvent"; + discriminator: [226, 2, 53, 67, 132, 158, 125, 173]; + }, + { + name: "collectMeteoraDammFeesEvent"; + discriminator: [193, 114, 225, 241, 209, 213, 175, 85]; + }, + { + name: "conditionalSwapEvent"; + discriminator: [2, 166, 200, 160, 94, 212, 68, 45]; + }, + { + name: "finalizeProposalEvent"; + discriminator: [45, 29, 122, 181, 79, 224, 57, 141]; + }, + { + name: "initializeDaoEvent"; + discriminator: [119, 48, 153, 116, 127, 37, 226, 228]; + }, + { + name: "initializeProposalEvent"; + discriminator: [141, 56, 246, 192, 168, 254, 64, 111]; + }, + { + name: "launchProposalEvent"; + discriminator: [177, 55, 191, 93, 203, 124, 184, 11]; + }, + { + name: "provideLiquidityEvent"; + discriminator: [38, 2, 37, 238, 229, 214, 255, 235]; + }, + { + name: "removeProposalEvent"; + discriminator: [135, 152, 254, 224, 208, 81, 197, 215]; + }, + { + name: "setSpendingLimitEvent"; + discriminator: [242, 139, 252, 83, 95, 147, 15, 58]; + }, + { + name: "sponsorProposalEvent"; + discriminator: [202, 190, 250, 176, 79, 235, 77, 194]; + }, + { + name: "spotSwapEvent"; + discriminator: [29, 253, 121, 255, 82, 60, 148, 195]; + }, + { + name: "stakeToProposalEvent"; + discriminator: [94, 69, 68, 151, 90, 149, 240, 191]; + }, + { + name: "syncSpendingLimitEvent"; + discriminator: [155, 35, 236, 84, 219, 60, 115, 167]; + }, + { + name: "unstakeFromProposalEvent"; + discriminator: [89, 129, 63, 211, 55, 33, 194, 171]; + }, + { + name: "updateDaoEvent"; + discriminator: [12, 58, 244, 224, 171, 25, 33, 56]; + }, + { + name: "withdrawLiquidityEvent"; + discriminator: [214, 6, 161, 45, 191, 142, 124, 186]; + }, + ]; errors: [ { code: 6000; - name: "AmmTooOld"; + name: "ammTooOld"; msg: "Amms must have been created within 5 minutes (counted in slots) of proposal initialization"; }, { code: 6001; - name: "InvalidInitialObservation"; + name: "invalidInitialObservation"; msg: "An amm has an `initial_observation` that doesn't match the `dao`'s config"; }, { code: 6002; - name: "InvalidMaxObservationChange"; + name: "invalidMaxObservationChange"; msg: "An amm has a `max_observation_change_per_update` that doesn't match the `dao`'s config"; }, { code: 6003; - name: "InvalidStartDelaySlots"; + name: "invalidStartDelaySlots"; msg: "An amm has a `start_delay_slots` that doesn't match the `dao`'s config"; }, { code: 6004; - name: "InvalidSettlementAuthority"; + name: "invalidSettlementAuthority"; msg: "One of the vaults has an invalid `settlement_authority`"; }, { code: 6005; - name: "ProposalTooYoung"; + name: "proposalTooYoung"; msg: "Proposal is too young to be executed or rejected"; }, { code: 6006; - name: "MarketsTooYoung"; + name: "marketsTooYoung"; msg: "Markets too young for proposal to be finalized. TWAP might need to be cranked"; }, { code: 6007; - name: "ProposalAlreadyFinalized"; + name: "proposalAlreadyFinalized"; msg: "This proposal has already been finalized"; }, { code: 6008; - name: "InvalidVaultNonce"; + name: "invalidVaultNonce"; msg: "A conditional vault has an invalid nonce. A nonce should encode the proposal number"; }, { code: 6009; - name: "ProposalNotPassed"; + name: "proposalNotPassed"; msg: "This proposal can't be executed because it isn't in the passed state"; }, { code: 6010; - name: "InsufficientLiquidity"; + name: "insufficientLiquidity"; msg: "More liquidity needs to be in the AMM to launch this proposal"; }, { code: 6011; - name: "ProposalDurationTooShort"; + name: "proposalDurationTooShort"; msg: "Proposal duration must be longer 1 day and longer than 2 times the TWAP start delay"; }, { code: 6012; - name: "PassThresholdTooHigh"; + name: "passThresholdTooHigh"; msg: "Pass threshold must be less than 10%"; }, { code: 6013; - name: "QuestionMustBeBinary"; + name: "questionMustBeBinary"; msg: "Question must have exactly 2 outcomes for binary futarchy"; }, { code: 6014; - name: "InvalidSquadsProposalStatus"; + name: "invalidSquadsProposalStatus"; msg: "Squads proposal must be in Active status"; }, { code: 6015; - name: "CastingOverflow"; + name: "castingOverflow"; msg: "Casting overflow. If you're seeing this, please report this"; }, { code: 6016; - name: "InsufficientBalance"; + name: "insufficientBalance"; msg: "Insufficient balance"; }, { code: 6017; - name: "ZeroLiquidityRemove"; + name: "zeroLiquidityRemove"; msg: "Cannot remove zero liquidity"; }, { code: 6018; - name: "SwapSlippageExceeded"; + name: "swapSlippageExceeded"; msg: "Swap slippage exceeded"; }, { code: 6019; - name: "AssertFailed"; + name: "assertFailed"; msg: "Assert failed"; }, { code: 6020; - name: "InvalidAdmin"; + name: "invalidAdmin"; msg: "Invalid admin"; }, { code: 6021; - name: "ProposalNotInDraftState"; + name: "proposalNotInDraftState"; msg: "Proposal is not in draft state"; }, { code: 6022; - name: "InsufficientTokenBalance"; + name: "insufficientTokenBalance"; msg: "Insufficient token balance"; }, { code: 6023; - name: "InvalidAmount"; + name: "invalidAmount"; msg: "Invalid amount"; }, { code: 6024; - name: "InsufficientStakeToLaunch"; + name: "insufficientStakeToLaunch"; msg: "Insufficient stake to launch proposal"; }, { code: 6025; - name: "StakerNotFound"; + name: "stakerNotFound"; msg: "Staker not found in proposal"; }, { code: 6026; - name: "PoolNotInSpotState"; + name: "poolNotInSpotState"; msg: "Pool must be in spot state"; }, { code: 6027; - name: "InvalidDaoCreateLiquidity"; + name: "invalidDaoCreateLiquidity"; msg: "If you're providing liquidity, you must provide both base and quote token accounts"; }, { code: 6028; - name: "InvalidStakeAccount"; + name: "invalidStakeAccount"; msg: "Invalid stake account"; }, { code: 6029; - name: "InvariantViolated"; + name: "invariantViolated"; msg: "An invariant was violated. You should get in contact with the MetaDAO team if you see this"; }, { code: 6030; - name: "ProposalNotActive"; + name: "proposalNotActive"; msg: "Proposal needs to be active to perform a conditional swap"; }, { code: 6031; - name: "InvalidTransaction"; + name: "invalidTransaction"; msg: "This Squads transaction should only contain calls to update spending limits"; }, { code: 6032; - name: "ProposalAlreadySponsored"; + name: "proposalAlreadySponsored"; msg: "Proposal has already been sponsored"; }, { code: 6033; - name: "InvalidTeamSponsoredPassThreshold"; + name: "invalidTeamSponsoredPassThreshold"; msg: "Team sponsored pass threshold must be between -10% and 10%"; }, { code: 6034; - name: "InvalidTargetK"; + name: "invalidTargetK"; msg: "Target K must be greater than the current K"; }, { code: 6035; - name: "InvalidTransactionMessage"; + name: "invalidTransactionMessage"; msg: "Failed to compile transaction message for Squads vault transaction"; }, { code: 6036; - name: "InvalidMint"; + name: "invalidMint"; msg: "Base mint and quote mint must be different"; }, { code: 6037; - name: "ProposalNotReadyToUnstake"; + name: "proposalNotReadyToUnstake"; msg: "Proposal is not ready to be unstaked"; }, { code: 6038; - name: "OptimisticGovernanceDisabled"; + name: "optimisticGovernanceDisabled"; msg: "Optimistic governance is disabled"; }, { code: 6039; - name: "ActiveOptimisticProposalAlreadyEnqueued"; + name: "activeOptimisticProposalAlreadyEnqueued"; msg: "An active optimistic proposal is already enqueued"; }, { code: 6040; - name: "OptimisticProposalAlreadyPassed"; + name: "optimisticProposalAlreadyPassed"; msg: "Optimistic proposal has already passed"; }, { code: 6041; - name: "InvalidSpendingLimitMint"; + name: "invalidSpendingLimitMint"; msg: "Invalid spending limit mint. Must be the same as the DAO's quote mint"; }, { code: 6042; - name: "NoActiveOptimisticProposal"; + name: "noActiveOptimisticProposal"; msg: "No active optimistic proposal"; }, { code: 6043; - name: "DaoLiquidated"; + name: "daoLiquidated"; msg: "This DAO has been liquidated"; }, { - code: 6044; - name: "ProposalKindCooldownActive"; - msg: "A proposal of this kind finalized recently, so the cooldown must elapse first"; - }, - { - code: 6045; - name: "NoSpendingLimit"; - msg: "The DAO has no spending limit"; - }, - { - code: 6046; - name: "SpendCapExceeded"; - msg: "Amount exceeds the cap of 3x the monthly spending limit"; - }, - { - code: 6047; - name: "UnknownMintAuthority"; - msg: "The base mint's authority is neither the treasury vault nor a mint governor"; - }, - { - code: 6048; - name: "ProposalNotTeamSponsored"; - msg: "This proposal kind must be team-sponsored before it can launch"; - }, - { - code: 6049; - name: "SpendingLimitNotDirty"; - msg: "The spending limit record hasn't changed, so there is nothing to sync"; - }, - { - code: 6050; - name: "InvalidProposalKind"; - msg: "Wrong proposal kind for this instruction"; - }, - { - code: 6051; - name: "TooManySpendingLimitMembers"; - msg: "A spending limit can have at most 10 members"; - }, - { - code: 6052; - name: "InvalidLiquidator"; - msg: "Invalid liquidator"; - }, - { - code: 6053; - name: "InvalidProposalPassThreshold"; - msg: "Pass threshold must be between -99.99% and 99.99%"; - }, - { - code: 6054; - name: "EmptyProposalParamsUpdate"; - msg: "A proposal params update must set at least one field"; - }, - { - code: 6055; - name: "BuybackCapExceeded"; - msg: "Buyback amount exceeds 25% of the treasury"; - }, - { - code: 6056; - name: "InvalidBuybackAmount"; - msg: "Buyback total must be non-zero"; - }, - { - code: 6057; - name: "InvalidBuybackCycleFrequency"; - msg: "Cycle frequency must be between 60 seconds and 1 year"; - }, - { - code: 6058; - name: "InvalidBuybackStartDelay"; - msg: "Start delay must be at most 30 days"; - }, - { - code: 6059; - name: "InvalidBuybackPriceBand"; - msg: "min_price must be no greater than max_price"; - }, - { - code: 6060; - name: "InvalidTreasuryAccount"; - msg: "A treasury account is neither a vault-owned quote account nor the treasury's AMM position"; - }, - { - code: 6061; - name: "TreasuryAccountsNotSorted"; - msg: "Treasury accounts must be in strictly ascending key order"; - }, - { - code: 6062; - name: "UnexpectedLaunchAccounts"; - msg: "This proposal kind's launch takes no extra accounts"; - }, - { - code: 6063; - name: "InvalidSpendingLimitAccount"; - msg: "Spending limit account is not the canonical spending-limit PDA"; - }, - { - code: 6064; - name: "StaleTeamAddress"; - msg: "The DAO's team has changed since this draft was created"; - }, - { - code: 6065; - name: "AccountNotMigrated"; - msg: "Account is not migrated to latest layout"; - }, - { - code: 6066; - name: "InvalidSpendingLimitAmount"; - msg: "A spending limit's monthly amount must be non-zero"; - }, - { - code: 6067; - name: "EmptySpendingLimitMembers"; - msg: "A spending limit must have at least one member"; - }, - { - code: 6068; - name: "DuplicateSpendingLimitMember"; - msg: "A spending limit's members must be unique"; - }, - { - code: 6069; - name: "InvalidBuybackCycleCount"; - msg: "A buyback must run at least two cycles"; - }, - { - code: 6070; - name: "InvalidTeamAddress"; - msg: "Invalid team address"; - }, - { - code: 6071; - name: "TeamSponsorshipForbidden"; - msg: "This proposal kind cannot be team-sponsored"; - }, - { - code: 6072; - name: "SquadsProposalNotApproved"; - msg: "Squads proposal must be in Approved status to be cancelled"; - }, - { - code: 6073; - name: "TypedProposalsDisabled"; - msg: "This DAO has not opted into typed proposals"; - }, - { - code: 6074; - name: "TypedProposalsCannotBeDisabled"; - msg: "Typed proposals cannot be disabled"; - }, - { - code: 6075; - name: "UnfrozenAddressLookupTable"; - msg: "Address lookup tables referenced by the vault transaction must be frozen"; - }, - { - code: 6076; - name: "InvalidAddressLookupTable"; - msg: "Lookup table accounts must match the vault transaction's address table lookups"; - }, - { - code: 6077; - name: "InvalidSquadsVaultTransaction"; - msg: "Expected the proposal's Squads vault transaction as the first launch account"; - }, - ]; -}; - -export const IDL: Futarchy = { - version: "0.6.2", - 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", - }, - }, - ], + code: 6044; + name: "proposalKindCooldownActive"; + msg: "A proposal of this kind finalized recently, so the cooldown must elapse first"; }, { - name: "initializeProposal", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "squadsProposal", - isMut: false, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: false, - isSigner: false, - }, - { - name: "squadsVaultTransaction", - 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: [], + code: 6045; + name: "noSpendingLimit"; + msg: "The DAO has no spending limit"; }, { - name: "initializeLargeSpendProposal", - accounts: [ - { - name: "typedInitializeAccounts", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "squadsTransaction", - isMut: true, - isSigner: false, - docs: [ - "and enforces that it is the transaction PDA for the next transaction index", - ], - }, - { - name: "squadsProposal", - isMut: true, - isSigner: false, - docs: [ - "enforces that it is the proposal PDA for the next transaction index", - ], - }, - { - name: "question", - isMut: false, - isSigner: false, - }, - { - name: "baseVault", - isMut: false, - isSigner: false, - }, - { - name: "quoteVault", - isMut: false, - isSigner: false, - }, - { - name: "proposer", - isMut: false, - isSigner: true, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "permissionlessAccount", - isMut: false, - isSigner: true, - docs: [ - "The Squads-side creator of the vault transaction and proposal, an", - "Initiate | Execute member of every DAO multisig. Its keypair ships in", - "the SDK, so anyone can provide this signature.", - ], - }, - { - name: "squadsProgram", - 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: "InitializeLargeSpendProposalArgs", - }, - }, - ], + code: 6046; + name: "spendCapExceeded"; + msg: "Amount exceeds the cap of 3x the monthly spending limit"; }, { - name: "initializeMintTokensProposal", - accounts: [ - { - name: "typedInitializeAccounts", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "squadsTransaction", - isMut: true, - isSigner: false, - docs: [ - "and enforces that it is the transaction PDA for the next transaction index", - ], - }, - { - name: "squadsProposal", - isMut: true, - isSigner: false, - docs: [ - "enforces that it is the proposal PDA for the next transaction index", - ], - }, - { - name: "question", - isMut: false, - isSigner: false, - }, - { - name: "baseVault", - isMut: false, - isSigner: false, - }, - { - name: "quoteVault", - isMut: false, - isSigner: false, - }, - { - name: "proposer", - isMut: false, - isSigner: true, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "permissionlessAccount", - isMut: false, - isSigner: true, - docs: [ - "The Squads-side creator of the vault transaction and proposal, an", - "Initiate | Execute member of every DAO multisig. Its keypair ships in", - "the SDK, so anyone can provide this signature.", - ], - }, - { - name: "squadsProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - ], - }, - { - name: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "mintGovernor", - isMut: false, - isSigner: false, - isOptional: true, - docs: [ - "Only for governed mints (v0.8 launches): the `MintGovernor` holding the", - "base mint's authority.", - ], - }, - { - name: "mintAuthority", - isMut: false, - isSigner: false, - isOptional: true, - docs: [ - "Only for governed mints: the vault's minting rights on `mint_governor`.", - ], - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "InitializeMintTokensProposalArgs", - }, - }, - ], + code: 6047; + name: "unknownMintAuthority"; + msg: "The base mint's authority is neither the treasury vault nor a mint governor"; }, { - name: "initializeSpendingLimitChangeProposal", - accounts: [ - { - name: "typedInitializeAccounts", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "squadsTransaction", - isMut: true, - isSigner: false, - docs: [ - "and enforces that it is the transaction PDA for the next transaction index", - ], - }, - { - name: "squadsProposal", - isMut: true, - isSigner: false, - docs: [ - "enforces that it is the proposal PDA for the next transaction index", - ], - }, - { - name: "question", - isMut: false, - isSigner: false, - }, - { - name: "baseVault", - isMut: false, - isSigner: false, - }, - { - name: "quoteVault", - isMut: false, - isSigner: false, - }, - { - name: "proposer", - isMut: false, - isSigner: true, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "permissionlessAccount", - isMut: false, - isSigner: true, - docs: [ - "The Squads-side creator of the vault transaction and proposal, an", - "Initiate | Execute member of every DAO multisig. Its keypair ships in", - "the SDK, so anyone can provide this signature.", - ], - }, - { - name: "squadsProgram", - 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: "InitializeSpendingLimitChangeProposalArgs", - }, - }, - ], + code: 6048; + name: "proposalNotTeamSponsored"; + msg: "This proposal kind must be team-sponsored before it can launch"; }, { - name: "initializeHostileTakeoverProposal", - accounts: [ - { - name: "typedInitializeAccounts", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "squadsTransaction", - isMut: true, - isSigner: false, - docs: [ - "and enforces that it is the transaction PDA for the next transaction index", - ], - }, - { - name: "squadsProposal", - isMut: true, - isSigner: false, - docs: [ - "enforces that it is the proposal PDA for the next transaction index", - ], - }, - { - name: "question", - isMut: false, - isSigner: false, - }, - { - name: "baseVault", - isMut: false, - isSigner: false, - }, - { - name: "quoteVault", - isMut: false, - isSigner: false, - }, - { - name: "proposer", - isMut: false, - isSigner: true, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "permissionlessAccount", - isMut: false, - isSigner: true, - docs: [ - "The Squads-side creator of the vault transaction and proposal, an", - "Initiate | Execute member of every DAO multisig. Its keypair ships in", - "the SDK, so anyone can provide this signature.", - ], - }, - { - name: "squadsProgram", - 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: "InitializeHostileTakeoverProposalArgs", - }, - }, - ], + code: 6049; + name: "spendingLimitNotDirty"; + msg: "The spending limit record hasn't changed, so there is nothing to sync"; + }, + { + code: 6050; + name: "invalidProposalKind"; + msg: "Wrong proposal kind for this instruction"; + }, + { + code: 6051; + name: "tooManySpendingLimitMembers"; + msg: "A spending limit can have at most 10 members"; + }, + { + code: 6052; + name: "invalidLiquidator"; + msg: "Invalid liquidator"; + }, + { + code: 6053; + name: "invalidProposalPassThreshold"; + msg: "Pass threshold must be between -99.99% and 99.99%"; + }, + { + code: 6054; + name: "emptyProposalParamsUpdate"; + msg: "A proposal params update must set at least one field"; }, { - name: "initializeHostileLiquidateProposal", - accounts: [ - { - name: "typedInitializeAccounts", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "squadsTransaction", - isMut: true, - isSigner: false, - docs: [ - "and enforces that it is the transaction PDA for the next transaction index", - ], - }, - { - name: "squadsProposal", - isMut: true, - isSigner: false, - docs: [ - "enforces that it is the proposal PDA for the next transaction index", - ], - }, - { - name: "question", - isMut: false, - isSigner: false, - }, - { - name: "baseVault", - isMut: false, - isSigner: false, - }, - { - name: "quoteVault", - isMut: false, - isSigner: false, - }, - { - name: "proposer", - isMut: false, - isSigner: true, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "permissionlessAccount", - isMut: false, - isSigner: true, - docs: [ - "The Squads-side creator of the vault transaction and proposal, an", - "Initiate | Execute member of every DAO multisig. Its keypair ships in", - "the SDK, so anyone can provide this signature.", - ], - }, - { - name: "squadsProgram", - 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: "InitializeHostileLiquidateProposalArgs", - }, - }, - ], + code: 6055; + name: "buybackCapExceeded"; + msg: "Buyback amount exceeds 25% of the treasury"; }, { - name: "initializeBuybackTokenProposal", - accounts: [ - { - name: "typedInitializeAccounts", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "squadsTransaction", - isMut: true, - isSigner: false, - docs: [ - "and enforces that it is the transaction PDA for the next transaction index", - ], - }, - { - name: "squadsProposal", - isMut: true, - isSigner: false, - docs: [ - "enforces that it is the proposal PDA for the next transaction index", - ], - }, - { - name: "question", - isMut: false, - isSigner: false, - }, - { - name: "baseVault", - isMut: false, - isSigner: false, - }, - { - name: "quoteVault", - isMut: false, - isSigner: false, - }, - { - name: "proposer", - isMut: false, - isSigner: true, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "permissionlessAccount", - isMut: false, - isSigner: true, - docs: [ - "The Squads-side creator of the vault transaction and proposal, an", - "Initiate | Execute member of every DAO multisig. Its keypair ships in", - "the SDK, so anyone can provide this signature.", - ], - }, - { - name: "squadsProgram", - 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: "InitializeBuybackTokenProposalArgs", - }, - }, - ], + code: 6056; + name: "invalidBuybackAmount"; + msg: "Buyback total must be non-zero"; }, { - 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: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "StakeToProposalParams", - }, - }, - ], + code: 6057; + name: "invalidBuybackCycleFrequency"; + msg: "Cycle frequency must be between 60 seconds and 1 year"; }, { - 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: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "staker", - 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: "UnstakeFromProposalParams", - }, - }, - ], + code: 6058; + name: "invalidBuybackStartDelay"; + msg: "Start delay must be at most 30 days"; }, { - 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: [], + code: 6059; + name: "invalidBuybackPriceBand"; + msg: "min_price must be no greater than max_price"; }, { - 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: [], + code: 6060; + name: "invalidTreasuryAccount"; + msg: "A treasury account is neither a vault-owned quote account nor the treasury's AMM position"; }, { - 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", - }, - }, - ], + code: 6061; + name: "treasuryAccountsNotSorted"; + msg: "Treasury accounts must be in strictly ascending key order"; }, { - name: "setSpendingLimit", - 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: "args", - type: { - defined: "SetSpendingLimitArgs", - }, - }, - ], + code: 6062; + name: "unexpectedLaunchAccounts"; + msg: "This proposal kind's launch takes no extra accounts"; }, { - name: "syncSpendingLimit", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "spendingLimit", - isMut: true, - isSigner: false, - }, - { - name: "rentPayer", - isMut: true, - isSigner: true, - docs: [ - "Pays rent when the limit is recreated and receives freed rent when it is removed.", - ], - }, - { - name: "squadsProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], + code: 6063; + name: "invalidSpendingLimitAccount"; + msg: "Spending limit account is not the canonical spending-limit PDA"; }, { - name: "resizeDao", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "spendingLimit", - isMut: false, - isSigner: false, - docs: [ - "spending-limit PDA (`create_key` is always the DAO); read-only and may", - "not exist", - ], - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - ], - args: [], + code: 6064; + name: "staleTeamAddress"; + msg: "The DAO's team has changed since this draft was created"; }, { - name: "resizeProposal", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: false, - isSigner: false, - docs: [ - "The proposal's DAO, checked against the deserialized proposal in the", - "handler.", - ], - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - ], - args: [], + code: 6065; + name: "accountNotMigrated"; + msg: "Account is not migrated to latest layout"; }, { - 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", - }, - }, - ], + code: 6066; + name: "invalidSpendingLimitAmount"; + msg: "A spending limit's monthly amount must be non-zero"; }, { - 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", - }, - }, - ], + code: 6067; + name: "emptySpendingLimitMembers"; + msg: "A spending limit must have at least one member"; }, { - 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", - }, - }, - ], + code: 6068; + name: "duplicateSpendingLimitMember"; + msg: "A spending limit's members must be unique"; }, { - 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", - }, - }, - ], + code: 6069; + name: "invalidBuybackCycleCount"; + msg: "A buyback must run at least two cycles"; }, { - 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: [], + code: 6070; + name: "invalidTeamAddress"; + msg: "Invalid team address"; + }, + { + code: 6071; + name: "teamSponsorshipForbidden"; + msg: "This proposal kind cannot be team-sponsored"; + }, + { + code: 6072; + name: "squadsProposalNotApproved"; + msg: "Squads proposal must be in Approved status to be cancelled"; }, { - 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: [], + code: 6073; + name: "typedProposalsDisabled"; + msg: "This DAO has not opted into typed proposals"; }, { - name: "collectMeteoraDammFees", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "admin", - isMut: true, - isSigner: true, - }, - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigVault", - isMut: true, - 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: [], + code: 6074; + name: "typedProposalsCannotBeDisabled"; + msg: "Typed proposals cannot be disabled"; }, { - name: "adminEnqueueMultisigProposalApproval", - accounts: [ - { - name: "dao", - isMut: false, - isSigner: false, - }, - { - name: "admin", - isMut: true, - isSigner: true, - }, - { - name: "squadsMultisig", - isMut: false, - isSigner: false, - }, - { - name: "squadsMultisigProposal", - isMut: false, - isSigner: false, - }, - { - name: "enqueuedApproval", - isMut: true, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "AdminEnqueueMultisigProposalApprovalArgs", - }, - }, - ], + code: 6075; + name: "unfrozenAddressLookupTable"; + msg: "Address lookup tables referenced by the vault transaction must be frozen"; }, { - name: "executeMultisigProposalApproval", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "rentReceiver", - isMut: true, - isSigner: true, - }, - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigProposal", - isMut: true, - isSigner: false, - }, - { - name: "enqueuedApproval", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigProgram", - isMut: false, - isSigner: false, - }, - ], - args: [], + code: 6076; + name: "invalidAddressLookupTable"; + msg: "Lookup table accounts must match the vault transaction's address table lookups"; }, { - name: "adminEnqueueMultisigProposalCancellation", - accounts: [ - { - name: "dao", - isMut: false, - isSigner: false, - }, - { - name: "admin", - isMut: true, - isSigner: true, - }, - { - name: "squadsMultisig", - isMut: false, - isSigner: false, - }, - { - name: "squadsMultisigProposal", - isMut: false, - isSigner: false, - }, - { - name: "enqueuedCancellation", - isMut: true, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "AdminEnqueueMultisigProposalCancellationArgs", + code: 6077; + name: "invalidSquadsVaultTransaction"; + msg: "Expected the proposal's Squads vault transaction as the first launch account"; + }, + ]; + types: [ + { + name: "adminCancelProposalEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, - }, - ], + { + name: "proposal"; + type: "pubkey"; + }, + { + name: "dao"; + type: "pubkey"; + }, + { + name: "admin"; + type: "pubkey"; + }, + { + name: "postAmmState"; + type: { + defined: { + name: "futarchyAmm"; + }; + }; + }, + ]; + }; }, { - name: "executeMultisigProposalCancellation", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "rentReceiver", - isMut: true, - isSigner: true, - }, - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigProposal", - isMut: true, - isSigner: false, - }, - { - name: "enqueuedCancellation", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigProgram", - isMut: false, - isSigner: false, - }, - ], - args: [], + name: "adminEnqueueMultisigProposalApprovalArgs"; + type: { + kind: "struct"; + fields: [ + { + name: "transactionIndex"; + type: "u64"; + }, + ]; + }; }, { - name: "adminExecuteMultisigProposal", - 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, - }, - ], - args: [], + name: "adminEnqueueMultisigProposalCancellationArgs"; + type: { + kind: "struct"; + fields: [ + { + name: "transactionIndex"; + type: "u64"; + }, + ]; + }; }, { - name: "adminCancelProposal", - 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: "admin", - isMut: false, - isSigner: true, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], + name: "adminFixPositionAuthorityEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "dao"; + type: "pubkey"; + }, + { + name: "admin"; + type: "pubkey"; + }, + { + name: "ammPosition"; + type: "pubkey"; + }, + { + name: "oldAuthority"; + type: "pubkey"; + }, + { + name: "newAuthority"; + type: "pubkey"; + }, + ]; + }; }, { - name: "adminRemoveProposal", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "admin", - isMut: true, - isSigner: true, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], + name: "adminUpdateProposalParamsArgs"; + type: { + kind: "struct"; + fields: [ + { + name: "durationInSeconds"; + type: { + option: "u32"; + }; + }, + { + name: "passThresholdBps"; + type: { + option: "i16"; + }; + }, + ]; + }; }, { - name: "adminUpdateProposalParams", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "admin", - isMut: false, - isSigner: true, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "AdminUpdateProposalParamsArgs", + name: "adminUpdateProposalParamsEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, - }, - ], + { + name: "dao"; + type: "pubkey"; + }, + { + name: "proposal"; + type: "pubkey"; + }, + { + name: "admin"; + type: "pubkey"; + }, + { + name: "oldDurationInSeconds"; + type: "u32"; + }, + { + name: "newDurationInSeconds"; + type: "u32"; + }, + { + name: "oldPassThresholdBps"; + type: "i16"; + }, + { + name: "newPassThresholdBps"; + type: "i16"; + }, + ]; + }; }, - ], - accounts: [ { - name: "ammPosition", + name: "ammPosition"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "dao", - type: "publicKey", + name: "dao"; + type: "pubkey"; }, { - name: "positionAuthority", - type: "publicKey", + name: "positionAuthority"; + type: "pubkey"; }, { - name: "liquidity", - type: "u128", + name: "liquidity"; + type: "u128"; }, - ], - }, + ]; + }; }, { - name: "dao", + name: "collectFeesEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "amm", - docs: ["Embedded FutarchyAmm - 1:1 relationship"], + name: "common"; type: { - defined: "FutarchyAmm", - }, + defined: { + name: "commonFields"; + }; + }; }, { - name: "nonce", - docs: ["`nonce` + `dao_creator` are PDA seeds"], - type: "u64", + name: "dao"; + type: "pubkey"; }, { - name: "daoCreator", - type: "publicKey", + name: "baseTokenAccount"; + type: "pubkey"; }, { - name: "pdaBump", - type: "u8", + name: "quoteTokenAccount"; + type: "pubkey"; }, { - name: "squadsMultisig", - type: "publicKey", + name: "ammBaseVault"; + type: "pubkey"; }, { - name: "squadsMultisigVault", - type: "publicKey", + name: "ammQuoteVault"; + type: "pubkey"; }, { - name: "baseMint", - type: "publicKey", + name: "quoteMint"; + type: "pubkey"; }, { - name: "quoteMint", - type: "publicKey", + name: "baseMint"; + type: "pubkey"; }, { - name: "proposalCount", - type: "u32", + name: "quoteFeesCollected"; + type: "u64"; }, { - name: "passThresholdBps", - type: "u16", + name: "baseFeesCollected"; + type: "u64"; }, { - name: "secondsPerProposal", - type: "u32", + name: "postAmmState"; + type: { + defined: { + name: "futarchyAmm"; + }; + }; }, + ]; + }; + }, + { + name: "collectMeteoraDammFeesEvent"; + type: { + kind: "struct"; + fields: [ { - 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: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "twapMaxObservationChangePerUpdate", - type: "u128", + name: "dao"; + type: "pubkey"; }, { - name: "twapStartDelaySeconds", - docs: [ - "Forces TWAP calculation to start after `twap_start_delay_seconds` seconds", - ], - type: "u32", + name: "pool"; + type: "pubkey"; }, { - 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: "baseTokenAccount"; + type: "pubkey"; }, { - name: "minBaseFutarchicLiquidity", - type: "u64", + name: "quoteTokenAccount"; + type: "pubkey"; }, { - name: "baseToStake", - docs: [ - "Minimum amount of base tokens that must be staked to launch a proposal", - ], - type: "u64", + name: "quoteMint"; + type: "pubkey"; }, { - name: "seqNum", - type: "u64", + name: "baseMint"; + type: "pubkey"; }, { - name: "initialSpendingLimit", - docs: [ - "The authoritative record of what the Squads spending limit should be.", - "`None` = no limit. Kept in sync with the Squads-side account by", - "`sync_spending_limit`. (Named for its original init-only role)", - ], + name: "quoteFeesCollected"; + type: "u64"; + }, + { + name: "baseFeesCollected"; + type: "u64"; + }, + ]; + }; + }, + { + name: "commonFields"; + type: { + kind: "struct"; + fields: [ + { + name: "slot"; + type: "u64"; + }, + { + name: "unixTimestamp"; + type: "i64"; + }, + { + name: "daoSeqNum"; + type: "u64"; + }, + ]; + }; + }, + { + name: "conditionalSwapEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; type: { - option: { - defined: "InitialSpendingLimit", - }, - }, + defined: { + name: "commonFields"; + }; + }; }, { - 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: "dao"; + type: "pubkey"; }, { - name: "teamAddress", - type: "publicKey", + name: "proposal"; + type: "pubkey"; + }, + { + name: "trader"; + type: "pubkey"; }, { - name: "optimisticProposal", - docs: ["Deprecated in favor of typed proposals"], + name: "market"; type: { - option: { - defined: "OptimisticProposal", - }, - }, + defined: { + name: "market"; + }; + }; + }, + { + name: "swapType"; + type: { + defined: { + name: "swapType"; + }; + }; + }, + { + name: "inputAmount"; + type: "u64"; + }, + { + name: "outputAmount"; + type: "u64"; + }, + { + name: "minOutputAmount"; + type: "u64"; + }, + { + name: "postAmmState"; + type: { + defined: { + name: "futarchyAmm"; + }; + }; + }, + ]; + }; + }, + { + name: "conditionalSwapParams"; + type: { + kind: "struct"; + fields: [ + { + name: "market"; + type: { + defined: { + name: "market"; + }; + }; }, { - name: "isOptimisticGovernanceEnabled", - docs: ["Deprecated in favor of typed proposals"], - type: "bool", + name: "swapType"; + type: { + defined: { + name: "swapType"; + }; + }; + }, + { + name: "inputAmount"; + type: "u64"; + }, + { + name: "minOutputAmount"; + type: "u64"; + }, + ]; + }; + }, + { + name: "conditionalVault"; + type: { + kind: "struct"; + fields: [ + { + name: "question"; + type: "pubkey"; }, { - name: "liquidator", - docs: [ - "`Some` means the DAO has been liquidated, and holds who runs the estate.", - "Set once by `finalize_proposal` the moment a hostile liquidation", - "passes, never cleared.", - ], - type: { - option: "publicKey", - }, + name: "underlyingTokenMint"; + type: "pubkey"; }, { - name: "lastFailedTakeoverAt", - docs: ["Unix time of the last failed hostile takeover. 0 = never."], - type: "i64", + name: "underlyingTokenAccount"; + type: "pubkey"; }, { - name: "lastFailedLiquidationAt", - docs: [ - "Unix time of the last failed hostile liquidation. 0 = never.", - ], - type: "i64", + name: "conditionalTokenMints"; + type: { + vec: "pubkey"; + }; }, { - name: "spendingLimitDirty", - docs: [ - "Set by every write to the spending-limit record (`initial_spending_limit`),", - "consumed by `sync_spending_limit`.", - ], - type: "bool", + name: "pdaBump"; + type: "u8"; }, { - name: "lastBuybackFinalizedAt", - docs: ["Unix time of the last buyback finalization. 0 = never."], - type: "i64", + name: "decimals"; + type: "u8"; }, { - name: "typedProposalsEnabled", - docs: [ - "Whether the DAO runs on the mini-instructions catalog. Never turns off.", - ], - type: "bool", + name: "seqNum"; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "oldDao", + name: "dao"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "amm", - docs: ["Embedded FutarchyAmm - 1:1 relationship"], + name: "amm"; + docs: ["Embedded FutarchyAmm - 1:1 relationship"]; type: { - defined: "FutarchyAmm", - }, + defined: { + name: "futarchyAmm"; + }; + }; }, { - name: "nonce", - docs: ["`nonce` + `dao_creator` are PDA seeds"], - type: "u64", + name: "nonce"; + docs: ["`nonce` + `dao_creator` are PDA seeds"]; + type: "u64"; }, { - name: "daoCreator", - type: "publicKey", + name: "daoCreator"; + type: "pubkey"; }, { - name: "pdaBump", - type: "u8", + name: "pdaBump"; + type: "u8"; }, { - name: "squadsMultisig", - type: "publicKey", + name: "squadsMultisig"; + type: "pubkey"; }, { - name: "squadsMultisigVault", - type: "publicKey", + name: "squadsMultisigVault"; + type: "pubkey"; }, { - name: "baseMint", - type: "publicKey", + name: "baseMint"; + type: "pubkey"; }, { - name: "quoteMint", - type: "publicKey", + name: "quoteMint"; + type: "pubkey"; }, { - name: "proposalCount", - type: "u32", + name: "proposalCount"; + type: "u32"; }, { - name: "passThresholdBps", - type: "u16", + name: "passThresholdBps"; + type: "u16"; }, { - name: "secondsPerProposal", - type: "u32", + name: "secondsPerProposal"; + type: "u32"; }, { - name: "twapInitialObservation", + 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", @@ -7958,22 +8479,22 @@ export const IDL: Futarchy = { "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", + ]; + type: "u128"; }, { - name: "twapMaxObservationChangePerUpdate", - type: "u128", + name: "twapMaxObservationChangePerUpdate"; + type: "u128"; }, { - name: "twapStartDelaySeconds", + name: "twapStartDelaySeconds"; docs: [ "Forces TWAP calculation to start after `twap_start_delay_seconds` seconds", - ], - type: "u32", + ]; + type: "u32"; }, { - name: "minQuoteFutarchicLiquidity", + 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.", @@ -7981,2679 +8502,1925 @@ export const IDL: Futarchy = { "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", + ]; + type: "u64"; }, { - name: "minBaseFutarchicLiquidity", - type: "u64", + name: "minBaseFutarchicLiquidity"; + type: "u64"; }, { - name: "baseToStake", + name: "baseToStake"; docs: [ "Minimum amount of base tokens that must be staked to launch a proposal", - ], - type: "u64", + ]; + type: "u64"; }, { - name: "seqNum", - type: "u64", + name: "seqNum"; + type: "u64"; }, { - name: "initialSpendingLimit", + name: "initialSpendingLimit"; + docs: [ + "The authoritative record of what the Squads spending limit should be.", + "`None` = no limit. Kept in sync with the Squads-side account by", + "`sync_spending_limit`. (Named for its original init-only role)", + ]; type: { option: { - defined: "InitialSpendingLimit", - }, - }, + defined: { + name: "initialSpendingLimit"; + }; + }; + }; }, { - name: "teamSponsoredPassThresholdBps", + 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", + ]; + type: "i16"; }, { - name: "teamAddress", - type: "publicKey", + name: "teamAddress"; + type: "pubkey"; }, { - name: "optimisticProposal", + name: "optimisticProposal"; + docs: ["Deprecated in favor of typed proposals"]; type: { option: { - defined: "OptimisticProposal", - }, - }, + defined: { + name: "optimisticProposal"; + }; + }; + }; }, { - name: "isOptimisticGovernanceEnabled", - type: "bool", + name: "isOptimisticGovernanceEnabled"; + docs: ["Deprecated in favor of typed proposals"]; + type: "bool"; }, - ], - }, - }, - { - name: "enqueuedMultisigProposalApproval", - type: { - kind: "struct", - fields: [ { - name: "dao", - type: "publicKey", + name: "liquidator"; + docs: [ + "`Some` means the DAO has been liquidated, and holds who runs the estate.", + "Set once by `finalize_proposal` the moment a hostile liquidation", + "passes, never cleared.", + ]; + type: { + option: "pubkey"; + }; }, { - name: "transactionIndex", - type: "u64", + name: "lastFailedTakeoverAt"; + docs: ["Unix time of the last failed hostile takeover. 0 = never."]; + type: "i64"; }, { - name: "pdaBump", - type: "u8", + name: "lastFailedLiquidationAt"; + docs: [ + "Unix time of the last failed hostile liquidation. 0 = never.", + ]; + type: "i64"; }, - ], - }, - }, - { - name: "enqueuedMultisigProposalCancellation", - type: { - kind: "struct", - fields: [ { - name: "dao", - type: "publicKey", + name: "spendingLimitDirty"; + docs: [ + "Set by every write to the spending-limit record (`initial_spending_limit`),", + "consumed by `sync_spending_limit`.", + ]; + type: "bool"; }, { - name: "transactionIndex", - type: "u64", + name: "lastBuybackFinalizedAt"; + docs: ["Unix time of the last buyback finalization. 0 = never."]; + type: "i64"; }, { - name: "pdaBump", - type: "u8", + name: "typedProposalsEnabled"; + docs: [ + "Whether the DAO runs on the mini-instructions catalog. Never turns off.", + ]; + type: "bool"; }, - ], - }, + ]; + }; }, { - name: "proposal", + name: "enqueuedMultisigProposalApproval"; type: { - kind: "struct", + 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: "sponsoredBy", - docs: [ - "The team that last sponsored the proposal. `None` = never sponsored.", - ], - type: { - option: "publicKey", - }, - }, - { - name: "passThresholdBps", - type: "i16", - }, - { - name: "councilCanBlock", - docs: ["Snapshot of the kind's blockable flag at create."], - type: "bool", + name: "dao"; + type: "pubkey"; }, { - name: "action", - docs: ["The typed action parameters."], - type: { - defined: "ProposalAction", - }, + name: "transactionIndex"; + type: "u64"; }, { - name: "paramsOverridden", - docs: [ - "Set by `admin_update_proposal_params`. `launch_proposal` then leaves the", - "duration and threshold alone.", - ], - type: "bool", + name: "pdaBump"; + type: "u8"; }, - ], - }, + ]; + }; }, { - name: "oldProposal", + name: "enqueuedMultisigProposalCancellation"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "number", - type: "u32", + name: "dao"; + type: "pubkey"; }, { - name: "proposer", - type: "publicKey", + name: "transactionIndex"; + type: "u64"; }, { - name: "timestampEnqueued", - type: "i64", + name: "pdaBump"; + type: "u8"; }, + ]; + }; + }, + { + name: "finalizeProposalEvent"; + type: { + kind: "struct"; + fields: [ { - name: "state", + name: "common"; type: { - defined: "ProposalState", - }, - }, - { - name: "baseVault", - type: "publicKey", - }, - { - name: "quoteVault", - type: "publicKey", + defined: { + name: "commonFields"; + }; + }; }, { - name: "dao", - type: "publicKey", + name: "proposal"; + type: "pubkey"; }, { - name: "pdaBump", - type: "u8", + name: "dao"; + type: "pubkey"; }, { - name: "question", - type: "publicKey", + name: "passMarketTwap"; + type: "u128"; }, { - name: "durationInSeconds", - type: "u32", + name: "failMarketTwap"; + type: "u128"; }, { - name: "squadsProposal", - type: "publicKey", + name: "threshold"; + type: "u128"; }, { - name: "passBaseMint", - type: "publicKey", + name: "state"; + type: { + defined: { + name: "proposalState"; + }; + }; }, { - name: "passQuoteMint", - type: "publicKey", + name: "squadsProposal"; + type: "pubkey"; }, { - name: "failBaseMint", - type: "publicKey", + name: "squadsMultisig"; + type: "pubkey"; }, { - name: "failQuoteMint", - type: "publicKey", + name: "postAmmState"; + type: { + defined: { + name: "futarchyAmm"; + }; + }; }, { - name: "isTeamSponsored", - type: "bool", + name: "isTeamSponsored"; + type: "bool"; }, - ], - }, + ]; + }; }, { - name: "stakeAccount", + name: "futarchyAmm"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "proposal", - type: "publicKey", - }, - { - name: "staker", - type: "publicKey", - }, - { - name: "amount", - type: "u64", - }, - { - name: "bump", - type: "u8", + name: "state"; + type: { + defined: { + name: "poolState"; + }; + }; }, - ], - }, - }, - ], - types: [ - { - name: "CommonFields", - type: { - kind: "struct", - fields: [ { - name: "slot", - type: "u64", + name: "totalLiquidity"; + type: "u128"; }, { - name: "unixTimestamp", - type: "i64", + name: "baseMint"; + type: "pubkey"; }, { - name: "daoSeqNum", - type: "u64", + name: "quoteMint"; + type: "pubkey"; }, - ], - }, - }, - { - name: "AdminEnqueueMultisigProposalApprovalArgs", - type: { - kind: "struct", - fields: [ { - name: "transactionIndex", - type: "u64", - }, - ], - }, - }, - { - name: "AdminEnqueueMultisigProposalCancellationArgs", - type: { - kind: "struct", - fields: [ + name: "ammBaseVault"; + type: "pubkey"; + }, { - name: "transactionIndex", - type: "u64", + name: "ammQuoteVault"; + type: "pubkey"; }, - ], - }, + ]; + }; }, { - name: "AdminUpdateProposalParamsArgs", + name: "initialSpendingLimit"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "durationInSeconds", - type: { - option: "u32", - }, + name: "amountPerMonth"; + type: "u64"; }, { - name: "passThresholdBps", + name: "members"; type: { - option: "i16", - }, + vec: "pubkey"; + }; }, - ], - }, + ]; + }; }, { - name: "ConditionalSwapParams", + name: "initializeBuybackTokenProposalArgs"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "market", - type: { - defined: "Market", - }, + name: "quoteAmount"; + type: "u64"; }, { - name: "swapType", - type: { - defined: "SwapType", - }, + name: "cycleCount"; + type: "u32"; + }, + { + name: "cycleFrequencySeconds"; + type: "u32"; + }, + { + name: "startDelaySeconds"; + type: "u32"; }, { - name: "inputAmount", - type: "u64", + name: "minPrice"; + type: { + option: "u64"; + }; }, { - name: "minOutputAmount", - type: "u64", + name: "maxPrice"; + type: { + option: "u64"; + }; }, - ], - }, + ]; + }; }, { - name: "InitializeBuybackTokenProposalArgs", + name: "initializeDaoEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "quoteAmount", - type: "u64", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "cycleCount", - type: "u32", + name: "dao"; + type: "pubkey"; }, { - name: "cycleFrequencySeconds", - type: "u32", + name: "baseMint"; + type: "pubkey"; }, { - name: "startDelaySeconds", - type: "u32", + name: "quoteMint"; + type: "pubkey"; }, { - name: "minPrice", - type: { - option: "u64", - }, + name: "passThresholdBps"; + type: "u16"; }, { - name: "maxPrice", - type: { - option: "u64", - }, + name: "secondsPerProposal"; + type: "u32"; }, - ], - }, - }, - { - name: "InitializeDaoParams", - type: { - kind: "struct", - fields: [ { - name: "twapInitialObservation", - type: "u128", + name: "twapInitialObservation"; + type: "u128"; }, { - name: "twapMaxObservationChangePerUpdate", - type: "u128", + name: "twapMaxObservationChangePerUpdate"; + type: "u128"; }, { - name: "twapStartDelaySeconds", - type: "u32", + name: "twapStartDelaySeconds"; + type: "u32"; }, { - name: "minQuoteFutarchicLiquidity", - type: "u64", + name: "minQuoteFutarchicLiquidity"; + type: "u64"; }, { - name: "minBaseFutarchicLiquidity", - type: "u64", + name: "minBaseFutarchicLiquidity"; + type: "u64"; }, { - name: "baseToStake", - type: "u64", + name: "baseToStake"; + type: "u64"; }, { - name: "passThresholdBps", - type: "u16", + name: "initialSpendingLimit"; + type: { + option: { + defined: { + name: "initialSpendingLimit"; + }; + }; + }; }, { - name: "secondsPerProposal", - type: "u32", + name: "squadsMultisig"; + type: "pubkey"; }, { - name: "nonce", - type: "u64", + name: "squadsMultisigVault"; + type: "pubkey"; }, { - name: "initialSpendingLimit", - type: { - option: { - defined: "InitialSpendingLimit", - }, - }, + name: "teamSponsoredPassThresholdBps"; + type: "i16"; }, { - name: "teamSponsoredPassThresholdBps", - type: "i16", + name: "teamAddress"; + type: "pubkey"; }, { - name: "teamAddress", - type: "publicKey", + name: "typedProposalsEnabled"; + type: "bool"; }, - ], - }, + ]; + }; }, { - name: "InitializeHostileLiquidateProposalArgs", + name: "initializeDaoParams"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "liquidator", - type: "publicKey", + name: "twapInitialObservation"; + type: "u128"; }, - ], - }, - }, - { - name: "InitializeHostileTakeoverProposalArgs", - type: { - kind: "struct", - fields: [ { - name: "newTeamAddress", - type: "publicKey", + name: "twapMaxObservationChangePerUpdate"; + type: "u128"; }, { - name: "spendingLimitAction", - type: { - defined: "SpendingLimitAction", - }, + name: "twapStartDelaySeconds"; + type: "u32"; }, - ], - }, - }, - { - name: "InitializeLargeSpendProposalArgs", - type: { - kind: "struct", - fields: [ { - name: "amount", - type: "u64", + name: "minQuoteFutarchicLiquidity"; + type: "u64"; }, - ], - }, - }, - { - name: "InitializeMintTokensProposalArgs", - type: { - kind: "struct", - fields: [ { - name: "amount", - type: "u64", + name: "minBaseFutarchicLiquidity"; + type: "u64"; }, { - name: "recipient", - type: "publicKey", + name: "baseToStake"; + type: "u64"; }, - ], - }, - }, - { - name: "InitializeSpendingLimitChangeProposalArgs", - type: { - kind: "struct", - fields: [ { - name: "config", - docs: ["`Some` replaces the record, `None` removes it."], - type: { - option: { - defined: "InitialSpendingLimit", - }, - }, + name: "passThresholdBps"; + type: "u16"; }, - ], - }, - }, - { - name: "ProvideLiquidityParams", - type: { - kind: "struct", - fields: [ { - name: "quoteAmount", - docs: ["How much quote token you will deposit to the pool"], - type: "u64", + name: "secondsPerProposal"; + type: "u32"; }, { - name: "maxBaseAmount", - docs: ["The maximum base token you will deposit to the pool"], - type: "u64", + name: "nonce"; + type: "u64"; }, { - name: "minLiquidity", - docs: ["The minimum liquidity you will be assigned"], - type: "u128", + name: "initialSpendingLimit"; + type: { + option: { + defined: { + name: "initialSpendingLimit"; + }; + }; + }; }, { - name: "positionAuthority", - docs: [ - "The account that will own the LP position, usually the same as the", - "liquidity provider", - ], - type: "publicKey", + name: "teamSponsoredPassThresholdBps"; + type: "i16"; }, - ], - }, + { + name: "teamAddress"; + type: "pubkey"; + }, + ]; + }; }, { - name: "SetSpendingLimitArgs", + name: "initializeHostileLiquidateProposalArgs"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "config", - docs: [ - "`Some` becomes the new record verbatim; `None` deletes it.", - ], - type: { - option: { - defined: "InitialSpendingLimit", - }, - }, + name: "liquidator"; + type: "pubkey"; }, - ], - }, + ]; + }; }, { - name: "SpotSwapParams", + name: "initializeHostileTakeoverProposalArgs"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "inputAmount", - type: "u64", + name: "newTeamAddress"; + type: "pubkey"; }, { - name: "swapType", + name: "spendingLimitAction"; type: { - defined: "SwapType", - }, - }, - { - name: "minOutputAmount", - type: "u64", + defined: { + name: "spendingLimitAction"; + }; + }; }, - ], - }, + ]; + }; }, { - name: "StakeToProposalParams", + name: "initializeLargeSpendProposalArgs"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "amount", - type: "u64", + name: "amount"; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "UnstakeFromProposalParams", + name: "initializeMintTokensProposalArgs"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "amount", - type: "u64", + name: "amount"; + type: "u64"; + }, + { + name: "recipient"; + type: "pubkey"; }, - ], - }, + ]; + }; }, { - name: "UpdateDaoParams", + name: "initializeProposalEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "passThresholdBps", - type: { - option: "u16", - }, - }, - { - name: "secondsPerProposal", + name: "common"; type: { - option: "u32", - }, - }, - { - name: "twapInitialObservation", - type: { - option: "u128", - }, - }, - { - name: "twapMaxObservationChangePerUpdate", - type: { - option: "u128", - }, + defined: { + name: "commonFields"; + }; + }; }, { - name: "twapStartDelaySeconds", - type: { - option: "u32", - }, + name: "proposal"; + type: "pubkey"; }, { - name: "minQuoteFutarchicLiquidity", - type: { - option: "u64", - }, + name: "dao"; + type: "pubkey"; }, { - name: "minBaseFutarchicLiquidity", - type: { - option: "u64", - }, + name: "question"; + type: "pubkey"; }, { - name: "baseToStake", - type: { - option: "u64", - }, + name: "quoteVault"; + type: "pubkey"; }, { - name: "teamSponsoredPassThresholdBps", - type: { - option: "i16", - }, + name: "baseVault"; + type: "pubkey"; }, { - name: "teamAddress", - type: { - option: "publicKey", - }, + name: "proposer"; + type: "pubkey"; }, { - name: "deprecatedIsOptimisticGovernanceEnabled", - docs: [ - "Ignored. The retired optimistic-governance flag, kept in place so", - "payloads encoded before the upgrade are refused, not reinterpreted.", - ], - type: { - option: "bool", - }, + name: "number"; + type: "u32"; }, { - name: "typedProposalsEnabled", - docs: [ - "`Some(true)` turns typed proposals on for this DAO. `None` leaves them", - "as they are. `Some(false)` is refused: there is no way to turn them off.", - ], - type: { - option: "bool", - }, + name: "pdaBump"; + type: "u8"; }, - ], - }, - }, - { - name: "WithdrawLiquidityParams", - type: { - kind: "struct", - fields: [ { - name: "liquidityToWithdraw", - docs: ["How much liquidity to withdraw"], - type: "u128", + name: "durationInSeconds"; + type: "u32"; }, { - name: "minBaseAmount", - docs: ["Minimum base tokens to receive"], - type: "u64", + name: "squadsProposal"; + type: "pubkey"; }, { - name: "minQuoteAmount", - docs: ["Minimum quote tokens to receive"], - type: "u64", + name: "squadsMultisig"; + type: "pubkey"; }, - ], - }, - }, - { - 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: "squadsMultisigVault"; + type: "pubkey"; }, { - name: "enqueuedTimestamp", - docs: [ - "The timestamp when the active optimistic squads proposal was enqueued.", - ], - type: "i64", + name: "action"; + type: { + defined: { + name: "proposalAction"; + }; + }; }, - ], - }, + ]; + }; }, { - name: "InitialSpendingLimit", + name: "initializeSpendingLimitChangeProposalArgs"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "amountPerMonth", - type: "u64", - }, - { - name: "members", + name: "config"; + docs: ["`Some` replaces the record, `None` removes it."]; type: { - vec: "publicKey", - }, + option: { + defined: { + name: "initialSpendingLimit"; + }; + }; + }; }, - ], - }, + ]; + }; }, { - name: "FutarchyAmm", + name: "launchProposalEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "state", + name: "common"; type: { - defined: "PoolState", - }, + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "proposal"; + type: "pubkey"; + }, + { + name: "dao"; + type: "pubkey"; }, { - name: "totalLiquidity", - type: "u128", + name: "timestampEnqueued"; + type: "i64"; + }, + { + name: "totalStaked"; + type: "u64"; }, { - name: "baseMint", - type: "publicKey", + name: "postAmmState"; + type: { + defined: { + name: "futarchyAmm"; + }; + }; }, { - name: "quoteMint", - type: "publicKey", + name: "durationInSeconds"; + docs: ["The terms the market opened with, as written by launch."]; + type: "u32"; }, { - name: "ammBaseVault", - type: "publicKey", + name: "passThresholdBps"; + type: "i16"; }, { - name: "ammQuoteVault", - type: "publicKey", + name: "isTeamSponsored"; + type: "bool"; }, - ], - }, + ]; + }; }, { - name: "TwapOracle", + name: "market"; type: { - kind: "struct", - fields: [ + kind: "enum"; + variants: [ { - name: "aggregator", - docs: [ - "Running sum of seconds_since_last_update * last_observation.", - "", - "Assuming latest observations are as big as possible (u64::MAX * 1e12),", - "we can store 18 million seconds worth of observations, which turns out to", - "be ~213 days.", - "", - "Assuming that latest observations are 100x smaller than they could theoretically", - "be, we can store ~57 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.", - "", - "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: "spot"; }, { - name: "lastUpdatedTimestamp", - type: "i64", + name: "pass"; }, { - name: "createdAtTimestamp", - type: "i64", + name: "fail"; }, + ]; + }; + }, + { + name: "mintAuthority"; + type: { + kind: "struct"; + fields: [ { - 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: "mintGovernor"; + type: "pubkey"; }, { - 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: "authorizedMinter"; + type: "pubkey"; }, { - name: "maxObservationChangePerUpdate", - docs: ["The most that an observation can change per update."], - type: "u128", + name: "maxTotal"; + type: { + option: "u64"; + }; }, { - name: "initialObservation", - docs: ["What the initial `latest_observation` is set to."], - type: "u128", + name: "totalMinted"; + type: "u64"; }, { - name: "startDelaySeconds", - docs: [ - "Number of seconds after amm.created_at_slot to start recording TWAP", - ], - type: "u32", + name: "bump"; + type: "u8"; }, - ], - }, + ]; + }; }, { - name: "Pool", + name: "mintGovernor"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "oracle", - type: { - defined: "TwapOracle", - }, + name: "mint"; + type: "pubkey"; }, { - name: "quoteReserves", - type: "u64", + name: "admin"; + type: "pubkey"; }, { - name: "baseReserves", - type: "u64", + name: "createKey"; + type: "pubkey"; }, { - name: "quoteProtocolFeeBalance", - type: "u64", + name: "seqNum"; + type: "u64"; }, { - name: "baseProtocolFeeBalance", - type: "u64", + name: "bump"; + type: "u8"; }, - ], - }, + ]; + }; }, { - name: "InstructionParams", + name: "optimisticProposal"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "durationSeconds", - type: "u32", + name: "squadsProposal"; + docs: [ + "The squads proposal currently enqueued for execution if not challenged by a new proposal.", + ]; + type: "pubkey"; }, { - name: "passThresholdBps", + name: "enqueuedTimestamp"; docs: [ - "Signed: a negative threshold lets a proposal pass even when the pass", - "price is below the fail price.", - ], - type: "i16", + "The timestamp when the active optimistic squads proposal was enqueued.", + ]; + type: "i64"; }, + ]; + }; + }, + { + name: "pool"; + type: { + kind: "struct"; + fields: [ { - name: "teamSponsorshipPolicy", - docs: ["Sponsorship policy"], + name: "oracle"; type: { - defined: "TeamSponsorshipPolicy", - }, + defined: { + name: "twapOracle"; + }; + }; + }, + { + name: "quoteReserves"; + type: "u64"; }, { - name: "councilCanBlock", - type: "bool", + name: "baseReserves"; + type: "u64"; }, { - name: "cooldownSeconds", - docs: ["Cooldown checked at launch. 0 = none."], - type: "u32", + name: "quoteProtocolFeeBalance"; + type: "u64"; }, { - name: "twapStartDelaySeconds", - docs: ["Delay before the conditional TWAPs start to accumulate"], - type: "u32", + name: "baseProtocolFeeBalance"; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "PoolState", + name: "poolState"; type: { - kind: "enum", + kind: "enum"; variants: [ { - name: "Spot", + name: "spot"; fields: [ { - name: "spot", + name: "spot"; type: { - defined: "Pool", - }, + defined: { + name: "pool"; + }; + }; }, - ], + ]; }, { - name: "Futarchy", + name: "futarchy"; fields: [ { - name: "spot", + name: "spot"; type: { - defined: "Pool", - }, + defined: { + name: "pool"; + }; + }; }, { - name: "pass", + name: "pass"; type: { - defined: "Pool", - }, + defined: { + name: "pool"; + }; + }; }, { - name: "fail", + name: "fail"; type: { - defined: "Pool", - }, + defined: { + name: "pool"; + }; + }; }, - ], + ]; }, - ], - }, + ]; + }; }, { - name: "Market", + name: "proposal"; type: { - kind: "enum", - variants: [ + kind: "struct"; + fields: [ { - name: "Spot", + name: "number"; + type: "u32"; }, { - name: "Pass", + name: "proposer"; + type: "pubkey"; }, { - name: "Fail", + name: "timestampEnqueued"; + type: "i64"; }, - ], - }, - }, - { - name: "SwapType", - type: { - kind: "enum", - variants: [ { - name: "Buy", + name: "state"; + type: { + defined: { + name: "proposalState"; + }; + }; }, { - name: "Sell", + name: "baseVault"; + type: "pubkey"; }, - ], - }, - }, - { - name: "Token", - type: { - kind: "enum", - variants: [ { - name: "Base", + name: "quoteVault"; + type: "pubkey"; }, { - name: "Quote", + name: "dao"; + type: "pubkey"; }, - ], - }, - }, - { - name: "TeamSponsorshipPolicy", - type: { - kind: "enum", - variants: [ { - name: "Required", + name: "pdaBump"; + type: "u8"; }, { - name: "Optional", + name: "question"; + type: "pubkey"; }, { - name: "Forbidden", + name: "durationInSeconds"; + type: "u32"; }, - ], - }, - }, - { - name: "SpendingLimitAction", - docs: ["What a hostile takeover declares for the spending limit."], - type: { - kind: "enum", - variants: [ { - name: "Keep", + name: "squadsProposal"; + type: "pubkey"; }, { - name: "Remove", + name: "passBaseMint"; + type: "pubkey"; }, { - name: "Set", - fields: [ - { - defined: "InitialSpendingLimit", - }, - ], + name: "passQuoteMint"; + type: "pubkey"; }, - ], - }, - }, - { - name: "ProposalAction", - docs: [ - "The typed action parameters, stored on the proposal. The borsh variant tag", - "is the proposal's kind discriminator, so variants are append-only — the", - "variant index is the wire tag.", - ], - type: { - kind: "enum", - variants: [ { - name: "LargeSpend", - fields: [ - { - name: "amount", - type: "u64", - }, - { - name: "teamAddress", - docs: [ - "The team the baked transfer pays, snapshotted at create. Launch", - "requires it to still be the DAO's team.", - ], - type: "publicKey", - }, - ], + name: "failBaseMint"; + type: "pubkey"; }, { - name: "MintTokens", - fields: [ - { - name: "amount", - type: "u64", - }, - { - name: "recipient", - type: "publicKey", - }, - ], + name: "failQuoteMint"; + type: "pubkey"; }, { - name: "SpendingLimitChange", - fields: [ - { - name: "config", - type: { - option: { - defined: "InitialSpendingLimit", - }, - }, - }, - ], + name: "sponsoredBy"; + docs: [ + "The team that last sponsored the proposal. `None` = never sponsored.", + ]; + type: { + option: "pubkey"; + }; }, { - name: "ExecuteArbitrary", + name: "passThresholdBps"; + type: "i16"; }, { - name: "HostileTakeover", - fields: [ - { - name: "newTeamAddress", - docs: [ - "The team to install. Launch requires it to still differ from the", - "DAO's team.", - ], - type: "publicKey", - }, - { - name: "spendingLimitAction", - type: { - defined: "SpendingLimitAction", - }, - }, - ], + name: "councilCanBlock"; + docs: ["Snapshot of the kind's blockable flag at create."]; + type: "bool"; }, { - name: "HostileLiquidate", - fields: [ - { - name: "liquidator", - type: "publicKey", - }, - ], + name: "action"; + docs: ["The typed action parameters."]; + type: { + defined: { + name: "proposalAction"; + }; + }; + }, + { + name: "paramsOverridden"; + docs: [ + "Set by `admin_update_proposal_params`. `launch_proposal` then leaves the", + "duration and threshold alone.", + ]; + type: "bool"; }, + ]; + }; + }, + { + name: "proposalAction"; + docs: [ + "The typed action parameters, stored on the proposal. The borsh variant tag", + "is the proposal's kind discriminator, so variants are append-only — the", + "variant index is the wire tag.", + ]; + type: { + kind: "enum"; + variants: [ { - name: "BuybackToken", + name: "largeSpend"; fields: [ { - name: "quoteAmount", - docs: ["Total quote to deploy. Capped at 25% of the treasury."], - type: "u64", - }, - { - name: "cycleCount", - docs: ["Orders the total is split across. At least 2."], - type: "u32", - }, - { - name: "cycleFrequencySeconds", - docs: ["Seconds between orders."], - type: "u32", + name: "amount"; + type: "u64"; }, { - name: "startDelaySeconds", + name: "teamAddress"; docs: [ - "Seconds after execution before the first order. 0 = immediately.", - ], - type: "u32", + "The team the baked transfer pays, snapshotted at create. Launch", + "requires it to still be the DAO's team.", + ]; + type: "pubkey"; }, + ]; + }, + { + name: "mintTokens"; + fields: [ { - name: "minPrice", - docs: [ - "Optional price band, in quote native units per whole base token:", - "1_600_000 = 1.6 USDC per token.", - "`None` = unguarded.", - ], - type: { - option: "u64", - }, + name: "amount"; + type: "u64"; }, { - name: "maxPrice", - type: { - option: "u64", - }, + name: "recipient"; + type: "pubkey"; }, - ], + ]; }, - ], - }, - }, - { - name: "ProposalState", - type: { - kind: "enum", - variants: [ { - name: "Draft", + name: "spendingLimitChange"; fields: [ { - name: "amountStaked", - type: "u64", - }, - ], - }, - { - name: "Pending", - }, - { - name: "Passed", - }, - { - name: "Failed", - }, - { - name: "Removed", - }, - ], - }, - }, - ], - 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: "typedProposalsEnabled", - type: "bool", - 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: "typedProposalsEnabled", - 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: "action", - type: { - defined: "ProposalAction", - }, - 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: "durationInSeconds", - type: "u32", - index: false, - }, - { - name: "passThresholdBps", - type: "i16", - index: false, - }, - { - name: "isTeamSponsored", - type: "bool", - 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", + name: "config"; + type: { + option: { + defined: { + name: "initialSpendingLimit"; + }; + }; + }; + }, + ]; }, - index: false, - }, - { - name: "squadsProposal", - type: "publicKey", - index: false, - }, - { - name: "squadsMultisig", - type: "publicKey", - index: false, - }, - { - name: "postAmmState", - type: { - defined: "FutarchyAmm", + { + name: "executeArbitrary"; }, - index: false, - }, - { - name: "isTeamSponsored", - type: "bool", - index: false, - }, - ], - }, - { - name: "SpotSwapEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "hostileTakeover"; + fields: [ + { + name: "newTeamAddress"; + docs: [ + "The team to install. Launch requires it to still differ from the", + "DAO's team.", + ]; + type: "pubkey"; + }, + { + name: "spendingLimitAction"; + type: { + defined: { + name: "spendingLimitAction"; + }; + }; + }, + ]; }, - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "user", - type: "publicKey", - index: false, - }, - { - name: "swapType", - type: { - defined: "SwapType", + { + name: "hostileLiquidate"; + fields: [ + { + name: "liquidator"; + type: "pubkey"; + }, + ]; }, - 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", + { + name: "buybackToken"; + fields: [ + { + name: "quoteAmount"; + docs: ["Total quote to deploy. Capped at 25% of the treasury."]; + type: "u64"; + }, + { + name: "cycleCount"; + docs: ["Orders the total is split across. At least 2."]; + type: "u32"; + }, + { + name: "cycleFrequencySeconds"; + docs: ["Seconds between orders."]; + type: "u32"; + }, + { + name: "startDelaySeconds"; + docs: [ + "Seconds after execution before the first order. 0 = immediately.", + ]; + type: "u32"; + }, + { + name: "minPrice"; + docs: [ + "Optional price band, in quote native units per whole base token:", + "1_600_000 = 1.6 USDC per token.", + "`None` = unguarded.", + ]; + type: { + option: "u64"; + }; + }, + { + name: "maxPrice"; + type: { + option: "u64"; + }; + }, + ]; }, - index: false, - }, - ], + ]; + }; }, { - name: "ConditionalSwapEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "proposalState"; + type: { + kind: "enum"; + variants: [ + { + name: "draft"; + fields: [ + { + name: "amountStaked"; + type: "u64"; + }, + ]; }, - 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", + { + name: "pending"; }, - index: false, - }, - { - name: "swapType", - type: { - defined: "SwapType", + { + name: "passed"; }, - 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", + { + name: "failed"; }, - index: false, - }, - ], + { + name: "removed"; + }, + ]; + }; }, { - name: "ProvideLiquidityEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "provideLiquidityEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "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", + { + name: "dao"; + type: "pubkey"; }, - index: false, - }, - ], - }, - { - name: "WithdrawLiquidityEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "liquidityProvider"; + type: "pubkey"; }, - 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", + { + name: "positionAuthority"; + type: "pubkey"; }, - index: false, - }, - ], - }, - { - name: "SponsorProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "quoteAmount"; + type: "u64"; }, - index: false, - }, - { - name: "proposal", - type: "publicKey", - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "teamAddress", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "RemoveProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "baseAmount"; + type: "u64"; }, - index: false, - }, - { - name: "proposal", - type: "publicKey", - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "admin", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "AdminUpdateProposalParamsEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "liquidityMinted"; + type: "u128"; }, - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "proposal", - type: "publicKey", - index: false, - }, - { - name: "admin", - type: "publicKey", - index: false, - }, - { - name: "oldDurationInSeconds", - type: "u32", - index: false, - }, - { - name: "newDurationInSeconds", - type: "u32", - index: false, - }, - { - name: "oldPassThresholdBps", - type: "i16", - index: false, - }, - { - name: "newPassThresholdBps", - type: "i16", - index: false, - }, - ], + { + name: "minLiquidity"; + type: "u128"; + }, + { + name: "postAmmState"; + type: { + defined: { + name: "futarchyAmm"; + }; + }; + }, + ]; + }; }, { - name: "AdminCancelProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "provideLiquidityParams"; + type: { + kind: "struct"; + fields: [ + { + name: "quoteAmount"; + docs: ["How much quote token you will deposit to the pool"]; + type: "u64"; }, - index: false, - }, - { - name: "proposal", - type: "publicKey", - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "admin", - type: "publicKey", - index: false, - }, - { - name: "postAmmState", - type: { - defined: "FutarchyAmm", + { + name: "maxBaseAmount"; + docs: ["The maximum base token you will deposit to the pool"]; + type: "u64"; }, - index: false, - }, - ], - }, - { - name: "CollectMeteoraDammFeesEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "minLiquidity"; + docs: ["The minimum liquidity you will be assigned"]; + type: "u128"; }, - 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: "AdminFixPositionAuthorityEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "positionAuthority"; + docs: [ + "The account that will own the LP position, usually the same as the", + "liquidity provider", + ]; + type: "pubkey"; }, - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "admin", - type: "publicKey", - index: false, - }, - { - name: "ammPosition", - type: "publicKey", - index: false, - }, - { - name: "oldAuthority", - type: "publicKey", - index: false, - }, - { - name: "newAuthority", - type: "publicKey", - index: false, - }, - ], + ]; + }; }, { - name: "SetSpendingLimitEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + 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]; + }; }, - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "config", - type: { - option: { - defined: "InitialSpendingLimit", - }, + { + name: "oracle"; + type: "pubkey"; }, - index: false, - }, - ], - }, - { - name: "SyncSpendingLimitEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "payoutNumerators"; + type: { + vec: "u32"; + }; }, - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "spendingLimit", - type: "publicKey", - index: false, - }, - { - name: "config", - type: { - option: { - defined: "InitialSpendingLimit", - }, + { + name: "payoutDenominator"; + type: "u32"; }, - 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 Active 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: "InvalidMint", - msg: "Base mint and quote mint must be different", - }, - { - code: 6037, - name: "ProposalNotReadyToUnstake", - msg: "Proposal is not ready to be unstaked", - }, - { - code: 6038, - name: "OptimisticGovernanceDisabled", - msg: "Optimistic governance is disabled", - }, - { - code: 6039, - name: "ActiveOptimisticProposalAlreadyEnqueued", - msg: "An active optimistic proposal is already enqueued", - }, - { - code: 6040, - name: "OptimisticProposalAlreadyPassed", - msg: "Optimistic proposal has already passed", - }, - { - code: 6041, - name: "InvalidSpendingLimitMint", - msg: "Invalid spending limit mint. Must be the same as the DAO's quote mint", - }, - { - code: 6042, - name: "NoActiveOptimisticProposal", - msg: "No active optimistic proposal", - }, - { - code: 6043, - name: "DaoLiquidated", - msg: "This DAO has been liquidated", - }, - { - code: 6044, - name: "ProposalKindCooldownActive", - msg: "A proposal of this kind finalized recently, so the cooldown must elapse first", - }, - { - code: 6045, - name: "NoSpendingLimit", - msg: "The DAO has no spending limit", - }, - { - code: 6046, - name: "SpendCapExceeded", - msg: "Amount exceeds the cap of 3x the monthly spending limit", - }, - { - code: 6047, - name: "UnknownMintAuthority", - msg: "The base mint's authority is neither the treasury vault nor a mint governor", - }, - { - code: 6048, - name: "ProposalNotTeamSponsored", - msg: "This proposal kind must be team-sponsored before it can launch", - }, - { - code: 6049, - name: "SpendingLimitNotDirty", - msg: "The spending limit record hasn't changed, so there is nothing to sync", - }, - { - code: 6050, - name: "InvalidProposalKind", - msg: "Wrong proposal kind for this instruction", - }, - { - code: 6051, - name: "TooManySpendingLimitMembers", - msg: "A spending limit can have at most 10 members", - }, - { - code: 6052, - name: "InvalidLiquidator", - msg: "Invalid liquidator", - }, - { - code: 6053, - name: "InvalidProposalPassThreshold", - msg: "Pass threshold must be between -99.99% and 99.99%", - }, - { - code: 6054, - name: "EmptyProposalParamsUpdate", - msg: "A proposal params update must set at least one field", - }, - { - code: 6055, - name: "BuybackCapExceeded", - msg: "Buyback amount exceeds 25% of the treasury", - }, - { - code: 6056, - name: "InvalidBuybackAmount", - msg: "Buyback total must be non-zero", - }, - { - code: 6057, - name: "InvalidBuybackCycleFrequency", - msg: "Cycle frequency must be between 60 seconds and 1 year", - }, - { - code: 6058, - name: "InvalidBuybackStartDelay", - msg: "Start delay must be at most 30 days", + ]; + }; }, { - code: 6059, - name: "InvalidBuybackPriceBand", - msg: "min_price must be no greater than max_price", + name: "removeProposalEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "proposal"; + type: "pubkey"; + }, + { + name: "dao"; + type: "pubkey"; + }, + { + name: "admin"; + type: "pubkey"; + }, + ]; + }; }, { - code: 6060, - name: "InvalidTreasuryAccount", - msg: "A treasury account is neither a vault-owned quote account nor the treasury's AMM position", + name: "setSpendingLimitArgs"; + type: { + kind: "struct"; + fields: [ + { + name: "config"; + docs: [ + "`Some` becomes the new record verbatim; `None` deletes it.", + ]; + type: { + option: { + defined: { + name: "initialSpendingLimit"; + }; + }; + }; + }, + ]; + }; }, { - code: 6061, - name: "TreasuryAccountsNotSorted", - msg: "Treasury accounts must be in strictly ascending key order", + name: "setSpendingLimitEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "dao"; + type: "pubkey"; + }, + { + name: "config"; + type: { + option: { + defined: { + name: "initialSpendingLimit"; + }; + }; + }; + }, + ]; + }; }, { - code: 6062, - name: "UnexpectedLaunchAccounts", - msg: "This proposal kind's launch takes no extra accounts", + name: "spendingLimitAction"; + docs: ["What a hostile takeover declares for the spending limit."]; + type: { + kind: "enum"; + variants: [ + { + name: "keep"; + }, + { + name: "remove"; + }, + { + name: "set"; + fields: [ + { + defined: { + name: "initialSpendingLimit"; + }; + }, + ]; + }, + ]; + }; }, { - code: 6063, - name: "InvalidSpendingLimitAccount", - msg: "Spending limit account is not the canonical spending-limit PDA", + name: "sponsorProposalEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "proposal"; + type: "pubkey"; + }, + { + name: "dao"; + type: "pubkey"; + }, + { + name: "teamAddress"; + type: "pubkey"; + }, + ]; + }; }, { - code: 6064, - name: "StaleTeamAddress", - msg: "The DAO's team has changed since this draft was created", + name: "spotSwapEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "dao"; + type: "pubkey"; + }, + { + name: "user"; + type: "pubkey"; + }, + { + name: "swapType"; + type: { + defined: { + name: "swapType"; + }; + }; + }, + { + name: "inputAmount"; + type: "u64"; + }, + { + name: "outputAmount"; + type: "u64"; + }, + { + name: "minOutputAmount"; + type: "u64"; + }, + { + name: "postAmmState"; + type: { + defined: { + name: "futarchyAmm"; + }; + }; + }, + ]; + }; }, { - code: 6065, - name: "AccountNotMigrated", - msg: "Account is not migrated to latest layout", + name: "spotSwapParams"; + type: { + kind: "struct"; + fields: [ + { + name: "inputAmount"; + type: "u64"; + }, + { + name: "swapType"; + type: { + defined: { + name: "swapType"; + }; + }; + }, + { + name: "minOutputAmount"; + type: "u64"; + }, + ]; + }; }, { - code: 6066, - name: "InvalidSpendingLimitAmount", - msg: "A spending limit's monthly amount must be non-zero", + name: "stakeAccount"; + type: { + kind: "struct"; + fields: [ + { + name: "proposal"; + type: "pubkey"; + }, + { + name: "staker"; + type: "pubkey"; + }, + { + name: "amount"; + type: "u64"; + }, + { + name: "bump"; + type: "u8"; + }, + ]; + }; }, { - code: 6067, - name: "EmptySpendingLimitMembers", - msg: "A spending limit must have at least one member", + name: "stakeToProposalEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "proposal"; + type: "pubkey"; + }, + { + name: "staker"; + type: "pubkey"; + }, + { + name: "amount"; + type: "u64"; + }, + { + name: "totalStaked"; + type: "u64"; + }, + ]; + }; }, { - code: 6068, - name: "DuplicateSpendingLimitMember", - msg: "A spending limit's members must be unique", + name: "stakeToProposalParams"; + type: { + kind: "struct"; + fields: [ + { + name: "amount"; + type: "u64"; + }, + ]; + }; }, { - code: 6069, - name: "InvalidBuybackCycleCount", - msg: "A buyback must run at least two cycles", + name: "swapType"; + type: { + kind: "enum"; + variants: [ + { + name: "buy"; + }, + { + name: "sell"; + }, + ]; + }; }, { - code: 6070, - name: "InvalidTeamAddress", - msg: "Invalid team address", + name: "syncSpendingLimitEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "dao"; + type: "pubkey"; + }, + { + name: "spendingLimit"; + docs: [ + "The Squads-side SpendingLimit PDA the record was projected onto.", + ]; + type: "pubkey"; + }, + { + name: "config"; + docs: [ + "The projected record — the Squads-side end-state after the sync.", + "`None` = no limit (removed or never existed).", + ]; + type: { + option: { + defined: { + name: "initialSpendingLimit"; + }; + }; + }; + }, + ]; + }; }, { - code: 6071, - name: "TeamSponsorshipForbidden", - msg: "This proposal kind cannot be team-sponsored", + name: "twapOracle"; + type: { + kind: "struct"; + fields: [ + { + name: "aggregator"; + docs: [ + "Running sum of seconds_since_last_update * last_observation.", + "", + "Assuming latest observations are as big as possible (u64::MAX * 1e12),", + "we can store 18 million seconds worth of observations, which turns out to", + "be ~213 days.", + "", + "Assuming that latest observations are 100x smaller than they could theoretically", + "be, we can store ~57 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.", + "", + "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"; + }, + ]; + }; }, { - code: 6072, - name: "SquadsProposalNotApproved", - msg: "Squads proposal must be in Approved status to be cancelled", + name: "unstakeFromProposalEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "proposal"; + type: "pubkey"; + }, + { + name: "staker"; + type: "pubkey"; + }, + { + name: "amount"; + type: "u64"; + }, + { + name: "totalStaked"; + type: "u64"; + }, + ]; + }; }, { - code: 6073, - name: "TypedProposalsDisabled", - msg: "This DAO has not opted into typed proposals", + name: "unstakeFromProposalParams"; + type: { + kind: "struct"; + fields: [ + { + name: "amount"; + type: "u64"; + }, + ]; + }; }, { - code: 6074, - name: "TypedProposalsCannotBeDisabled", - msg: "Typed proposals cannot be disabled", + name: "updateDaoEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "dao"; + type: "pubkey"; + }, + { + name: "passThresholdBps"; + type: "u16"; + }, + { + name: "secondsPerProposal"; + type: "u32"; + }, + { + 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: "teamSponsoredPassThresholdBps"; + type: "i16"; + }, + { + name: "teamAddress"; + type: "pubkey"; + }, + { + name: "isOptimisticGovernanceEnabled"; + type: "bool"; + }, + { + name: "typedProposalsEnabled"; + type: "bool"; + }, + ]; + }; }, { - code: 6075, - name: "UnfrozenAddressLookupTable", - msg: "Address lookup tables referenced by the vault transaction must be frozen", + 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: "pubkey"; + }; + }, + { + name: "deprecatedIsOptimisticGovernanceEnabled"; + docs: [ + "Ignored. The retired optimistic-governance flag, kept in place so", + "payloads encoded before the upgrade are refused, not reinterpreted.", + ]; + type: { + option: "bool"; + }; + }, + { + name: "typedProposalsEnabled"; + docs: [ + "`Some(true)` turns typed proposals on for this DAO. `None` leaves them", + "as they are. `Some(false)` is refused: there is no way to turn them off.", + ]; + type: { + option: "bool"; + }; + }, + ]; + }; }, { - code: 6076, - name: "InvalidAddressLookupTable", - msg: "Lookup table accounts must match the vault transaction's address table lookups", + name: "withdrawLiquidityEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "dao"; + type: "pubkey"; + }, + { + name: "liquidityProvider"; + type: "pubkey"; + }, + { + name: "liquidityWithdrawn"; + type: "u128"; + }, + { + name: "minBaseAmount"; + type: "u64"; + }, + { + name: "minQuoteAmount"; + type: "u64"; + }, + { + name: "baseAmount"; + type: "u64"; + }, + { + name: "quoteAmount"; + type: "u64"; + }, + { + name: "postAmmState"; + type: { + defined: { + name: "futarchyAmm"; + }; + }; + }, + ]; + }; }, { - code: 6077, - name: "InvalidSquadsVaultTransaction", - msg: "Expected the proposal's Squads vault transaction as the first launch account", + 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"; + }, + ]; + }; }, - ], + ]; }; diff --git a/sdk/src/futarchy/v0.6/types/index.ts b/sdk/src/futarchy/v0.6/types/index.ts index 0cdc8a807..c6d6a3725 100644 --- a/sdk/src/futarchy/v0.6/types/index.ts +++ b/sdk/src/futarchy/v0.6/types/index.ts @@ -1,89 +1,86 @@ -import { Futarchy as FutarchyProgram, IDL as FutarchyIDL } from "./futarchy.js"; -export { FutarchyProgram, FutarchyIDL }; +import type { Futarchy as FutarchyProgram } from "./futarchy.js"; +import futarchyIdl from "./futarchy.json" with { type: "json" }; +export type { FutarchyProgram }; +export const FutarchyIDL = futarchyIdl as FutarchyProgram; -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 type { Futarchy as v0_6_0_Futarchy } from "./v0.6.0-futarchy.js"; +import v0_6_0_FutarchyIdl from "./v0.6.0-futarchy.json" with { type: "json" }; +export type { v0_6_0_Futarchy }; +export const v0_6_0_FutarchyIDL = v0_6_0_FutarchyIdl as v0_6_0_Futarchy; -import { - Futarchy as v0_6_1_Futarchy, - IDL as v0_6_1_FutarchyIDL, -} from "./v0.6.1-futarchy.js"; -export { v0_6_1_Futarchy, v0_6_1_FutarchyIDL }; +import type { Futarchy as v0_6_1_Futarchy } from "./v0.6.1-futarchy.js"; +import v0_6_1_FutarchyIdl from "./v0.6.1-futarchy.json" with { type: "json" }; +export type { v0_6_1_Futarchy }; +export const v0_6_1_FutarchyIDL = v0_6_1_FutarchyIdl as v0_6_1_Futarchy; export { LowercaseKeys } from "../../../utils.js"; -import type { IdlAccounts, IdlTypes, IdlEvents } from "@coral-xyz/anchor"; +import type { IdlAccounts, IdlTypes, IdlEvents } from "@anchor-lang/core"; export type InitializeDaoParams = - IdlTypes["InitializeDaoParams"]; + IdlTypes["initializeDaoParams"]; // The retired optimistic-governance flag only keeps its position in the // encoding; `updateDaoIx` fills it in, so callers never set it. export type UpdateDaoParams = Omit< - IdlTypes["UpdateDaoParams"], + IdlTypes["updateDaoParams"], "deprecatedIsOptimisticGovernanceEnabled" >; export type SetSpendingLimitArgs = - IdlTypes["SetSpendingLimitArgs"]; + IdlTypes["setSpendingLimitArgs"]; export type InitializeLargeSpendProposalArgs = - IdlTypes["InitializeLargeSpendProposalArgs"]; + IdlTypes["initializeLargeSpendProposalArgs"]; export type InitializeMintTokensProposalArgs = - IdlTypes["InitializeMintTokensProposalArgs"]; + IdlTypes["initializeMintTokensProposalArgs"]; export type InitializeSpendingLimitChangeProposalArgs = - IdlTypes["InitializeSpendingLimitChangeProposalArgs"]; + IdlTypes["initializeSpendingLimitChangeProposalArgs"]; export type InitializeHostileTakeoverProposalArgs = - IdlTypes["InitializeHostileTakeoverProposalArgs"]; + IdlTypes["initializeHostileTakeoverProposalArgs"]; export type InitializeBuybackTokenProposalArgs = - IdlTypes["InitializeBuybackTokenProposalArgs"]; -export type InstructionParams = IdlTypes["InstructionParams"]; -export type TeamSponsorshipPolicy = - IdlTypes["TeamSponsorshipPolicy"]; + IdlTypes["initializeBuybackTokenProposalArgs"]; export type SpendingLimitAction = - IdlTypes["SpendingLimitAction"]; -export type ProposalAction = IdlTypes["ProposalAction"]; + IdlTypes["spendingLimitAction"]; +export type ProposalAction = IdlTypes["proposalAction"]; export type Dao = IdlAccounts["dao"]; export type Proposal = IdlAccounts["proposal"]; -export type CollectFeesEvent = IdlEvents["CollectFeesEvent"]; +export type CollectFeesEvent = IdlEvents["collectFeesEvent"]; export type InitializeDaoEvent = - IdlEvents["InitializeDaoEvent"]; -export type UpdateDaoEvent = IdlEvents["UpdateDaoEvent"]; + IdlEvents["initializeDaoEvent"]; +export type UpdateDaoEvent = IdlEvents["updateDaoEvent"]; export type InitializeProposalEvent = - IdlEvents["InitializeProposalEvent"]; + IdlEvents["initializeProposalEvent"]; export type StakeToProposalEvent = - IdlEvents["StakeToProposalEvent"]; + IdlEvents["stakeToProposalEvent"]; export type UnstakeFromProposalEvent = - IdlEvents["UnstakeFromProposalEvent"]; + IdlEvents["unstakeFromProposalEvent"]; export type LaunchProposalEvent = - IdlEvents["LaunchProposalEvent"]; + IdlEvents["launchProposalEvent"]; export type FinalizeProposalEvent = - IdlEvents["FinalizeProposalEvent"]; -export type SpotSwapEvent = IdlEvents["SpotSwapEvent"]; + IdlEvents["finalizeProposalEvent"]; +export type SpotSwapEvent = IdlEvents["spotSwapEvent"]; export type ConditionalSwapEvent = - IdlEvents["ConditionalSwapEvent"]; + IdlEvents["conditionalSwapEvent"]; export type ProvideLiquidityEvent = - IdlEvents["ProvideLiquidityEvent"]; + IdlEvents["provideLiquidityEvent"]; export type WithdrawLiquidityEvent = - IdlEvents["WithdrawLiquidityEvent"]; + IdlEvents["withdrawLiquidityEvent"]; export type SponsorProposalEvent = - IdlEvents["SponsorProposalEvent"]; + IdlEvents["sponsorProposalEvent"]; export type RemoveProposalEvent = - IdlEvents["RemoveProposalEvent"]; + IdlEvents["removeProposalEvent"]; export type AdminUpdateProposalParamsEvent = - IdlEvents["AdminUpdateProposalParamsEvent"]; + IdlEvents["adminUpdateProposalParamsEvent"]; export type AdminCancelProposalEvent = - IdlEvents["AdminCancelProposalEvent"]; + IdlEvents["adminCancelProposalEvent"]; export type CollectMeteoraDammFeesEvent = - IdlEvents["CollectMeteoraDammFeesEvent"]; + IdlEvents["collectMeteoraDammFeesEvent"]; export type AdminFixPositionAuthorityEvent = - IdlEvents["AdminFixPositionAuthorityEvent"]; + IdlEvents["adminFixPositionAuthorityEvent"]; export type SetSpendingLimitEvent = - IdlEvents["SetSpendingLimitEvent"]; + IdlEvents["setSpendingLimitEvent"]; export type SyncSpendingLimitEvent = - IdlEvents["SyncSpendingLimitEvent"]; + IdlEvents["syncSpendingLimitEvent"]; export type FutarchyEvent = | CollectFeesEvent | InitializeDaoEvent @@ -107,28 +104,28 @@ export type FutarchyEvent = | SyncSpendingLimitEvent; export type v0_6_0_CollectFeesEvent = - IdlEvents["CollectFeesEvent"]; + IdlEvents["collectFeesEvent"]; export type v0_6_0_InitializeDaoEvent = - IdlEvents["InitializeDaoEvent"]; + IdlEvents["initializeDaoEvent"]; export type v0_6_0_UpdateDaoEvent = - IdlEvents["UpdateDaoEvent"]; + IdlEvents["updateDaoEvent"]; export type v0_6_0_InitializeProposalEvent = - IdlEvents["InitializeProposalEvent"]; + IdlEvents["initializeProposalEvent"]; export type v0_6_0_StakeToProposalEvent = - IdlEvents["StakeToProposalEvent"]; + IdlEvents["stakeToProposalEvent"]; export type v0_6_0_UnstakeFromProposalEvent = - IdlEvents["UnstakeFromProposalEvent"]; + IdlEvents["unstakeFromProposalEvent"]; export type v0_6_0_LaunchProposalEvent = - IdlEvents["LaunchProposalEvent"]; + IdlEvents["launchProposalEvent"]; export type v0_6_0_FinalizeProposalEvent = - IdlEvents["FinalizeProposalEvent"]; -export type v0_6_0_SpotSwapEvent = IdlEvents["SpotSwapEvent"]; + IdlEvents["finalizeProposalEvent"]; +export type v0_6_0_SpotSwapEvent = IdlEvents["spotSwapEvent"]; export type v0_6_0_ConditionalSwapEvent = - IdlEvents["ConditionalSwapEvent"]; + IdlEvents["conditionalSwapEvent"]; export type v0_6_0_ProvideLiquidityEvent = - IdlEvents["ProvideLiquidityEvent"]; + IdlEvents["provideLiquidityEvent"]; export type v0_6_0_WithdrawLiquidityEvent = - IdlEvents["WithdrawLiquidityEvent"]; + IdlEvents["withdrawLiquidityEvent"]; export type v0_6_0_FutarchyEvent = | v0_6_0_CollectFeesEvent | v0_6_0_InitializeDaoEvent @@ -144,42 +141,42 @@ export type v0_6_0_FutarchyEvent = | v0_6_0_WithdrawLiquidityEvent; export type v0_6_1_CollectFeesEvent = - IdlEvents["CollectFeesEvent"]; + IdlEvents["collectFeesEvent"]; export type v0_6_1_InitializeDaoEvent = - IdlEvents["InitializeDaoEvent"]; + IdlEvents["initializeDaoEvent"]; export type v0_6_1_UpdateDaoEvent = - IdlEvents["UpdateDaoEvent"]; + IdlEvents["updateDaoEvent"]; export type v0_6_1_InitializeProposalEvent = - IdlEvents["InitializeProposalEvent"]; + IdlEvents["initializeProposalEvent"]; export type v0_6_1_StakeToProposalEvent = - IdlEvents["StakeToProposalEvent"]; + IdlEvents["stakeToProposalEvent"]; export type v0_6_1_UnstakeFromProposalEvent = - IdlEvents["UnstakeFromProposalEvent"]; + IdlEvents["unstakeFromProposalEvent"]; export type v0_6_1_LaunchProposalEvent = - IdlEvents["LaunchProposalEvent"]; + IdlEvents["launchProposalEvent"]; export type v0_6_1_FinalizeProposalEvent = - IdlEvents["FinalizeProposalEvent"]; -export type v0_6_1_SpotSwapEvent = IdlEvents["SpotSwapEvent"]; + IdlEvents["finalizeProposalEvent"]; +export type v0_6_1_SpotSwapEvent = IdlEvents["spotSwapEvent"]; export type v0_6_1_ConditionalSwapEvent = - IdlEvents["ConditionalSwapEvent"]; + IdlEvents["conditionalSwapEvent"]; export type v0_6_1_ProvideLiquidityEvent = - IdlEvents["ProvideLiquidityEvent"]; + IdlEvents["provideLiquidityEvent"]; export type v0_6_1_WithdrawLiquidityEvent = - IdlEvents["WithdrawLiquidityEvent"]; + IdlEvents["withdrawLiquidityEvent"]; export type v0_6_1_SponsorProposalEvent = - IdlEvents["SponsorProposalEvent"]; + IdlEvents["sponsorProposalEvent"]; export type v0_6_1_RemoveProposalEvent = - IdlEvents["RemoveProposalEvent"]; + IdlEvents["removeProposalEvent"]; export type v0_6_1_AdminCancelProposalEvent = - IdlEvents["AdminCancelProposalEvent"]; + IdlEvents["adminCancelProposalEvent"]; export type v0_6_1_CollectMeteoraDammFeesEvent = - IdlEvents["CollectMeteoraDammFeesEvent"]; + IdlEvents["collectMeteoraDammFeesEvent"]; export type v0_6_1_AdminFixPositionAuthorityEvent = - IdlEvents["AdminFixPositionAuthorityEvent"]; + IdlEvents["adminFixPositionAuthorityEvent"]; export type v0_6_1_InitiateVaultSpendOptimisticProposalEvent = - IdlEvents["InitiateVaultSpendOptimisticProposalEvent"]; + IdlEvents["initiateVaultSpendOptimisticProposalEvent"]; export type v0_6_1_FinalizeOptimisticProposalEvent = - IdlEvents["FinalizeOptimisticProposalEvent"]; + IdlEvents["finalizeOptimisticProposalEvent"]; export type v0_6_1_FutarchyEvent = | v0_6_1_CollectFeesEvent | v0_6_1_InitializeDaoEvent diff --git a/sdk/src/futarchy/v0.6/types/v0.6.0-futarchy.json b/sdk/src/futarchy/v0.6/types/v0.6.0-futarchy.json new file mode 100644 index 000000000..58f806ac8 --- /dev/null +++ b/sdk/src/futarchy/v0.6/types/v0.6.0-futarchy.json @@ -0,0 +1,2709 @@ +{ + "address": "FUTARELBfJfQ8RDGhg1wdhddq1odMAJUePHFuBYfUxKq", + "metadata": { + "name": "futarchy", + "version": "0.6.0", + "spec": "0.1.0" + }, + "instructions": [ + { + "name": "initialize_dao", + "discriminator": [ + 128, + 226, + 96, + 90, + 39, + 56, + 24, + 196 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "dao_creator", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program" + }, + { + "name": "base_mint" + }, + { + "name": "quote_mint" + }, + { + "name": "squads_multisig", + "writable": true + }, + { + "name": "squads_multisig_vault" + }, + { + "name": "squads_program" + }, + { + "name": "squads_program_config" + }, + { + "name": "squads_program_config_treasury", + "writable": true + }, + { + "name": "spending_limit", + "writable": true + }, + { + "name": "futarchy_amm_base_vault", + "writable": true + }, + { + "name": "futarchy_amm_quote_vault", + "writable": true + }, + { + "name": "token_program" + }, + { + "name": "associated_token_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "InitializeDaoParams" + } + } + } + ] + }, + { + "name": "initialize_proposal", + "discriminator": [ + 50, + 73, + 156, + 98, + 129, + 149, + 21, + 158 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "squads_proposal" + }, + { + "name": "dao", + "writable": true + }, + { + "name": "question" + }, + { + "name": "quote_vault" + }, + { + "name": "base_vault" + }, + { + "name": "proposer", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "stake_to_proposal", + "discriminator": [ + 10, + 169, + 175, + 238, + 80, + 221, + 37, + 16 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "dao", + "writable": true + }, + { + "name": "staker_base_account", + "writable": true + }, + { + "name": "proposal_base_account", + "writable": true + }, + { + "name": "stake_account", + "writable": true + }, + { + "name": "staker", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "token_program" + }, + { + "name": "associated_token_program" + }, + { + "name": "system_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "StakeToProposalParams" + } + } + } + ] + }, + { + "name": "unstake_from_proposal", + "discriminator": [ + 179, + 220, + 186, + 86, + 2, + 96, + 50, + 161 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "dao", + "writable": true + }, + { + "name": "staker_base_account", + "writable": true + }, + { + "name": "proposal_base_account", + "writable": true + }, + { + "name": "stake_account", + "writable": true + }, + { + "name": "staker", + "signer": true + }, + { + "name": "token_program" + }, + { + "name": "associated_token_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "UnstakeFromProposalParams" + } + } + } + ] + }, + { + "name": "launch_proposal", + "discriminator": [ + 16, + 211, + 189, + 119, + 245, + 72, + 0, + 229 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "base_vault" + }, + { + "name": "quote_vault" + }, + { + "name": "pass_base_mint" + }, + { + "name": "pass_quote_mint" + }, + { + "name": "fail_base_mint" + }, + { + "name": "fail_quote_mint" + }, + { + "name": "dao", + "writable": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "amm_pass_base_vault", + "writable": true + }, + { + "name": "amm_pass_quote_vault", + "writable": true + }, + { + "name": "amm_fail_base_vault", + "writable": true + }, + { + "name": "amm_fail_quote_vault", + "writable": true + }, + { + "name": "system_program" + }, + { + "name": "token_program" + }, + { + "name": "associated_token_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "finalize_proposal", + "discriminator": [ + 23, + 68, + 51, + 167, + 109, + 173, + 187, + 164 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "dao", + "writable": true + }, + { + "name": "question", + "writable": true + }, + { + "name": "squads_proposal", + "writable": true + }, + { + "name": "squads_multisig" + }, + { + "name": "squads_multisig_program" + }, + { + "name": "amm_pass_base_vault", + "writable": true + }, + { + "name": "amm_pass_quote_vault", + "writable": true + }, + { + "name": "amm_fail_base_vault", + "writable": true + }, + { + "name": "amm_fail_quote_vault", + "writable": true + }, + { + "name": "amm_base_vault", + "writable": true + }, + { + "name": "amm_quote_vault", + "writable": true + }, + { + "name": "vault_program" + }, + { + "name": "vault_event_authority" + }, + { + "name": "token_program" + }, + { + "name": "quote_vault", + "writable": true + }, + { + "name": "quote_vault_underlying_token_account", + "writable": true + }, + { + "name": "pass_quote_mint", + "writable": true + }, + { + "name": "fail_quote_mint", + "writable": true + }, + { + "name": "pass_base_mint", + "writable": true + }, + { + "name": "fail_base_mint", + "writable": true + }, + { + "name": "base_vault", + "writable": true + }, + { + "name": "base_vault_underlying_token_account", + "writable": true + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "update_dao", + "discriminator": [ + 131, + 72, + 75, + 25, + 112, + 210, + 109, + 2 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "squads_multisig_vault", + "signer": true + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "dao_params", + "type": { + "defined": { + "name": "UpdateDaoParams" + } + } + } + ] + }, + { + "name": "spot_swap", + "discriminator": [ + 167, + 97, + 12, + 231, + 237, + 78, + 166, + 251 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "user_base_account", + "writable": true + }, + { + "name": "user_quote_account", + "writable": true + }, + { + "name": "amm_base_vault", + "writable": true + }, + { + "name": "amm_quote_vault", + "writable": true + }, + { + "name": "user", + "signer": true + }, + { + "name": "token_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "SpotSwapParams" + } + } + } + ] + }, + { + "name": "conditional_swap", + "discriminator": [ + 194, + 136, + 220, + 89, + 242, + 169, + 130, + 157 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "amm_base_vault", + "writable": true + }, + { + "name": "amm_quote_vault", + "writable": true + }, + { + "name": "proposal" + }, + { + "name": "amm_pass_base_vault", + "writable": true + }, + { + "name": "amm_pass_quote_vault", + "writable": true + }, + { + "name": "amm_fail_base_vault", + "writable": true + }, + { + "name": "amm_fail_quote_vault", + "writable": true + }, + { + "name": "trader", + "signer": true + }, + { + "name": "user_input_account", + "writable": true + }, + { + "name": "user_output_account", + "writable": true + }, + { + "name": "base_vault", + "writable": true + }, + { + "name": "base_vault_underlying_token_account", + "writable": true + }, + { + "name": "quote_vault", + "writable": true + }, + { + "name": "quote_vault_underlying_token_account", + "writable": true + }, + { + "name": "pass_base_mint", + "writable": true + }, + { + "name": "fail_base_mint", + "writable": true + }, + { + "name": "pass_quote_mint", + "writable": true + }, + { + "name": "fail_quote_mint", + "writable": true + }, + { + "name": "conditional_vault_program" + }, + { + "name": "vault_event_authority" + }, + { + "name": "question" + }, + { + "name": "token_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "ConditionalSwapParams" + } + } + } + ] + }, + { + "name": "provide_liquidity", + "discriminator": [ + 40, + 110, + 107, + 116, + 174, + 127, + 97, + 204 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "liquidity_provider", + "signer": true + }, + { + "name": "liquidity_provider_base_account", + "writable": true + }, + { + "name": "liquidity_provider_quote_account", + "writable": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program" + }, + { + "name": "amm_base_vault", + "writable": true + }, + { + "name": "amm_quote_vault", + "writable": true + }, + { + "name": "amm_position", + "writable": true + }, + { + "name": "token_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "ProvideLiquidityParams" + } + } + } + ] + }, + { + "name": "withdraw_liquidity", + "discriminator": [ + 149, + 158, + 33, + 185, + 47, + 243, + 253, + 31 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "position_authority", + "signer": true + }, + { + "name": "liquidity_provider_base_account", + "writable": true + }, + { + "name": "liquidity_provider_quote_account", + "writable": true + }, + { + "name": "amm_base_vault", + "writable": true + }, + { + "name": "amm_quote_vault", + "writable": true + }, + { + "name": "amm_position", + "writable": true + }, + { + "name": "token_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "WithdrawLiquidityParams" + } + } + } + ] + }, + { + "name": "collect_fees", + "discriminator": [ + 164, + 152, + 207, + 99, + 30, + 186, + 19, + 182 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "admin", + "signer": true + }, + { + "name": "base_token_account", + "writable": true + }, + { + "name": "quote_token_account", + "writable": true + }, + { + "name": "amm_base_vault", + "writable": true + }, + { + "name": "amm_quote_vault", + "writable": true + }, + { + "name": "token_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "execute_spending_limit_change", + "discriminator": [ + 146, + 175, + 145, + 31, + 184, + 129, + 252, + 79 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "dao", + "writable": true + }, + { + "name": "squads_proposal", + "writable": true + }, + { + "name": "squads_multisig" + }, + { + "name": "squads_multisig_program" + }, + { + "name": "vault_transaction" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + } + ], + "accounts": [ + { + "name": "AmmPosition", + "discriminator": [ + 34, + 97, + 105, + 74, + 17, + 226, + 212, + 0 + ] + }, + { + "name": "Dao", + "discriminator": [ + 163, + 9, + 47, + 31, + 52, + 85, + 197, + 49 + ] + }, + { + "name": "Proposal", + "discriminator": [ + 26, + 94, + 189, + 187, + 116, + 136, + 53, + 33 + ] + }, + { + "name": "StakeAccount", + "discriminator": [ + 80, + 158, + 67, + 124, + 50, + 189, + 192, + 255 + ] + } + ], + "events": [ + { + "name": "CollectFeesEvent", + "discriminator": [ + 226, + 2, + 53, + 67, + 132, + 158, + 125, + 173 + ] + }, + { + "name": "InitializeDaoEvent", + "discriminator": [ + 119, + 48, + 153, + 116, + 127, + 37, + 226, + 228 + ] + }, + { + "name": "UpdateDaoEvent", + "discriminator": [ + 12, + 58, + 244, + 224, + 171, + 25, + 33, + 56 + ] + }, + { + "name": "InitializeProposalEvent", + "discriminator": [ + 141, + 56, + 246, + 192, + 168, + 254, + 64, + 111 + ] + }, + { + "name": "StakeToProposalEvent", + "discriminator": [ + 94, + 69, + 68, + 151, + 90, + 149, + 240, + 191 + ] + }, + { + "name": "UnstakeFromProposalEvent", + "discriminator": [ + 89, + 129, + 63, + 211, + 55, + 33, + 194, + 171 + ] + }, + { + "name": "LaunchProposalEvent", + "discriminator": [ + 177, + 55, + 191, + 93, + 203, + 124, + 184, + 11 + ] + }, + { + "name": "FinalizeProposalEvent", + "discriminator": [ + 45, + 29, + 122, + 181, + 79, + 224, + 57, + 141 + ] + }, + { + "name": "SpotSwapEvent", + "discriminator": [ + 29, + 253, + 121, + 255, + 82, + 60, + 148, + 195 + ] + }, + { + "name": "ConditionalSwapEvent", + "discriminator": [ + 2, + 166, + 200, + 160, + 94, + 212, + 68, + 45 + ] + }, + { + "name": "ProvideLiquidityEvent", + "discriminator": [ + 38, + 2, + 37, + 238, + 229, + 214, + 255, + 235 + ] + }, + { + "name": "WithdrawLiquidityEvent", + "discriminator": [ + 214, + 6, + 161, + 45, + 191, + 142, + 124, + 186 + ] + } + ], + "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" + } + ], + "types": [ + { + "name": "CommonFields", + "type": { + "kind": "struct", + "fields": [ + { + "name": "slot", + "type": "u64" + }, + { + "name": "unix_timestamp", + "type": "i64" + }, + { + "name": "dao_seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "ConditionalSwapParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "market", + "type": { + "defined": { + "name": "Market" + } + } + }, + { + "name": "swap_type", + "type": { + "defined": { + "name": "SwapType" + } + } + }, + { + "name": "input_amount", + "type": "u64" + }, + { + "name": "min_output_amount", + "type": "u64" + } + ] + } + }, + { + "name": "InitializeDaoParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "twap_initial_observation", + "type": "u128" + }, + { + "name": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "twap_start_delay_seconds", + "type": "u32" + }, + { + "name": "min_quote_futarchic_liquidity", + "type": "u64" + }, + { + "name": "min_base_futarchic_liquidity", + "type": "u64" + }, + { + "name": "base_to_stake", + "type": "u64" + }, + { + "name": "pass_threshold_bps", + "type": "u16" + }, + { + "name": "seconds_per_proposal", + "type": "u32" + }, + { + "name": "nonce", + "type": "u64" + }, + { + "name": "initial_spending_limit", + "type": { + "option": { + "defined": { + "name": "InitialSpendingLimit" + } + } + } + } + ] + } + }, + { + "name": "ProvideLiquidityParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "quote_amount", + "docs": [ + "How much quote token you will deposit to the pool" + ], + "type": "u64" + }, + { + "name": "max_base_amount", + "docs": [ + "The maximum base token you will deposit to the pool" + ], + "type": "u64" + }, + { + "name": "min_liquidity", + "docs": [ + "The minimum liquidity you will be assigned" + ], + "type": "u128" + }, + { + "name": "position_authority", + "docs": [ + "The account that will own the LP position, usually the same as the", + "liquidity provider" + ], + "type": "pubkey" + } + ] + } + }, + { + "name": "SpotSwapParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "input_amount", + "type": "u64" + }, + { + "name": "swap_type", + "type": { + "defined": { + "name": "SwapType" + } + } + }, + { + "name": "min_output_amount", + "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": "pass_threshold_bps", + "type": { + "option": "u16" + } + }, + { + "name": "seconds_per_proposal", + "type": { + "option": "u32" + } + }, + { + "name": "twap_initial_observation", + "type": { + "option": "u128" + } + }, + { + "name": "twap_max_observation_change_per_update", + "type": { + "option": "u128" + } + }, + { + "name": "min_quote_futarchic_liquidity", + "type": { + "option": "u64" + } + }, + { + "name": "min_base_futarchic_liquidity", + "type": { + "option": "u64" + } + }, + { + "name": "base_to_stake", + "type": { + "option": "u64" + } + } + ] + } + }, + { + "name": "WithdrawLiquidityParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "liquidity_to_withdraw", + "docs": [ + "How much liquidity to withdraw" + ], + "type": "u128" + }, + { + "name": "min_base_amount", + "docs": [ + "Minimum base tokens to receive" + ], + "type": "u64" + }, + { + "name": "min_quote_amount", + "docs": [ + "Minimum quote tokens to receive" + ], + "type": "u64" + } + ] + } + }, + { + "name": "InitialSpendingLimit", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amount_per_month", + "type": "u64" + }, + { + "name": "members", + "type": { + "vec": "pubkey" + } + } + ] + } + }, + { + "name": "FutarchyAmm", + "type": { + "kind": "struct", + "fields": [ + { + "name": "state", + "type": { + "defined": { + "name": "PoolState" + } + } + }, + { + "name": "total_liquidity", + "type": "u128" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "amm_base_vault", + "type": "pubkey" + }, + { + "name": "amm_quote_vault", + "type": "pubkey" + } + ] + } + }, + { + "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": "last_updated_timestamp", + "type": "i64" + }, + { + "name": "created_at_timestamp", + "type": "i64" + }, + { + "name": "last_price", + "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": "last_observation", + "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": "max_observation_change_per_update", + "docs": [ + "The most that an observation can change per update." + ], + "type": "u128" + }, + { + "name": "initial_observation", + "docs": [ + "What the initial `latest_observation` is set to." + ], + "type": "u128" + }, + { + "name": "start_delay_seconds", + "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": { + "name": "TwapOracle" + } + } + }, + { + "name": "quote_reserves", + "type": "u64" + }, + { + "name": "base_reserves", + "type": "u64" + }, + { + "name": "quote_protocol_fee_balance", + "type": "u64" + }, + { + "name": "base_protocol_fee_balance", + "type": "u64" + } + ] + } + }, + { + "name": "PoolState", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Spot", + "fields": [ + { + "name": "spot", + "type": { + "defined": { + "name": "Pool" + } + } + } + ] + }, + { + "name": "Futarchy", + "fields": [ + { + "name": "spot", + "type": { + "defined": { + "name": "Pool" + } + } + }, + { + "name": "pass", + "type": { + "defined": { + "name": "Pool" + } + } + }, + { + "name": "fail", + "type": { + "defined": { + "name": "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": "amount_staked", + "type": "u64" + } + ] + }, + { + "name": "Pending" + }, + { + "name": "Passed" + }, + { + "name": "Failed" + } + ] + } + }, + { + "name": "AmmPosition", + "type": { + "kind": "struct", + "fields": [ + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "position_authority", + "type": "pubkey" + }, + { + "name": "liquidity", + "type": "u128" + } + ] + } + }, + { + "name": "Dao", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amm", + "docs": [ + "Embedded FutarchyAmm - 1:1 relationship" + ], + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + }, + { + "name": "nonce", + "docs": [ + "`nonce` + `dao_creator` are PDA seeds" + ], + "type": "u64" + }, + { + "name": "dao_creator", + "type": "pubkey" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "squads_multisig", + "type": "pubkey" + }, + { + "name": "squads_multisig_vault", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "proposal_count", + "type": "u32" + }, + { + "name": "pass_threshold_bps", + "type": "u16" + }, + { + "name": "seconds_per_proposal", + "type": "u32" + }, + { + "name": "twap_initial_observation", + "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": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "twap_start_delay_seconds", + "docs": [ + "Forces TWAP calculation to start after `twap_start_delay_seconds` seconds" + ], + "type": "u32" + }, + { + "name": "min_quote_futarchic_liquidity", + "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": "min_base_futarchic_liquidity", + "type": "u64" + }, + { + "name": "base_to_stake", + "docs": [ + "Minimum amount of base tokens that must be staked to launch a proposal" + ], + "type": "u64" + }, + { + "name": "seq_num", + "type": "u64" + }, + { + "name": "initial_spending_limit", + "type": { + "option": { + "defined": { + "name": "InitialSpendingLimit" + } + } + } + } + ] + } + }, + { + "name": "Proposal", + "type": { + "kind": "struct", + "fields": [ + { + "name": "number", + "type": "u32" + }, + { + "name": "proposer", + "type": "pubkey" + }, + { + "name": "timestamp_enqueued", + "type": "i64" + }, + { + "name": "state", + "type": { + "defined": { + "name": "ProposalState" + } + } + }, + { + "name": "base_vault", + "type": "pubkey" + }, + { + "name": "quote_vault", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "question", + "type": "pubkey" + }, + { + "name": "duration_in_seconds", + "type": "u32" + }, + { + "name": "squads_proposal", + "type": "pubkey" + }, + { + "name": "pass_base_mint", + "type": "pubkey" + }, + { + "name": "pass_quote_mint", + "type": "pubkey" + }, + { + "name": "fail_base_mint", + "type": "pubkey" + }, + { + "name": "fail_quote_mint", + "type": "pubkey" + } + ] + } + }, + { + "name": "StakeAccount", + "type": { + "kind": "struct", + "fields": [ + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "staker", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "bump", + "type": "u8" + } + ] + } + }, + { + "name": "CollectFeesEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "base_token_account", + "type": "pubkey" + }, + { + "name": "quote_token_account", + "type": "pubkey" + }, + { + "name": "amm_base_vault", + "type": "pubkey" + }, + { + "name": "amm_quote_vault", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_fees_collected", + "type": "u64" + }, + { + "name": "base_fees_collected", + "type": "u64" + }, + { + "name": "post_amm_state", + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + } + ] + } + }, + { + "name": "InitializeDaoEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "pass_threshold_bps", + "type": "u16" + }, + { + "name": "seconds_per_proposal", + "type": "u32" + }, + { + "name": "twap_initial_observation", + "type": "u128" + }, + { + "name": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "min_quote_futarchic_liquidity", + "type": "u64" + }, + { + "name": "min_base_futarchic_liquidity", + "type": "u64" + }, + { + "name": "base_to_stake", + "type": "u64" + }, + { + "name": "initial_spending_limit", + "type": { + "option": { + "defined": { + "name": "InitialSpendingLimit" + } + } + } + }, + { + "name": "squads_multisig", + "type": "pubkey" + }, + { + "name": "squads_multisig_vault", + "type": "pubkey" + } + ] + } + }, + { + "name": "UpdateDaoEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "pass_threshold_bps", + "type": "u16" + }, + { + "name": "seconds_per_proposal", + "type": "u32" + }, + { + "name": "twap_initial_observation", + "type": "u128" + }, + { + "name": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "min_quote_futarchic_liquidity", + "type": "u64" + }, + { + "name": "min_base_futarchic_liquidity", + "type": "u64" + }, + { + "name": "base_to_stake", + "type": "u64" + } + ] + } + }, + { + "name": "InitializeProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "question", + "type": "pubkey" + }, + { + "name": "quote_vault", + "type": "pubkey" + }, + { + "name": "base_vault", + "type": "pubkey" + }, + { + "name": "proposer", + "type": "pubkey" + }, + { + "name": "number", + "type": "u32" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "duration_in_seconds", + "type": "u32" + }, + { + "name": "squads_proposal", + "type": "pubkey" + }, + { + "name": "squads_multisig", + "type": "pubkey" + }, + { + "name": "squads_multisig_vault", + "type": "pubkey" + } + ] + } + }, + { + "name": "StakeToProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "staker", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "total_staked", + "type": "u64" + } + ] + } + }, + { + "name": "UnstakeFromProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "staker", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "total_staked", + "type": "u64" + } + ] + } + }, + { + "name": "LaunchProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "total_staked", + "type": "u64" + }, + { + "name": "post_amm_state", + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + } + ] + } + }, + { + "name": "FinalizeProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "pass_market_twap", + "type": "u128" + }, + { + "name": "fail_market_twap", + "type": "u128" + }, + { + "name": "threshold", + "type": "u128" + }, + { + "name": "state", + "type": { + "defined": { + "name": "ProposalState" + } + } + }, + { + "name": "squads_proposal", + "type": "pubkey" + }, + { + "name": "squads_multisig", + "type": "pubkey" + }, + { + "name": "post_amm_state", + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + } + ] + } + }, + { + "name": "SpotSwapEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "swap_type", + "type": { + "defined": { + "name": "SwapType" + } + } + }, + { + "name": "input_amount", + "type": "u64" + }, + { + "name": "output_amount", + "type": "u64" + }, + { + "name": "min_output_amount", + "type": "u64" + }, + { + "name": "post_amm_state", + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + } + ] + } + }, + { + "name": "ConditionalSwapEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "trader", + "type": "pubkey" + }, + { + "name": "market", + "type": { + "defined": { + "name": "Market" + } + } + }, + { + "name": "swap_type", + "type": { + "defined": { + "name": "SwapType" + } + } + }, + { + "name": "input_amount", + "type": "u64" + }, + { + "name": "output_amount", + "type": "u64" + }, + { + "name": "min_output_amount", + "type": "u64" + }, + { + "name": "post_amm_state", + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + } + ] + } + }, + { + "name": "ProvideLiquidityEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "liquidity_provider", + "type": "pubkey" + }, + { + "name": "position_authority", + "type": "pubkey" + }, + { + "name": "quote_amount", + "type": "u64" + }, + { + "name": "base_amount", + "type": "u64" + }, + { + "name": "liquidity_minted", + "type": "u128" + }, + { + "name": "min_liquidity", + "type": "u128" + }, + { + "name": "post_amm_state", + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + } + ] + } + }, + { + "name": "WithdrawLiquidityEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "liquidity_provider", + "type": "pubkey" + }, + { + "name": "liquidity_withdrawn", + "type": "u128" + }, + { + "name": "min_base_amount", + "type": "u64" + }, + { + "name": "min_quote_amount", + "type": "u64" + }, + { + "name": "base_amount", + "type": "u64" + }, + { + "name": "quote_amount", + "type": "u64" + }, + { + "name": "post_amm_state", + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + } + ] + } + } + ] +} \ No newline at end of file diff --git a/sdk/src/futarchy/v0.6/types/v0.6.0-futarchy.ts b/sdk/src/futarchy/v0.6/types/v0.6.0-futarchy.ts index 210888785..803cbdfd2 100644 --- a/sdk/src/futarchy/v0.6/types/v0.6.0-futarchy.ts +++ b/sdk/src/futarchy/v0.6/types/v0.6.0-futarchy.ts @@ -1,992 +1,795 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL was converted from the legacy format with `anchor idl convert` and lives in + * the `.json` file next to this one. + */ export type Futarchy = { - version: "0.6.0"; - name: "futarchy"; + address: "FUTARELBfJfQ8RDGhg1wdhddq1odMAJUePHFuBYfUxKq"; + metadata: { + name: "futarchy"; + version: "0.6.0"; + spec: "0.1.0"; + }; instructions: [ { name: "initializeDao"; + discriminator: [128, 226, 96, 90, 39, 56, 24, 196]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "daoCreator"; - isMut: false; - isSigner: true; + signer: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: 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; + writable: true; }, { name: "squadsMultisigVault"; - isMut: false; - isSigner: false; }, { name: "squadsProgram"; - isMut: false; - isSigner: false; }, { name: "squadsProgramConfig"; - isMut: false; - isSigner: false; }, { name: "squadsProgramConfigTreasury"; - isMut: true; - isSigner: false; + writable: true; }, { name: "spendingLimit"; - isMut: true; - isSigner: false; + writable: true; }, { name: "futarchyAmmBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "futarchyAmmQuoteVault"; - isMut: true; - isSigner: false; + writable: 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: "InitializeDaoParams"; + defined: { + name: "initializeDaoParams"; + }; }; }, ]; }, { name: "initializeProposal"; + discriminator: [50, 73, 156, 98, 129, 149, 21, 158]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsProposal"; - isMut: false; - isSigner: false; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "question"; - isMut: false; - isSigner: false; }, { name: "quoteVault"; - isMut: false; - isSigner: false; }, { name: "baseVault"; - isMut: false; - isSigner: false; }, { name: "proposer"; - isMut: false; - isSigner: true; + signer: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "systemProgram"; - isMut: false; - isSigner: false; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "stakeToProposal"; + discriminator: [10, 169, 175, 238, 80, 221, 37, 16]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "stakerBaseAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "proposalBaseAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "stakeAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "staker"; - isMut: false; - isSigner: true; + signer: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: 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"; + defined: { + name: "stakeToProposalParams"; + }; }; }, ]; }, { name: "unstakeFromProposal"; + discriminator: [179, 220, 186, 86, 2, 96, 50, 161]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "stakerBaseAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "proposalBaseAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "stakeAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "staker"; - isMut: false; - isSigner: true; + signer: 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"; + defined: { + name: "unstakeFromProposalParams"; + }; }; }, ]; }, { name: "launchProposal"; + discriminator: [16, 211, 189, 119, 245, 72, 0, 229]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { 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; + writable: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "ammPassBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammPassQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammFailBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammFailQuoteVault"; - isMut: true; - isSigner: false; + writable: 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: "finalizeProposal"; + discriminator: [23, 68, 51, 167, 109, 173, 187, 164]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "question"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsProposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisig"; - isMut: false; - isSigner: false; }, { name: "squadsMultisigProgram"; - isMut: false; - isSigner: false; }, { name: "ammPassBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammPassQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammFailBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammFailQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultProgram"; - isMut: false; - isSigner: false; }, { name: "vaultEventAuthority"; - isMut: false; - isSigner: false; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; }, { name: "quoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "quoteVaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "passQuoteMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "failQuoteMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "passBaseMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "failBaseMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "baseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "baseVaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "updateDao"; + discriminator: [131, 72, 75, 25, 112, 210, 109, 2]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisigVault"; - isMut: false; - isSigner: true; + signer: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "daoParams"; type: { - defined: "UpdateDaoParams"; + defined: { + name: "updateDaoParams"; + }; }; }, ]; }, { name: "spotSwap"; + discriminator: [167, 97, 12, 231, 237, 78, 166, 251]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userBaseAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "user"; - isMut: false; - isSigner: true; + signer: 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"; + defined: { + name: "spotSwapParams"; + }; }; }, ]; }, { name: "conditionalSwap"; + discriminator: [194, 136, 220, 89, 242, 169, 130, 157]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "proposal"; - isMut: false; - isSigner: false; }, { name: "ammPassBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammPassQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammFailBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammFailQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "trader"; - isMut: false; - isSigner: true; + signer: true; }, { name: "userInputAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userOutputAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "baseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "baseVaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "quoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "quoteVaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "passBaseMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "failBaseMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "passQuoteMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "failQuoteMint"; - isMut: true; - isSigner: false; + writable: true; }, { 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"; + defined: { + name: "conditionalSwapParams"; + }; }; }, ]; }, { name: "provideLiquidity"; + discriminator: [40, 110, 107, 116, 174, 127, 97, 204]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "liquidityProvider"; - isMut: false; - isSigner: true; + signer: true; }, { name: "liquidityProviderBaseAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "liquidityProviderQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "systemProgram"; - isMut: false; - isSigner: false; }, { name: "ammBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammPosition"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "params"; type: { - defined: "ProvideLiquidityParams"; + defined: { + name: "provideLiquidityParams"; + }; }; }, ]; }, { name: "withdrawLiquidity"; + discriminator: [149, 158, 33, 185, 47, 243, 253, 31]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "positionAuthority"; - isMut: false; - isSigner: true; + signer: true; }, { name: "liquidityProviderBaseAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "liquidityProviderQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammPosition"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "params"; type: { - defined: "WithdrawLiquidityParams"; + defined: { + name: "withdrawLiquidityParams"; + }; }; }, ]; }, { name: "collectFees"; + discriminator: [164, 152, 207, 99, 30, 186, 19, 182]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "admin"; - isMut: false; - isSigner: true; + signer: true; }, { name: "baseTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "quoteTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "executeSpendingLimitChange"; + discriminator: [146, 175, 145, 31, 184, 129, 252, 79]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsProposal"; - isMut: true; - isSigner: false; + writable: true; }, { 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: []; @@ -995,68 +798,314 @@ export type Futarchy = { accounts: [ { name: "ammPosition"; + discriminator: [34, 97, 105, 74, 17, 226, 212, 0]; + }, + { + name: "dao"; + discriminator: [163, 9, 47, 31, 52, 85, 197, 49]; + }, + { + name: "proposal"; + discriminator: [26, 94, 189, 187, 116, 136, 53, 33]; + }, + { + name: "stakeAccount"; + discriminator: [80, 158, 67, 124, 50, 189, 192, 255]; + }, + ]; + events: [ + { + name: "collectFeesEvent"; + discriminator: [226, 2, 53, 67, 132, 158, 125, 173]; + }, + { + name: "initializeDaoEvent"; + discriminator: [119, 48, 153, 116, 127, 37, 226, 228]; + }, + { + name: "updateDaoEvent"; + discriminator: [12, 58, 244, 224, 171, 25, 33, 56]; + }, + { + name: "initializeProposalEvent"; + discriminator: [141, 56, 246, 192, 168, 254, 64, 111]; + }, + { + name: "stakeToProposalEvent"; + discriminator: [94, 69, 68, 151, 90, 149, 240, 191]; + }, + { + name: "unstakeFromProposalEvent"; + discriminator: [89, 129, 63, 211, 55, 33, 194, 171]; + }, + { + name: "launchProposalEvent"; + discriminator: [177, 55, 191, 93, 203, 124, 184, 11]; + }, + { + name: "finalizeProposalEvent"; + discriminator: [45, 29, 122, 181, 79, 224, 57, 141]; + }, + { + name: "spotSwapEvent"; + discriminator: [29, 253, 121, 255, 82, 60, 148, 195]; + }, + { + name: "conditionalSwapEvent"; + discriminator: [2, 166, 200, 160, 94, 212, 68, 45]; + }, + { + name: "provideLiquidityEvent"; + discriminator: [38, 2, 37, 238, 229, 214, 255, 235]; + }, + { + name: "withdrawLiquidityEvent"; + discriminator: [214, 6, 161, 45, 191, 142, 124, 186]; + }, + ]; + 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"; + }, + ]; + types: [ + { + name: "commonFields"; type: { kind: "struct"; fields: [ { - name: "dao"; - type: "publicKey"; + name: "slot"; + type: "u64"; }, { - name: "positionAuthority"; - type: "publicKey"; + name: "unixTimestamp"; + type: "i64"; }, { - name: "liquidity"; - type: "u128"; + name: "daoSeqNum"; + type: "u64"; }, ]; }; }, { - name: "dao"; + name: "conditionalSwapParams"; type: { kind: "struct"; fields: [ { - name: "amm"; - docs: ["Embedded FutarchyAmm - 1:1 relationship"]; + name: "market"; + type: { + defined: { + name: "market"; + }; + }; + }, + { + name: "swapType"; type: { - defined: "FutarchyAmm"; + defined: { + name: "swapType"; + }; }; }, { - name: "nonce"; - docs: ["`nonce` + `dao_creator` are PDA seeds"]; + name: "inputAmount"; type: "u64"; }, { - name: "daoCreator"; - type: "publicKey"; + name: "minOutputAmount"; + type: "u64"; }, + ]; + }; + }, + { + name: "initializeDaoParams"; + type: { + kind: "struct"; + fields: [ { - name: "pdaBump"; - type: "u8"; + name: "twapInitialObservation"; + type: "u128"; }, { - name: "squadsMultisig"; - type: "publicKey"; + name: "twapMaxObservationChangePerUpdate"; + type: "u128"; }, { - name: "squadsMultisigVault"; - type: "publicKey"; + name: "twapStartDelaySeconds"; + type: "u32"; }, { - name: "baseMint"; - type: "publicKey"; + name: "minQuoteFutarchicLiquidity"; + type: "u64"; }, { - name: "quoteMint"; - type: "publicKey"; + name: "minBaseFutarchicLiquidity"; + type: "u64"; }, { - name: "proposalCount"; - type: "u32"; + name: "baseToStake"; + type: "u64"; }, { name: "passThresholdBps"; @@ -1067,264 +1116,16 @@ export type Futarchy = { 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: "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: "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: "nonce"; + type: "u64"; }, { name: "initialSpendingLimit"; type: { option: { - defined: "InitialSpendingLimit"; + defined: { + name: "initialSpendingLimit"; + }; }; }; }, @@ -1332,7 +1133,7 @@ export type Futarchy = { }; }, { - name: "ProvideLiquidityParams"; + name: "provideLiquidityParams"; type: { kind: "struct"; fields: [ @@ -1357,13 +1158,13 @@ export type Futarchy = { "The account that will own the LP position, usually the same as the", "liquidity provider", ]; - type: "publicKey"; + type: "pubkey"; }, ]; }; }, { - name: "SpotSwapParams"; + name: "spotSwapParams"; type: { kind: "struct"; fields: [ @@ -1374,7 +1175,9 @@ export type Futarchy = { { name: "swapType"; type: { - defined: "SwapType"; + defined: { + name: "swapType"; + }; }; }, { @@ -1385,7 +1188,7 @@ export type Futarchy = { }; }, { - name: "StakeToProposalParams"; + name: "stakeToProposalParams"; type: { kind: "struct"; fields: [ @@ -1397,7 +1200,7 @@ export type Futarchy = { }; }, { - name: "UnstakeFromProposalParams"; + name: "unstakeFromProposalParams"; type: { kind: "struct"; fields: [ @@ -1409,7 +1212,7 @@ export type Futarchy = { }; }, { - name: "UpdateDaoParams"; + name: "updateDaoParams"; type: { kind: "struct"; fields: [ @@ -1459,7 +1262,7 @@ export type Futarchy = { }; }, { - name: "WithdrawLiquidityParams"; + name: "withdrawLiquidityParams"; type: { kind: "struct"; fields: [ @@ -1482,7 +1285,7 @@ export type Futarchy = { }; }, { - name: "InitialSpendingLimit"; + name: "initialSpendingLimit"; type: { kind: "struct"; fields: [ @@ -1493,21 +1296,23 @@ export type Futarchy = { { name: "members"; type: { - vec: "publicKey"; + vec: "pubkey"; }; }, ]; }; }, { - name: "FutarchyAmm"; + name: "futarchyAmm"; type: { kind: "struct"; fields: [ { name: "state"; type: { - defined: "PoolState"; + defined: { + name: "poolState"; + }; }; }, { @@ -1516,25 +1321,25 @@ export type Futarchy = { }, { name: "baseMint"; - type: "publicKey"; + type: "pubkey"; }, { name: "quoteMint"; - type: "publicKey"; + type: "pubkey"; }, { name: "ammBaseVault"; - type: "publicKey"; + type: "pubkey"; }, { name: "ammQuoteVault"; - type: "publicKey"; + type: "pubkey"; }, ]; }; }, { - name: "TwapOracle"; + name: "twapOracle"; type: { kind: "struct"; fields: [ @@ -1606,14 +1411,16 @@ export type Futarchy = { }; }, { - name: "Pool"; + name: "pool"; type: { kind: "struct"; fields: [ { name: "oracle"; type: { - defined: "TwapOracle"; + defined: { + name: "twapOracle"; + }; }; }, { @@ -1636,40 +1443,48 @@ export type Futarchy = { }; }, { - name: "PoolState"; + name: "poolState"; type: { kind: "enum"; variants: [ { - name: "Spot"; + name: "spot"; fields: [ { name: "spot"; type: { - defined: "Pool"; + defined: { + name: "pool"; + }; }; }, ]; }, { - name: "Futarchy"; + name: "futarchy"; fields: [ { name: "spot"; type: { - defined: "Pool"; + defined: { + name: "pool"; + }; }; }, { name: "pass"; type: { - defined: "Pool"; + defined: { + name: "pool"; + }; }; }, { name: "fail"; type: { - defined: "Pool"; + defined: { + name: "pool"; + }; }; }, ]; @@ -1678,57 +1493,57 @@ export type Futarchy = { }; }, { - name: "Market"; + name: "market"; type: { kind: "enum"; variants: [ { - name: "Spot"; + name: "spot"; }, { - name: "Pass"; + name: "pass"; }, { - name: "Fail"; + name: "fail"; }, ]; }; }, { - name: "SwapType"; + name: "swapType"; type: { kind: "enum"; variants: [ { - name: "Buy"; + name: "buy"; }, { - name: "Sell"; + name: "sell"; }, ]; }; }, { - name: "Token"; + name: "token"; type: { kind: "enum"; variants: [ { - name: "Base"; + name: "base"; }, { - name: "Quote"; + name: "quote"; }, ]; }; }, { - name: "ProposalState"; + name: "proposalState"; type: { kind: "enum"; variants: [ { - name: "Draft"; + name: "draft"; fields: [ { name: "amountStaked"; @@ -1737,1904 +1552,94 @@ export type Futarchy = { ]; }, { - name: "Pending"; + name: "pending"; }, { - name: "Passed"; + name: "passed"; }, { - name: "Failed"; + 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: "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: "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: "minQuoteFutarchicLiquidity"; - type: "u64"; - index: false; - }, - { - name: "minBaseFutarchicLiquidity"; - type: "u64"; - index: false; - }, - { - name: "baseToStake"; - 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: "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: "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: "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; - }, - ]; - }, - ]; - 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"; - }, - ]; -}; - -export const IDL: Futarchy = { - version: "0.6.0", - 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: "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: "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: "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: [], - }, - ], - accounts: [ - { - name: "ammPosition", + name: "ammPosition"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "dao", - type: "publicKey", + name: "dao"; + type: "pubkey"; }, { - name: "positionAuthority", - type: "publicKey", + name: "positionAuthority"; + type: "pubkey"; }, { - name: "liquidity", - type: "u128", + name: "liquidity"; + type: "u128"; }, - ], - }, + ]; + }; }, { - name: "dao", + name: "dao"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "amm", - docs: ["Embedded FutarchyAmm - 1:1 relationship"], + name: "amm"; + docs: ["Embedded FutarchyAmm - 1:1 relationship"]; type: { - defined: "FutarchyAmm", - }, + defined: { + name: "futarchyAmm"; + }; + }; }, { - name: "nonce", - docs: ["`nonce` + `dao_creator` are PDA seeds"], - type: "u64", + name: "nonce"; + docs: ["`nonce` + `dao_creator` are PDA seeds"]; + type: "u64"; }, { - name: "daoCreator", - type: "publicKey", + name: "daoCreator"; + type: "pubkey"; }, { - name: "pdaBump", - type: "u8", + name: "pdaBump"; + type: "u8"; }, { - name: "squadsMultisig", - type: "publicKey", + name: "squadsMultisig"; + type: "pubkey"; }, { - name: "squadsMultisigVault", - type: "publicKey", + name: "squadsMultisigVault"; + type: "pubkey"; }, { - name: "baseMint", - type: "publicKey", + name: "baseMint"; + type: "pubkey"; }, { - name: "quoteMint", - type: "publicKey", + name: "quoteMint"; + type: "pubkey"; }, { - name: "proposalCount", - type: "u32", + name: "proposalCount"; + type: "u32"; }, { - name: "passThresholdBps", - type: "u16", + name: "passThresholdBps"; + type: "u16"; }, { - name: "secondsPerProposal", - type: "u32", + name: "secondsPerProposal"; + type: "u32"; }, { - name: "twapInitialObservation", + 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", @@ -3650,22 +1655,22 @@ export const IDL: Futarchy = { "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", + ]; + type: "u128"; }, { - name: "twapMaxObservationChangePerUpdate", - type: "u128", + name: "twapMaxObservationChangePerUpdate"; + type: "u128"; }, { - name: "twapStartDelaySeconds", + name: "twapStartDelaySeconds"; docs: [ "Forces TWAP calculation to start after `twap_start_delay_seconds` seconds", - ], - type: "u32", + ]; + type: "u32"; }, { - name: "minQuoteFutarchicLiquidity", + 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.", @@ -3673,1461 +1678,758 @@ export const IDL: Futarchy = { "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", + ]; + type: "u64"; }, { - name: "minBaseFutarchicLiquidity", - type: "u64", + name: "minBaseFutarchicLiquidity"; + type: "u64"; }, { - name: "baseToStake", + name: "baseToStake"; docs: [ "Minimum amount of base tokens that must be staked to launch a proposal", - ], - type: "u64", + ]; + type: "u64"; }, { - name: "seqNum", - type: "u64", + name: "seqNum"; + type: "u64"; }, { - name: "initialSpendingLimit", + name: "initialSpendingLimit"; type: { option: { - defined: "InitialSpendingLimit", - }, - }, + defined: { + name: "initialSpendingLimit"; + }; + }; + }; }, - ], - }, + ]; + }; }, { - name: "proposal", + name: "proposal"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "number", - type: "u32", + name: "number"; + type: "u32"; }, { - name: "proposer", - type: "publicKey", + name: "proposer"; + type: "pubkey"; }, { - name: "timestampEnqueued", - type: "i64", + name: "timestampEnqueued"; + type: "i64"; }, { - name: "state", + name: "state"; type: { - defined: "ProposalState", - }, + defined: { + name: "proposalState"; + }; + }; }, { - name: "baseVault", - type: "publicKey", + name: "baseVault"; + type: "pubkey"; }, { - name: "quoteVault", - type: "publicKey", + name: "quoteVault"; + type: "pubkey"; }, { - name: "dao", - type: "publicKey", + name: "dao"; + type: "pubkey"; }, { - name: "pdaBump", - type: "u8", + name: "pdaBump"; + type: "u8"; }, { - name: "question", - type: "publicKey", + name: "question"; + type: "pubkey"; }, { - name: "durationInSeconds", - type: "u32", + name: "durationInSeconds"; + type: "u32"; }, { - name: "squadsProposal", - type: "publicKey", + name: "squadsProposal"; + type: "pubkey"; }, { - name: "passBaseMint", - type: "publicKey", + name: "passBaseMint"; + type: "pubkey"; }, { - name: "passQuoteMint", - type: "publicKey", + name: "passQuoteMint"; + type: "pubkey"; }, { - name: "failBaseMint", - type: "publicKey", + name: "failBaseMint"; + type: "pubkey"; }, { - name: "failQuoteMint", - type: "publicKey", + name: "failQuoteMint"; + type: "pubkey"; }, - ], - }, + ]; + }; }, { - name: "stakeAccount", + name: "stakeAccount"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "proposal", - type: "publicKey", + name: "proposal"; + type: "pubkey"; }, { - name: "staker", - type: "publicKey", + name: "staker"; + type: "pubkey"; }, { - name: "amount", - type: "u64", + name: "amount"; + type: "u64"; }, { - name: "bump", - type: "u8", + name: "bump"; + type: "u8"; }, - ], - }, + ]; + }; }, - ], - types: [ { - name: "CommonFields", + name: "collectFeesEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "slot", - type: "u64", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "dao"; + type: "pubkey"; }, { - name: "unixTimestamp", - type: "i64", + name: "baseTokenAccount"; + type: "pubkey"; }, { - name: "daoSeqNum", - type: "u64", + name: "quoteTokenAccount"; + type: "pubkey"; }, - ], - }, - }, - { - name: "ConditionalSwapParams", - type: { - kind: "struct", - fields: [ { - name: "market", - type: { - defined: "Market", - }, + name: "ammBaseVault"; + type: "pubkey"; }, { - name: "swapType", - type: { - defined: "SwapType", - }, + name: "ammQuoteVault"; + type: "pubkey"; + }, + { + name: "quoteMint"; + type: "pubkey"; }, { - name: "inputAmount", - type: "u64", + name: "baseMint"; + type: "pubkey"; + }, + { + name: "quoteFeesCollected"; + type: "u64"; }, { - name: "minOutputAmount", - type: "u64", + name: "baseFeesCollected"; + type: "u64"; + }, + { + name: "postAmmState"; + type: { + defined: { + name: "futarchyAmm"; + }; + }; }, - ], - }, + ]; + }; }, { - name: "InitializeDaoParams", + name: "initializeDaoEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "twapInitialObservation", - type: "u128", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "dao"; + type: "pubkey"; + }, + { + name: "baseMint"; + type: "pubkey"; }, { - name: "twapMaxObservationChangePerUpdate", - type: "u128", + name: "quoteMint"; + type: "pubkey"; }, { - name: "twapStartDelaySeconds", - type: "u32", + name: "passThresholdBps"; + type: "u16"; }, { - name: "minQuoteFutarchicLiquidity", - type: "u64", + name: "secondsPerProposal"; + type: "u32"; }, { - name: "minBaseFutarchicLiquidity", - type: "u64", + name: "twapInitialObservation"; + type: "u128"; }, { - name: "baseToStake", - type: "u64", + name: "twapMaxObservationChangePerUpdate"; + type: "u128"; }, { - name: "passThresholdBps", - type: "u16", + name: "minQuoteFutarchicLiquidity"; + type: "u64"; }, { - name: "secondsPerProposal", - type: "u32", + name: "minBaseFutarchicLiquidity"; + type: "u64"; }, { - name: "nonce", - type: "u64", + name: "baseToStake"; + type: "u64"; }, { - name: "initialSpendingLimit", + name: "initialSpendingLimit"; type: { option: { - defined: "InitialSpendingLimit", - }, - }, + defined: { + name: "initialSpendingLimit"; + }; + }; + }; + }, + { + name: "squadsMultisig"; + type: "pubkey"; + }, + { + name: "squadsMultisigVault"; + type: "pubkey"; }, - ], - }, + ]; + }; }, { - name: "ProvideLiquidityParams", + name: "updateDaoEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "quoteAmount", - docs: ["How much quote token you will deposit to the pool"], - type: "u64", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "maxBaseAmount", - docs: ["The maximum base token you will deposit to the pool"], - type: "u64", + name: "dao"; + type: "pubkey"; }, { - name: "minLiquidity", - docs: ["The minimum liquidity you will be assigned"], - type: "u128", + name: "passThresholdBps"; + type: "u16"; }, { - name: "positionAuthority", - docs: [ - "The account that will own the LP position, usually the same as the", - "liquidity provider", - ], - type: "publicKey", + name: "secondsPerProposal"; + type: "u32"; }, - ], - }, - }, - { - name: "SpotSwapParams", - type: { - kind: "struct", - fields: [ { - name: "inputAmount", - type: "u64", + name: "twapInitialObservation"; + type: "u128"; }, { - name: "swapType", - type: { - defined: "SwapType", - }, + name: "twapMaxObservationChangePerUpdate"; + type: "u128"; }, { - name: "minOutputAmount", - type: "u64", + name: "minQuoteFutarchicLiquidity"; + type: "u64"; }, - ], - }, - }, - { - name: "StakeToProposalParams", - type: { - kind: "struct", - fields: [ { - name: "amount", - type: "u64", + name: "minBaseFutarchicLiquidity"; + type: "u64"; }, - ], - }, - }, - { - name: "UnstakeFromProposalParams", - type: { - kind: "struct", - fields: [ { - name: "amount", - type: "u64", + name: "baseToStake"; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "UpdateDaoParams", + name: "initializeProposalEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "passThresholdBps", + name: "common"; type: { - option: "u16", - }, + defined: { + name: "commonFields"; + }; + }; }, { - name: "secondsPerProposal", - type: { - option: "u32", - }, + name: "proposal"; + type: "pubkey"; }, { - name: "twapInitialObservation", - type: { - option: "u128", - }, + name: "dao"; + type: "pubkey"; }, { - name: "twapMaxObservationChangePerUpdate", - type: { - option: "u128", - }, + name: "question"; + type: "pubkey"; }, { - name: "minQuoteFutarchicLiquidity", - type: { - option: "u64", - }, + name: "quoteVault"; + type: "pubkey"; }, { - name: "minBaseFutarchicLiquidity", - type: { - option: "u64", - }, + name: "baseVault"; + type: "pubkey"; }, { - name: "baseToStake", - type: { - option: "u64", - }, + name: "proposer"; + type: "pubkey"; + }, + { + name: "number"; + type: "u32"; }, - ], - }, - }, - { - name: "WithdrawLiquidityParams", - type: { - kind: "struct", - fields: [ { - name: "liquidityToWithdraw", - docs: ["How much liquidity to withdraw"], - type: "u128", + name: "pdaBump"; + type: "u8"; }, { - name: "minBaseAmount", - docs: ["Minimum base tokens to receive"], - type: "u64", + name: "durationInSeconds"; + type: "u32"; }, { - name: "minQuoteAmount", - docs: ["Minimum quote tokens to receive"], - type: "u64", + name: "squadsProposal"; + type: "pubkey"; }, - ], - }, - }, - { - name: "InitialSpendingLimit", - type: { - kind: "struct", - fields: [ { - name: "amountPerMonth", - type: "u64", + name: "squadsMultisig"; + type: "pubkey"; }, { - name: "members", - type: { - vec: "publicKey", - }, + name: "squadsMultisigVault"; + type: "pubkey"; }, - ], - }, + ]; + }; }, { - name: "FutarchyAmm", + name: "stakeToProposalEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "state", + name: "common"; type: { - defined: "PoolState", - }, - }, - { - name: "totalLiquidity", - type: "u128", + defined: { + name: "commonFields"; + }; + }; }, { - name: "baseMint", - type: "publicKey", + name: "proposal"; + type: "pubkey"; }, { - name: "quoteMint", - type: "publicKey", + name: "staker"; + type: "pubkey"; }, { - name: "ammBaseVault", - type: "publicKey", + name: "amount"; + type: "u64"; }, { - name: "ammQuoteVault", - type: "publicKey", + name: "totalStaked"; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "TwapOracle", + name: "unstakeFromProposalEvent"; type: { - kind: "struct", + 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: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "lastUpdatedTimestamp", - type: "i64", + name: "proposal"; + type: "pubkey"; }, { - name: "createdAtTimestamp", - type: "i64", + name: "staker"; + type: "pubkey"; }, { - 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: "amount"; + type: "u64"; + }, + { + name: "totalStaked"; + type: "u64"; + }, + ]; + }; + }, + { + name: "launchProposalEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - 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: "proposal"; + type: "pubkey"; }, { - name: "maxObservationChangePerUpdate", - docs: ["The most that an observation can change per update."], - type: "u128", + name: "dao"; + type: "pubkey"; }, { - name: "initialObservation", - docs: ["What the initial `latest_observation` is set to."], - type: "u128", + name: "totalStaked"; + type: "u64"; }, { - name: "startDelaySeconds", - docs: [ - "Number of seconds after amm.created_at_slot to start recording TWAP", - ], - type: "u32", + name: "postAmmState"; + type: { + defined: { + name: "futarchyAmm"; + }; + }; }, - ], - }, + ]; + }; }, { - name: "Pool", + name: "finalizeProposalEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "oracle", + name: "common"; type: { - defined: "TwapOracle", - }, + defined: { + name: "commonFields"; + }; + }; }, { - name: "quoteReserves", - type: "u64", + name: "proposal"; + type: "pubkey"; }, { - name: "baseReserves", - type: "u64", + name: "dao"; + type: "pubkey"; }, { - name: "quoteProtocolFeeBalance", - type: "u64", + name: "passMarketTwap"; + type: "u128"; }, { - name: "baseProtocolFeeBalance", - type: "u64", + name: "failMarketTwap"; + type: "u128"; }, - ], - }, - }, - { - name: "PoolState", - type: { - kind: "enum", - variants: [ { - name: "Spot", - fields: [ - { - name: "spot", - type: { - defined: "Pool", - }, - }, - ], + name: "threshold"; + type: "u128"; }, { - name: "Futarchy", - fields: [ - { - name: "spot", - type: { - defined: "Pool", - }, - }, - { - name: "pass", - type: { - defined: "Pool", - }, - }, - { - name: "fail", - type: { - defined: "Pool", - }, - }, - ], + name: "state"; + type: { + defined: { + name: "proposalState"; + }; + }; }, - ], - }, - }, - { - name: "Market", - type: { - kind: "enum", - variants: [ { - name: "Spot", + name: "squadsProposal"; + type: "pubkey"; }, { - name: "Pass", + name: "squadsMultisig"; + type: "pubkey"; }, { - name: "Fail", + name: "postAmmState"; + type: { + defined: { + name: "futarchyAmm"; + }; + }; }, - ], - }, + ]; + }; }, { - name: "SwapType", + name: "spotSwapEvent"; type: { - kind: "enum", - variants: [ + kind: "struct"; + fields: [ { - name: "Buy", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "Sell", + name: "dao"; + type: "pubkey"; }, - ], - }, - }, - { - name: "Token", - type: { - kind: "enum", - variants: [ { - name: "Base", + name: "user"; + type: "pubkey"; }, { - name: "Quote", + name: "swapType"; + type: { + defined: { + name: "swapType"; + }; + }; }, - ], - }, - }, - { - name: "ProposalState", - type: { - kind: "enum", - variants: [ { - name: "Draft", - fields: [ - { - name: "amountStaked", - type: "u64", - }, - ], + name: "inputAmount"; + type: "u64"; }, { - name: "Pending", + name: "outputAmount"; + type: "u64"; }, { - name: "Passed", + name: "minOutputAmount"; + type: "u64"; }, { - name: "Failed", + name: "postAmmState"; + type: { + defined: { + name: "futarchyAmm"; + }; + }; }, - ], - }, + ]; + }; }, - ], - events: [ { - name: "CollectFeesEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "conditionalSwapEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "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", + { + name: "dao"; + type: "pubkey"; }, - index: false, - }, - ], - }, - { - name: "InitializeDaoEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "proposal"; + type: "pubkey"; }, - 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: "minQuoteFutarchicLiquidity", - type: "u64", - index: false, - }, - { - name: "minBaseFutarchicLiquidity", - type: "u64", - index: false, - }, - { - name: "baseToStake", - type: "u64", - index: false, - }, - { - name: "initialSpendingLimit", - type: { - option: { - defined: "InitialSpendingLimit", - }, + { + name: "trader"; + type: "pubkey"; }, - index: false, - }, - { - name: "squadsMultisig", - type: "publicKey", - index: false, - }, - { - name: "squadsMultisigVault", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "UpdateDaoEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "market"; + type: { + defined: { + name: "market"; + }; + }; }, - 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: "minQuoteFutarchicLiquidity", - type: "u64", - index: false, - }, - { - name: "minBaseFutarchicLiquidity", - type: "u64", - index: false, - }, - { - name: "baseToStake", - type: "u64", - index: false, - }, - ], - }, - { - name: "InitializeProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "swapType"; + type: { + defined: { + name: "swapType"; + }; + }; }, - 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", + { + name: "inputAmount"; + type: "u64"; }, - 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", + { + name: "outputAmount"; + type: "u64"; }, - 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", + { + name: "minOutputAmount"; + type: "u64"; }, - index: false, - }, - { - name: "proposal", - type: "publicKey", - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "totalStaked", - type: "u64", - index: false, - }, - { - name: "postAmmState", - type: { - defined: "FutarchyAmm", + { + name: "postAmmState"; + type: { + defined: { + name: "futarchyAmm"; + }; + }; }, - index: false, - }, - ], + ]; + }; }, { - name: "FinalizeProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "provideLiquidityEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "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", + { + name: "dao"; + type: "pubkey"; }, - index: false, - }, - { - name: "squadsProposal", - type: "publicKey", - index: false, - }, - { - name: "squadsMultisig", - type: "publicKey", - index: false, - }, - { - name: "postAmmState", - type: { - defined: "FutarchyAmm", + { + name: "liquidityProvider"; + type: "pubkey"; }, - index: false, - }, - ], - }, - { - name: "SpotSwapEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "positionAuthority"; + type: "pubkey"; }, - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "user", - type: "publicKey", - index: false, - }, - { - name: "swapType", - type: { - defined: "SwapType", + { + name: "quoteAmount"; + type: "u64"; }, - 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", + { + name: "baseAmount"; + type: "u64"; }, - index: false, - }, - ], + { + name: "liquidityMinted"; + type: "u128"; + }, + { + name: "minLiquidity"; + type: "u128"; + }, + { + name: "postAmmState"; + type: { + defined: { + name: "futarchyAmm"; + }; + }; + }, + ]; + }; }, { - name: "ConditionalSwapEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "withdrawLiquidityEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "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", + { + name: "dao"; + type: "pubkey"; }, - index: false, - }, - { - name: "swapType", - type: { - defined: "SwapType", + { + name: "liquidityProvider"; + type: "pubkey"; }, - 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", + { + name: "liquidityWithdrawn"; + type: "u128"; }, - index: false, - }, - ], - }, - { - name: "ProvideLiquidityEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "minBaseAmount"; + type: "u64"; }, - 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", + { + name: "minQuoteAmount"; + type: "u64"; }, - index: false, - }, - ], - }, - { - name: "WithdrawLiquidityEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "baseAmount"; + type: "u64"; }, - 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", + { + name: "quoteAmount"; + type: "u64"; }, - 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", + { + name: "postAmmState"; + type: { + defined: { + name: "futarchyAmm"; + }; + }; + }, + ]; + }; }, - ], + ]; }; diff --git a/sdk/src/futarchy/v0.6/types/v0.6.1-futarchy.json b/sdk/src/futarchy/v0.6/types/v0.6.1-futarchy.json new file mode 100644 index 000000000..8e927df56 --- /dev/null +++ b/sdk/src/futarchy/v0.6/types/v0.6.1-futarchy.json @@ -0,0 +1,4020 @@ +{ + "address": "FUTARELBfJfQ8RDGhg1wdhddq1odMAJUePHFuBYfUxKq", + "metadata": { + "name": "futarchy", + "version": "0.6.1", + "spec": "0.1.0" + }, + "instructions": [ + { + "name": "initialize_dao", + "discriminator": [ + 128, + 226, + 96, + 90, + 39, + 56, + 24, + 196 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "dao_creator", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program" + }, + { + "name": "base_mint" + }, + { + "name": "quote_mint" + }, + { + "name": "squads_multisig", + "writable": true + }, + { + "name": "squads_multisig_vault" + }, + { + "name": "squads_program" + }, + { + "name": "squads_program_config" + }, + { + "name": "squads_program_config_treasury", + "writable": true + }, + { + "name": "spending_limit", + "writable": true + }, + { + "name": "futarchy_amm_base_vault", + "writable": true + }, + { + "name": "futarchy_amm_quote_vault", + "writable": true + }, + { + "name": "token_program" + }, + { + "name": "associated_token_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "InitializeDaoParams" + } + } + } + ] + }, + { + "name": "initialize_proposal", + "discriminator": [ + 50, + 73, + 156, + 98, + 129, + 149, + 21, + 158 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "squads_proposal" + }, + { + "name": "squads_multisig" + }, + { + "name": "dao", + "writable": true + }, + { + "name": "question" + }, + { + "name": "quote_vault" + }, + { + "name": "base_vault" + }, + { + "name": "proposer", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "stake_to_proposal", + "discriminator": [ + 10, + 169, + 175, + 238, + 80, + 221, + 37, + 16 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "dao", + "writable": true + }, + { + "name": "staker_base_account", + "writable": true + }, + { + "name": "proposal_base_account", + "writable": true + }, + { + "name": "stake_account", + "writable": true + }, + { + "name": "staker", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "token_program" + }, + { + "name": "system_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "StakeToProposalParams" + } + } + } + ] + }, + { + "name": "unstake_from_proposal", + "discriminator": [ + 179, + 220, + 186, + 86, + 2, + 96, + 50, + 161 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "dao", + "writable": true + }, + { + "name": "staker_base_account", + "writable": true + }, + { + "name": "proposal_base_account", + "writable": true + }, + { + "name": "stake_account", + "writable": true + }, + { + "name": "base_mint" + }, + { + "name": "staker", + "writable": true, + "signer": true + }, + { + "name": "token_program" + }, + { + "name": "system_program" + }, + { + "name": "associated_token_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "UnstakeFromProposalParams" + } + } + } + ] + }, + { + "name": "launch_proposal", + "discriminator": [ + 16, + 211, + 189, + 119, + 245, + 72, + 0, + 229 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "base_vault" + }, + { + "name": "quote_vault" + }, + { + "name": "pass_base_mint" + }, + { + "name": "pass_quote_mint" + }, + { + "name": "fail_base_mint" + }, + { + "name": "fail_quote_mint" + }, + { + "name": "dao", + "writable": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "amm_pass_base_vault", + "writable": true + }, + { + "name": "amm_pass_quote_vault", + "writable": true + }, + { + "name": "amm_fail_base_vault", + "writable": true + }, + { + "name": "amm_fail_quote_vault", + "writable": true + }, + { + "name": "squads_multisig" + }, + { + "name": "squads_proposal" + }, + { + "name": "system_program" + }, + { + "name": "token_program" + }, + { + "name": "associated_token_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "finalize_proposal", + "discriminator": [ + 23, + 68, + 51, + 167, + 109, + 173, + 187, + 164 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "dao", + "writable": true + }, + { + "name": "question", + "writable": true + }, + { + "name": "squads_proposal", + "writable": true + }, + { + "name": "squads_multisig" + }, + { + "name": "squads_multisig_program" + }, + { + "name": "amm_pass_base_vault", + "writable": true + }, + { + "name": "amm_pass_quote_vault", + "writable": true + }, + { + "name": "amm_fail_base_vault", + "writable": true + }, + { + "name": "amm_fail_quote_vault", + "writable": true + }, + { + "name": "amm_base_vault", + "writable": true + }, + { + "name": "amm_quote_vault", + "writable": true + }, + { + "name": "vault_program" + }, + { + "name": "vault_event_authority" + }, + { + "name": "token_program" + }, + { + "name": "quote_vault", + "writable": true + }, + { + "name": "quote_vault_underlying_token_account", + "writable": true + }, + { + "name": "pass_quote_mint", + "writable": true + }, + { + "name": "fail_quote_mint", + "writable": true + }, + { + "name": "pass_base_mint", + "writable": true + }, + { + "name": "fail_base_mint", + "writable": true + }, + { + "name": "base_vault", + "writable": true + }, + { + "name": "base_vault_underlying_token_account", + "writable": true + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "update_dao", + "discriminator": [ + 131, + 72, + 75, + 25, + 112, + 210, + 109, + 2 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "squads_multisig_vault", + "signer": true + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "dao_params", + "type": { + "defined": { + "name": "UpdateDaoParams" + } + } + } + ] + }, + { + "name": "resize_dao", + "discriminator": [ + 142, + 52, + 68, + 81, + 113, + 14, + 90, + 40 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program" + } + ], + "args": [] + }, + { + "name": "spot_swap", + "discriminator": [ + 167, + 97, + 12, + 231, + 237, + 78, + 166, + 251 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "user_base_account", + "writable": true + }, + { + "name": "user_quote_account", + "writable": true + }, + { + "name": "amm_base_vault", + "writable": true + }, + { + "name": "amm_quote_vault", + "writable": true + }, + { + "name": "user", + "signer": true + }, + { + "name": "token_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "SpotSwapParams" + } + } + } + ] + }, + { + "name": "conditional_swap", + "discriminator": [ + 194, + 136, + 220, + 89, + 242, + 169, + 130, + 157 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "amm_base_vault", + "writable": true + }, + { + "name": "amm_quote_vault", + "writable": true + }, + { + "name": "proposal" + }, + { + "name": "amm_pass_base_vault", + "writable": true + }, + { + "name": "amm_pass_quote_vault", + "writable": true + }, + { + "name": "amm_fail_base_vault", + "writable": true + }, + { + "name": "amm_fail_quote_vault", + "writable": true + }, + { + "name": "trader", + "signer": true + }, + { + "name": "user_input_account", + "writable": true + }, + { + "name": "user_output_account", + "writable": true + }, + { + "name": "base_vault", + "writable": true + }, + { + "name": "base_vault_underlying_token_account", + "writable": true + }, + { + "name": "quote_vault", + "writable": true + }, + { + "name": "quote_vault_underlying_token_account", + "writable": true + }, + { + "name": "pass_base_mint", + "writable": true + }, + { + "name": "fail_base_mint", + "writable": true + }, + { + "name": "pass_quote_mint", + "writable": true + }, + { + "name": "fail_quote_mint", + "writable": true + }, + { + "name": "conditional_vault_program" + }, + { + "name": "vault_event_authority" + }, + { + "name": "question" + }, + { + "name": "token_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "ConditionalSwapParams" + } + } + } + ] + }, + { + "name": "provide_liquidity", + "discriminator": [ + 40, + 110, + 107, + 116, + 174, + 127, + 97, + 204 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "liquidity_provider", + "signer": true + }, + { + "name": "liquidity_provider_base_account", + "writable": true + }, + { + "name": "liquidity_provider_quote_account", + "writable": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program" + }, + { + "name": "amm_base_vault", + "writable": true + }, + { + "name": "amm_quote_vault", + "writable": true + }, + { + "name": "amm_position", + "writable": true + }, + { + "name": "token_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "ProvideLiquidityParams" + } + } + } + ] + }, + { + "name": "withdraw_liquidity", + "discriminator": [ + 149, + 158, + 33, + 185, + 47, + 243, + 253, + 31 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "position_authority", + "signer": true + }, + { + "name": "liquidity_provider_base_account", + "writable": true + }, + { + "name": "liquidity_provider_quote_account", + "writable": true + }, + { + "name": "amm_base_vault", + "writable": true + }, + { + "name": "amm_quote_vault", + "writable": true + }, + { + "name": "amm_position", + "writable": true + }, + { + "name": "token_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "WithdrawLiquidityParams" + } + } + } + ] + }, + { + "name": "collect_fees", + "discriminator": [ + 164, + 152, + 207, + 99, + 30, + 186, + 19, + 182 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "admin", + "signer": true + }, + { + "name": "base_token_account", + "writable": true + }, + { + "name": "quote_token_account", + "writable": true + }, + { + "name": "amm_base_vault", + "writable": true + }, + { + "name": "amm_quote_vault", + "writable": true + }, + { + "name": "token_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "execute_spending_limit_change", + "discriminator": [ + 146, + 175, + 145, + 31, + 184, + 129, + 252, + 79 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "dao", + "writable": true + }, + { + "name": "squads_proposal", + "writable": true + }, + { + "name": "squads_multisig" + }, + { + "name": "squads_multisig_program" + }, + { + "name": "vault_transaction" + } + ], + "args": [] + }, + { + "name": "sponsor_proposal", + "discriminator": [ + 193, + 57, + 170, + 136, + 101, + 196, + 58, + 173 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "dao", + "writable": true + }, + { + "name": "team_address", + "signer": true + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "collect_meteora_damm_fees", + "discriminator": [ + 139, + 212, + 105, + 118, + 126, + 54, + 214, + 143 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "admin", + "writable": true, + "signer": true + }, + { + "name": "squads_multisig", + "writable": true + }, + { + "name": "squads_multisig_vault", + "writable": true + }, + { + "name": "squads_multisig_vault_transaction", + "writable": true + }, + { + "name": "squads_multisig_proposal", + "writable": true + }, + { + "name": "squads_multisig_permissionless_account", + "signer": true + }, + { + "name": "meteora_claim_position_fees_accounts", + "accounts": [ + { + "name": "damm_v2_program" + }, + { + "name": "damm_v2_event_authority" + }, + { + "name": "pool_authority" + }, + { + "name": "pool" + }, + { + "name": "position", + "writable": true + }, + { + "name": "token_a_account", + "docs": [ + "Token account of base tokens recipient" + ], + "writable": true + }, + { + "name": "token_b_account", + "docs": [ + "Token account of quote tokens recipient" + ], + "writable": true + }, + { + "name": "token_a_vault", + "writable": true + }, + { + "name": "token_b_vault", + "writable": true + }, + { + "name": "token_a_mint" + }, + { + "name": "token_b_mint" + }, + { + "name": "position_nft_account" + }, + { + "name": "owner" + }, + { + "name": "token_a_program" + }, + { + "name": "token_b_program" + } + ] + }, + { + "name": "system_program" + }, + { + "name": "token_program" + }, + { + "name": "squads_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "initiate_vault_spend_optimistic_proposal", + "discriminator": [ + 83, + 24, + 40, + 200, + 88, + 239, + 19, + 255 + ], + "accounts": [ + { + "name": "squads_multisig" + }, + { + "name": "squads_multisig_vault" + }, + { + "name": "squads_spending_limit" + }, + { + "name": "squads_proposal" + }, + { + "name": "squads_vault_transaction" + }, + { + "name": "dao", + "writable": true + }, + { + "name": "dao_quote_vault_account" + }, + { + "name": "proposer", + "signer": true + }, + { + "name": "recipient" + }, + { + "name": "recipient_quote_account" + }, + { + "name": "squads_program" + }, + { + "name": "token_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "InitiateVaultSpendOptimisticProposalParams" + } + } + } + ] + }, + { + "name": "finalize_optimistic_proposal", + "discriminator": [ + 71, + 146, + 38, + 160, + 89, + 15, + 48, + 19 + ], + "accounts": [ + { + "name": "squads_multisig", + "writable": true + }, + { + "name": "squads_proposal", + "writable": true + }, + { + "name": "dao", + "writable": true + }, + { + "name": "squads_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "admin_enqueue_multisig_proposal_approval", + "discriminator": [ + 61, + 199, + 241, + 100, + 238, + 220, + 84, + 78 + ], + "accounts": [ + { + "name": "dao" + }, + { + "name": "admin", + "writable": true, + "signer": true + }, + { + "name": "squads_multisig" + }, + { + "name": "squads_multisig_proposal" + }, + { + "name": "enqueued_approval", + "writable": true + }, + { + "name": "system_program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "AdminEnqueueMultisigProposalApprovalArgs" + } + } + } + ] + }, + { + "name": "execute_multisig_proposal_approval", + "discriminator": [ + 124, + 144, + 201, + 164, + 182, + 226, + 193, + 224 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "rent_receiver", + "writable": true, + "signer": true + }, + { + "name": "squads_multisig", + "writable": true + }, + { + "name": "squads_multisig_proposal", + "writable": true + }, + { + "name": "enqueued_approval", + "writable": true + }, + { + "name": "squads_multisig_program" + } + ], + "args": [] + }, + { + "name": "admin_execute_multisig_proposal", + "discriminator": [ + 226, + 221, + 40, + 160, + 169, + 90, + 48, + 42 + ], + "accounts": [ + { + "name": "dao", + "writable": true + }, + { + "name": "admin", + "writable": true, + "signer": true + }, + { + "name": "squads_multisig", + "writable": true + }, + { + "name": "squads_multisig_proposal", + "writable": true + }, + { + "name": "squads_multisig_vault_transaction", + "writable": true + }, + { + "name": "squads_multisig_program" + } + ], + "args": [] + }, + { + "name": "admin_cancel_proposal", + "discriminator": [ + 95, + 233, + 121, + 193, + 90, + 80, + 147, + 255 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "dao", + "writable": true + }, + { + "name": "question", + "writable": true + }, + { + "name": "squads_proposal", + "writable": true + }, + { + "name": "squads_multisig" + }, + { + "name": "squads_multisig_program" + }, + { + "name": "amm_pass_base_vault", + "writable": true + }, + { + "name": "amm_pass_quote_vault", + "writable": true + }, + { + "name": "amm_fail_base_vault", + "writable": true + }, + { + "name": "amm_fail_quote_vault", + "writable": true + }, + { + "name": "amm_base_vault", + "writable": true + }, + { + "name": "amm_quote_vault", + "writable": true + }, + { + "name": "vault_program" + }, + { + "name": "vault_event_authority" + }, + { + "name": "token_program" + }, + { + "name": "quote_vault", + "writable": true + }, + { + "name": "quote_vault_underlying_token_account", + "writable": true + }, + { + "name": "pass_quote_mint", + "writable": true + }, + { + "name": "fail_quote_mint", + "writable": true + }, + { + "name": "pass_base_mint", + "writable": true + }, + { + "name": "fail_base_mint", + "writable": true + }, + { + "name": "base_vault", + "writable": true + }, + { + "name": "base_vault_underlying_token_account", + "writable": true + }, + { + "name": "admin", + "signer": true + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "admin_remove_proposal", + "discriminator": [ + 242, + 199, + 27, + 28, + 7, + 108, + 122, + 73 + ], + "accounts": [ + { + "name": "proposal", + "writable": true + }, + { + "name": "dao", + "writable": true + }, + { + "name": "admin", + "writable": true, + "signer": true + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + } + ], + "accounts": [ + { + "name": "AmmPosition", + "discriminator": [ + 34, + 97, + 105, + 74, + 17, + 226, + 212, + 0 + ] + }, + { + "name": "Dao", + "discriminator": [ + 163, + 9, + 47, + 31, + 52, + 85, + 197, + 49 + ] + }, + { + "name": "OldDao", + "discriminator": [ + 81, + 235, + 225, + 156, + 146, + 147, + 224, + 129 + ] + }, + { + "name": "EnqueuedMultisigProposalApproval", + "discriminator": [ + 172, + 225, + 237, + 72, + 8, + 241, + 28, + 124 + ] + }, + { + "name": "Proposal", + "discriminator": [ + 26, + 94, + 189, + 187, + 116, + 136, + 53, + 33 + ] + }, + { + "name": "StakeAccount", + "discriminator": [ + 80, + 158, + 67, + 124, + 50, + 189, + 192, + 255 + ] + } + ], + "events": [ + { + "name": "CollectFeesEvent", + "discriminator": [ + 226, + 2, + 53, + 67, + 132, + 158, + 125, + 173 + ] + }, + { + "name": "InitializeDaoEvent", + "discriminator": [ + 119, + 48, + 153, + 116, + 127, + 37, + 226, + 228 + ] + }, + { + "name": "UpdateDaoEvent", + "discriminator": [ + 12, + 58, + 244, + 224, + 171, + 25, + 33, + 56 + ] + }, + { + "name": "InitializeProposalEvent", + "discriminator": [ + 141, + 56, + 246, + 192, + 168, + 254, + 64, + 111 + ] + }, + { + "name": "StakeToProposalEvent", + "discriminator": [ + 94, + 69, + 68, + 151, + 90, + 149, + 240, + 191 + ] + }, + { + "name": "UnstakeFromProposalEvent", + "discriminator": [ + 89, + 129, + 63, + 211, + 55, + 33, + 194, + 171 + ] + }, + { + "name": "LaunchProposalEvent", + "discriminator": [ + 177, + 55, + 191, + 93, + 203, + 124, + 184, + 11 + ] + }, + { + "name": "FinalizeProposalEvent", + "discriminator": [ + 45, + 29, + 122, + 181, + 79, + 224, + 57, + 141 + ] + }, + { + "name": "SpotSwapEvent", + "discriminator": [ + 29, + 253, + 121, + 255, + 82, + 60, + 148, + 195 + ] + }, + { + "name": "ConditionalSwapEvent", + "discriminator": [ + 2, + 166, + 200, + 160, + 94, + 212, + 68, + 45 + ] + }, + { + "name": "ProvideLiquidityEvent", + "discriminator": [ + 38, + 2, + 37, + 238, + 229, + 214, + 255, + 235 + ] + }, + { + "name": "WithdrawLiquidityEvent", + "discriminator": [ + 214, + 6, + 161, + 45, + 191, + 142, + 124, + 186 + ] + }, + { + "name": "SponsorProposalEvent", + "discriminator": [ + 202, + 190, + 250, + 176, + 79, + 235, + 77, + 194 + ] + }, + { + "name": "RemoveProposalEvent", + "discriminator": [ + 135, + 152, + 254, + 224, + 208, + 81, + 197, + 215 + ] + }, + { + "name": "AdminCancelProposalEvent", + "discriminator": [ + 118, + 2, + 87, + 75, + 91, + 217, + 71, + 124 + ] + }, + { + "name": "CollectMeteoraDammFeesEvent", + "discriminator": [ + 193, + 114, + 225, + 241, + 209, + 213, + 175, + 85 + ] + }, + { + "name": "AdminFixPositionAuthorityEvent", + "discriminator": [ + 174, + 79, + 62, + 1, + 150, + 182, + 236, + 147 + ] + }, + { + "name": "InitiateVaultSpendOptimisticProposalEvent", + "discriminator": [ + 224, + 194, + 233, + 205, + 198, + 135, + 5, + 90 + ] + }, + { + "name": "FinalizeOptimisticProposalEvent", + "discriminator": [ + 64, + 171, + 35, + 255, + 228, + 201, + 18, + 97 + ] + } + ], + "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 Active 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": "InvalidMint", + "msg": "Base mint and quote mint must be different" + }, + { + "code": 6037, + "name": "ProposalNotReadyToUnstake", + "msg": "Proposal is not ready to be unstaked" + }, + { + "code": 6038, + "name": "OptimisticGovernanceDisabled", + "msg": "Optimistic governance is disabled" + }, + { + "code": 6039, + "name": "ActiveOptimisticProposalAlreadyEnqueued", + "msg": "An active optimistic proposal is already enqueued" + }, + { + "code": 6040, + "name": "OptimisticProposalAlreadyPassed", + "msg": "Optimistic proposal has already passed" + }, + { + "code": 6041, + "name": "InvalidSpendingLimitMint", + "msg": "Invalid spending limit mint. Must be the same as the DAO's quote mint" + }, + { + "code": 6042, + "name": "NoActiveOptimisticProposal", + "msg": "No active optimistic proposal" + } + ], + "types": [ + { + "name": "CommonFields", + "type": { + "kind": "struct", + "fields": [ + { + "name": "slot", + "type": "u64" + }, + { + "name": "unix_timestamp", + "type": "i64" + }, + { + "name": "dao_seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "AdminEnqueueMultisigProposalApprovalArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "transaction_index", + "type": "u64" + } + ] + } + }, + { + "name": "ConditionalSwapParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "market", + "type": { + "defined": { + "name": "Market" + } + } + }, + { + "name": "swap_type", + "type": { + "defined": { + "name": "SwapType" + } + } + }, + { + "name": "input_amount", + "type": "u64" + }, + { + "name": "min_output_amount", + "type": "u64" + } + ] + } + }, + { + "name": "InitializeDaoParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "twap_initial_observation", + "type": "u128" + }, + { + "name": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "twap_start_delay_seconds", + "type": "u32" + }, + { + "name": "min_quote_futarchic_liquidity", + "type": "u64" + }, + { + "name": "min_base_futarchic_liquidity", + "type": "u64" + }, + { + "name": "base_to_stake", + "type": "u64" + }, + { + "name": "pass_threshold_bps", + "type": "u16" + }, + { + "name": "seconds_per_proposal", + "type": "u32" + }, + { + "name": "nonce", + "type": "u64" + }, + { + "name": "initial_spending_limit", + "type": { + "option": { + "defined": { + "name": "InitialSpendingLimit" + } + } + } + }, + { + "name": "team_sponsored_pass_threshold_bps", + "type": "i16" + }, + { + "name": "team_address", + "type": "pubkey" + } + ] + } + }, + { + "name": "InitiateVaultSpendOptimisticProposalParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amount", + "type": "u64" + } + ] + } + }, + { + "name": "ProvideLiquidityParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "quote_amount", + "docs": [ + "How much quote token you will deposit to the pool" + ], + "type": "u64" + }, + { + "name": "max_base_amount", + "docs": [ + "The maximum base token you will deposit to the pool" + ], + "type": "u64" + }, + { + "name": "min_liquidity", + "docs": [ + "The minimum liquidity you will be assigned" + ], + "type": "u128" + }, + { + "name": "position_authority", + "docs": [ + "The account that will own the LP position, usually the same as the", + "liquidity provider" + ], + "type": "pubkey" + } + ] + } + }, + { + "name": "SpotSwapParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "input_amount", + "type": "u64" + }, + { + "name": "swap_type", + "type": { + "defined": { + "name": "SwapType" + } + } + }, + { + "name": "min_output_amount", + "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": "pass_threshold_bps", + "type": { + "option": "u16" + } + }, + { + "name": "seconds_per_proposal", + "type": { + "option": "u32" + } + }, + { + "name": "twap_initial_observation", + "type": { + "option": "u128" + } + }, + { + "name": "twap_max_observation_change_per_update", + "type": { + "option": "u128" + } + }, + { + "name": "twap_start_delay_seconds", + "type": { + "option": "u32" + } + }, + { + "name": "min_quote_futarchic_liquidity", + "type": { + "option": "u64" + } + }, + { + "name": "min_base_futarchic_liquidity", + "type": { + "option": "u64" + } + }, + { + "name": "base_to_stake", + "type": { + "option": "u64" + } + }, + { + "name": "team_sponsored_pass_threshold_bps", + "type": { + "option": "i16" + } + }, + { + "name": "team_address", + "type": { + "option": "pubkey" + } + }, + { + "name": "is_optimistic_governance_enabled", + "type": { + "option": "bool" + } + } + ] + } + }, + { + "name": "WithdrawLiquidityParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "liquidity_to_withdraw", + "docs": [ + "How much liquidity to withdraw" + ], + "type": "u128" + }, + { + "name": "min_base_amount", + "docs": [ + "Minimum base tokens to receive" + ], + "type": "u64" + }, + { + "name": "min_quote_amount", + "docs": [ + "Minimum quote tokens to receive" + ], + "type": "u64" + } + ] + } + }, + { + "name": "OptimisticProposal", + "type": { + "kind": "struct", + "fields": [ + { + "name": "squads_proposal", + "docs": [ + "The squads proposal currently enqueued for execution if not challenged by a new proposal." + ], + "type": "pubkey" + }, + { + "name": "enqueued_timestamp", + "docs": [ + "The timestamp when the active optimistic squads proposal was enqueued." + ], + "type": "i64" + } + ] + } + }, + { + "name": "InitialSpendingLimit", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amount_per_month", + "type": "u64" + }, + { + "name": "members", + "type": { + "vec": "pubkey" + } + } + ] + } + }, + { + "name": "FutarchyAmm", + "type": { + "kind": "struct", + "fields": [ + { + "name": "state", + "type": { + "defined": { + "name": "PoolState" + } + } + }, + { + "name": "total_liquidity", + "type": "u128" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "amm_base_vault", + "type": "pubkey" + }, + { + "name": "amm_quote_vault", + "type": "pubkey" + } + ] + } + }, + { + "name": "TwapOracle", + "type": { + "kind": "struct", + "fields": [ + { + "name": "aggregator", + "docs": [ + "Running sum of seconds_since_last_update * last_observation.", + "", + "Assuming latest observations are as big as possible (u64::MAX * 1e12),", + "we can store 18 million seconds worth of observations, which turns out to", + "be ~213 days.", + "", + "Assuming that latest observations are 100x smaller than they could theoretically", + "be, we can store ~57 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.", + "", + "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": "last_updated_timestamp", + "type": "i64" + }, + { + "name": "created_at_timestamp", + "type": "i64" + }, + { + "name": "last_price", + "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": "last_observation", + "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": "max_observation_change_per_update", + "docs": [ + "The most that an observation can change per update." + ], + "type": "u128" + }, + { + "name": "initial_observation", + "docs": [ + "What the initial `latest_observation` is set to." + ], + "type": "u128" + }, + { + "name": "start_delay_seconds", + "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": { + "name": "TwapOracle" + } + } + }, + { + "name": "quote_reserves", + "type": "u64" + }, + { + "name": "base_reserves", + "type": "u64" + }, + { + "name": "quote_protocol_fee_balance", + "type": "u64" + }, + { + "name": "base_protocol_fee_balance", + "type": "u64" + } + ] + } + }, + { + "name": "PoolState", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Spot", + "fields": [ + { + "name": "spot", + "type": { + "defined": { + "name": "Pool" + } + } + } + ] + }, + { + "name": "Futarchy", + "fields": [ + { + "name": "spot", + "type": { + "defined": { + "name": "Pool" + } + } + }, + { + "name": "pass", + "type": { + "defined": { + "name": "Pool" + } + } + }, + { + "name": "fail", + "type": { + "defined": { + "name": "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": "amount_staked", + "type": "u64" + } + ] + }, + { + "name": "Pending" + }, + { + "name": "Passed" + }, + { + "name": "Failed" + }, + { + "name": "Removed" + } + ] + } + }, + { + "name": "AmmPosition", + "type": { + "kind": "struct", + "fields": [ + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "position_authority", + "type": "pubkey" + }, + { + "name": "liquidity", + "type": "u128" + } + ] + } + }, + { + "name": "Dao", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amm", + "docs": [ + "Embedded FutarchyAmm - 1:1 relationship" + ], + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + }, + { + "name": "nonce", + "docs": [ + "`nonce` + `dao_creator` are PDA seeds" + ], + "type": "u64" + }, + { + "name": "dao_creator", + "type": "pubkey" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "squads_multisig", + "type": "pubkey" + }, + { + "name": "squads_multisig_vault", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "proposal_count", + "type": "u32" + }, + { + "name": "pass_threshold_bps", + "type": "u16" + }, + { + "name": "seconds_per_proposal", + "type": "u32" + }, + { + "name": "twap_initial_observation", + "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": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "twap_start_delay_seconds", + "docs": [ + "Forces TWAP calculation to start after `twap_start_delay_seconds` seconds" + ], + "type": "u32" + }, + { + "name": "min_quote_futarchic_liquidity", + "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": "min_base_futarchic_liquidity", + "type": "u64" + }, + { + "name": "base_to_stake", + "docs": [ + "Minimum amount of base tokens that must be staked to launch a proposal" + ], + "type": "u64" + }, + { + "name": "seq_num", + "type": "u64" + }, + { + "name": "initial_spending_limit", + "type": { + "option": { + "defined": { + "name": "InitialSpendingLimit" + } + } + } + }, + { + "name": "team_sponsored_pass_threshold_bps", + "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": "team_address", + "type": "pubkey" + }, + { + "name": "optimistic_proposal", + "type": { + "option": { + "defined": { + "name": "OptimisticProposal" + } + } + } + }, + { + "name": "is_optimistic_governance_enabled", + "type": "bool" + } + ] + } + }, + { + "name": "OldDao", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amm", + "docs": [ + "Embedded FutarchyAmm - 1:1 relationship" + ], + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + }, + { + "name": "nonce", + "docs": [ + "`nonce` + `dao_creator` are PDA seeds" + ], + "type": "u64" + }, + { + "name": "dao_creator", + "type": "pubkey" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "squads_multisig", + "type": "pubkey" + }, + { + "name": "squads_multisig_vault", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "proposal_count", + "type": "u32" + }, + { + "name": "pass_threshold_bps", + "type": "u16" + }, + { + "name": "seconds_per_proposal", + "type": "u32" + }, + { + "name": "twap_initial_observation", + "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": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "twap_start_delay_seconds", + "docs": [ + "Forces TWAP calculation to start after `twap_start_delay_seconds` seconds" + ], + "type": "u32" + }, + { + "name": "min_quote_futarchic_liquidity", + "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": "min_base_futarchic_liquidity", + "type": "u64" + }, + { + "name": "base_to_stake", + "docs": [ + "Minimum amount of base tokens that must be staked to launch a proposal" + ], + "type": "u64" + }, + { + "name": "seq_num", + "type": "u64" + }, + { + "name": "initial_spending_limit", + "type": { + "option": { + "defined": { + "name": "InitialSpendingLimit" + } + } + } + }, + { + "name": "team_sponsored_pass_threshold_bps", + "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": "team_address", + "type": "pubkey" + } + ] + } + }, + { + "name": "EnqueuedMultisigProposalApproval", + "type": { + "kind": "struct", + "fields": [ + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "transaction_index", + "type": "u64" + }, + { + "name": "pda_bump", + "type": "u8" + } + ] + } + }, + { + "name": "Proposal", + "type": { + "kind": "struct", + "fields": [ + { + "name": "number", + "type": "u32" + }, + { + "name": "proposer", + "type": "pubkey" + }, + { + "name": "timestamp_enqueued", + "type": "i64" + }, + { + "name": "state", + "type": { + "defined": { + "name": "ProposalState" + } + } + }, + { + "name": "base_vault", + "type": "pubkey" + }, + { + "name": "quote_vault", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "question", + "type": "pubkey" + }, + { + "name": "duration_in_seconds", + "type": "u32" + }, + { + "name": "squads_proposal", + "type": "pubkey" + }, + { + "name": "pass_base_mint", + "type": "pubkey" + }, + { + "name": "pass_quote_mint", + "type": "pubkey" + }, + { + "name": "fail_base_mint", + "type": "pubkey" + }, + { + "name": "fail_quote_mint", + "type": "pubkey" + }, + { + "name": "is_team_sponsored", + "type": "bool" + } + ] + } + }, + { + "name": "StakeAccount", + "type": { + "kind": "struct", + "fields": [ + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "staker", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "bump", + "type": "u8" + } + ] + } + }, + { + "name": "CollectFeesEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "base_token_account", + "type": "pubkey" + }, + { + "name": "quote_token_account", + "type": "pubkey" + }, + { + "name": "amm_base_vault", + "type": "pubkey" + }, + { + "name": "amm_quote_vault", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_fees_collected", + "type": "u64" + }, + { + "name": "base_fees_collected", + "type": "u64" + }, + { + "name": "post_amm_state", + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + } + ] + } + }, + { + "name": "InitializeDaoEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "pass_threshold_bps", + "type": "u16" + }, + { + "name": "seconds_per_proposal", + "type": "u32" + }, + { + "name": "twap_initial_observation", + "type": "u128" + }, + { + "name": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "twap_start_delay_seconds", + "type": "u32" + }, + { + "name": "min_quote_futarchic_liquidity", + "type": "u64" + }, + { + "name": "min_base_futarchic_liquidity", + "type": "u64" + }, + { + "name": "base_to_stake", + "type": "u64" + }, + { + "name": "initial_spending_limit", + "type": { + "option": { + "defined": { + "name": "InitialSpendingLimit" + } + } + } + }, + { + "name": "squads_multisig", + "type": "pubkey" + }, + { + "name": "squads_multisig_vault", + "type": "pubkey" + }, + { + "name": "team_sponsored_pass_threshold_bps", + "type": "i16" + }, + { + "name": "team_address", + "type": "pubkey" + } + ] + } + }, + { + "name": "UpdateDaoEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "pass_threshold_bps", + "type": "u16" + }, + { + "name": "seconds_per_proposal", + "type": "u32" + }, + { + "name": "twap_initial_observation", + "type": "u128" + }, + { + "name": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "twap_start_delay_seconds", + "type": "u32" + }, + { + "name": "min_quote_futarchic_liquidity", + "type": "u64" + }, + { + "name": "min_base_futarchic_liquidity", + "type": "u64" + }, + { + "name": "base_to_stake", + "type": "u64" + }, + { + "name": "team_sponsored_pass_threshold_bps", + "type": "i16" + }, + { + "name": "team_address", + "type": "pubkey" + }, + { + "name": "is_optimistic_governance_enabled", + "type": "bool" + } + ] + } + }, + { + "name": "InitializeProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "question", + "type": "pubkey" + }, + { + "name": "quote_vault", + "type": "pubkey" + }, + { + "name": "base_vault", + "type": "pubkey" + }, + { + "name": "proposer", + "type": "pubkey" + }, + { + "name": "number", + "type": "u32" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "duration_in_seconds", + "type": "u32" + }, + { + "name": "squads_proposal", + "type": "pubkey" + }, + { + "name": "squads_multisig", + "type": "pubkey" + }, + { + "name": "squads_multisig_vault", + "type": "pubkey" + } + ] + } + }, + { + "name": "StakeToProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "staker", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "total_staked", + "type": "u64" + } + ] + } + }, + { + "name": "UnstakeFromProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "staker", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "total_staked", + "type": "u64" + } + ] + } + }, + { + "name": "LaunchProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "timestamp_enqueued", + "type": "i64" + }, + { + "name": "total_staked", + "type": "u64" + }, + { + "name": "post_amm_state", + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + } + ] + } + }, + { + "name": "FinalizeProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "pass_market_twap", + "type": "u128" + }, + { + "name": "fail_market_twap", + "type": "u128" + }, + { + "name": "threshold", + "type": "u128" + }, + { + "name": "state", + "type": { + "defined": { + "name": "ProposalState" + } + } + }, + { + "name": "squads_proposal", + "type": "pubkey" + }, + { + "name": "squads_multisig", + "type": "pubkey" + }, + { + "name": "post_amm_state", + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + }, + { + "name": "is_team_sponsored", + "type": "bool" + } + ] + } + }, + { + "name": "SpotSwapEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "swap_type", + "type": { + "defined": { + "name": "SwapType" + } + } + }, + { + "name": "input_amount", + "type": "u64" + }, + { + "name": "output_amount", + "type": "u64" + }, + { + "name": "min_output_amount", + "type": "u64" + }, + { + "name": "post_amm_state", + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + } + ] + } + }, + { + "name": "ConditionalSwapEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "trader", + "type": "pubkey" + }, + { + "name": "market", + "type": { + "defined": { + "name": "Market" + } + } + }, + { + "name": "swap_type", + "type": { + "defined": { + "name": "SwapType" + } + } + }, + { + "name": "input_amount", + "type": "u64" + }, + { + "name": "output_amount", + "type": "u64" + }, + { + "name": "min_output_amount", + "type": "u64" + }, + { + "name": "post_amm_state", + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + } + ] + } + }, + { + "name": "ProvideLiquidityEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "liquidity_provider", + "type": "pubkey" + }, + { + "name": "position_authority", + "type": "pubkey" + }, + { + "name": "quote_amount", + "type": "u64" + }, + { + "name": "base_amount", + "type": "u64" + }, + { + "name": "liquidity_minted", + "type": "u128" + }, + { + "name": "min_liquidity", + "type": "u128" + }, + { + "name": "post_amm_state", + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + } + ] + } + }, + { + "name": "WithdrawLiquidityEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "liquidity_provider", + "type": "pubkey" + }, + { + "name": "liquidity_withdrawn", + "type": "u128" + }, + { + "name": "min_base_amount", + "type": "u64" + }, + { + "name": "min_quote_amount", + "type": "u64" + }, + { + "name": "base_amount", + "type": "u64" + }, + { + "name": "quote_amount", + "type": "u64" + }, + { + "name": "post_amm_state", + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + } + ] + } + }, + { + "name": "SponsorProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "team_address", + "type": "pubkey" + } + ] + } + }, + { + "name": "RemoveProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "admin", + "type": "pubkey" + } + ] + } + }, + { + "name": "AdminCancelProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "proposal", + "type": "pubkey" + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "post_amm_state", + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + } + ] + } + }, + { + "name": "CollectMeteoraDammFeesEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "pool", + "type": "pubkey" + }, + { + "name": "base_token_account", + "type": "pubkey" + }, + { + "name": "quote_token_account", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_fees_collected", + "type": "u64" + }, + { + "name": "base_fees_collected", + "type": "u64" + } + ] + } + }, + { + "name": "AdminFixPositionAuthorityEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "amm_position", + "type": "pubkey" + }, + { + "name": "old_authority", + "type": "pubkey" + }, + { + "name": "new_authority", + "type": "pubkey" + } + ] + } + }, + { + "name": "InitiateVaultSpendOptimisticProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "proposer", + "type": "pubkey" + }, + { + "name": "squads_proposal", + "type": "pubkey" + }, + { + "name": "squads_multisig", + "type": "pubkey" + }, + { + "name": "squads_multisig_vault", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "recipient", + "type": "pubkey" + }, + { + "name": "dao_quote_vault_account", + "type": "pubkey" + }, + { + "name": "recipient_quote_account", + "type": "pubkey" + }, + { + "name": "enqueued_timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "FinalizeOptimisticProposalEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "dao", + "type": "pubkey" + }, + { + "name": "squads_proposal", + "type": "pubkey" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/sdk/src/futarchy/v0.6/types/v0.6.1-futarchy.ts b/sdk/src/futarchy/v0.6/types/v0.6.1-futarchy.ts index 9af98c323..b9cba4ca1 100644 --- a/sdk/src/futarchy/v0.6/types/v0.6.1-futarchy.ts +++ b/sdk/src/futarchy/v0.6/types/v0.6.1-futarchy.ts @@ -1,1603 +1,1271 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL was converted from the legacy format with `anchor idl convert` and lives in + * the `.json` file next to this one. + */ export type Futarchy = { - version: "0.6.1"; - name: "futarchy"; + address: "FUTARELBfJfQ8RDGhg1wdhddq1odMAJUePHFuBYfUxKq"; + metadata: { + name: "futarchy"; + version: "0.6.1"; + spec: "0.1.0"; + }; instructions: [ { name: "initializeDao"; + discriminator: [128, 226, 96, 90, 39, 56, 24, 196]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "daoCreator"; - isMut: false; - isSigner: true; + signer: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: 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; + writable: true; }, { name: "squadsMultisigVault"; - isMut: false; - isSigner: false; }, { name: "squadsProgram"; - isMut: false; - isSigner: false; }, { name: "squadsProgramConfig"; - isMut: false; - isSigner: false; }, { name: "squadsProgramConfigTreasury"; - isMut: true; - isSigner: false; + writable: true; }, { name: "spendingLimit"; - isMut: true; - isSigner: false; + writable: true; }, { name: "futarchyAmmBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "futarchyAmmQuoteVault"; - isMut: true; - isSigner: false; + writable: 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: "InitializeDaoParams"; + defined: { + name: "initializeDaoParams"; + }; }; }, ]; }, { name: "initializeProposal"; + discriminator: [50, 73, 156, 98, 129, 149, 21, 158]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsProposal"; - isMut: false; - isSigner: false; }, { name: "squadsMultisig"; - isMut: false; - isSigner: false; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "question"; - isMut: false; - isSigner: false; }, { name: "quoteVault"; - isMut: false; - isSigner: false; }, { name: "baseVault"; - isMut: false; - isSigner: false; }, { name: "proposer"; - isMut: false; - isSigner: true; + signer: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "systemProgram"; - isMut: false; - isSigner: false; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "stakeToProposal"; + discriminator: [10, 169, 175, 238, 80, 221, 37, 16]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "stakerBaseAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "proposalBaseAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "stakeAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "staker"; - isMut: false; - isSigner: true; + signer: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { 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: "StakeToProposalParams"; + defined: { + name: "stakeToProposalParams"; + }; }; }, ]; }, { name: "unstakeFromProposal"; + discriminator: [179, 220, 186, 86, 2, 96, 50, 161]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "stakerBaseAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "proposalBaseAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "stakeAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "baseMint"; - isMut: false; - isSigner: false; }, { name: "staker"; - isMut: true; - isSigner: true; + writable: true; + signer: 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: "UnstakeFromProposalParams"; + defined: { + name: "unstakeFromProposalParams"; + }; }; }, ]; }, { name: "launchProposal"; + discriminator: [16, 211, 189, 119, 245, 72, 0, 229]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { 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; + writable: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "ammPassBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammPassQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammFailBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammFailQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { 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"; + discriminator: [23, 68, 51, 167, 109, 173, 187, 164]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "question"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsProposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisig"; - isMut: false; - isSigner: false; }, { name: "squadsMultisigProgram"; - isMut: false; - isSigner: false; }, { name: "ammPassBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammPassQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammFailBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammFailQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultProgram"; - isMut: false; - isSigner: false; }, { name: "vaultEventAuthority"; - isMut: false; - isSigner: false; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; }, { name: "quoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "quoteVaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "passQuoteMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "failQuoteMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "passBaseMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "failBaseMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "baseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "baseVaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "updateDao"; + discriminator: [131, 72, 75, 25, 112, 210, 109, 2]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisigVault"; - isMut: false; - isSigner: true; + signer: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "daoParams"; type: { - defined: "UpdateDaoParams"; + defined: { + name: "updateDaoParams"; + }; }; }, ]; }, { name: "resizeDao"; + discriminator: [142, 52, 68, 81, 113, 14, 90, 40]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "systemProgram"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "spotSwap"; + discriminator: [167, 97, 12, 231, 237, 78, 166, 251]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userBaseAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "user"; - isMut: false; - isSigner: true; + signer: 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"; + defined: { + name: "spotSwapParams"; + }; }; }, ]; }, { name: "conditionalSwap"; + discriminator: [194, 136, 220, 89, 242, 169, 130, 157]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "proposal"; - isMut: false; - isSigner: false; }, { name: "ammPassBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammPassQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammFailBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammFailQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "trader"; - isMut: false; - isSigner: true; + signer: true; }, { name: "userInputAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "userOutputAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "baseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "baseVaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "quoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "quoteVaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "passBaseMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "failBaseMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "passQuoteMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "failQuoteMint"; - isMut: true; - isSigner: false; + writable: true; }, { 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"; + defined: { + name: "conditionalSwapParams"; + }; }; }, ]; }, { name: "provideLiquidity"; + discriminator: [40, 110, 107, 116, 174, 127, 97, 204]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "liquidityProvider"; - isMut: false; - isSigner: true; + signer: true; }, { name: "liquidityProviderBaseAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "liquidityProviderQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "systemProgram"; - isMut: false; - isSigner: false; }, { name: "ammBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammPosition"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "params"; type: { - defined: "ProvideLiquidityParams"; + defined: { + name: "provideLiquidityParams"; + }; }; }, ]; }, { name: "withdrawLiquidity"; + discriminator: [149, 158, 33, 185, 47, 243, 253, 31]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "positionAuthority"; - isMut: false; - isSigner: true; + signer: true; }, { name: "liquidityProviderBaseAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "liquidityProviderQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammPosition"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "params"; type: { - defined: "WithdrawLiquidityParams"; + defined: { + name: "withdrawLiquidityParams"; + }; }; }, ]; }, { name: "collectFees"; + discriminator: [164, 152, 207, 99, 30, 186, 19, 182]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "admin"; - isMut: false; - isSigner: true; + signer: true; }, { name: "baseTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "quoteTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "executeSpendingLimitChange"; + discriminator: [146, 175, 145, 31, 184, 129, 252, 79]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsProposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisig"; - isMut: false; - isSigner: false; }, { name: "squadsMultisigProgram"; - isMut: false; - isSigner: false; }, { name: "vaultTransaction"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "sponsorProposal"; + discriminator: [193, 57, 170, 136, 101, 196, 58, 173]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "teamAddress"; - isMut: false; - isSigner: true; + signer: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "collectMeteoraDammFees"; + discriminator: [139, 212, 105, 118, 126, 54, 214, 143]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "admin"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "squadsMultisig"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisigVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisigVaultTransaction"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisigProposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisigPermissionlessAccount"; - isMut: false; - isSigner: true; + signer: 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; + writable: true; }, { name: "tokenAAccount"; - isMut: true; - isSigner: false; docs: ["Token account of base tokens recipient"]; + writable: true; }, { name: "tokenBAccount"; - isMut: true; - isSigner: false; docs: ["Token account of quote tokens recipient"]; + writable: true; }, { name: "tokenAVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenBVault"; - isMut: true; - isSigner: false; + writable: true; }, { 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"; + discriminator: [83, 24, 40, 200, 88, 239, 19, 255]; accounts: [ { name: "squadsMultisig"; - isMut: false; - isSigner: false; }, { name: "squadsMultisigVault"; - isMut: false; - isSigner: false; }, { name: "squadsSpendingLimit"; - isMut: false; - isSigner: false; }, { name: "squadsProposal"; - isMut: false; - isSigner: false; }, { name: "squadsVaultTransaction"; - isMut: false; - isSigner: false; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "daoQuoteVaultAccount"; - isMut: false; - isSigner: false; }, { name: "proposer"; - isMut: false; - isSigner: true; + signer: true; }, { name: "recipient"; - isMut: false; - isSigner: false; }, { name: "recipientQuoteAccount"; - 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"; + defined: { + name: "initiateVaultSpendOptimisticProposalParams"; + }; }; }, ]; }, { name: "finalizeOptimisticProposal"; + discriminator: [71, 146, 38, 160, 89, 15, 48, 19]; accounts: [ { name: "squadsMultisig"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsProposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsProgram"; - isMut: false; - isSigner: false; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "adminEnqueueMultisigProposalApproval"; + discriminator: [61, 199, 241, 100, 238, 220, 84, 78]; accounts: [ { name: "dao"; - isMut: false; - isSigner: false; }, { name: "admin"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "squadsMultisig"; - isMut: false; - isSigner: false; }, { name: "squadsMultisigProposal"; - isMut: false; - isSigner: false; }, { name: "enqueuedApproval"; - isMut: true; - isSigner: false; + writable: true; }, { name: "systemProgram"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "args"; type: { - defined: "AdminEnqueueMultisigProposalApprovalArgs"; + defined: { + name: "adminEnqueueMultisigProposalApprovalArgs"; + }; }; }, ]; }, { name: "executeMultisigProposalApproval"; + discriminator: [124, 144, 201, 164, 182, 226, 193, 224]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "rentReceiver"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "squadsMultisig"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisigProposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "enqueuedApproval"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisigProgram"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "adminExecuteMultisigProposal"; + discriminator: [226, 221, 40, 160, 169, 90, 48, 42]; accounts: [ { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "admin"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "squadsMultisig"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisigProposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisigVaultTransaction"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisigProgram"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "adminCancelProposal"; + discriminator: [95, 233, 121, 193, 90, 80, 147, 255]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "question"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsProposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisig"; - isMut: false; - isSigner: false; }, { name: "squadsMultisigProgram"; - isMut: false; - isSigner: false; }, { name: "ammPassBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammPassQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammFailBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammFailQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "vaultProgram"; - isMut: false; - isSigner: false; }, { name: "vaultEventAuthority"; - isMut: false; - isSigner: false; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; }, { name: "quoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "quoteVaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "passQuoteMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "failQuoteMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "passBaseMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "failBaseMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "baseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "baseVaultUnderlyingTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "admin"; - isMut: false; - isSigner: true; + signer: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "adminRemoveProposal"; + discriminator: [242, 199, 27, 28, 7, 108, 122, 73]; accounts: [ { name: "proposal"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "admin"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; @@ -1606,95 +1274,396 @@ export type Futarchy = { accounts: [ { name: "ammPosition"; + discriminator: [34, 97, 105, 74, 17, 226, 212, 0]; + }, + { + name: "dao"; + discriminator: [163, 9, 47, 31, 52, 85, 197, 49]; + }, + { + name: "oldDao"; + discriminator: [81, 235, 225, 156, 146, 147, 224, 129]; + }, + { + name: "enqueuedMultisigProposalApproval"; + discriminator: [172, 225, 237, 72, 8, 241, 28, 124]; + }, + { + name: "proposal"; + discriminator: [26, 94, 189, 187, 116, 136, 53, 33]; + }, + { + name: "stakeAccount"; + discriminator: [80, 158, 67, 124, 50, 189, 192, 255]; + }, + ]; + events: [ + { + name: "collectFeesEvent"; + discriminator: [226, 2, 53, 67, 132, 158, 125, 173]; + }, + { + name: "initializeDaoEvent"; + discriminator: [119, 48, 153, 116, 127, 37, 226, 228]; + }, + { + name: "updateDaoEvent"; + discriminator: [12, 58, 244, 224, 171, 25, 33, 56]; + }, + { + name: "initializeProposalEvent"; + discriminator: [141, 56, 246, 192, 168, 254, 64, 111]; + }, + { + name: "stakeToProposalEvent"; + discriminator: [94, 69, 68, 151, 90, 149, 240, 191]; + }, + { + name: "unstakeFromProposalEvent"; + discriminator: [89, 129, 63, 211, 55, 33, 194, 171]; + }, + { + name: "launchProposalEvent"; + discriminator: [177, 55, 191, 93, 203, 124, 184, 11]; + }, + { + name: "finalizeProposalEvent"; + discriminator: [45, 29, 122, 181, 79, 224, 57, 141]; + }, + { + name: "spotSwapEvent"; + discriminator: [29, 253, 121, 255, 82, 60, 148, 195]; + }, + { + name: "conditionalSwapEvent"; + discriminator: [2, 166, 200, 160, 94, 212, 68, 45]; + }, + { + name: "provideLiquidityEvent"; + discriminator: [38, 2, 37, 238, 229, 214, 255, 235]; + }, + { + name: "withdrawLiquidityEvent"; + discriminator: [214, 6, 161, 45, 191, 142, 124, 186]; + }, + { + name: "sponsorProposalEvent"; + discriminator: [202, 190, 250, 176, 79, 235, 77, 194]; + }, + { + name: "removeProposalEvent"; + discriminator: [135, 152, 254, 224, 208, 81, 197, 215]; + }, + { + name: "adminCancelProposalEvent"; + discriminator: [118, 2, 87, 75, 91, 217, 71, 124]; + }, + { + name: "collectMeteoraDammFeesEvent"; + discriminator: [193, 114, 225, 241, 209, 213, 175, 85]; + }, + { + name: "adminFixPositionAuthorityEvent"; + discriminator: [174, 79, 62, 1, 150, 182, 236, 147]; + }, + { + name: "initiateVaultSpendOptimisticProposalEvent"; + discriminator: [224, 194, 233, 205, 198, 135, 5, 90]; + }, + { + name: "finalizeOptimisticProposalEvent"; + discriminator: [64, 171, 35, 255, 228, 201, 18, 97]; + }, + ]; + 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 Active 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: "invalidMint"; + msg: "Base mint and quote mint must be different"; + }, + { + code: 6037; + name: "proposalNotReadyToUnstake"; + msg: "Proposal is not ready to be unstaked"; + }, + { + code: 6038; + name: "optimisticGovernanceDisabled"; + msg: "Optimistic governance is disabled"; + }, + { + code: 6039; + name: "activeOptimisticProposalAlreadyEnqueued"; + msg: "An active optimistic proposal is already enqueued"; + }, + { + code: 6040; + name: "optimisticProposalAlreadyPassed"; + msg: "Optimistic proposal has already passed"; + }, + { + code: 6041; + name: "invalidSpendingLimitMint"; + msg: "Invalid spending limit mint. Must be the same as the DAO's quote mint"; + }, + { + code: 6042; + name: "noActiveOptimisticProposal"; + msg: "No active optimistic proposal"; + }, + ]; + types: [ + { + name: "commonFields"; type: { kind: "struct"; fields: [ { - name: "dao"; - type: "publicKey"; + name: "slot"; + type: "u64"; }, { - name: "positionAuthority"; - type: "publicKey"; + name: "unixTimestamp"; + type: "i64"; }, { - name: "liquidity"; - type: "u128"; + name: "daoSeqNum"; + type: "u64"; }, ]; }; }, { - name: "dao"; + name: "adminEnqueueMultisigProposalApprovalArgs"; type: { kind: "struct"; fields: [ { - name: "amm"; - docs: ["Embedded FutarchyAmm - 1:1 relationship"]; - type: { - defined: "FutarchyAmm"; - }; - }, - { - name: "nonce"; - docs: ["`nonce` + `dao_creator` are PDA seeds"]; + name: "transactionIndex"; type: "u64"; }, + ]; + }; + }, + { + name: "conditionalSwapParams"; + type: { + kind: "struct"; + fields: [ { - 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: "market"; + type: { + defined: { + name: "market"; + }; + }; }, { - name: "proposalCount"; - type: "u32"; + name: "swapType"; + type: { + defined: { + name: "swapType"; + }; + }; }, { - name: "passThresholdBps"; - type: "u16"; + name: "inputAmount"; + type: "u64"; }, { - name: "secondsPerProposal"; - type: "u32"; + name: "minOutputAmount"; + type: "u64"; }, + ]; + }; + }, + { + name: "initializeDaoParams"; + type: { + kind: "struct"; + fields: [ { 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"; }, { @@ -1703,21 +1672,10 @@ export type Futarchy = { }, { 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"; }, { @@ -1726,5886 +1684,1884 @@ export type Futarchy = { }, { name: "baseToStake"; - docs: [ - "Minimum amount of base tokens that must be staked to launch a proposal", - ]; type: "u64"; }, { - name: "seqNum"; + name: "passThresholdBps"; + type: "u16"; + }, + { + name: "secondsPerProposal"; + type: "u32"; + }, + { + name: "nonce"; type: "u64"; }, { name: "initialSpendingLimit"; type: { option: { - defined: "InitialSpendingLimit"; + defined: { + name: "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"; - }; - }; + type: "pubkey"; }, + ]; + }; + }, + { + name: "initiateVaultSpendOptimisticProposalParams"; + type: { + kind: "struct"; + fields: [ { - name: "isOptimisticGovernanceEnabled"; - type: "bool"; + name: "amount"; + type: "u64"; }, ]; }; }, { - name: "oldDao"; + name: "provideLiquidityParams"; type: { kind: "struct"; fields: [ { - name: "amm"; - docs: ["Embedded FutarchyAmm - 1:1 relationship"]; - type: { - defined: "FutarchyAmm"; - }; + name: "quoteAmount"; + docs: ["How much quote token you will deposit to the pool"]; + type: "u64"; }, { - name: "nonce"; - docs: ["`nonce` + `dao_creator` are PDA seeds"]; + name: "maxBaseAmount"; + docs: ["The maximum base token you will deposit to the pool"]; type: "u64"; }, { - name: "daoCreator"; - type: "publicKey"; + name: "minLiquidity"; + docs: ["The minimum liquidity you will be assigned"]; + type: "u128"; }, { - name: "pdaBump"; - type: "u8"; + name: "positionAuthority"; + docs: [ + "The account that will own the LP position, usually the same as the", + "liquidity provider", + ]; + type: "pubkey"; }, + ]; + }; + }, + { + name: "spotSwapParams"; + type: { + kind: "struct"; + fields: [ { - name: "squadsMultisig"; - type: "publicKey"; + name: "inputAmount"; + type: "u64"; }, { - name: "squadsMultisigVault"; - type: "publicKey"; + name: "swapType"; + type: { + defined: { + name: "swapType"; + }; + }; }, { - name: "baseMint"; - type: "publicKey"; + name: "minOutputAmount"; + type: "u64"; }, + ]; + }; + }, + { + name: "stakeToProposalParams"; + type: { + kind: "struct"; + fields: [ { - name: "quoteMint"; - type: "publicKey"; + name: "amount"; + type: "u64"; }, + ]; + }; + }, + { + name: "unstakeFromProposalParams"; + type: { + kind: "struct"; + fields: [ { - name: "proposalCount"; - type: "u32"; + name: "amount"; + type: "u64"; }, + ]; + }; + }, + { + name: "updateDaoParams"; + type: { + kind: "struct"; + fields: [ { name: "passThresholdBps"; - type: "u16"; + type: { + option: "u16"; + }; }, { name: "secondsPerProposal"; - type: "u32"; + type: { + option: "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"; + type: { + option: "u128"; + }; }, { name: "twapMaxObservationChangePerUpdate"; - type: "u128"; + type: { + option: "u128"; + }; }, { name: "twapStartDelaySeconds"; - docs: [ - "Forces TWAP calculation to start after `twap_start_delay_seconds` seconds", - ]; - type: "u32"; + type: { + option: "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"; + type: { + option: "u64"; + }; }, { name: "minBaseFutarchicLiquidity"; - type: "u64"; + type: { + option: "u64"; + }; }, { name: "baseToStake"; - docs: [ - "Minimum amount of base tokens that must be staked to launch a proposal", - ]; - type: "u64"; - }, - { - name: "seqNum"; - type: "u64"; + type: { + option: "u64"; + }; }, { - name: "initialSpendingLimit"; + name: "teamSponsoredPassThresholdBps"; type: { - option: { - defined: "InitialSpendingLimit"; - }; + option: "i16"; }; }, { - 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: { + option: "pubkey"; + }; }, { - name: "teamAddress"; - type: "publicKey"; + name: "isOptimisticGovernanceEnabled"; + type: { + option: "bool"; + }; }, ]; }; }, { - name: "enqueuedMultisigProposalApproval"; + name: "withdrawLiquidityParams"; type: { kind: "struct"; fields: [ { - name: "dao"; - type: "publicKey"; + name: "liquidityToWithdraw"; + docs: ["How much liquidity to withdraw"]; + type: "u128"; }, { - name: "transactionIndex"; + name: "minBaseAmount"; + docs: ["Minimum base tokens to receive"]; type: "u64"; }, { - name: "pdaBump"; - type: "u8"; + name: "minQuoteAmount"; + docs: ["Minimum quote tokens to receive"]; + type: "u64"; }, ]; }; }, { - name: "proposal"; + name: "optimisticProposal"; type: { kind: "struct"; fields: [ { - name: "number"; - type: "u32"; + name: "squadsProposal"; + docs: [ + "The squads proposal currently enqueued for execution if not challenged by a new proposal.", + ]; + type: "pubkey"; }, { - name: "proposer"; - 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: "timestampEnqueued"; - type: "i64"; + name: "members"; + type: { + vec: "pubkey"; + }; }, + ]; + }; + }, + { + name: "futarchyAmm"; + type: { + kind: "struct"; + fields: [ { name: "state"; type: { - defined: "ProposalState"; + defined: { + name: "poolState"; + }; }; }, { - name: "baseVault"; - type: "publicKey"; + name: "totalLiquidity"; + type: "u128"; }, { - name: "quoteVault"; - type: "publicKey"; + name: "baseMint"; + type: "pubkey"; }, { - name: "dao"; - type: "publicKey"; + name: "quoteMint"; + type: "pubkey"; }, { - name: "pdaBump"; - type: "u8"; + name: "ammBaseVault"; + type: "pubkey"; }, { - name: "question"; - type: "publicKey"; + name: "ammQuoteVault"; + type: "pubkey"; }, + ]; + }; + }, + { + name: "twapOracle"; + type: { + kind: "struct"; + fields: [ { - name: "durationInSeconds"; - type: "u32"; + name: "aggregator"; + docs: [ + "Running sum of seconds_since_last_update * last_observation.", + "", + "Assuming latest observations are as big as possible (u64::MAX * 1e12),", + "we can store 18 million seconds worth of observations, which turns out to", + "be ~213 days.", + "", + "Assuming that latest observations are 100x smaller than they could theoretically", + "be, we can store ~57 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.", + "", + "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: "squadsProposal"; - type: "publicKey"; + name: "lastUpdatedTimestamp"; + type: "i64"; }, { - name: "passBaseMint"; - type: "publicKey"; + name: "createdAtTimestamp"; + type: "i64"; }, { - name: "passQuoteMint"; - type: "publicKey"; + 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: "failBaseMint"; - type: "publicKey"; + 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: "failQuoteMint"; - type: "publicKey"; + name: "maxObservationChangePerUpdate"; + docs: ["The most that an observation can change per update."]; + type: "u128"; }, { - name: "isTeamSponsored"; - type: "bool"; + 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: "stakeAccount"; + name: "pool"; type: { kind: "struct"; fields: [ { - name: "proposal"; - type: "publicKey"; + name: "oracle"; + type: { + defined: { + name: "twapOracle"; + }; + }; }, { - name: "staker"; - type: "publicKey"; + name: "quoteReserves"; + type: "u64"; }, { - name: "amount"; + name: "baseReserves"; type: "u64"; }, { - name: "bump"; - type: "u8"; + name: "quoteProtocolFeeBalance"; + type: "u64"; + }, + { + name: "baseProtocolFeeBalance"; + type: "u64"; }, ]; }; }, - ]; - types: [ { - name: "CommonFields"; + name: "poolState"; type: { - kind: "struct"; - fields: [ - { - name: "slot"; - type: "u64"; - }, + kind: "enum"; + variants: [ { - name: "unixTimestamp"; - type: "i64"; + name: "spot"; + fields: [ + { + name: "spot"; + type: { + defined: { + name: "pool"; + }; + }; + }, + ]; }, { - name: "daoSeqNum"; - type: "u64"; + name: "futarchy"; + fields: [ + { + name: "spot"; + type: { + defined: { + name: "pool"; + }; + }; + }, + { + name: "pass"; + type: { + defined: { + name: "pool"; + }; + }; + }, + { + name: "fail"; + type: { + defined: { + name: "pool"; + }; + }; + }, + ]; }, ]; }; }, { - name: "AdminEnqueueMultisigProposalApprovalArgs"; + name: "market"; type: { - kind: "struct"; - fields: [ + kind: "enum"; + variants: [ { - name: "transactionIndex"; - type: "u64"; + name: "spot"; + }, + { + name: "pass"; + }, + { + name: "fail"; }, ]; }; }, { - name: "ConditionalSwapParams"; + name: "swapType"; type: { - kind: "struct"; - fields: [ + kind: "enum"; + variants: [ { - name: "market"; - type: { - defined: "Market"; - }; + name: "buy"; }, { - name: "swapType"; - type: { - defined: "SwapType"; - }; + name: "sell"; }, + ]; + }; + }, + { + name: "token"; + type: { + kind: "enum"; + variants: [ { - name: "inputAmount"; - type: "u64"; + name: "base"; }, { - name: "minOutputAmount"; - type: "u64"; + name: "quote"; }, ]; }; }, { - name: "InitializeDaoParams"; + name: "proposalState"; type: { - kind: "struct"; - fields: [ + kind: "enum"; + variants: [ { - name: "twapInitialObservation"; - type: "u128"; + name: "draft"; + fields: [ + { + name: "amountStaked"; + type: "u64"; + }, + ]; }, { - name: "twapMaxObservationChangePerUpdate"; - type: "u128"; + name: "pending"; }, { - name: "twapStartDelaySeconds"; - type: "u32"; + name: "passed"; }, { - name: "minQuoteFutarchicLiquidity"; - type: "u64"; + name: "failed"; }, { - 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: "removed"; }, ]; }; }, { - name: "InitiateVaultSpendOptimisticProposalParams"; + name: "ammPosition"; type: { kind: "struct"; fields: [ { - name: "amount"; - type: "u64"; + name: "dao"; + type: "pubkey"; + }, + { + name: "positionAuthority"; + type: "pubkey"; + }, + { + name: "liquidity"; + type: "u128"; }, ]; }; }, { - name: "ProvideLiquidityParams"; + name: "dao"; type: { kind: "struct"; fields: [ { - name: "quoteAmount"; - docs: ["How much quote token you will deposit to the pool"]; - type: "u64"; + name: "amm"; + docs: ["Embedded FutarchyAmm - 1:1 relationship"]; + type: { + defined: { + name: "futarchyAmm"; + }; + }; }, { - name: "maxBaseAmount"; - docs: ["The maximum base token you will deposit to the pool"]; + name: "nonce"; + docs: ["`nonce` + `dao_creator` are PDA seeds"]; type: "u64"; }, { - name: "minLiquidity"; - docs: ["The minimum liquidity you will be assigned"]; - type: "u128"; + name: "daoCreator"; + type: "pubkey"; }, { - name: "positionAuthority"; - docs: [ - "The account that will own the LP position, usually the same as the", - "liquidity provider", - ]; - type: "publicKey"; + name: "pdaBump"; + type: "u8"; }, - ]; - }; - }, - { - name: "SpotSwapParams"; - type: { - kind: "struct"; - fields: [ { - name: "inputAmount"; - type: "u64"; + name: "squadsMultisig"; + type: "pubkey"; }, { - name: "swapType"; - type: { - defined: "SwapType"; - }; + name: "squadsMultisigVault"; + type: "pubkey"; }, { - name: "minOutputAmount"; - type: "u64"; + name: "baseMint"; + type: "pubkey"; }, - ]; - }; - }, - { - name: "StakeToProposalParams"; - type: { - kind: "struct"; - fields: [ { - name: "amount"; - type: "u64"; + name: "quoteMint"; + type: "pubkey"; }, - ]; - }; - }, - { - name: "UnstakeFromProposalParams"; - type: { - kind: "struct"; - fields: [ { - name: "amount"; - type: "u64"; + name: "proposalCount"; + type: "u32"; }, - ]; - }; - }, - { - name: "UpdateDaoParams"; - type: { - kind: "struct"; - fields: [ { name: "passThresholdBps"; - type: { - option: "u16"; - }; + type: "u16"; }, { name: "secondsPerProposal"; - type: { - option: "u32"; - }; + type: "u32"; }, { name: "twapInitialObservation"; - type: { - option: "u128"; - }; + 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: { - option: "u128"; - }; + type: "u128"; }, { name: "twapStartDelaySeconds"; - type: { - option: "u32"; - }; + docs: [ + "Forces TWAP calculation to start after `twap_start_delay_seconds` seconds", + ]; + type: "u32"; }, { name: "minQuoteFutarchicLiquidity"; - type: { - option: "u64"; - }; + 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: { - option: "u64"; - }; + 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: "u64"; + option: { + defined: { + name: "initialSpendingLimit"; + }; + }; }; }, { name: "teamSponsoredPassThresholdBps"; - type: { - option: "i16"; - }; + 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: "pubkey"; + }, + { + name: "optimisticProposal"; type: { - option: "publicKey"; + option: { + defined: { + name: "optimisticProposal"; + }; + }; }; }, { name: "isOptimisticGovernanceEnabled"; - type: { - option: "bool"; - }; + type: "bool"; }, ]; }; }, { - name: "WithdrawLiquidityParams"; + name: "oldDao"; type: { kind: "struct"; fields: [ { - name: "liquidityToWithdraw"; - docs: ["How much liquidity to withdraw"]; - type: "u128"; + name: "amm"; + docs: ["Embedded FutarchyAmm - 1:1 relationship"]; + type: { + defined: { + name: "futarchyAmm"; + }; + }; }, { - name: "minBaseAmount"; - docs: ["Minimum base tokens to receive"]; + name: "nonce"; + docs: ["`nonce` + `dao_creator` are PDA seeds"]; type: "u64"; }, { - name: "minQuoteAmount"; - docs: ["Minimum quote tokens to receive"]; - type: "u64"; + name: "daoCreator"; + type: "pubkey"; }, - ]; - }; - }, - { - 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: "pdaBump"; + type: "u8"; }, { - name: "enqueuedTimestamp"; - docs: [ - "The timestamp when the active optimistic squads proposal was enqueued.", - ]; - type: "i64"; + name: "squadsMultisig"; + type: "pubkey"; }, - ]; - }; - }, - { - name: "InitialSpendingLimit"; - type: { - kind: "struct"; - fields: [ { - name: "amountPerMonth"; - type: "u64"; + name: "squadsMultisigVault"; + type: "pubkey"; }, { - name: "members"; - type: { - vec: "publicKey"; - }; - }, - ]; - }; - }, - { - name: "FutarchyAmm"; - type: { - kind: "struct"; - fields: [ - { - name: "state"; - type: { - defined: "PoolState"; - }; - }, - { - name: "totalLiquidity"; - type: "u128"; + name: "baseMint"; + type: "pubkey"; }, { - name: "baseMint"; - type: "publicKey"; + name: "quoteMint"; + type: "pubkey"; }, { - name: "quoteMint"; - type: "publicKey"; + name: "proposalCount"; + type: "u32"; }, { - name: "ammBaseVault"; - type: "publicKey"; + name: "passThresholdBps"; + type: "u16"; }, { - name: "ammQuoteVault"; - type: "publicKey"; + name: "secondsPerProposal"; + type: "u32"; }, - ]; - }; - }, - { - name: "TwapOracle"; - type: { - kind: "struct"; - fields: [ { - name: "aggregator"; + name: "twapInitialObservation"; docs: [ - "Running sum of seconds_since_last_update * last_observation.", - "", - "Assuming latest observations are as big as possible (u64::MAX * 1e12),", - "we can store 18 million seconds worth of observations, which turns out to", - "be ~213 days.", - "", - "Assuming that latest observations are 100x smaller than they could theoretically", - "be, we can store ~57 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.", + "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.", "", - "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.", + "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: "lastUpdatedTimestamp"; - type: "i64"; + name: "twapMaxObservationChangePerUpdate"; + type: "u128"; }, { - name: "createdAtTimestamp"; - type: "i64"; + name: "twapStartDelaySeconds"; + docs: [ + "Forces TWAP calculation to start after `twap_start_delay_seconds` seconds", + ]; + type: "u32"; }, { - name: "lastPrice"; + name: "minQuoteFutarchicLiquidity"; 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", + "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: "u128"; + type: "u64"; }, { - name: "lastObservation"; + name: "minBaseFutarchicLiquidity"; + type: "u64"; + }, + { + name: "baseToStake"; 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.", + "Minimum amount of base tokens that must be staked to launch a proposal", ]; - type: "u128"; + type: "u64"; }, { - name: "maxObservationChangePerUpdate"; - docs: ["The most that an observation can change per update."]; - type: "u128"; + name: "seqNum"; + type: "u64"; }, { - name: "initialObservation"; - docs: ["What the initial `latest_observation` is set to."]; - type: "u128"; + name: "initialSpendingLimit"; + type: { + option: { + defined: { + name: "initialSpendingLimit"; + }; + }; + }; }, { - name: "startDelaySeconds"; + name: "teamSponsoredPassThresholdBps"; docs: [ - "Number of seconds after amm.created_at_slot to start recording TWAP", + "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: "u32"; + type: "i16"; + }, + { + name: "teamAddress"; + type: "pubkey"; }, ]; }; }, { - name: "Pool"; + name: "enqueuedMultisigProposalApproval"; type: { kind: "struct"; fields: [ { - name: "oracle"; - type: { - defined: "TwapOracle"; - }; - }, - { - name: "quoteReserves"; - type: "u64"; - }, - { - name: "baseReserves"; - type: "u64"; + name: "dao"; + type: "pubkey"; }, { - name: "quoteProtocolFeeBalance"; + name: "transactionIndex"; type: "u64"; }, { - name: "baseProtocolFeeBalance"; - type: "u64"; + name: "pdaBump"; + type: "u8"; }, ]; }; }, { - name: "PoolState"; + name: "proposal"; type: { - kind: "enum"; - variants: [ + kind: "struct"; + fields: [ { - name: "Spot"; - fields: [ - { - name: "spot"; - type: { - defined: "Pool"; - }; - }, - ]; + name: "number"; + type: "u32"; }, { - name: "Futarchy"; - fields: [ - { - name: "spot"; - type: { - defined: "Pool"; - }; - }, - { - name: "pass"; - type: { - defined: "Pool"; - }; - }, - { - name: "fail"; - type: { - defined: "Pool"; - }; - }, - ]; + name: "proposer"; + type: "pubkey"; }, - ]; - }; - }, - { - name: "Market"; - type: { - kind: "enum"; - variants: [ { - name: "Spot"; + name: "timestampEnqueued"; + type: "i64"; }, { - name: "Pass"; + name: "state"; + type: { + defined: { + name: "proposalState"; + }; + }; }, { - name: "Fail"; + name: "baseVault"; + type: "pubkey"; }, - ]; - }; - }, - { - name: "SwapType"; - type: { - kind: "enum"; - variants: [ { - name: "Buy"; + name: "quoteVault"; + type: "pubkey"; + }, + { + name: "dao"; + type: "pubkey"; + }, + { + name: "pdaBump"; + type: "u8"; + }, + { + name: "question"; + type: "pubkey"; + }, + { + name: "durationInSeconds"; + type: "u32"; + }, + { + name: "squadsProposal"; + type: "pubkey"; + }, + { + name: "passBaseMint"; + type: "pubkey"; + }, + { + name: "passQuoteMint"; + type: "pubkey"; }, { - name: "Sell"; + name: "failBaseMint"; + type: "pubkey"; + }, + { + name: "failQuoteMint"; + type: "pubkey"; + }, + { + name: "isTeamSponsored"; + type: "bool"; }, ]; }; }, { - name: "Token"; + name: "stakeAccount"; type: { - kind: "enum"; - variants: [ + kind: "struct"; + fields: [ + { + name: "proposal"; + type: "pubkey"; + }, { - name: "Base"; + name: "staker"; + type: "pubkey"; + }, + { + name: "amount"; + type: "u64"; }, { - name: "Quote"; + name: "bump"; + type: "u8"; }, ]; }; }, { - name: "ProposalState"; + name: "collectFeesEvent"; type: { - kind: "enum"; - variants: [ + kind: "struct"; + fields: [ { - name: "Draft"; - fields: [ - { - name: "amountStaked"; - type: "u64"; - }, - ]; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "Pending"; + name: "dao"; + type: "pubkey"; }, { - name: "Passed"; + name: "baseTokenAccount"; + type: "pubkey"; }, { - name: "Failed"; + name: "quoteTokenAccount"; + type: "pubkey"; }, { - name: "Removed"; - }, - ]; - }; - }, - ]; - 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: "RemoveProposalEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "proposal"; - type: "publicKey"; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "admin"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "AdminCancelProposalEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "proposal"; - type: "publicKey"; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "admin"; - type: "publicKey"; - index: false; - }, - { - name: "postAmmState"; - type: { - defined: "FutarchyAmm"; - }; - 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: "AdminFixPositionAuthorityEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "dao"; - type: "publicKey"; - index: false; - }, - { - name: "admin"; - type: "publicKey"; - index: false; - }, - { - name: "ammPosition"; - type: "publicKey"; - index: false; - }, - { - name: "oldAuthority"; - type: "publicKey"; - index: false; - }, - { - name: "newAuthority"; - type: "publicKey"; - 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 Active 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: "InvalidMint"; - msg: "Base mint and quote mint must be different"; - }, - { - code: 6037; - name: "ProposalNotReadyToUnstake"; - msg: "Proposal is not ready to be unstaked"; - }, - { - code: 6038; - name: "OptimisticGovernanceDisabled"; - msg: "Optimistic governance is disabled"; - }, - { - code: 6039; - name: "ActiveOptimisticProposalAlreadyEnqueued"; - msg: "An active optimistic proposal is already enqueued"; - }, - { - code: 6040; - name: "OptimisticProposalAlreadyPassed"; - msg: "Optimistic proposal has already passed"; - }, - { - code: 6041; - name: "InvalidSpendingLimitMint"; - msg: "Invalid spending limit mint. Must be the same as the DAO's quote mint"; - }, - { - code: 6042; - name: "NoActiveOptimisticProposal"; - msg: "No active optimistic proposal"; - }, - ]; -}; - -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: "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: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "staker", - 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: "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, - }, - ], - 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: true, - 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: false, - isSigner: false, - }, - { - name: "squadsMultisigVault", - isMut: false, - isSigner: false, - }, - { - name: "squadsSpendingLimit", - isMut: false, - isSigner: false, - }, - { - name: "squadsProposal", - isMut: false, - isSigner: false, - }, - { - name: "squadsVaultTransaction", - isMut: false, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "daoQuoteVaultAccount", - isMut: false, - isSigner: false, - }, - { - name: "proposer", - isMut: false, - isSigner: true, - }, - { - name: "recipient", - isMut: false, - isSigner: false, - }, - { - name: "recipientQuoteAccount", - 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: "adminEnqueueMultisigProposalApproval", - accounts: [ - { - name: "dao", - isMut: false, - isSigner: false, - }, - { - name: "admin", - isMut: true, - isSigner: true, - }, - { - name: "squadsMultisig", - isMut: false, - isSigner: false, - }, - { - name: "squadsMultisigProposal", - isMut: false, - isSigner: false, - }, - { - name: "enqueuedApproval", - isMut: true, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "AdminEnqueueMultisigProposalApprovalArgs", - }, - }, - ], - }, - { - name: "executeMultisigProposalApproval", - accounts: [ - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "rentReceiver", - isMut: true, - isSigner: true, - }, - { - name: "squadsMultisig", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigProposal", - isMut: true, - isSigner: false, - }, - { - name: "enqueuedApproval", - isMut: true, - isSigner: false, - }, - { - name: "squadsMultisigProgram", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "adminExecuteMultisigProposal", - 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, - }, - ], - args: [], - }, - { - name: "adminCancelProposal", - 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: "admin", - isMut: false, - isSigner: true, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "adminRemoveProposal", - accounts: [ - { - name: "proposal", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "admin", - isMut: true, - isSigner: true, - }, - { - 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: "enqueuedMultisigProposalApproval", - type: { - kind: "struct", - fields: [ - { - name: "dao", - type: "publicKey", - }, - { - name: "transactionIndex", - type: "u64", - }, - { - name: "pdaBump", - type: "u8", - }, - ], - }, - }, - { - 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: "AdminEnqueueMultisigProposalApprovalArgs", - type: { - kind: "struct", - fields: [ - { - name: "transactionIndex", - 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: "ammBaseVault"; + type: "pubkey"; }, { - name: "minBaseAmount", - docs: ["Minimum base tokens to receive"], - type: "u64", + name: "ammQuoteVault"; + type: "pubkey"; }, { - name: "minQuoteAmount", - docs: ["Minimum quote tokens to receive"], - type: "u64", + name: "quoteMint"; + type: "pubkey"; }, - ], - }, - }, - { - 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: "baseMint"; + type: "pubkey"; }, { - name: "enqueuedTimestamp", - docs: [ - "The timestamp when the active optimistic squads proposal was enqueued.", - ], - type: "i64", + name: "quoteFeesCollected"; + type: "u64"; }, - ], - }, - }, - { - name: "InitialSpendingLimit", - type: { - kind: "struct", - fields: [ { - name: "amountPerMonth", - type: "u64", + name: "baseFeesCollected"; + type: "u64"; }, { - name: "members", + name: "postAmmState"; type: { - vec: "publicKey", - }, + defined: { + name: "futarchyAmm"; + }; + }; }, - ], - }, + ]; + }; }, { - name: "FutarchyAmm", + name: "initializeDaoEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "state", + name: "common"; 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 seconds_since_last_update * last_observation.", - "", - "Assuming latest observations are as big as possible (u64::MAX * 1e12),", - "we can store 18 million seconds worth of observations, which turns out to", - "be ~213 days.", - "", - "Assuming that latest observations are 100x smaller than they could theoretically", - "be, we can store ~57 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.", - "", - "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", + defined: { + name: "commonFields"; + }; + }; }, { - name: "createdAtTimestamp", - type: "i64", + name: "dao"; + type: "pubkey"; }, { - 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: "baseMint"; + type: "pubkey"; }, { - 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: "quoteMint"; + type: "pubkey"; }, { - name: "maxObservationChangePerUpdate", - docs: ["The most that an observation can change per update."], - type: "u128", + name: "passThresholdBps"; + type: "u16"; }, { - name: "initialObservation", - docs: ["What the initial `latest_observation` is set to."], - type: "u128", + name: "secondsPerProposal"; + type: "u32"; }, { - name: "startDelaySeconds", - docs: [ - "Number of seconds after amm.created_at_slot to start recording TWAP", - ], - type: "u32", + name: "twapInitialObservation"; + type: "u128"; }, - ], - }, - }, - { - name: "Pool", - type: { - kind: "struct", - fields: [ { - name: "oracle", - type: { - defined: "TwapOracle", - }, + name: "twapMaxObservationChangePerUpdate"; + type: "u128"; }, { - name: "quoteReserves", - type: "u64", + name: "twapStartDelaySeconds"; + type: "u32"; }, { - name: "baseReserves", - type: "u64", + name: "minQuoteFutarchicLiquidity"; + type: "u64"; }, { - name: "quoteProtocolFeeBalance", - type: "u64", + name: "minBaseFutarchicLiquidity"; + type: "u64"; }, { - name: "baseProtocolFeeBalance", - type: "u64", + name: "baseToStake"; + type: "u64"; }, - ], - }, - }, - { - name: "PoolState", - type: { - kind: "enum", - variants: [ { - name: "Spot", - fields: [ - { - name: "spot", - type: { - defined: "Pool", - }, - }, - ], + name: "initialSpendingLimit"; + type: { + option: { + defined: { + name: "initialSpendingLimit"; + }; + }; + }; }, { - name: "Futarchy", - fields: [ - { - name: "spot", - type: { - defined: "Pool", - }, - }, - { - name: "pass", - type: { - defined: "Pool", - }, - }, - { - name: "fail", - type: { - defined: "Pool", - }, - }, - ], + name: "squadsMultisig"; + type: "pubkey"; }, - ], - }, - }, - { - name: "Market", - type: { - kind: "enum", - variants: [ { - name: "Spot", + name: "squadsMultisigVault"; + type: "pubkey"; }, { - name: "Pass", + name: "teamSponsoredPassThresholdBps"; + type: "i16"; }, { - name: "Fail", + name: "teamAddress"; + type: "pubkey"; }, - ], - }, + ]; + }; }, { - name: "SwapType", + name: "updateDaoEvent"; type: { - kind: "enum", - variants: [ + kind: "struct"; + fields: [ { - name: "Buy", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "Sell", + name: "dao"; + type: "pubkey"; }, - ], - }, - }, - { - name: "Token", - type: { - kind: "enum", - variants: [ { - name: "Base", + name: "passThresholdBps"; + type: "u16"; }, { - name: "Quote", + name: "secondsPerProposal"; + type: "u32"; }, - ], - }, - }, - { - name: "ProposalState", - type: { - kind: "enum", - variants: [ { - name: "Draft", - fields: [ - { - name: "amountStaked", - type: "u64", - }, - ], + name: "twapInitialObservation"; + type: "u128"; }, { - name: "Pending", + name: "twapMaxObservationChangePerUpdate"; + type: "u128"; }, { - name: "Passed", + name: "twapStartDelaySeconds"; + type: "u32"; }, { - name: "Failed", + name: "minQuoteFutarchicLiquidity"; + type: "u64"; }, { - name: "Removed", - }, - ], - }, - }, - ], - 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", - }, + name: "minBaseFutarchicLiquidity"; + type: "u64"; }, - 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", + { + name: "baseToStake"; + type: "u64"; }, - 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", + { + name: "teamSponsoredPassThresholdBps"; + type: "i16"; }, - 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", + { + name: "teamAddress"; + type: "pubkey"; }, - 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", + { + name: "isOptimisticGovernanceEnabled"; + type: "bool"; }, - 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", + name: "initializeProposalEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "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", + { + name: "proposal"; + type: "pubkey"; }, - index: false, - }, - ], + { + name: "dao"; + type: "pubkey"; + }, + { + name: "question"; + type: "pubkey"; + }, + { + name: "quoteVault"; + type: "pubkey"; + }, + { + name: "baseVault"; + type: "pubkey"; + }, + { + name: "proposer"; + type: "pubkey"; + }, + { + name: "number"; + type: "u32"; + }, + { + name: "pdaBump"; + type: "u8"; + }, + { + name: "durationInSeconds"; + type: "u32"; + }, + { + name: "squadsProposal"; + type: "pubkey"; + }, + { + name: "squadsMultisig"; + type: "pubkey"; + }, + { + name: "squadsMultisigVault"; + type: "pubkey"; + }, + ]; + }; }, { - name: "FinalizeProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "stakeToProposalEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "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", + { + name: "proposal"; + type: "pubkey"; }, - index: false, - }, - { - name: "squadsProposal", - type: "publicKey", - index: false, - }, - { - name: "squadsMultisig", - type: "publicKey", - index: false, - }, - { - name: "postAmmState", - type: { - defined: "FutarchyAmm", + { + name: "staker"; + type: "pubkey"; }, - index: false, - }, - { - name: "isTeamSponsored", - type: "bool", - index: false, - }, - ], + { + name: "amount"; + type: "u64"; + }, + { + name: "totalStaked"; + type: "u64"; + }, + ]; + }; }, { - name: "SpotSwapEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "unstakeFromProposalEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "user", - type: "publicKey", - index: false, - }, - { - name: "swapType", - type: { - defined: "SwapType", + { + name: "proposal"; + type: "pubkey"; }, - 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", + { + name: "staker"; + type: "pubkey"; }, - index: false, - }, - ], + { + name: "amount"; + type: "u64"; + }, + { + name: "totalStaked"; + type: "u64"; + }, + ]; + }; }, { - name: "ConditionalSwapEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "launchProposalEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "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", + { + name: "proposal"; + type: "pubkey"; }, - index: false, - }, - { - name: "swapType", - type: { - defined: "SwapType", + { + name: "dao"; + type: "pubkey"; }, - 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", + { + name: "timestampEnqueued"; + type: "i64"; }, - index: false, - }, - ], + { + name: "totalStaked"; + type: "u64"; + }, + { + name: "postAmmState"; + type: { + defined: { + name: "futarchyAmm"; + }; + }; + }, + ]; + }; }, { - name: "ProvideLiquidityEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "finalizeProposalEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "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", + { + name: "proposal"; + type: "pubkey"; + }, + { + name: "dao"; + type: "pubkey"; + }, + { + name: "passMarketTwap"; + type: "u128"; + }, + { + name: "failMarketTwap"; + type: "u128"; + }, + { + name: "threshold"; + type: "u128"; + }, + { + name: "state"; + type: { + defined: { + name: "proposalState"; + }; + }; + }, + { + name: "squadsProposal"; + type: "pubkey"; + }, + { + name: "squadsMultisig"; + type: "pubkey"; + }, + { + name: "postAmmState"; + type: { + defined: { + name: "futarchyAmm"; + }; + }; + }, + { + name: "isTeamSponsored"; + type: "bool"; }, - index: false, - }, - ], + ]; + }; }, { - name: "WithdrawLiquidityEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "spotSwapEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "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", + { + name: "dao"; + type: "pubkey"; }, - index: false, - }, - ], - }, - { - name: "SponsorProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "user"; + type: "pubkey"; }, - index: false, - }, - { - name: "proposal", - type: "publicKey", - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "teamAddress", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "RemoveProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "swapType"; + type: { + defined: { + name: "swapType"; + }; + }; }, - index: false, - }, - { - name: "proposal", - type: "publicKey", - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "admin", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "AdminCancelProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "inputAmount"; + type: "u64"; }, - index: false, - }, - { - name: "proposal", - type: "publicKey", - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "admin", - type: "publicKey", - index: false, - }, - { - name: "postAmmState", - type: { - defined: "FutarchyAmm", + { + name: "outputAmount"; + type: "u64"; }, - index: false, - }, - ], - }, - { - name: "CollectMeteoraDammFeesEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "minOutputAmount"; + type: "u64"; }, - 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: "AdminFixPositionAuthorityEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "postAmmState"; + type: { + defined: { + name: "futarchyAmm"; + }; + }; }, - index: false, - }, - { - name: "dao", - type: "publicKey", - index: false, - }, - { - name: "admin", - type: "publicKey", - index: false, - }, - { - name: "ammPosition", - type: "publicKey", - index: false, - }, - { - name: "oldAuthority", - type: "publicKey", - index: false, - }, - { - name: "newAuthority", - type: "publicKey", - index: false, - }, - ], + ]; + }; }, { - name: "InitiateVaultSpendOptimisticProposalEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "conditionalSwapEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "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", + { + name: "dao"; + type: "pubkey"; }, - 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 Active 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%", + { + name: "proposal"; + type: "pubkey"; + }, + { + name: "trader"; + type: "pubkey"; + }, + { + name: "market"; + type: { + defined: { + name: "market"; + }; + }; + }, + { + name: "swapType"; + type: { + defined: { + name: "swapType"; + }; + }; + }, + { + name: "inputAmount"; + type: "u64"; + }, + { + name: "outputAmount"; + type: "u64"; + }, + { + name: "minOutputAmount"; + type: "u64"; + }, + { + name: "postAmmState"; + type: { + defined: { + name: "futarchyAmm"; + }; + }; + }, + ]; + }; }, { - code: 6034, - name: "InvalidTargetK", - msg: "Target K must be greater than the current K", + name: "provideLiquidityEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "dao"; + type: "pubkey"; + }, + { + name: "liquidityProvider"; + type: "pubkey"; + }, + { + name: "positionAuthority"; + type: "pubkey"; + }, + { + name: "quoteAmount"; + type: "u64"; + }, + { + name: "baseAmount"; + type: "u64"; + }, + { + name: "liquidityMinted"; + type: "u128"; + }, + { + name: "minLiquidity"; + type: "u128"; + }, + { + name: "postAmmState"; + type: { + defined: { + name: "futarchyAmm"; + }; + }; + }, + ]; + }; }, { - code: 6035, - name: "InvalidTransactionMessage", - msg: "Failed to compile transaction message for Squads vault transaction", + name: "withdrawLiquidityEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "dao"; + type: "pubkey"; + }, + { + name: "liquidityProvider"; + type: "pubkey"; + }, + { + name: "liquidityWithdrawn"; + type: "u128"; + }, + { + name: "minBaseAmount"; + type: "u64"; + }, + { + name: "minQuoteAmount"; + type: "u64"; + }, + { + name: "baseAmount"; + type: "u64"; + }, + { + name: "quoteAmount"; + type: "u64"; + }, + { + name: "postAmmState"; + type: { + defined: { + name: "futarchyAmm"; + }; + }; + }, + ]; + }; }, { - code: 6036, - name: "InvalidMint", - msg: "Base mint and quote mint must be different", + name: "sponsorProposalEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "proposal"; + type: "pubkey"; + }, + { + name: "dao"; + type: "pubkey"; + }, + { + name: "teamAddress"; + type: "pubkey"; + }, + ]; + }; }, { - code: 6037, - name: "ProposalNotReadyToUnstake", - msg: "Proposal is not ready to be unstaked", + name: "removeProposalEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "proposal"; + type: "pubkey"; + }, + { + name: "dao"; + type: "pubkey"; + }, + { + name: "admin"; + type: "pubkey"; + }, + ]; + }; }, { - code: 6038, - name: "OptimisticGovernanceDisabled", - msg: "Optimistic governance is disabled", + name: "adminCancelProposalEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "proposal"; + type: "pubkey"; + }, + { + name: "dao"; + type: "pubkey"; + }, + { + name: "admin"; + type: "pubkey"; + }, + { + name: "postAmmState"; + type: { + defined: { + name: "futarchyAmm"; + }; + }; + }, + ]; + }; }, { - code: 6039, - name: "ActiveOptimisticProposalAlreadyEnqueued", - msg: "An active optimistic proposal is already enqueued", + name: "collectMeteoraDammFeesEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "dao"; + type: "pubkey"; + }, + { + name: "pool"; + type: "pubkey"; + }, + { + name: "baseTokenAccount"; + type: "pubkey"; + }, + { + name: "quoteTokenAccount"; + type: "pubkey"; + }, + { + name: "quoteMint"; + type: "pubkey"; + }, + { + name: "baseMint"; + type: "pubkey"; + }, + { + name: "quoteFeesCollected"; + type: "u64"; + }, + { + name: "baseFeesCollected"; + type: "u64"; + }, + ]; + }; }, { - code: 6040, - name: "OptimisticProposalAlreadyPassed", - msg: "Optimistic proposal has already passed", + name: "adminFixPositionAuthorityEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "dao"; + type: "pubkey"; + }, + { + name: "admin"; + type: "pubkey"; + }, + { + name: "ammPosition"; + type: "pubkey"; + }, + { + name: "oldAuthority"; + type: "pubkey"; + }, + { + name: "newAuthority"; + type: "pubkey"; + }, + ]; + }; }, { - code: 6041, - name: "InvalidSpendingLimitMint", - msg: "Invalid spending limit mint. Must be the same as the DAO's quote mint", + name: "initiateVaultSpendOptimisticProposalEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "dao"; + type: "pubkey"; + }, + { + name: "proposer"; + type: "pubkey"; + }, + { + name: "squadsProposal"; + type: "pubkey"; + }, + { + name: "squadsMultisig"; + type: "pubkey"; + }, + { + name: "squadsMultisigVault"; + type: "pubkey"; + }, + { + name: "amount"; + type: "u64"; + }, + { + name: "recipient"; + type: "pubkey"; + }, + { + name: "daoQuoteVaultAccount"; + type: "pubkey"; + }, + { + name: "recipientQuoteAccount"; + type: "pubkey"; + }, + { + name: "enqueuedTimestamp"; + type: "i64"; + }, + ]; + }; }, { - code: 6042, - name: "NoActiveOptimisticProposal", - msg: "No active optimistic proposal", + name: "finalizeOptimisticProposalEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "dao"; + type: "pubkey"; + }, + { + name: "squadsProposal"; + type: "pubkey"; + }, + ]; + }; }, - ], + ]; }; diff --git a/sdk/src/gated_mint/v0.1/GatedMintClient.ts b/sdk/src/gated_mint/v0.1/GatedMintClient.ts index d95e1414f..e009e1bfb 100644 --- a/sdk/src/gated_mint/v0.1/GatedMintClient.ts +++ b/sdk/src/gated_mint/v0.1/GatedMintClient.ts @@ -1,4 +1,4 @@ -import { AnchorProvider, Program } from "@coral-xyz/anchor"; +import { AnchorProvider, Program } from "@anchor-lang/core"; import { AccountInfo, PublicKey, @@ -7,10 +7,7 @@ import { import { TOKEN_PROGRAM_ID } from "@solana/spl-token"; import { GATED_MINT_V0_1_PROGRAM_ID } from "../../constants.js"; import { getGatedMintConfigAddr, getWhitelistedUserAddr } from "./pda.js"; -import { - GatedMint as GatedMintProgram, - IDL as GatedMintIDL, -} from "./types/gated_mint.js"; +import { GatedMintProgram, GatedMintIDL } from "./types/index.js"; import type { GatedMintConfigAccount, WhitelistedUserAccount, @@ -30,8 +27,7 @@ export class GatedMintClient { this.provider = provider; this.programId = programId; this.program = new Program( - GatedMintIDL, - programId, + { ...GatedMintIDL, address: programId.toBase58() }, provider, ); } @@ -96,7 +92,7 @@ export class GatedMintClient { return this.program.methods .initializeGatedMint({ whitelistAdmin }) - .accounts({ + .accountsPartial({ mint, gatedMintConfig, currentFreezeAuthority, @@ -127,7 +123,7 @@ export class GatedMintClient { user, }); - return this.program.methods.addWhitelistedUser().accounts({ + return this.program.methods.addWhitelistedUser().accountsPartial({ gatedMintConfig, authority, mint, @@ -158,7 +154,7 @@ export class GatedMintClient { user, }); - return this.program.methods.removeWhitelistedUser().accounts({ + return this.program.methods.removeWhitelistedUser().accountsPartial({ gatedMintConfig, authority, mint, @@ -182,10 +178,12 @@ export class GatedMintClient { mint, }); - return this.program.methods.setWhitelistAdmin({ whitelistAdmin }).accounts({ - gatedMintConfig, - admin, - }); + return this.program.methods + .setWhitelistAdmin({ whitelistAdmin }) + .accountsPartial({ + gatedMintConfig, + admin, + }); } gatedInvokeIx({ @@ -209,7 +207,7 @@ export class GatedMintClient { return this.program.methods .gatedInvoke({ instructionData: instruction.data }) - .accounts({ + .accountsPartial({ caller, gatedMintConfig, whitelistedUser, @@ -226,7 +224,7 @@ export class GatedMintClient { mint, }); - return this.program.methods.disableGating().accounts({ + return this.program.methods.disableGating().accountsPartial({ gatedMintConfig, admin, }); @@ -244,7 +242,7 @@ export class GatedMintClient { mint, }); - return this.program.methods.thawAccount().accounts({ + return this.program.methods.thawAccount().accountsPartial({ gatedMintConfig, mint, tokenAccount, diff --git a/sdk/src/gated_mint/v0.1/types/gated_mint.json b/sdk/src/gated_mint/v0.1/types/gated_mint.json new file mode 100644 index 000000000..61306ae9f --- /dev/null +++ b/sdk/src/gated_mint/v0.1/types/gated_mint.json @@ -0,0 +1,1177 @@ +{ + "address": "GaTEjZy6eMdHg2BcL8dk3iE78jkJ9sPtyw1q2tMNi8PA", + "metadata": { + "name": "gated_mint", + "version": "0.1.0", + "spec": "0.1.0", + "description": "Created with Anchor" + }, + "instructions": [ + { + "name": "add_whitelisted_user", + "discriminator": [ + 211, + 199, + 16, + 14, + 43, + 46, + 211, + 130 + ], + "accounts": [ + { + "name": "gated_mint_config", + "writable": true + }, + { + "name": "authority", + "signer": true + }, + { + "name": "mint", + "relations": [ + "gated_mint_config" + ] + }, + { + "name": "user" + }, + { + "name": "whitelisted_user", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 119, + 104, + 105, + 116, + 101, + 108, + 105, + 115, + 116, + 101, + 100, + 95, + 117, + 115, + 101, + 114 + ] + }, + { + "kind": "account", + "path": "mint" + }, + { + "kind": "account", + "path": "user" + } + ] + } + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "disable_gating", + "discriminator": [ + 26, + 134, + 241, + 15, + 176, + 212, + 81, + 205 + ], + "accounts": [ + { + "name": "gated_mint_config", + "writable": true + }, + { + "name": "admin", + "signer": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "gated_invoke", + "discriminator": [ + 253, + 225, + 179, + 175, + 187, + 144, + 104, + 247 + ], + "accounts": [ + { + "name": "caller", + "signer": true + }, + { + "name": "gated_mint_config", + "writable": true + }, + { + "name": "whitelisted_user", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 119, + 104, + 105, + 116, + 101, + 108, + 105, + 115, + 116, + 101, + 100, + 95, + 117, + 115, + 101, + 114 + ] + }, + { + "kind": "account", + "path": "mint" + }, + { + "kind": "account", + "path": "caller" + } + ] + } + }, + { + "name": "mint", + "relations": [ + "gated_mint_config", + "whitelisted_user" + ] + }, + { + "name": "target_program" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "GatedInvokeArgs" + } + } + } + ] + }, + { + "name": "initialize_gated_mint", + "discriminator": [ + 104, + 52, + 160, + 240, + 89, + 118, + 217, + 147 + ], + "accounts": [ + { + "name": "mint", + "writable": true + }, + { + "name": "gated_mint_config", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 103, + 97, + 116, + 101, + 100, + 95, + 109, + 105, + 110, + 116, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "mint" + } + ] + } + }, + { + "name": "current_freeze_authority", + "signer": true + }, + { + "name": "admin" + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "InitializeGatedMintArgs" + } + } + } + ] + }, + { + "name": "remove_whitelisted_user", + "discriminator": [ + 231, + 10, + 54, + 151, + 190, + 230, + 82, + 6 + ], + "accounts": [ + { + "name": "gated_mint_config", + "writable": true + }, + { + "name": "authority", + "signer": true + }, + { + "name": "mint", + "relations": [ + "gated_mint_config", + "whitelisted_user" + ] + }, + { + "name": "user" + }, + { + "name": "whitelisted_user", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 119, + 104, + 105, + 116, + 101, + 108, + 105, + 115, + 116, + 101, + 100, + 95, + 117, + 115, + 101, + 114 + ] + }, + { + "kind": "account", + "path": "mint" + }, + { + "kind": "account", + "path": "user" + } + ] + } + }, + { + "name": "rent_destination", + "writable": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "set_whitelist_admin", + "discriminator": [ + 224, + 247, + 186, + 24, + 93, + 98, + 152, + 25 + ], + "accounts": [ + { + "name": "gated_mint_config", + "writable": true + }, + { + "name": "admin", + "signer": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "SetWhitelistAdminArgs" + } + } + } + ] + }, + { + "name": "thaw_account", + "discriminator": [ + 115, + 152, + 79, + 213, + 213, + 169, + 184, + 35 + ], + "accounts": [ + { + "name": "gated_mint_config", + "writable": true + }, + { + "name": "mint", + "relations": [ + "gated_mint_config" + ] + }, + { + "name": "token_account", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + } + ], + "accounts": [ + { + "name": "GatedMintConfig", + "discriminator": [ + 58, + 25, + 220, + 64, + 205, + 99, + 235, + 87 + ] + }, + { + "name": "WhitelistedUser", + "discriminator": [ + 156, + 78, + 95, + 223, + 72, + 234, + 174, + 85 + ] + } + ], + "events": [ + { + "name": "AccountThawedEvent", + "discriminator": [ + 172, + 202, + 68, + 155, + 173, + 98, + 79, + 74 + ] + }, + { + "name": "GatedInvokeEvent", + "discriminator": [ + 111, + 20, + 226, + 55, + 0, + 110, + 86, + 58 + ] + }, + { + "name": "GatedMintInitializedEvent", + "discriminator": [ + 34, + 94, + 74, + 87, + 153, + 151, + 220, + 10 + ] + }, + { + "name": "GatingDisabledEvent", + "discriminator": [ + 183, + 85, + 68, + 72, + 163, + 69, + 125, + 149 + ] + }, + { + "name": "WhitelistAdminSetEvent", + "discriminator": [ + 59, + 215, + 174, + 4, + 139, + 231, + 18, + 173 + ] + }, + { + "name": "WhitelistedUserAddedEvent", + "discriminator": [ + 6, + 53, + 76, + 25, + 100, + 133, + 240, + 41 + ] + }, + { + "name": "WhitelistedUserRemovedEvent", + "discriminator": [ + 28, + 48, + 239, + 140, + 118, + 240, + 96, + 109 + ] + } + ], + "errors": [ + { + "code": 6000, + "name": "UnauthorizedAdmin", + "msg": "Unauthorized: signer is not the gated mint admin" + }, + { + "code": 6001, + "name": "UnauthorizedFreezeAuthority", + "msg": "Unauthorized: signer is not the current freeze authority of the mint" + }, + { + "code": 6002, + "name": "MintMismatch", + "msg": "Mint mismatch: account does not match the expected gated mint" + }, + { + "code": 6003, + "name": "GatingDisabled", + "msg": "Gating is already disabled for this mint" + }, + { + "code": 6004, + "name": "GatingNotDisabled", + "msg": "Gating must be disabled to call this instruction" + }, + { + "code": 6005, + "name": "TargetProgramNotWhitelisted", + "msg": "Target program is not on the gated_mint whitelist" + }, + { + "code": 6006, + "name": "SelfInvocation", + "msg": "Target program may not be the gated_mint program itself" + }, + { + "code": 6007, + "name": "InvalidTokenAccount", + "msg": "Invalid token account: account is not a valid SPL Token account of the gated mint" + }, + { + "code": 6008, + "name": "UnauthorizedWhitelistAuthority", + "msg": "Unauthorized: signer is neither admin nor whitelist admin" + }, + { + "code": 6009, + "name": "InvalidWhitelistAdmin", + "msg": "Whitelist admin may not equal admin" + } + ], + "types": [ + { + "name": "AccountThawedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "gated_mint_config", + "type": "pubkey" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "token_account", + "type": "pubkey" + } + ] + } + }, + { + "name": "CommonFields", + "type": { + "kind": "struct", + "fields": [ + { + "name": "slot", + "type": "u64" + }, + { + "name": "unix_timestamp", + "type": "i64" + }, + { + "name": "gated_mint_config_seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "GatedInvokeArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "instruction_data", + "type": "bytes" + } + ] + } + }, + { + "name": "GatedInvokeEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "gated_mint_config", + "type": "pubkey" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "caller", + "type": "pubkey" + }, + { + "name": "target_program", + "type": "pubkey" + }, + { + "name": "thawed_count", + "type": "u32" + }, + { + "name": "frozen_count", + "type": "u32" + } + ] + } + }, + { + "name": "GatedMintConfig", + "type": { + "kind": "struct", + "fields": [ + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "whitelist_admin", + "type": { + "option": "pubkey" + } + }, + { + "name": "gating_disabled", + "type": "bool" + }, + { + "name": "seq_num", + "type": "u64" + }, + { + "name": "bump", + "type": "u8" + } + ] + } + }, + { + "name": "GatedMintInitializedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "gated_mint_config", + "type": "pubkey" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "whitelist_admin", + "type": { + "option": "pubkey" + } + }, + { + "name": "previous_freeze_authority", + "type": "pubkey" + }, + { + "name": "pda_bump", + "type": "u8" + } + ] + } + }, + { + "name": "GatingDisabledEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "gated_mint_config", + "type": "pubkey" + }, + { + "name": "mint", + "type": "pubkey" + } + ] + } + }, + { + "name": "InitializeGatedMintArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "whitelist_admin", + "type": { + "option": "pubkey" + } + } + ] + } + }, + { + "name": "SetWhitelistAdminArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "whitelist_admin", + "type": { + "option": "pubkey" + } + } + ] + } + }, + { + "name": "WhitelistAdminSetEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "gated_mint_config", + "type": "pubkey" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "previous_whitelist_admin", + "type": { + "option": "pubkey" + } + }, + { + "name": "new_whitelist_admin", + "type": { + "option": "pubkey" + } + } + ] + } + }, + { + "name": "WhitelistedUser", + "type": { + "kind": "struct", + "fields": [ + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "bump", + "type": "u8" + } + ] + } + }, + { + "name": "WhitelistedUserAddedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "gated_mint_config", + "type": "pubkey" + }, + { + "name": "whitelisted_user", + "type": "pubkey" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "authority", + "type": "pubkey" + } + ] + } + }, + { + "name": "WhitelistedUserRemovedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "gated_mint_config", + "type": "pubkey" + }, + { + "name": "whitelisted_user", + "type": "pubkey" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "user", + "type": "pubkey" + }, + { + "name": "authority", + "type": "pubkey" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/sdk/src/gated_mint/v0.1/types/gated_mint.ts b/sdk/src/gated_mint/v0.1/types/gated_mint.ts index 81ca5d632..ca8851a1e 100644 --- a/sdk/src/gated_mint/v0.1/types/gated_mint.ts +++ b/sdk/src/gated_mint/v0.1/types/gated_mint.ts @@ -1,306 +1,576 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL can be found at `target/idl/gated_mint.json`. + */ export type GatedMint = { - version: "0.1.0"; - name: "gated_mint"; + address: "GaTEjZy6eMdHg2BcL8dk3iE78jkJ9sPtyw1q2tMNi8PA"; + metadata: { + name: "gatedMint"; + version: "0.1.0"; + spec: "0.1.0"; + description: "Created with Anchor"; + }; instructions: [ { - name: "initializeGatedMint"; + name: "addWhitelistedUser"; + discriminator: [211, 199, 16, 14, 43, 46, 211, 130]; accounts: [ { - name: "mint"; - isMut: true; - isSigner: false; + name: "gatedMintConfig"; + writable: true; }, { - name: "gatedMintConfig"; - isMut: true; - isSigner: false; + name: "authority"; + signer: true; }, { - name: "currentFreezeAuthority"; - isMut: false; - isSigner: true; + name: "mint"; + relations: ["gatedMintConfig"]; }, { - name: "admin"; - isMut: false; - isSigner: false; + name: "user"; }, { - name: "payer"; - isMut: true; - isSigner: true; + name: "whitelistedUser"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 119, + 104, + 105, + 116, + 101, + 108, + 105, + 115, + 116, + 101, + 100, + 95, + 117, + 115, + 101, + 114, + ]; + }, + { + kind: "account"; + path: "mint"; + }, + { + kind: "account"; + path: "user"; + }, + ]; + }; }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + name: "payer"; + writable: true; + signer: true; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "InitializeGatedMintArgs"; - }; }, ]; + args: []; }, { - name: "addWhitelistedUser"; + name: "disableGating"; + discriminator: [26, 134, 241, 15, 176, 212, 81, 205]; accounts: [ { name: "gatedMintConfig"; - isMut: true; - isSigner: false; - }, - { - name: "authority"; - isMut: false; - isSigner: true; - }, - { - name: "mint"; - isMut: false; - isSigner: false; + writable: true; }, { - name: "user"; - isMut: false; - isSigner: false; - }, - { - name: "whitelistedUser"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; + name: "admin"; + signer: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { - name: "removeWhitelistedUser"; + name: "gatedInvoke"; + discriminator: [253, 225, 179, 175, 187, 144, 104, 247]; accounts: [ { - name: "gatedMintConfig"; - isMut: true; - isSigner: false; + name: "caller"; + signer: true; }, { - name: "authority"; - isMut: false; - isSigner: true; + name: "gatedMintConfig"; + writable: true; }, { - name: "mint"; - isMut: false; - isSigner: false; + name: "whitelistedUser"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 119, + 104, + 105, + 116, + 101, + 108, + 105, + 115, + 116, + 101, + 100, + 95, + 117, + 115, + 101, + 114, + ]; + }, + { + kind: "account"; + path: "mint"; + }, + { + kind: "account"; + path: "caller"; + }, + ]; + }; }, { - name: "user"; - isMut: false; - isSigner: false; + name: "mint"; + relations: ["gatedMintConfig", "whitelistedUser"]; }, { - name: "whitelistedUser"; - isMut: true; - isSigner: false; + name: "targetProgram"; }, { - name: "rentDestination"; - isMut: true; - isSigner: false; + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; - args: []; + args: [ + { + name: "args"; + type: { + defined: { + name: "gatedInvokeArgs"; + }; + }; + }, + ]; }, { - name: "setWhitelistAdmin"; + name: "initializeGatedMint"; + discriminator: [104, 52, 160, 240, 89, 118, 217, 147]; accounts: [ + { + name: "mint"; + writable: true; + }, { name: "gatedMintConfig"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 103, + 97, + 116, + 101, + 100, + 95, + 109, + 105, + 110, + 116, + 95, + 99, + 111, + 110, + 102, + 105, + 103, + ]; + }, + { + kind: "account"; + path: "mint"; + }, + ]; + }; + }, + { + name: "currentFreezeAuthority"; + signer: true; }, { name: "admin"; - isMut: false; - isSigner: true; + }, + { + name: "payer"; + writable: true; + signer: true; + }, + { + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; + }, + { + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "args"; type: { - defined: "SetWhitelistAdminArgs"; + defined: { + name: "initializeGatedMintArgs"; + }; }; }, ]; }, { - name: "gatedInvoke"; + name: "removeWhitelistedUser"; + discriminator: [231, 10, 54, 151, 190, 230, 82, 6]; accounts: [ - { - name: "caller"; - isMut: false; - isSigner: true; - }, { name: "gatedMintConfig"; - isMut: true; - isSigner: false; + writable: true; }, { - name: "whitelistedUser"; - isMut: false; - isSigner: false; + name: "authority"; + signer: true; }, { name: "mint"; - isMut: false; - isSigner: false; + relations: ["gatedMintConfig", "whitelistedUser"]; }, { - name: "targetProgram"; - isMut: false; - isSigner: false; + name: "user"; }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + name: "whitelistedUser"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 119, + 104, + 105, + 116, + 101, + 108, + 105, + 115, + 116, + 101, + 100, + 95, + 117, + 115, + 101, + 114, + ]; + }, + { + kind: "account"; + path: "mint"; + }, + { + kind: "account"; + path: "user"; + }, + ]; + }; }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + name: "rentDestination"; + writable: true; }, { - name: "program"; - isMut: false; - isSigner: false; + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, - ]; - args: [ { - name: "args"; - type: { - defined: "GatedInvokeArgs"; - }; + name: "program"; }, ]; + args: []; }, { - name: "disableGating"; + name: "setWhitelistAdmin"; + discriminator: [224, 247, 186, 24, 93, 98, 152, 25]; accounts: [ { name: "gatedMintConfig"; - isMut: true; - isSigner: false; + writable: true; }, { name: "admin"; - isMut: false; - isSigner: true; + signer: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; - args: []; + args: [ + { + name: "args"; + type: { + defined: { + name: "setWhitelistAdminArgs"; + }; + }; + }, + ]; }, { name: "thawAccount"; + discriminator: [115, 152, 79, 213, 213, 169, 184, 35]; accounts: [ { name: "gatedMintConfig"; - isMut: true; - isSigner: false; + writable: true; }, { name: "mint"; - isMut: false; - isSigner: false; + relations: ["gatedMintConfig"]; }, { name: "tokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; @@ -309,62 +579,126 @@ export type GatedMint = { accounts: [ { name: "gatedMintConfig"; + discriminator: [58, 25, 220, 64, 205, 99, 235, 87]; + }, + { + name: "whitelistedUser"; + discriminator: [156, 78, 95, 223, 72, 234, 174, 85]; + }, + ]; + events: [ + { + name: "accountThawedEvent"; + discriminator: [172, 202, 68, 155, 173, 98, 79, 74]; + }, + { + name: "gatedInvokeEvent"; + discriminator: [111, 20, 226, 55, 0, 110, 86, 58]; + }, + { + name: "gatedMintInitializedEvent"; + discriminator: [34, 94, 74, 87, 153, 151, 220, 10]; + }, + { + name: "gatingDisabledEvent"; + discriminator: [183, 85, 68, 72, 163, 69, 125, 149]; + }, + { + name: "whitelistAdminSetEvent"; + discriminator: [59, 215, 174, 4, 139, 231, 18, 173]; + }, + { + name: "whitelistedUserAddedEvent"; + discriminator: [6, 53, 76, 25, 100, 133, 240, 41]; + }, + { + name: "whitelistedUserRemovedEvent"; + discriminator: [28, 48, 239, 140, 118, 240, 96, 109]; + }, + ]; + errors: [ + { + code: 6000; + name: "unauthorizedAdmin"; + msg: "Unauthorized: signer is not the gated mint admin"; + }, + { + code: 6001; + name: "unauthorizedFreezeAuthority"; + msg: "Unauthorized: signer is not the current freeze authority of the mint"; + }, + { + code: 6002; + name: "mintMismatch"; + msg: "Mint mismatch: account does not match the expected gated mint"; + }, + { + code: 6003; + name: "gatingDisabled"; + msg: "Gating is already disabled for this mint"; + }, + { + code: 6004; + name: "gatingNotDisabled"; + msg: "Gating must be disabled to call this instruction"; + }, + { + code: 6005; + name: "targetProgramNotWhitelisted"; + msg: "Target program is not on the gated_mint whitelist"; + }, + { + code: 6006; + name: "selfInvocation"; + msg: "Target program may not be the gated_mint program itself"; + }, + { + code: 6007; + name: "invalidTokenAccount"; + msg: "Invalid token account: account is not a valid SPL Token account of the gated mint"; + }, + { + code: 6008; + name: "unauthorizedWhitelistAuthority"; + msg: "Unauthorized: signer is neither admin nor whitelist admin"; + }, + { + code: 6009; + name: "invalidWhitelistAdmin"; + msg: "Whitelist admin may not equal admin"; + }, + ]; + types: [ + { + name: "accountThawedEvent"; type: { kind: "struct"; fields: [ { - name: "mint"; - type: "publicKey"; - }, - { - name: "admin"; - type: "publicKey"; - }, - { - name: "whitelistAdmin"; + name: "common"; type: { - option: "publicKey"; + defined: { + name: "commonFields"; + }; }; }, { - name: "gatingDisabled"; - type: "bool"; - }, - { - name: "seqNum"; - type: "u64"; - }, - { - name: "bump"; - type: "u8"; + name: "gatedMintConfig"; + type: "pubkey"; }, - ]; - }; - }, - { - name: "whitelistedUser"; - type: { - kind: "struct"; - fields: [ { name: "mint"; - type: "publicKey"; + type: "pubkey"; }, { - name: "user"; - type: "publicKey"; - }, - { - name: "bump"; - type: "u8"; + name: "tokenAccount"; + type: "pubkey"; }, ]; }; }, - ]; - types: [ { - name: "CommonFields"; + name: "commonFields"; type: { kind: "struct"; fields: [ @@ -384,7 +718,7 @@ export type GatedMint = { }; }, { - name: "GatedInvokeArgs"; + name: "gatedInvokeArgs"; type: { kind: "struct"; fields: [ @@ -396,1058 +730,300 @@ export type GatedMint = { }; }, { - name: "InitializeGatedMintArgs"; + name: "gatedInvokeEvent"; type: { kind: "struct"; fields: [ { - name: "whitelistAdmin"; + name: "common"; type: { - option: "publicKey"; + defined: { + name: "commonFields"; + }; }; }, + { + name: "gatedMintConfig"; + type: "pubkey"; + }, + { + name: "mint"; + type: "pubkey"; + }, + { + name: "caller"; + type: "pubkey"; + }, + { + name: "targetProgram"; + type: "pubkey"; + }, + { + name: "thawedCount"; + type: "u32"; + }, + { + name: "frozenCount"; + type: "u32"; + }, ]; }; }, { - name: "SetWhitelistAdminArgs"; + name: "gatedMintConfig"; type: { kind: "struct"; fields: [ + { + name: "mint"; + type: "pubkey"; + }, + { + name: "admin"; + type: "pubkey"; + }, { name: "whitelistAdmin"; type: { - option: "publicKey"; + option: "pubkey"; }; }, + { + name: "gatingDisabled"; + type: "bool"; + }, + { + name: "seqNum"; + type: "u64"; + }, + { + name: "bump"; + type: "u8"; + }, ]; }; }, - ]; - events: [ - { - name: "GatedMintInitializedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "gatedMintConfig"; - type: "publicKey"; - index: false; - }, - { - name: "mint"; - type: "publicKey"; - index: false; - }, - { - name: "admin"; - type: "publicKey"; - index: false; - }, - { - name: "whitelistAdmin"; - type: { - option: "publicKey"; - }; - index: false; - }, - { - name: "previousFreezeAuthority"; - type: "publicKey"; - index: false; - }, - { - name: "pdaBump"; - type: "u8"; - index: false; - }, - ]; - }, - { - name: "WhitelistedUserAddedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "gatedMintConfig"; - type: "publicKey"; - index: false; - }, - { - name: "whitelistedUser"; - type: "publicKey"; - index: false; - }, - { - name: "mint"; - type: "publicKey"; - index: false; - }, - { - name: "user"; - type: "publicKey"; - index: false; - }, - { - name: "authority"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "WhitelistedUserRemovedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "gatedMintConfig"; - type: "publicKey"; - index: false; - }, - { - name: "whitelistedUser"; - type: "publicKey"; - index: false; - }, - { - name: "mint"; - type: "publicKey"; - index: false; - }, - { - name: "user"; - type: "publicKey"; - index: false; - }, - { - name: "authority"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "WhitelistAdminSetEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "gatedMintConfig"; - type: "publicKey"; - index: false; - }, - { - name: "mint"; - type: "publicKey"; - index: false; - }, - { - name: "previousWhitelistAdmin"; - type: { - option: "publicKey"; - }; - index: false; - }, - { - name: "newWhitelistAdmin"; - type: { - option: "publicKey"; - }; - index: false; - }, - ]; - }, - { - name: "GatedInvokeEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "gatedMintConfig"; - type: "publicKey"; - index: false; - }, - { - name: "mint"; - type: "publicKey"; - index: false; - }, - { - name: "caller"; - type: "publicKey"; - index: false; - }, - { - name: "targetProgram"; - type: "publicKey"; - index: false; - }, - { - name: "thawedCount"; - type: "u32"; - index: false; - }, - { - name: "frozenCount"; - type: "u32"; - index: false; - }, - ]; - }, - { - name: "GatingDisabledEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "gatedMintConfig"; - type: "publicKey"; - index: false; - }, - { - name: "mint"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "AccountThawedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "gatedMintConfig"; - type: "publicKey"; - index: false; - }, - { - name: "mint"; - type: "publicKey"; - index: false; - }, - { - name: "tokenAccount"; - type: "publicKey"; - index: false; - }, - ]; - }, - ]; - errors: [ - { - code: 6000; - name: "UnauthorizedAdmin"; - msg: "Unauthorized: signer is not the gated mint admin"; - }, - { - code: 6001; - name: "UnauthorizedFreezeAuthority"; - msg: "Unauthorized: signer is not the current freeze authority of the mint"; - }, - { - code: 6002; - name: "MintMismatch"; - msg: "Mint mismatch: account does not match the expected gated mint"; - }, - { - code: 6003; - name: "GatingDisabled"; - msg: "Gating is already disabled for this mint"; - }, - { - code: 6004; - name: "GatingNotDisabled"; - msg: "Gating must be disabled to call this instruction"; - }, - { - code: 6005; - name: "TargetProgramNotWhitelisted"; - msg: "Target program is not on the gated_mint whitelist"; - }, - { - code: 6006; - name: "SelfInvocation"; - msg: "Target program may not be the gated_mint program itself"; - }, - { - code: 6007; - name: "InvalidTokenAccount"; - msg: "Invalid token account: account is not a valid SPL Token account of the gated mint"; - }, - { - code: 6008; - name: "UnauthorizedWhitelistAuthority"; - msg: "Unauthorized: signer is neither admin nor whitelist admin"; - }, - { - code: 6009; - name: "InvalidWhitelistAdmin"; - msg: "Whitelist admin may not equal admin"; - }, - ]; -}; - -export const IDL: GatedMint = { - version: "0.1.0", - name: "gated_mint", - instructions: [ - { - name: "initializeGatedMint", - accounts: [ - { - name: "mint", - isMut: true, - isSigner: false, - }, - { - name: "gatedMintConfig", - isMut: true, - isSigner: false, - }, - { - name: "currentFreezeAuthority", - isMut: false, - isSigner: true, - }, - { - name: "admin", - isMut: false, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - 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: "InitializeGatedMintArgs", - }, - }, - ], - }, - { - name: "addWhitelistedUser", - accounts: [ - { - name: "gatedMintConfig", - isMut: true, - isSigner: false, - }, - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "mint", - isMut: false, - isSigner: false, - }, - { - name: "user", - isMut: false, - isSigner: false, - }, - { - name: "whitelistedUser", - 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: "removeWhitelistedUser", - accounts: [ - { - name: "gatedMintConfig", - isMut: true, - isSigner: false, - }, - { - name: "authority", - isMut: false, - isSigner: true, - }, - { - name: "mint", - isMut: false, - isSigner: false, - }, - { - name: "user", - isMut: false, - isSigner: false, - }, - { - name: "whitelistedUser", - isMut: true, - isSigner: false, - }, - { - name: "rentDestination", - isMut: true, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "setWhitelistAdmin", - accounts: [ - { - name: "gatedMintConfig", - isMut: true, - isSigner: false, - }, - { - name: "admin", - isMut: false, - isSigner: true, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "SetWhitelistAdminArgs", - }, - }, - ], - }, - { - name: "gatedInvoke", - accounts: [ - { - name: "caller", - isMut: false, - isSigner: true, - }, - { - name: "gatedMintConfig", - isMut: true, - isSigner: false, - }, - { - name: "whitelistedUser", - isMut: false, - isSigner: false, - }, - { - name: "mint", - isMut: false, - isSigner: false, - }, - { - name: "targetProgram", - isMut: false, - 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: "GatedInvokeArgs", - }, - }, - ], - }, - { - name: "disableGating", - accounts: [ - { - name: "gatedMintConfig", - isMut: true, - isSigner: false, - }, - { - name: "admin", - isMut: false, - isSigner: true, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "thawAccount", - accounts: [ - { - name: "gatedMintConfig", - isMut: true, - isSigner: false, - }, - { - name: "mint", - isMut: false, - isSigner: false, - }, - { - name: "tokenAccount", - 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: "gatedMintConfig", + name: "gatedMintInitializedEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "mint", - type: "publicKey", - }, - { - name: "admin", - type: "publicKey", - }, - { - name: "whitelistAdmin", + name: "common"; type: { - option: "publicKey", - }, + defined: { + name: "commonFields"; + }; + }; }, { - name: "gatingDisabled", - type: "bool", + name: "gatedMintConfig"; + type: "pubkey"; }, { - name: "seqNum", - type: "u64", + name: "mint"; + type: "pubkey"; }, { - name: "bump", - type: "u8", + name: "admin"; + type: "pubkey"; }, - ], - }, - }, - { - name: "whitelistedUser", - type: { - kind: "struct", - fields: [ { - name: "mint", - type: "publicKey", + name: "whitelistAdmin"; + type: { + option: "pubkey"; + }; }, { - name: "user", - type: "publicKey", + name: "previousFreezeAuthority"; + type: "pubkey"; }, { - name: "bump", - type: "u8", + name: "pdaBump"; + type: "u8"; }, - ], - }, + ]; + }; }, - ], - types: [ { - name: "CommonFields", + name: "gatingDisabledEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "slot", - type: "u64", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "unixTimestamp", - type: "i64", + name: "gatedMintConfig"; + type: "pubkey"; }, { - name: "gatedMintConfigSeqNum", - type: "u64", + name: "mint"; + type: "pubkey"; }, - ], - }, + ]; + }; }, { - name: "GatedInvokeArgs", + name: "initializeGatedMintArgs"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "instructionData", - type: "bytes", + name: "whitelistAdmin"; + type: { + option: "pubkey"; + }; }, - ], - }, + ]; + }; }, { - name: "InitializeGatedMintArgs", + name: "setWhitelistAdminArgs"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "whitelistAdmin", + name: "whitelistAdmin"; type: { - option: "publicKey", - }, + option: "pubkey"; + }; }, - ], - }, + ]; + }; }, { - name: "SetWhitelistAdminArgs", + name: "whitelistAdminSetEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "whitelistAdmin", + name: "common"; type: { - option: "publicKey", - }, + defined: { + name: "commonFields"; + }; + }; }, - ], - }, - }, - ], - events: [ - { - name: "GatedMintInitializedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "gatedMintConfig"; + type: "pubkey"; }, - index: false, - }, - { - name: "gatedMintConfig", - type: "publicKey", - index: false, - }, - { - name: "mint", - type: "publicKey", - index: false, - }, - { - name: "admin", - type: "publicKey", - index: false, - }, - { - name: "whitelistAdmin", - type: { - option: "publicKey", + { + name: "mint"; + type: "pubkey"; }, - index: false, - }, - { - name: "previousFreezeAuthority", - type: "publicKey", - index: false, - }, - { - name: "pdaBump", - type: "u8", - index: false, - }, - ], - }, - { - name: "WhitelistedUserAddedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "previousWhitelistAdmin"; + type: { + option: "pubkey"; + }; }, - index: false, - }, - { - name: "gatedMintConfig", - type: "publicKey", - index: false, - }, - { - name: "whitelistedUser", - type: "publicKey", - index: false, - }, - { - name: "mint", - type: "publicKey", - index: false, - }, - { - name: "user", - type: "publicKey", - index: false, - }, - { - name: "authority", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "WhitelistedUserRemovedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "newWhitelistAdmin"; + type: { + option: "pubkey"; + }; }, - index: false, - }, - { - name: "gatedMintConfig", - type: "publicKey", - index: false, - }, - { - name: "whitelistedUser", - type: "publicKey", - index: false, - }, - { - name: "mint", - type: "publicKey", - index: false, - }, - { - name: "user", - type: "publicKey", - index: false, - }, - { - name: "authority", - type: "publicKey", - index: false, - }, - ], + ]; + }; }, { - name: "WhitelistAdminSetEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "whitelistedUser"; + type: { + kind: "struct"; + fields: [ + { + name: "mint"; + type: "pubkey"; }, - index: false, - }, - { - name: "gatedMintConfig", - type: "publicKey", - index: false, - }, - { - name: "mint", - type: "publicKey", - index: false, - }, - { - name: "previousWhitelistAdmin", - type: { - option: "publicKey", + { + name: "user"; + type: "pubkey"; }, - index: false, - }, - { - name: "newWhitelistAdmin", - type: { - option: "publicKey", + { + name: "bump"; + type: "u8"; }, - index: false, - }, - ], + ]; + }; }, { - name: "GatedInvokeEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "whitelistedUserAddedEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, - index: false, - }, - { - name: "gatedMintConfig", - type: "publicKey", - index: false, - }, - { - name: "mint", - type: "publicKey", - index: false, - }, - { - name: "caller", - type: "publicKey", - index: false, - }, - { - name: "targetProgram", - type: "publicKey", - index: false, - }, - { - name: "thawedCount", - type: "u32", - index: false, - }, - { - name: "frozenCount", - type: "u32", - index: false, - }, - ], - }, - { - name: "GatingDisabledEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "gatedMintConfig"; + type: "pubkey"; }, - index: false, - }, - { - name: "gatedMintConfig", - type: "publicKey", - index: false, - }, - { - name: "mint", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "AccountThawedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "whitelistedUser"; + type: "pubkey"; }, - index: false, - }, - { - name: "gatedMintConfig", - type: "publicKey", - index: false, - }, - { - name: "mint", - type: "publicKey", - index: false, - }, - { - name: "tokenAccount", - type: "publicKey", - index: false, - }, - ], - }, - ], - errors: [ - { - code: 6000, - name: "UnauthorizedAdmin", - msg: "Unauthorized: signer is not the gated mint admin", - }, - { - code: 6001, - name: "UnauthorizedFreezeAuthority", - msg: "Unauthorized: signer is not the current freeze authority of the mint", - }, - { - code: 6002, - name: "MintMismatch", - msg: "Mint mismatch: account does not match the expected gated mint", - }, - { - code: 6003, - name: "GatingDisabled", - msg: "Gating is already disabled for this mint", - }, - { - code: 6004, - name: "GatingNotDisabled", - msg: "Gating must be disabled to call this instruction", - }, - { - code: 6005, - name: "TargetProgramNotWhitelisted", - msg: "Target program is not on the gated_mint whitelist", - }, - { - code: 6006, - name: "SelfInvocation", - msg: "Target program may not be the gated_mint program itself", - }, - { - code: 6007, - name: "InvalidTokenAccount", - msg: "Invalid token account: account is not a valid SPL Token account of the gated mint", - }, - { - code: 6008, - name: "UnauthorizedWhitelistAuthority", - msg: "Unauthorized: signer is neither admin nor whitelist admin", + { + name: "mint"; + type: "pubkey"; + }, + { + name: "user"; + type: "pubkey"; + }, + { + name: "authority"; + type: "pubkey"; + }, + ]; + }; }, { - code: 6009, - name: "InvalidWhitelistAdmin", - msg: "Whitelist admin may not equal admin", + name: "whitelistedUserRemovedEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "gatedMintConfig"; + type: "pubkey"; + }, + { + name: "whitelistedUser"; + type: "pubkey"; + }, + { + name: "mint"; + type: "pubkey"; + }, + { + name: "user"; + type: "pubkey"; + }, + { + name: "authority"; + type: "pubkey"; + }, + ]; + }; }, - ], + ]; }; diff --git a/sdk/src/gated_mint/v0.1/types/index.ts b/sdk/src/gated_mint/v0.1/types/index.ts index 7f84e3ba3..cfb6a4721 100644 --- a/sdk/src/gated_mint/v0.1/types/index.ts +++ b/sdk/src/gated_mint/v0.1/types/index.ts @@ -1,9 +1,8 @@ -import { IdlAccounts, IdlEvents } from "@coral-xyz/anchor"; -import { - GatedMint as GatedMintProgram, - IDL as GatedMintIDL, -} from "./gated_mint.js"; -export { GatedMintProgram, GatedMintIDL }; +import { IdlAccounts, IdlEvents } from "@anchor-lang/core"; +import type { GatedMint as GatedMintProgram } from "./gated_mint.js"; +import gatedMintIdl from "./gated_mint.json" with { type: "json" }; +export type { GatedMintProgram }; +export const GatedMintIDL = gatedMintIdl as GatedMintProgram; export type GatedMintConfigAccount = IdlAccounts["gatedMintConfig"]; @@ -11,14 +10,14 @@ export type WhitelistedUserAccount = IdlAccounts["whitelistedUser"]; export type GatedMintInitializedEvent = - IdlEvents["GatedMintInitializedEvent"]; + IdlEvents["gatedMintInitializedEvent"]; export type WhitelistedUserAddedEvent = - IdlEvents["WhitelistedUserAddedEvent"]; -export type GatedInvokeEvent = IdlEvents["GatedInvokeEvent"]; + IdlEvents["whitelistedUserAddedEvent"]; +export type GatedInvokeEvent = IdlEvents["gatedInvokeEvent"]; export type GatingDisabledEvent = - IdlEvents["GatingDisabledEvent"]; + IdlEvents["gatingDisabledEvent"]; export type AccountThawedEvent = - IdlEvents["AccountThawedEvent"]; + IdlEvents["accountThawedEvent"]; export type GatedMintEvent = | GatedMintInitializedEvent | WhitelistedUserAddedEvent diff --git a/sdk/src/launchpad/v0.4/LaunchpadClient.ts b/sdk/src/launchpad/v0.4/LaunchpadClient.ts index e8e71dab6..257a51c95 100644 --- a/sdk/src/launchpad/v0.4/LaunchpadClient.ts +++ b/sdk/src/launchpad/v0.4/LaunchpadClient.ts @@ -1,11 +1,11 @@ -import { AnchorProvider, Program } from "@coral-xyz/anchor"; +import { AnchorProvider, Program } from "@anchor-lang/core"; import { PublicKey, Keypair, AccountInfo, ComputeBudgetProgram, } from "@solana/web3.js"; -import { Launchpad, IDL as LaunchpadIDL } from "./types/launchpad.js"; +import { LaunchpadProgram as Launchpad, LaunchpadIDL } from "./types/index.js"; import { LAUNCHPAD_V0_4_PROGRAM_ID, RAYDIUM_AUTHORITY, @@ -37,7 +37,7 @@ import { 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"; +import * as anchor from "@anchor-lang/core"; export type CreateLaunchpadClientParams = { provider: AnchorProvider; @@ -55,8 +55,12 @@ export class LaunchpadClient { private constructor(params: CreateLaunchpadClientParams) { this.provider = params.provider; this.launchpad = new Program( - LaunchpadIDL, - params.launchpadProgramId || LAUNCHPAD_V0_4_PROGRAM_ID, + { + ...LaunchpadIDL, + address: ( + params.launchpadProgramId || LAUNCHPAD_V0_4_PROGRAM_ID + ).toBase58(), + }, this.provider, ); this.autocratClient = AutocratClient.createClient({ @@ -143,7 +147,7 @@ export class LaunchpadClient { tokenSymbol, tokenUri, }) - .accounts({ + .accountsPartial({ launch, launchSigner, usdcVault, @@ -170,7 +174,7 @@ export class LaunchpadClient { launch: PublicKey, launchAuthority: PublicKey = this.provider.publicKey, ) { - return this.launchpad.methods.startLaunch().accounts({ + return this.launchpad.methods.startLaunch().accountsPartial({ launch, launchAuthority, }); @@ -200,7 +204,7 @@ export class LaunchpadClient { funder, ); - return this.launchpad.methods.fund(amount).accounts({ + return this.launchpad.methods.fund(amount).accountsPartial({ launch, launchUsdcVault, fundingRecord, @@ -285,7 +289,7 @@ export class LaunchpadClient { return this.launchpad.methods .completeLaunch() - .accounts({ + .accountsPartial({ launch, launchSigner, launchUsdcVault, @@ -354,7 +358,7 @@ export class LaunchpadClient { ); const funderUsdcAccount = getAssociatedTokenAddressSync(USDC, funder, true); - return this.launchpad.methods.refund().accounts({ + return this.launchpad.methods.refund().accountsPartial({ launch, launchSigner, launchUsdcVault, @@ -381,7 +385,7 @@ export class LaunchpadClient { return this.launchpad.methods .claim() - .accounts({ + .accountsPartial({ launch, fundingRecord, launchSigner, diff --git a/sdk/src/launchpad/v0.4/pda.ts b/sdk/src/launchpad/v0.4/pda.ts index 3e5b9a370..9c61a5800 100644 --- a/sdk/src/launchpad/v0.4/pda.ts +++ b/sdk/src/launchpad/v0.4/pda.ts @@ -1,5 +1,5 @@ import { PublicKey } from "@solana/web3.js"; -import { utils } from "@coral-xyz/anchor"; +import { utils } from "@anchor-lang/core"; import { LAUNCHPAD_V0_4_PROGRAM_ID, RAYDIUM_CP_SWAP_PROGRAM_ID, diff --git a/sdk/src/launchpad/v0.4/types/index.ts b/sdk/src/launchpad/v0.4/types/index.ts index 8ee0e3354..95f8ab859 100644 --- a/sdk/src/launchpad/v0.4/types/index.ts +++ b/sdk/src/launchpad/v0.4/types/index.ts @@ -1,25 +1,24 @@ -import { - Launchpad as LaunchpadProgram, - IDL as LaunchpadIDL, -} from "./launchpad.js"; -export { LaunchpadProgram, LaunchpadIDL }; +import type { Launchpad as LaunchpadProgram } from "./launchpad.js"; +import launchpadIdl from "./launchpad.json" with { type: "json" }; +export type { LaunchpadProgram }; +export const LaunchpadIDL = launchpadIdl as LaunchpadProgram; -import type { IdlAccounts, IdlEvents } from "@coral-xyz/anchor"; +import type { IdlAccounts, IdlEvents } from "@anchor-lang/core"; export type Launch = IdlAccounts["launch"]; export type FundingRecord = IdlAccounts["fundingRecord"]; -export type LaunchClaimEvent = IdlEvents["LaunchClaimEvent"]; +export type LaunchClaimEvent = IdlEvents["launchClaimEvent"]; export type LaunchCompletedEvent = - IdlEvents["LaunchCompletedEvent"]; + IdlEvents["launchCompletedEvent"]; export type LaunchFundedEvent = - IdlEvents["LaunchFundedEvent"]; + IdlEvents["launchFundedEvent"]; export type LaunchInitializedEvent = - IdlEvents["LaunchInitializedEvent"]; + IdlEvents["launchInitializedEvent"]; export type LaunchRefundedEvent = - IdlEvents["LaunchRefundedEvent"]; + IdlEvents["launchRefundedEvent"]; export type LaunchStartedEvent = - IdlEvents["LaunchStartedEvent"]; + IdlEvents["launchStartedEvent"]; export type LaunchpadEvent = | LaunchClaimEvent | LaunchCompletedEvent diff --git a/sdk/src/launchpad/v0.4/types/launchpad.json b/sdk/src/launchpad/v0.4/types/launchpad.json new file mode 100644 index 000000000..5dfc1d3a9 --- /dev/null +++ b/sdk/src/launchpad/v0.4/types/launchpad.json @@ -0,0 +1,1087 @@ +{ + "address": "AfJJJ5UqxhBKoE3grkKAZZsoXDE9kncbMKvqSHGsCNrE", + "metadata": { + "name": "launchpad", + "version": "0.4.1", + "spec": "0.1.0" + }, + "instructions": [ + { + "name": "initialize_launch", + "discriminator": [ + 90, + 201, + 220, + 142, + 112, + 253, + 100, + 13 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "token_mint", + "writable": true + }, + { + "name": "token_metadata", + "writable": true + }, + { + "name": "launch_signer" + }, + { + "name": "usdc_vault", + "writable": true + }, + { + "name": "token_vault", + "writable": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "launch_authority" + }, + { + "name": "usdc_mint" + }, + { + "name": "rent", + "address": "SysvarRent111111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_metadata_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "InitializeLaunchArgs" + } + } + } + ] + }, + { + "name": "start_launch", + "discriminator": [ + 205, + 178, + 36, + 232, + 95, + 202, + 241, + 68 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "launch_authority", + "signer": true + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "fund", + "discriminator": [ + 218, + 188, + 111, + 221, + 152, + 113, + 174, + 7 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "funding_record", + "writable": true + }, + { + "name": "launch_signer" + }, + { + "name": "launch_usdc_vault", + "writable": true + }, + { + "name": "funder", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "funder_usdc_account", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "amount", + "type": "u64" + } + ] + }, + { + "name": "complete_launch", + "discriminator": [ + 118, + 207, + 250, + 130, + 44, + 148, + 251, + 237 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "token_metadata", + "writable": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "launch_signer", + "writable": true + }, + { + "name": "authority" + }, + { + "name": "launch_usdc_vault", + "writable": true + }, + { + "name": "launch_token_vault", + "writable": true + }, + { + "name": "treasury_usdc_account", + "writable": true + }, + { + "name": "treasury_lp_account", + "writable": true + }, + { + "name": "amm_config", + "docs": [ + "Use the lowest fee pool, can see fees at https://api-v3.raydium.io/main/cpmm-config" + ], + "writable": true + }, + { + "name": "pool_state", + "writable": true + }, + { + "name": "token_mint", + "writable": true + }, + { + "name": "usdc_mint" + }, + { + "name": "lp_mint", + "writable": true + }, + { + "name": "lp_vault", + "writable": true + }, + { + "name": "pool_token_vault", + "writable": true + }, + { + "name": "pool_usdc_vault", + "writable": true + }, + { + "name": "create_pool_fee", + "docs": [ + "create pool fee account" + ], + "writable": true + }, + { + "name": "observation_state", + "writable": true + }, + { + "name": "dao", + "writable": true + }, + { + "name": "dao_treasury" + }, + { + "name": "cp_swap_program" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "autocrat_program" + }, + { + "name": "token_metadata_program" + }, + { + "name": "autocrat_event_authority" + }, + { + "name": "rent", + "address": "SysvarRent111111111111111111111111111111111" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "refund", + "discriminator": [ + 2, + 96, + 183, + 251, + 63, + 208, + 46, + 46 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "funding_record", + "writable": true + }, + { + "name": "launch_usdc_vault", + "writable": true + }, + { + "name": "launch_signer" + }, + { + "name": "funder", + "writable": true, + "signer": true + }, + { + "name": "funder_usdc_account", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "claim", + "discriminator": [ + 62, + 198, + 214, + 193, + 213, + 159, + 108, + 210 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "funding_record", + "writable": true + }, + { + "name": "launch_signer" + }, + { + "name": "token_mint", + "writable": true + }, + { + "name": "launch_token_vault", + "writable": true + }, + { + "name": "funder" + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "funder_token_account", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + } + ], + "accounts": [ + { + "name": "FundingRecord", + "discriminator": [ + 20, + 34, + 251, + 238, + 204, + 117, + 11, + 67 + ] + }, + { + "name": "Launch", + "discriminator": [ + 144, + 51, + 51, + 163, + 206, + 85, + 213, + 38 + ] + } + ], + "events": [ + { + "name": "LaunchInitializedEvent", + "discriminator": [ + 227, + 109, + 144, + 20, + 65, + 239, + 101, + 176 + ] + }, + { + "name": "LaunchStartedEvent", + "discriminator": [ + 187, + 129, + 95, + 253, + 255, + 206, + 36, + 239 + ] + }, + { + "name": "LaunchFundedEvent", + "discriminator": [ + 107, + 1, + 188, + 175, + 129, + 59, + 38, + 79 + ] + }, + { + "name": "LaunchCompletedEvent", + "discriminator": [ + 11, + 31, + 43, + 56, + 39, + 157, + 147, + 101 + ] + }, + { + "name": "LaunchRefundedEvent", + "discriminator": [ + 59, + 128, + 76, + 161, + 92, + 17, + 206, + 130 + ] + }, + { + "name": "LaunchClaimEvent", + "discriminator": [ + 185, + 124, + 167, + 74, + 161, + 160, + 106, + 96 + ] + } + ], + "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": "Launch needs to be in refunding state to get a refund" + }, + { + "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" + } + ], + "types": [ + { + "name": "CommonFields", + "type": { + "kind": "struct", + "fields": [ + { + "name": "slot", + "type": "u64" + }, + { + "name": "unix_timestamp", + "type": "i64" + }, + { + "name": "launch_seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "InitializeLaunchArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "minimum_raise_amount", + "type": "u64" + }, + { + "name": "seconds_for_launch", + "type": "u32" + }, + { + "name": "token_name", + "type": "string" + }, + { + "name": "token_symbol", + "type": "string" + }, + { + "name": "token_uri", + "type": "string" + } + ] + } + }, + { + "name": "LaunchState", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Initialized" + }, + { + "name": "Live" + }, + { + "name": "Complete" + }, + { + "name": "Refunding" + } + ] + } + }, + { + "name": "FundingRecord", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pda_bump", + "docs": [ + "The PDA bump." + ], + "type": "u8" + }, + { + "name": "funder", + "docs": [ + "The funder." + ], + "type": "pubkey" + }, + { + "name": "launch", + "docs": [ + "The launch." + ], + "type": "pubkey" + }, + { + "name": "committed_amount", + "docs": [ + "The amount of USDC that has been committed by the funder." + ], + "type": "u64" + }, + { + "name": "seq_num", + "docs": [ + "The sequence number of this funding record. Useful for sorting events." + ], + "type": "u64" + } + ] + } + }, + { + "name": "Launch", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pda_bump", + "docs": [ + "The PDA bump." + ], + "type": "u8" + }, + { + "name": "minimum_raise_amount", + "docs": [ + "The minimum amount of USDC that must be raised, otherwise", + "everyone can get their USDC back." + ], + "type": "u64" + }, + { + "name": "launch_authority", + "docs": [ + "The account that can start the launch." + ], + "type": "pubkey" + }, + { + "name": "launch_signer", + "docs": [ + "The launch signer address. Needed because Raydium pools need a SOL payer and this PDA can't hold SOL." + ], + "type": "pubkey" + }, + { + "name": "launch_signer_pda_bump", + "docs": [ + "The PDA bump for the launch signer." + ], + "type": "u8" + }, + { + "name": "launch_usdc_vault", + "docs": [ + "The USDC vault that will hold the USDC raised until the launch is over." + ], + "type": "pubkey" + }, + { + "name": "launch_token_vault", + "docs": [ + "The token vault, used to send tokens to Raydium." + ], + "type": "pubkey" + }, + { + "name": "token_mint", + "docs": [ + "The token that will be minted to funders and that will control the DAO." + ], + "type": "pubkey" + }, + { + "name": "usdc_mint", + "docs": [ + "The USDC mint." + ], + "type": "pubkey" + }, + { + "name": "unix_timestamp_started", + "docs": [ + "The unix timestamp when the launch was started." + ], + "type": "i64" + }, + { + "name": "total_committed_amount", + "docs": [ + "The amount of USDC that has been committed by the users." + ], + "type": "u64" + }, + { + "name": "state", + "docs": [ + "The state of the launch." + ], + "type": { + "defined": { + "name": "LaunchState" + } + } + }, + { + "name": "seq_num", + "docs": [ + "The sequence number of this launch. Useful for sorting events." + ], + "type": "u64" + }, + { + "name": "seconds_for_launch", + "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": "pubkey" + } + }, + { + "name": "dao_treasury", + "docs": [ + "The DAO treasury that USDC / LP is sent to, if the launch is complete." + ], + "type": { + "option": "pubkey" + } + } + ] + } + }, + { + "name": "LaunchInitializedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "minimum_raise_amount", + "type": "u64" + }, + { + "name": "launch_authority", + "type": "pubkey" + }, + { + "name": "launch_signer", + "type": "pubkey" + }, + { + "name": "launch_signer_pda_bump", + "type": "u8" + }, + { + "name": "launch_usdc_vault", + "type": "pubkey" + }, + { + "name": "launch_token_vault", + "type": "pubkey" + }, + { + "name": "token_mint", + "type": "pubkey" + }, + { + "name": "usdc_mint", + "type": "pubkey" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "seconds_for_launch", + "type": "u32" + } + ] + } + }, + { + "name": "LaunchStartedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "launch_authority", + "type": "pubkey" + }, + { + "name": "slot_started", + "type": "u64" + } + ] + } + }, + { + "name": "LaunchFundedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "funding_record", + "type": "pubkey" + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "funder", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "total_committed_by_funder", + "type": "u64" + }, + { + "name": "total_committed", + "type": "u64" + }, + { + "name": "funding_record_seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "LaunchCompletedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "final_state", + "type": { + "defined": { + "name": "LaunchState" + } + } + }, + { + "name": "total_committed", + "type": "u64" + }, + { + "name": "dao", + "type": { + "option": "pubkey" + } + }, + { + "name": "dao_treasury", + "type": { + "option": "pubkey" + } + } + ] + } + }, + { + "name": "LaunchRefundedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "funder", + "type": "pubkey" + }, + { + "name": "usdc_refunded", + "type": "u64" + }, + { + "name": "funding_record", + "type": "pubkey" + } + ] + } + }, + { + "name": "LaunchClaimEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "funder", + "type": "pubkey" + }, + { + "name": "tokens_claimed", + "type": "u64" + }, + { + "name": "funding_record", + "type": "pubkey" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/sdk/src/launchpad/v0.4/types/launchpad.ts b/sdk/src/launchpad/v0.4/types/launchpad.ts index 50a6f63aa..0a1ace7b0 100644 --- a/sdk/src/launchpad/v0.4/types/launchpad.ts +++ b/sdk/src/launchpad/v0.4/types/launchpad.ts @@ -1,183 +1,159 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL was converted from the legacy format with `anchor idl convert` and lives in + * the `.json` file next to this one. + */ export type Launchpad = { - version: "0.4.1"; - name: "launchpad"; + address: "AfJJJ5UqxhBKoE3grkKAZZsoXDE9kncbMKvqSHGsCNrE"; + metadata: { + name: "launchpad"; + version: "0.4.1"; + spec: "0.1.0"; + }; instructions: [ { name: "initializeLaunch"; + discriminator: [90, 201, 220, 142, 112, 253, 100, 13]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenMetadata"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchSigner"; - isMut: false; - isSigner: false; }, { name: "usdcVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "launchAuthority"; - isMut: false; - isSigner: false; }, { name: "usdcMint"; - isMut: false; - isSigner: false; }, { name: "rent"; - isMut: false; - isSigner: false; + address: "SysvarRent111111111111111111111111111111111"; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "tokenMetadataProgram"; - isMut: false; - isSigner: false; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "args"; type: { - defined: "InitializeLaunchArgs"; + defined: { + name: "initializeLaunchArgs"; + }; }; }, ]; }, { name: "startLaunch"; + discriminator: [205, 178, 36, 232, 95, 202, 241, 68]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchAuthority"; - isMut: false; - isSigner: true; + signer: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "fund"; + discriminator: [218, 188, 111, 221, 152, 113, 174, 7]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "fundingRecord"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchSigner"; - isMut: false; - isSigner: false; }, { name: "launchUsdcVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "funder"; - isMut: false; - isSigner: true; + signer: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "funderUsdcAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ @@ -189,293 +165,391 @@ export type Launchpad = { }, { name: "completeLaunch"; + discriminator: [118, 207, 250, 130, 44, 148, 251, 237]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenMetadata"; - isMut: true; - isSigner: false; + writable: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "launchSigner"; - isMut: true; - isSigner: false; + writable: true; }, { name: "authority"; - isMut: false; - isSigner: false; }, { name: "launchUsdcVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchTokenVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "treasuryUsdcAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "treasuryLpAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammConfig"; - isMut: true; - isSigner: false; docs: [ "Use the lowest fee pool, can see fees at https://api-v3.raydium.io/main/cpmm-config", ]; + writable: true; }, { name: "poolState"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "usdcMint"; - isMut: false; - isSigner: false; }, { name: "lpMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "lpVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "poolTokenVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "poolUsdcVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "createPoolFee"; - isMut: true; - isSigner: false; docs: ["create pool fee account"]; + writable: true; }, { name: "observationState"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "daoTreasury"; - isMut: false; - isSigner: false; }, { name: "cpSwapProgram"; - isMut: false; - isSigner: false; }, { name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "autocratProgram"; - isMut: false; - isSigner: false; }, { name: "tokenMetadataProgram"; - isMut: false; - isSigner: false; }, { name: "autocratEventAuthority"; - isMut: false; - isSigner: false; }, { name: "rent"; - isMut: false; - isSigner: false; + address: "SysvarRent111111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "refund"; + discriminator: [2, 96, 183, 251, 63, 208, 46, 46]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "fundingRecord"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchUsdcVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchSigner"; - isMut: false; - isSigner: false; }, { name: "funder"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "funderUsdcAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "claim"; + discriminator: [62, 198, 214, 193, 213, 159, 108, 210]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "fundingRecord"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchSigner"; - isMut: false; - isSigner: false; }, { name: "tokenMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchTokenVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "funder"; - isMut: false; - isSigner: false; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "funderTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, ]; accounts: [ + { + name: "fundingRecord"; + discriminator: [20, 34, 251, 238, 204, 117, 11, 67]; + }, + { + name: "launch"; + discriminator: [144, 51, 51, 163, 206, 85, 213, 38]; + }, + ]; + events: [ + { + name: "launchInitializedEvent"; + discriminator: [227, 109, 144, 20, 65, 239, 101, 176]; + }, + { + name: "launchStartedEvent"; + discriminator: [187, 129, 95, 253, 255, 206, 36, 239]; + }, + { + name: "launchFundedEvent"; + discriminator: [107, 1, 188, 175, 129, 59, 38, 79]; + }, + { + name: "launchCompletedEvent"; + discriminator: [11, 31, 43, 56, 39, 157, 147, 101]; + }, + { + name: "launchRefundedEvent"; + discriminator: [59, 128, 76, 161, 92, 17, 206, 130]; + }, + { + name: "launchClaimEvent"; + discriminator: [185, 124, 167, 74, 161, 160, 106, 96]; + }, + ]; + 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: "Launch needs to be in refunding state to get a refund"; + }, + { + 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"; + }, + ]; + 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: "secondsForLaunch"; + type: "u32"; + }, + { + name: "tokenName"; + type: "string"; + }, + { + name: "tokenSymbol"; + type: "string"; + }, + { + name: "tokenUri"; + type: "string"; + }, + ]; + }; + }, + { + name: "launchState"; + type: { + kind: "enum"; + variants: [ + { + name: "initialized"; + }, + { + name: "live"; + }, + { + name: "complete"; + }, + { + name: "refunding"; + }, + ]; + }; + }, { name: "fundingRecord"; type: { @@ -489,12 +563,12 @@ export type Launchpad = { { name: "funder"; docs: ["The funder."]; - type: "publicKey"; + type: "pubkey"; }, { name: "launch"; docs: ["The launch."]; - type: "publicKey"; + type: "pubkey"; }, { name: "committedAmount"; @@ -532,14 +606,14 @@ export type Launchpad = { { name: "launchAuthority"; docs: ["The account that can start the launch."]; - type: "publicKey"; + type: "pubkey"; }, { name: "launchSigner"; docs: [ "The launch signer address. Needed because Raydium pools need a SOL payer and this PDA can't hold SOL.", ]; - type: "publicKey"; + type: "pubkey"; }, { name: "launchSignerPdaBump"; @@ -551,24 +625,24 @@ export type Launchpad = { docs: [ "The USDC vault that will hold the USDC raised until the launch is over.", ]; - type: "publicKey"; + type: "pubkey"; }, { name: "launchTokenVault"; docs: ["The token vault, used to send tokens to Raydium."]; - type: "publicKey"; + type: "pubkey"; }, { name: "tokenMint"; docs: [ "The token that will be minted to funders and that will control the DAO.", ]; - type: "publicKey"; + type: "pubkey"; }, { name: "usdcMint"; docs: ["The USDC mint."]; - type: "publicKey"; + type: "pubkey"; }, { name: "unixTimestampStarted"; @@ -584,7 +658,9 @@ export type Launchpad = { name: "state"; docs: ["The state of the launch."]; type: { - defined: "LaunchState"; + defined: { + name: "launchState"; + }; }; }, { @@ -603,7 +679,7 @@ export type Launchpad = { name: "dao"; docs: ["The DAO, if the launch is complete."]; type: { - option: "publicKey"; + option: "pubkey"; }; }, { @@ -612,1388 +688,251 @@ export type Launchpad = { "The DAO treasury that USDC / LP is sent to, if the launch is complete.", ]; type: { - option: "publicKey"; + option: "pubkey"; }; }, ]; }; }, - ]; - types: [ { - name: "CommonFields"; + name: "launchInitializedEvent"; type: { kind: "struct"; fields: [ { - name: "slot"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "launch"; + type: "pubkey"; + }, + { + name: "minimumRaiseAmount"; type: "u64"; }, { - name: "unixTimestamp"; - type: "i64"; + name: "launchAuthority"; + type: "pubkey"; }, { - name: "launchSeqNum"; + name: "launchSigner"; + type: "pubkey"; + }, + { + name: "launchSignerPdaBump"; + type: "u8"; + }, + { + name: "launchUsdcVault"; + type: "pubkey"; + }, + { + name: "launchTokenVault"; + type: "pubkey"; + }, + { + name: "tokenMint"; + type: "pubkey"; + }, + { + name: "usdcMint"; + type: "pubkey"; + }, + { + name: "pdaBump"; + type: "u8"; + }, + { + name: "secondsForLaunch"; + type: "u32"; + }, + ]; + }; + }, + { + name: "launchStartedEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "launch"; + type: "pubkey"; + }, + { + name: "launchAuthority"; + type: "pubkey"; + }, + { + name: "slotStarted"; type: "u64"; }, ]; }; }, { - name: "InitializeLaunchArgs"; + name: "launchFundedEvent"; type: { kind: "struct"; fields: [ { - name: "minimumRaiseAmount"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "fundingRecord"; + type: "pubkey"; + }, + { + name: "launch"; + type: "pubkey"; + }, + { + name: "funder"; + type: "pubkey"; + }, + { + name: "amount"; type: "u64"; }, { - name: "secondsForLaunch"; - type: "u32"; + name: "totalCommittedByFunder"; + type: "u64"; }, { - name: "tokenName"; - type: "string"; + name: "totalCommitted"; + type: "u64"; }, { - name: "tokenSymbol"; - type: "string"; + name: "fundingRecordSeqNum"; + type: "u64"; + }, + ]; + }; + }, + { + name: "launchCompletedEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "tokenUri"; - type: "string"; + name: "launch"; + type: "pubkey"; + }, + { + name: "finalState"; + type: { + defined: { + name: "launchState"; + }; + }; + }, + { + name: "totalCommitted"; + type: "u64"; + }, + { + name: "dao"; + type: { + option: "pubkey"; + }; + }, + { + name: "daoTreasury"; + type: { + option: "pubkey"; + }; }, ]; }; }, { - name: "LaunchState"; + name: "launchRefundedEvent"; type: { - kind: "enum"; - variants: [ + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, { - name: "Initialized"; + name: "launch"; + type: "pubkey"; }, { - name: "Live"; + name: "funder"; + type: "pubkey"; }, { - name: "Complete"; + name: "usdcRefunded"; + type: "u64"; }, { - name: "Refunding"; + name: "fundingRecord"; + type: "pubkey"; }, ]; }; }, - ]; - 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: "tokenMint"; - type: "publicKey"; - index: false; - }, - { - name: "usdcMint"; - 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: "fundingRecordSeqNum"; - 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: "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; - }, - ]; - }, - ]; - 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: "Launch needs to be in refunding state to get a refund"; - }, - { - 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"; - }, - ]; -}; - -export const IDL: Launchpad = { - version: "0.4.1", - name: "launchpad", - instructions: [ - { - name: "initializeLaunch", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "tokenMint", - isMut: true, - isSigner: false, - }, - { - name: "tokenMetadata", - isMut: true, - isSigner: false, - }, - { - name: "launchSigner", - isMut: false, - isSigner: false, - }, - { - name: "usdcVault", - isMut: true, - isSigner: false, - }, - { - name: "tokenVault", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "launchAuthority", - isMut: false, - isSigner: false, - }, - { - name: "usdcMint", - 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: "launchSigner", - isMut: false, - isSigner: false, - }, - { - name: "launchUsdcVault", - isMut: true, - isSigner: false, - }, - { - name: "funder", - isMut: false, - isSigner: true, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "funderUsdcAccount", - 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: "tokenMetadata", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "launchSigner", - isMut: true, - isSigner: false, - }, - { - name: "authority", - isMut: false, - isSigner: false, - }, - { - name: "launchUsdcVault", - isMut: true, - isSigner: false, - }, - { - name: "launchTokenVault", - isMut: true, - isSigner: false, - }, - { - name: "treasuryUsdcAccount", - isMut: true, - isSigner: false, - }, - { - name: "treasuryLpAccount", - isMut: true, - isSigner: false, - }, - { - name: "ammConfig", - isMut: true, - isSigner: false, - docs: [ - "Use the lowest fee pool, can see fees at https://api-v3.raydium.io/main/cpmm-config", - ], - }, - { - name: "poolState", - isMut: true, - isSigner: false, - }, - { - name: "tokenMint", - isMut: true, - isSigner: false, - }, - { - name: "usdcMint", - isMut: false, - isSigner: false, - }, - { - name: "lpMint", - isMut: true, - isSigner: false, - }, - { - name: "lpVault", - isMut: true, - isSigner: false, - }, - { - name: "poolTokenVault", - isMut: true, - isSigner: false, - }, - { - name: "poolUsdcVault", - isMut: true, - isSigner: false, - }, - { - name: "createPoolFee", - isMut: true, - isSigner: false, - docs: ["create pool fee account"], - }, - { - name: "observationState", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - }, - { - name: "daoTreasury", - isMut: false, - isSigner: false, - }, - { - name: "cpSwapProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "autocratProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenMetadataProgram", - isMut: false, - isSigner: false, - }, - { - name: "autocratEventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "rent", - 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: "launchUsdcVault", - isMut: true, - isSigner: false, - }, - { - name: "launchSigner", - isMut: false, - isSigner: false, - }, - { - name: "funder", - isMut: true, - isSigner: true, - }, - { - name: "funderUsdcAccount", - 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: "tokenMint", - isMut: true, - isSigner: false, - }, - { - name: "launchTokenVault", - isMut: true, - isSigner: false, - }, - { - name: "funder", - isMut: false, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - 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: [], - }, - ], - 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: "seqNum", - docs: [ - "The sequence number of this funding record. Useful for sorting events.", - ], - type: "u64", - }, - ], - }, - }, - { - name: "launch", + name: "launchClaimEvent"; type: { - kind: "struct", + 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: "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: "launchUsdcVault", - docs: [ - "The USDC vault that will hold the USDC raised until the launch is over.", - ], - type: "publicKey", - }, - { - name: "launchTokenVault", - docs: ["The token vault, used to send tokens to Raydium."], - type: "publicKey", - }, - { - name: "tokenMint", - docs: [ - "The token that will be minted to funders and that will control the DAO.", - ], - type: "publicKey", - }, - { - name: "usdcMint", - docs: ["The USDC mint."], - type: "publicKey", - }, - { - name: "unixTimestampStarted", - docs: ["The unix timestamp when the launch was started."], - type: "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: "daoTreasury", - docs: [ - "The DAO treasury that USDC / LP is sent to, if the launch is complete.", - ], + name: "common"; type: { - option: "publicKey", - }, - }, - ], - }, - }, - ], - 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: "secondsForLaunch", - type: "u32", - }, - { - name: "tokenName", - type: "string", - }, - { - name: "tokenSymbol", - type: "string", - }, - { - name: "tokenUri", - type: "string", + defined: { + name: "commonFields"; + }; + }; }, - ], - }, - }, - { - name: "LaunchState", - type: { - kind: "enum", - variants: [ { - name: "Initialized", + name: "launch"; + type: "pubkey"; }, { - name: "Live", + name: "funder"; + type: "pubkey"; }, { - name: "Complete", + name: "tokensClaimed"; + type: "u64"; }, { - 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: "tokenMint", - type: "publicKey", - index: false, - }, - { - name: "usdcMint", - 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: "fundingRecordSeqNum", - 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: "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", + name: "fundingRecord"; + type: "pubkey"; }, - 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, - }, - ], - }, - ], - 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: "Launch needs to be in refunding state to get a refund", - }, - { - 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", + ]; + }; }, - ], + ]; }; diff --git a/sdk/src/launchpad/v0.5/LaunchpadClient.ts b/sdk/src/launchpad/v0.5/LaunchpadClient.ts index f21a25ef9..e778da168 100644 --- a/sdk/src/launchpad/v0.5/LaunchpadClient.ts +++ b/sdk/src/launchpad/v0.5/LaunchpadClient.ts @@ -1,11 +1,11 @@ -import { AnchorProvider, Program } from "@coral-xyz/anchor"; +import { AnchorProvider, Program } from "@anchor-lang/core"; import { PublicKey, Keypair, AccountInfo, ComputeBudgetProgram, } from "@solana/web3.js"; -import { Launchpad, IDL as LaunchpadIDL } from "./types/launchpad.js"; +import { LaunchpadProgram as Launchpad, LaunchpadIDL } from "./types/index.js"; import { LAUNCHPAD_V0_5_PROGRAM_ID, RAYDIUM_AUTHORITY, @@ -40,7 +40,7 @@ import { 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 anchor from "@anchor-lang/core"; import * as multisig from "@sqds/multisig"; export type CreateLaunchpadClientParams = { @@ -59,8 +59,12 @@ export class LaunchpadClient { private constructor(params: CreateLaunchpadClientParams) { this.provider = params.provider; this.launchpad = new Program( - LaunchpadIDL, - params.launchpadProgramId || LAUNCHPAD_V0_5_PROGRAM_ID, + { + ...LaunchpadIDL, + address: ( + params.launchpadProgramId || LAUNCHPAD_V0_5_PROGRAM_ID + ).toBase58(), + }, this.provider, ); this.autocratClient = AutocratClient.createClient({ @@ -154,7 +158,7 @@ export class LaunchpadClient { monthlySpendingLimitAmount, monthlySpendingLimitMembers, }) - .accounts({ + .accountsPartial({ launch, launchSigner, quoteVault, @@ -181,7 +185,7 @@ export class LaunchpadClient { launch: PublicKey, launchAuthority: PublicKey = this.provider.publicKey, ) { - return this.launchpad.methods.startLaunch().accounts({ + return this.launchpad.methods.startLaunch().accountsPartial({ launch, launchAuthority, }); @@ -216,7 +220,7 @@ export class LaunchpadClient { funder, ); - return this.launchpad.methods.fund(amount).accounts({ + return this.launchpad.methods.fund(amount).accountsPartial({ launch, launchQuoteVault, fundingRecord, @@ -314,7 +318,7 @@ export class LaunchpadClient { true, ); - return this.launchpad.methods.completeLaunch().accounts({ + return this.launchpad.methods.completeLaunch().accountsPartial({ launch, launchSigner, launchQuoteVault, @@ -393,7 +397,7 @@ export class LaunchpadClient { true, ); - return this.launchpad.methods.refund().accounts({ + return this.launchpad.methods.refund().accountsPartial({ launch, launchSigner, launchQuoteVault, @@ -420,7 +424,7 @@ export class LaunchpadClient { return this.launchpad.methods .claim() - .accounts({ + .accountsPartial({ launch, fundingRecord, launchSigner, diff --git a/sdk/src/launchpad/v0.5/pda.ts b/sdk/src/launchpad/v0.5/pda.ts index 589e277c3..68e8f2abc 100644 --- a/sdk/src/launchpad/v0.5/pda.ts +++ b/sdk/src/launchpad/v0.5/pda.ts @@ -1,5 +1,5 @@ import { PublicKey } from "@solana/web3.js"; -import { utils } from "@coral-xyz/anchor"; +import { utils } from "@anchor-lang/core"; import { LAUNCHPAD_V0_5_PROGRAM_ID, RAYDIUM_CP_SWAP_PROGRAM_ID, diff --git a/sdk/src/launchpad/v0.5/types/index.ts b/sdk/src/launchpad/v0.5/types/index.ts index 8ee0e3354..95f8ab859 100644 --- a/sdk/src/launchpad/v0.5/types/index.ts +++ b/sdk/src/launchpad/v0.5/types/index.ts @@ -1,25 +1,24 @@ -import { - Launchpad as LaunchpadProgram, - IDL as LaunchpadIDL, -} from "./launchpad.js"; -export { LaunchpadProgram, LaunchpadIDL }; +import type { Launchpad as LaunchpadProgram } from "./launchpad.js"; +import launchpadIdl from "./launchpad.json" with { type: "json" }; +export type { LaunchpadProgram }; +export const LaunchpadIDL = launchpadIdl as LaunchpadProgram; -import type { IdlAccounts, IdlEvents } from "@coral-xyz/anchor"; +import type { IdlAccounts, IdlEvents } from "@anchor-lang/core"; export type Launch = IdlAccounts["launch"]; export type FundingRecord = IdlAccounts["fundingRecord"]; -export type LaunchClaimEvent = IdlEvents["LaunchClaimEvent"]; +export type LaunchClaimEvent = IdlEvents["launchClaimEvent"]; export type LaunchCompletedEvent = - IdlEvents["LaunchCompletedEvent"]; + IdlEvents["launchCompletedEvent"]; export type LaunchFundedEvent = - IdlEvents["LaunchFundedEvent"]; + IdlEvents["launchFundedEvent"]; export type LaunchInitializedEvent = - IdlEvents["LaunchInitializedEvent"]; + IdlEvents["launchInitializedEvent"]; export type LaunchRefundedEvent = - IdlEvents["LaunchRefundedEvent"]; + IdlEvents["launchRefundedEvent"]; export type LaunchStartedEvent = - IdlEvents["LaunchStartedEvent"]; + IdlEvents["launchStartedEvent"]; export type LaunchpadEvent = | LaunchClaimEvent | LaunchCompletedEvent diff --git a/sdk/src/launchpad/v0.5/types/launchpad.json b/sdk/src/launchpad/v0.5/types/launchpad.json new file mode 100644 index 000000000..2a4ba43f9 --- /dev/null +++ b/sdk/src/launchpad/v0.5/types/launchpad.json @@ -0,0 +1,1142 @@ +{ + "address": "mooNhciQJi1LqHDmse2JPic2NqG2PXCanbE3ZYzP3qA", + "metadata": { + "name": "launchpad", + "version": "0.5.0", + "spec": "0.1.0" + }, + "instructions": [ + { + "name": "initialize_launch", + "discriminator": [ + 90, + 201, + 220, + 142, + 112, + 253, + 100, + 13 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "base_mint", + "writable": true + }, + { + "name": "token_metadata", + "writable": true + }, + { + "name": "launch_signer" + }, + { + "name": "quote_vault", + "writable": true + }, + { + "name": "base_vault", + "writable": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "launch_authority" + }, + { + "name": "quote_mint" + }, + { + "name": "rent", + "address": "SysvarRent111111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_metadata_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "InitializeLaunchArgs" + } + } + } + ] + }, + { + "name": "start_launch", + "discriminator": [ + 205, + 178, + 36, + 232, + 95, + 202, + 241, + 68 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "launch_authority", + "signer": true + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "fund", + "discriminator": [ + 218, + 188, + 111, + 221, + 152, + 113, + 174, + 7 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "funding_record", + "writable": true + }, + { + "name": "launch_signer" + }, + { + "name": "launch_quote_vault", + "writable": true + }, + { + "name": "funder", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "funder_quote_account", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "amount", + "type": "u64" + } + ] + }, + { + "name": "complete_launch", + "discriminator": [ + 118, + 207, + 250, + 130, + 44, + 148, + 251, + 237 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "token_metadata", + "writable": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "launch_signer", + "writable": true + }, + { + "name": "launch_quote_vault", + "writable": true + }, + { + "name": "launch_base_vault", + "writable": true + }, + { + "name": "treasury_quote_account", + "writable": true + }, + { + "name": "treasury_lp_account", + "writable": true + }, + { + "name": "pool_state", + "writable": true + }, + { + "name": "base_mint", + "writable": true + }, + { + "name": "quote_mint" + }, + { + "name": "lp_mint", + "writable": true + }, + { + "name": "lp_vault", + "writable": true + }, + { + "name": "pool_token_vault", + "writable": true + }, + { + "name": "pool_usdc_vault", + "writable": true + }, + { + "name": "observation_state", + "writable": true + }, + { + "name": "dao", + "writable": true + }, + { + "name": "squads_multisig", + "writable": true + }, + { + "name": "squads_multisig_vault" + }, + { + "name": "spending_limit", + "writable": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "static_accounts", + "accounts": [ + { + "name": "authority" + }, + { + "name": "amm_config", + "docs": [ + "Use the lowest fee pool, can see fees at https://api-v3.raydium.io/main/cpmm-config" + ], + "writable": true + }, + { + "name": "create_pool_fee", + "docs": [ + "create pool fee account" + ], + "writable": true + }, + { + "name": "cp_swap_program" + }, + { + "name": "autocrat_program" + }, + { + "name": "token_metadata_program" + }, + { + "name": "autocrat_event_authority" + }, + { + "name": "rent", + "address": "SysvarRent111111111111111111111111111111111" + }, + { + "name": "squads_program" + }, + { + "name": "squads_program_config" + }, + { + "name": "squads_program_config_treasury", + "writable": true + } + ] + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "refund", + "discriminator": [ + 2, + 96, + 183, + 251, + 63, + 208, + 46, + 46 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "funding_record", + "writable": true + }, + { + "name": "launch_quote_vault", + "writable": true + }, + { + "name": "launch_signer" + }, + { + "name": "funder", + "writable": true, + "signer": true + }, + { + "name": "funder_quote_account", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "claim", + "discriminator": [ + 62, + 198, + 214, + 193, + 213, + 159, + 108, + 210 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "funding_record", + "writable": true + }, + { + "name": "launch_signer" + }, + { + "name": "base_mint", + "writable": true + }, + { + "name": "launch_base_vault", + "writable": true + }, + { + "name": "funder" + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "funder_token_account", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + } + ], + "accounts": [ + { + "name": "FundingRecord", + "discriminator": [ + 20, + 34, + 251, + 238, + 204, + 117, + 11, + 67 + ] + }, + { + "name": "Launch", + "discriminator": [ + 144, + 51, + 51, + 163, + 206, + 85, + 213, + 38 + ] + } + ], + "events": [ + { + "name": "LaunchInitializedEvent", + "discriminator": [ + 227, + 109, + 144, + 20, + 65, + 239, + 101, + 176 + ] + }, + { + "name": "LaunchStartedEvent", + "discriminator": [ + 187, + 129, + 95, + 253, + 255, + 206, + 36, + 239 + ] + }, + { + "name": "LaunchFundedEvent", + "discriminator": [ + 107, + 1, + 188, + 175, + 129, + 59, + 38, + 79 + ] + }, + { + "name": "LaunchCompletedEvent", + "discriminator": [ + 11, + 31, + 43, + 56, + 39, + 157, + 147, + 101 + ] + }, + { + "name": "LaunchRefundedEvent", + "discriminator": [ + 59, + 128, + 76, + 161, + 92, + 17, + 206, + 130 + ] + }, + { + "name": "LaunchClaimEvent", + "discriminator": [ + 185, + 124, + 167, + 74, + 161, + 160, + 106, + 96 + ] + } + ], + "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": "Launch needs to be in refunding state to get a refund" + }, + { + "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" + } + ], + "types": [ + { + "name": "CommonFields", + "type": { + "kind": "struct", + "fields": [ + { + "name": "slot", + "type": "u64" + }, + { + "name": "unix_timestamp", + "type": "i64" + }, + { + "name": "launch_seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "InitializeLaunchArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "minimum_raise_amount", + "type": "u64" + }, + { + "name": "monthly_spending_limit_amount", + "type": "u64" + }, + { + "name": "monthly_spending_limit_members", + "type": { + "vec": "pubkey" + } + }, + { + "name": "seconds_for_launch", + "type": "u32" + }, + { + "name": "token_name", + "type": "string" + }, + { + "name": "token_symbol", + "type": "string" + }, + { + "name": "token_uri", + "type": "string" + } + ] + } + }, + { + "name": "LaunchState", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Initialized" + }, + { + "name": "Live" + }, + { + "name": "Complete" + }, + { + "name": "Refunding" + } + ] + } + }, + { + "name": "FundingRecord", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pda_bump", + "docs": [ + "The PDA bump." + ], + "type": "u8" + }, + { + "name": "funder", + "docs": [ + "The funder." + ], + "type": "pubkey" + }, + { + "name": "launch", + "docs": [ + "The launch." + ], + "type": "pubkey" + }, + { + "name": "committed_amount", + "docs": [ + "The amount of USDC that has been committed by the funder." + ], + "type": "u64" + }, + { + "name": "seq_num", + "docs": [ + "The sequence number of this funding record. Useful for sorting events." + ], + "type": "u64" + } + ] + } + }, + { + "name": "Launch", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pda_bump", + "docs": [ + "The PDA bump." + ], + "type": "u8" + }, + { + "name": "minimum_raise_amount", + "docs": [ + "The minimum amount of USDC that must be raised, otherwise", + "everyone can get their USDC back." + ], + "type": "u64" + }, + { + "name": "monthly_spending_limit_amount", + "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": "monthly_spending_limit_members", + "docs": [ + "The wallets that have access to the monthly spending limit." + ], + "type": { + "vec": "pubkey" + } + }, + { + "name": "launch_authority", + "docs": [ + "The account that can start the launch." + ], + "type": "pubkey" + }, + { + "name": "launch_signer", + "docs": [ + "The launch signer address. Needed because Raydium pools need a SOL payer and this PDA can't hold SOL." + ], + "type": "pubkey" + }, + { + "name": "launch_signer_pda_bump", + "docs": [ + "The PDA bump for the launch signer." + ], + "type": "u8" + }, + { + "name": "launch_quote_vault", + "docs": [ + "The USDC vault that will hold the USDC raised until the launch is over." + ], + "type": "pubkey" + }, + { + "name": "launch_base_vault", + "docs": [ + "The token vault, used to send tokens to Raydium." + ], + "type": "pubkey" + }, + { + "name": "base_mint", + "docs": [ + "The token that will be minted to funders and that will control the DAO." + ], + "type": "pubkey" + }, + { + "name": "quote_mint", + "docs": [ + "The USDC mint." + ], + "type": "pubkey" + }, + { + "name": "unix_timestamp_started", + "docs": [ + "The unix timestamp when the launch was started." + ], + "type": "i64" + }, + { + "name": "total_committed_amount", + "docs": [ + "The amount of USDC that has been committed by the users." + ], + "type": "u64" + }, + { + "name": "state", + "docs": [ + "The state of the launch." + ], + "type": { + "defined": { + "name": "LaunchState" + } + } + }, + { + "name": "seq_num", + "docs": [ + "The sequence number of this launch. Useful for sorting events." + ], + "type": "u64" + }, + { + "name": "seconds_for_launch", + "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": "pubkey" + } + }, + { + "name": "dao_vault", + "docs": [ + "The DAO treasury that USDC / LP is sent to, if the launch is complete." + ], + "type": { + "option": "pubkey" + } + } + ] + } + }, + { + "name": "LaunchInitializedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "minimum_raise_amount", + "type": "u64" + }, + { + "name": "launch_authority", + "type": "pubkey" + }, + { + "name": "launch_signer", + "type": "pubkey" + }, + { + "name": "launch_signer_pda_bump", + "type": "u8" + }, + { + "name": "launch_usdc_vault", + "type": "pubkey" + }, + { + "name": "launch_token_vault", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "seconds_for_launch", + "type": "u32" + } + ] + } + }, + { + "name": "LaunchStartedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "launch_authority", + "type": "pubkey" + }, + { + "name": "slot_started", + "type": "u64" + } + ] + } + }, + { + "name": "LaunchFundedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "funding_record", + "type": "pubkey" + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "funder", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "total_committed_by_funder", + "type": "u64" + }, + { + "name": "total_committed", + "type": "u64" + }, + { + "name": "funding_record_seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "LaunchCompletedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "final_state", + "type": { + "defined": { + "name": "LaunchState" + } + } + }, + { + "name": "total_committed", + "type": "u64" + }, + { + "name": "dao", + "type": { + "option": "pubkey" + } + }, + { + "name": "dao_treasury", + "type": { + "option": "pubkey" + } + } + ] + } + }, + { + "name": "LaunchRefundedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "funder", + "type": "pubkey" + }, + { + "name": "usdc_refunded", + "type": "u64" + }, + { + "name": "funding_record", + "type": "pubkey" + } + ] + } + }, + { + "name": "LaunchClaimEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "funder", + "type": "pubkey" + }, + { + "name": "tokens_claimed", + "type": "u64" + }, + { + "name": "funding_record", + "type": "pubkey" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/sdk/src/launchpad/v0.5/types/launchpad.ts b/sdk/src/launchpad/v0.5/types/launchpad.ts index 0af6abd3c..14e886f77 100644 --- a/sdk/src/launchpad/v0.5/types/launchpad.ts +++ b/sdk/src/launchpad/v0.5/types/launchpad.ts @@ -1,183 +1,159 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL was converted from the legacy format with `anchor idl convert` and lives in + * the `.json` file next to this one. + */ export type Launchpad = { - version: "0.5.0"; - name: "launchpad"; + address: "mooNhciQJi1LqHDmse2JPic2NqG2PXCanbE3ZYzP3qA"; + metadata: { + name: "launchpad"; + version: "0.5.0"; + spec: "0.1.0"; + }; instructions: [ { name: "initializeLaunch"; + discriminator: [90, 201, 220, 142, 112, 253, 100, 13]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "baseMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenMetadata"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchSigner"; - isMut: false; - isSigner: false; }, { name: "quoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "baseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "launchAuthority"; - isMut: false; - isSigner: false; }, { name: "quoteMint"; - isMut: false; - isSigner: false; }, { name: "rent"; - isMut: false; - isSigner: false; + address: "SysvarRent111111111111111111111111111111111"; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "tokenMetadataProgram"; - isMut: false; - isSigner: false; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "args"; type: { - defined: "InitializeLaunchArgs"; + defined: { + name: "initializeLaunchArgs"; + }; }; }, ]; }, { name: "startLaunch"; + discriminator: [205, 178, 36, 232, 95, 202, 241, 68]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchAuthority"; - isMut: false; - isSigner: true; + signer: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "fund"; + discriminator: [218, 188, 111, 221, 152, 113, 174, 7]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "fundingRecord"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchSigner"; - isMut: false; - isSigner: false; }, { name: "launchQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "funder"; - isMut: false; - isSigner: true; + signer: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "funderQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ @@ -189,323 +165,429 @@ export type Launchpad = { }, { name: "completeLaunch"; + discriminator: [118, 207, 250, 130, 44, 148, 251, 237]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenMetadata"; - isMut: true; - isSigner: false; + writable: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "launchSigner"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "treasuryQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "treasuryLpAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "poolState"; - isMut: true; - isSigner: false; + writable: true; }, { name: "baseMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "quoteMint"; - isMut: false; - isSigner: false; }, { name: "lpMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "lpVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "poolTokenVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "poolUsdcVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "observationState"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisig"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisigVault"; - isMut: false; - isSigner: false; }, { name: "spendingLimit"; - isMut: true; - isSigner: false; + writable: true; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "staticAccounts"; accounts: [ { name: "authority"; - isMut: false; - isSigner: false; }, { name: "ammConfig"; - isMut: true; - isSigner: false; docs: [ "Use the lowest fee pool, can see fees at https://api-v3.raydium.io/main/cpmm-config", ]; + writable: true; }, { name: "createPoolFee"; - isMut: true; - isSigner: false; docs: ["create pool fee account"]; + writable: true; }, { name: "cpSwapProgram"; - isMut: false; - isSigner: false; }, { name: "autocratProgram"; - isMut: false; - isSigner: false; }, { name: "tokenMetadataProgram"; - isMut: false; - isSigner: false; }, { name: "autocratEventAuthority"; - isMut: false; - isSigner: false; }, { name: "rent"; - isMut: false; - isSigner: false; + address: "SysvarRent111111111111111111111111111111111"; }, { name: "squadsProgram"; - isMut: false; - isSigner: false; }, { name: "squadsProgramConfig"; - isMut: false; - isSigner: false; }, { name: "squadsProgramConfigTreasury"; - isMut: true; - isSigner: false; + writable: true; }, ]; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "refund"; + discriminator: [2, 96, 183, 251, 63, 208, 46, 46]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "fundingRecord"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchSigner"; - isMut: false; - isSigner: false; }, { name: "funder"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "funderQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "claim"; + discriminator: [62, 198, 214, 193, 213, 159, 108, 210]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "fundingRecord"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchSigner"; - isMut: false; - isSigner: false; }, { name: "baseMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "funder"; - isMut: false; - isSigner: false; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "funderTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, ]; accounts: [ + { + name: "fundingRecord"; + discriminator: [20, 34, 251, 238, 204, 117, 11, 67]; + }, + { + name: "launch"; + discriminator: [144, 51, 51, 163, 206, 85, 213, 38]; + }, + ]; + events: [ + { + name: "launchInitializedEvent"; + discriminator: [227, 109, 144, 20, 65, 239, 101, 176]; + }, + { + name: "launchStartedEvent"; + discriminator: [187, 129, 95, 253, 255, 206, 36, 239]; + }, + { + name: "launchFundedEvent"; + discriminator: [107, 1, 188, 175, 129, 59, 38, 79]; + }, + { + name: "launchCompletedEvent"; + discriminator: [11, 31, 43, 56, 39, 157, 147, 101]; + }, + { + name: "launchRefundedEvent"; + discriminator: [59, 128, 76, 161, 92, 17, 206, 130]; + }, + { + name: "launchClaimEvent"; + discriminator: [185, 124, 167, 74, 161, 160, 106, 96]; + }, + ]; + 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: "Launch needs to be in refunding state to get a refund"; + }, + { + 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"; + }, + ]; + 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: "pubkey"; + }; + }, + { + name: "secondsForLaunch"; + type: "u32"; + }, + { + name: "tokenName"; + type: "string"; + }, + { + name: "tokenSymbol"; + type: "string"; + }, + { + name: "tokenUri"; + type: "string"; + }, + ]; + }; + }, + { + name: "launchState"; + type: { + kind: "enum"; + variants: [ + { + name: "initialized"; + }, + { + name: "live"; + }, + { + name: "complete"; + }, + { + name: "refunding"; + }, + ]; + }; + }, { name: "fundingRecord"; type: { @@ -519,12 +601,12 @@ export type Launchpad = { { name: "funder"; docs: ["The funder."]; - type: "publicKey"; + type: "pubkey"; }, { name: "launch"; docs: ["The launch."]; - type: "publicKey"; + type: "pubkey"; }, { name: "committedAmount"; @@ -573,20 +655,20 @@ export type Launchpad = { "The wallets that have access to the monthly spending limit.", ]; type: { - vec: "publicKey"; + vec: "pubkey"; }; }, { name: "launchAuthority"; docs: ["The account that can start the launch."]; - type: "publicKey"; + type: "pubkey"; }, { name: "launchSigner"; docs: [ "The launch signer address. Needed because Raydium pools need a SOL payer and this PDA can't hold SOL.", ]; - type: "publicKey"; + type: "pubkey"; }, { name: "launchSignerPdaBump"; @@ -598,24 +680,24 @@ export type Launchpad = { docs: [ "The USDC vault that will hold the USDC raised until the launch is over.", ]; - type: "publicKey"; + type: "pubkey"; }, { name: "launchBaseVault"; docs: ["The token vault, used to send tokens to Raydium."]; - type: "publicKey"; + type: "pubkey"; }, { name: "baseMint"; docs: [ "The token that will be minted to funders and that will control the DAO.", ]; - type: "publicKey"; + type: "pubkey"; }, { name: "quoteMint"; docs: ["The USDC mint."]; - type: "publicKey"; + type: "pubkey"; }, { name: "unixTimestampStarted"; @@ -631,7 +713,9 @@ export type Launchpad = { name: "state"; docs: ["The state of the launch."]; type: { - defined: "LaunchState"; + defined: { + name: "launchState"; + }; }; }, { @@ -650,7 +734,7 @@ export type Launchpad = { name: "dao"; docs: ["The DAO, if the launch is complete."]; type: { - option: "publicKey"; + option: "pubkey"; }; }, { @@ -659,1465 +743,251 @@ export type Launchpad = { "The DAO treasury that USDC / LP is sent to, if the launch is complete.", ]; type: { - option: "publicKey"; + option: "pubkey"; }; }, ]; }; }, - ]; - types: [ { - name: "CommonFields"; + name: "launchInitializedEvent"; type: { kind: "struct"; fields: [ { - name: "slot"; - type: "u64"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "unixTimestamp"; - type: "i64"; + name: "launch"; + type: "pubkey"; }, { - name: "launchSeqNum"; + name: "minimumRaiseAmount"; type: "u64"; }, + { + name: "launchAuthority"; + type: "pubkey"; + }, + { + name: "launchSigner"; + type: "pubkey"; + }, + { + name: "launchSignerPdaBump"; + type: "u8"; + }, + { + name: "launchUsdcVault"; + type: "pubkey"; + }, + { + name: "launchTokenVault"; + type: "pubkey"; + }, + { + name: "baseMint"; + type: "pubkey"; + }, + { + name: "quoteMint"; + type: "pubkey"; + }, + { + name: "pdaBump"; + type: "u8"; + }, + { + name: "secondsForLaunch"; + type: "u32"; + }, ]; }; }, { - name: "InitializeLaunchArgs"; + name: "launchStartedEvent"; type: { kind: "struct"; fields: [ { - name: "minimumRaiseAmount"; - type: "u64"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "monthlySpendingLimitAmount"; + name: "launch"; + type: "pubkey"; + }, + { + name: "launchAuthority"; + type: "pubkey"; + }, + { + name: "slotStarted"; type: "u64"; }, + ]; + }; + }, + { + name: "launchFundedEvent"; + type: { + kind: "struct"; + fields: [ { - name: "monthlySpendingLimitMembers"; + name: "common"; type: { - vec: "publicKey"; + defined: { + name: "commonFields"; + }; }; }, { - name: "secondsForLaunch"; - type: "u32"; + name: "fundingRecord"; + type: "pubkey"; }, { - name: "tokenName"; - type: "string"; + name: "launch"; + type: "pubkey"; }, { - name: "tokenSymbol"; - type: "string"; + name: "funder"; + type: "pubkey"; }, { - name: "tokenUri"; - type: "string"; + name: "amount"; + type: "u64"; + }, + { + name: "totalCommittedByFunder"; + type: "u64"; + }, + { + name: "totalCommitted"; + type: "u64"; + }, + { + name: "fundingRecordSeqNum"; + type: "u64"; }, ]; }; }, { - name: "LaunchState"; + name: "launchCompletedEvent"; type: { - kind: "enum"; - variants: [ + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "launch"; + type: "pubkey"; + }, { - name: "Initialized"; + name: "finalState"; + type: { + defined: { + name: "launchState"; + }; + }; }, { - name: "Live"; + name: "totalCommitted"; + type: "u64"; }, { - name: "Complete"; + name: "dao"; + type: { + option: "pubkey"; + }; }, { - name: "Refunding"; + name: "daoTreasury"; + type: { + option: "pubkey"; + }; }, ]; }; }, - ]; - 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: "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: "fundingRecordSeqNum"; - 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: "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; - }, - ]; - }, - ]; - 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: "Launch needs to be in refunding state to get a refund"; - }, - { - 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"; - }, - ]; -}; - -export const IDL: Launchpad = { - version: "0.5.0", - 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: "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: "completeLaunch", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - 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: "treasuryLpAccount", - isMut: true, - isSigner: false, - }, - { - name: "poolState", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: true, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "lpMint", - isMut: true, - isSigner: false, - }, - { - name: "lpVault", - isMut: true, - isSigner: false, - }, - { - name: "poolTokenVault", - isMut: true, - isSigner: false, - }, - { - name: "poolUsdcVault", - isMut: true, - isSigner: false, - }, - { - name: "observationState", - 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: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "associatedTokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "staticAccounts", - accounts: [ - { - name: "authority", - isMut: false, - isSigner: false, - }, - { - name: "ammConfig", - isMut: true, - isSigner: false, - docs: [ - "Use the lowest fee pool, can see fees at https://api-v3.raydium.io/main/cpmm-config", - ], - }, - { - name: "createPoolFee", - isMut: true, - isSigner: false, - docs: ["create pool fee account"], - }, - { - name: "cpSwapProgram", - isMut: false, - isSigner: false, - }, - { - name: "autocratProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenMetadataProgram", - isMut: false, - isSigner: false, - }, - { - name: "autocratEventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "rent", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgram", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgramConfig", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgramConfigTreasury", - isMut: true, - 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: 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: "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: "payer", - isMut: true, - isSigner: true, - }, - { - 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: [], - }, - ], - 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: "seqNum", - docs: [ - "The sequence number of this funding record. Useful for sorting events.", - ], - type: "u64", - }, - ], - }, - }, - { - name: "launch", + name: "launchRefundedEvent"; type: { - kind: "struct", + 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: "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."], + name: "common"; type: { - option: "publicKey", - }, + defined: { + name: "commonFields"; + }; + }; }, { - name: "daoVault", - docs: [ - "The DAO treasury that USDC / LP is sent to, if the launch is complete.", - ], - type: { - option: "publicKey", - }, + name: "launch"; + type: "pubkey"; }, - ], - }, - }, - ], - types: [ - { - name: "CommonFields", - type: { - kind: "struct", - fields: [ { - name: "slot", - type: "u64", + name: "funder"; + type: "pubkey"; }, { - name: "unixTimestamp", - type: "i64", + name: "usdcRefunded"; + type: "u64"; }, { - name: "launchSeqNum", - type: "u64", + name: "fundingRecord"; + type: "pubkey"; }, - ], - }, + ]; + }; }, { - name: "InitializeLaunchArgs", + name: "launchClaimEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "minimumRaiseAmount", - type: "u64", - }, - { - name: "monthlySpendingLimitAmount", - type: "u64", - }, - { - name: "monthlySpendingLimitMembers", + name: "common"; type: { - vec: "publicKey", - }, - }, - { - name: "secondsForLaunch", - type: "u32", - }, - { - name: "tokenName", - type: "string", - }, - { - name: "tokenSymbol", - type: "string", - }, - { - name: "tokenUri", - type: "string", + defined: { + name: "commonFields"; + }; + }; }, - ], - }, - }, - { - name: "LaunchState", - type: { - kind: "enum", - variants: [ { - name: "Initialized", + name: "launch"; + type: "pubkey"; }, { - name: "Live", + name: "funder"; + type: "pubkey"; }, { - name: "Complete", + name: "tokensClaimed"; + type: "u64"; }, { - 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: "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: "fundingRecordSeqNum", - 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: "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", + name: "fundingRecord"; + type: "pubkey"; }, - 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, - }, - ], - }, - ], - 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: "Launch needs to be in refunding state to get a refund", - }, - { - 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", + ]; + }; }, - ], + ]; }; diff --git a/sdk/src/launchpad/v0.6/LaunchpadClient.ts b/sdk/src/launchpad/v0.6/LaunchpadClient.ts index 173b66e49..abaa167ef 100644 --- a/sdk/src/launchpad/v0.6/LaunchpadClient.ts +++ b/sdk/src/launchpad/v0.6/LaunchpadClient.ts @@ -1,10 +1,11 @@ -import { AnchorProvider, Program } from "@coral-xyz/anchor"; +import { AnchorProvider, Program } from "@anchor-lang/core"; 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"; + LaunchpadProgram as Launchpad, + LaunchpadIDL, + v0_6_0_Launchpad as v0_6_0_launchpad, + v0_6_0_LaunchpadIDL as v0_6_0_launchpadIDL, +} from "./types/index.js"; import { LAUNCHPAD_V0_6_PROGRAM_ID, MPL_TOKEN_METADATA_PROGRAM_ID, @@ -56,13 +57,21 @@ export class LaunchpadClient { private constructor(params: CreateLaunchpadClientParams) { this.provider = params.provider; this.launchpad = new Program( - LaunchpadIDL, - params.launchpadProgramId || LAUNCHPAD_V0_6_PROGRAM_ID, + { + ...LaunchpadIDL, + address: ( + params.launchpadProgramId || LAUNCHPAD_V0_6_PROGRAM_ID + ).toBase58(), + }, this.provider, ); this.v0_6_0_launchpad = new Program( - v0_6_0_launchpadIDL, - params.launchpadProgramId || LAUNCHPAD_V0_6_PROGRAM_ID, + { + ...v0_6_0_launchpadIDL, + address: ( + params.launchpadProgramId || LAUNCHPAD_V0_6_PROGRAM_ID + ).toBase58(), + }, this.provider, ); this.futarchyClient = FutarchyClient.createClient({ @@ -182,7 +191,7 @@ export class LaunchpadClient { monthsUntilInsidersCanUnlock, teamAddress, }) - .accounts({ + .accountsPartial({ launch, launchSigner, quoteVault, @@ -212,7 +221,7 @@ export class LaunchpadClient { launch: PublicKey; launchAuthority?: PublicKey; }) { - return this.launchpad.methods.startLaunch().accounts({ + return this.launchpad.methods.startLaunch().accountsPartial({ launch, launchAuthority, }); @@ -247,7 +256,7 @@ export class LaunchpadClient { funder, ); - return this.launchpad.methods.fund(amount).accounts({ + return this.launchpad.methods.fund(amount).accountsPartial({ launch, launchQuoteVault, fundingRecord, @@ -257,7 +266,7 @@ export class LaunchpadClient { } closeLaunchIx({ launch }: { launch: PublicKey }) { - return this.launchpad.methods.closeLaunch().accounts({ + return this.launchpad.methods.closeLaunch().accountsPartial({ launch, }); } @@ -404,7 +413,7 @@ export class LaunchpadClient { return this.launchpad.methods .completeLaunch({ finalRaiseAmount }) - .accounts({ + .accountsPartial({ launch, launchSigner, launchQuoteVault, @@ -501,7 +510,7 @@ export class LaunchpadClient { true, ); - return this.launchpad.methods.refund().accounts({ + return this.launchpad.methods.refund().accountsPartial({ launch, launchSigner, launchQuoteVault, @@ -528,7 +537,7 @@ export class LaunchpadClient { return this.launchpad.methods .claim() - .accounts({ + .accountsPartial({ launch, fundingRecord, launchSigner, diff --git a/sdk/src/launchpad/v0.6/types/index.ts b/sdk/src/launchpad/v0.6/types/index.ts index 2e0337f75..608c40416 100644 --- a/sdk/src/launchpad/v0.6/types/index.ts +++ b/sdk/src/launchpad/v0.6/types/index.ts @@ -1,31 +1,29 @@ -import { IdlAccounts, IdlEvents } from "@coral-xyz/anchor"; -import { - Launchpad as LaunchpadProgram, - IDL as LaunchpadIDL, -} from "./launchpad.js"; -export { LaunchpadProgram, LaunchpadIDL }; +import { IdlAccounts, IdlEvents } from "@anchor-lang/core"; +import type { Launchpad as LaunchpadProgram } from "./launchpad.js"; +import launchpadIdl from "./launchpad.json" with { type: "json" }; +export type { LaunchpadProgram }; +export const LaunchpadIDL = launchpadIdl as LaunchpadProgram; -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 type { Launchpad as v0_6_0_Launchpad } from "./v0.6.0-launchpad.js"; +import v0_6_0_LaunchpadIdl from "./v0.6.0-launchpad.json" with { type: "json" }; +export type { v0_6_0_Launchpad }; +export const v0_6_0_LaunchpadIDL = v0_6_0_LaunchpadIdl as v0_6_0_Launchpad; export type Launch = IdlAccounts["launch"]; export type FundingRecord = IdlAccounts["fundingRecord"]; -export type LaunchClaimEvent = IdlEvents["LaunchClaimEvent"]; +export type LaunchClaimEvent = IdlEvents["launchClaimEvent"]; export type LaunchCompletedEvent = - IdlEvents["LaunchCompletedEvent"]; + IdlEvents["launchCompletedEvent"]; export type LaunchFundedEvent = - IdlEvents["LaunchFundedEvent"]; + IdlEvents["launchFundedEvent"]; export type LaunchInitializedEvent = - IdlEvents["LaunchInitializedEvent"]; + IdlEvents["launchInitializedEvent"]; export type LaunchRefundedEvent = - IdlEvents["LaunchRefundedEvent"]; + IdlEvents["launchRefundedEvent"]; export type LaunchStartedEvent = - IdlEvents["LaunchStartedEvent"]; -export type LaunchCloseEvent = IdlEvents["LaunchCloseEvent"]; + IdlEvents["launchStartedEvent"]; +export type LaunchCloseEvent = IdlEvents["launchCloseEvent"]; export type LaunchpadEvent = | LaunchClaimEvent | LaunchCompletedEvent @@ -36,19 +34,19 @@ export type LaunchpadEvent = | LaunchCloseEvent; export type v0_6_0_LaunchClaimEvent = - IdlEvents["LaunchClaimEvent"]; + IdlEvents["launchClaimEvent"]; export type v0_6_0_LaunchCompletedEvent = - IdlEvents["LaunchCompletedEvent"]; + IdlEvents["launchCompletedEvent"]; export type v0_6_0_LaunchFundedEvent = - IdlEvents["LaunchFundedEvent"]; + IdlEvents["launchFundedEvent"]; export type v0_6_0_LaunchInitializedEvent = - IdlEvents["LaunchInitializedEvent"]; + IdlEvents["launchInitializedEvent"]; export type v0_6_0_LaunchRefundedEvent = - IdlEvents["LaunchRefundedEvent"]; + IdlEvents["launchRefundedEvent"]; export type v0_6_0_LaunchStartedEvent = - IdlEvents["LaunchStartedEvent"]; + IdlEvents["launchStartedEvent"]; export type v0_6_0_LaunchCloseEvent = - IdlEvents["LaunchCloseEvent"]; + IdlEvents["launchCloseEvent"]; export type v0_6_0_LaunchpadEvent = | v0_6_0_LaunchClaimEvent | v0_6_0_LaunchCompletedEvent diff --git a/sdk/src/launchpad/v0.6/types/launchpad.json b/sdk/src/launchpad/v0.6/types/launchpad.json new file mode 100644 index 000000000..78e90c13f --- /dev/null +++ b/sdk/src/launchpad/v0.6/types/launchpad.json @@ -0,0 +1,3082 @@ +{ + "address": "MooNyh4CBUYEKyXVnjGYQ8mEiJDpGvJMdvrZx1iGeHV", + "metadata": { + "name": "launchpad", + "version": "0.6.1", + "spec": "0.1.0", + "description": "Created with Anchor" + }, + "instructions": [ + { + "name": "claim", + "discriminator": [ + 62, + 198, + 214, + 193, + 213, + 159, + 108, + 210 + ], + "accounts": [ + { + "name": "launch", + "writable": true, + "relations": [ + "funding_record" + ] + }, + { + "name": "funding_record", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 117, + 110, + 100, + 105, + 110, + 103, + 95, + 114, + 101, + 99, + 111, + 114, + 100 + ] + }, + { + "kind": "account", + "path": "launch" + }, + { + "kind": "account", + "path": "funder" + } + ] + } + }, + { + "name": "launch_signer", + "relations": [ + "launch" + ] + }, + { + "name": "base_mint", + "relations": [ + "launch" + ] + }, + { + "name": "launch_base_vault", + "writable": true, + "relations": [ + "launch" + ] + }, + { + "name": "funder", + "relations": [ + "funding_record" + ] + }, + { + "name": "funder_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "funder" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "close_launch", + "discriminator": [ + 27, + 216, + 111, + 223, + 10, + 230, + 19, + 211 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "complete_launch", + "discriminator": [ + 118, + 207, + 250, + 130, + 44, + 148, + 251, + 237 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "launch_authority", + "signer": true, + "optional": true + }, + { + "name": "token_metadata", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 101, + 116, + 97, + 100, + 97, + 116, + 97 + ] + }, + { + "kind": "const", + "value": [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70 + ] + } + } + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "launch_signer", + "writable": true, + "relations": [ + "launch" + ] + }, + { + "name": "launch_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "launch_signer" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + }, + "relations": [ + "launch" + ] + }, + { + "name": "launch_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "launch_signer" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + }, + "relations": [ + "launch" + ] + }, + { + "name": "treasury_quote_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "squads_multisig_vault" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "base_mint", + "writable": true, + "relations": [ + "launch" + ] + }, + { + "name": "quote_mint", + "relations": [ + "launch" + ] + }, + { + "name": "dao_owned_lp_position", + "writable": true + }, + { + "name": "futarchy_amm_base_vault", + "writable": true + }, + { + "name": "futarchy_amm_quote_vault", + "writable": true + }, + { + "name": "dao", + "writable": true + }, + { + "name": "squads_multisig", + "writable": true + }, + { + "name": "squads_multisig_vault" + }, + { + "name": "spending_limit", + "writable": true + }, + { + "name": "performance_package", + "writable": true + }, + { + "name": "performance_package_token_account", + "writable": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "static_accounts", + "accounts": [ + { + "name": "futarchy_program", + "address": "FUTARELBfJfQ8RDGhg1wdhddq1odMAJUePHFuBYfUxKq" + }, + { + "name": "token_metadata_program", + "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" + }, + { + "name": "autocrat_event_authority" + }, + { + "name": "squads_program", + "address": "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf" + }, + { + "name": "squads_program_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "const", + "value": [ + 112, + 114, + 111, + 103, + 114, + 97, + 109, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + } + ], + "program": { + "kind": "account", + "path": "squads_program" + } + } + }, + { + "name": "squads_program_config_treasury", + "writable": true + }, + { + "name": "price_based_performance_package_program", + "address": "pbPPQH7jyKoSLu8QYs3rSY3YkDRXEBojKbTgnUg7NDS" + }, + { + "name": "price_based_performance_package_event_authority" + } + ] + }, + { + "name": "meteora_accounts", + "accounts": [ + { + "name": "damm_v2_program", + "address": "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG" + }, + { + "name": "config" + }, + { + "name": "token_2022_program", + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "position_nft_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110, + 95, + 110, + 102, + 116, + 95, + 97, + 99, + 99, + 111, + 117, + 110, + 116 + ] + }, + { + "kind": "account", + "path": "position_nft_mint" + } + ], + "program": { + "kind": "account", + "path": "damm_v2_program" + } + } + }, + { + "name": "pool", + "writable": true + }, + { + "name": "position", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110 + ] + }, + { + "kind": "account", + "path": "position_nft_mint" + } + ], + "program": { + "kind": "account", + "path": "damm_v2_program" + } + } + }, + { + "name": "position_nft_mint", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110, + 95, + 110, + 102, + 116, + 95, + 109, + 105, + 110, + 116 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ] + } + }, + { + "name": "base_mint" + }, + { + "name": "quote_mint" + }, + { + "name": "token_a_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 116, + 111, + 107, + 101, + 110, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "base_mint" + }, + { + "kind": "account", + "path": "pool" + } + ], + "program": { + "kind": "account", + "path": "damm_v2_program" + } + } + }, + { + "name": "token_b_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 116, + 111, + 107, + 101, + 110, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "quote_mint" + }, + { + "kind": "account", + "path": "pool" + } + ], + "program": { + "kind": "account", + "path": "damm_v2_program" + } + } + }, + { + "name": "pool_creator_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 100, + 97, + 109, + 109, + 95, + 112, + 111, + 111, + 108, + 95, + 99, + 114, + 101, + 97, + 116, + 111, + 114, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "pool_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ], + "program": { + "kind": "account", + "path": "damm_v2_program" + } + } + }, + { + "name": "damm_v2_event_authority" + } + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "CompleteLaunchArgs" + } + } + } + ] + }, + { + "name": "fund", + "discriminator": [ + 218, + 188, + 111, + 221, + 152, + 113, + 174, + 7 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "funding_record", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 117, + 110, + 100, + 105, + 110, + 103, + 95, + 114, + 101, + 99, + 111, + 114, + 100 + ] + }, + { + "kind": "account", + "path": "launch" + }, + { + "kind": "account", + "path": "funder" + } + ] + } + }, + { + "name": "launch_quote_vault", + "writable": true, + "relations": [ + "launch" + ] + }, + { + "name": "funder", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "funder_quote_account", + "writable": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "amount", + "type": "u64" + } + ] + }, + { + "name": "initialize_launch", + "discriminator": [ + 90, + 201, + 220, + 142, + 112, + 253, + 100, + 13 + ], + "accounts": [ + { + "name": "launch", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 108, + 97, + 117, + 110, + 99, + 104 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ] + } + }, + { + "name": "base_mint", + "writable": true + }, + { + "name": "token_metadata", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 101, + 116, + 97, + 100, + 97, + 116, + 97 + ] + }, + { + "kind": "const", + "value": [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70 + ] + } + } + }, + { + "name": "launch_signer", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 108, + 97, + 117, + 110, + 99, + 104, + 95, + 115, + 105, + 103, + 110, + 101, + 114 + ] + }, + { + "kind": "account", + "path": "launch" + } + ] + } + }, + { + "name": "quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "launch_signer" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "launch_signer" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "launch_authority" + }, + { + "name": "quote_mint", + "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" + }, + { + "name": "rent", + "address": "SysvarRent111111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_metadata_program", + "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "InitializeLaunchArgs" + } + } + } + ] + }, + { + "name": "refund", + "discriminator": [ + 2, + 96, + 183, + 251, + 63, + 208, + 46, + 46 + ], + "accounts": [ + { + "name": "launch", + "writable": true, + "relations": [ + "funding_record" + ] + }, + { + "name": "funding_record", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 117, + 110, + 100, + 105, + 110, + 103, + 95, + 114, + 101, + 99, + 111, + 114, + 100 + ] + }, + { + "kind": "account", + "path": "launch" + }, + { + "kind": "account", + "path": "funder" + } + ] + } + }, + { + "name": "launch_quote_vault", + "writable": true, + "relations": [ + "launch" + ] + }, + { + "name": "launch_signer", + "relations": [ + "launch" + ] + }, + { + "name": "funder", + "relations": [ + "funding_record" + ] + }, + { + "name": "funder_quote_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "funder" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "launch.quote_mint", + "account": "Launch" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "return_funds", + "discriminator": [ + 220, + 104, + 119, + 202, + 186, + 1, + 45, + 90 + ], + "accounts": [ + { + "name": "admin", + "signer": true + }, + { + "name": "launch", + "writable": true + }, + { + "name": "launch_quote_vault", + "writable": true, + "relations": [ + "launch" + ] + }, + { + "name": "launch_signer", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 108, + 97, + 117, + 110, + 99, + 104, + 95, + 115, + 105, + 103, + 110, + 101, + 114 + ] + }, + { + "kind": "account", + "path": "launch" + } + ] + }, + "relations": [ + "launch" + ] + }, + { + "name": "recipient" + }, + { + "name": "recipient_quote_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "recipient" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "launch.quote_mint", + "account": "Launch" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "ReturnFundsArgs" + } + } + } + ] + }, + { + "name": "start_launch", + "discriminator": [ + 205, + 178, + 36, + 232, + 95, + 202, + 241, + 68 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "launch_authority", + "signer": true, + "relations": [ + "launch" + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + } + ], + "accounts": [ + { + "name": "FundingRecord", + "discriminator": [ + 20, + 34, + 251, + 238, + 204, + 117, + 11, + 67 + ] + }, + { + "name": "Launch", + "discriminator": [ + 144, + 51, + 51, + 163, + 206, + 85, + 213, + 38 + ] + } + ], + "events": [ + { + "name": "LaunchClaimEvent", + "discriminator": [ + 185, + 124, + 167, + 74, + 161, + 160, + 106, + 96 + ] + }, + { + "name": "LaunchCloseEvent", + "discriminator": [ + 229, + 71, + 160, + 47, + 144, + 13, + 115, + 12 + ] + }, + { + "name": "LaunchCompletedEvent", + "discriminator": [ + 11, + 31, + 43, + 56, + 39, + 157, + 147, + 101 + ] + }, + { + "name": "LaunchFundedEvent", + "discriminator": [ + 107, + 1, + 188, + 175, + 129, + 59, + 38, + 79 + ] + }, + { + "name": "LaunchFundsReturnedEvent", + "discriminator": [ + 4, + 117, + 127, + 237, + 30, + 27, + 239, + 250 + ] + }, + { + "name": "LaunchInitializedEvent", + "discriminator": [ + 227, + 109, + 144, + 20, + 65, + 239, + 101, + 176 + ] + }, + { + "name": "LaunchRefundedEvent", + "discriminator": [ + 59, + 128, + 76, + 161, + 92, + 17, + 206, + 130 + ] + }, + { + "name": "LaunchStartedEvent", + "discriminator": [ + 187, + 129, + 95, + 253, + 255, + 206, + 36, + 239 + ] + } + ], + "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" + } + ], + "types": [ + { + "name": "CommonFields", + "type": { + "kind": "struct", + "fields": [ + { + "name": "slot", + "type": "u64" + }, + { + "name": "unix_timestamp", + "type": "i64" + }, + { + "name": "launch_seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "CompleteLaunchArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "final_raise_amount", + "type": { + "option": "u64" + } + } + ] + } + }, + { + "name": "FundingRecord", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pda_bump", + "docs": [ + "The PDA bump." + ], + "type": "u8" + }, + { + "name": "funder", + "docs": [ + "The funder." + ], + "type": "pubkey" + }, + { + "name": "launch", + "docs": [ + "The launch." + ], + "type": "pubkey" + }, + { + "name": "committed_amount", + "docs": [ + "The amount of USDC that has been committed by the funder." + ], + "type": "u64" + }, + { + "name": "is_tokens_claimed", + "docs": [ + "Whether the tokens have been claimed." + ], + "type": "bool" + }, + { + "name": "is_usdc_refunded", + "docs": [ + "Whether the USDC has been refunded." + ], + "type": "bool" + } + ] + } + }, + { + "name": "InitializeLaunchArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "minimum_raise_amount", + "type": "u64" + }, + { + "name": "monthly_spending_limit_amount", + "type": "u64" + }, + { + "name": "monthly_spending_limit_members", + "type": { + "vec": "pubkey" + } + }, + { + "name": "seconds_for_launch", + "type": "u32" + }, + { + "name": "token_name", + "type": "string" + }, + { + "name": "token_symbol", + "type": "string" + }, + { + "name": "token_uri", + "type": "string" + }, + { + "name": "performance_package_grantee", + "type": "pubkey" + }, + { + "name": "performance_package_token_amount", + "type": "u64" + }, + { + "name": "months_until_insiders_can_unlock", + "type": "u8" + }, + { + "name": "team_address", + "type": "pubkey" + } + ] + } + }, + { + "name": "Launch", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pda_bump", + "docs": [ + "The PDA bump." + ], + "type": "u8" + }, + { + "name": "minimum_raise_amount", + "docs": [ + "The minimum amount of USDC that must be raised, otherwise", + "everyone can get their USDC back." + ], + "type": "u64" + }, + { + "name": "monthly_spending_limit_amount", + "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": "monthly_spending_limit_members", + "docs": [ + "The wallets that have access to the monthly spending limit." + ], + "type": { + "vec": "pubkey" + } + }, + { + "name": "launch_authority", + "docs": [ + "The account that can start the launch." + ], + "type": "pubkey" + }, + { + "name": "launch_signer", + "docs": [ + "The launch signer address. Needed because Raydium pools need a SOL payer and this PDA can't hold SOL." + ], + "type": "pubkey" + }, + { + "name": "launch_signer_pda_bump", + "docs": [ + "The PDA bump for the launch signer." + ], + "type": "u8" + }, + { + "name": "launch_quote_vault", + "docs": [ + "The USDC vault that will hold the USDC raised until the launch is over." + ], + "type": "pubkey" + }, + { + "name": "launch_base_vault", + "docs": [ + "The token vault, used to send tokens to Raydium." + ], + "type": "pubkey" + }, + { + "name": "base_mint", + "docs": [ + "The token that will be minted to funders and that will control the DAO." + ], + "type": "pubkey" + }, + { + "name": "quote_mint", + "docs": [ + "The USDC mint." + ], + "type": "pubkey" + }, + { + "name": "unix_timestamp_started", + "docs": [ + "The unix timestamp when the launch was started." + ], + "type": { + "option": "i64" + } + }, + { + "name": "unix_timestamp_closed", + "docs": [ + "The unix timestamp when the launch stopped taking new contributions." + ], + "type": { + "option": "i64" + } + }, + { + "name": "total_committed_amount", + "docs": [ + "The amount of USDC that has been committed by the users." + ], + "type": "u64" + }, + { + "name": "final_raise_amount", + "docs": [ + "The final raise amount." + ], + "type": { + "option": "u64" + } + }, + { + "name": "state", + "docs": [ + "The state of the launch." + ], + "type": { + "defined": { + "name": "LaunchState" + } + } + }, + { + "name": "seq_num", + "docs": [ + "The sequence number of this launch. Useful for sorting events." + ], + "type": "u64" + }, + { + "name": "seconds_for_launch", + "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": "pubkey" + } + }, + { + "name": "dao_vault", + "docs": [ + "The DAO treasury that USDC / LP is sent to, if the launch is complete." + ], + "type": { + "option": "pubkey" + } + }, + { + "name": "performance_package_grantee", + "docs": [ + "The address that will receive the performance package tokens." + ], + "type": "pubkey" + }, + { + "name": "performance_package_token_amount", + "docs": [ + "The amount of tokens to be granted to the performance package grantee." + ], + "type": "u64" + }, + { + "name": "months_until_insiders_can_unlock", + "docs": [ + "The number of months that insiders must wait before unlocking their tokens." + ], + "type": "u8" + }, + { + "name": "team_address", + "docs": [ + "The initial address used to sponsor team proposals." + ], + "type": "pubkey" + } + ] + } + }, + { + "name": "LaunchClaimEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "funder", + "type": "pubkey" + }, + { + "name": "tokens_claimed", + "type": "u64" + }, + { + "name": "funding_record", + "type": "pubkey" + } + ] + } + }, + { + "name": "LaunchCloseEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "new_state", + "type": { + "defined": { + "name": "LaunchState" + } + } + } + ] + } + }, + { + "name": "LaunchCompletedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "final_state", + "type": { + "defined": { + "name": "LaunchState" + } + } + }, + { + "name": "total_committed", + "type": "u64" + }, + { + "name": "dao", + "type": { + "option": "pubkey" + } + }, + { + "name": "dao_treasury", + "type": { + "option": "pubkey" + } + }, + { + "name": "final_raise_amount", + "type": { + "option": "u64" + } + } + ] + } + }, + { + "name": "LaunchFundedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "funding_record", + "type": "pubkey" + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "funder", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "total_committed_by_funder", + "type": "u64" + }, + { + "name": "total_committed", + "type": "u64" + } + ] + } + }, + { + "name": "LaunchFundsReturnedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "recipient", + "type": "pubkey" + }, + { + "name": "usdc_returned", + "type": "u64" + } + ] + } + }, + { + "name": "LaunchInitializedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "minimum_raise_amount", + "type": "u64" + }, + { + "name": "launch_authority", + "type": "pubkey" + }, + { + "name": "launch_signer", + "type": "pubkey" + }, + { + "name": "launch_signer_pda_bump", + "type": "u8" + }, + { + "name": "launch_usdc_vault", + "type": "pubkey" + }, + { + "name": "launch_token_vault", + "type": "pubkey" + }, + { + "name": "performance_package_grantee", + "type": "pubkey" + }, + { + "name": "performance_package_token_amount", + "type": "u64" + }, + { + "name": "months_until_insiders_can_unlock", + "type": "u8" + }, + { + "name": "monthly_spending_limit_amount", + "type": "u64" + }, + { + "name": "monthly_spending_limit_members", + "type": { + "vec": "pubkey" + } + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "seconds_for_launch", + "type": "u32" + } + ] + } + }, + { + "name": "LaunchRefundedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "funder", + "type": "pubkey" + }, + { + "name": "usdc_refunded", + "type": "u64" + }, + { + "name": "funding_record", + "type": "pubkey" + } + ] + } + }, + { + "name": "LaunchStartedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "launch_authority", + "type": "pubkey" + }, + { + "name": "slot_started", + "type": "u64" + } + ] + } + }, + { + "name": "LaunchState", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Initialized" + }, + { + "name": "Live" + }, + { + "name": "Closed" + }, + { + "name": "Complete" + }, + { + "name": "Refunding" + } + ] + } + }, + { + "name": "ReturnFundsArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amount", + "type": "u64" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/sdk/src/launchpad/v0.6/types/launchpad.ts b/sdk/src/launchpad/v0.6/types/launchpad.ts index 3950f26cf..69d3f5082 100644 --- a/sdk/src/launchpad/v0.6/types/launchpad.ts +++ b/sdk/src/launchpad/v0.6/types/launchpad.ts @@ -1,343 +1,754 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL can be found at `target/idl/launchpad.json`. + */ export type Launchpad = { - version: "0.6.1"; - name: "launchpad"; + address: "MooNyh4CBUYEKyXVnjGYQ8mEiJDpGvJMdvrZx1iGeHV"; + metadata: { + name: "launchpad"; + version: "0.6.1"; + spec: "0.1.0"; + description: "Created with Anchor"; + }; instructions: [ { - name: "initializeLaunch"; + name: "claim"; + discriminator: [62, 198, 214, 193, 213, 159, 108, 210]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "baseMint"; - isMut: true; - isSigner: false; + writable: true; + relations: ["fundingRecord"]; }, { - name: "tokenMetadata"; - isMut: true; - isSigner: false; + name: "fundingRecord"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 102, + 117, + 110, + 100, + 105, + 110, + 103, + 95, + 114, + 101, + 99, + 111, + 114, + 100, + ]; + }, + { + kind: "account"; + path: "launch"; + }, + { + kind: "account"; + path: "funder"; + }, + ]; + }; }, { name: "launchSigner"; - isMut: false; - isSigner: false; - }, - { - name: "quoteVault"; - isMut: true; - isSigner: false; + relations: ["launch"]; }, { - name: "baseVault"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; + name: "baseMint"; + relations: ["launch"]; }, { - name: "launchAuthority"; - isMut: false; - isSigner: false; + name: "launchBaseVault"; + writable: true; + relations: ["launch"]; }, { - name: "quoteMint"; - isMut: false; - isSigner: false; + name: "funder"; + relations: ["fundingRecord"]; }, { - name: "rent"; - isMut: false; - isSigner: false; + name: "funderTokenAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "funder"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenMetadataProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "InitializeLaunchArgs"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; }; }, - ]; - }, - { - 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"; + name: "closeLaunch"; + discriminator: [27, 216, 111, 223, 10, 230, 19, 211]; 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; + writable: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "amount"; - type: "u64"; }, ]; + args: []; }, { name: "completeLaunch"; + discriminator: [118, 207, 250, 130, 44, 148, 251, 237]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchAuthority"; - isMut: false; - isSigner: true; - isOptional: true; + signer: true; + optional: true; }, { name: "tokenMetadata"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 101, 116, 97, 100, 97, 116, 97]; + }, + { + kind: "const"; + value: [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70, + ]; + }; + }; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "launchSigner"; - isMut: true; - isSigner: false; + writable: true; + relations: ["launch"]; }, { name: "launchQuoteVault"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "launchSigner"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; + relations: ["launch"]; }, { name: "launchBaseVault"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "launchSigner"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; + relations: ["launch"]; }, { name: "treasuryQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "squadsMultisigVault"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "baseMint"; - isMut: true; - isSigner: false; + writable: true; + relations: ["launch"]; }, { name: "quoteMint"; - isMut: false; - isSigner: false; + relations: ["launch"]; }, { name: "daoOwnedLpPosition"; - isMut: true; - isSigner: false; + writable: true; }, { name: "futarchyAmmBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "futarchyAmmQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisig"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisigVault"; - isMut: false; - isSigner: false; }, { name: "spendingLimit"; - isMut: true; - isSigner: false; + writable: true; }, { name: "performancePackage"; - isMut: true; - isSigner: false; + writable: true; }, { name: "performancePackageTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "staticAccounts"; accounts: [ { name: "futarchyProgram"; - isMut: false; - isSigner: false; + address: "FUTARELBfJfQ8RDGhg1wdhddq1odMAJUePHFuBYfUxKq"; }, { name: "tokenMetadataProgram"; - isMut: false; - isSigner: false; + address: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"; }, { name: "autocratEventAuthority"; - isMut: false; - isSigner: false; }, { name: "squadsProgram"; - isMut: false; - isSigner: false; + address: "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf"; }, { name: "squadsProgramConfig"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "const"; + value: [ + 112, + 114, + 111, + 103, + 114, + 97, + 109, + 95, + 99, + 111, + 110, + 102, + 105, + 103, + ]; + }, + ]; + program: { + kind: "account"; + path: "squadsProgram"; + }; + }; }, { name: "squadsProgramConfigTreasury"; - isMut: true; - isSigner: false; + writable: true; }, { name: "priceBasedPerformancePackageProgram"; - isMut: false; - isSigner: false; + address: "pbPPQH7jyKoSLu8QYs3rSY3YkDRXEBojKbTgnUg7NDS"; }, { name: "priceBasedPerformancePackageEventAuthority"; - isMut: false; - isSigner: false; }, ]; }, @@ -346,309 +757,1464 @@ export type Launchpad = { accounts: [ { name: "dammV2Program"; - isMut: false; - isSigner: false; + address: "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG"; }, { name: "config"; - isMut: false; - isSigner: false; }, { name: "token2022Program"; - isMut: false; - isSigner: false; + address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"; }, { name: "positionNftAccount"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110, + 95, + 110, + 102, + 116, + 95, + 97, + 99, + 99, + 111, + 117, + 110, + 116, + ]; + }, + { + kind: "account"; + path: "positionNftMint"; + }, + ]; + program: { + kind: "account"; + path: "dammV2Program"; + }; + }; }, { name: "pool"; - isMut: true; - isSigner: false; + writable: true; }, { name: "position"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [112, 111, 115, 105, 116, 105, 111, 110]; + }, + { + kind: "account"; + path: "positionNftMint"; + }, + ]; + program: { + kind: "account"; + path: "dammV2Program"; + }; + }; }, { name: "positionNftMint"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110, + 95, + 110, + 102, + 116, + 95, + 109, + 105, + 110, + 116, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + }; }, { name: "baseMint"; - isMut: false; - isSigner: false; }, { name: "quoteMint"; - isMut: false; - isSigner: false; }, { name: "tokenAVault"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 116, + 111, + 107, + 101, + 110, + 95, + 118, + 97, + 117, + 108, + 116, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + { + kind: "account"; + path: "pool"; + }, + ]; + program: { + kind: "account"; + path: "dammV2Program"; + }; + }; }, { name: "tokenBVault"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 116, + 111, + 107, + 101, + 110, + 95, + 118, + 97, + 117, + 108, + 116, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + { + kind: "account"; + path: "pool"; + }, + ]; + program: { + kind: "account"; + path: "dammV2Program"; + }; + }; }, { name: "poolCreatorAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 100, + 97, + 109, + 109, + 95, + 112, + 111, + 111, + 108, + 95, + 99, + 114, + 101, + 97, + 116, + 111, + 114, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "poolAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 112, + 111, + 111, + 108, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + program: { + kind: "account"; + path: "dammV2Program"; + }; + }; }, { name: "dammV2EventAuthority"; - isMut: false; - isSigner: false; }, ]; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "args"; type: { - defined: "CompleteLaunchArgs"; + defined: { + name: "completeLaunchArgs"; + }; }; }, ]; }, { - name: "refund"; + name: "fund"; + discriminator: [218, 188, 111, 221, 152, 113, 174, 7]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "fundingRecord"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 102, + 117, + 110, + 100, + 105, + 110, + 103, + 95, + 114, + 101, + 99, + 111, + 114, + 100, + ]; + }, + { + kind: "account"; + path: "launch"; + }, + { + kind: "account"; + path: "funder"; + }, + ]; + }; }, { name: "launchQuoteVault"; - isMut: true; - isSigner: false; + writable: true; + relations: ["launch"]; }, { - name: "launchSigner"; - isMut: false; - isSigner: false; + name: "funder"; + signer: true; }, { - name: "funder"; - isMut: false; - isSigner: false; + name: "payer"; + writable: true; + signer: true; }, { name: "funderQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; + }, + { + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; - args: []; + args: [ + { + name: "amount"; + type: "u64"; + }, + ]; }, { - name: "claim"; + name: "initializeLaunch"; + discriminator: [90, 201, 220, 142, 112, 253, 100, 13]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [108, 97, 117, 110, 99, 104]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + }; }, { - name: "fundingRecord"; - isMut: true; - isSigner: false; + name: "baseMint"; + writable: true; + }, + { + name: "tokenMetadata"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 101, 116, 97, 100, 97, 116, 97]; + }, + { + kind: "const"; + value: [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70, + ]; + }; + }; }, { name: "launchSigner"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 108, + 97, + 117, + 110, + 99, + 104, + 95, + 115, + 105, + 103, + 110, + 101, + 114, + ]; + }, + { + kind: "account"; + path: "launch"; + }, + ]; + }; }, { - name: "baseMint"; - isMut: false; - isSigner: false; + name: "quoteVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "launchSigner"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "launchBaseVault"; - isMut: true; - isSigner: false; + name: "baseVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "launchSigner"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "funder"; - isMut: false; - isSigner: false; + name: "payer"; + writable: true; + signer: true; }, { - name: "funderTokenAccount"; - isMut: true; - isSigner: false; + name: "launchAuthority"; + }, + { + name: "quoteMint"; + address: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"; + }, + { + name: "rent"; + address: "SysvarRent111111111111111111111111111111111"; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; + }, + { + name: "associatedTokenProgram"; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; + }, + { + name: "systemProgram"; + address: "11111111111111111111111111111111"; + }, + { + name: "tokenMetadataProgram"; + address: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; - args: []; + args: [ + { + name: "args"; + type: { + defined: { + name: "initializeLaunchArgs"; + }; + }; + }, + ]; }, { - name: "closeLaunch"; + name: "refund"; + discriminator: [2, 96, 183, 251, 63, 208, 46, 46]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; + relations: ["fundingRecord"]; + }, + { + name: "fundingRecord"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 102, + 117, + 110, + 100, + 105, + 110, + 103, + 95, + 114, + 101, + 99, + 111, + 114, + 100, + ]; + }, + { + kind: "account"; + path: "launch"; + }, + { + kind: "account"; + path: "funder"; + }, + ]; + }; + }, + { + name: "launchQuoteVault"; + writable: true; + relations: ["launch"]; + }, + { + name: "launchSigner"; + relations: ["launch"]; + }, + { + name: "funder"; + relations: ["fundingRecord"]; + }, + { + name: "funderQuoteAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "funder"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "launch.quote_mint"; + account: "launch"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; + }, + { + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "returnFunds"; + discriminator: [220, 104, 119, 202, 186, 1, 45, 90]; accounts: [ { name: "admin"; - isMut: false; - isSigner: true; + signer: true; }, { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchQuoteVault"; - isMut: true; - isSigner: false; + writable: true; + relations: ["launch"]; }, { name: "launchSigner"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 108, + 97, + 117, + 110, + 99, + 104, + 95, + 115, + 105, + 103, + 110, + 101, + 114, + ]; + }, + { + kind: "account"; + path: "launch"; + }, + ]; + }; + relations: ["launch"]; }, { name: "recipient"; - isMut: false; - isSigner: false; }, { name: "recipientQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "recipient"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "launch.quote_mint"; + account: "launch"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "args"; type: { - defined: "ReturnFundsArgs"; + defined: { + name: "returnFundsArgs"; + }; + }; + }, + ]; + }, + { + name: "startLaunch"; + discriminator: [205, 178, 36, 232, 95, 202, 241, 68]; + accounts: [ + { + name: "launch"; + writable: true; + }, + { + name: "launchAuthority"; + signer: true; + relations: ["launch"]; + }, + { + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; }; }, + { + name: "program"; + }, ]; + 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"; - }, + discriminator: [20, 34, 251, 238, 204, 117, 11, 67]; + }, + { + name: "launch"; + discriminator: [144, 51, 51, 163, 206, 85, 213, 38]; + }, + ]; + events: [ + { + name: "launchClaimEvent"; + discriminator: [185, 124, 167, 74, 161, 160, 106, 96]; + }, + { + name: "launchCloseEvent"; + discriminator: [229, 71, 160, 47, 144, 13, 115, 12]; + }, + { + name: "launchCompletedEvent"; + discriminator: [11, 31, 43, 56, 39, 157, 147, 101]; + }, + { + name: "launchFundedEvent"; + discriminator: [107, 1, 188, 175, 129, 59, 38, 79]; + }, + { + name: "launchFundsReturnedEvent"; + discriminator: [4, 117, 127, 237, 30, 27, 239, 250]; + }, + { + name: "launchInitializedEvent"; + discriminator: [227, 109, 144, 20, 65, 239, 101, 176]; + }, + { + name: "launchRefundedEvent"; + discriminator: [59, 128, 76, 161, 92, 17, 206, 130]; + }, + { + name: "launchStartedEvent"; + discriminator: [187, 129, 95, 253, 255, 206, 36, 239]; + }, + ]; + 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"; + }, + ]; + 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: "fundingRecord"; + type: { + kind: "struct"; + fields: [ + { + name: "pdaBump"; + docs: ["The PDA bump."]; + type: "u8"; + }, + { + name: "funder"; + docs: ["The funder."]; + type: "pubkey"; + }, + { + name: "launch"; + docs: ["The launch."]; + type: "pubkey"; + }, + { + 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."]; @@ -662,6 +2228,60 @@ export type Launchpad = { ]; }; }, + { + name: "initializeLaunchArgs"; + type: { + kind: "struct"; + fields: [ + { + name: "minimumRaiseAmount"; + type: "u64"; + }, + { + name: "monthlySpendingLimitAmount"; + type: "u64"; + }, + { + name: "monthlySpendingLimitMembers"; + type: { + vec: "pubkey"; + }; + }, + { + name: "secondsForLaunch"; + type: "u32"; + }, + { + name: "tokenName"; + type: "string"; + }, + { + name: "tokenSymbol"; + type: "string"; + }, + { + name: "tokenUri"; + type: "string"; + }, + { + name: "performancePackageGrantee"; + type: "pubkey"; + }, + { + name: "performancePackageTokenAmount"; + type: "u64"; + }, + { + name: "monthsUntilInsidersCanUnlock"; + type: "u8"; + }, + { + name: "teamAddress"; + type: "pubkey"; + }, + ]; + }; + }, { name: "launch"; type: { @@ -694,20 +2314,20 @@ export type Launchpad = { "The wallets that have access to the monthly spending limit.", ]; type: { - vec: "publicKey"; + vec: "pubkey"; }; }, { name: "launchAuthority"; docs: ["The account that can start the launch."]; - type: "publicKey"; + type: "pubkey"; }, { name: "launchSigner"; docs: [ "The launch signer address. Needed because Raydium pools need a SOL payer and this PDA can't hold SOL.", ]; - type: "publicKey"; + type: "pubkey"; }, { name: "launchSignerPdaBump"; @@ -719,24 +2339,24 @@ export type Launchpad = { docs: [ "The USDC vault that will hold the USDC raised until the launch is over.", ]; - type: "publicKey"; + type: "pubkey"; }, { name: "launchBaseVault"; docs: ["The token vault, used to send tokens to Raydium."]; - type: "publicKey"; + type: "pubkey"; }, { name: "baseMint"; docs: [ "The token that will be minted to funders and that will control the DAO.", ]; - type: "publicKey"; + type: "pubkey"; }, { name: "quoteMint"; docs: ["The USDC mint."]; - type: "publicKey"; + type: "pubkey"; }, { name: "unixTimestampStarted"; @@ -770,7 +2390,9 @@ export type Launchpad = { name: "state"; docs: ["The state of the launch."]; type: { - defined: "LaunchState"; + defined: { + name: "launchState"; + }; }; }, { @@ -789,7 +2411,7 @@ export type Launchpad = { name: "dao"; docs: ["The DAO, if the launch is complete."]; type: { - option: "publicKey"; + option: "pubkey"; }; }, { @@ -798,7 +2420,7 @@ export type Launchpad = { "The DAO treasury that USDC / LP is sent to, if the launch is complete.", ]; type: { - option: "publicKey"; + option: "pubkey"; }; }, { @@ -806,7 +2428,7 @@ export type Launchpad = { docs: [ "The address that will receive the performance package tokens.", ]; - type: "publicKey"; + type: "pubkey"; }, { name: "performancePackageTokenAmount"; @@ -825,1989 +2447,365 @@ export type Launchpad = { { name: "teamAddress"; docs: ["The initial address used to sponsor team proposals."]; - type: "publicKey"; + type: "pubkey"; }, ]; }; }, - ]; - types: [ { - name: "CommonFields"; + name: "launchClaimEvent"; type: { kind: "struct"; fields: [ { - name: "slot"; - type: "u64"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "unixTimestamp"; - type: "i64"; + name: "launch"; + type: "pubkey"; }, { - name: "launchSeqNum"; + name: "funder"; + type: "pubkey"; + }, + { + name: "tokensClaimed"; type: "u64"; }, + { + name: "fundingRecord"; + type: "pubkey"; + }, ]; }; }, { - name: "CompleteLaunchArgs"; + name: "launchCloseEvent"; type: { kind: "struct"; fields: [ { - name: "finalRaiseAmount"; + name: "common"; type: { - option: "u64"; + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "launch"; + type: "pubkey"; + }, + { + name: "newState"; + type: { + defined: { + name: "launchState"; + }; }; }, ]; }; }, { - name: "InitializeLaunchArgs"; + name: "launchCompletedEvent"; type: { kind: "struct"; fields: [ { - name: "minimumRaiseAmount"; - type: "u64"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "monthlySpendingLimitAmount"; - type: "u64"; + name: "launch"; + type: "pubkey"; }, { - name: "monthlySpendingLimitMembers"; + name: "finalState"; type: { - vec: "publicKey"; + defined: { + name: "launchState"; + }; }; }, { - 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: false, - 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: "totalCommitted"; + type: "u64"; }, { - name: "committedAmount", - docs: ["The amount of USDC that has been committed by the funder."], - type: "u64", + name: "dao"; + type: { + option: "pubkey"; + }; }, { - name: "isTokensClaimed", - docs: ["Whether the tokens have been claimed."], - type: "bool", + name: "daoTreasury"; + type: { + option: "pubkey"; + }; }, { - name: "isUsdcRefunded", - docs: ["Whether the USDC has been refunded."], - type: "bool", + name: "finalRaiseAmount"; + type: { + option: "u64"; + }; }, - ], - }, + ]; + }; }, { - name: "launch", + name: "launchFundedEvent"; type: { - kind: "struct", + 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.", - ], + name: "common"; type: { - option: "i64", - }, + defined: { + name: "commonFields"; + }; + }; }, { - name: "totalCommittedAmount", - docs: ["The amount of USDC that has been committed by the users."], - type: "u64", + name: "fundingRecord"; + type: "pubkey"; }, { - name: "finalRaiseAmount", - docs: ["The final raise amount."], - type: { - option: "u64", - }, + name: "launch"; + type: "pubkey"; }, { - name: "state", - docs: ["The state of the launch."], - type: { - defined: "LaunchState", - }, + name: "funder"; + type: "pubkey"; }, { - name: "seqNum", - docs: [ - "The sequence number of this launch. Useful for sorting events.", - ], - type: "u64", + name: "amount"; + type: "u64"; }, { - name: "secondsForLaunch", - docs: ["The number of seconds that the launch will be live for."], - type: "u32", + name: "totalCommittedByFunder"; + type: "u64"; }, { - name: "dao", - docs: ["The DAO, if the launch is complete."], - type: { - option: "publicKey", - }, + name: "totalCommitted"; + type: "u64"; }, + ]; + }; + }, + { + name: "launchFundsReturnedEvent"; + type: { + kind: "struct"; + fields: [ { - name: "daoVault", - docs: [ - "The DAO treasury that USDC / LP is sent to, if the launch is complete.", - ], + name: "common"; type: { - option: "publicKey", - }, - }, - { - name: "performancePackageGrantee", - docs: [ - "The address that will receive the performance package tokens.", - ], - type: "publicKey", + defined: { + name: "commonFields"; + }; + }; }, { - name: "performancePackageTokenAmount", - docs: [ - "The amount of tokens to be granted to the performance package grantee.", - ], - type: "u64", + name: "launch"; + type: "pubkey"; }, { - name: "monthsUntilInsidersCanUnlock", - docs: [ - "The number of months that insiders must wait before unlocking their tokens.", - ], - type: "u8", + name: "recipient"; + type: "pubkey"; }, { - name: "teamAddress", - docs: ["The initial address used to sponsor team proposals."], - type: "publicKey", + name: "usdcReturned"; + type: "u64"; }, - ], - }, + ]; + }; }, - ], - types: [ { - name: "CommonFields", + name: "launchInitializedEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "slot", - type: "u64", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "launch"; + type: "pubkey"; }, { - name: "unixTimestamp", - type: "i64", + name: "minimumRaiseAmount"; + type: "u64"; }, { - name: "launchSeqNum", - type: "u64", + name: "launchAuthority"; + type: "pubkey"; }, - ], - }, - }, - { - name: "CompleteLaunchArgs", - type: { - kind: "struct", - fields: [ { - name: "finalRaiseAmount", - type: { - option: "u64", - }, + name: "launchSigner"; + type: "pubkey"; }, - ], - }, - }, - { - name: "InitializeLaunchArgs", - type: { - kind: "struct", - fields: [ { - name: "minimumRaiseAmount", - type: "u64", + name: "launchSignerPdaBump"; + type: "u8"; }, { - name: "monthlySpendingLimitAmount", - type: "u64", + name: "launchUsdcVault"; + type: "pubkey"; }, { - name: "monthlySpendingLimitMembers", - type: { - vec: "publicKey", - }, + name: "launchTokenVault"; + type: "pubkey"; }, { - name: "secondsForLaunch", - type: "u32", + name: "performancePackageGrantee"; + type: "pubkey"; }, { - name: "tokenName", - type: "string", + name: "performancePackageTokenAmount"; + type: "u64"; }, { - name: "tokenSymbol", - type: "string", + name: "monthsUntilInsidersCanUnlock"; + type: "u8"; }, { - name: "tokenUri", - type: "string", + name: "monthlySpendingLimitAmount"; + type: "u64"; }, { - name: "performancePackageGrantee", - type: "publicKey", + name: "monthlySpendingLimitMembers"; + type: { + vec: "pubkey"; + }; }, { - name: "performancePackageTokenAmount", - type: "u64", + name: "baseMint"; + type: "pubkey"; }, { - name: "monthsUntilInsidersCanUnlock", - type: "u8", + name: "quoteMint"; + type: "pubkey"; }, { - name: "teamAddress", - type: "publicKey", + name: "pdaBump"; + type: "u8"; }, - ], - }, - }, - { - name: "ReturnFundsArgs", - type: { - kind: "struct", - fields: [ { - name: "amount", - type: "u64", + name: "secondsForLaunch"; + type: "u32"; }, - ], - }, + ]; + }; }, { - name: "LaunchState", + name: "launchRefundedEvent"; type: { - kind: "enum", - variants: [ + kind: "struct"; + fields: [ { - name: "Initialized", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "Live", + name: "launch"; + type: "pubkey"; }, { - name: "Closed", + name: "funder"; + type: "pubkey"; }, { - name: "Complete", + name: "usdcRefunded"; + type: "u64"; }, { - name: "Refunding", + name: "fundingRecord"; + type: "pubkey"; }, - ], - }, + ]; + }; }, - ], - events: [ { - name: "LaunchInitializedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "launchStartedEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "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", + { + name: "launch"; + type: "pubkey"; }, - 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", + { + name: "launchAuthority"; + type: "pubkey"; }, - 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", + { + name: "slotStarted"; + type: "u64"; }, - 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", + name: "launchState"; + type: { + kind: "enum"; + variants: [ + { + name: "initialized"; }, - index: false, - }, - ], - }, - { - name: "LaunchRefundedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "live"; }, - 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", + { + name: "closed"; }, - 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", + { + name: "complete"; }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "newState", - type: { - defined: "LaunchState", + { + name: "refunding"; }, - index: false, - }, - ], + ]; + }; }, { - name: "LaunchFundsReturnedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "returnFundsArgs"; + type: { + kind: "struct"; + fields: [ + { + name: "amount"; + type: "u64"; }, - 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/launchpad/v0.6/types/v0.6.0-launchpad.json b/sdk/src/launchpad/v0.6/types/v0.6.0-launchpad.json new file mode 100644 index 000000000..34df8c4e2 --- /dev/null +++ b/sdk/src/launchpad/v0.6/types/v0.6.0-launchpad.json @@ -0,0 +1,1353 @@ +{ + "address": "MooNyh4CBUYEKyXVnjGYQ8mEiJDpGvJMdvrZx1iGeHV", + "metadata": { + "name": "launchpad", + "version": "0.6.0", + "spec": "0.1.0" + }, + "instructions": [ + { + "name": "initialize_launch", + "discriminator": [ + 90, + 201, + 220, + 142, + 112, + 253, + 100, + 13 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "base_mint", + "writable": true + }, + { + "name": "token_metadata", + "writable": true + }, + { + "name": "launch_signer" + }, + { + "name": "quote_vault", + "writable": true + }, + { + "name": "base_vault", + "writable": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "launch_authority" + }, + { + "name": "quote_mint" + }, + { + "name": "rent" + }, + { + "name": "token_program" + }, + { + "name": "associated_token_program" + }, + { + "name": "system_program" + }, + { + "name": "token_metadata_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "InitializeLaunchArgs" + } + } + } + ] + }, + { + "name": "start_launch", + "discriminator": [ + 205, + 178, + 36, + 232, + 95, + 202, + 241, + 68 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "launch_authority", + "signer": true + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "fund", + "discriminator": [ + 218, + 188, + 111, + 221, + 152, + 113, + 174, + 7 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "funding_record", + "writable": true + }, + { + "name": "launch_signer" + }, + { + "name": "launch_quote_vault", + "writable": true + }, + { + "name": "funder", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "funder_quote_account", + "writable": true + }, + { + "name": "token_program" + }, + { + "name": "system_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "amount", + "type": "u64" + } + ] + }, + { + "name": "complete_launch", + "discriminator": [ + 118, + 207, + 250, + 130, + 44, + 148, + 251, + 237 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "launch_authority", + "signer": true, + "optional": true + }, + { + "name": "token_metadata", + "writable": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "launch_signer", + "writable": true + }, + { + "name": "launch_quote_vault", + "writable": true + }, + { + "name": "launch_base_vault", + "writable": true + }, + { + "name": "treasury_quote_account", + "writable": true + }, + { + "name": "base_mint", + "writable": true + }, + { + "name": "quote_mint" + }, + { + "name": "dao_owned_lp_position", + "writable": true + }, + { + "name": "futarchy_amm_base_vault", + "writable": true + }, + { + "name": "futarchy_amm_quote_vault", + "writable": true + }, + { + "name": "dao", + "writable": true + }, + { + "name": "squads_multisig", + "writable": true + }, + { + "name": "squads_multisig_vault" + }, + { + "name": "spending_limit", + "writable": true + }, + { + "name": "performance_package", + "writable": true + }, + { + "name": "performance_package_token_account", + "writable": true + }, + { + "name": "system_program" + }, + { + "name": "token_program" + }, + { + "name": "associated_token_program" + }, + { + "name": "static_accounts", + "accounts": [ + { + "name": "futarchy_program" + }, + { + "name": "token_metadata_program" + }, + { + "name": "autocrat_event_authority" + }, + { + "name": "squads_program" + }, + { + "name": "squads_program_config" + }, + { + "name": "squads_program_config_treasury", + "writable": true + }, + { + "name": "price_based_performance_package_program" + }, + { + "name": "price_based_performance_package_event_authority" + } + ] + }, + { + "name": "meteora_accounts", + "accounts": [ + { + "name": "damm_v2_program" + }, + { + "name": "config" + }, + { + "name": "token2022_program" + }, + { + "name": "position_nft_account", + "writable": true + }, + { + "name": "pool", + "writable": true + }, + { + "name": "position", + "writable": true + }, + { + "name": "position_nft_mint", + "writable": true + }, + { + "name": "base_mint" + }, + { + "name": "quote_mint" + }, + { + "name": "token_a_vault", + "writable": true + }, + { + "name": "token_b_vault", + "writable": true + }, + { + "name": "pool_creator_authority" + }, + { + "name": "pool_authority" + }, + { + "name": "damm_v2_event_authority" + } + ] + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "CompleteLaunchArgs" + } + } + } + ] + }, + { + "name": "refund", + "discriminator": [ + 2, + 96, + 183, + 251, + 63, + 208, + 46, + 46 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "funding_record", + "writable": true + }, + { + "name": "launch_quote_vault", + "writable": true + }, + { + "name": "launch_signer" + }, + { + "name": "funder" + }, + { + "name": "funder_quote_account", + "writable": true + }, + { + "name": "token_program" + }, + { + "name": "system_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "claim", + "discriminator": [ + 62, + 198, + 214, + 193, + 213, + 159, + 108, + 210 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "funding_record", + "writable": true + }, + { + "name": "launch_signer" + }, + { + "name": "base_mint", + "writable": true + }, + { + "name": "launch_base_vault", + "writable": true + }, + { + "name": "funder" + }, + { + "name": "funder_token_account", + "writable": true + }, + { + "name": "token_program" + }, + { + "name": "system_program" + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "close_launch", + "discriminator": [ + 27, + 216, + 111, + 223, + 10, + 230, + 19, + 211 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "event_authority" + }, + { + "name": "program" + } + ], + "args": [] + } + ], + "accounts": [ + { + "name": "FundingRecord", + "discriminator": [ + 20, + 34, + 251, + 238, + 204, + 117, + 11, + 67 + ] + }, + { + "name": "Launch", + "discriminator": [ + 144, + 51, + 51, + 163, + 206, + 85, + 213, + 38 + ] + } + ], + "events": [ + { + "name": "LaunchInitializedEvent", + "discriminator": [ + 227, + 109, + 144, + 20, + 65, + 239, + 101, + 176 + ] + }, + { + "name": "LaunchStartedEvent", + "discriminator": [ + 187, + 129, + 95, + 253, + 255, + 206, + 36, + 239 + ] + }, + { + "name": "LaunchFundedEvent", + "discriminator": [ + 107, + 1, + 188, + 175, + 129, + 59, + 38, + 79 + ] + }, + { + "name": "LaunchCompletedEvent", + "discriminator": [ + 11, + 31, + 43, + 56, + 39, + 157, + 147, + 101 + ] + }, + { + "name": "LaunchRefundedEvent", + "discriminator": [ + 59, + 128, + 76, + 161, + 92, + 17, + 206, + 130 + ] + }, + { + "name": "LaunchClaimEvent", + "discriminator": [ + 185, + 124, + 167, + 74, + 161, + 160, + 106, + 96 + ] + }, + { + "name": "LaunchCloseEvent", + "discriminator": [ + 229, + 71, + 160, + 47, + 144, + 13, + 115, + 12 + ] + } + ], + "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" + }, + { + "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" + } + ], + "types": [ + { + "name": "CommonFields", + "type": { + "kind": "struct", + "fields": [ + { + "name": "slot", + "type": "u64" + }, + { + "name": "unix_timestamp", + "type": "i64" + }, + { + "name": "launch_seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "CompleteLaunchArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "final_raise_amount", + "type": { + "option": "u64" + } + } + ] + } + }, + { + "name": "InitializeLaunchArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "minimum_raise_amount", + "type": "u64" + }, + { + "name": "monthly_spending_limit_amount", + "type": "u64" + }, + { + "name": "monthly_spending_limit_members", + "type": { + "vec": "pubkey" + } + }, + { + "name": "seconds_for_launch", + "type": "u32" + }, + { + "name": "token_name", + "type": "string" + }, + { + "name": "token_symbol", + "type": "string" + }, + { + "name": "token_uri", + "type": "string" + }, + { + "name": "performance_package_grantee", + "type": "pubkey" + }, + { + "name": "performance_package_token_amount", + "type": "u64" + }, + { + "name": "months_until_insiders_can_unlock", + "type": "u8" + } + ] + } + }, + { + "name": "LaunchState", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Initialized" + }, + { + "name": "Live" + }, + { + "name": "Closed" + }, + { + "name": "Complete" + }, + { + "name": "Refunding" + } + ] + } + }, + { + "name": "FundingRecord", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pda_bump", + "docs": [ + "The PDA bump." + ], + "type": "u8" + }, + { + "name": "funder", + "docs": [ + "The funder." + ], + "type": "pubkey" + }, + { + "name": "launch", + "docs": [ + "The launch." + ], + "type": "pubkey" + }, + { + "name": "committed_amount", + "docs": [ + "The amount of USDC that has been committed by the funder." + ], + "type": "u64" + }, + { + "name": "is_tokens_claimed", + "docs": [ + "Whether the tokens have been claimed." + ], + "type": "bool" + }, + { + "name": "is_usdc_refunded", + "docs": [ + "Whether the USDC has been refunded." + ], + "type": "bool" + } + ] + } + }, + { + "name": "Launch", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pda_bump", + "docs": [ + "The PDA bump." + ], + "type": "u8" + }, + { + "name": "minimum_raise_amount", + "docs": [ + "The minimum amount of USDC that must be raised, otherwise", + "everyone can get their USDC back." + ], + "type": "u64" + }, + { + "name": "monthly_spending_limit_amount", + "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": "monthly_spending_limit_members", + "docs": [ + "The wallets that have access to the monthly spending limit." + ], + "type": { + "vec": "pubkey" + } + }, + { + "name": "launch_authority", + "docs": [ + "The account that can start the launch." + ], + "type": "pubkey" + }, + { + "name": "launch_signer", + "docs": [ + "The launch signer address. Needed because Raydium pools need a SOL payer and this PDA can't hold SOL." + ], + "type": "pubkey" + }, + { + "name": "launch_signer_pda_bump", + "docs": [ + "The PDA bump for the launch signer." + ], + "type": "u8" + }, + { + "name": "launch_quote_vault", + "docs": [ + "The USDC vault that will hold the USDC raised until the launch is over." + ], + "type": "pubkey" + }, + { + "name": "launch_base_vault", + "docs": [ + "The token vault, used to send tokens to Raydium." + ], + "type": "pubkey" + }, + { + "name": "base_mint", + "docs": [ + "The token that will be minted to funders and that will control the DAO." + ], + "type": "pubkey" + }, + { + "name": "quote_mint", + "docs": [ + "The USDC mint." + ], + "type": "pubkey" + }, + { + "name": "unix_timestamp_started", + "docs": [ + "The unix timestamp when the launch was started." + ], + "type": { + "option": "i64" + } + }, + { + "name": "unix_timestamp_closed", + "docs": [ + "The unix timestamp when the launch stopped taking new contributions." + ], + "type": { + "option": "i64" + } + }, + { + "name": "total_committed_amount", + "docs": [ + "The amount of USDC that has been committed by the users." + ], + "type": "u64" + }, + { + "name": "final_raise_amount", + "docs": [ + "The final raise amount." + ], + "type": { + "option": "u64" + } + }, + { + "name": "state", + "docs": [ + "The state of the launch." + ], + "type": { + "defined": { + "name": "LaunchState" + } + } + }, + { + "name": "seq_num", + "docs": [ + "The sequence number of this launch. Useful for sorting events." + ], + "type": "u64" + }, + { + "name": "seconds_for_launch", + "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": "pubkey" + } + }, + { + "name": "dao_vault", + "docs": [ + "The DAO treasury that USDC / LP is sent to, if the launch is complete." + ], + "type": { + "option": "pubkey" + } + }, + { + "name": "performance_package_grantee", + "docs": [ + "The address that will receive the performance package tokens." + ], + "type": "pubkey" + }, + { + "name": "performance_package_token_amount", + "docs": [ + "The amount of tokens to be granted to the performance package grantee." + ], + "type": "u64" + }, + { + "name": "months_until_insiders_can_unlock", + "docs": [ + "The number of months that insiders must wait before unlocking their tokens." + ], + "type": "u8" + } + ] + } + }, + { + "name": "LaunchInitializedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "minimum_raise_amount", + "type": "u64" + }, + { + "name": "launch_authority", + "type": "pubkey" + }, + { + "name": "launch_signer", + "type": "pubkey" + }, + { + "name": "launch_signer_pda_bump", + "type": "u8" + }, + { + "name": "launch_usdc_vault", + "type": "pubkey" + }, + { + "name": "launch_token_vault", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "seconds_for_launch", + "type": "u32" + } + ] + } + }, + { + "name": "LaunchStartedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "launch_authority", + "type": "pubkey" + }, + { + "name": "slot_started", + "type": "u64" + } + ] + } + }, + { + "name": "LaunchFundedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "funding_record", + "type": "pubkey" + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "funder", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "total_committed_by_funder", + "type": "u64" + }, + { + "name": "total_committed", + "type": "u64" + } + ] + } + }, + { + "name": "LaunchCompletedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "final_state", + "type": { + "defined": { + "name": "LaunchState" + } + } + }, + { + "name": "total_committed", + "type": "u64" + }, + { + "name": "dao", + "type": { + "option": "pubkey" + } + }, + { + "name": "dao_treasury", + "type": { + "option": "pubkey" + } + } + ] + } + }, + { + "name": "LaunchRefundedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "funder", + "type": "pubkey" + }, + { + "name": "usdc_refunded", + "type": "u64" + }, + { + "name": "funding_record", + "type": "pubkey" + } + ] + } + }, + { + "name": "LaunchClaimEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "funder", + "type": "pubkey" + }, + { + "name": "tokens_claimed", + "type": "u64" + }, + { + "name": "funding_record", + "type": "pubkey" + } + ] + } + }, + { + "name": "LaunchCloseEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "new_state", + "type": { + "defined": { + "name": "LaunchState" + } + } + } + ] + } + } + ] +} \ No newline at end of file diff --git a/sdk/src/launchpad/v0.6/types/v0.6.0-launchpad.ts b/sdk/src/launchpad/v0.6/types/v0.6.0-launchpad.ts index 828949a83..9568e8175 100644 --- a/sdk/src/launchpad/v0.6/types/v0.6.0-launchpad.ts +++ b/sdk/src/launchpad/v0.6/types/v0.6.0-launchpad.ts @@ -1,183 +1,153 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL was converted from the legacy format with `anchor idl convert` and lives in + * the `.json` file next to this one. + */ export type Launchpad = { - version: "0.6.0"; - name: "launchpad"; + address: "MooNyh4CBUYEKyXVnjGYQ8mEiJDpGvJMdvrZx1iGeHV"; + metadata: { + name: "launchpad"; + version: "0.6.0"; + spec: "0.1.0"; + }; instructions: [ { name: "initializeLaunch"; + discriminator: [90, 201, 220, 142, 112, 253, 100, 13]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "baseMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenMetadata"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchSigner"; - isMut: false; - isSigner: false; }, { name: "quoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "baseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: 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"; + defined: { + name: "initializeLaunchArgs"; + }; }; }, ]; }, { name: "startLaunch"; + discriminator: [205, 178, 36, 232, 95, 202, 241, 68]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchAuthority"; - isMut: false; - isSigner: true; + signer: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "fund"; + discriminator: [218, 188, 111, 221, 152, 113, 174, 7]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "fundingRecord"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchSigner"; - isMut: false; - isSigner: false; }, { name: "launchQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "funder"; - isMut: false; - isSigner: true; + signer: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "funderQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; }, { 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: [ @@ -189,160 +159,120 @@ export type Launchpad = { }, { name: "completeLaunch"; + discriminator: [118, 207, 250, 130, 44, 148, 251, 237]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchAuthority"; - isMut: false; - isSigner: true; - isOptional: true; + signer: true; + optional: true; }, { name: "tokenMetadata"; - isMut: true; - isSigner: false; + writable: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "launchSigner"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "treasuryQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "baseMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "quoteMint"; - isMut: false; - isSigner: false; }, { name: "daoOwnedLpPosition"; - isMut: true; - isSigner: false; + writable: true; }, { name: "futarchyAmmBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "futarchyAmmQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisig"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisigVault"; - isMut: false; - isSigner: false; }, { name: "spendingLimit"; - isMut: true; - isSigner: false; + writable: true; }, { name: "performancePackage"; - isMut: true; - isSigner: false; + writable: true; }, { name: "performancePackageTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { 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; + writable: true; }, { name: "priceBasedPerformancePackageProgram"; - isMut: false; - isSigner: false; }, { name: "priceBasedPerformancePackageEventAuthority"; - isMut: false; - isSigner: false; }, ]; }, @@ -351,236 +281,436 @@ export type Launchpad = { 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; + writable: true; }, { name: "pool"; - isMut: true; - isSigner: false; + writable: true; }, { name: "position"; - isMut: true; - isSigner: false; + writable: true; }, { name: "positionNftMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "baseMint"; - isMut: false; - isSigner: false; }, { name: "quoteMint"; - isMut: false; - isSigner: false; }, { name: "tokenAVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "tokenBVault"; - isMut: true; - isSigner: false; + writable: true; }, { 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"; + defined: { + name: "completeLaunchArgs"; + }; }; }, ]; }, { name: "refund"; + discriminator: [2, 96, 183, 251, 63, 208, 46, 46]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "fundingRecord"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchSigner"; - isMut: false; - isSigner: false; }, { name: "funder"; - isMut: false; - isSigner: false; }, { name: "funderQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; }, { 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"; + discriminator: [62, 198, 214, 193, 213, 159, 108, 210]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "fundingRecord"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchSigner"; - isMut: false; - isSigner: false; }, { name: "baseMint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "funder"; - isMut: false; - isSigner: false; }, { name: "funderTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { 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"; + discriminator: [27, 216, 111, 223, 10, 230, 19, 211]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, ]; accounts: [ + { + name: "fundingRecord"; + discriminator: [20, 34, 251, 238, 204, 117, 11, 67]; + }, + { + name: "launch"; + discriminator: [144, 51, 51, 163, 206, 85, 213, 38]; + }, + ]; + events: [ + { + name: "launchInitializedEvent"; + discriminator: [227, 109, 144, 20, 65, 239, 101, 176]; + }, + { + name: "launchStartedEvent"; + discriminator: [187, 129, 95, 253, 255, 206, 36, 239]; + }, + { + name: "launchFundedEvent"; + discriminator: [107, 1, 188, 175, 129, 59, 38, 79]; + }, + { + name: "launchCompletedEvent"; + discriminator: [11, 31, 43, 56, 39, 157, 147, 101]; + }, + { + name: "launchRefundedEvent"; + discriminator: [59, 128, 76, 161, 92, 17, 206, 130]; + }, + { + name: "launchClaimEvent"; + discriminator: [185, 124, 167, 74, 161, 160, 106, 96]; + }, + { + name: "launchCloseEvent"; + discriminator: [229, 71, 160, 47, 144, 13, 115, 12]; + }, + ]; + 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"; + }, + { + 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"; + }, + ]; + 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: "pubkey"; + }; + }, + { + name: "secondsForLaunch"; + type: "u32"; + }, + { + name: "tokenName"; + type: "string"; + }, + { + name: "tokenSymbol"; + type: "string"; + }, + { + name: "tokenUri"; + type: "string"; + }, + { + name: "performancePackageGrantee"; + type: "pubkey"; + }, + { + name: "performancePackageTokenAmount"; + type: "u64"; + }, + { + name: "monthsUntilInsidersCanUnlock"; + type: "u8"; + }, + ]; + }; + }, + { + name: "launchState"; + type: { + kind: "enum"; + variants: [ + { + name: "initialized"; + }, + { + name: "live"; + }, + { + name: "closed"; + }, + { + name: "complete"; + }, + { + name: "refunding"; + }, + ]; + }; + }, { name: "fundingRecord"; type: { @@ -594,12 +724,12 @@ export type Launchpad = { { name: "funder"; docs: ["The funder."]; - type: "publicKey"; + type: "pubkey"; }, { name: "launch"; docs: ["The launch."]; - type: "publicKey"; + type: "pubkey"; }, { name: "committedAmount"; @@ -651,20 +781,20 @@ export type Launchpad = { "The wallets that have access to the monthly spending limit.", ]; type: { - vec: "publicKey"; + vec: "pubkey"; }; }, { name: "launchAuthority"; docs: ["The account that can start the launch."]; - type: "publicKey"; + type: "pubkey"; }, { name: "launchSigner"; docs: [ "The launch signer address. Needed because Raydium pools need a SOL payer and this PDA can't hold SOL.", ]; - type: "publicKey"; + type: "pubkey"; }, { name: "launchSignerPdaBump"; @@ -676,24 +806,24 @@ export type Launchpad = { docs: [ "The USDC vault that will hold the USDC raised until the launch is over.", ]; - type: "publicKey"; + type: "pubkey"; }, { name: "launchBaseVault"; docs: ["The token vault, used to send tokens to Raydium."]; - type: "publicKey"; + type: "pubkey"; }, { name: "baseMint"; docs: [ "The token that will be minted to funders and that will control the DAO.", ]; - type: "publicKey"; + type: "pubkey"; }, { name: "quoteMint"; docs: ["The USDC mint."]; - type: "publicKey"; + type: "pubkey"; }, { name: "unixTimestampStarted"; @@ -727,7 +857,9 @@ export type Launchpad = { name: "state"; docs: ["The state of the launch."]; type: { - defined: "LaunchState"; + defined: { + name: "launchState"; + }; }; }, { @@ -746,7 +878,7 @@ export type Launchpad = { name: "dao"; docs: ["The DAO, if the launch is complete."]; type: { - option: "publicKey"; + option: "pubkey"; }; }, { @@ -755,7 +887,7 @@ export type Launchpad = { "The DAO treasury that USDC / LP is sent to, if the launch is complete.", ]; type: { - option: "publicKey"; + option: "pubkey"; }; }, { @@ -763,7 +895,7 @@ export type Launchpad = { docs: [ "The address that will receive the performance package tokens.", ]; - type: "publicKey"; + type: "pubkey"; }, { name: "performancePackageTokenAmount"; @@ -782,1772 +914,269 @@ export type Launchpad = { ]; }; }, - ]; - types: [ { - name: "CommonFields"; + name: "launchInitializedEvent"; type: { kind: "struct"; fields: [ { - name: "slot"; - type: "u64"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "unixTimestamp"; - type: "i64"; + name: "launch"; + type: "pubkey"; }, { - name: "launchSeqNum"; + name: "minimumRaiseAmount"; type: "u64"; }, - ]; - }; - }, - { - name: "CompleteLaunchArgs"; - type: { - kind: "struct"; - fields: [ { - name: "finalRaiseAmount"; - type: { - option: "u64"; - }; + name: "launchAuthority"; + type: "pubkey"; }, - ]; - }; - }, - { - name: "InitializeLaunchArgs"; - type: { - kind: "struct"; - fields: [ { - name: "minimumRaiseAmount"; - type: "u64"; + name: "launchSigner"; + type: "pubkey"; }, { - name: "monthlySpendingLimitAmount"; - type: "u64"; + name: "launchSignerPdaBump"; + type: "u8"; }, { - name: "monthlySpendingLimitMembers"; - type: { - vec: "publicKey"; - }; + name: "launchUsdcVault"; + type: "pubkey"; }, { - name: "secondsForLaunch"; - type: "u32"; + name: "launchTokenVault"; + type: "pubkey"; }, { - 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: "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: "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: "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; - }, - ]; - }, - ]; - 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"; - }, - { - 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"; - }, - ]; -}; - -export const IDL: Launchpad = { - version: "0.6.0", - 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: "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: "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: "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: [], - }, - ], - 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: "baseMint"; + type: "pubkey"; }, { - name: "performancePackageGrantee", - docs: [ - "The address that will receive the performance package tokens.", - ], - type: "publicKey", + name: "quoteMint"; + type: "pubkey"; }, { - name: "performancePackageTokenAmount", - docs: [ - "The amount of tokens to be granted to the performance package grantee.", - ], - type: "u64", + name: "pdaBump"; + type: "u8"; }, { - name: "monthsUntilInsidersCanUnlock", - docs: [ - "The number of months that insiders must wait before unlocking their tokens.", - ], - type: "u8", + name: "secondsForLaunch"; + type: "u32"; }, - ], - }, + ]; + }; }, - ], - types: [ { - name: "CommonFields", + name: "launchStartedEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "slot", - type: "u64", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "launch"; + type: "pubkey"; }, { - name: "unixTimestamp", - type: "i64", + name: "launchAuthority"; + type: "pubkey"; }, { - name: "launchSeqNum", - type: "u64", + name: "slotStarted"; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "CompleteLaunchArgs", + name: "launchFundedEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "finalRaiseAmount", + name: "common"; type: { - option: "u64", - }, + defined: { + name: "commonFields"; + }; + }; }, - ], - }, - }, - { - name: "InitializeLaunchArgs", - type: { - kind: "struct", - fields: [ { - name: "minimumRaiseAmount", - type: "u64", + name: "fundingRecord"; + type: "pubkey"; }, { - name: "monthlySpendingLimitAmount", - type: "u64", + name: "launch"; + type: "pubkey"; }, { - name: "monthlySpendingLimitMembers", - type: { - vec: "publicKey", - }, + name: "funder"; + type: "pubkey"; + }, + { + name: "amount"; + type: "u64"; + }, + { + name: "totalCommittedByFunder"; + type: "u64"; }, { - name: "secondsForLaunch", - type: "u32", + name: "totalCommitted"; + type: "u64"; }, + ]; + }; + }, + { + name: "launchCompletedEvent"; + type: { + kind: "struct"; + fields: [ { - name: "tokenName", - type: "string", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "tokenSymbol", - type: "string", + name: "launch"; + type: "pubkey"; }, { - name: "tokenUri", - type: "string", + name: "finalState"; + type: { + defined: { + name: "launchState"; + }; + }; }, { - name: "performancePackageGrantee", - type: "publicKey", + name: "totalCommitted"; + type: "u64"; }, { - name: "performancePackageTokenAmount", - type: "u64", + name: "dao"; + type: { + option: "pubkey"; + }; }, { - name: "monthsUntilInsidersCanUnlock", - type: "u8", + name: "daoTreasury"; + type: { + option: "pubkey"; + }; }, - ], - }, + ]; + }; }, { - name: "LaunchState", + name: "launchRefundedEvent"; type: { - kind: "enum", - variants: [ + kind: "struct"; + fields: [ { - name: "Initialized", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "Live", + name: "launch"; + type: "pubkey"; }, { - name: "Closed", + name: "funder"; + type: "pubkey"; }, { - name: "Complete", + name: "usdcRefunded"; + type: "u64"; }, { - 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: "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", + name: "fundingRecord"; + type: "pubkey"; }, - 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", + name: "launchClaimEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "finalState", - type: { - defined: "LaunchState", + { + name: "launch"; + type: "pubkey"; }, - index: false, - }, - { - name: "totalCommitted", - type: "u64", - index: false, - }, - { - name: "dao", - type: { - option: "publicKey", + { + name: "funder"; + type: "pubkey"; }, - index: false, - }, - { - name: "daoTreasury", - type: { - option: "publicKey", + { + name: "tokensClaimed"; + type: "u64"; }, - index: false, - }, - ], - }, - { - name: "LaunchRefundedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "fundingRecord"; + type: "pubkey"; }, - 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", + name: "launchCloseEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "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", + { + name: "launch"; + type: "pubkey"; }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "newState", - type: { - defined: "LaunchState", + { + name: "newState"; + type: { + defined: { + name: "launchState"; + }; + }; }, - 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", - }, - { - 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", + ]; + }; }, - ], + ]; }; diff --git a/sdk/src/launchpad/v0.7/LaunchpadClient.ts b/sdk/src/launchpad/v0.7/LaunchpadClient.ts index c2f4910ad..23df7dab7 100644 --- a/sdk/src/launchpad/v0.7/LaunchpadClient.ts +++ b/sdk/src/launchpad/v0.7/LaunchpadClient.ts @@ -1,14 +1,11 @@ -import { AnchorProvider, Program } from "@coral-xyz/anchor"; +import { AnchorProvider, Program } from "@anchor-lang/core"; import { PublicKey, AccountInfo, ComputeBudgetProgram, SystemProgram, } from "@solana/web3.js"; -import { - LaunchpadV7 as Launchpad, - IDL as LaunchpadIDL, -} from "./types/launchpad_v7.js"; +import { LaunchpadProgram as Launchpad, LaunchpadIDL } from "./types/index.js"; import { LAUNCHPAD_V0_7_PROGRAM_ID, MPL_TOKEN_METADATA_PROGRAM_ID, @@ -64,8 +61,12 @@ export class LaunchpadClient { private constructor(params: CreateLaunchpadClientParams) { this.provider = params.provider; this.launchpad = new Program( - LaunchpadIDL, - params.launchpadProgramId || LAUNCHPAD_V0_7_PROGRAM_ID, + { + ...LaunchpadIDL, + address: ( + params.launchpadProgramId || LAUNCHPAD_V0_7_PROGRAM_ID + ).toBase58(), + }, this.provider, ); this.futarchyClient = FutarchyClient.createClient({ @@ -200,7 +201,7 @@ export class LaunchpadClient { accumulatorActivationDelaySeconds, hasBidWall, }) - .accounts({ + .accountsPartial({ launch, launchSigner, quoteVault, @@ -231,7 +232,7 @@ export class LaunchpadClient { launch: PublicKey; launchAuthority?: PublicKey; }) { - return this.launchpad.methods.startLaunch().accounts({ + return this.launchpad.methods.startLaunch().accountsPartial({ launch, launchAuthority, }); @@ -266,7 +267,7 @@ export class LaunchpadClient { funder, ); - return this.launchpad.methods.fund(amount).accounts({ + return this.launchpad.methods.fund(amount).accountsPartial({ launch, launchQuoteVault, fundingRecord, @@ -276,7 +277,7 @@ export class LaunchpadClient { } closeLaunchIx({ launch }: { launch: PublicKey }) { - return this.launchpad.methods.closeLaunch().accounts({ + return this.launchpad.methods.closeLaunch().accountsPartial({ launch, }); } @@ -434,7 +435,7 @@ export class LaunchpadClient { return this.launchpad.methods .completeLaunch() - .accounts({ + .accountsPartial({ launch, launchSigner, launchQuoteVault, @@ -531,7 +532,7 @@ export class LaunchpadClient { true, ); - return this.launchpad.methods.refund().accounts({ + return this.launchpad.methods.refund().accountsPartial({ launch, launchSigner, launchQuoteVault, @@ -558,7 +559,7 @@ export class LaunchpadClient { return this.launchpad.methods .claim() - .accounts({ + .accountsPartial({ launch, fundingRecord, launchSigner, @@ -604,7 +605,7 @@ export class LaunchpadClient { return this.launchpad.methods .setFundingRecordApproval(approvedAmount) - .accounts({ + .accountsPartial({ launch, fundingRecord, launchAuthority, @@ -624,26 +625,28 @@ export class LaunchpadClient { }) { const launchSigner = this.getLaunchSignerAddress({ launch }); - return this.launchpad.methods.claimAdditionalTokenAllocation().accounts({ - launch, - payer, - launchSigner, - launchBaseVault: getAssociatedTokenAddressSync( - baseMint, + return this.launchpad.methods + .claimAdditionalTokenAllocation() + .accountsPartial({ + launch, + payer, launchSigner, - true, - ), - baseMint, - additionalTokensRecipient, - additionalTokensRecipientTokenAccount: getAssociatedTokenAddressSync( + launchBaseVault: getAssociatedTokenAddressSync( + baseMint, + launchSigner, + true, + ), baseMint, additionalTokensRecipient, - true, - ), - systemProgram: SystemProgram.programId, - tokenProgram: TOKEN_PROGRAM_ID, - associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID, - }); + additionalTokensRecipientTokenAccount: getAssociatedTokenAddressSync( + baseMint, + additionalTokensRecipient, + true, + ), + systemProgram: SystemProgram.programId, + tokenProgram: TOKEN_PROGRAM_ID, + associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID, + }); } initializePerformancePackageIx({ @@ -684,25 +687,27 @@ export class LaunchpadClient { true, ); - return this.launchpad.methods.initializePerformancePackage().accounts({ - launch, - performancePackage, - performancePackageTokenAccount, - dao, - squadsMultisig: multisigPda, - squadsMultisigVault: multisigVault, - launchBaseVault, - baseMint, - payer, - launchSigner, - squadsProgram: SQUADS_PROGRAM_ID, - priceBasedPerformancePackageEventAuthority: - this.priceBasedUnlock.getEventAuthorityAddress(), - priceBasedPerformancePackageProgram: this.priceBasedUnlock.programId, - associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID, - tokenProgram: TOKEN_PROGRAM_ID, - systemProgram: SystemProgram.programId, - }); + return this.launchpad.methods + .initializePerformancePackage() + .accountsPartial({ + launch, + performancePackage, + performancePackageTokenAccount, + dao, + squadsMultisig: multisigPda, + squadsMultisigVault: multisigVault, + launchBaseVault, + baseMint, + payer, + launchSigner, + squadsProgram: SQUADS_PROGRAM_ID, + priceBasedPerformancePackageEventAuthority: + this.priceBasedUnlock.getEventAuthorityAddress(), + priceBasedPerformancePackageProgram: this.priceBasedUnlock.programId, + associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID, + tokenProgram: TOKEN_PROGRAM_ID, + systemProgram: SystemProgram.programId, + }); } extendLaunchIx({ @@ -714,10 +719,12 @@ export class LaunchpadClient { durationSeconds: number; admin?: PublicKey; }) { - return this.launchpad.methods.extendLaunch({ durationSeconds }).accounts({ - launch, - admin, - }); + return this.launchpad.methods + .extendLaunch({ durationSeconds }) + .accountsPartial({ + launch, + admin, + }); } getLaunchAddress({ baseMint }: { baseMint: PublicKey }): PublicKey { diff --git a/sdk/src/launchpad/v0.7/types/index.ts b/sdk/src/launchpad/v0.7/types/index.ts index 7e63bbfc3..93c83d0c8 100644 --- a/sdk/src/launchpad/v0.7/types/index.ts +++ b/sdk/src/launchpad/v0.7/types/index.ts @@ -1,32 +1,31 @@ -import type { IdlAccounts, IdlEvents } from "@coral-xyz/anchor"; +import type { IdlAccounts, IdlEvents } from "@anchor-lang/core"; -import { - LaunchpadV7 as LaunchpadProgram, - IDL as LaunchpadIDL, -} from "./launchpad_v7.js"; -export { LaunchpadProgram, LaunchpadIDL }; +import type { LaunchpadV7 as LaunchpadProgram } from "./launchpad_v7.js"; +import launchpadIdl from "./launchpad_v7.json" with { type: "json" }; +export type { LaunchpadProgram }; +export const LaunchpadIDL = launchpadIdl as LaunchpadProgram; export type Launch = IdlAccounts["launch"]; export type FundingRecord = IdlAccounts["fundingRecord"]; -export type LaunchClaimEvent = IdlEvents["LaunchClaimEvent"]; +export type LaunchClaimEvent = IdlEvents["launchClaimEvent"]; export type LaunchCompletedEvent = - IdlEvents["LaunchCompletedEvent"]; + IdlEvents["launchCompletedEvent"]; export type LaunchFundedEvent = - IdlEvents["LaunchFundedEvent"]; + IdlEvents["launchFundedEvent"]; export type LaunchInitializedEvent = - IdlEvents["LaunchInitializedEvent"]; + IdlEvents["launchInitializedEvent"]; export type LaunchRefundedEvent = - IdlEvents["LaunchRefundedEvent"]; + IdlEvents["launchRefundedEvent"]; export type LaunchStartedEvent = - IdlEvents["LaunchStartedEvent"]; -export type LaunchCloseEvent = IdlEvents["LaunchCloseEvent"]; + IdlEvents["launchStartedEvent"]; +export type LaunchCloseEvent = IdlEvents["launchCloseEvent"]; export type FundingRecordApprovalSetEvent = - IdlEvents["FundingRecordApprovalSetEvent"]; + IdlEvents["fundingRecordApprovalSetEvent"]; export type LaunchClaimAdditionalTokenAllocationEvent = - IdlEvents["LaunchClaimAdditionalTokenAllocationEvent"]; + IdlEvents["launchClaimAdditionalTokenAllocationEvent"]; export type LaunchPerformancePackageInitializedEvent = - IdlEvents["LaunchPerformancePackageInitializedEvent"]; + IdlEvents["launchPerformancePackageInitializedEvent"]; export type LaunchpadEvent = | LaunchClaimEvent | LaunchCompletedEvent diff --git a/sdk/src/launchpad/v0.7/types/launchpad_v7.json b/sdk/src/launchpad/v0.7/types/launchpad_v7.json new file mode 100644 index 000000000..6e8daf6bc --- /dev/null +++ b/sdk/src/launchpad/v0.7/types/launchpad_v7.json @@ -0,0 +1,3983 @@ +{ + "address": "moontUzsdepotRGe5xsfip7vLPTJnVuafqdUWexVnPM", + "metadata": { + "name": "launchpad_v7", + "version": "0.7.0", + "spec": "0.1.0", + "description": "Created with Anchor" + }, + "instructions": [ + { + "name": "claim", + "discriminator": [ + 62, + 198, + 214, + 193, + 213, + 159, + 108, + 210 + ], + "accounts": [ + { + "name": "launch", + "writable": true, + "relations": [ + "funding_record" + ] + }, + { + "name": "funding_record", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 117, + 110, + 100, + 105, + 110, + 103, + 95, + 114, + 101, + 99, + 111, + 114, + 100 + ] + }, + { + "kind": "account", + "path": "launch" + }, + { + "kind": "account", + "path": "funder" + } + ] + } + }, + { + "name": "launch_signer", + "relations": [ + "launch" + ] + }, + { + "name": "base_mint", + "relations": [ + "launch" + ] + }, + { + "name": "launch_base_vault", + "writable": true, + "relations": [ + "launch" + ] + }, + { + "name": "funder", + "relations": [ + "funding_record" + ] + }, + { + "name": "funder_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "funder" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "claim_additional_token_allocation", + "discriminator": [ + 245, + 214, + 225, + 140, + 237, + 135, + 163, + 244 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "launch_signer", + "relations": [ + "launch" + ] + }, + { + "name": "launch_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "launch_signer" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + }, + "relations": [ + "launch" + ] + }, + { + "name": "base_mint", + "relations": [ + "launch" + ] + }, + { + "name": "additional_tokens_recipient" + }, + { + "name": "additional_tokens_recipient_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "additional_tokens_recipient" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "close_launch", + "discriminator": [ + 27, + 216, + 111, + 223, + 10, + 230, + 19, + 211 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "complete_launch", + "discriminator": [ + 118, + 207, + 250, + 130, + 44, + 148, + 251, + 237 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "launch_authority", + "signer": true, + "optional": true + }, + { + "name": "token_metadata", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 101, + 116, + 97, + 100, + 97, + 116, + 97 + ] + }, + { + "kind": "const", + "value": [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70 + ] + } + } + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "launch_signer", + "writable": true, + "relations": [ + "launch" + ] + }, + { + "name": "launch_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "launch_signer" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + }, + "relations": [ + "launch" + ] + }, + { + "name": "launch_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "launch_signer" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + }, + "relations": [ + "launch" + ] + }, + { + "name": "treasury_quote_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "squads_multisig_vault" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "base_mint", + "writable": true, + "relations": [ + "launch" + ] + }, + { + "name": "quote_mint", + "relations": [ + "launch" + ] + }, + { + "name": "dao_owned_lp_position", + "writable": true + }, + { + "name": "futarchy_amm_base_vault", + "writable": true + }, + { + "name": "futarchy_amm_quote_vault", + "writable": true + }, + { + "name": "dao", + "writable": true + }, + { + "name": "squads_multisig", + "writable": true + }, + { + "name": "squads_multisig_vault" + }, + { + "name": "spending_limit", + "writable": true + }, + { + "name": "bid_wall", + "writable": true + }, + { + "name": "bid_wall_quote_token_account", + "writable": true + }, + { + "name": "fee_recipient", + "address": "6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "static_accounts", + "accounts": [ + { + "name": "futarchy_program", + "address": "FUTARELBfJfQ8RDGhg1wdhddq1odMAJUePHFuBYfUxKq" + }, + { + "name": "token_metadata_program", + "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" + }, + { + "name": "futarchy_event_authority" + }, + { + "name": "squads_program", + "address": "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf" + }, + { + "name": "squads_program_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "const", + "value": [ + 112, + 114, + 111, + 103, + 114, + 97, + 109, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + } + ], + "program": { + "kind": "account", + "path": "squads_program" + } + } + }, + { + "name": "squads_program_config_treasury", + "writable": true + }, + { + "name": "bid_wall_program", + "address": "WALL8ucBuUyL46QYxwYJjidaFYhdvxUFrgvBxPshERx" + }, + { + "name": "bid_wall_event_authority" + } + ] + }, + { + "name": "meteora_accounts", + "accounts": [ + { + "name": "damm_v2_program", + "address": "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG" + }, + { + "name": "config" + }, + { + "name": "token_2022_program", + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "position_nft_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110, + 95, + 110, + 102, + 116, + 95, + 97, + 99, + 99, + 111, + 117, + 110, + 116 + ] + }, + { + "kind": "account", + "path": "position_nft_mint" + } + ], + "program": { + "kind": "account", + "path": "damm_v2_program" + } + } + }, + { + "name": "pool", + "writable": true + }, + { + "name": "position", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110 + ] + }, + { + "kind": "account", + "path": "position_nft_mint" + } + ], + "program": { + "kind": "account", + "path": "damm_v2_program" + } + } + }, + { + "name": "position_nft_mint", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110, + 95, + 110, + 102, + 116, + 95, + 109, + 105, + 110, + 116 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ] + } + }, + { + "name": "base_mint" + }, + { + "name": "quote_mint" + }, + { + "name": "token_a_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 116, + 111, + 107, + 101, + 110, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "base_mint" + }, + { + "kind": "account", + "path": "pool" + } + ], + "program": { + "kind": "account", + "path": "damm_v2_program" + } + } + }, + { + "name": "token_b_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 116, + 111, + 107, + 101, + 110, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "quote_mint" + }, + { + "kind": "account", + "path": "pool" + } + ], + "program": { + "kind": "account", + "path": "damm_v2_program" + } + } + }, + { + "name": "pool_creator_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 100, + 97, + 109, + 109, + 95, + 112, + 111, + 111, + 108, + 95, + 99, + 114, + 101, + 97, + 116, + 111, + 114, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "pool_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ], + "program": { + "kind": "account", + "path": "damm_v2_program" + } + } + }, + { + "name": "damm_v2_event_authority" + } + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "extend_launch", + "discriminator": [ + 50, + 150, + 200, + 194, + 216, + 50, + 60, + 253 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "admin", + "signer": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "ExtendLaunchArgs" + } + } + } + ] + }, + { + "name": "fund", + "discriminator": [ + 218, + 188, + 111, + 221, + 152, + 113, + 174, + 7 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "funding_record", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 117, + 110, + 100, + 105, + 110, + 103, + 95, + 114, + 101, + 99, + 111, + 114, + 100 + ] + }, + { + "kind": "account", + "path": "launch" + }, + { + "kind": "account", + "path": "funder" + } + ] + } + }, + { + "name": "launch_quote_vault", + "writable": true, + "relations": [ + "launch" + ] + }, + { + "name": "funder", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "funder_quote_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "funder" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "launch.quote_mint", + "account": "Launch" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "amount", + "type": "u64" + } + ] + }, + { + "name": "initialize_launch", + "discriminator": [ + 90, + 201, + 220, + 142, + 112, + 253, + 100, + 13 + ], + "accounts": [ + { + "name": "launch", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 108, + 97, + 117, + 110, + 99, + 104 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ] + } + }, + { + "name": "base_mint", + "writable": true + }, + { + "name": "token_metadata", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 101, + 116, + 97, + 100, + 97, + 116, + 97 + ] + }, + { + "kind": "const", + "value": [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70 + ] + } + } + }, + { + "name": "launch_signer", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 108, + 97, + 117, + 110, + 99, + 104, + 95, + 115, + 105, + 103, + 110, + 101, + 114 + ] + }, + { + "kind": "account", + "path": "launch" + } + ] + } + }, + { + "name": "quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "launch_signer" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "launch_signer" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "launch_authority" + }, + { + "name": "quote_mint", + "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" + }, + { + "name": "additional_tokens_recipient", + "optional": true + }, + { + "name": "rent", + "address": "SysvarRent111111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_metadata_program", + "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "InitializeLaunchArgs" + } + } + } + ] + }, + { + "name": "initialize_performance_package", + "discriminator": [ + 3, + 171, + 56, + 55, + 135, + 100, + 163, + 186 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "launch_signer", + "relations": [ + "launch" + ] + }, + { + "name": "launch_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "launch_signer" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + }, + "relations": [ + "launch" + ] + }, + { + "name": "base_mint", + "writable": true, + "relations": [ + "launch" + ] + }, + { + "name": "dao" + }, + { + "name": "squads_multisig", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "dao" + } + ], + "program": { + "kind": "account", + "path": "squads_program" + } + } + }, + { + "name": "squads_multisig_vault", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "squads_multisig" + }, + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "const", + "value": [ + 0 + ] + } + ], + "program": { + "kind": "account", + "path": "squads_program" + } + } + }, + { + "name": "performance_package", + "writable": true + }, + { + "name": "performance_package_token_account", + "writable": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "squads_program", + "address": "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf" + }, + { + "name": "price_based_performance_package_program", + "address": "pbPPQH7jyKoSLu8QYs3rSY3YkDRXEBojKbTgnUg7NDS" + }, + { + "name": "price_based_performance_package_event_authority" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "refund", + "discriminator": [ + 2, + 96, + 183, + 251, + 63, + 208, + 46, + 46 + ], + "accounts": [ + { + "name": "launch", + "writable": true, + "relations": [ + "funding_record" + ] + }, + { + "name": "funding_record", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 117, + 110, + 100, + 105, + 110, + 103, + 95, + 114, + 101, + 99, + 111, + 114, + 100 + ] + }, + { + "kind": "account", + "path": "launch" + }, + { + "kind": "account", + "path": "funder" + } + ] + } + }, + { + "name": "launch_quote_vault", + "writable": true, + "relations": [ + "launch" + ] + }, + { + "name": "launch_signer", + "relations": [ + "launch" + ] + }, + { + "name": "funder", + "relations": [ + "funding_record" + ] + }, + { + "name": "funder_quote_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "funder" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "launch.quote_mint", + "account": "Launch" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "resize_funding_record", + "discriminator": [ + 134, + 103, + 232, + 47, + 182, + 183, + 198, + 5 + ], + "accounts": [ + { + "name": "funding_record", + "writable": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + } + ], + "args": [] + }, + { + "name": "resize_launch", + "discriminator": [ + 3, + 23, + 109, + 180, + 59, + 58, + 163, + 211 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + } + ], + "args": [] + }, + { + "name": "set_funding_record_approval", + "discriminator": [ + 18, + 197, + 233, + 219, + 37, + 33, + 186, + 25 + ], + "accounts": [ + { + "name": "launch", + "writable": true, + "relations": [ + "funding_record" + ] + }, + { + "name": "funding_record", + "writable": true + }, + { + "name": "launch_authority", + "signer": true, + "relations": [ + "launch" + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "approved_amount", + "type": "u64" + } + ] + }, + { + "name": "start_launch", + "discriminator": [ + 205, + 178, + 36, + 232, + 95, + 202, + 241, + 68 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "launch_authority", + "signer": true, + "relations": [ + "launch" + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + } + ], + "accounts": [ + { + "name": "FundingRecord", + "discriminator": [ + 20, + 34, + 251, + 238, + 204, + 117, + 11, + 67 + ] + }, + { + "name": "Launch", + "discriminator": [ + 144, + 51, + 51, + 163, + 206, + 85, + 213, + 38 + ] + } + ], + "events": [ + { + "name": "FundingRecordApprovalSetEvent", + "discriminator": [ + 33, + 45, + 100, + 94, + 3, + 52, + 35, + 246 + ] + }, + { + "name": "LaunchClaimAdditionalTokenAllocationEvent", + "discriminator": [ + 228, + 82, + 146, + 235, + 214, + 251, + 170, + 28 + ] + }, + { + "name": "LaunchClaimEvent", + "discriminator": [ + 185, + 124, + 167, + 74, + 161, + 160, + 106, + 96 + ] + }, + { + "name": "LaunchCloseEvent", + "discriminator": [ + 229, + 71, + 160, + 47, + 144, + 13, + 115, + 12 + ] + }, + { + "name": "LaunchCompletedEvent", + "discriminator": [ + 11, + 31, + 43, + 56, + 39, + 157, + 147, + 101 + ] + }, + { + "name": "LaunchExtendedEvent", + "discriminator": [ + 178, + 224, + 112, + 157, + 98, + 161, + 2, + 229 + ] + }, + { + "name": "LaunchFundedEvent", + "discriminator": [ + 107, + 1, + 188, + 175, + 129, + 59, + 38, + 79 + ] + }, + { + "name": "LaunchInitializedEvent", + "discriminator": [ + 227, + 109, + 144, + 20, + 65, + 239, + 101, + 176 + ] + }, + { + "name": "LaunchPerformancePackageInitializedEvent", + "discriminator": [ + 10, + 184, + 255, + 200, + 108, + 213, + 44, + 161 + ] + }, + { + "name": "LaunchRefundedEvent", + "discriminator": [ + 59, + 128, + 76, + 161, + 92, + 17, + 206, + 130 + ] + }, + { + "name": "LaunchStartedEvent", + "discriminator": [ + 187, + 129, + 95, + 253, + 255, + 206, + 36, + 239 + ] + } + ], + "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" + }, + { + "code": 6027, + "name": "FundingRecordApprovalPeriodOver", + "msg": "Funding record approval period is over" + }, + { + "code": 6028, + "name": "PerformancePackageAlreadyInitialized", + "msg": "Performance package already initialized" + }, + { + "code": 6029, + "name": "InvalidDao", + "msg": "Invalid DAO" + }, + { + "code": 6030, + "name": "InvalidAccumulatorActivationDelaySeconds", + "msg": "Accumulator activation delay must be less than the launch duration" + }, + { + "code": 6031, + "name": "ExtendDurationExceedsMax", + "msg": "The extend duration would exceed the maximum allowed launch duration" + } + ], + "types": [ + { + "name": "CommonFields", + "type": { + "kind": "struct", + "fields": [ + { + "name": "slot", + "type": "u64" + }, + { + "name": "unix_timestamp", + "type": "i64" + }, + { + "name": "launch_seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "ExtendLaunchArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "duration_seconds", + "type": "u32" + } + ] + } + }, + { + "name": "FundingRecord", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pda_bump", + "docs": [ + "The PDA bump." + ], + "type": "u8" + }, + { + "name": "funder", + "docs": [ + "The funder." + ], + "type": "pubkey" + }, + { + "name": "launch", + "docs": [ + "The launch." + ], + "type": "pubkey" + }, + { + "name": "committed_amount", + "docs": [ + "The amount of USDC that has been committed by the funder." + ], + "type": "u64" + }, + { + "name": "is_tokens_claimed", + "docs": [ + "Whether the tokens have been claimed." + ], + "type": "bool" + }, + { + "name": "is_usdc_refunded", + "docs": [ + "Whether the USDC has been refunded." + ], + "type": "bool" + }, + { + "name": "approved_amount", + "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": "committed_amount_accumulator", + "docs": [ + "Running integral of committed_amount over time (committed_amount * seconds)." + ], + "type": "u128" + }, + { + "name": "last_accumulator_update", + "docs": [ + "Unix timestamp of the last accumulator update." + ], + "type": "i64" + } + ] + } + }, + { + "name": "FundingRecordApprovalSetEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "funding_record", + "type": "pubkey" + }, + { + "name": "funder", + "type": "pubkey" + }, + { + "name": "approved_amount", + "type": "u64" + }, + { + "name": "total_approved", + "type": "u64" + } + ] + } + }, + { + "name": "InitializeLaunchArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "minimum_raise_amount", + "type": "u64" + }, + { + "name": "monthly_spending_limit_amount", + "type": "u64" + }, + { + "name": "monthly_spending_limit_members", + "type": { + "vec": "pubkey" + } + }, + { + "name": "seconds_for_launch", + "type": "u32" + }, + { + "name": "token_name", + "type": "string" + }, + { + "name": "token_symbol", + "type": "string" + }, + { + "name": "token_uri", + "type": "string" + }, + { + "name": "performance_package_grantee", + "type": "pubkey" + }, + { + "name": "performance_package_token_amount", + "type": "u64" + }, + { + "name": "months_until_insiders_can_unlock", + "type": "u8" + }, + { + "name": "team_address", + "type": "pubkey" + }, + { + "name": "additional_tokens_amount", + "type": "u64" + }, + { + "name": "accumulator_activation_delay_seconds", + "type": "u32" + }, + { + "name": "has_bid_wall", + "type": "bool" + } + ] + } + }, + { + "name": "Launch", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pda_bump", + "docs": [ + "The PDA bump." + ], + "type": "u8" + }, + { + "name": "minimum_raise_amount", + "docs": [ + "The minimum amount of USDC that must be raised, otherwise", + "everyone can get their USDC back." + ], + "type": "u64" + }, + { + "name": "monthly_spending_limit_amount", + "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": "monthly_spending_limit_members", + "docs": [ + "The wallets that have access to the monthly spending limit." + ], + "type": { + "vec": "pubkey" + } + }, + { + "name": "launch_authority", + "docs": [ + "The account that can start the launch." + ], + "type": "pubkey" + }, + { + "name": "launch_signer", + "docs": [ + "The launch signer address. Needed because Raydium pools need a SOL payer and this PDA can't hold SOL." + ], + "type": "pubkey" + }, + { + "name": "launch_signer_pda_bump", + "docs": [ + "The PDA bump for the launch signer." + ], + "type": "u8" + }, + { + "name": "launch_quote_vault", + "docs": [ + "The USDC vault that will hold the USDC raised until the launch is over." + ], + "type": "pubkey" + }, + { + "name": "launch_base_vault", + "docs": [ + "The token vault, used to send tokens to Raydium." + ], + "type": "pubkey" + }, + { + "name": "base_mint", + "docs": [ + "The token that will be minted to funders and that will control the DAO." + ], + "type": "pubkey" + }, + { + "name": "quote_mint", + "docs": [ + "The USDC mint." + ], + "type": "pubkey" + }, + { + "name": "unix_timestamp_started", + "docs": [ + "The unix timestamp when the launch was started." + ], + "type": { + "option": "i64" + } + }, + { + "name": "unix_timestamp_closed", + "docs": [ + "The unix timestamp when the launch stopped taking new contributions." + ], + "type": { + "option": "i64" + } + }, + { + "name": "total_committed_amount", + "docs": [ + "The amount of USDC that has been committed by the users." + ], + "type": "u64" + }, + { + "name": "state", + "docs": [ + "The state of the launch." + ], + "type": { + "defined": { + "name": "LaunchState" + } + } + }, + { + "name": "seq_num", + "docs": [ + "The sequence number of this launch. Useful for sorting events." + ], + "type": "u64" + }, + { + "name": "seconds_for_launch", + "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": "pubkey" + } + }, + { + "name": "dao_vault", + "docs": [ + "The DAO treasury that USDC / LP is sent to, if the launch is complete." + ], + "type": { + "option": "pubkey" + } + }, + { + "name": "performance_package_grantee", + "docs": [ + "The address that will receive the performance package tokens." + ], + "type": "pubkey" + }, + { + "name": "performance_package_token_amount", + "docs": [ + "The amount of tokens to be granted to the performance package grantee." + ], + "type": "u64" + }, + { + "name": "months_until_insiders_can_unlock", + "docs": [ + "The number of months that insiders must wait before unlocking their tokens." + ], + "type": "u8" + }, + { + "name": "team_address", + "docs": [ + "The initial address used to sponsor team proposals." + ], + "type": "pubkey" + }, + { + "name": "total_approved_amount", + "docs": [ + "The amount of USDC that the launch authority has approved across all funders." + ], + "type": "u64" + }, + { + "name": "additional_tokens_amount", + "docs": [ + "The amount of additional tokens to be minted on a successful launch." + ], + "type": "u64" + }, + { + "name": "additional_tokens_recipient", + "docs": [ + "The token account that will receive the additional tokens." + ], + "type": { + "option": "pubkey" + } + }, + { + "name": "additional_tokens_claimed", + "docs": [ + "Are the additional tokens claimed" + ], + "type": "bool" + }, + { + "name": "unix_timestamp_completed", + "docs": [ + "The unix timestamp when the launch was completed." + ], + "type": { + "option": "i64" + } + }, + { + "name": "is_performance_package_initialized", + "docs": [ + "Whether the performance package has been initialized." + ], + "type": "bool" + }, + { + "name": "accumulator_activation_delay_seconds", + "docs": [ + "Number of seconds after launch start before the funding accumulator", + "begins tracking." + ], + "type": "u32" + }, + { + "name": "has_bid_wall", + "docs": [ + "Whether the launch has a bid wall." + ], + "type": "bool" + } + ] + } + }, + { + "name": "LaunchClaimAdditionalTokenAllocationEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "additional_tokens_amount", + "type": "u64" + }, + { + "name": "additional_tokens_recipient", + "type": "pubkey" + } + ] + } + }, + { + "name": "LaunchClaimEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "funder", + "type": "pubkey" + }, + { + "name": "tokens_claimed", + "type": "u64" + }, + { + "name": "funding_record", + "type": "pubkey" + } + ] + } + }, + { + "name": "LaunchCloseEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "new_state", + "type": { + "defined": { + "name": "LaunchState" + } + } + } + ] + } + }, + { + "name": "LaunchCompletedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "final_state", + "type": { + "defined": { + "name": "LaunchState" + } + } + }, + { + "name": "total_committed", + "type": "u64" + }, + { + "name": "dao", + "type": { + "option": "pubkey" + } + }, + { + "name": "dao_treasury", + "type": { + "option": "pubkey" + } + }, + { + "name": "total_approved_amount", + "type": "u64" + }, + { + "name": "bid_wall", + "type": { + "option": "pubkey" + } + }, + { + "name": "bid_wall_amount", + "type": "u64" + } + ] + } + }, + { + "name": "LaunchExtendedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "old_seconds_for_launch", + "type": "u32" + }, + { + "name": "new_seconds_for_launch", + "type": "u32" + } + ] + } + }, + { + "name": "LaunchFundedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "funding_record", + "type": "pubkey" + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "funder", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "total_committed_by_funder", + "type": "u64" + }, + { + "name": "total_committed", + "type": "u64" + }, + { + "name": "committed_amount_accumulator", + "type": "u128" + } + ] + } + }, + { + "name": "LaunchInitializedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "minimum_raise_amount", + "type": "u64" + }, + { + "name": "launch_authority", + "type": "pubkey" + }, + { + "name": "launch_signer", + "type": "pubkey" + }, + { + "name": "launch_signer_pda_bump", + "type": "u8" + }, + { + "name": "launch_usdc_vault", + "type": "pubkey" + }, + { + "name": "launch_token_vault", + "type": "pubkey" + }, + { + "name": "performance_package_grantee", + "type": "pubkey" + }, + { + "name": "performance_package_token_amount", + "type": "u64" + }, + { + "name": "months_until_insiders_can_unlock", + "type": "u8" + }, + { + "name": "monthly_spending_limit_amount", + "type": "u64" + }, + { + "name": "monthly_spending_limit_members", + "type": { + "vec": "pubkey" + } + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "seconds_for_launch", + "type": "u32" + }, + { + "name": "additional_tokens_amount", + "type": "u64" + }, + { + "name": "additional_tokens_recipient", + "type": { + "option": "pubkey" + } + }, + { + "name": "accumulator_activation_delay_seconds", + "type": "u32" + }, + { + "name": "has_bid_wall", + "type": "bool" + } + ] + } + }, + { + "name": "LaunchPerformancePackageInitializedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "performance_package", + "type": "pubkey" + } + ] + } + }, + { + "name": "LaunchRefundedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "funder", + "type": "pubkey" + }, + { + "name": "usdc_refunded", + "type": "u64" + }, + { + "name": "funding_record", + "type": "pubkey" + } + ] + } + }, + { + "name": "LaunchStartedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "launch_authority", + "type": "pubkey" + }, + { + "name": "slot_started", + "type": "u64" + } + ] + } + }, + { + "name": "LaunchState", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Initialized" + }, + { + "name": "Live" + }, + { + "name": "Closed" + }, + { + "name": "Complete" + }, + { + "name": "Refunding" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/sdk/src/launchpad/v0.7/types/launchpad_v7.ts b/sdk/src/launchpad/v0.7/types/launchpad_v7.ts index e5b1bf7e9..2a4fce695 100644 --- a/sdk/src/launchpad/v0.7/types/launchpad_v7.ts +++ b/sdk/src/launchpad/v0.7/types/launchpad_v7.ts @@ -1,390 +1,1010 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL can be found at `target/idl/launchpad_v7.json`. + */ export type LaunchpadV7 = { - version: "0.7.0"; - name: "launchpad_v7"; + address: "moontUzsdepotRGe5xsfip7vLPTJnVuafqdUWexVnPM"; + metadata: { + name: "launchpadV7"; + version: "0.7.0"; + spec: "0.1.0"; + description: "Created with Anchor"; + }; instructions: [ { - name: "initializeLaunch"; + name: "claim"; + discriminator: [62, 198, 214, 193, 213, 159, 108, 210]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "baseMint"; - isMut: true; - isSigner: false; + writable: true; + relations: ["fundingRecord"]; }, { - name: "tokenMetadata"; - isMut: true; - isSigner: false; + name: "fundingRecord"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 102, + 117, + 110, + 100, + 105, + 110, + 103, + 95, + 114, + 101, + 99, + 111, + 114, + 100, + ]; + }, + { + kind: "account"; + path: "launch"; + }, + { + kind: "account"; + path: "funder"; + }, + ]; + }; }, { name: "launchSigner"; - isMut: false; - isSigner: false; - }, - { - name: "quoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "baseVault"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; + relations: ["launch"]; }, { - name: "launchAuthority"; - isMut: false; - isSigner: false; + name: "baseMint"; + relations: ["launch"]; }, { - name: "quoteMint"; - isMut: false; - isSigner: false; + name: "launchBaseVault"; + writable: true; + relations: ["launch"]; }, { - name: "additionalTokensRecipient"; - isMut: false; - isSigner: false; - isOptional: true; + name: "funder"; + relations: ["fundingRecord"]; }, { - name: "rent"; - isMut: false; - isSigner: false; + name: "funderTokenAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "funder"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenMetadataProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "InitializeLaunchArgs"; - }; }, ]; + args: []; }, { - name: "startLaunch"; + name: "claimAdditionalTokenAllocation"; + discriminator: [245, 214, 225, 140, 237, 135, 163, 244]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "launchAuthority"; - isMut: false; - isSigner: true; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; + writable: true; }, { - name: "program"; - isMut: false; - isSigner: false; + name: "payer"; + writable: true; + signer: true; }, - ]; - args: []; - }, - { - name: "fund"; - accounts: [ { - name: "launch"; - isMut: true; - isSigner: false; + name: "launchSigner"; + relations: ["launch"]; }, { - name: "fundingRecord"; - isMut: true; - isSigner: false; + name: "launchBaseVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "launchSigner"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; + relations: ["launch"]; }, { - name: "launchQuoteVault"; - isMut: true; - isSigner: false; + name: "baseMint"; + relations: ["launch"]; }, { - name: "funder"; - isMut: false; - isSigner: true; + name: "additionalTokensRecipient"; }, { - name: "payer"; - isMut: true; - isSigner: true; + name: "additionalTokensRecipientTokenAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "additionalTokensRecipient"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "funderQuoteAccount"; - isMut: true; - isSigner: false; + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { - name: "systemProgram"; - isMut: false; - isSigner: false; + name: "associatedTokenProgram"; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "amount"; - type: "u64"; }, ]; + args: []; }, { - name: "setFundingRecordApproval"; + name: "closeLaunch"; + discriminator: [27, 216, 111, 223, 10, 230, 19, 211]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "fundingRecord"; - isMut: true; - isSigner: false; - }, - { - name: "launchAuthority"; - isMut: false; - isSigner: true; + writable: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "approvedAmount"; - type: "u64"; }, ]; + args: []; }, { name: "completeLaunch"; + discriminator: [118, 207, 250, 130, 44, 148, 251, 237]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "launchAuthority"; - isMut: false; - isSigner: true; - isOptional: true; + signer: true; + optional: true; }, { name: "tokenMetadata"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 101, 116, 97, 100, 97, 116, 97]; + }, + { + kind: "const"; + value: [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70, + ]; + }; + }; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "launchSigner"; - isMut: true; - isSigner: false; + writable: true; + relations: ["launch"]; }, { name: "launchQuoteVault"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "launchSigner"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; + relations: ["launch"]; }, { name: "launchBaseVault"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "launchSigner"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; + relations: ["launch"]; }, { name: "treasuryQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "squadsMultisigVault"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "baseMint"; - isMut: true; - isSigner: false; + writable: true; + relations: ["launch"]; }, { name: "quoteMint"; - isMut: false; - isSigner: false; + relations: ["launch"]; }, { name: "daoOwnedLpPosition"; - isMut: true; - isSigner: false; + writable: true; }, { name: "futarchyAmmBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "futarchyAmmQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisig"; - isMut: true; - isSigner: false; + writable: true; }, { name: "squadsMultisigVault"; - isMut: false; - isSigner: false; }, { name: "spendingLimit"; - isMut: true; - isSigner: false; + writable: true; }, { name: "bidWall"; - isMut: true; - isSigner: false; + writable: true; }, { name: "bidWallQuoteTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "feeRecipient"; - isMut: false; - isSigner: false; + address: "6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf"; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "staticAccounts"; accounts: [ { name: "futarchyProgram"; - isMut: false; - isSigner: false; + address: "FUTARELBfJfQ8RDGhg1wdhddq1odMAJUePHFuBYfUxKq"; }, { name: "tokenMetadataProgram"; - isMut: false; - isSigner: false; + address: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"; }, { name: "futarchyEventAuthority"; - isMut: false; - isSigner: false; }, { name: "squadsProgram"; - isMut: false; - isSigner: false; + address: "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf"; }, { name: "squadsProgramConfig"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "const"; + value: [ + 112, + 114, + 111, + 103, + 114, + 97, + 109, + 95, + 99, + 111, + 110, + 102, + 105, + 103, + ]; + }, + ]; + program: { + kind: "account"; + path: "squadsProgram"; + }; + }; }, { name: "squadsProgramConfigTreasury"; - isMut: true; - isSigner: false; + writable: true; }, { name: "bidWallProgram"; - isMut: false; - isSigner: false; + address: "WALL8ucBuUyL46QYxwYJjidaFYhdvxUFrgvBxPshERx"; }, { name: "bidWallEventAuthority"; - isMut: false; - isSigner: false; }, ]; }, @@ -393,516 +1013,1775 @@ export type LaunchpadV7 = { accounts: [ { name: "dammV2Program"; - isMut: false; - isSigner: false; + address: "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG"; }, { name: "config"; - isMut: false; - isSigner: false; }, { name: "token2022Program"; - isMut: false; - isSigner: false; + address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"; }, { name: "positionNftAccount"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110, + 95, + 110, + 102, + 116, + 95, + 97, + 99, + 99, + 111, + 117, + 110, + 116, + ]; + }, + { + kind: "account"; + path: "positionNftMint"; + }, + ]; + program: { + kind: "account"; + path: "dammV2Program"; + }; + }; }, { name: "pool"; - isMut: true; - isSigner: false; + writable: true; }, { name: "position"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [112, 111, 115, 105, 116, 105, 111, 110]; + }, + { + kind: "account"; + path: "positionNftMint"; + }, + ]; + program: { + kind: "account"; + path: "dammV2Program"; + }; + }; }, { name: "positionNftMint"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110, + 95, + 110, + 102, + 116, + 95, + 109, + 105, + 110, + 116, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + }; }, { name: "baseMint"; - isMut: false; - isSigner: false; }, { name: "quoteMint"; - isMut: false; - isSigner: false; }, { name: "tokenAVault"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 116, + 111, + 107, + 101, + 110, + 95, + 118, + 97, + 117, + 108, + 116, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + { + kind: "account"; + path: "pool"; + }, + ]; + program: { + kind: "account"; + path: "dammV2Program"; + }; + }; }, { name: "tokenBVault"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 116, + 111, + 107, + 101, + 110, + 95, + 118, + 97, + 117, + 108, + 116, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + { + kind: "account"; + path: "pool"; + }, + ]; + program: { + kind: "account"; + path: "dammV2Program"; + }; + }; }, { name: "poolCreatorAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 100, + 97, + 109, + 109, + 95, + 112, + 111, + 111, + 108, + 95, + 99, + 114, + 101, + 97, + 116, + 111, + 114, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "poolAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 112, + 111, + 111, + 108, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + program: { + kind: "account"; + path: "dammV2Program"; + }; + }; }, { name: "dammV2EventAuthority"; - isMut: false; - isSigner: false; }, ]; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { - name: "refund"; + name: "extendLaunch"; + discriminator: [50, 150, 200, 194, 216, 50, 60, 253]; 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; + writable: true; }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + name: "admin"; + signer: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; - args: []; + args: [ + { + name: "args"; + type: { + defined: { + name: "extendLaunchArgs"; + }; + }; + }, + ]; }, { - name: "claim"; + name: "fund"; + discriminator: [218, 188, 111, 221, 152, 113, 174, 7]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "fundingRecord"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 102, + 117, + 110, + 100, + 105, + 110, + 103, + 95, + 114, + 101, + 99, + 111, + 114, + 100, + ]; + }, + { + kind: "account"; + path: "launch"; + }, + { + kind: "account"; + path: "funder"; + }, + ]; + }; }, { - name: "launchSigner"; - isMut: false; - isSigner: false; + name: "launchQuoteVault"; + writable: true; + relations: ["launch"]; }, { - name: "baseMint"; - isMut: false; - isSigner: false; + name: "funder"; + signer: true; }, { - name: "launchBaseVault"; - isMut: true; - isSigner: false; + name: "payer"; + writable: true; + signer: true; }, { - name: "funder"; - isMut: false; - isSigner: false; + name: "funderQuoteAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "funder"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "launch.quote_mint"; + account: "launch"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "funderTokenAccount"; - isMut: true; - isSigner: false; + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; - args: []; + args: [ + { + name: "amount"; + type: "u64"; + }, + ]; }, { - name: "closeLaunch"; + name: "initializeLaunch"; + discriminator: [90, 201, 220, 142, 112, 253, 100, 13]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [108, 97, 117, 110, 99, 104]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + }; }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + name: "baseMint"; + writable: true; }, { - name: "program"; - isMut: false; - isSigner: false; + name: "tokenMetadata"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 101, 116, 97, 100, 97, 116, 97]; + }, + { + kind: "const"; + value: [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70, + ]; + }; + }; }, - ]; - args: []; - }, - { - name: "claimAdditionalTokenAllocation"; - accounts: [ { - name: "launch"; - isMut: true; - isSigner: false; + name: "launchSigner"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 108, + 97, + 117, + 110, + 99, + 104, + 95, + 115, + 105, + 103, + 110, + 101, + 114, + ]; + }, + { + kind: "account"; + path: "launch"; + }, + ]; + }; }, { - name: "payer"; - isMut: true; - isSigner: true; + name: "quoteVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "launchSigner"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "launchSigner"; - isMut: false; - isSigner: false; + name: "baseVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "launchSigner"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "launchBaseVault"; - isMut: true; - isSigner: false; + name: "payer"; + writable: true; + signer: true; }, { - name: "baseMint"; - isMut: false; - isSigner: false; + name: "launchAuthority"; }, { - name: "additionalTokensRecipient"; - isMut: false; - isSigner: false; + name: "quoteMint"; + address: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"; }, { - name: "additionalTokensRecipientTokenAccount"; - isMut: true; - isSigner: false; + name: "additionalTokensRecipient"; + optional: true; }, { - name: "systemProgram"; - isMut: false; - isSigner: false; + name: "rent"; + address: "SysvarRent111111111111111111111111111111111"; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; + }, + { + name: "systemProgram"; + address: "11111111111111111111111111111111"; + }, + { + name: "tokenMetadataProgram"; + address: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; - args: []; + args: [ + { + name: "args"; + type: { + defined: { + name: "initializeLaunchArgs"; + }; + }; + }, + ]; }, { name: "initializePerformancePackage"; + discriminator: [3, 171, 56, 55, 135, 100, 163, 186]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "launchSigner"; - isMut: false; - isSigner: false; + relations: ["launch"]; }, { name: "launchBaseVault"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "launchSigner"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; + relations: ["launch"]; }, { name: "baseMint"; - isMut: true; - isSigner: false; + writable: true; + relations: ["launch"]; }, { name: "dao"; - isMut: false; - isSigner: false; }, { name: "squadsMultisig"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "account"; + path: "dao"; + }, + ]; + program: { + kind: "account"; + path: "squadsProgram"; + }; + }; }, { name: "squadsMultisigVault"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "account"; + path: "squadsMultisig"; + }, + { + kind: "const"; + value: [118, 97, 117, 108, 116]; + }, + { + kind: "const"; + value: [0]; + }, + ]; + program: { + kind: "account"; + path: "squadsProgram"; + }; + }; }, { name: "performancePackage"; - isMut: true; - isSigner: false; + writable: true; }, { name: "performancePackageTokenAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "squadsProgram"; - isMut: false; - isSigner: false; + address: "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf"; }, { name: "priceBasedPerformancePackageProgram"; - isMut: false; - isSigner: false; + address: "pbPPQH7jyKoSLu8QYs3rSY3YkDRXEBojKbTgnUg7NDS"; }, { name: "priceBasedPerformancePackageEventAuthority"; - isMut: false; - isSigner: false; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { - name: "resizeFundingRecord"; + name: "refund"; + discriminator: [2, 96, 183, 251, 63, 208, 46, 46]; accounts: [ { - name: "fundingRecord"; - isMut: true; - isSigner: false; + name: "launch"; + writable: true; + relations: ["fundingRecord"]; }, { - name: "payer"; - isMut: true; - isSigner: true; + name: "fundingRecord"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 102, + 117, + 110, + 100, + 105, + 110, + 103, + 95, + 114, + 101, + 99, + 111, + 114, + 100, + ]; + }, + { + kind: "account"; + path: "launch"; + }, + { + kind: "account"; + path: "funder"; + }, + ]; + }; + }, + { + name: "launchQuoteVault"; + writable: true; + relations: ["launch"]; + }, + { + name: "launchSigner"; + relations: ["launch"]; + }, + { + name: "funder"; + relations: ["fundingRecord"]; + }, + { + name: "funderQuoteAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "funder"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "launch.quote_mint"; + account: "launch"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; + }, + { + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; + }, + { + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; + }, + { + name: "program"; + }, + ]; + args: []; + }, + { + name: "resizeFundingRecord"; + discriminator: [134, 103, 232, 47, 182, 183, 198, 5]; + accounts: [ + { + name: "fundingRecord"; + writable: true; + }, + { + name: "payer"; + writable: true; + signer: true; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, ]; args: []; }, { name: "resizeLaunch"; + discriminator: [3, 23, 109, 180, 59, 58, 163, 211]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, ]; args: []; }, { - name: "extendLaunch"; + name: "setFundingRecordApproval"; + discriminator: [18, 197, 233, 219, 37, 33, 186, 25]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; + relations: ["fundingRecord"]; }, { - name: "admin"; - isMut: false; - isSigner: true; + name: "fundingRecord"; + writable: true; + }, + { + name: "launchAuthority"; + signer: true; + relations: ["launch"]; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { - name: "args"; - type: { - defined: "ExtendLaunchArgs"; + name: "approvedAmount"; + type: "u64"; + }, + ]; + }, + { + name: "startLaunch"; + discriminator: [205, 178, 36, 232, 95, 202, 241, 68]; + accounts: [ + { + name: "launch"; + writable: true; + }, + { + name: "launchAuthority"; + signer: true; + relations: ["launch"]; + }, + { + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; }; }, + { + name: "program"; + }, ]; + args: []; }, ]; accounts: [ { name: "fundingRecord"; + discriminator: [20, 34, 251, 238, 204, 117, 11, 67]; + }, + { + name: "launch"; + discriminator: [144, 51, 51, 163, 206, 85, 213, 38]; + }, + ]; + events: [ + { + name: "fundingRecordApprovalSetEvent"; + discriminator: [33, 45, 100, 94, 3, 52, 35, 246]; + }, + { + name: "launchClaimAdditionalTokenAllocationEvent"; + discriminator: [228, 82, 146, 235, 214, 251, 170, 28]; + }, + { + name: "launchClaimEvent"; + discriminator: [185, 124, 167, 74, 161, 160, 106, 96]; + }, + { + name: "launchCloseEvent"; + discriminator: [229, 71, 160, 47, 144, 13, 115, 12]; + }, + { + name: "launchCompletedEvent"; + discriminator: [11, 31, 43, 56, 39, 157, 147, 101]; + }, + { + name: "launchExtendedEvent"; + discriminator: [178, 224, 112, 157, 98, 161, 2, 229]; + }, + { + name: "launchFundedEvent"; + discriminator: [107, 1, 188, 175, 129, 59, 38, 79]; + }, + { + name: "launchInitializedEvent"; + discriminator: [227, 109, 144, 20, 65, 239, 101, 176]; + }, + { + name: "launchPerformancePackageInitializedEvent"; + discriminator: [10, 184, 255, 200, 108, 213, 44, 161]; + }, + { + name: "launchRefundedEvent"; + discriminator: [59, 128, 76, 161, 92, 17, 206, 130]; + }, + { + name: "launchStartedEvent"; + discriminator: [187, 129, 95, 253, 255, 206, 36, 239]; + }, + ]; + 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"; + }, + { + code: 6027; + name: "fundingRecordApprovalPeriodOver"; + msg: "Funding record approval period is over"; + }, + { + code: 6028; + name: "performancePackageAlreadyInitialized"; + msg: "Performance package already initialized"; + }, + { + code: 6029; + name: "invalidDao"; + msg: "Invalid DAO"; + }, + { + code: 6030; + name: "invalidAccumulatorActivationDelaySeconds"; + msg: "Accumulator activation delay must be less than the launch duration"; + }, + { + code: 6031; + name: "extendDurationExceedsMax"; + msg: "The extend duration would exceed the maximum allowed launch duration"; + }, + ]; + types: [ + { + name: "commonFields"; type: { kind: "struct"; fields: [ { - name: "pdaBump"; - docs: ["The PDA bump."]; - type: "u8"; - }, - { - name: "funder"; - docs: ["The funder."]; - type: "publicKey"; + name: "slot"; + type: "u64"; }, { - name: "launch"; - docs: ["The launch."]; - type: "publicKey"; + name: "unixTimestamp"; + type: "i64"; }, { - name: "committedAmount"; - docs: ["The amount of USDC that has been committed by the funder."]; + name: "launchSeqNum"; type: "u64"; }, + ]; + }; + }, + { + name: "extendLaunchArgs"; + type: { + kind: "struct"; + fields: [ { - 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: "committedAmountAccumulator"; - docs: [ - "Running integral of committed_amount over time (committed_amount * seconds).", - ]; - type: "u128"; - }, - { - name: "lastAccumulatorUpdate"; - docs: ["Unix timestamp of the last accumulator update."]; - type: "i64"; + name: "durationSeconds"; + type: "u32"; }, ]; }; }, { - name: "oldFundingRecord"; + name: "fundingRecord"; type: { kind: "struct"; fields: [ @@ -914,12 +2793,12 @@ export type LaunchpadV7 = { { name: "funder"; docs: ["The funder."]; - type: "publicKey"; + type: "pubkey"; }, { name: "launch"; docs: ["The launch."]; - type: "publicKey"; + type: "pubkey"; }, { name: "committedAmount"; @@ -944,225 +2823,125 @@ export type LaunchpadV7 = { ]; type: "u64"; }, + { + name: "committedAmountAccumulator"; + docs: [ + "Running integral of committed_amount over time (committed_amount * seconds).", + ]; + type: "u128"; + }, + { + name: "lastAccumulatorUpdate"; + docs: ["Unix timestamp of the last accumulator update."]; + type: "i64"; + }, ]; }; }, { - name: "launch"; + name: "fundingRecordApprovalSetEvent"; 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.", - ]; + name: "common"; type: { - vec: "publicKey"; + defined: { + name: "commonFields"; + }; }; }, { - 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: "launch"; + type: "pubkey"; }, { - name: "launchBaseVault"; - docs: ["The token vault, used to send tokens to Raydium."]; - type: "publicKey"; + name: "fundingRecord"; + type: "pubkey"; }, { - name: "baseMint"; - docs: [ - "The token that will be minted to funders and that will control the DAO.", - ]; - type: "publicKey"; + name: "funder"; + type: "pubkey"; }, { - name: "quoteMint"; - docs: ["The USDC mint."]; - type: "publicKey"; + name: "approvedAmount"; + type: "u64"; }, { - name: "unixTimestampStarted"; - docs: ["The unix timestamp when the launch was started."]; - type: { - option: "i64"; - }; + name: "totalApproved"; + type: "u64"; }, + ]; + }; + }, + { + name: "initializeLaunchArgs"; + type: { + kind: "struct"; + fields: [ { - name: "unixTimestampClosed"; - docs: [ - "The unix timestamp when the launch stopped taking new contributions.", - ]; - type: { - option: "i64"; - }; + name: "minimumRaiseAmount"; + type: "u64"; }, { - name: "totalCommittedAmount"; - docs: ["The amount of USDC that has been committed by the users."]; + name: "monthlySpendingLimitAmount"; type: "u64"; }, { - name: "state"; - docs: ["The state of the launch."]; + name: "monthlySpendingLimitMembers"; type: { - defined: "LaunchState"; + vec: "pubkey"; }; }, - { - 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: "tokenName"; + type: "string"; }, { - name: "daoVault"; - docs: [ - "The DAO treasury that USDC / LP is sent to, if the launch is complete.", - ]; - type: { - option: "publicKey"; - }; + name: "tokenSymbol"; + type: "string"; + }, + { + name: "tokenUri"; + type: "string"; }, { name: "performancePackageGrantee"; - docs: [ - "The address that will receive the performance package tokens.", - ]; - type: "publicKey"; + type: "pubkey"; }, { 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"; + type: "pubkey"; }, { 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"; - }, - { - name: "unixTimestampCompleted"; - docs: ["The unix timestamp when the launch was completed."]; - type: { - option: "i64"; - }; - }, - { - name: "isPerformancePackageInitialized"; - docs: ["Whether the performance package has been initialized."]; - type: "bool"; - }, { name: "accumulatorActivationDelaySeconds"; - docs: [ - "Number of seconds after launch start before the funding accumulator", - "begins tracking.", - ]; type: "u32"; }, { name: "hasBidWall"; - docs: ["Whether the launch has a bid wall."]; type: "bool"; }, ]; }; }, { - name: "oldLaunch"; + name: "launch"; type: { kind: "struct"; fields: [ @@ -1193,20 +2972,20 @@ export type LaunchpadV7 = { "The wallets that have access to the monthly spending limit.", ]; type: { - vec: "publicKey"; + vec: "pubkey"; }; }, { name: "launchAuthority"; docs: ["The account that can start the launch."]; - type: "publicKey"; + type: "pubkey"; }, { name: "launchSigner"; docs: [ "The launch signer address. Needed because Raydium pools need a SOL payer and this PDA can't hold SOL.", ]; - type: "publicKey"; + type: "pubkey"; }, { name: "launchSignerPdaBump"; @@ -1218,24 +2997,24 @@ export type LaunchpadV7 = { docs: [ "The USDC vault that will hold the USDC raised until the launch is over.", ]; - type: "publicKey"; + type: "pubkey"; }, { name: "launchBaseVault"; docs: ["The token vault, used to send tokens to Raydium."]; - type: "publicKey"; + type: "pubkey"; }, { name: "baseMint"; docs: [ "The token that will be minted to funders and that will control the DAO.", ]; - type: "publicKey"; + type: "pubkey"; }, { name: "quoteMint"; docs: ["The USDC mint."]; - type: "publicKey"; + type: "pubkey"; }, { name: "unixTimestampStarted"; @@ -1262,7 +3041,9 @@ export type LaunchpadV7 = { name: "state"; docs: ["The state of the launch."]; type: { - defined: "LaunchState"; + defined: { + name: "launchState"; + }; }; }, { @@ -1281,7 +3062,7 @@ export type LaunchpadV7 = { name: "dao"; docs: ["The DAO, if the launch is complete."]; type: { - option: "publicKey"; + option: "pubkey"; }; }, { @@ -1290,7 +3071,7 @@ export type LaunchpadV7 = { "The DAO treasury that USDC / LP is sent to, if the launch is complete.", ]; type: { - option: "publicKey"; + option: "pubkey"; }; }, { @@ -1298,7 +3079,7 @@ export type LaunchpadV7 = { docs: [ "The address that will receive the performance package tokens.", ]; - type: "publicKey"; + type: "pubkey"; }, { name: "performancePackageTokenAmount"; @@ -1317,7 +3098,7 @@ export type LaunchpadV7 = { { name: "teamAddress"; docs: ["The initial address used to sponsor team proposals."]; - type: "publicKey"; + type: "pubkey"; }, { name: "totalApprovedAmount"; @@ -1339,7 +3120,7 @@ export type LaunchpadV7 = { "The token account that will receive the additional tokens.", ]; type: { - option: "publicKey"; + option: "pubkey"; }; }, { @@ -1356,6 +3137,7 @@ export type LaunchpadV7 = { }, { name: "isPerformancePackageInitialized"; + docs: ["Whether the performance package has been initialized."]; type: "bool"; }, { @@ -1366,81 +3148,276 @@ export type LaunchpadV7 = { ]; type: "u32"; }, + { + name: "hasBidWall"; + docs: ["Whether the launch has a bid wall."]; + type: "bool"; + }, ]; }; }, - ]; - types: [ { - name: "CommonFields"; + name: "launchClaimAdditionalTokenAllocationEvent"; type: { kind: "struct"; fields: [ { - name: "slot"; - type: "u64"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "unixTimestamp"; - type: "i64"; + name: "launch"; + type: "pubkey"; }, { - name: "launchSeqNum"; + name: "additionalTokensAmount"; type: "u64"; }, + { + name: "additionalTokensRecipient"; + type: "pubkey"; + }, ]; }; }, { - name: "ExtendLaunchArgs"; + name: "launchClaimEvent"; type: { kind: "struct"; fields: [ { - name: "durationSeconds"; - type: "u32"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "launch"; + type: "pubkey"; + }, + { + name: "funder"; + type: "pubkey"; + }, + { + name: "tokensClaimed"; + type: "u64"; + }, + { + name: "fundingRecord"; + type: "pubkey"; }, ]; }; }, { - name: "InitializeLaunchArgs"; + name: "launchCloseEvent"; type: { kind: "struct"; fields: [ { - name: "minimumRaiseAmount"; - type: "u64"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "monthlySpendingLimitAmount"; - type: "u64"; + name: "launch"; + type: "pubkey"; }, { - name: "monthlySpendingLimitMembers"; + name: "newState"; type: { - vec: "publicKey"; + defined: { + name: "launchState"; + }; }; }, + ]; + }; + }, + { + name: "launchCompletedEvent"; + type: { + kind: "struct"; + fields: [ { - name: "secondsForLaunch"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "launch"; + type: "pubkey"; + }, + { + name: "finalState"; + type: { + defined: { + name: "launchState"; + }; + }; + }, + { + name: "totalCommitted"; + type: "u64"; + }, + { + name: "dao"; + type: { + option: "pubkey"; + }; + }, + { + name: "daoTreasury"; + type: { + option: "pubkey"; + }; + }, + { + name: "totalApprovedAmount"; + type: "u64"; + }, + { + name: "bidWall"; + type: { + option: "pubkey"; + }; + }, + { + name: "bidWallAmount"; + type: "u64"; + }, + ]; + }; + }, + { + name: "launchExtendedEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "launch"; + type: "pubkey"; + }, + { + name: "oldSecondsForLaunch"; type: "u32"; }, { - name: "tokenName"; - type: "string"; + name: "newSecondsForLaunch"; + type: "u32"; }, + ]; + }; + }, + { + name: "launchFundedEvent"; + type: { + kind: "struct"; + fields: [ { - name: "tokenSymbol"; - type: "string"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "tokenUri"; - type: "string"; + name: "fundingRecord"; + type: "pubkey"; + }, + { + name: "launch"; + type: "pubkey"; + }, + { + name: "funder"; + type: "pubkey"; + }, + { + name: "amount"; + type: "u64"; + }, + { + name: "totalCommittedByFunder"; + type: "u64"; + }, + { + name: "totalCommitted"; + type: "u64"; + }, + { + name: "committedAmountAccumulator"; + type: "u128"; + }, + ]; + }; + }, + { + name: "launchInitializedEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "launch"; + type: "pubkey"; + }, + { + name: "minimumRaiseAmount"; + type: "u64"; + }, + { + name: "launchAuthority"; + type: "pubkey"; + }, + { + name: "launchSigner"; + type: "pubkey"; + }, + { + name: "launchSignerPdaBump"; + type: "u8"; + }, + { + name: "launchUsdcVault"; + type: "pubkey"; + }, + { + name: "launchTokenVault"; + type: "pubkey"; }, { name: "performancePackageGrantee"; - type: "publicKey"; + type: "pubkey"; }, { name: "performancePackageTokenAmount"; @@ -1451,13 +3428,41 @@ export type LaunchpadV7 = { type: "u8"; }, { - name: "teamAddress"; - type: "publicKey"; + name: "monthlySpendingLimitAmount"; + type: "u64"; + }, + { + name: "monthlySpendingLimitMembers"; + type: { + vec: "pubkey"; + }; + }, + { + name: "baseMint"; + type: "pubkey"; + }, + { + name: "quoteMint"; + type: "pubkey"; + }, + { + name: "pdaBump"; + type: "u8"; + }, + { + name: "secondsForLaunch"; + type: "u32"; }, { name: "additionalTokensAmount"; type: "u64"; }, + { + name: "additionalTokensRecipient"; + type: { + option: "pubkey"; + }; + }, { name: "accumulatorActivationDelaySeconds"; type: "u32"; @@ -1470,2754 +3475,111 @@ export type LaunchpadV7 = { }; }, { - name: "LaunchState"; + name: "launchPerformancePackageInitializedEvent"; type: { - kind: "enum"; - variants: [ + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "launch"; + type: "pubkey"; + }, + { + name: "performancePackage"; + type: "pubkey"; + }, + ]; + }; + }, + { + name: "launchRefundedEvent"; + type: { + kind: "struct"; + fields: [ { - name: "Initialized"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "Live"; + name: "launch"; + type: "pubkey"; }, { - name: "Closed"; + name: "funder"; + type: "pubkey"; }, { - name: "Complete"; + name: "usdcRefunded"; + type: "u64"; }, { - name: "Refunding"; + name: "fundingRecord"; + type: "pubkey"; }, ]; }; }, - ]; - 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: "additionalTokensAmount"; - type: "u64"; - index: false; - }, - { - name: "additionalTokensRecipient"; - type: { - option: "publicKey"; - }; - index: false; - }, - { - name: "accumulatorActivationDelaySeconds"; - type: "u32"; - index: false; - }, - { - name: "hasBidWall"; - type: "bool"; - index: false; - }, - ]; + name: "launchStartedEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "launch"; + type: "pubkey"; + }, + { + name: "launchAuthority"; + type: "pubkey"; + }, + { + name: "slotStarted"; + type: "u64"; + }, + ]; + }; }, { - 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: "committedAmountAccumulator"; - type: "u128"; - 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: "bidWall"; - type: { - option: "publicKey"; - }; - index: false; - }, - { - name: "bidWallAmount"; - 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; - }, - ]; - }, - { - name: "LaunchPerformancePackageInitializedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "launch"; - type: "publicKey"; - index: false; - }, - { - name: "performancePackage"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "LaunchExtendedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "launch"; - type: "publicKey"; - index: false; - }, - { - name: "oldSecondsForLaunch"; - type: "u32"; - index: false; - }, - { - name: "newSecondsForLaunch"; - type: "u32"; - 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"; - }, - { - code: 6027; - name: "FundingRecordApprovalPeriodOver"; - msg: "Funding record approval period is over"; - }, - { - code: 6028; - name: "PerformancePackageAlreadyInitialized"; - msg: "Performance package already initialized"; - }, - { - code: 6029; - name: "InvalidDao"; - msg: "Invalid DAO"; - }, - { - code: 6030; - name: "InvalidAccumulatorActivationDelaySeconds"; - msg: "Accumulator activation delay must be less than the launch duration"; - }, - { - code: 6031; - name: "ExtendDurationExceedsMax"; - msg: "The extend duration would exceed the maximum allowed launch duration"; - }, - ]; -}; - -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: "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: "bidWall", - isMut: true, - isSigner: false, - }, - { - name: "bidWallQuoteTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "feeRecipient", - isMut: false, - 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: "futarchyEventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgram", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgramConfig", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgramConfigTreasury", - isMut: true, - isSigner: false, - }, - { - name: "bidWallProgram", - isMut: false, - isSigner: false, - }, - { - name: "bidWallEventAuthority", - 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: "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: false, - 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: "claimAdditionalTokenAllocation", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "launchSigner", - isMut: false, - isSigner: false, - }, - { - name: "launchBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - 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: [], - }, - { - name: "initializePerformancePackage", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "launchSigner", - isMut: false, - isSigner: false, - }, - { - name: "launchBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: false, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: false, - isSigner: false, - }, - { - name: "squadsMultisigVault", - isMut: false, - 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: "squadsProgram", - isMut: false, - isSigner: false, - }, - { - name: "priceBasedPerformancePackageProgram", - isMut: false, - isSigner: false, - }, - { - name: "priceBasedPerformancePackageEventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "resizeFundingRecord", - accounts: [ - { - name: "fundingRecord", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "resizeLaunch", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "extendLaunch", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "admin", - isMut: false, - isSigner: true, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "ExtendLaunchArgs", - }, - }, - ], - }, - ], - 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: "committedAmountAccumulator", - docs: [ - "Running integral of committed_amount over time (committed_amount * seconds).", - ], - type: "u128", - }, - { - name: "lastAccumulatorUpdate", - docs: ["Unix timestamp of the last accumulator update."], - type: "i64", - }, - ], - }, - }, - { - name: "oldFundingRecord", - 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", - }, - { - name: "unixTimestampCompleted", - docs: ["The unix timestamp when the launch was completed."], - type: { - option: "i64", - }, - }, - { - name: "isPerformancePackageInitialized", - docs: ["Whether the performance package has been initialized."], - type: "bool", - }, - { - name: "accumulatorActivationDelaySeconds", - docs: [ - "Number of seconds after launch start before the funding accumulator", - "begins tracking.", - ], - type: "u32", - }, - { - name: "hasBidWall", - docs: ["Whether the launch has a bid wall."], - type: "bool", - }, - ], - }, - }, - { - name: "oldLaunch", - 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", - }, - { - name: "unixTimestampCompleted", - docs: ["The unix timestamp when the launch was completed."], - type: { - option: "i64", - }, - }, - { - name: "isPerformancePackageInitialized", - type: "bool", - }, - { - name: "accumulatorActivationDelaySeconds", - docs: [ - "Number of seconds after launch start before the funding accumulator", - "begins tracking.", - ], - type: "u32", - }, - ], - }, - }, - ], - types: [ - { - name: "CommonFields", - type: { - kind: "struct", - fields: [ - { - name: "slot", - type: "u64", - }, - { - name: "unixTimestamp", - type: "i64", - }, - { - name: "launchSeqNum", - type: "u64", - }, - ], - }, - }, - { - name: "ExtendLaunchArgs", - type: { - kind: "struct", - fields: [ - { - name: "durationSeconds", - type: "u32", - }, - ], - }, - }, - { - 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: "accumulatorActivationDelaySeconds", - type: "u32", - }, - { - name: "hasBidWall", - type: "bool", - }, - ], - }, - }, - { - 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: "additionalTokensAmount", - type: "u64", - index: false, - }, - { - name: "additionalTokensRecipient", - type: { - option: "publicKey", - }, - index: false, - }, - { - name: "accumulatorActivationDelaySeconds", - type: "u32", - index: false, - }, - { - name: "hasBidWall", - type: "bool", - 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: "committedAmountAccumulator", - type: "u128", - 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: "bidWall", - type: { - option: "publicKey", - }, - index: false, - }, - { - name: "bidWallAmount", - 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", + name: "launchState"; + type: { + kind: "enum"; + variants: [ + { + name: "initialized"; }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "newState", - type: { - defined: "LaunchState", + { + name: "live"; }, - index: false, - }, - ], - }, - { - name: "LaunchClaimAdditionalTokenAllocationEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "closed"; }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "additionalTokensAmount", - type: "u64", - index: false, - }, - { - name: "additionalTokensRecipient", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "LaunchPerformancePackageInitializedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "complete"; }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "performancePackage", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "LaunchExtendedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "refunding"; }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "oldSecondsForLaunch", - type: "u32", - index: false, - }, - { - name: "newSecondsForLaunch", - type: "u32", - 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", - }, - { - code: 6027, - name: "FundingRecordApprovalPeriodOver", - msg: "Funding record approval period is over", - }, - { - code: 6028, - name: "PerformancePackageAlreadyInitialized", - msg: "Performance package already initialized", - }, - { - code: 6029, - name: "InvalidDao", - msg: "Invalid DAO", - }, - { - code: 6030, - name: "InvalidAccumulatorActivationDelaySeconds", - msg: "Accumulator activation delay must be less than the launch duration", - }, - { - code: 6031, - name: "ExtendDurationExceedsMax", - msg: "The extend duration would exceed the maximum allowed launch duration", + ]; + }; }, - ], + ]; }; diff --git a/sdk/src/launchpad/v0.8/LaunchpadClient.ts b/sdk/src/launchpad/v0.8/LaunchpadClient.ts index c49d8b146..f6c077048 100644 --- a/sdk/src/launchpad/v0.8/LaunchpadClient.ts +++ b/sdk/src/launchpad/v0.8/LaunchpadClient.ts @@ -1,4 +1,4 @@ -import { AnchorProvider, Program } from "@coral-xyz/anchor"; +import { AnchorProvider, Program } from "@anchor-lang/core"; import { PublicKey, AccountInfo, ComputeBudgetProgram } from "@solana/web3.js"; import { createAssociatedTokenAccountIdempotentInstruction, @@ -65,8 +65,12 @@ export class LaunchpadClient { private constructor(params: CreateLaunchpadClientParams) { this.provider = params.provider; this.launchpad = new Program( - LaunchpadIDL as any, - params.launchpadProgramId || LAUNCHPAD_V0_8_PROGRAM_ID, + { + ...LaunchpadIDL, + address: ( + params.launchpadProgramId || LAUNCHPAD_V0_8_PROGRAM_ID + ).toBase58(), + }, this.provider, ); this.futarchyClient = FutarchyClient.createClient({ @@ -276,7 +280,7 @@ export class LaunchpadClient { accumulatorActivationDelaySeconds, hasBidWall, }) - .accounts({ + .accountsPartial({ launch, launchSigner, quoteVault, @@ -309,7 +313,7 @@ export class LaunchpadClient { launch: PublicKey; launchAuthority?: PublicKey; }) { - return this.launchpad.methods.startLaunch().accounts({ + return this.launchpad.methods.startLaunch().accountsPartial({ launch, launchAuthority, }); @@ -346,7 +350,7 @@ export class LaunchpadClient { funder, ); - return this.launchpad.methods.fund(amount).accounts({ + return this.launchpad.methods.fund(amount).accountsPartial({ launch, launchQuoteVault, fundingRecord, @@ -357,7 +361,7 @@ export class LaunchpadClient { } closeLaunchIx({ launch }: { launch: PublicKey }) { - return this.launchpad.methods.closeLaunch().accounts({ + return this.launchpad.methods.closeLaunch().accountsPartial({ launch, }); } @@ -381,7 +385,7 @@ export class LaunchpadClient { return this.launchpad.methods .setFundingRecordApproval(approvedAmount) - .accounts({ + .accountsPartial({ launch, fundingRecord, launchAuthority, @@ -533,7 +537,7 @@ export class LaunchpadClient { return this.launchpad.methods .settleLaunch() - .accounts({ + .accountsPartial({ launch, launchSigner, launchQuoteVault, @@ -615,7 +619,7 @@ export class LaunchpadClient { return this.launchpad.methods .claim() - .accounts({ + .accountsPartial({ launch, fundingRecord, launchSigner, @@ -669,7 +673,7 @@ export class LaunchpadClient { true, ); - return this.launchpad.methods.refund().accounts({ + return this.launchpad.methods.refund().accountsPartial({ launch, fundingRecord, launchQuoteVault, @@ -734,7 +738,7 @@ export class LaunchpadClient { return this.launchpad.methods .finalizeLaunch() - .accounts({ + .accountsPartial({ launch, payer, launchSigner, @@ -771,23 +775,25 @@ export class LaunchpadClient { }) { const launchSigner = this.getLaunchSignerAddress({ launch }); - return this.launchpad.methods.claimAdditionalTokenAllocation().accounts({ - launch, - payer, - launchSigner, - launchBaseVault: getAssociatedTokenAddressSync( - baseMint, + return this.launchpad.methods + .claimAdditionalTokenAllocation() + .accountsPartial({ + launch, + payer, launchSigner, - true, - ), - baseMint, - additionalTokensRecipient, - additionalTokensRecipientTokenAccount: getAssociatedTokenAddressSync( + launchBaseVault: getAssociatedTokenAddressSync( + baseMint, + launchSigner, + true, + ), baseMint, additionalTokensRecipient, - true, - ), - }); + additionalTokensRecipientTokenAccount: getAssociatedTokenAddressSync( + baseMint, + additionalTokensRecipient, + true, + ), + }); } extendLaunchIx({ @@ -799,9 +805,11 @@ export class LaunchpadClient { durationSeconds: number; admin?: PublicKey; }) { - return this.launchpad.methods.extendLaunch({ durationSeconds }).accounts({ - launch, - admin, - }); + return this.launchpad.methods + .extendLaunch({ durationSeconds }) + .accountsPartial({ + launch, + admin, + }); } } diff --git a/sdk/src/launchpad/v0.8/types/index.ts b/sdk/src/launchpad/v0.8/types/index.ts index 4815b985f..592b14af8 100644 --- a/sdk/src/launchpad/v0.8/types/index.ts +++ b/sdk/src/launchpad/v0.8/types/index.ts @@ -1,34 +1,33 @@ -import type { IdlAccounts, IdlEvents } from "@coral-xyz/anchor"; +import type { IdlAccounts, IdlEvents } from "@anchor-lang/core"; -import { - LaunchpadV8 as LaunchpadProgram, - IDL as LaunchpadIDL, -} from "./launchpad_v8.js"; -export { LaunchpadProgram, LaunchpadIDL }; +import type { LaunchpadV8 as LaunchpadProgram } from "./launchpad_v8.js"; +import launchpadIdl from "./launchpad_v8.json" with { type: "json" }; +export type { LaunchpadProgram }; +export const LaunchpadIDL = launchpadIdl as LaunchpadProgram; export type Launch = IdlAccounts["launch"]; export type FundingRecord = IdlAccounts["fundingRecord"]; export type LaunchInitializedEvent = - IdlEvents["LaunchInitializedEvent"]; + IdlEvents["launchInitializedEvent"]; export type LaunchStartedEvent = - IdlEvents["LaunchStartedEvent"]; + IdlEvents["launchStartedEvent"]; export type LaunchFundedEvent = - IdlEvents["LaunchFundedEvent"]; + IdlEvents["launchFundedEvent"]; export type FundingRecordApprovalSetEvent = - IdlEvents["FundingRecordApprovalSetEvent"]; + IdlEvents["fundingRecordApprovalSetEvent"]; export type LaunchSettledEvent = - IdlEvents["LaunchSettledEvent"]; + IdlEvents["launchSettledEvent"]; export type LaunchFinalizedEvent = - IdlEvents["LaunchFinalizedEvent"]; + IdlEvents["launchFinalizedEvent"]; export type LaunchRefundedEvent = - IdlEvents["LaunchRefundedEvent"]; -export type LaunchClaimEvent = IdlEvents["LaunchClaimEvent"]; -export type LaunchCloseEvent = IdlEvents["LaunchCloseEvent"]; + IdlEvents["launchRefundedEvent"]; +export type LaunchClaimEvent = IdlEvents["launchClaimEvent"]; +export type LaunchCloseEvent = IdlEvents["launchCloseEvent"]; export type LaunchClaimAdditionalTokenAllocationEvent = - IdlEvents["LaunchClaimAdditionalTokenAllocationEvent"]; + IdlEvents["launchClaimAdditionalTokenAllocationEvent"]; export type LaunchExtendedEvent = - IdlEvents["LaunchExtendedEvent"]; + IdlEvents["launchExtendedEvent"]; export type LaunchpadEvent = | LaunchInitializedEvent diff --git a/sdk/src/launchpad/v0.8/types/launchpad_v8.json b/sdk/src/launchpad/v0.8/types/launchpad_v8.json new file mode 100644 index 000000000..658beb347 --- /dev/null +++ b/sdk/src/launchpad/v0.8/types/launchpad_v8.json @@ -0,0 +1,3993 @@ +{ + "address": "moonDJUoHteKkGATejA5bdJVwJ6V6Dg74gyqyJTx73n", + "metadata": { + "name": "launchpad_v8", + "version": "0.8.0", + "spec": "0.1.0", + "description": "Created with Anchor" + }, + "instructions": [ + { + "name": "claim", + "discriminator": [ + 62, + 198, + 214, + 193, + 213, + 159, + 108, + 210 + ], + "accounts": [ + { + "name": "launch", + "writable": true, + "relations": [ + "funding_record" + ] + }, + { + "name": "funding_record", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 117, + 110, + 100, + 105, + 110, + 103, + 95, + 114, + 101, + 99, + 111, + 114, + 100 + ] + }, + { + "kind": "account", + "path": "launch" + }, + { + "kind": "account", + "path": "funder" + } + ] + } + }, + { + "name": "launch_signer", + "relations": [ + "launch" + ] + }, + { + "name": "base_mint", + "relations": [ + "launch" + ] + }, + { + "name": "launch_base_vault", + "writable": true, + "relations": [ + "launch" + ] + }, + { + "name": "funder", + "relations": [ + "funding_record" + ] + }, + { + "name": "funder_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "funder" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "claim_additional_token_allocation", + "discriminator": [ + 245, + 214, + 225, + 140, + 237, + 135, + 163, + 244 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "launch_signer", + "relations": [ + "launch" + ] + }, + { + "name": "launch_base_vault", + "writable": true, + "relations": [ + "launch" + ] + }, + { + "name": "base_mint", + "relations": [ + "launch" + ] + }, + { + "name": "additional_tokens_recipient" + }, + { + "name": "additional_tokens_recipient_token_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "additional_tokens_recipient" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "close_launch", + "discriminator": [ + 27, + 216, + 111, + 223, + 10, + 230, + 19, + 211 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "extend_launch", + "discriminator": [ + 50, + 150, + 200, + 194, + 216, + 50, + 60, + 253 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "admin", + "signer": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "ExtendLaunchArgs" + } + } + } + ] + }, + { + "name": "finalize_launch", + "discriminator": [ + 113, + 133, + 62, + 196, + 58, + 212, + 118, + 166 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "launch_signer", + "relations": [ + "launch" + ] + }, + { + "name": "base_mint", + "relations": [ + "launch" + ] + }, + { + "name": "dao" + }, + { + "name": "squads_multisig", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "dao" + } + ], + "program": { + "kind": "account", + "path": "squads_program" + } + } + }, + { + "name": "squads_multisig_vault", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "account", + "path": "squads_multisig" + }, + { + "kind": "const", + "value": [ + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "const", + "value": [ + 0 + ] + } + ], + "program": { + "kind": "account", + "path": "squads_program" + } + } + }, + { + "name": "performance_package_grantee", + "relations": [ + "launch" + ] + }, + { + "name": "mint_governor", + "writable": true, + "relations": [ + "launch" + ] + }, + { + "name": "pp_mint_authority", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 105, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + }, + { + "kind": "account", + "path": "mint_governor" + }, + { + "kind": "account", + "path": "performance_package" + } + ], + "program": { + "kind": "account", + "path": "mint_governor_program" + } + } + }, + { + "name": "dao_mint_authority", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 105, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + }, + { + "kind": "account", + "path": "mint_governor" + }, + { + "kind": "account", + "path": "squads_multisig_vault" + } + ], + "program": { + "kind": "account", + "path": "mint_governor_program" + } + } + }, + { + "name": "performance_package", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 101, + 114, + 102, + 111, + 114, + 109, + 97, + 110, + 99, + 101, + 95, + 112, + 97, + 99, + 107, + 97, + 103, + 101 + ] + }, + { + "kind": "account", + "path": "launch_signer" + } + ], + "program": { + "kind": "account", + "path": "performance_package_v2_program" + } + } + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "squads_program", + "address": "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf" + }, + { + "name": "mint_governor_program", + "address": "gvnr27cVeyW3AVf3acL7VCJ5WjGAphytnsgcK1feHyH" + }, + { + "name": "mint_governor_event_authority" + }, + { + "name": "performance_package_v2_program", + "address": "pPV2pfrxnmstSb9j7kEeCLny5BGj6SNwCWGd6xbGGzz" + }, + { + "name": "performance_package_v2_event_authority" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "fund", + "discriminator": [ + 218, + 188, + 111, + 221, + 152, + 113, + 174, + 7 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "funding_record", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 117, + 110, + 100, + 105, + 110, + 103, + 95, + 114, + 101, + 99, + 111, + 114, + 100 + ] + }, + { + "kind": "account", + "path": "launch" + }, + { + "kind": "account", + "path": "funder" + } + ] + } + }, + { + "name": "launch_quote_vault", + "writable": true, + "relations": [ + "launch" + ] + }, + { + "name": "funder", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "funder_quote_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "funder" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "launch.quote_mint", + "account": "Launch" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "amount", + "type": "u64" + } + ] + }, + { + "name": "initialize_launch", + "discriminator": [ + 90, + 201, + 220, + 142, + 112, + 253, + 100, + 13 + ], + "accounts": [ + { + "name": "launch", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 108, + 97, + 117, + 110, + 99, + 104 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ] + } + }, + { + "name": "base_mint", + "writable": true + }, + { + "name": "token_metadata", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 101, + 116, + 97, + 100, + 97, + 116, + 97 + ] + }, + { + "kind": "const", + "value": [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70 + ] + } + } + }, + { + "name": "launch_signer", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 108, + 97, + 117, + 110, + 99, + 104, + 95, + 115, + 105, + 103, + 110, + 101, + 114 + ] + }, + { + "kind": "account", + "path": "launch" + } + ] + } + }, + { + "name": "quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "launch_signer" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "launch_signer" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "launch_authority" + }, + { + "name": "quote_mint", + "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" + }, + { + "name": "additional_tokens_recipient", + "optional": true + }, + { + "name": "mint_governor", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 105, + 110, + 116, + 95, + 103, + 111, + 118, + 101, + 114, + 110, + 111, + 114 + ] + }, + { + "kind": "account", + "path": "base_mint" + }, + { + "kind": "account", + "path": "launch_signer" + } + ], + "program": { + "kind": "account", + "path": "mint_governor_program" + } + } + }, + { + "name": "mint_governor_program", + "address": "gvnr27cVeyW3AVf3acL7VCJ5WjGAphytnsgcK1feHyH" + }, + { + "name": "mint_governor_event_authority" + }, + { + "name": "rent", + "address": "SysvarRent111111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_metadata_program", + "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "InitializeLaunchArgs" + } + } + } + ] + }, + { + "name": "refund", + "discriminator": [ + 2, + 96, + 183, + 251, + 63, + 208, + 46, + 46 + ], + "accounts": [ + { + "name": "launch", + "writable": true, + "relations": [ + "funding_record" + ] + }, + { + "name": "funding_record", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 102, + 117, + 110, + 100, + 105, + 110, + 103, + 95, + 114, + 101, + 99, + 111, + 114, + 100 + ] + }, + { + "kind": "account", + "path": "launch" + }, + { + "kind": "account", + "path": "funder" + } + ] + } + }, + { + "name": "launch_quote_vault", + "writable": true, + "relations": [ + "launch" + ] + }, + { + "name": "launch_signer", + "relations": [ + "launch" + ] + }, + { + "name": "funder", + "relations": [ + "funding_record" + ] + }, + { + "name": "funder_quote_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "funder" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "launch.quote_mint", + "account": "Launch" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "set_funding_record_approval", + "discriminator": [ + 18, + 197, + 233, + 219, + 37, + 33, + 186, + 25 + ], + "accounts": [ + { + "name": "launch", + "writable": true, + "relations": [ + "funding_record" + ] + }, + { + "name": "funding_record", + "writable": true + }, + { + "name": "launch_authority", + "signer": true, + "relations": [ + "launch" + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "approved_amount", + "type": "u64" + } + ] + }, + { + "name": "settle_launch", + "discriminator": [ + 200, + 143, + 23, + 151, + 91, + 142, + 43, + 125 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "launch_authority", + "signer": true, + "optional": true + }, + { + "name": "token_metadata", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 101, + 116, + 97, + 100, + 97, + 116, + 97 + ] + }, + { + "kind": "const", + "value": [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70 + ] + } + } + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "launch_signer", + "writable": true, + "relations": [ + "launch" + ] + }, + { + "name": "launch_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "launch_signer" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + }, + "relations": [ + "launch" + ] + }, + { + "name": "launch_base_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "launch_signer" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + }, + "relations": [ + "launch" + ] + }, + { + "name": "treasury_quote_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "squads_multisig_vault" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "base_mint", + "writable": true, + "relations": [ + "launch" + ] + }, + { + "name": "quote_mint", + "relations": [ + "launch" + ] + }, + { + "name": "dao_owned_lp_position", + "writable": true + }, + { + "name": "futarchy_amm_base_vault", + "writable": true + }, + { + "name": "futarchy_amm_quote_vault", + "writable": true + }, + { + "name": "dao", + "writable": true + }, + { + "name": "squads_multisig", + "writable": true + }, + { + "name": "squads_multisig_vault" + }, + { + "name": "spending_limit", + "writable": true + }, + { + "name": "bid_wall", + "writable": true + }, + { + "name": "bid_wall_quote_token_account", + "writable": true + }, + { + "name": "fee_recipient", + "address": "6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "static_accounts", + "accounts": [ + { + "name": "futarchy_program", + "address": "FUTARELBfJfQ8RDGhg1wdhddq1odMAJUePHFuBYfUxKq" + }, + { + "name": "token_metadata_program", + "address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s" + }, + { + "name": "futarchy_event_authority" + }, + { + "name": "squads_program", + "address": "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf" + }, + { + "name": "squads_program_config", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 117, + 108, + 116, + 105, + 115, + 105, + 103 + ] + }, + { + "kind": "const", + "value": [ + 112, + 114, + 111, + 103, + 114, + 97, + 109, + 95, + 99, + 111, + 110, + 102, + 105, + 103 + ] + } + ], + "program": { + "kind": "account", + "path": "squads_program" + } + } + }, + { + "name": "squads_program_config_treasury", + "writable": true + }, + { + "name": "bid_wall_program", + "address": "WALL8ucBuUyL46QYxwYJjidaFYhdvxUFrgvBxPshERx" + }, + { + "name": "bid_wall_event_authority" + } + ] + }, + { + "name": "meteora_accounts", + "accounts": [ + { + "name": "damm_v2_program", + "address": "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG" + }, + { + "name": "config" + }, + { + "name": "token_2022_program", + "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "name": "position_nft_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110, + 95, + 110, + 102, + 116, + 95, + 97, + 99, + 99, + 111, + 117, + 110, + 116 + ] + }, + { + "kind": "account", + "path": "position_nft_mint" + } + ], + "program": { + "kind": "account", + "path": "damm_v2_program" + } + } + }, + { + "name": "pool", + "writable": true + }, + { + "name": "position", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110 + ] + }, + { + "kind": "account", + "path": "position_nft_mint" + } + ], + "program": { + "kind": "account", + "path": "damm_v2_program" + } + } + }, + { + "name": "position_nft_mint", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110, + 95, + 110, + 102, + 116, + 95, + 109, + 105, + 110, + 116 + ] + }, + { + "kind": "account", + "path": "base_mint" + } + ] + } + }, + { + "name": "base_mint" + }, + { + "name": "quote_mint" + }, + { + "name": "token_a_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 116, + 111, + 107, + 101, + 110, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "base_mint" + }, + { + "kind": "account", + "path": "pool" + } + ], + "program": { + "kind": "account", + "path": "damm_v2_program" + } + } + }, + { + "name": "token_b_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 116, + 111, + 107, + 101, + 110, + 95, + 118, + 97, + 117, + 108, + 116 + ] + }, + { + "kind": "account", + "path": "quote_mint" + }, + { + "kind": "account", + "path": "pool" + } + ], + "program": { + "kind": "account", + "path": "damm_v2_program" + } + } + }, + { + "name": "pool_creator_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 100, + 97, + 109, + 109, + 95, + 112, + 111, + 111, + 108, + 95, + 99, + 114, + 101, + 97, + 116, + 111, + 114, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "pool_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 111, + 111, + 108, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ], + "program": { + "kind": "account", + "path": "damm_v2_program" + } + } + }, + { + "name": "damm_v2_event_authority" + } + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "start_launch", + "discriminator": [ + 205, + 178, + 36, + 232, + 95, + 202, + 241, + 68 + ], + "accounts": [ + { + "name": "launch", + "writable": true + }, + { + "name": "launch_authority", + "signer": true, + "relations": [ + "launch" + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + } + ], + "accounts": [ + { + "name": "FundingRecord", + "discriminator": [ + 20, + 34, + 251, + 238, + 204, + 117, + 11, + 67 + ] + }, + { + "name": "Launch", + "discriminator": [ + 144, + 51, + 51, + 163, + 206, + 85, + 213, + 38 + ] + }, + { + "name": "MintGovernor", + "discriminator": [ + 110, + 173, + 19, + 114, + 217, + 193, + 37, + 71 + ] + } + ], + "events": [ + { + "name": "FundingRecordApprovalSetEvent", + "discriminator": [ + 33, + 45, + 100, + 94, + 3, + 52, + 35, + 246 + ] + }, + { + "name": "LaunchClaimAdditionalTokenAllocationEvent", + "discriminator": [ + 228, + 82, + 146, + 235, + 214, + 251, + 170, + 28 + ] + }, + { + "name": "LaunchClaimEvent", + "discriminator": [ + 185, + 124, + 167, + 74, + 161, + 160, + 106, + 96 + ] + }, + { + "name": "LaunchCloseEvent", + "discriminator": [ + 229, + 71, + 160, + 47, + 144, + 13, + 115, + 12 + ] + }, + { + "name": "LaunchExtendedEvent", + "discriminator": [ + 178, + 224, + 112, + 157, + 98, + 161, + 2, + 229 + ] + }, + { + "name": "LaunchFinalizedEvent", + "discriminator": [ + 82, + 58, + 210, + 25, + 233, + 142, + 81, + 250 + ] + }, + { + "name": "LaunchFundedEvent", + "discriminator": [ + 107, + 1, + 188, + 175, + 129, + 59, + 38, + 79 + ] + }, + { + "name": "LaunchInitializedEvent", + "discriminator": [ + 227, + 109, + 144, + 20, + 65, + 239, + 101, + 176 + ] + }, + { + "name": "LaunchRefundedEvent", + "discriminator": [ + 59, + 128, + 76, + 161, + 92, + 17, + 206, + 130 + ] + }, + { + "name": "LaunchSettledEvent", + "discriminator": [ + 222, + 55, + 230, + 150, + 71, + 177, + 177, + 50 + ] + }, + { + "name": "LaunchStartedEvent", + "discriminator": [ + 187, + 129, + 95, + 253, + 255, + 206, + 36, + 239 + ] + } + ], + "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": "InvalidLaunchState", + "msg": "Invalid launch state" + }, + { + "code": 6005, + "name": "LaunchPeriodNotOver", + "msg": "Launch period not over" + }, + { + "code": 6006, + "name": "LaunchExpired", + "msg": "Launch is complete, no more funding allowed" + }, + { + "code": 6007, + "name": "LaunchNotRefunding", + "msg": "Refund not available" + }, + { + "code": 6008, + "name": "LaunchNotInitialized", + "msg": "Launch must be initialized to be started" + }, + { + "code": 6009, + "name": "FreezeAuthoritySet", + "msg": "Freeze authority can't be set on launchpad tokens" + }, + { + "code": 6010, + "name": "InvalidMonthlySpendingLimit", + "msg": "Monthly spending limit must be less than 1/6th of the minimum raise amount and cannot be 0" + }, + { + "code": 6011, + "name": "InvalidMonthlySpendingLimitMembers", + "msg": "There can only be at most 10 monthly spending limit members" + }, + { + "code": 6012, + "name": "InvalidPerformancePackageTokenAmount", + "msg": "Invalid performance package token amount" + }, + { + "code": 6013, + "name": "InvalidPerformancePackageMinUnlockTime", + "msg": "Insiders must wait at least 12 months before unlocking" + }, + { + "code": 6014, + "name": "LaunchAuthorityNotSet", + "msg": "Launch authority must be set to complete the launch until 2 days after closing" + }, + { + "code": 6015, + "name": "FinalRaiseAmountTooLow", + "msg": "The final amount raised must be >= the minimum raise amount" + }, + { + "code": 6016, + "name": "TokensAlreadyClaimed", + "msg": "Tokens already claimed" + }, + { + "code": 6017, + "name": "MoneyAlreadyRefunded", + "msg": "USDC already refunded" + }, + { + "code": 6018, + "name": "InvariantViolated", + "msg": "Invariant violated" + }, + { + "code": 6019, + "name": "LaunchNotLive", + "msg": "Launch must be live to be closed" + }, + { + "code": 6020, + "name": "InvalidMinimumRaiseAmount", + "msg": "Minimum raise amount too low for liquidity" + }, + { + "code": 6021, + "name": "FinalRaiseAmountAlreadySet", + "msg": "Final raise amount already set" + }, + { + "code": 6022, + "name": "TotalApprovedAmountTooLow", + "msg": "Total approved amount too low" + }, + { + "code": 6023, + "name": "InvalidAdditionalTokensRecipient", + "msg": "Additional tokens recipient must be set when amount > 0" + }, + { + "code": 6024, + "name": "NoAdditionalTokensRecipientSet", + "msg": "No additional tokens recipient set" + }, + { + "code": 6025, + "name": "AdditionalTokensAlreadyClaimed", + "msg": "Additional tokens already claimed" + }, + { + "code": 6026, + "name": "FundingRecordApprovalPeriodOver", + "msg": "Funding record approval period is over" + }, + { + "code": 6027, + "name": "PerformancePackageAlreadyInitialized", + "msg": "Performance package already initialized" + }, + { + "code": 6028, + "name": "InvalidDao", + "msg": "Invalid DAO" + }, + { + "code": 6029, + "name": "InvalidAccumulatorActivationDelaySeconds", + "msg": "Accumulator activation delay must be less than the launch duration" + }, + { + "code": 6030, + "name": "ExtendDurationExceedsMax", + "msg": "Extend duration would exceed maximum allowed launch duration" + }, + { + "code": 6031, + "name": "InvalidMintAuthority", + "msg": "Mint authority does not match expected" + }, + { + "code": 6032, + "name": "InvalidMeteoraAccount", + "msg": "Invalid Meteora account" + } + ], + "types": [ + { + "name": "CommonFields", + "type": { + "kind": "struct", + "fields": [ + { + "name": "slot", + "type": "u64" + }, + { + "name": "unix_timestamp", + "type": "i64" + }, + { + "name": "launch_seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "ExtendLaunchArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "duration_seconds", + "type": "u32" + } + ] + } + }, + { + "name": "FundingRecord", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pda_bump", + "docs": [ + "The PDA bump." + ], + "type": "u8" + }, + { + "name": "funder", + "docs": [ + "The funder." + ], + "type": "pubkey" + }, + { + "name": "launch", + "docs": [ + "The launch." + ], + "type": "pubkey" + }, + { + "name": "committed_amount", + "docs": [ + "The amount of USDC that has been committed by the funder." + ], + "type": "u64" + }, + { + "name": "is_tokens_claimed", + "docs": [ + "Whether the tokens have been claimed." + ], + "type": "bool" + }, + { + "name": "is_usdc_refunded", + "docs": [ + "Whether the USDC has been refunded." + ], + "type": "bool" + }, + { + "name": "approved_amount", + "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": "committed_amount_accumulator", + "docs": [ + "Running integral of committed_amount over time (committed_amount * seconds)." + ], + "type": "u128" + }, + { + "name": "last_accumulator_update", + "docs": [ + "Unix timestamp of the last accumulator update." + ], + "type": "i64" + } + ] + } + }, + { + "name": "FundingRecordApprovalSetEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "funding_record", + "type": "pubkey" + }, + { + "name": "funder", + "type": "pubkey" + }, + { + "name": "approved_amount", + "type": "u64" + }, + { + "name": "total_approved", + "type": "u64" + } + ] + } + }, + { + "name": "InitializeLaunchArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "minimum_raise_amount", + "type": "u64" + }, + { + "name": "monthly_spending_limit_amount", + "type": "u64" + }, + { + "name": "monthly_spending_limit_members", + "type": { + "vec": "pubkey" + } + }, + { + "name": "seconds_for_launch", + "type": "u32" + }, + { + "name": "token_name", + "type": "string" + }, + { + "name": "token_symbol", + "type": "string" + }, + { + "name": "token_uri", + "type": "string" + }, + { + "name": "performance_package_grantee", + "type": "pubkey" + }, + { + "name": "performance_package_token_amount", + "type": "u64" + }, + { + "name": "months_until_insiders_can_unlock", + "type": "u8" + }, + { + "name": "team_address", + "type": "pubkey" + }, + { + "name": "additional_tokens_amount", + "type": "u64" + }, + { + "name": "accumulator_activation_delay_seconds", + "type": "u32" + }, + { + "name": "has_bid_wall", + "type": "bool" + } + ] + } + }, + { + "name": "Launch", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pda_bump", + "docs": [ + "The PDA bump." + ], + "type": "u8" + }, + { + "name": "minimum_raise_amount", + "docs": [ + "The minimum amount of USDC that must be raised, otherwise", + "everyone can get their USDC back." + ], + "type": "u64" + }, + { + "name": "monthly_spending_limit_amount", + "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": "monthly_spending_limit_members", + "docs": [ + "The wallets that have access to the monthly spending limit." + ], + "type": { + "vec": "pubkey" + } + }, + { + "name": "launch_authority", + "docs": [ + "The account that can start the launch." + ], + "type": "pubkey" + }, + { + "name": "launch_signer", + "docs": [ + "The launch signer address." + ], + "type": "pubkey" + }, + { + "name": "launch_signer_pda_bump", + "docs": [ + "The PDA bump for the launch signer." + ], + "type": "u8" + }, + { + "name": "launch_quote_vault", + "docs": [ + "The USDC vault that will hold the USDC raised until the launch is over." + ], + "type": "pubkey" + }, + { + "name": "launch_base_vault", + "docs": [ + "The token vault, used to send tokens to the AMM." + ], + "type": "pubkey" + }, + { + "name": "base_mint", + "docs": [ + "The token that will be minted to funders and that will control the DAO." + ], + "type": "pubkey" + }, + { + "name": "quote_mint", + "docs": [ + "The USDC mint." + ], + "type": "pubkey" + }, + { + "name": "unix_timestamp_started", + "docs": [ + "The unix timestamp when the launch was started." + ], + "type": { + "option": "i64" + } + }, + { + "name": "unix_timestamp_closed", + "docs": [ + "The unix timestamp when the launch stopped taking new contributions." + ], + "type": { + "option": "i64" + } + }, + { + "name": "total_committed_amount", + "docs": [ + "The amount of USDC that has been committed by the users." + ], + "type": "u64" + }, + { + "name": "state", + "docs": [ + "The state of the launch." + ], + "type": { + "defined": { + "name": "LaunchState" + } + } + }, + { + "name": "seq_num", + "docs": [ + "The sequence number of this launch. Useful for sorting events." + ], + "type": "u64" + }, + { + "name": "seconds_for_launch", + "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": "pubkey" + } + }, + { + "name": "dao_vault", + "docs": [ + "The DAO treasury that USDC / LP is sent to, if the launch is complete." + ], + "type": { + "option": "pubkey" + } + }, + { + "name": "performance_package_grantee", + "docs": [ + "The address that will receive the performance package tokens." + ], + "type": "pubkey" + }, + { + "name": "performance_package_token_amount", + "docs": [ + "The amount of tokens to be granted to the performance package grantee." + ], + "type": "u64" + }, + { + "name": "months_until_insiders_can_unlock", + "docs": [ + "The number of months that insiders must wait before unlocking their tokens." + ], + "type": "u8" + }, + { + "name": "team_address", + "docs": [ + "The initial address used to sponsor team proposals." + ], + "type": "pubkey" + }, + { + "name": "total_approved_amount", + "docs": [ + "The amount of USDC that the launch authority has approved across all funders." + ], + "type": "u64" + }, + { + "name": "additional_tokens_amount", + "docs": [ + "The amount of additional tokens to be minted on a successful launch." + ], + "type": "u64" + }, + { + "name": "additional_tokens_recipient", + "docs": [ + "The token account that will receive the additional tokens." + ], + "type": { + "option": "pubkey" + } + }, + { + "name": "additional_tokens_claimed", + "docs": [ + "Are the additional tokens claimed." + ], + "type": "bool" + }, + { + "name": "unix_timestamp_completed", + "docs": [ + "The unix timestamp when the launch was completed." + ], + "type": { + "option": "i64" + } + }, + { + "name": "is_finalized", + "docs": [ + "Whether the launch has been finalized." + ], + "type": "bool" + }, + { + "name": "accumulator_activation_delay_seconds", + "docs": [ + "Number of seconds after launch start before the funding accumulator", + "begins tracking." + ], + "type": "u32" + }, + { + "name": "has_bid_wall", + "docs": [ + "Whether the launch has a bid wall." + ], + "type": "bool" + }, + { + "name": "mint_governor", + "docs": [ + "The MintGovernor PDA that owns the SPL mint authority." + ], + "type": "pubkey" + } + ] + } + }, + { + "name": "LaunchClaimAdditionalTokenAllocationEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "additional_tokens_amount", + "type": "u64" + }, + { + "name": "additional_tokens_recipient", + "type": "pubkey" + } + ] + } + }, + { + "name": "LaunchClaimEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "funder", + "type": "pubkey" + }, + { + "name": "tokens_claimed", + "type": "u64" + }, + { + "name": "funding_record", + "type": "pubkey" + } + ] + } + }, + { + "name": "LaunchCloseEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "new_state", + "type": { + "defined": { + "name": "LaunchState" + } + } + } + ] + } + }, + { + "name": "LaunchExtendedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "old_seconds_for_launch", + "type": "u32" + }, + { + "name": "new_seconds_for_launch", + "type": "u32" + } + ] + } + }, + { + "name": "LaunchFinalizedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "performance_package", + "type": "pubkey" + }, + { + "name": "mint_governor", + "type": "pubkey" + }, + { + "name": "mint_governor_new_admin", + "type": "pubkey" + }, + { + "name": "pp_mint_authority", + "type": "pubkey" + }, + { + "name": "dao_mint_authority", + "type": "pubkey" + } + ] + } + }, + { + "name": "LaunchFundedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "funding_record", + "type": "pubkey" + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "funder", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "total_committed_by_funder", + "type": "u64" + }, + { + "name": "total_committed", + "type": "u64" + }, + { + "name": "committed_amount_accumulator", + "type": "u128" + } + ] + } + }, + { + "name": "LaunchInitializedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "minimum_raise_amount", + "type": "u64" + }, + { + "name": "launch_authority", + "type": "pubkey" + }, + { + "name": "launch_signer", + "type": "pubkey" + }, + { + "name": "launch_signer_pda_bump", + "type": "u8" + }, + { + "name": "launch_usdc_vault", + "type": "pubkey" + }, + { + "name": "launch_token_vault", + "type": "pubkey" + }, + { + "name": "performance_package_grantee", + "type": "pubkey" + }, + { + "name": "performance_package_token_amount", + "type": "u64" + }, + { + "name": "months_until_insiders_can_unlock", + "type": "u8" + }, + { + "name": "monthly_spending_limit_amount", + "type": "u64" + }, + { + "name": "monthly_spending_limit_members", + "type": { + "vec": "pubkey" + } + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "seconds_for_launch", + "type": "u32" + }, + { + "name": "additional_tokens_amount", + "type": "u64" + }, + { + "name": "additional_tokens_recipient", + "type": { + "option": "pubkey" + } + }, + { + "name": "accumulator_activation_delay_seconds", + "type": "u32" + }, + { + "name": "has_bid_wall", + "type": "bool" + }, + { + "name": "mint_governor", + "type": "pubkey" + } + ] + } + }, + { + "name": "LaunchRefundedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "funder", + "type": "pubkey" + }, + { + "name": "usdc_refunded", + "type": "u64" + }, + { + "name": "funding_record", + "type": "pubkey" + } + ] + } + }, + { + "name": "LaunchSettledEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "final_state", + "type": { + "defined": { + "name": "LaunchState" + } + } + }, + { + "name": "total_committed", + "type": "u64" + }, + { + "name": "dao", + "type": { + "option": "pubkey" + } + }, + { + "name": "dao_treasury", + "type": { + "option": "pubkey" + } + }, + { + "name": "total_approved_amount", + "type": "u64" + }, + { + "name": "bid_wall", + "type": { + "option": "pubkey" + } + }, + { + "name": "bid_wall_amount", + "type": "u64" + }, + { + "name": "tokens_minted", + "type": "u64" + } + ] + } + }, + { + "name": "LaunchStartedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "launch", + "type": "pubkey" + }, + { + "name": "launch_authority", + "type": "pubkey" + }, + { + "name": "slot_started", + "type": "u64" + } + ] + } + }, + { + "name": "LaunchState", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Initialized" + }, + { + "name": "Live" + }, + { + "name": "Closed" + }, + { + "name": "Complete" + }, + { + "name": "Refunding" + } + ] + } + }, + { + "name": "MintGovernor", + "type": { + "kind": "struct", + "fields": [ + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "create_key", + "type": "pubkey" + }, + { + "name": "seq_num", + "type": "u64" + }, + { + "name": "bump", + "type": "u8" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/sdk/src/launchpad/v0.8/types/launchpad_v8.ts b/sdk/src/launchpad/v0.8/types/launchpad_v8.ts index 42cbef700..b8c5e9c9e 100644 --- a/sdk/src/launchpad/v0.8/types/launchpad_v8.ts +++ b/sdk/src/launchpad/v0.8/types/launchpad_v8.ts @@ -1,426 +1,2131 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL can be found at `target/idl/launchpad_v8.json`. + */ export type LaunchpadV8 = { - version: "0.8.0"; - name: "launchpad_v8"; + address: "moonDJUoHteKkGATejA5bdJVwJ6V6Dg74gyqyJTx73n"; + metadata: { + name: "launchpadV8"; + version: "0.8.0"; + spec: "0.1.0"; + description: "Created with Anchor"; + }; instructions: [ { - name: "initializeLaunch"; + name: "claim"; + discriminator: [62, 198, 214, 193, 213, 159, 108, 210]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; + relations: ["fundingRecord"]; }, { - name: "baseMint"; - isMut: true; - isSigner: false; + name: "fundingRecord"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 102, + 117, + 110, + 100, + 105, + 110, + 103, + 95, + 114, + 101, + 99, + 111, + 114, + 100, + ]; + }, + { + kind: "account"; + path: "launch"; + }, + { + kind: "account"; + path: "funder"; + }, + ]; + }; }, { - name: "tokenMetadata"; - isMut: true; - isSigner: false; + name: "launchSigner"; + relations: ["launch"]; }, { - name: "launchSigner"; - isMut: false; - isSigner: false; + name: "baseMint"; + relations: ["launch"]; }, { - name: "quoteVault"; - isMut: true; - isSigner: false; + name: "launchBaseVault"; + writable: true; + relations: ["launch"]; }, { - name: "baseVault"; - isMut: true; - isSigner: false; + name: "funder"; + relations: ["fundingRecord"]; }, { - name: "payer"; - isMut: true; - isSigner: true; + name: "funderTokenAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "funder"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "launchAuthority"; - isMut: false; - isSigner: false; + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { - name: "quoteMint"; - isMut: false; - isSigner: false; + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { - name: "additionalTokensRecipient"; - isMut: false; - isSigner: false; - isOptional: true; + name: "program"; + }, + ]; + args: []; + }, + { + name: "claimAdditionalTokenAllocation"; + discriminator: [245, 214, 225, 140, 237, 135, 163, 244]; + accounts: [ + { + name: "launch"; + writable: true; }, { - name: "mintGovernor"; - isMut: true; - isSigner: false; + name: "payer"; + writable: true; + signer: true; }, { - name: "mintGovernorProgram"; - isMut: false; - isSigner: false; + name: "launchSigner"; + relations: ["launch"]; }, { - name: "mintGovernorEventAuthority"; - isMut: false; - isSigner: false; + name: "launchBaseVault"; + writable: true; + relations: ["launch"]; }, { - name: "rent"; - isMut: false; - isSigner: false; + name: "baseMint"; + relations: ["launch"]; }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + name: "additionalTokensRecipient"; }, { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + name: "additionalTokensRecipientTokenAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "additionalTokensRecipient"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { - name: "tokenMetadataProgram"; - isMut: false; - isSigner: false; + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; + }, + { + name: "associatedTokenProgram"; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; - args: [ + args: []; + }, + { + name: "closeLaunch"; + discriminator: [27, 216, 111, 223, 10, 230, 19, 211]; + accounts: [ { - name: "args"; - type: { - defined: "InitializeLaunchArgs"; + name: "launch"; + writable: true; + }, + { + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; }; }, + { + name: "program"; + }, ]; + args: []; }, { - name: "startLaunch"; + name: "extendLaunch"; + discriminator: [50, 150, 200, 194, 216, 50, 60, 253]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { - name: "launchAuthority"; - isMut: false; - isSigner: true; + name: "admin"; + signer: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; - args: []; + args: [ + { + name: "args"; + type: { + defined: { + name: "extendLaunchArgs"; + }; + }; + }, + ]; }, { - name: "fund"; + name: "finalizeLaunch"; + discriminator: [113, 133, 62, 196, 58, 212, 118, 166]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { - name: "fundingRecord"; - isMut: true; - isSigner: false; + name: "payer"; + writable: true; + signer: true; }, { - name: "launchQuoteVault"; - isMut: true; - isSigner: false; + name: "launchSigner"; + relations: ["launch"]; }, { - name: "funder"; - isMut: false; - isSigner: true; + name: "baseMint"; + relations: ["launch"]; }, { - name: "payer"; - isMut: true; - isSigner: true; + name: "dao"; }, { - name: "funderQuoteAccount"; - isMut: true; - isSigner: false; + name: "squadsMultisig"; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "account"; + path: "dao"; + }, + ]; + program: { + kind: "account"; + path: "squadsProgram"; + }; + }; }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + name: "squadsMultisigVault"; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "account"; + path: "squadsMultisig"; + }, + { + kind: "const"; + value: [118, 97, 117, 108, 116]; + }, + { + kind: "const"; + value: [0]; + }, + ]; + program: { + kind: "account"; + path: "squadsProgram"; + }; + }; + }, + { + name: "performancePackageGrantee"; + relations: ["launch"]; + }, + { + name: "mintGovernor"; + writable: true; + relations: ["launch"]; + }, + { + name: "ppMintAuthority"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 109, + 105, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + { + kind: "account"; + path: "mintGovernor"; + }, + { + kind: "account"; + path: "performancePackage"; + }, + ]; + program: { + kind: "account"; + path: "mintGovernorProgram"; + }; + }; + }, + { + name: "daoMintAuthority"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 109, + 105, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + { + kind: "account"; + path: "mintGovernor"; + }, + { + kind: "account"; + path: "squadsMultisigVault"; + }, + ]; + program: { + kind: "account"; + path: "mintGovernorProgram"; + }; + }; + }, + { + name: "performancePackage"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 112, + 101, + 114, + 102, + 111, + 114, + 109, + 97, + 110, + 99, + 101, + 95, + 112, + 97, + 99, + 107, + 97, + 103, + 101, + ]; + }, + { + kind: "account"; + path: "launchSigner"; + }, + ]; + program: { + kind: "account"; + path: "performancePackageV2Program"; + }; + }; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { - name: "program"; - isMut: false; - isSigner: false; + name: "squadsProgram"; + address: "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf"; }, - ]; - args: [ { - name: "amount"; - type: "u64"; + name: "mintGovernorProgram"; + address: "gvnr27cVeyW3AVf3acL7VCJ5WjGAphytnsgcK1feHyH"; }, - ]; - }, - { - name: "closeLaunch"; - accounts: [ { - name: "launch"; - isMut: true; - isSigner: false; + name: "mintGovernorEventAuthority"; + }, + { + name: "performancePackageV2Program"; + address: "pPV2pfrxnmstSb9j7kEeCLny5BGj6SNwCWGd6xbGGzz"; + }, + { + name: "performancePackageV2EventAuthority"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { - name: "setFundingRecordApproval"; + name: "fund"; + discriminator: [218, 188, 111, 221, 152, 113, 174, 7]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; }, { name: "fundingRecord"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 102, + 117, + 110, + 100, + 105, + 110, + 103, + 95, + 114, + 101, + 99, + 111, + 114, + 100, + ]; + }, + { + kind: "account"; + path: "launch"; + }, + { + kind: "account"; + path: "funder"; + }, + ]; + }; }, { - name: "launchAuthority"; - isMut: false; - isSigner: true; + name: "launchQuoteVault"; + writable: true; + relations: ["launch"]; + }, + { + name: "funder"; + signer: true; + }, + { + name: "payer"; + writable: true; + signer: true; + }, + { + name: "funderQuoteAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "funder"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "launch.quote_mint"; + account: "launch"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; + }, + { + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; + }, + { + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { - name: "approvedAmount"; + name: "amount"; type: "u64"; }, ]; }, { - name: "settleLaunch"; + name: "initializeLaunch"; + discriminator: [90, 201, 220, 142, 112, 253, 100, 13]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [108, 97, 117, 110, 99, 104]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + }; }, { - name: "launchAuthority"; - isMut: false; - isSigner: true; - isOptional: true; + name: "baseMint"; + writable: true; }, { name: "tokenMetadata"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 101, 116, 97, 100, 97, 116, 97]; + }, + { + kind: "const"; + value: [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70, + ]; + }; + }; }, { name: "launchSigner"; - isMut: true; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 108, + 97, + 117, + 110, + 99, + 104, + 95, + 115, + 105, + 103, + 110, + 101, + 114, + ]; + }, + { + kind: "account"; + path: "launch"; + }, + ]; + }; }, { - name: "launchQuoteVault"; - isMut: true; - isSigner: false; + name: "quoteVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "launchSigner"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "launchBaseVault"; - isMut: true; - isSigner: false; + name: "baseVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "launchSigner"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "treasuryQuoteAccount"; - isMut: true; - isSigner: false; + name: "payer"; + writable: true; + signer: true; }, { - name: "baseMint"; - isMut: true; - isSigner: false; + name: "launchAuthority"; }, { name: "quoteMint"; - isMut: false; - isSigner: false; + address: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"; }, { - name: "daoOwnedLpPosition"; - isMut: true; - isSigner: false; + name: "additionalTokensRecipient"; + optional: true; }, { - name: "futarchyAmmBaseVault"; - isMut: true; - isSigner: false; + name: "mintGovernor"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 109, + 105, + 110, + 116, + 95, + 103, + 111, + 118, + 101, + 114, + 110, + 111, + 114, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + { + kind: "account"; + path: "launchSigner"; + }, + ]; + program: { + kind: "account"; + path: "mintGovernorProgram"; + }; + }; }, { - name: "futarchyAmmQuoteVault"; - isMut: true; - isSigner: false; + name: "mintGovernorProgram"; + address: "gvnr27cVeyW3AVf3acL7VCJ5WjGAphytnsgcK1feHyH"; }, { - name: "dao"; - isMut: true; - isSigner: false; + name: "mintGovernorEventAuthority"; }, { - name: "squadsMultisig"; - isMut: true; - isSigner: false; + name: "rent"; + address: "SysvarRent111111111111111111111111111111111"; }, { - name: "squadsMultisigVault"; - isMut: false; - isSigner: false; + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { - name: "spendingLimit"; - isMut: true; - isSigner: false; + name: "associatedTokenProgram"; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { - name: "bidWall"; - isMut: true; - isSigner: false; + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, { - name: "bidWallQuoteTokenAccount"; - isMut: true; - isSigner: false; + name: "tokenMetadataProgram"; + address: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"; }, { - name: "feeRecipient"; - isMut: false; - isSigner: false; + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { - name: "systemProgram"; - isMut: false; - isSigner: false; + name: "program"; }, + ]; + args: [ { - name: "tokenProgram"; - isMut: false; - isSigner: false; + name: "args"; + type: { + defined: { + name: "initializeLaunchArgs"; + }; + }; }, + ]; + }, + { + name: "refund"; + discriminator: [2, 96, 183, 251, 63, 208, 46, 46]; + accounts: [ { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + name: "launch"; + writable: true; + relations: ["fundingRecord"]; }, { - name: "staticAccounts"; + name: "fundingRecord"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 102, + 117, + 110, + 100, + 105, + 110, + 103, + 95, + 114, + 101, + 99, + 111, + 114, + 100, + ]; + }, + { + kind: "account"; + path: "launch"; + }, + { + kind: "account"; + path: "funder"; + }, + ]; + }; + }, + { + name: "launchQuoteVault"; + writable: true; + relations: ["launch"]; + }, + { + name: "launchSigner"; + relations: ["launch"]; + }, + { + name: "funder"; + relations: ["fundingRecord"]; + }, + { + name: "funderQuoteAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "funder"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "launch.quote_mint"; + account: "launch"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; + }, + { + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; + }, + { + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; + }, + { + name: "program"; + }, + ]; + args: []; + }, + { + name: "setFundingRecordApproval"; + discriminator: [18, 197, 233, 219, 37, 33, 186, 25]; + accounts: [ + { + name: "launch"; + writable: true; + relations: ["fundingRecord"]; + }, + { + name: "fundingRecord"; + writable: true; + }, + { + name: "launchAuthority"; + signer: true; + relations: ["launch"]; + }, + { + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; + }, + { + name: "program"; + }, + ]; + args: [ + { + name: "approvedAmount"; + type: "u64"; + }, + ]; + }, + { + name: "settleLaunch"; + discriminator: [200, 143, 23, 151, 91, 142, 43, 125]; + accounts: [ + { + name: "launch"; + writable: true; + }, + { + name: "launchAuthority"; + signer: true; + optional: true; + }, + { + name: "tokenMetadata"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 101, 116, 97, 100, 97, 116, 97]; + }, + { + kind: "const"; + value: [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 11, + 112, + 101, + 177, + 227, + 209, + 124, + 69, + 56, + 157, + 82, + 127, + 107, + 4, + 195, + 205, + 88, + 184, + 108, + 115, + 26, + 160, + 253, + 181, + 73, + 182, + 209, + 188, + 3, + 248, + 41, + 70, + ]; + }; + }; + }, + { + name: "payer"; + writable: true; + signer: true; + }, + { + name: "launchSigner"; + writable: true; + relations: ["launch"]; + }, + { + name: "launchQuoteVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "launchSigner"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; + relations: ["launch"]; + }, + { + name: "launchBaseVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "launchSigner"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; + relations: ["launch"]; + }, + { + name: "treasuryQuoteAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "squadsMultisigVault"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; + }, + { + name: "baseMint"; + writable: true; + relations: ["launch"]; + }, + { + name: "quoteMint"; + relations: ["launch"]; + }, + { + name: "daoOwnedLpPosition"; + writable: true; + }, + { + name: "futarchyAmmBaseVault"; + writable: true; + }, + { + name: "futarchyAmmQuoteVault"; + writable: true; + }, + { + name: "dao"; + writable: true; + }, + { + name: "squadsMultisig"; + writable: true; + }, + { + name: "squadsMultisigVault"; + }, + { + name: "spendingLimit"; + writable: true; + }, + { + name: "bidWall"; + writable: true; + }, + { + name: "bidWallQuoteTokenAccount"; + writable: true; + }, + { + name: "feeRecipient"; + address: "6awyHMshBGVjJ3ozdSJdyyDE1CTAXUwrpNMaRGMsb4sf"; + }, + { + name: "systemProgram"; + address: "11111111111111111111111111111111"; + }, + { + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; + }, + { + name: "associatedTokenProgram"; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; + }, + { + name: "staticAccounts"; accounts: [ { name: "futarchyProgram"; - isMut: false; - isSigner: false; + address: "FUTARELBfJfQ8RDGhg1wdhddq1odMAJUePHFuBYfUxKq"; }, { name: "tokenMetadataProgram"; - isMut: false; - isSigner: false; + address: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"; }, { name: "futarchyEventAuthority"; - isMut: false; - isSigner: false; }, { name: "squadsProgram"; - isMut: false; - isSigner: false; + address: "SQDS4ep65T869zMMBKyuUq6aD6EgTu8psMjkvj52pCf"; }, { name: "squadsProgramConfig"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [109, 117, 108, 116, 105, 115, 105, 103]; + }, + { + kind: "const"; + value: [ + 112, + 114, + 111, + 103, + 114, + 97, + 109, + 95, + 99, + 111, + 110, + 102, + 105, + 103, + ]; + }, + ]; + program: { + kind: "account"; + path: "squadsProgram"; + }; + }; }, { name: "squadsProgramConfigTreasury"; - isMut: true; - isSigner: false; + writable: true; }, { name: "bidWallProgram"; - isMut: false; - isSigner: false; + address: "WALL8ucBuUyL46QYxwYJjidaFYhdvxUFrgvBxPshERx"; }, { name: "bidWallEventAuthority"; - isMut: false; - isSigner: false; }, ]; }, @@ -429,468 +2134,612 @@ export type LaunchpadV8 = { accounts: [ { name: "dammV2Program"; - isMut: false; - isSigner: false; + address: "cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG"; }, { name: "config"; - isMut: false; - isSigner: false; }, { name: "token2022Program"; - isMut: false; - isSigner: false; + address: "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"; }, { name: "positionNftAccount"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110, + 95, + 110, + 102, + 116, + 95, + 97, + 99, + 99, + 111, + 117, + 110, + 116, + ]; + }, + { + kind: "account"; + path: "positionNftMint"; + }, + ]; + program: { + kind: "account"; + path: "dammV2Program"; + }; + }; }, { name: "pool"; - isMut: true; - isSigner: false; + writable: true; }, { name: "position"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [112, 111, 115, 105, 116, 105, 111, 110]; + }, + { + kind: "account"; + path: "positionNftMint"; + }, + ]; + program: { + kind: "account"; + path: "dammV2Program"; + }; + }; }, { name: "positionNftMint"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 112, + 111, + 115, + 105, + 116, + 105, + 111, + 110, + 95, + 110, + 102, + 116, + 95, + 109, + 105, + 110, + 116, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + ]; + }; }, { name: "baseMint"; - isMut: false; - isSigner: false; }, { name: "quoteMint"; - isMut: false; - isSigner: false; }, { name: "tokenAVault"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 116, + 111, + 107, + 101, + 110, + 95, + 118, + 97, + 117, + 108, + 116, + ]; + }, + { + kind: "account"; + path: "baseMint"; + }, + { + kind: "account"; + path: "pool"; + }, + ]; + program: { + kind: "account"; + path: "dammV2Program"; + }; + }; }, { name: "tokenBVault"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 116, + 111, + 107, + 101, + 110, + 95, + 118, + 97, + 117, + 108, + 116, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + { + kind: "account"; + path: "pool"; + }, + ]; + program: { + kind: "account"; + path: "dammV2Program"; + }; + }; }, { name: "poolCreatorAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 100, + 97, + 109, + 109, + 95, + 112, + 111, + 111, + 108, + 95, + 99, + 114, + 101, + 97, + 116, + 111, + 114, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "poolAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 112, + 111, + 111, + 108, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + program: { + kind: "account"; + path: "dammV2Program"; + }; + }; }, { name: "dammV2EventAuthority"; - isMut: false; - isSigner: false; }, ]; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { - name: "claim"; + name: "startLaunch"; + discriminator: [205, 178, 36, 232, 95, 202, 241, 68]; accounts: [ { name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "fundingRecord"; - isMut: true; - isSigner: false; - }, - { - name: "launchSigner"; - isMut: false; - isSigner: false; - }, - { - name: "baseMint"; - isMut: false; - isSigner: false; + writable: true; }, { - 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: "launchAuthority"; + signer: true; + relations: ["launch"]; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, + ]; + accounts: [ { - 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: "fundingRecord"; + discriminator: [20, 34, 251, 238, 204, 117, 11, 67]; }, { - name: "claimAdditionalTokenAllocation"; - accounts: [ - { - name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "launchSigner"; - isMut: false; - isSigner: false; - }, - { - name: "launchBaseVault"; - isMut: true; - isSigner: false; - }, - { - name: "baseMint"; - isMut: false; - 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: []; + name: "launch"; + discriminator: [144, 51, 51, 163, 206, 85, 213, 38]; }, { - name: "finalizeLaunch"; - accounts: [ - { - name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "launchSigner"; - isMut: false; - isSigner: false; - }, - { - name: "baseMint"; - isMut: false; - isSigner: false; - }, - { - name: "dao"; - isMut: false; - isSigner: false; - }, - { - name: "squadsMultisig"; - isMut: false; - isSigner: false; - }, - { - name: "squadsMultisigVault"; - isMut: false; - isSigner: false; - }, - { - name: "performancePackageGrantee"; - isMut: false; - isSigner: false; - }, - { - name: "mintGovernor"; - isMut: true; - isSigner: false; - }, - { - name: "ppMintAuthority"; - isMut: true; - isSigner: false; - }, - { - name: "daoMintAuthority"; - isMut: true; - isSigner: false; - }, - { - name: "performancePackage"; - isMut: true; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - { - name: "squadsProgram"; - isMut: false; - isSigner: false; - }, - { - name: "mintGovernorProgram"; - isMut: false; - isSigner: false; - }, - { - name: "mintGovernorEventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "performancePackageV2Program"; - isMut: false; - isSigner: false; - }, - { - name: "performancePackageV2EventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: []; + name: "mintGovernor"; + discriminator: [110, 173, 19, 114, 217, 193, 37, 71]; }, + ]; + events: [ { - name: "extendLaunch"; - accounts: [ - { - name: "launch"; - isMut: true; - isSigner: false; - }, - { - name: "admin"; - isMut: false; - isSigner: true; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "ExtendLaunchArgs"; - }; - }, - ]; + name: "fundingRecordApprovalSetEvent"; + discriminator: [33, 45, 100, 94, 3, 52, 35, 246]; + }, + { + name: "launchClaimAdditionalTokenAllocationEvent"; + discriminator: [228, 82, 146, 235, 214, 251, 170, 28]; + }, + { + name: "launchClaimEvent"; + discriminator: [185, 124, 167, 74, 161, 160, 106, 96]; + }, + { + name: "launchCloseEvent"; + discriminator: [229, 71, 160, 47, 144, 13, 115, 12]; + }, + { + name: "launchExtendedEvent"; + discriminator: [178, 224, 112, 157, 98, 161, 2, 229]; + }, + { + name: "launchFinalizedEvent"; + discriminator: [82, 58, 210, 25, 233, 142, 81, 250]; + }, + { + name: "launchFundedEvent"; + discriminator: [107, 1, 188, 175, 129, 59, 38, 79]; + }, + { + name: "launchInitializedEvent"; + discriminator: [227, 109, 144, 20, 65, 239, 101, 176]; + }, + { + name: "launchRefundedEvent"; + discriminator: [59, 128, 76, 161, 92, 17, 206, 130]; + }, + { + name: "launchSettledEvent"; + discriminator: [222, 55, 230, 150, 71, 177, 177, 50]; + }, + { + name: "launchStartedEvent"; + discriminator: [187, 129, 95, 253, 255, 206, 36, 239]; }, ]; - accounts: [ + errors: [ { - name: "fundingRecord"; + 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: "invalidLaunchState"; + msg: "Invalid launch state"; + }, + { + code: 6005; + name: "launchPeriodNotOver"; + msg: "Launch period not over"; + }, + { + code: 6006; + name: "launchExpired"; + msg: "Launch is complete, no more funding allowed"; + }, + { + code: 6007; + name: "launchNotRefunding"; + msg: "Refund not available"; + }, + { + code: 6008; + name: "launchNotInitialized"; + msg: "Launch must be initialized to be started"; + }, + { + code: 6009; + name: "freezeAuthoritySet"; + msg: "Freeze authority can't be set on launchpad tokens"; + }, + { + code: 6010; + name: "invalidMonthlySpendingLimit"; + msg: "Monthly spending limit must be less than 1/6th of the minimum raise amount and cannot be 0"; + }, + { + code: 6011; + name: "invalidMonthlySpendingLimitMembers"; + msg: "There can only be at most 10 monthly spending limit members"; + }, + { + code: 6012; + name: "invalidPerformancePackageTokenAmount"; + msg: "Invalid performance package token amount"; + }, + { + code: 6013; + name: "invalidPerformancePackageMinUnlockTime"; + msg: "Insiders must wait at least 12 months before unlocking"; + }, + { + code: 6014; + name: "launchAuthorityNotSet"; + msg: "Launch authority must be set to complete the launch until 2 days after closing"; + }, + { + code: 6015; + name: "finalRaiseAmountTooLow"; + msg: "The final amount raised must be >= the minimum raise amount"; + }, + { + code: 6016; + name: "tokensAlreadyClaimed"; + msg: "Tokens already claimed"; + }, + { + code: 6017; + name: "moneyAlreadyRefunded"; + msg: "USDC already refunded"; + }, + { + code: 6018; + name: "invariantViolated"; + msg: "Invariant violated"; + }, + { + code: 6019; + name: "launchNotLive"; + msg: "Launch must be live to be closed"; + }, + { + code: 6020; + name: "invalidMinimumRaiseAmount"; + msg: "Minimum raise amount too low for liquidity"; + }, + { + code: 6021; + name: "finalRaiseAmountAlreadySet"; + msg: "Final raise amount already set"; + }, + { + code: 6022; + name: "totalApprovedAmountTooLow"; + msg: "Total approved amount too low"; + }, + { + code: 6023; + name: "invalidAdditionalTokensRecipient"; + msg: "Additional tokens recipient must be set when amount > 0"; + }, + { + code: 6024; + name: "noAdditionalTokensRecipientSet"; + msg: "No additional tokens recipient set"; + }, + { + code: 6025; + name: "additionalTokensAlreadyClaimed"; + msg: "Additional tokens already claimed"; + }, + { + code: 6026; + name: "fundingRecordApprovalPeriodOver"; + msg: "Funding record approval period is over"; + }, + { + code: 6027; + name: "performancePackageAlreadyInitialized"; + msg: "Performance package already initialized"; + }, + { + code: 6028; + name: "invalidDao"; + msg: "Invalid DAO"; + }, + { + code: 6029; + name: "invalidAccumulatorActivationDelaySeconds"; + msg: "Accumulator activation delay must be less than the launch duration"; + }, + { + code: 6030; + name: "extendDurationExceedsMax"; + msg: "Extend duration would exceed maximum allowed launch duration"; + }, + { + code: 6031; + name: "invalidMintAuthority"; + msg: "Mint authority does not match expected"; + }, + { + code: 6032; + name: "invalidMeteoraAccount"; + msg: "Invalid Meteora account"; + }, + ]; + types: [ + { + name: "commonFields"; type: { kind: "struct"; fields: [ { - name: "pdaBump"; - docs: ["The PDA bump."]; - type: "u8"; - }, - { - name: "funder"; - docs: ["The funder."]; - type: "publicKey"; + name: "slot"; + type: "u64"; }, { - name: "launch"; - docs: ["The launch."]; - type: "publicKey"; + name: "unixTimestamp"; + type: "i64"; }, { - name: "committedAmount"; - docs: ["The amount of USDC that has been committed by the funder."]; + name: "launchSeqNum"; type: "u64"; }, + ]; + }; + }, + { + name: "extendLaunchArgs"; + type: { + kind: "struct"; + fields: [ { - 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: "committedAmountAccumulator"; - docs: [ - "Running integral of committed_amount over time (committed_amount * seconds).", - ]; - type: "u128"; - }, - { - name: "lastAccumulatorUpdate"; - docs: ["Unix timestamp of the last accumulator update."]; - type: "i64"; + name: "durationSeconds"; + type: "u32"; }, ]; }; }, { - name: "launch"; + name: "fundingRecord"; type: { kind: "struct"; fields: [ @@ -900,2868 +2749,850 @@ export type LaunchpadV8 = { 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."]; - 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 the AMM."]; - 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: "funder"; + docs: ["The funder."]; + type: "pubkey"; }, { - name: "performancePackageGrantee"; - docs: [ - "The address that will receive the performance package tokens.", - ]; - type: "publicKey"; + name: "launch"; + docs: ["The launch."]; + type: "pubkey"; }, { - name: "performancePackageTokenAmount"; - docs: [ - "The amount of tokens to be granted to the performance package grantee.", - ]; + name: "committedAmount"; + docs: ["The amount of USDC that has been committed by the funder."]; 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: "isTokensClaimed"; + docs: ["Whether the tokens have been claimed."]; + type: "bool"; }, { - name: "totalApprovedAmount"; - docs: [ - "The amount of USDC that the launch authority has approved across all funders.", - ]; - type: "u64"; + name: "isUsdcRefunded"; + docs: ["Whether the USDC has been refunded."]; + type: "bool"; }, { - name: "additionalTokensAmount"; + name: "approvedAmount"; docs: [ - "The amount of additional tokens to be minted on a successful launch.", + "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: "additionalTokensRecipient"; - docs: [ - "The token account that will receive the additional tokens.", - ]; - type: { - option: "publicKey"; - }; - }, - { - name: "additionalTokensClaimed"; - docs: ["Are the additional tokens claimed."]; - type: "bool"; - }, - { - name: "unixTimestampCompleted"; - docs: ["The unix timestamp when the launch was completed."]; - type: { - option: "i64"; - }; - }, - { - name: "isFinalized"; - docs: ["Whether the launch has been finalized."]; - type: "bool"; - }, - { - name: "accumulatorActivationDelaySeconds"; + name: "committedAmountAccumulator"; docs: [ - "Number of seconds after launch start before the funding accumulator", - "begins tracking.", + "Running integral of committed_amount over time (committed_amount * seconds).", ]; - type: "u32"; - }, - { - name: "hasBidWall"; - docs: ["Whether the launch has a bid wall."]; - type: "bool"; - }, - { - name: "mintGovernor"; - docs: ["The MintGovernor PDA that owns the SPL mint authority."]; - type: "publicKey"; - }, - ]; - }; - }, - ]; - types: [ - { - name: "CommonFields"; - type: { - kind: "struct"; - fields: [ - { - name: "slot"; - type: "u64"; + type: "u128"; }, { - name: "unixTimestamp"; + name: "lastAccumulatorUpdate"; + docs: ["Unix timestamp of the last accumulator update."]; type: "i64"; }, - { - name: "launchSeqNum"; - type: "u64"; - }, ]; }; }, { - name: "ExtendLaunchArgs"; + name: "fundingRecordApprovalSetEvent"; type: { kind: "struct"; fields: [ { - name: "durationSeconds"; - type: "u32"; - }, - ]; - }; - }, - { - name: "InitializeLaunchArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "minimumRaiseAmount"; - type: "u64"; - }, - { - name: "monthlySpendingLimitAmount"; - type: "u64"; - }, - { - name: "monthlySpendingLimitMembers"; + name: "common"; 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: "accumulatorActivationDelaySeconds"; - type: "u32"; - }, - { - name: "hasBidWall"; - type: "bool"; - }, - ]; - }; - }, - { - 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: "additionalTokensAmount"; - type: "u64"; - index: false; - }, - { - name: "additionalTokensRecipient"; - type: { - option: "publicKey"; - }; - index: false; - }, - { - name: "accumulatorActivationDelaySeconds"; - type: "u32"; - index: false; - }, - { - name: "hasBidWall"; - type: "bool"; - index: false; - }, - { - name: "mintGovernor"; - type: "publicKey"; - 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: "committedAmountAccumulator"; - type: "u128"; - 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: "LaunchSettledEvent"; - 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: "bidWall"; - type: { - option: "publicKey"; - }; - index: false; - }, - { - name: "bidWallAmount"; - type: "u64"; - index: false; - }, - { - name: "tokensMinted"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "LaunchFinalizedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "launch"; - type: "publicKey"; - index: false; - }, - { - name: "performancePackage"; - type: "publicKey"; - index: false; - }, - { - name: "mintGovernor"; - type: "publicKey"; - index: false; - }, - { - name: "mintGovernorNewAdmin"; - type: "publicKey"; - index: false; - }, - { - name: "ppMintAuthority"; - type: "publicKey"; - index: false; - }, - { - name: "daoMintAuthority"; - type: "publicKey"; - 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; - }, - ]; - }, - { - name: "LaunchExtendedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "launch"; - type: "publicKey"; - index: false; - }, - { - name: "oldSecondsForLaunch"; - type: "u32"; - index: false; - }, - { - name: "newSecondsForLaunch"; - type: "u32"; - 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: "InvalidLaunchState"; - msg: "Invalid launch state"; - }, - { - code: 6005; - name: "LaunchPeriodNotOver"; - msg: "Launch period not over"; - }, - { - code: 6006; - name: "LaunchExpired"; - msg: "Launch is complete, no more funding allowed"; - }, - { - code: 6007; - name: "LaunchNotRefunding"; - msg: "Refund not available"; - }, - { - code: 6008; - name: "LaunchNotInitialized"; - msg: "Launch must be initialized to be started"; - }, - { - code: 6009; - name: "FreezeAuthoritySet"; - msg: "Freeze authority can't be set on launchpad tokens"; - }, - { - code: 6010; - name: "InvalidMonthlySpendingLimit"; - msg: "Monthly spending limit must be less than 1/6th of the minimum raise amount and cannot be 0"; - }, - { - code: 6011; - name: "InvalidMonthlySpendingLimitMembers"; - msg: "There can only be at most 10 monthly spending limit members"; - }, - { - code: 6012; - name: "InvalidPerformancePackageTokenAmount"; - msg: "Invalid performance package token amount"; - }, - { - code: 6013; - name: "InvalidPerformancePackageMinUnlockTime"; - msg: "Insiders must wait at least 12 months before unlocking"; - }, - { - code: 6014; - name: "LaunchAuthorityNotSet"; - msg: "Launch authority must be set to complete the launch until 2 days after closing"; - }, - { - code: 6015; - name: "FinalRaiseAmountTooLow"; - msg: "The final amount raised must be >= the minimum raise amount"; - }, - { - code: 6016; - name: "TokensAlreadyClaimed"; - msg: "Tokens already claimed"; - }, - { - code: 6017; - name: "MoneyAlreadyRefunded"; - msg: "USDC already refunded"; - }, - { - code: 6018; - name: "InvariantViolated"; - msg: "Invariant violated"; - }, - { - code: 6019; - name: "LaunchNotLive"; - msg: "Launch must be live to be closed"; - }, - { - code: 6020; - name: "InvalidMinimumRaiseAmount"; - msg: "Minimum raise amount too low for liquidity"; - }, - { - code: 6021; - name: "FinalRaiseAmountAlreadySet"; - msg: "Final raise amount already set"; - }, - { - code: 6022; - name: "TotalApprovedAmountTooLow"; - msg: "Total approved amount too low"; - }, - { - code: 6023; - name: "InvalidAdditionalTokensRecipient"; - msg: "Additional tokens recipient must be set when amount > 0"; - }, - { - code: 6024; - name: "NoAdditionalTokensRecipientSet"; - msg: "No additional tokens recipient set"; - }, - { - code: 6025; - name: "AdditionalTokensAlreadyClaimed"; - msg: "Additional tokens already claimed"; - }, - { - code: 6026; - name: "FundingRecordApprovalPeriodOver"; - msg: "Funding record approval period is over"; - }, - { - code: 6027; - name: "PerformancePackageAlreadyInitialized"; - msg: "Performance package already initialized"; - }, - { - code: 6028; - name: "InvalidDao"; - msg: "Invalid DAO"; - }, - { - code: 6029; - name: "InvalidAccumulatorActivationDelaySeconds"; - msg: "Accumulator activation delay must be less than the launch duration"; - }, - { - code: 6030; - name: "ExtendDurationExceedsMax"; - msg: "Extend duration would exceed maximum allowed launch duration"; - }, - { - code: 6031; - name: "InvalidMintAuthority"; - msg: "Mint authority does not match expected"; - }, - { - code: 6032; - name: "InvalidMeteoraAccount"; - msg: "Invalid Meteora account"; - }, - ]; -}; - -export const IDL: LaunchpadV8 = { - version: "0.8.0", - name: "launchpad_v8", - 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: "mintGovernor", - isMut: true, - isSigner: false, - }, - { - name: "mintGovernorProgram", - isMut: false, - isSigner: false, - }, - { - name: "mintGovernorEventAuthority", - 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: "closeLaunch", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - 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: "settleLaunch", - 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: "bidWall", - isMut: true, - isSigner: false, - }, - { - name: "bidWallQuoteTokenAccount", - isMut: true, - isSigner: false, - }, - { - name: "feeRecipient", - isMut: false, - 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: "futarchyEventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgram", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgramConfig", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgramConfigTreasury", - isMut: true, - isSigner: false, - }, - { - name: "bidWallProgram", - isMut: false, - isSigner: false, - }, - { - name: "bidWallEventAuthority", - 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: "claim", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "fundingRecord", - isMut: true, - isSigner: false, - }, - { - name: "launchSigner", - isMut: false, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - 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: "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: "claimAdditionalTokenAllocation", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "launchSigner", - isMut: false, - isSigner: false, - }, - { - name: "launchBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - 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: [], - }, - { - name: "finalizeLaunch", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "launchSigner", - isMut: false, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "dao", - isMut: false, - isSigner: false, - }, - { - name: "squadsMultisig", - isMut: false, - isSigner: false, - }, - { - name: "squadsMultisigVault", - isMut: false, - isSigner: false, - }, - { - name: "performancePackageGrantee", - isMut: false, - isSigner: false, - }, - { - name: "mintGovernor", - isMut: true, - isSigner: false, - }, - { - name: "ppMintAuthority", - isMut: true, - isSigner: false, - }, - { - name: "daoMintAuthority", - isMut: true, - isSigner: false, - }, - { - name: "performancePackage", - isMut: true, - isSigner: false, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "squadsProgram", - isMut: false, - isSigner: false, - }, - { - name: "mintGovernorProgram", - isMut: false, - isSigner: false, - }, - { - name: "mintGovernorEventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "performancePackageV2Program", - isMut: false, - isSigner: false, - }, - { - name: "performancePackageV2EventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "extendLaunch", - accounts: [ - { - name: "launch", - isMut: true, - isSigner: false, - }, - { - name: "admin", - isMut: false, - isSigner: true, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "ExtendLaunchArgs", + defined: { + name: "commonFields"; + }; + }; }, - }, - ], + { + name: "launch"; + type: "pubkey"; + }, + { + name: "fundingRecord"; + type: "pubkey"; + }, + { + name: "funder"; + type: "pubkey"; + }, + { + name: "approvedAmount"; + type: "u64"; + }, + { + name: "totalApproved"; + type: "u64"; + }, + ]; + }; }, - ], - accounts: [ { - name: "fundingRecord", + name: "initializeLaunchArgs"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "pdaBump", - docs: ["The PDA bump."], - type: "u8", + name: "minimumRaiseAmount"; + type: "u64"; + }, + { + name: "monthlySpendingLimitAmount"; + type: "u64"; + }, + { + name: "monthlySpendingLimitMembers"; + type: { + vec: "pubkey"; + }; + }, + { + name: "secondsForLaunch"; + type: "u32"; }, { - name: "funder", - docs: ["The funder."], - type: "publicKey", + name: "tokenName"; + type: "string"; }, { - name: "launch", - docs: ["The launch."], - type: "publicKey", + name: "tokenSymbol"; + type: "string"; }, { - name: "committedAmount", - docs: ["The amount of USDC that has been committed by the funder."], - type: "u64", + name: "tokenUri"; + type: "string"; }, { - name: "isTokensClaimed", - docs: ["Whether the tokens have been claimed."], - type: "bool", + name: "performancePackageGrantee"; + type: "pubkey"; }, { - name: "isUsdcRefunded", - docs: ["Whether the USDC has been refunded."], - type: "bool", + name: "performancePackageTokenAmount"; + type: "u64"; }, { - 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: "monthsUntilInsidersCanUnlock"; + type: "u8"; }, { - name: "committedAmountAccumulator", - docs: [ - "Running integral of committed_amount over time (committed_amount * seconds).", - ], - type: "u128", + name: "teamAddress"; + type: "pubkey"; + }, + { + name: "additionalTokensAmount"; + type: "u64"; + }, + { + name: "accumulatorActivationDelaySeconds"; + type: "u32"; }, { - name: "lastAccumulatorUpdate", - docs: ["Unix timestamp of the last accumulator update."], - type: "i64", + name: "hasBidWall"; + type: "bool"; }, - ], - }, + ]; + }; }, { - name: "launch", + name: "launch"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "pdaBump", - docs: ["The PDA bump."], - type: "u8", + name: "pdaBump"; + docs: ["The PDA bump."]; + type: "u8"; }, { - name: "minimumRaiseAmount", + name: "minimumRaiseAmount"; docs: [ "The minimum amount of USDC that must be raised, otherwise", "everyone can get their USDC back.", - ], - type: "u64", + ]; + type: "u64"; }, { - name: "monthlySpendingLimitAmount", + 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", + ]; + type: "u64"; }, { - name: "monthlySpendingLimitMembers", + name: "monthlySpendingLimitMembers"; docs: [ "The wallets that have access to the monthly spending limit.", - ], + ]; type: { - vec: "publicKey", - }, + vec: "pubkey"; + }; + }, + { + name: "launchAuthority"; + docs: ["The account that can start the launch."]; + type: "pubkey"; + }, + { + name: "launchSigner"; + docs: ["The launch signer address."]; + type: "pubkey"; + }, + { + 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: "pubkey"; + }, + { + name: "launchBaseVault"; + docs: ["The token vault, used to send tokens to the AMM."]; + type: "pubkey"; + }, + { + name: "baseMint"; + docs: [ + "The token that will be minted to funders and that will control the DAO.", + ]; + type: "pubkey"; + }, + { + name: "quoteMint"; + docs: ["The USDC mint."]; + type: "pubkey"; + }, + { + 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: { + name: "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: "pubkey"; + }; + }, + { + name: "daoVault"; + docs: [ + "The DAO treasury that USDC / LP is sent to, if the launch is complete.", + ]; + type: { + option: "pubkey"; + }; + }, + { + name: "performancePackageGrantee"; + docs: [ + "The address that will receive the performance package tokens.", + ]; + type: "pubkey"; + }, + { + 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: "pubkey"; + }, + { + 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: "pubkey"; + }; + }, + { + name: "additionalTokensClaimed"; + docs: ["Are the additional tokens claimed."]; + type: "bool"; + }, + { + name: "unixTimestampCompleted"; + docs: ["The unix timestamp when the launch was completed."]; + type: { + option: "i64"; + }; + }, + { + name: "isFinalized"; + docs: ["Whether the launch has been finalized."]; + type: "bool"; + }, + { + name: "accumulatorActivationDelaySeconds"; + docs: [ + "Number of seconds after launch start before the funding accumulator", + "begins tracking.", + ]; + type: "u32"; + }, + { + name: "hasBidWall"; + docs: ["Whether the launch has a bid wall."]; + type: "bool"; + }, + { + name: "mintGovernor"; + docs: ["The MintGovernor PDA that owns the SPL mint authority."]; + type: "pubkey"; + }, + ]; + }; + }, + { + name: "launchClaimAdditionalTokenAllocationEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "launchAuthority", - docs: ["The account that can start the launch."], - type: "publicKey", + name: "launch"; + type: "pubkey"; }, { - name: "launchSigner", - docs: ["The launch signer address."], - type: "publicKey", + name: "additionalTokensAmount"; + type: "u64"; }, { - name: "launchSignerPdaBump", - docs: ["The PDA bump for the launch signer."], - type: "u8", + name: "additionalTokensRecipient"; + type: "pubkey"; }, + ]; + }; + }, + { + name: "launchClaimEvent"; + type: { + kind: "struct"; + fields: [ { - name: "launchQuoteVault", - docs: [ - "The USDC vault that will hold the USDC raised until the launch is over.", - ], - type: "publicKey", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "launchBaseVault", - docs: ["The token vault, used to send tokens to the AMM."], - type: "publicKey", + name: "launch"; + type: "pubkey"; }, { - name: "baseMint", - docs: [ - "The token that will be minted to funders and that will control the DAO.", - ], - type: "publicKey", + name: "funder"; + type: "pubkey"; }, { - name: "quoteMint", - docs: ["The USDC mint."], - type: "publicKey", + name: "tokensClaimed"; + type: "u64"; }, { - name: "unixTimestampStarted", - docs: ["The unix timestamp when the launch was started."], - type: { - option: "i64", - }, + name: "fundingRecord"; + type: "pubkey"; }, + ]; + }; + }, + { + name: "launchCloseEvent"; + type: { + kind: "struct"; + fields: [ { - name: "unixTimestampClosed", - docs: [ - "The unix timestamp when the launch stopped taking new contributions.", - ], + name: "common"; type: { - option: "i64", - }, + defined: { + name: "commonFields"; + }; + }; }, { - name: "totalCommittedAmount", - docs: ["The amount of USDC that has been committed by the users."], - type: "u64", + name: "launch"; + type: "pubkey"; }, { - name: "state", - docs: ["The state of the launch."], + name: "newState"; type: { - defined: "LaunchState", - }, + defined: { + name: "launchState"; + }; + }; }, + ]; + }; + }, + { + name: "launchExtendedEvent"; + type: { + kind: "struct"; + fields: [ { - name: "seqNum", - docs: [ - "The sequence number of this launch. Useful for sorting events.", - ], - type: "u64", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "secondsForLaunch", - docs: ["The number of seconds that the launch will be live for."], - type: "u32", + name: "launch"; + type: "pubkey"; }, { - name: "dao", - docs: ["The DAO, if the launch is complete."], - type: { - option: "publicKey", - }, + name: "oldSecondsForLaunch"; + type: "u32"; }, { - name: "daoVault", - docs: [ - "The DAO treasury that USDC / LP is sent to, if the launch is complete.", - ], + name: "newSecondsForLaunch"; + type: "u32"; + }, + ]; + }; + }, + { + name: "launchFinalizedEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; type: { - option: "publicKey", - }, + defined: { + name: "commonFields"; + }; + }; }, { - name: "performancePackageGrantee", - docs: [ - "The address that will receive the performance package tokens.", - ], - type: "publicKey", + name: "launch"; + type: "pubkey"; }, { - name: "performancePackageTokenAmount", - docs: [ - "The amount of tokens to be granted to the performance package grantee.", - ], - type: "u64", + name: "performancePackage"; + type: "pubkey"; }, { - name: "monthsUntilInsidersCanUnlock", - docs: [ - "The number of months that insiders must wait before unlocking their tokens.", - ], - type: "u8", + name: "mintGovernor"; + type: "pubkey"; }, { - name: "teamAddress", - docs: ["The initial address used to sponsor team proposals."], - type: "publicKey", + name: "mintGovernorNewAdmin"; + type: "pubkey"; }, { - name: "totalApprovedAmount", - docs: [ - "The amount of USDC that the launch authority has approved across all funders.", - ], - type: "u64", + name: "ppMintAuthority"; + type: "pubkey"; }, { - name: "additionalTokensAmount", - docs: [ - "The amount of additional tokens to be minted on a successful launch.", - ], - type: "u64", + name: "daoMintAuthority"; + type: "pubkey"; }, + ]; + }; + }, + { + name: "launchFundedEvent"; + type: { + kind: "struct"; + fields: [ { - name: "additionalTokensRecipient", - docs: [ - "The token account that will receive the additional tokens.", - ], + name: "common"; type: { - option: "publicKey", - }, + defined: { + name: "commonFields"; + }; + }; }, { - name: "additionalTokensClaimed", - docs: ["Are the additional tokens claimed."], - type: "bool", + name: "fundingRecord"; + type: "pubkey"; }, { - name: "unixTimestampCompleted", - docs: ["The unix timestamp when the launch was completed."], - type: { - option: "i64", - }, + name: "launch"; + type: "pubkey"; }, { - name: "isFinalized", - docs: ["Whether the launch has been finalized."], - type: "bool", + name: "funder"; + type: "pubkey"; }, { - name: "accumulatorActivationDelaySeconds", - docs: [ - "Number of seconds after launch start before the funding accumulator", - "begins tracking.", - ], - type: "u32", + name: "amount"; + type: "u64"; + }, + { + name: "totalCommittedByFunder"; + type: "u64"; }, { - name: "hasBidWall", - docs: ["Whether the launch has a bid wall."], - type: "bool", + name: "totalCommitted"; + type: "u64"; }, { - name: "mintGovernor", - docs: ["The MintGovernor PDA that owns the SPL mint authority."], - type: "publicKey", + name: "committedAmountAccumulator"; + type: "u128"; }, - ], - }, + ]; + }; }, - ], - types: [ { - name: "CommonFields", + name: "launchInitializedEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "slot", - type: "u64", - }, - { - name: "unixTimestamp", - type: "i64", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "launchSeqNum", - type: "u64", + name: "launch"; + type: "pubkey"; }, - ], - }, - }, - { - name: "ExtendLaunchArgs", - type: { - kind: "struct", - fields: [ { - name: "durationSeconds", - type: "u32", + name: "minimumRaiseAmount"; + type: "u64"; }, - ], - }, - }, - { - name: "InitializeLaunchArgs", - type: { - kind: "struct", - fields: [ { - name: "minimumRaiseAmount", - type: "u64", + name: "launchAuthority"; + type: "pubkey"; }, { - name: "monthlySpendingLimitAmount", - type: "u64", + name: "launchSigner"; + type: "pubkey"; }, { - name: "monthlySpendingLimitMembers", - type: { - vec: "publicKey", - }, + name: "launchSignerPdaBump"; + type: "u8"; }, { - name: "secondsForLaunch", - type: "u32", + name: "launchUsdcVault"; + type: "pubkey"; }, { - name: "tokenName", - type: "string", + name: "launchTokenVault"; + type: "pubkey"; }, { - name: "tokenSymbol", - type: "string", + name: "performancePackageGrantee"; + type: "pubkey"; }, { - name: "tokenUri", - type: "string", + name: "performancePackageTokenAmount"; + type: "u64"; }, { - name: "performancePackageGrantee", - type: "publicKey", + name: "monthsUntilInsidersCanUnlock"; + type: "u8"; }, { - name: "performancePackageTokenAmount", - type: "u64", + name: "monthlySpendingLimitAmount"; + type: "u64"; }, { - name: "monthsUntilInsidersCanUnlock", - type: "u8", + name: "monthlySpendingLimitMembers"; + type: { + vec: "pubkey"; + }; }, { - name: "teamAddress", - type: "publicKey", + name: "baseMint"; + type: "pubkey"; }, { - name: "additionalTokensAmount", - type: "u64", + name: "quoteMint"; + type: "pubkey"; }, { - name: "accumulatorActivationDelaySeconds", - type: "u32", + name: "pdaBump"; + type: "u8"; }, { - name: "hasBidWall", - type: "bool", + name: "secondsForLaunch"; + type: "u32"; }, - ], - }, - }, - { - name: "LaunchState", - type: { - kind: "enum", - variants: [ { - name: "Initialized", + name: "additionalTokensAmount"; + type: "u64"; }, { - name: "Live", + name: "additionalTokensRecipient"; + type: { + option: "pubkey"; + }; }, { - name: "Closed", + name: "accumulatorActivationDelaySeconds"; + type: "u32"; }, { - name: "Complete", + name: "hasBidWall"; + type: "bool"; }, { - name: "Refunding", + name: "mintGovernor"; + type: "pubkey"; }, - ], - }, + ]; + }; }, - ], - 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", + name: "launchRefundedEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, - 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: "additionalTokensAmount", - type: "u64", - index: false, - }, - { - name: "additionalTokensRecipient", - type: { - option: "publicKey", + { + name: "launch"; + type: "pubkey"; }, - index: false, - }, - { - name: "accumulatorActivationDelaySeconds", - type: "u32", - index: false, - }, - { - name: "hasBidWall", - type: "bool", - index: false, - }, - { - name: "mintGovernor", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "LaunchStartedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "funder"; + type: "pubkey"; }, - 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", + { + name: "usdcRefunded"; + type: "u64"; }, - 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: "committedAmountAccumulator", - type: "u128", - index: false, - }, - ], - }, - { - name: "FundingRecordApprovalSetEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "fundingRecord"; + type: "pubkey"; }, - 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: "LaunchSettledEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "launchSettledEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "finalState", - type: { - defined: "LaunchState", + { + name: "launch"; + type: "pubkey"; }, - index: false, - }, - { - name: "totalCommitted", - type: "u64", - index: false, - }, - { - name: "dao", - type: { - option: "publicKey", + { + name: "finalState"; + type: { + defined: { + name: "launchState"; + }; + }; }, - index: false, - }, - { - name: "daoTreasury", - type: { - option: "publicKey", + { + name: "totalCommitted"; + type: "u64"; }, - index: false, - }, - { - name: "totalApprovedAmount", - type: "u64", - index: false, - }, - { - name: "bidWall", - type: { - option: "publicKey", + { + name: "dao"; + type: { + option: "pubkey"; + }; }, - index: false, - }, - { - name: "bidWallAmount", - type: "u64", - index: false, - }, - { - name: "tokensMinted", - type: "u64", - index: false, - }, - ], - }, - { - name: "LaunchFinalizedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "daoTreasury"; + type: { + option: "pubkey"; + }; }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "performancePackage", - type: "publicKey", - index: false, - }, - { - name: "mintGovernor", - type: "publicKey", - index: false, - }, - { - name: "mintGovernorNewAdmin", - type: "publicKey", - index: false, - }, - { - name: "ppMintAuthority", - type: "publicKey", - index: false, - }, - { - name: "daoMintAuthority", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "LaunchRefundedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "totalApprovedAmount"; + type: "u64"; }, - 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", + { + name: "bidWall"; + type: { + option: "pubkey"; + }; }, - 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", + { + name: "bidWallAmount"; + type: "u64"; }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "newState", - type: { - defined: "LaunchState", + { + name: "tokensMinted"; + type: "u64"; }, - index: false, - }, - ], + ]; + }; }, { - name: "LaunchClaimAdditionalTokenAllocationEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "launchStartedEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "additionalTokensAmount", - type: "u64", - index: false, - }, - { - name: "additionalTokensRecipient", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "LaunchExtendedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "launch"; + type: "pubkey"; }, - index: false, - }, - { - name: "launch", - type: "publicKey", - index: false, - }, - { - name: "oldSecondsForLaunch", - type: "u32", - index: false, - }, - { - name: "newSecondsForLaunch", - type: "u32", - 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: "InvalidLaunchState", - msg: "Invalid launch state", - }, - { - code: 6005, - name: "LaunchPeriodNotOver", - msg: "Launch period not over", - }, - { - code: 6006, - name: "LaunchExpired", - msg: "Launch is complete, no more funding allowed", - }, - { - code: 6007, - name: "LaunchNotRefunding", - msg: "Refund not available", - }, - { - code: 6008, - name: "LaunchNotInitialized", - msg: "Launch must be initialized to be started", - }, - { - code: 6009, - name: "FreezeAuthoritySet", - msg: "Freeze authority can't be set on launchpad tokens", - }, - { - code: 6010, - name: "InvalidMonthlySpendingLimit", - msg: "Monthly spending limit must be less than 1/6th of the minimum raise amount and cannot be 0", - }, - { - code: 6011, - name: "InvalidMonthlySpendingLimitMembers", - msg: "There can only be at most 10 monthly spending limit members", - }, - { - code: 6012, - name: "InvalidPerformancePackageTokenAmount", - msg: "Invalid performance package token amount", - }, - { - code: 6013, - name: "InvalidPerformancePackageMinUnlockTime", - msg: "Insiders must wait at least 12 months before unlocking", - }, - { - code: 6014, - name: "LaunchAuthorityNotSet", - msg: "Launch authority must be set to complete the launch until 2 days after closing", - }, - { - code: 6015, - name: "FinalRaiseAmountTooLow", - msg: "The final amount raised must be >= the minimum raise amount", - }, - { - code: 6016, - name: "TokensAlreadyClaimed", - msg: "Tokens already claimed", - }, - { - code: 6017, - name: "MoneyAlreadyRefunded", - msg: "USDC already refunded", - }, - { - code: 6018, - name: "InvariantViolated", - msg: "Invariant violated", - }, - { - code: 6019, - name: "LaunchNotLive", - msg: "Launch must be live to be closed", - }, - { - code: 6020, - name: "InvalidMinimumRaiseAmount", - msg: "Minimum raise amount too low for liquidity", - }, - { - code: 6021, - name: "FinalRaiseAmountAlreadySet", - msg: "Final raise amount already set", - }, - { - code: 6022, - name: "TotalApprovedAmountTooLow", - msg: "Total approved amount too low", - }, - { - code: 6023, - name: "InvalidAdditionalTokensRecipient", - msg: "Additional tokens recipient must be set when amount > 0", - }, - { - code: 6024, - name: "NoAdditionalTokensRecipientSet", - msg: "No additional tokens recipient set", - }, - { - code: 6025, - name: "AdditionalTokensAlreadyClaimed", - msg: "Additional tokens already claimed", - }, - { - code: 6026, - name: "FundingRecordApprovalPeriodOver", - msg: "Funding record approval period is over", - }, - { - code: 6027, - name: "PerformancePackageAlreadyInitialized", - msg: "Performance package already initialized", - }, - { - code: 6028, - name: "InvalidDao", - msg: "Invalid DAO", - }, - { - code: 6029, - name: "InvalidAccumulatorActivationDelaySeconds", - msg: "Accumulator activation delay must be less than the launch duration", - }, - { - code: 6030, - name: "ExtendDurationExceedsMax", - msg: "Extend duration would exceed maximum allowed launch duration", + { + name: "launchAuthority"; + type: "pubkey"; + }, + { + name: "slotStarted"; + type: "u64"; + }, + ]; + }; }, { - code: 6031, - name: "InvalidMintAuthority", - msg: "Mint authority does not match expected", + name: "launchState"; + type: { + kind: "enum"; + variants: [ + { + name: "initialized"; + }, + { + name: "live"; + }, + { + name: "closed"; + }, + { + name: "complete"; + }, + { + name: "refunding"; + }, + ]; + }; }, { - code: 6032, - name: "InvalidMeteoraAccount", - msg: "Invalid Meteora account", + name: "mintGovernor"; + type: { + kind: "struct"; + fields: [ + { + name: "mint"; + type: "pubkey"; + }, + { + name: "admin"; + type: "pubkey"; + }, + { + name: "createKey"; + type: "pubkey"; + }, + { + name: "seqNum"; + type: "u64"; + }, + { + name: "bump"; + type: "u8"; + }, + ]; + }; }, - ], + ]; }; diff --git a/sdk/src/liquidation/v0.7/LiquidationClient.ts b/sdk/src/liquidation/v0.7/LiquidationClient.ts index 68f1c5db7..d8f8dc0f6 100644 --- a/sdk/src/liquidation/v0.7/LiquidationClient.ts +++ b/sdk/src/liquidation/v0.7/LiquidationClient.ts @@ -1,4 +1,4 @@ -import { AnchorProvider, Program } from "@coral-xyz/anchor"; +import { AnchorProvider, Program } from "@anchor-lang/core"; import BN from "bn.js"; import { AccountInfo, PublicKey, SystemProgram } from "@solana/web3.js"; import { @@ -30,8 +30,7 @@ export class LiquidationClient { this.provider = provider; this.programId = liquidationProgramId; this.liquidationProgram = new Program( - LiquidationIDL, - liquidationProgramId, + { ...LiquidationIDL, address: liquidationProgramId.toBase58() }, provider, ); } @@ -133,7 +132,7 @@ export class LiquidationClient { return this.liquidationProgram.methods .initializeLiquidation({ durationSeconds }) - .accounts({ + .accountsPartial({ payer, createKey, recordAuthority, @@ -170,7 +169,7 @@ export class LiquidationClient { return this.liquidationProgram.methods .setRefundRecord({ baseAssigned, quoteRefundable }) - .accounts({ + .accountsPartial({ payer, recordAuthority, liquidation, @@ -201,15 +200,17 @@ export class LiquidationClient { liquidationAuthorityQuoteAccount ?? getAssociatedTokenAddressSync(quoteMint, liquidationAuthority, true); - return this.liquidationProgram.methods.activateLiquidation().accounts({ - liquidationAuthority, - liquidation, - liquidationAuthorityQuoteAccount: - resolvedLiquidationAuthorityQuoteAccount, - liquidationQuoteVault, - quoteMint, - tokenProgram: TOKEN_PROGRAM_ID, - }); + return this.liquidationProgram.methods + .activateLiquidation() + .accountsPartial({ + liquidationAuthority, + liquidation, + liquidationAuthorityQuoteAccount: + resolvedLiquidationAuthorityQuoteAccount, + liquidationQuoteVault, + quoteMint, + tokenProgram: TOKEN_PROGRAM_ID, + }); } refundIx({ @@ -246,7 +247,7 @@ export class LiquidationClient { true, ); - return this.liquidationProgram.methods.refund().accounts({ + return this.liquidationProgram.methods.refund().accountsPartial({ recipient, liquidation, refundRecord, @@ -282,15 +283,17 @@ export class LiquidationClient { liquidationAuthorityQuoteAccount ?? getAssociatedTokenAddressSync(quoteMint, liquidationAuthority, true); - return this.liquidationProgram.methods.withdrawRemainingQuote().accounts({ - liquidationAuthority, - liquidation, - liquidationQuoteVault, - liquidationAuthorityQuoteAccount: - resolvedLiquidationAuthorityQuoteAccount, - quoteMint, - tokenProgram: TOKEN_PROGRAM_ID, - }); + return this.liquidationProgram.methods + .withdrawRemainingQuote() + .accountsPartial({ + liquidationAuthority, + liquidation, + liquidationQuoteVault, + liquidationAuthorityQuoteAccount: + resolvedLiquidationAuthorityQuoteAccount, + quoteMint, + tokenProgram: TOKEN_PROGRAM_ID, + }); } async getRefundRecord({ diff --git a/sdk/src/liquidation/v0.7/types/index.ts b/sdk/src/liquidation/v0.7/types/index.ts index 65cd7e412..72d7501b7 100644 --- a/sdk/src/liquidation/v0.7/types/index.ts +++ b/sdk/src/liquidation/v0.7/types/index.ts @@ -1,11 +1,9 @@ -import { IdlAccounts } from "@coral-xyz/anchor"; +import { IdlAccounts } from "@anchor-lang/core"; -import { - Liquidation as LiquidationProgram, - IDL as LiquidationIDL, -} from "./liquidation.js"; - -export { LiquidationProgram, LiquidationIDL }; +import type { Liquidation as LiquidationProgram } from "./liquidation.js"; +import liquidationIdl from "./liquidation.json" with { type: "json" }; +export type { LiquidationProgram }; +export const LiquidationIDL = liquidationIdl as LiquidationProgram; export type LiquidationAccount = IdlAccounts["liquidation"]; export type RefundRecordAccount = diff --git a/sdk/src/liquidation/v0.7/types/liquidation.json b/sdk/src/liquidation/v0.7/types/liquidation.json new file mode 100644 index 000000000..a0b05151e --- /dev/null +++ b/sdk/src/liquidation/v0.7/types/liquidation.json @@ -0,0 +1,1576 @@ +{ + "address": "LiQnowFbFQdYyZhF4pUbpsrZCjxRTQ1upKJxZ2VXjde", + "metadata": { + "name": "liquidation", + "version": "0.1.0", + "spec": "0.1.0", + "description": "Manages the orderly liquidation of a project's treasury back to token holders." + }, + "instructions": [ + { + "name": "activate_liquidation", + "discriminator": [ + 142, + 154, + 220, + 96, + 71, + 12, + 193, + 18 + ], + "accounts": [ + { + "name": "liquidation_authority", + "signer": true, + "relations": [ + "liquidation" + ] + }, + { + "name": "liquidation", + "writable": true + }, + { + "name": "liquidation_authority_quote_account", + "writable": true + }, + { + "name": "liquidation_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "liquidation" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "quote_mint", + "relations": [ + "liquidation" + ] + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "initialize_liquidation", + "discriminator": [ + 176, + 137, + 148, + 128, + 141, + 254, + 91, + 255 + ], + "accounts": [ + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "create_key", + "signer": true + }, + { + "name": "record_authority" + }, + { + "name": "liquidation_authority" + }, + { + "name": "base_mint" + }, + { + "name": "quote_mint" + }, + { + "name": "liquidation", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 108, + 105, + 113, + 117, + 105, + 100, + 97, + 116, + 105, + 111, + 110 + ] + }, + { + "kind": "account", + "path": "base_mint" + }, + { + "kind": "account", + "path": "quote_mint" + }, + { + "kind": "account", + "path": "create_key" + } + ] + } + }, + { + "name": "liquidation_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "liquidation" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "InitializeLiquidationArgs" + } + } + } + ] + }, + { + "name": "refund", + "discriminator": [ + 2, + 96, + 183, + 251, + 63, + 208, + 46, + 46 + ], + "accounts": [ + { + "name": "recipient", + "writable": true, + "signer": true, + "relations": [ + "refund_record" + ] + }, + { + "name": "liquidation", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 108, + 105, + 113, + 117, + 105, + 100, + 97, + 116, + 105, + 111, + 110 + ] + }, + { + "kind": "account", + "path": "base_mint" + }, + { + "kind": "account", + "path": "quote_mint" + }, + { + "kind": "account", + "path": "liquidation.create_key", + "account": "Liquidation" + } + ] + }, + "relations": [ + "refund_record" + ] + }, + { + "name": "refund_record", + "writable": true + }, + { + "name": "recipient_base_account", + "writable": true + }, + { + "name": "liquidation_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "liquidation" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "recipient_quote_account", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "recipient" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "base_mint", + "writable": true, + "relations": [ + "liquidation" + ] + }, + { + "name": "quote_mint", + "relations": [ + "liquidation" + ] + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "set_refund_record", + "discriminator": [ + 179, + 197, + 210, + 86, + 84, + 87, + 43, + 16 + ], + "accounts": [ + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "record_authority", + "signer": true + }, + { + "name": "liquidation", + "writable": true + }, + { + "name": "recipient" + }, + { + "name": "refund_record", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 114, + 101, + 102, + 117, + 110, + 100, + 95, + 114, + 101, + 99, + 111, + 114, + 100 + ] + }, + { + "kind": "account", + "path": "liquidation" + }, + { + "kind": "account", + "path": "recipient" + } + ] + } + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "SetRefundRecordArgs" + } + } + } + ] + }, + { + "name": "withdraw_remaining_quote", + "discriminator": [ + 54, + 253, + 188, + 34, + 100, + 145, + 59, + 127 + ], + "accounts": [ + { + "name": "liquidation_authority", + "signer": true, + "relations": [ + "liquidation" + ] + }, + { + "name": "liquidation", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 108, + 105, + 113, + 117, + 105, + 100, + 97, + 116, + 105, + 111, + 110 + ] + }, + { + "kind": "account", + "path": "liquidation.base_mint", + "account": "Liquidation" + }, + { + "kind": "account", + "path": "quote_mint" + }, + { + "kind": "account", + "path": "liquidation.create_key", + "account": "Liquidation" + } + ] + } + }, + { + "name": "liquidation_quote_vault", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "liquidation" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "liquidation_authority_quote_account", + "writable": true + }, + { + "name": "quote_mint", + "relations": [ + "liquidation" + ] + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + } + ], + "accounts": [ + { + "name": "Liquidation", + "discriminator": [ + 47, + 86, + 219, + 172, + 131, + 174, + 18, + 227 + ] + }, + { + "name": "RefundRecord", + "discriminator": [ + 101, + 159, + 85, + 113, + 48, + 38, + 7, + 215 + ] + } + ], + "events": [ + { + "name": "LiquidationActivatedEvent", + "discriminator": [ + 156, + 171, + 134, + 76, + 106, + 29, + 65, + 180 + ] + }, + { + "name": "LiquidationCreatedEvent", + "discriminator": [ + 5, + 223, + 88, + 192, + 206, + 170, + 143, + 203 + ] + }, + { + "name": "RefundEvent", + "discriminator": [ + 176, + 159, + 218, + 59, + 94, + 213, + 129, + 218 + ] + }, + { + "name": "RefundRecordSetEvent", + "discriminator": [ + 8, + 130, + 38, + 95, + 71, + 11, + 27, + 213 + ] + }, + { + "name": "WithdrawRemainingQuoteEvent", + "discriminator": [ + 89, + 109, + 106, + 25, + 96, + 35, + 166, + 12 + ] + } + ], + "errors": [ + { + "code": 6000, + "name": "RefundingNotEnabled", + "msg": "Refunding is not enabled" + }, + { + "code": 6001, + "name": "AlreadyActivated", + "msg": "Liquidation is already activated" + }, + { + "code": 6002, + "name": "NothingToFund", + "msg": "No quote tokens to fund" + }, + { + "code": 6003, + "name": "NoBaseAssigned", + "msg": "No base tokens assigned" + }, + { + "code": 6004, + "name": "RefundWindowExpired", + "msg": "Refund window has expired" + }, + { + "code": 6005, + "name": "RefundWindowNotExpired", + "msg": "Refund window has not expired" + }, + { + "code": 6006, + "name": "InvalidDuration", + "msg": "Duration must be greater than zero" + }, + { + "code": 6007, + "name": "NothingToRefund", + "msg": "Nothing to refund" + }, + { + "code": 6008, + "name": "InvalidAllocation", + "msg": "Invalid allocation" + }, + { + "code": 6009, + "name": "InvalidAuthority", + "msg": "Invalid authority" + }, + { + "code": 6010, + "name": "InvalidMint", + "msg": "Invalid mint" + } + ], + "types": [ + { + "name": "CommonFields", + "type": { + "kind": "struct", + "fields": [ + { + "name": "slot", + "type": "u64" + }, + { + "name": "unix_timestamp", + "type": "i64" + }, + { + "name": "liquidation_seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "InitializeLiquidationArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "duration_seconds", + "type": "u32" + } + ] + } + }, + { + "name": "Liquidation", + "type": { + "kind": "struct", + "fields": [ + { + "name": "create_key", + "docs": [ + "Arbitrary keypair used to make the PDA unique." + ], + "type": "pubkey" + }, + { + "name": "record_authority", + "docs": [ + "The address that can create and modify RefundRecords during setup." + ], + "type": "pubkey" + }, + { + "name": "liquidation_authority", + "docs": [ + "The address that activates the liquidation and receives remaining quote tokens post-deadline." + ], + "type": "pubkey" + }, + { + "name": "base_mint", + "docs": [ + "The project token mint (tokens to be burned)." + ], + "type": "pubkey" + }, + { + "name": "quote_mint", + "docs": [ + "The refund token mint (USDC)." + ], + "type": "pubkey" + }, + { + "name": "total_quote_refundable", + "docs": [ + "Sum of all RefundRecord quote_refundable values." + ], + "type": "u64" + }, + { + "name": "total_quote_refunded", + "docs": [ + "Sum of all quote tokens actually transferred to users so far." + ], + "type": "u64" + }, + { + "name": "total_base_assigned", + "docs": [ + "Sum of all RefundRecord base_assigned values." + ], + "type": "u64" + }, + { + "name": "total_base_burned", + "docs": [ + "Sum of all base tokens actually burned so far." + ], + "type": "u64" + }, + { + "name": "started_at", + "docs": [ + "Unix timestamp when ActivateLiquidation was called. 0 before activation." + ], + "type": "i64" + }, + { + "name": "duration_seconds", + "docs": [ + "How long the refund window lasts after activation." + ], + "type": "u32" + }, + { + "name": "seq_num", + "docs": [ + "Event sequence number for indexing." + ], + "type": "u64" + }, + { + "name": "is_refunding", + "docs": [ + "Whether refunds are currently enabled." + ], + "type": "bool" + }, + { + "name": "pda_bump", + "docs": [ + "PDA bump seed." + ], + "type": "u8" + } + ] + } + }, + { + "name": "LiquidationActivatedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "liquidation", + "type": "pubkey" + }, + { + "name": "total_quote_funded", + "type": "u64" + }, + { + "name": "started_at", + "type": "i64" + } + ] + } + }, + { + "name": "LiquidationCreatedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "liquidation", + "type": "pubkey" + }, + { + "name": "create_key", + "type": "pubkey" + }, + { + "name": "record_authority", + "type": "pubkey" + }, + { + "name": "liquidation_authority", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "duration_seconds", + "type": "u32" + }, + { + "name": "pda_bump", + "type": "u8" + } + ] + } + }, + { + "name": "RefundEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "liquidation", + "type": "pubkey" + }, + { + "name": "refund_record", + "type": "pubkey" + }, + { + "name": "recipient", + "type": "pubkey" + }, + { + "name": "base_burned", + "type": "u64" + }, + { + "name": "quote_refunded", + "type": "u64" + }, + { + "name": "post_record_base_burned", + "type": "u64" + }, + { + "name": "post_record_quote_refunded", + "type": "u64" + }, + { + "name": "post_liquidation_total_base_burned", + "type": "u64" + }, + { + "name": "post_liquidation_total_quote_refunded", + "type": "u64" + } + ] + } + }, + { + "name": "RefundRecord", + "type": { + "kind": "struct", + "fields": [ + { + "name": "liquidation", + "docs": [ + "The parent Liquidation account." + ], + "type": "pubkey" + }, + { + "name": "recipient", + "docs": [ + "The user this record belongs to." + ], + "type": "pubkey" + }, + { + "name": "base_assigned", + "docs": [ + "Total base tokens this user is eligible to burn." + ], + "type": "u64" + }, + { + "name": "base_burned", + "docs": [ + "Base tokens this user has burned so far." + ], + "type": "u64" + }, + { + "name": "quote_refundable", + "docs": [ + "Total quote tokens this user can receive if they burn all assigned base." + ], + "type": "u64" + }, + { + "name": "quote_refunded", + "docs": [ + "Quote tokens already transferred to this user." + ], + "type": "u64" + }, + { + "name": "pda_bump", + "docs": [ + "PDA bump seed." + ], + "type": "u8" + } + ] + } + }, + { + "name": "RefundRecordSetEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "liquidation", + "type": "pubkey" + }, + { + "name": "refund_record", + "type": "pubkey" + }, + { + "name": "recipient", + "type": "pubkey" + }, + { + "name": "base_assigned", + "type": "u64" + }, + { + "name": "quote_refundable", + "type": "u64" + }, + { + "name": "liquidation_total_base_assigned", + "type": "u64" + }, + { + "name": "liquidation_total_quote_refundable", + "type": "u64" + }, + { + "name": "pda_bump", + "type": "u8" + } + ] + } + }, + { + "name": "SetRefundRecordArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "base_assigned", + "type": "u64" + }, + { + "name": "quote_refundable", + "type": "u64" + } + ] + } + }, + { + "name": "WithdrawRemainingQuoteEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "liquidation", + "type": "pubkey" + }, + { + "name": "liquidation_authority", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/sdk/src/liquidation/v0.7/types/liquidation.ts b/sdk/src/liquidation/v0.7/types/liquidation.ts index a83a162cf..b77012a6e 100644 --- a/sdk/src/liquidation/v0.7/types/liquidation.ts +++ b/sdk/src/liquidation/v0.7/types/liquidation.ts @@ -1,303 +1,1040 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL can be found at `target/idl/liquidation.json`. + */ export type Liquidation = { - version: "0.1.0"; - name: "liquidation"; + address: "LiQnowFbFQdYyZhF4pUbpsrZCjxRTQ1upKJxZ2VXjde"; + metadata: { + name: "liquidation"; + version: "0.1.0"; + spec: "0.1.0"; + description: "Manages the orderly liquidation of a project's treasury back to token holders."; + }; instructions: [ + { + name: "activateLiquidation"; + discriminator: [142, 154, 220, 96, 71, 12, 193, 18]; + accounts: [ + { + name: "liquidationAuthority"; + signer: true; + relations: ["liquidation"]; + }, + { + name: "liquidation"; + writable: true; + }, + { + name: "liquidationAuthorityQuoteAccount"; + writable: true; + }, + { + name: "liquidationQuoteVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "liquidation"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; + }, + { + name: "quoteMint"; + relations: ["liquidation"]; + }, + { + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; + }, + { + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; + }, + { + name: "program"; + }, + ]; + args: []; + }, { name: "initializeLiquidation"; + discriminator: [176, 137, 148, 128, 141, 254, 91, 255]; accounts: [ { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "createKey"; - isMut: false; - isSigner: true; + signer: true; }, { name: "recordAuthority"; - isMut: false; - isSigner: false; }, { name: "liquidationAuthority"; - isMut: false; - isSigner: false; }, { name: "baseMint"; - isMut: false; - isSigner: false; }, { name: "quoteMint"; - isMut: false; - isSigner: false; }, { name: "liquidation"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [108, 105, 113, 117, 105, 100, 97, 116, 105, 111, 110]; + }, + { + kind: "account"; + path: "baseMint"; + }, + { + kind: "account"; + path: "quoteMint"; + }, + { + kind: "account"; + path: "createKey"; + }, + ]; + }; }, { name: "liquidationQuoteVault"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "liquidation"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "args"; type: { - defined: "InitializeLiquidationArgs"; + defined: { + name: "initializeLiquidationArgs"; + }; }; }, ]; }, { - name: "setRefundRecord"; + name: "refund"; + discriminator: [2, 96, 183, 251, 63, 208, 46, 46]; accounts: [ { - name: "payer"; - isMut: true; - isSigner: true; - }, - { - name: "recordAuthority"; - isMut: false; - isSigner: true; + name: "recipient"; + writable: true; + signer: true; + relations: ["refundRecord"]; }, { name: "liquidation"; - isMut: true; - isSigner: false; - }, - { - name: "recipient"; - isMut: false; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [108, 105, 113, 117, 105, 100, 97, 116, 105, 111, 110]; + }, + { + kind: "account"; + path: "baseMint"; + }, + { + kind: "account"; + path: "quoteMint"; + }, + { + kind: "account"; + path: "liquidation.create_key"; + account: "liquidation"; + }, + ]; + }; + relations: ["refundRecord"]; }, { name: "refundRecord"; - isMut: true; - isSigner: false; - }, - { - name: "systemProgram"; - isMut: false; - isSigner: false; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; + writable: true; }, { - name: "program"; - isMut: false; - isSigner: false; + name: "recipientBaseAccount"; + writable: true; }, - ]; - args: [ { - name: "args"; - type: { - defined: "SetRefundRecordArgs"; + name: "liquidationQuoteVault"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "liquidation"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; }; }, - ]; - }, - { - name: "activateLiquidation"; - accounts: [ { - name: "liquidationAuthority"; - isMut: false; - isSigner: true; + name: "recipientQuoteAccount"; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "recipient"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "liquidation"; - isMut: true; - isSigner: false; + name: "baseMint"; + writable: true; + relations: ["liquidation"]; }, { - name: "liquidationAuthorityQuoteAccount"; - isMut: true; - isSigner: false; + name: "quoteMint"; + relations: ["liquidation"]; }, { - name: "liquidationQuoteVault"; - isMut: true; - isSigner: false; + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { - name: "quoteMint"; - isMut: false; - isSigner: false; + name: "associatedTokenProgram"; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { - name: "refund"; + name: "setRefundRecord"; + discriminator: [179, 197, 210, 86, 84, 87, 43, 16]; accounts: [ { - name: "recipient"; - isMut: true; - isSigner: true; - }, - { - name: "liquidation"; - isMut: true; - isSigner: false; - }, - { - name: "refundRecord"; - isMut: true; - isSigner: false; - }, - { - name: "recipientBaseAccount"; - isMut: true; - isSigner: false; - }, - { - name: "liquidationQuoteVault"; - isMut: true; - isSigner: false; - }, - { - name: "recipientQuoteAccount"; - isMut: true; - isSigner: false; + name: "payer"; + writable: true; + signer: true; }, { - name: "baseMint"; - isMut: true; - isSigner: false; + name: "recordAuthority"; + signer: true; }, { - name: "quoteMint"; - isMut: false; - isSigner: false; + name: "liquidation"; + writable: true; }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + name: "recipient"; }, { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + name: "refundRecord"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 114, + 101, + 102, + 117, + 110, + 100, + 95, + 114, + 101, + 99, + 111, + 114, + 100, + ]; + }, + { + kind: "account"; + path: "liquidation"; + }, + { + kind: "account"; + path: "recipient"; + }, + ]; + }; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; - args: []; + args: [ + { + name: "args"; + type: { + defined: { + name: "setRefundRecordArgs"; + }; + }; + }, + ]; }, { name: "withdrawRemainingQuote"; + discriminator: [54, 253, 188, 34, 100, 145, 59, 127]; accounts: [ { name: "liquidationAuthority"; - isMut: false; - isSigner: true; + signer: true; + relations: ["liquidation"]; }, { name: "liquidation"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [108, 105, 113, 117, 105, 100, 97, 116, 105, 111, 110]; + }, + { + kind: "account"; + path: "liquidation.base_mint"; + account: "liquidation"; + }, + { + kind: "account"; + path: "quoteMint"; + }, + { + kind: "account"; + path: "liquidation.create_key"; + account: "liquidation"; + }, + ]; + }; }, { name: "liquidationQuoteVault"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "liquidation"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "liquidationAuthorityQuoteAccount"; - isMut: true; - isSigner: false; + writable: true; }, { name: "quoteMint"; - isMut: false; - isSigner: false; + relations: ["liquidation"]; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, ]; accounts: [ + { + name: "liquidation"; + discriminator: [47, 86, 219, 172, 131, 174, 18, 227]; + }, + { + name: "refundRecord"; + discriminator: [101, 159, 85, 113, 48, 38, 7, 215]; + }, + ]; + events: [ + { + name: "liquidationActivatedEvent"; + discriminator: [156, 171, 134, 76, 106, 29, 65, 180]; + }, + { + name: "liquidationCreatedEvent"; + discriminator: [5, 223, 88, 192, 206, 170, 143, 203]; + }, + { + name: "refundEvent"; + discriminator: [176, 159, 218, 59, 94, 213, 129, 218]; + }, + { + name: "refundRecordSetEvent"; + discriminator: [8, 130, 38, 95, 71, 11, 27, 213]; + }, + { + name: "withdrawRemainingQuoteEvent"; + discriminator: [89, 109, 106, 25, 96, 35, 166, 12]; + }, + ]; + errors: [ + { + code: 6000; + name: "refundingNotEnabled"; + msg: "Refunding is not enabled"; + }, + { + code: 6001; + name: "alreadyActivated"; + msg: "Liquidation is already activated"; + }, + { + code: 6002; + name: "nothingToFund"; + msg: "No quote tokens to fund"; + }, + { + code: 6003; + name: "noBaseAssigned"; + msg: "No base tokens assigned"; + }, + { + code: 6004; + name: "refundWindowExpired"; + msg: "Refund window has expired"; + }, + { + code: 6005; + name: "refundWindowNotExpired"; + msg: "Refund window has not expired"; + }, + { + code: 6006; + name: "invalidDuration"; + msg: "Duration must be greater than zero"; + }, + { + code: 6007; + name: "nothingToRefund"; + msg: "Nothing to refund"; + }, + { + code: 6008; + name: "invalidAllocation"; + msg: "Invalid allocation"; + }, + { + code: 6009; + name: "invalidAuthority"; + msg: "Invalid authority"; + }, + { + code: 6010; + name: "invalidMint"; + msg: "Invalid mint"; + }, + ]; + types: [ + { + name: "commonFields"; + type: { + kind: "struct"; + fields: [ + { + name: "slot"; + type: "u64"; + }, + { + name: "unixTimestamp"; + type: "i64"; + }, + { + name: "liquidationSeqNum"; + type: "u64"; + }, + ]; + }; + }, + { + name: "initializeLiquidationArgs"; + type: { + kind: "struct"; + fields: [ + { + name: "durationSeconds"; + type: "u32"; + }, + ]; + }; + }, { name: "liquidation"; type: { @@ -306,31 +1043,31 @@ export type Liquidation = { { name: "createKey"; docs: ["Arbitrary keypair used to make the PDA unique."]; - type: "publicKey"; + type: "pubkey"; }, { name: "recordAuthority"; docs: [ "The address that can create and modify RefundRecords during setup.", ]; - type: "publicKey"; + type: "pubkey"; }, { name: "liquidationAuthority"; docs: [ "The address that activates the liquidation and receives remaining quote tokens post-deadline.", ]; - type: "publicKey"; + type: "pubkey"; }, { name: "baseMint"; docs: ["The project token mint (tokens to be burned)."]; - type: "publicKey"; + type: "pubkey"; }, { name: "quoteMint"; docs: ["The refund token mint (USDC)."]; - type: "publicKey"; + type: "pubkey"; }, { name: "totalQuoteRefundable"; @@ -385,1131 +1122,269 @@ export type Liquidation = { }; }, { - name: "refundRecord"; + name: "liquidationActivatedEvent"; type: { kind: "struct"; fields: [ { - name: "liquidation"; - docs: ["The parent Liquidation account."]; - type: "publicKey"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "recipient"; - docs: ["The user this record belongs to."]; - type: "publicKey"; + name: "liquidation"; + type: "pubkey"; }, { - name: "baseAssigned"; - docs: ["Total base tokens this user is eligible to burn."]; + name: "totalQuoteFunded"; type: "u64"; }, { - name: "baseBurned"; - docs: ["Base tokens this user has burned so far."]; - type: "u64"; + name: "startedAt"; + type: "i64"; }, + ]; + }; + }, + { + name: "liquidationCreatedEvent"; + type: { + kind: "struct"; + fields: [ { - name: "quoteRefundable"; - docs: [ - "Total quote tokens this user can receive if they burn all assigned base.", - ]; - type: "u64"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "quoteRefunded"; - docs: ["Quote tokens already transferred to this user."]; - type: "u64"; - }, - { - name: "pdaBump"; - docs: ["PDA bump seed."]; - type: "u8"; - }, - ]; - }; - }, - ]; - types: [ - { - name: "CommonFields"; - type: { - kind: "struct"; - fields: [ - { - name: "slot"; - type: "u64"; - }, - { - name: "unixTimestamp"; - type: "i64"; - }, - { - name: "liquidationSeqNum"; - type: "u64"; - }, - ]; - }; - }, - { - name: "InitializeLiquidationArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "durationSeconds"; - type: "u32"; - }, - ]; - }; - }, - { - name: "SetRefundRecordArgs"; - type: { - kind: "struct"; - fields: [ - { - name: "baseAssigned"; - type: "u64"; - }, - { - name: "quoteRefundable"; - type: "u64"; - }, - ]; - }; - }, - ]; - events: [ - { - name: "LiquidationCreatedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "liquidation"; - type: "publicKey"; - index: false; - }, - { - name: "createKey"; - type: "publicKey"; - index: false; - }, - { - name: "recordAuthority"; - type: "publicKey"; - index: false; - }, - { - name: "liquidationAuthority"; - type: "publicKey"; - index: false; - }, - { - name: "baseMint"; - type: "publicKey"; - index: false; - }, - { - name: "quoteMint"; - type: "publicKey"; - index: false; - }, - { - name: "durationSeconds"; - type: "u32"; - index: false; - }, - { - name: "pdaBump"; - type: "u8"; - index: false; - }, - ]; - }, - { - name: "LiquidationActivatedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "liquidation"; - type: "publicKey"; - index: false; - }, - { - name: "totalQuoteFunded"; - type: "u64"; - index: false; - }, - { - name: "startedAt"; - type: "i64"; - index: false; - }, - ]; - }, - { - name: "RefundRecordSetEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "liquidation"; - type: "publicKey"; - index: false; - }, - { - name: "refundRecord"; - type: "publicKey"; - index: false; - }, - { - name: "recipient"; - type: "publicKey"; - index: false; - }, - { - name: "baseAssigned"; - type: "u64"; - index: false; - }, - { - name: "quoteRefundable"; - type: "u64"; - index: false; - }, - { - name: "liquidationTotalBaseAssigned"; - type: "u64"; - index: false; - }, - { - name: "liquidationTotalQuoteRefundable"; - type: "u64"; - index: false; - }, - { - name: "pdaBump"; - type: "u8"; - index: false; - }, - ]; - }, - { - name: "RefundEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "liquidation"; - type: "publicKey"; - index: false; - }, - { - name: "refundRecord"; - type: "publicKey"; - index: false; - }, - { - name: "recipient"; - type: "publicKey"; - index: false; - }, - { - name: "baseBurned"; - type: "u64"; - index: false; - }, - { - name: "quoteRefunded"; - type: "u64"; - index: false; - }, - { - name: "postRecordBaseBurned"; - type: "u64"; - index: false; - }, - { - name: "postRecordQuoteRefunded"; - type: "u64"; - index: false; - }, - { - name: "postLiquidationTotalBaseBurned"; - type: "u64"; - index: false; - }, - { - name: "postLiquidationTotalQuoteRefunded"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "WithdrawRemainingQuoteEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "liquidation"; - type: "publicKey"; - index: false; - }, - { - name: "liquidationAuthority"; - type: "publicKey"; - index: false; - }, - { - name: "amount"; - type: "u64"; - index: false; - }, - ]; - }, - ]; - errors: [ - { - code: 6000; - name: "RefundingNotEnabled"; - msg: "Refunding is not enabled"; - }, - { - code: 6001; - name: "AlreadyActivated"; - msg: "Liquidation is already activated"; - }, - { - code: 6002; - name: "NothingToFund"; - msg: "No quote tokens to fund"; - }, - { - code: 6003; - name: "NoBaseAssigned"; - msg: "No base tokens assigned"; - }, - { - code: 6004; - name: "RefundWindowExpired"; - msg: "Refund window has expired"; - }, - { - code: 6005; - name: "RefundWindowNotExpired"; - msg: "Refund window has not expired"; - }, - { - code: 6006; - name: "InvalidDuration"; - msg: "Duration must be greater than zero"; - }, - { - code: 6007; - name: "NothingToRefund"; - msg: "Nothing to refund"; - }, - { - code: 6008; - name: "InvalidAllocation"; - msg: "Invalid allocation"; - }, - { - code: 6009; - name: "InvalidAuthority"; - msg: "Invalid authority"; - }, - { - code: 6010; - name: "InvalidMint"; - msg: "Invalid mint"; - }, - ]; -}; - -export const IDL: Liquidation = { - version: "0.1.0", - name: "liquidation", - instructions: [ - { - name: "initializeLiquidation", - accounts: [ - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "createKey", - isMut: false, - isSigner: true, - }, - { - name: "recordAuthority", - isMut: false, - isSigner: false, - }, - { - name: "liquidationAuthority", - isMut: false, - isSigner: false, - }, - { - name: "baseMint", - isMut: false, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "liquidation", - isMut: true, - isSigner: false, - }, - { - name: "liquidationQuoteVault", - 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: [ - { - name: "args", - type: { - defined: "InitializeLiquidationArgs", - }, - }, - ], - }, - { - name: "setRefundRecord", - accounts: [ - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "recordAuthority", - isMut: false, - isSigner: true, - }, - { - name: "liquidation", - isMut: true, - isSigner: false, - }, - { - name: "recipient", - isMut: false, - isSigner: false, - }, - { - name: "refundRecord", - isMut: true, - 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: "SetRefundRecordArgs", - }, - }, - ], - }, - { - name: "activateLiquidation", - accounts: [ - { - name: "liquidationAuthority", - isMut: false, - isSigner: true, - }, - { - name: "liquidation", - isMut: true, - isSigner: false, - }, - { - name: "liquidationAuthorityQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "liquidationQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "refund", - accounts: [ - { - name: "recipient", - isMut: true, - isSigner: true, - }, - { - name: "liquidation", - isMut: true, - isSigner: false, - }, - { - name: "refundRecord", - isMut: true, - isSigner: false, - }, - { - name: "recipientBaseAccount", - isMut: true, - isSigner: false, - }, - { - name: "liquidationQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "recipientQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "baseMint", - isMut: true, - 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: "withdrawRemainingQuote", - accounts: [ - { - name: "liquidationAuthority", - isMut: false, - isSigner: true, - }, - { - name: "liquidation", - isMut: true, - isSigner: false, - }, - { - name: "liquidationQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "liquidationAuthorityQuoteAccount", - isMut: true, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "liquidation", - type: { - kind: "struct", - fields: [ + name: "liquidation"; + type: "pubkey"; + }, { - name: "createKey", - docs: ["Arbitrary keypair used to make the PDA unique."], - type: "publicKey", + name: "createKey"; + type: "pubkey"; }, { - name: "recordAuthority", - docs: [ - "The address that can create and modify RefundRecords during setup.", - ], - type: "publicKey", + name: "recordAuthority"; + type: "pubkey"; }, { - name: "liquidationAuthority", - docs: [ - "The address that activates the liquidation and receives remaining quote tokens post-deadline.", - ], - type: "publicKey", + name: "liquidationAuthority"; + type: "pubkey"; }, { - name: "baseMint", - docs: ["The project token mint (tokens to be burned)."], - type: "publicKey", + name: "baseMint"; + type: "pubkey"; }, { - name: "quoteMint", - docs: ["The refund token mint (USDC)."], - type: "publicKey", + name: "quoteMint"; + type: "pubkey"; }, { - name: "totalQuoteRefundable", - docs: ["Sum of all RefundRecord quote_refundable values."], - type: "u64", + name: "durationSeconds"; + type: "u32"; }, { - name: "totalQuoteRefunded", - docs: [ - "Sum of all quote tokens actually transferred to users so far.", - ], - type: "u64", + name: "pdaBump"; + type: "u8"; + }, + ]; + }; + }, + { + name: "refundEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "totalBaseAssigned", - docs: ["Sum of all RefundRecord base_assigned values."], - type: "u64", + name: "liquidation"; + type: "pubkey"; }, { - name: "totalBaseBurned", - docs: ["Sum of all base tokens actually burned so far."], - type: "u64", + name: "refundRecord"; + type: "pubkey"; }, { - name: "startedAt", - docs: [ - "Unix timestamp when ActivateLiquidation was called. 0 before activation.", - ], - type: "i64", + name: "recipient"; + type: "pubkey"; + }, + { + name: "baseBurned"; + type: "u64"; + }, + { + name: "quoteRefunded"; + type: "u64"; }, { - name: "durationSeconds", - docs: ["How long the refund window lasts after activation."], - type: "u32", + name: "postRecordBaseBurned"; + type: "u64"; }, { - name: "seqNum", - docs: ["Event sequence number for indexing."], - type: "u64", + name: "postRecordQuoteRefunded"; + type: "u64"; }, { - name: "isRefunding", - docs: ["Whether refunds are currently enabled."], - type: "bool", + name: "postLiquidationTotalBaseBurned"; + type: "u64"; }, { - name: "pdaBump", - docs: ["PDA bump seed."], - type: "u8", + name: "postLiquidationTotalQuoteRefunded"; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "refundRecord", + name: "refundRecord"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "liquidation", - docs: ["The parent Liquidation account."], - type: "publicKey", + name: "liquidation"; + docs: ["The parent Liquidation account."]; + type: "pubkey"; }, { - name: "recipient", - docs: ["The user this record belongs to."], - type: "publicKey", + name: "recipient"; + docs: ["The user this record belongs to."]; + type: "pubkey"; }, { - name: "baseAssigned", - docs: ["Total base tokens this user is eligible to burn."], - type: "u64", + name: "baseAssigned"; + docs: ["Total base tokens this user is eligible to burn."]; + type: "u64"; }, { - name: "baseBurned", - docs: ["Base tokens this user has burned so far."], - type: "u64", + name: "baseBurned"; + docs: ["Base tokens this user has burned so far."]; + type: "u64"; }, { - name: "quoteRefundable", + name: "quoteRefundable"; docs: [ "Total quote tokens this user can receive if they burn all assigned base.", - ], - type: "u64", + ]; + type: "u64"; }, { - name: "quoteRefunded", - docs: ["Quote tokens already transferred to this user."], - type: "u64", + name: "quoteRefunded"; + docs: ["Quote tokens already transferred to this user."]; + type: "u64"; }, { - name: "pdaBump", - docs: ["PDA bump seed."], - type: "u8", + name: "pdaBump"; + docs: ["PDA bump seed."]; + type: "u8"; }, - ], - }, + ]; + }; }, - ], - types: [ { - name: "CommonFields", + name: "refundRecordSetEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "slot", - type: "u64", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "unixTimestamp", - type: "i64", + name: "liquidation"; + type: "pubkey"; }, { - name: "liquidationSeqNum", - type: "u64", + name: "refundRecord"; + type: "pubkey"; + }, + { + name: "recipient"; + type: "pubkey"; + }, + { + name: "baseAssigned"; + type: "u64"; }, - ], - }, - }, - { - name: "InitializeLiquidationArgs", - type: { - kind: "struct", - fields: [ { - name: "durationSeconds", - type: "u32", + name: "quoteRefundable"; + type: "u64"; + }, + { + name: "liquidationTotalBaseAssigned"; + type: "u64"; + }, + { + name: "liquidationTotalQuoteRefundable"; + type: "u64"; }, - ], - }, + { + name: "pdaBump"; + type: "u8"; + }, + ]; + }; }, { - name: "SetRefundRecordArgs", + name: "setRefundRecordArgs"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "baseAssigned", - type: "u64", + name: "baseAssigned"; + type: "u64"; }, { - name: "quoteRefundable", - type: "u64", - }, - ], - }, - }, - ], - events: [ - { - name: "LiquidationCreatedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "quoteRefundable"; + type: "u64"; }, - index: false, - }, - { - name: "liquidation", - type: "publicKey", - index: false, - }, - { - name: "createKey", - type: "publicKey", - index: false, - }, - { - name: "recordAuthority", - type: "publicKey", - index: false, - }, - { - name: "liquidationAuthority", - type: "publicKey", - index: false, - }, - { - name: "baseMint", - type: "publicKey", - index: false, - }, - { - name: "quoteMint", - type: "publicKey", - index: false, - }, - { - name: "durationSeconds", - type: "u32", - index: false, - }, - { - name: "pdaBump", - type: "u8", - index: false, - }, - ], + ]; + }; }, { - name: "LiquidationActivatedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "withdrawRemainingQuoteEvent"; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, - index: false, - }, - { - name: "liquidation", - type: "publicKey", - index: false, - }, - { - name: "totalQuoteFunded", - type: "u64", - index: false, - }, - { - name: "startedAt", - type: "i64", - index: false, - }, - ], - }, - { - name: "RefundRecordSetEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "liquidation"; + type: "pubkey"; }, - index: false, - }, - { - name: "liquidation", - type: "publicKey", - index: false, - }, - { - name: "refundRecord", - type: "publicKey", - index: false, - }, - { - name: "recipient", - type: "publicKey", - index: false, - }, - { - name: "baseAssigned", - type: "u64", - index: false, - }, - { - name: "quoteRefundable", - type: "u64", - index: false, - }, - { - name: "liquidationTotalBaseAssigned", - type: "u64", - index: false, - }, - { - name: "liquidationTotalQuoteRefundable", - type: "u64", - index: false, - }, - { - name: "pdaBump", - type: "u8", - index: false, - }, - ], - }, - { - name: "RefundEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "liquidationAuthority"; + type: "pubkey"; }, - index: false, - }, - { - name: "liquidation", - type: "publicKey", - index: false, - }, - { - name: "refundRecord", - type: "publicKey", - index: false, - }, - { - name: "recipient", - type: "publicKey", - index: false, - }, - { - name: "baseBurned", - type: "u64", - index: false, - }, - { - name: "quoteRefunded", - type: "u64", - index: false, - }, - { - name: "postRecordBaseBurned", - type: "u64", - index: false, - }, - { - name: "postRecordQuoteRefunded", - type: "u64", - index: false, - }, - { - name: "postLiquidationTotalBaseBurned", - type: "u64", - index: false, - }, - { - name: "postLiquidationTotalQuoteRefunded", - type: "u64", - index: false, - }, - ], - }, - { - name: "WithdrawRemainingQuoteEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "amount"; + type: "u64"; }, - index: false, - }, - { - name: "liquidation", - type: "publicKey", - index: false, - }, - { - name: "liquidationAuthority", - type: "publicKey", - index: false, - }, - { - name: "amount", - type: "u64", - index: false, - }, - ], - }, - ], - errors: [ - { - code: 6000, - name: "RefundingNotEnabled", - msg: "Refunding is not enabled", - }, - { - code: 6001, - name: "AlreadyActivated", - msg: "Liquidation is already activated", - }, - { - code: 6002, - name: "NothingToFund", - msg: "No quote tokens to fund", - }, - { - code: 6003, - name: "NoBaseAssigned", - msg: "No base tokens assigned", - }, - { - code: 6004, - name: "RefundWindowExpired", - msg: "Refund window has expired", - }, - { - code: 6005, - name: "RefundWindowNotExpired", - msg: "Refund window has not expired", - }, - { - code: 6006, - name: "InvalidDuration", - msg: "Duration must be greater than zero", - }, - { - code: 6007, - name: "NothingToRefund", - msg: "Nothing to refund", - }, - { - code: 6008, - name: "InvalidAllocation", - msg: "Invalid allocation", - }, - { - code: 6009, - name: "InvalidAuthority", - msg: "Invalid authority", - }, - { - code: 6010, - name: "InvalidMint", - msg: "Invalid mint", + ]; + }; }, - ], + ]; }; diff --git a/sdk/src/mint_governor/v0.7/MintGovernorClient.ts b/sdk/src/mint_governor/v0.7/MintGovernorClient.ts index 78f070135..e6e204a02 100644 --- a/sdk/src/mint_governor/v0.7/MintGovernorClient.ts +++ b/sdk/src/mint_governor/v0.7/MintGovernorClient.ts @@ -1,13 +1,10 @@ -import { AnchorProvider, Program } from "@coral-xyz/anchor"; +import { AnchorProvider, Program } from "@anchor-lang/core"; import { AccountInfo, PublicKey } from "@solana/web3.js"; import { TOKEN_PROGRAM_ID } from "@solana/spl-token"; 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, - IDL as MintGovernorIDL, -} from "./types/mint_governor.js"; +import { MintGovernorProgram, MintGovernorIDL } from "./types/index.js"; import type { MintGovernorAccount, MintAuthorityAccount, @@ -27,8 +24,7 @@ export class MintGovernorClient { this.provider = provider; this.programId = programId; this.program = new Program( - MintGovernorIDL, - programId, + { ...MintGovernorIDL, address: programId.toBase58() }, provider, ); } @@ -87,7 +83,7 @@ export class MintGovernorClient { createKey, }); - return this.program.methods.initializeMintGovernor().accounts({ + return this.program.methods.initializeMintGovernor().accountsPartial({ mint, mintGovernor, createKey, @@ -107,7 +103,7 @@ export class MintGovernorClient { currentAuthority: PublicKey; tokenProgram?: PublicKey; }) { - return this.program.methods.transferAuthorityToGovernor().accounts({ + return this.program.methods.transferAuthorityToGovernor().accountsPartial({ mintGovernor, mint, currentAuthority, @@ -134,7 +130,7 @@ export class MintGovernorClient { authorizedMinter, }); - return this.program.methods.addMintAuthority({ maxTotal }).accounts({ + return this.program.methods.addMintAuthority({ maxTotal }).accountsPartial({ mintGovernor, mintAuthority, admin, @@ -154,11 +150,13 @@ export class MintGovernorClient { admin: PublicKey; maxTotal: BN | null; }) { - return this.program.methods.updateMintAuthority({ maxTotal }).accounts({ - mintGovernor, - mintAuthority, - admin, - }); + return this.program.methods + .updateMintAuthority({ maxTotal }) + .accountsPartial({ + mintGovernor, + mintAuthority, + admin, + }); } removeMintAuthorityIx({ @@ -172,7 +170,7 @@ export class MintGovernorClient { admin: PublicKey; rentDestination: PublicKey; }) { - return this.program.methods.removeMintAuthority().accounts({ + return this.program.methods.removeMintAuthority().accountsPartial({ mintGovernor, mintAuthority, admin, @@ -201,7 +199,7 @@ export class MintGovernorClient { authorizedMinter, }); - return this.program.methods.mintTokens({ amount }).accounts({ + return this.program.methods.mintTokens({ amount }).accountsPartial({ mintGovernor, mintAuthority, mint, @@ -220,7 +218,7 @@ export class MintGovernorClient { admin: PublicKey; newAdmin: PublicKey; }) { - return this.program.methods.updateMintGovernorAdmin().accounts({ + return this.program.methods.updateMintGovernorAdmin().accountsPartial({ mintGovernor, admin, newAdmin, @@ -240,7 +238,7 @@ export class MintGovernorClient { newAuthority: PublicKey; tokenProgram?: PublicKey; }) { - return this.program.methods.reclaimAuthority().accounts({ + return this.program.methods.reclaimAuthority().accountsPartial({ mintGovernor, mint, admin, diff --git a/sdk/src/mint_governor/v0.7/types/index.ts b/sdk/src/mint_governor/v0.7/types/index.ts index ce730c722..a763f2449 100644 --- a/sdk/src/mint_governor/v0.7/types/index.ts +++ b/sdk/src/mint_governor/v0.7/types/index.ts @@ -1,9 +1,8 @@ -import { IdlAccounts, IdlEvents } from "@coral-xyz/anchor"; -import { - MintGovernor as MintGovernorProgram, - IDL as MintGovernorIDL, -} from "./mint_governor.js"; -export { MintGovernorProgram, MintGovernorIDL }; +import { IdlAccounts, IdlEvents } from "@anchor-lang/core"; +import type { MintGovernor as MintGovernorProgram } from "./mint_governor.js"; +import mintGovernorIdl from "./mint_governor.json" with { type: "json" }; +export type { MintGovernorProgram }; +export const MintGovernorIDL = mintGovernorIdl as MintGovernorProgram; export type MintGovernorAccount = IdlAccounts["mintGovernor"]; @@ -11,21 +10,21 @@ export type MintAuthorityAccount = IdlAccounts["mintAuthority"]; export type MintGovernorInitializedEvent = - IdlEvents["MintGovernorInitializedEvent"]; + IdlEvents["mintGovernorInitializedEvent"]; export type MintAuthorityTransferredEvent = - IdlEvents["MintAuthorityTransferredEvent"]; + IdlEvents["mintAuthorityTransferredEvent"]; export type MintAuthorityAddedEvent = - IdlEvents["MintAuthorityAddedEvent"]; + IdlEvents["mintAuthorityAddedEvent"]; export type TokensMintedEvent = - IdlEvents["TokensMintedEvent"]; + IdlEvents["tokensMintedEvent"]; export type MintAuthorityUpdatedEvent = - IdlEvents["MintAuthorityUpdatedEvent"]; + IdlEvents["mintAuthorityUpdatedEvent"]; export type MintAuthorityRemovedEvent = - IdlEvents["MintAuthorityRemovedEvent"]; + IdlEvents["mintAuthorityRemovedEvent"]; export type MintGovernorAdminUpdatedEvent = - IdlEvents["MintGovernorAdminUpdatedEvent"]; + IdlEvents["mintGovernorAdminUpdatedEvent"]; export type MintAuthorityReclaimedEvent = - IdlEvents["MintAuthorityReclaimedEvent"]; + IdlEvents["mintAuthorityReclaimedEvent"]; export type MintGovernorEvent = | MintGovernorInitializedEvent | MintAuthorityTransferredEvent diff --git a/sdk/src/mint_governor/v0.7/types/mint_governor.json b/sdk/src/mint_governor/v0.7/types/mint_governor.json new file mode 100644 index 000000000..c377ecf4f --- /dev/null +++ b/sdk/src/mint_governor/v0.7/types/mint_governor.json @@ -0,0 +1,1188 @@ +{ + "address": "gvnr27cVeyW3AVf3acL7VCJ5WjGAphytnsgcK1feHyH", + "metadata": { + "name": "mint_governor", + "version": "0.7.0", + "spec": "0.1.0", + "description": "Created with Anchor" + }, + "instructions": [ + { + "name": "add_mint_authority", + "discriminator": [ + 41, + 254, + 251, + 123, + 155, + 68, + 213, + 8 + ], + "accounts": [ + { + "name": "mint_governor", + "writable": true + }, + { + "name": "mint_authority", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 105, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + }, + { + "kind": "account", + "path": "mint_governor" + }, + { + "kind": "account", + "path": "authorized_minter" + } + ] + } + }, + { + "name": "admin", + "signer": true + }, + { + "name": "authorized_minter" + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "AddMintAuthorityArgs" + } + } + } + ] + }, + { + "name": "initialize_mint_governor", + "discriminator": [ + 198, + 71, + 122, + 52, + 99, + 36, + 35, + 197 + ], + "accounts": [ + { + "name": "mint" + }, + { + "name": "mint_governor", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 109, + 105, + 110, + 116, + 95, + 103, + 111, + 118, + 101, + 114, + 110, + 111, + 114 + ] + }, + { + "kind": "account", + "path": "mint" + }, + { + "kind": "account", + "path": "create_key" + } + ] + } + }, + { + "name": "create_key", + "signer": true + }, + { + "name": "admin" + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "mint_tokens", + "discriminator": [ + 59, + 132, + 24, + 246, + 122, + 39, + 8, + 243 + ], + "accounts": [ + { + "name": "mint_governor", + "writable": true, + "relations": [ + "mint_authority" + ] + }, + { + "name": "mint_authority", + "writable": true + }, + { + "name": "mint", + "writable": true, + "relations": [ + "destination_ata" + ] + }, + { + "name": "destination_ata", + "writable": true + }, + { + "name": "authorized_minter", + "signer": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "MintTokensArgs" + } + } + } + ] + }, + { + "name": "reclaim_authority", + "discriminator": [ + 156, + 147, + 67, + 113, + 251, + 229, + 162, + 166 + ], + "accounts": [ + { + "name": "mint_governor", + "writable": true + }, + { + "name": "mint", + "writable": true + }, + { + "name": "admin", + "signer": true + }, + { + "name": "new_authority" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "remove_mint_authority", + "discriminator": [ + 33, + 207, + 52, + 111, + 106, + 97, + 9, + 63 + ], + "accounts": [ + { + "name": "mint_governor", + "writable": true, + "relations": [ + "mint_authority" + ] + }, + { + "name": "mint_authority", + "writable": true + }, + { + "name": "admin", + "signer": true + }, + { + "name": "rent_destination", + "writable": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "transfer_authority_to_governor", + "discriminator": [ + 14, + 48, + 149, + 50, + 10, + 197, + 115, + 141 + ], + "accounts": [ + { + "name": "mint_governor", + "writable": true + }, + { + "name": "mint", + "writable": true + }, + { + "name": "current_authority", + "signer": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "update_mint_authority", + "discriminator": [ + 103, + 51, + 57, + 197, + 223, + 22, + 44, + 142 + ], + "accounts": [ + { + "name": "mint_governor", + "writable": true, + "relations": [ + "mint_authority" + ] + }, + { + "name": "mint_authority", + "writable": true + }, + { + "name": "admin", + "signer": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "UpdateMintAuthorityArgs" + } + } + } + ] + }, + { + "name": "update_mint_governor_admin", + "discriminator": [ + 13, + 24, + 126, + 16, + 56, + 4, + 123, + 179 + ], + "accounts": [ + { + "name": "mint_governor", + "writable": true + }, + { + "name": "admin", + "signer": true + }, + { + "name": "new_admin" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + } + ], + "accounts": [ + { + "name": "MintAuthority", + "discriminator": [ + 148, + 0, + 219, + 228, + 254, + 237, + 76, + 128 + ] + }, + { + "name": "MintGovernor", + "discriminator": [ + 110, + 173, + 19, + 114, + 217, + 193, + 37, + 71 + ] + } + ], + "events": [ + { + "name": "MintAuthorityAddedEvent", + "discriminator": [ + 169, + 138, + 119, + 137, + 190, + 104, + 6, + 248 + ] + }, + { + "name": "MintAuthorityReclaimedEvent", + "discriminator": [ + 230, + 206, + 54, + 112, + 17, + 252, + 238, + 136 + ] + }, + { + "name": "MintAuthorityRemovedEvent", + "discriminator": [ + 33, + 191, + 194, + 66, + 228, + 81, + 72, + 195 + ] + }, + { + "name": "MintAuthorityTransferredEvent", + "discriminator": [ + 205, + 127, + 250, + 250, + 151, + 40, + 121, + 49 + ] + }, + { + "name": "MintAuthorityUpdatedEvent", + "discriminator": [ + 62, + 240, + 230, + 80, + 136, + 231, + 9, + 75 + ] + }, + { + "name": "MintGovernorAdminUpdatedEvent", + "discriminator": [ + 65, + 63, + 211, + 60, + 91, + 209, + 207, + 132 + ] + }, + { + "name": "MintGovernorInitializedEvent", + "discriminator": [ + 19, + 13, + 254, + 0, + 215, + 154, + 195, + 136 + ] + }, + { + "name": "TokensMintedEvent", + "discriminator": [ + 197, + 87, + 251, + 124, + 83, + 45, + 57, + 62 + ] + } + ], + "errors": [ + { + "code": 6000, + "name": "UnauthorizedAdmin", + "msg": "Unauthorized: signer is not the admin" + }, + { + "code": 6001, + "name": "UnauthorizedMinter", + "msg": "Unauthorized: signer is not the authorized minter" + }, + { + "code": 6002, + "name": "MintMismatch", + "msg": "Mint mismatch: mint_governor.mint does not match provided mint" + }, + { + "code": 6003, + "name": "MintLimitExceeded", + "msg": "Mint limit exceeded: would exceed max_total" + } + ], + "types": [ + { + "name": "AddMintAuthorityArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "max_total", + "type": { + "option": "u64" + } + } + ] + } + }, + { + "name": "CommonFields", + "type": { + "kind": "struct", + "fields": [ + { + "name": "slot", + "type": "u64" + }, + { + "name": "unix_timestamp", + "type": "i64" + }, + { + "name": "mint_governor_seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "MintAuthority", + "type": { + "kind": "struct", + "fields": [ + { + "name": "mint_governor", + "type": "pubkey" + }, + { + "name": "authorized_minter", + "type": "pubkey" + }, + { + "name": "max_total", + "type": { + "option": "u64" + } + }, + { + "name": "total_minted", + "type": "u64" + }, + { + "name": "bump", + "type": "u8" + } + ] + } + }, + { + "name": "MintAuthorityAddedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "mint_governor", + "type": "pubkey" + }, + { + "name": "mint_authority", + "type": "pubkey" + }, + { + "name": "authorized_minter", + "type": "pubkey" + }, + { + "name": "max_total", + "type": { + "option": "u64" + } + } + ] + } + }, + { + "name": "MintAuthorityReclaimedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "mint_governor", + "type": "pubkey" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "new_authority", + "type": "pubkey" + } + ] + } + }, + { + "name": "MintAuthorityRemovedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "mint_governor", + "type": "pubkey" + }, + { + "name": "mint_authority", + "type": "pubkey" + }, + { + "name": "authorized_minter", + "type": "pubkey" + }, + { + "name": "max_total", + "type": { + "option": "u64" + } + }, + { + "name": "total_minted", + "type": "u64" + } + ] + } + }, + { + "name": "MintAuthorityTransferredEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "mint_governor", + "type": "pubkey" + }, + { + "name": "mint", + "type": "pubkey" + } + ] + } + }, + { + "name": "MintAuthorityUpdatedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "mint_governor", + "type": "pubkey" + }, + { + "name": "mint_authority", + "type": "pubkey" + }, + { + "name": "authorized_minter", + "type": "pubkey" + }, + { + "name": "max_total", + "type": { + "option": "u64" + } + }, + { + "name": "total_minted", + "type": "u64" + } + ] + } + }, + { + "name": "MintGovernor", + "type": { + "kind": "struct", + "fields": [ + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "create_key", + "type": "pubkey" + }, + { + "name": "seq_num", + "type": "u64" + }, + { + "name": "bump", + "type": "u8" + } + ] + } + }, + { + "name": "MintGovernorAdminUpdatedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "mint_governor", + "type": "pubkey" + }, + { + "name": "new_admin", + "type": "pubkey" + } + ] + } + }, + { + "name": "MintGovernorInitializedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "mint_governor", + "type": "pubkey" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "create_key", + "type": "pubkey" + }, + { + "name": "pda_bump", + "type": "u8" + } + ] + } + }, + { + "name": "MintTokensArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amount", + "type": "u64" + } + ] + } + }, + { + "name": "TokensMintedEvent", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "mint_governor", + "type": "pubkey" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "authorized_minter", + "type": "pubkey" + }, + { + "name": "destination_ata", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "post_total_minted", + "type": "u64" + }, + { + "name": "authority_max_total", + "type": { + "option": "u64" + } + }, + { + "name": "post_mint_supply", + "type": "u64" + } + ] + } + }, + { + "name": "UpdateMintAuthorityArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "max_total", + "type": { + "option": "u64" + } + } + ] + } + } + ] +} \ No newline at end of file diff --git a/sdk/src/mint_governor/v0.7/types/mint_governor.ts b/sdk/src/mint_governor/v0.7/types/mint_governor.ts index 56e0f1539..dc0a37b64 100644 --- a/sdk/src/mint_governor/v0.7/types/mint_governor.ts +++ b/sdk/src/mint_governor/v0.7/types/mint_governor.ts @@ -1,343 +1,669 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL can be found at `target/idl/mint_governor.json`. + */ export type MintGovernor = { - version: "0.7.0"; - name: "mint_governor"; + address: "gvnr27cVeyW3AVf3acL7VCJ5WjGAphytnsgcK1feHyH"; + metadata: { + name: "mintGovernor"; + version: "0.7.0"; + spec: "0.1.0"; + description: "Created with Anchor"; + }; instructions: [ { - name: "initializeMintGovernor"; + name: "addMintAuthority"; + discriminator: [41, 254, 251, 123, 155, 68, 213, 8]; accounts: [ - { - name: "mint"; - isMut: false; - isSigner: false; - }, { name: "mintGovernor"; - isMut: true; - isSigner: false; + writable: true; }, { - name: "createKey"; - isMut: false; - isSigner: true; + name: "mintAuthority"; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 109, + 105, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + { + kind: "account"; + path: "mintGovernor"; + }, + { + kind: "account"; + path: "authorizedMinter"; + }, + ]; + }; }, { name: "admin"; - isMut: false; - isSigner: false; + signer: true; + }, + { + name: "authorizedMinter"; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; - args: []; + args: [ + { + name: "args"; + type: { + defined: { + name: "addMintAuthorityArgs"; + }; + }; + }, + ]; }, { - name: "transferAuthorityToGovernor"; + name: "initializeMintGovernor"; + discriminator: [198, 71, 122, 52, 99, 36, 35, 197]; accounts: [ + { + name: "mint"; + }, { name: "mintGovernor"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 109, + 105, + 110, + 116, + 95, + 103, + 111, + 118, + 101, + 114, + 110, + 111, + 114, + ]; + }, + { + kind: "account"; + path: "mint"; + }, + { + kind: "account"; + path: "createKey"; + }, + ]; + }; }, { - name: "mint"; - isMut: true; - isSigner: false; + name: "createKey"; + signer: true; }, { - name: "currentAuthority"; - isMut: false; - isSigner: true; + name: "admin"; }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + name: "payer"; + writable: true; + signer: true; + }, + { + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { - name: "addMintAuthority"; + name: "mintTokens"; + discriminator: [59, 132, 24, 246, 122, 39, 8, 243]; accounts: [ { name: "mintGovernor"; - isMut: true; - isSigner: false; + writable: true; + relations: ["mintAuthority"]; }, { name: "mintAuthority"; - isMut: true; - isSigner: false; + writable: true; }, { - name: "admin"; - isMut: false; - isSigner: true; + name: "mint"; + writable: true; + relations: ["destinationAta"]; }, { - name: "authorizedMinter"; - isMut: false; - isSigner: false; + name: "destinationAta"; + writable: true; }, { - name: "payer"; - isMut: true; - isSigner: true; + name: "authorizedMinter"; + signer: true; }, { - name: "systemProgram"; - isMut: false; - isSigner: false; + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "args"; type: { - defined: "AddMintAuthorityArgs"; + defined: { + name: "mintTokensArgs"; + }; }; }, ]; }, { - name: "mintTokens"; + name: "reclaimAuthority"; + discriminator: [156, 147, 67, 113, 251, 229, 162, 166]; accounts: [ { name: "mintGovernor"; - isMut: true; - isSigner: false; - }, - { - name: "mintAuthority"; - isMut: true; - isSigner: false; + writable: true; }, { name: "mint"; - isMut: true; - isSigner: false; + writable: true; }, { - name: "destinationAta"; - isMut: true; - isSigner: false; + name: "admin"; + signer: true; }, { - name: "authorizedMinter"; - isMut: false; - isSigner: true; + name: "newAuthority"; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "MintTokensArgs"; - }; }, ]; + args: []; }, { - name: "updateMintAuthority"; + name: "removeMintAuthority"; + discriminator: [33, 207, 52, 111, 106, 97, 9, 63]; accounts: [ { name: "mintGovernor"; - isMut: true; - isSigner: false; + writable: true; + relations: ["mintAuthority"]; }, { name: "mintAuthority"; - isMut: true; - isSigner: false; + writable: true; }, { name: "admin"; - isMut: false; - isSigner: true; + signer: true; }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + name: "rentDestination"; + writable: true; }, { - name: "program"; - isMut: false; - isSigner: false; + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, - ]; - args: [ { - name: "args"; - type: { - defined: "UpdateMintAuthorityArgs"; - }; + name: "program"; }, ]; + args: []; }, { - name: "removeMintAuthority"; + name: "transferAuthorityToGovernor"; + discriminator: [14, 48, 149, 50, 10, 197, 115, 141]; accounts: [ { name: "mintGovernor"; - isMut: true; - isSigner: false; + writable: true; }, { - name: "mintAuthority"; - isMut: true; - isSigner: false; + name: "mint"; + writable: true; }, { - name: "admin"; - isMut: false; - isSigner: true; + name: "currentAuthority"; + signer: true; }, { - name: "rentDestination"; - isMut: true; - isSigner: false; + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { - name: "updateMintGovernorAdmin"; + name: "updateMintAuthority"; + discriminator: [103, 51, 57, 197, 223, 22, 44, 142]; accounts: [ { name: "mintGovernor"; - isMut: true; - isSigner: false; + writable: true; + relations: ["mintAuthority"]; }, { - name: "admin"; - isMut: false; - isSigner: true; + name: "mintAuthority"; + writable: true; }, { - name: "newAdmin"; - isMut: false; - isSigner: false; + name: "admin"; + signer: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; - args: []; + args: [ + { + name: "args"; + type: { + defined: { + name: "updateMintAuthorityArgs"; + }; + }; + }, + ]; }, { - name: "reclaimAuthority"; + name: "updateMintGovernorAdmin"; + discriminator: [13, 24, 126, 16, 56, 4, 123, 179]; accounts: [ { name: "mintGovernor"; - isMut: true; - isSigner: false; - }, - { - name: "mint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "admin"; - isMut: false; - isSigner: true; - }, - { - name: "newAuthority"; - isMut: false; - isSigner: false; + signer: true; }, { - name: "tokenProgram"; - isMut: false; - isSigner: false; + name: "newAdmin"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, ]; accounts: [ + { + name: "mintAuthority"; + discriminator: [148, 0, 219, 228, 254, 237, 76, 128]; + }, + { + name: "mintGovernor"; + discriminator: [110, 173, 19, 114, 217, 193, 37, 71]; + }, + ]; + events: [ + { + name: "mintAuthorityAddedEvent"; + discriminator: [169, 138, 119, 137, 190, 104, 6, 248]; + }, + { + name: "mintAuthorityReclaimedEvent"; + discriminator: [230, 206, 54, 112, 17, 252, 238, 136]; + }, + { + name: "mintAuthorityRemovedEvent"; + discriminator: [33, 191, 194, 66, 228, 81, 72, 195]; + }, + { + name: "mintAuthorityTransferredEvent"; + discriminator: [205, 127, 250, 250, 151, 40, 121, 49]; + }, + { + name: "mintAuthorityUpdatedEvent"; + discriminator: [62, 240, 230, 80, 136, 231, 9, 75]; + }, + { + name: "mintGovernorAdminUpdatedEvent"; + discriminator: [65, 63, 211, 60, 91, 209, 207, 132]; + }, + { + name: "mintGovernorInitializedEvent"; + discriminator: [19, 13, 254, 0, 215, 154, 195, 136]; + }, + { + name: "tokensMintedEvent"; + discriminator: [197, 87, 251, 124, 83, 45, 57, 62]; + }, + ]; + errors: [ + { + code: 6000; + name: "unauthorizedAdmin"; + msg: "Unauthorized: signer is not the admin"; + }, + { + code: 6001; + name: "unauthorizedMinter"; + msg: "Unauthorized: signer is not the authorized minter"; + }, + { + code: 6002; + name: "mintMismatch"; + msg: "Mint mismatch: mint_governor.mint does not match provided mint"; + }, + { + code: 6003; + name: "mintLimitExceeded"; + msg: "Mint limit exceeded: would exceed max_total"; + }, + ]; + types: [ + { + name: "addMintAuthorityArgs"; + type: { + kind: "struct"; + fields: [ + { + name: "maxTotal"; + type: { + option: "u64"; + }; + }, + ]; + }; + }, + { + name: "commonFields"; + type: { + kind: "struct"; + fields: [ + { + name: "slot"; + type: "u64"; + }, + { + name: "unixTimestamp"; + type: "i64"; + }, + { + name: "mintGovernorSeqNum"; + type: "u64"; + }, + ]; + }; + }, { name: "mintAuthority"; type: { @@ -345,11 +671,11 @@ export type MintGovernor = { fields: [ { name: "mintGovernor"; - type: "publicKey"; + type: "pubkey"; }, { name: "authorizedMinter"; - type: "publicKey"; + type: "pubkey"; }, { name: "maxTotal"; @@ -369,1153 +695,330 @@ export type MintGovernor = { }; }, { - name: "mintGovernor"; + name: "mintAuthorityAddedEvent"; type: { kind: "struct"; fields: [ { - name: "mint"; - type: "publicKey"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "admin"; - type: "publicKey"; + name: "mintGovernor"; + type: "pubkey"; }, { - name: "createKey"; - type: "publicKey"; + name: "mintAuthority"; + type: "pubkey"; }, { - name: "seqNum"; - type: "u64"; + name: "authorizedMinter"; + type: "pubkey"; }, { - name: "bump"; - type: "u8"; + name: "maxTotal"; + type: { + option: "u64"; + }; }, ]; }; }, - ]; - types: [ { - name: "CommonFields"; + name: "mintAuthorityReclaimedEvent"; type: { kind: "struct"; fields: [ { - name: "slot"; - type: "u64"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "unixTimestamp"; - type: "i64"; + name: "mintGovernor"; + type: "pubkey"; }, { - name: "mintGovernorSeqNum"; - type: "u64"; + name: "mint"; + type: "pubkey"; + }, + { + name: "newAuthority"; + type: "pubkey"; }, ]; }; }, { - name: "AddMintAuthorityArgs"; + name: "mintAuthorityRemovedEvent"; type: { kind: "struct"; fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "mintGovernor"; + type: "pubkey"; + }, + { + name: "mintAuthority"; + type: "pubkey"; + }, + { + name: "authorizedMinter"; + type: "pubkey"; + }, { name: "maxTotal"; type: { option: "u64"; }; }, + { + name: "totalMinted"; + type: "u64"; + }, ]; }; }, { - name: "MintTokensArgs"; + name: "mintAuthorityTransferredEvent"; type: { kind: "struct"; fields: [ { - name: "amount"; - type: "u64"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "mintGovernor"; + type: "pubkey"; + }, + { + name: "mint"; + type: "pubkey"; }, ]; }; }, { - name: "UpdateMintAuthorityArgs"; + name: "mintAuthorityUpdatedEvent"; type: { kind: "struct"; fields: [ { - name: "maxTotal"; + name: "common"; type: { - option: "u64"; + defined: { + name: "commonFields"; + }; }; }, - ]; - }; - }, - ]; - events: [ - { - name: "MintGovernorInitializedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "mintGovernor"; - type: "publicKey"; - index: false; - }, - { - name: "mint"; - type: "publicKey"; - index: false; - }, - { - name: "admin"; - type: "publicKey"; - index: false; - }, - { - name: "createKey"; - type: "publicKey"; - index: false; - }, - { - name: "pdaBump"; - type: "u8"; - index: false; - }, - ]; - }, - { - name: "MintAuthorityTransferredEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "mintGovernor"; - type: "publicKey"; - index: false; - }, - { - name: "mint"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "MintAuthorityAddedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "mintGovernor"; - type: "publicKey"; - index: false; - }, - { - name: "mintAuthority"; - type: "publicKey"; - index: false; - }, - { - name: "authorizedMinter"; - type: "publicKey"; - index: false; - }, - { - name: "maxTotal"; - type: { - option: "u64"; - }; - index: false; - }, - ]; - }, - { - name: "TokensMintedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "mintGovernor"; - type: "publicKey"; - index: false; - }, - { - name: "mint"; - type: "publicKey"; - index: false; - }, - { - name: "authorizedMinter"; - type: "publicKey"; - index: false; - }, - { - name: "destinationAta"; - type: "publicKey"; - index: false; - }, - { - name: "amount"; - type: "u64"; - index: false; - }, - { - name: "postTotalMinted"; - type: "u64"; - index: false; - }, - { - name: "authorityMaxTotal"; - type: { - option: "u64"; - }; - index: false; - }, - { - name: "postMintSupply"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "MintAuthorityUpdatedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "mintGovernor"; - type: "publicKey"; - index: false; - }, - { - name: "mintAuthority"; - type: "publicKey"; - index: false; - }, - { - name: "authorizedMinter"; - type: "publicKey"; - index: false; - }, - { - name: "maxTotal"; - type: { - option: "u64"; - }; - index: false; - }, - { - name: "totalMinted"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "MintAuthorityRemovedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "mintGovernor"; - type: "publicKey"; - index: false; - }, - { - name: "mintAuthority"; - type: "publicKey"; - index: false; - }, - { - name: "authorizedMinter"; - type: "publicKey"; - index: false; - }, - { - name: "maxTotal"; - type: { - option: "u64"; - }; - index: false; - }, - { - name: "totalMinted"; - type: "u64"; - index: false; - }, - ]; - }, - { - name: "MintGovernorAdminUpdatedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "mintGovernor"; - type: "publicKey"; - index: false; - }, - { - name: "newAdmin"; - type: "publicKey"; - index: false; - }, - ]; - }, - { - name: "MintAuthorityReclaimedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "mintGovernor"; - type: "publicKey"; - index: false; - }, - { - name: "mint"; - type: "publicKey"; - index: false; - }, - { - name: "newAuthority"; - type: "publicKey"; - index: false; - }, - ]; - }, - ]; - errors: [ - { - code: 6000; - name: "UnauthorizedAdmin"; - msg: "Unauthorized: signer is not the admin"; - }, - { - code: 6001; - name: "UnauthorizedMinter"; - msg: "Unauthorized: signer is not the authorized minter"; - }, - { - code: 6002; - name: "MintMismatch"; - msg: "Mint mismatch: mint_governor.mint does not match provided mint"; - }, - { - code: 6003; - name: "MintLimitExceeded"; - msg: "Mint limit exceeded: would exceed max_total"; - }, - ]; -}; - -export const IDL: MintGovernor = { - version: "0.7.0", - name: "mint_governor", - instructions: [ - { - name: "initializeMintGovernor", - accounts: [ - { - name: "mint", - isMut: false, - isSigner: false, - }, - { - name: "mintGovernor", - isMut: true, - isSigner: false, - }, - { - name: "createKey", - isMut: false, - isSigner: true, - }, - { - name: "admin", - isMut: false, - 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: "transferAuthorityToGovernor", - accounts: [ - { - name: "mintGovernor", - isMut: true, - isSigner: false, - }, - { - name: "mint", - isMut: true, - isSigner: false, - }, - { - name: "currentAuthority", - isMut: false, - isSigner: true, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "addMintAuthority", - accounts: [ - { - name: "mintGovernor", - isMut: true, - isSigner: false, - }, - { - name: "mintAuthority", - isMut: true, - isSigner: false, - }, - { - name: "admin", - isMut: false, - isSigner: true, - }, - { - name: "authorizedMinter", - isMut: false, - 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: "AddMintAuthorityArgs", - }, - }, - ], - }, - { - name: "mintTokens", - accounts: [ - { - name: "mintGovernor", - isMut: true, - isSigner: false, - }, - { - name: "mintAuthority", - isMut: true, - isSigner: false, - }, - { - name: "mint", - isMut: true, - isSigner: false, - }, - { - name: "destinationAta", - isMut: true, - isSigner: false, - }, - { - name: "authorizedMinter", - isMut: false, - isSigner: true, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "MintTokensArgs", - }, - }, - ], - }, - { - name: "updateMintAuthority", - accounts: [ - { - name: "mintGovernor", - isMut: true, - isSigner: false, - }, - { - name: "mintAuthority", - isMut: true, - isSigner: false, - }, - { - name: "admin", - isMut: false, - isSigner: true, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "args", - type: { - defined: "UpdateMintAuthorityArgs", - }, - }, - ], - }, - { - name: "removeMintAuthority", - accounts: [ - { - name: "mintGovernor", - isMut: true, - isSigner: false, - }, - { - name: "mintAuthority", - isMut: true, - isSigner: false, - }, - { - name: "admin", - isMut: false, - isSigner: true, - }, - { - name: "rentDestination", - isMut: true, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "updateMintGovernorAdmin", - accounts: [ - { - name: "mintGovernor", - isMut: true, - isSigner: false, - }, - { - name: "admin", - isMut: false, - isSigner: true, - }, - { - name: "newAdmin", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "reclaimAuthority", - accounts: [ - { - name: "mintGovernor", - isMut: true, - isSigner: false, - }, - { - name: "mint", - isMut: true, - isSigner: false, - }, - { - name: "admin", - isMut: false, - isSigner: true, - }, - { - name: "newAuthority", - isMut: false, - isSigner: false, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "mintAuthority", - type: { - kind: "struct", - fields: [ { - name: "mintGovernor", - type: "publicKey", + name: "mintGovernor"; + type: "pubkey"; }, { - name: "authorizedMinter", - type: "publicKey", + name: "mintAuthority"; + type: "pubkey"; }, { - name: "maxTotal", - type: { - option: "u64", - }, + name: "authorizedMinter"; + type: "pubkey"; }, { - name: "totalMinted", - type: "u64", + name: "maxTotal"; + type: { + option: "u64"; + }; }, { - name: "bump", - type: "u8", + name: "totalMinted"; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "mintGovernor", + name: "mintGovernor"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "mint", - type: "publicKey", + name: "mint"; + type: "pubkey"; }, { - name: "admin", - type: "publicKey", + name: "admin"; + type: "pubkey"; }, { - name: "createKey", - type: "publicKey", + name: "createKey"; + type: "pubkey"; }, { - name: "seqNum", - type: "u64", + name: "seqNum"; + type: "u64"; }, { - name: "bump", - type: "u8", + name: "bump"; + type: "u8"; }, - ], - }, + ]; + }; }, - ], - types: [ { - name: "CommonFields", + name: "mintGovernorAdminUpdatedEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "slot", - type: "u64", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "unixTimestamp", - type: "i64", + name: "mintGovernor"; + type: "pubkey"; }, { - name: "mintGovernorSeqNum", - type: "u64", + name: "newAdmin"; + type: "pubkey"; }, - ], - }, + ]; + }; }, { - name: "AddMintAuthorityArgs", + name: "mintGovernorInitializedEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "maxTotal", + name: "common"; type: { - option: "u64", - }, + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "mintGovernor"; + type: "pubkey"; + }, + { + name: "mint"; + type: "pubkey"; + }, + { + name: "admin"; + type: "pubkey"; + }, + { + name: "createKey"; + type: "pubkey"; + }, + { + name: "pdaBump"; + type: "u8"; }, - ], - }, + ]; + }; }, { - name: "MintTokensArgs", + name: "mintTokensArgs"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "amount", - type: "u64", + name: "amount"; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "UpdateMintAuthorityArgs", + name: "tokensMintedEvent"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "maxTotal", + name: "common"; type: { - option: "u64", - }, - }, - ], - }, - }, - ], - events: [ - { - name: "MintGovernorInitializedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "mintGovernor", - type: "publicKey", - index: false, - }, - { - name: "mint", - type: "publicKey", - index: false, - }, - { - name: "admin", - type: "publicKey", - index: false, - }, - { - name: "createKey", - type: "publicKey", - index: false, - }, - { - name: "pdaBump", - type: "u8", - index: false, - }, - ], - }, - { - name: "MintAuthorityTransferredEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "mintGovernor", - type: "publicKey", - index: false, - }, - { - name: "mint", - type: "publicKey", - index: false, - }, - ], - }, - { - name: "MintAuthorityAddedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + defined: { + name: "commonFields"; + }; + }; }, - index: false, - }, - { - name: "mintGovernor", - type: "publicKey", - index: false, - }, - { - name: "mintAuthority", - type: "publicKey", - index: false, - }, - { - name: "authorizedMinter", - type: "publicKey", - index: false, - }, - { - name: "maxTotal", - type: { - option: "u64", + { + name: "mintGovernor"; + type: "pubkey"; }, - index: false, - }, - ], - }, - { - name: "TokensMintedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "mint"; + type: "pubkey"; }, - index: false, - }, - { - name: "mintGovernor", - type: "publicKey", - index: false, - }, - { - name: "mint", - type: "publicKey", - index: false, - }, - { - name: "authorizedMinter", - type: "publicKey", - index: false, - }, - { - name: "destinationAta", - type: "publicKey", - index: false, - }, - { - name: "amount", - type: "u64", - index: false, - }, - { - name: "postTotalMinted", - type: "u64", - index: false, - }, - { - name: "authorityMaxTotal", - type: { - option: "u64", + { + name: "authorizedMinter"; + type: "pubkey"; }, - index: false, - }, - { - name: "postMintSupply", - type: "u64", - index: false, - }, - ], - }, - { - name: "MintAuthorityUpdatedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "destinationAta"; + type: "pubkey"; }, - index: false, - }, - { - name: "mintGovernor", - type: "publicKey", - index: false, - }, - { - name: "mintAuthority", - type: "publicKey", - index: false, - }, - { - name: "authorizedMinter", - type: "publicKey", - index: false, - }, - { - name: "maxTotal", - type: { - option: "u64", + { + name: "amount"; + type: "u64"; }, - index: false, - }, - { - name: "totalMinted", - type: "u64", - index: false, - }, - ], - }, - { - name: "MintAuthorityRemovedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "postTotalMinted"; + type: "u64"; }, - index: false, - }, - { - name: "mintGovernor", - type: "publicKey", - index: false, - }, - { - name: "mintAuthority", - type: "publicKey", - index: false, - }, - { - name: "authorizedMinter", - type: "publicKey", - index: false, - }, - { - name: "maxTotal", - type: { - option: "u64", + { + name: "authorityMaxTotal"; + type: { + option: "u64"; + }; }, - index: false, - }, - { - name: "totalMinted", - type: "u64", - index: false, - }, - ], - }, - { - name: "MintGovernorAdminUpdatedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "postMintSupply"; + type: "u64"; }, - index: false, - }, - { - name: "mintGovernor", - type: "publicKey", - index: false, - }, - { - name: "newAdmin", - type: "publicKey", - index: false, - }, - ], + ]; + }; }, { - name: "MintAuthorityReclaimedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "updateMintAuthorityArgs"; + type: { + kind: "struct"; + fields: [ + { + name: "maxTotal"; + type: { + option: "u64"; + }; }, - index: false, - }, - { - name: "mintGovernor", - type: "publicKey", - index: false, - }, - { - name: "mint", - type: "publicKey", - index: false, - }, - { - name: "newAuthority", - type: "publicKey", - index: false, - }, - ], - }, - ], - errors: [ - { - code: 6000, - name: "UnauthorizedAdmin", - msg: "Unauthorized: signer is not the admin", - }, - { - code: 6001, - name: "UnauthorizedMinter", - msg: "Unauthorized: signer is not the authorized minter", - }, - { - code: 6002, - name: "MintMismatch", - msg: "Mint mismatch: mint_governor.mint does not match provided mint", - }, - { - code: 6003, - name: "MintLimitExceeded", - msg: "Mint limit exceeded: would exceed max_total", + ]; + }; }, - ], + ]; }; diff --git a/sdk/src/pda.ts b/sdk/src/pda.ts index cdbf9c0ae..84d5e319b 100644 --- a/sdk/src/pda.ts +++ b/sdk/src/pda.ts @@ -1,5 +1,5 @@ import { PublicKey } from "@solana/web3.js"; -import { utils } from "@coral-xyz/anchor"; +import { utils } from "@anchor-lang/core"; import { MPL_TOKEN_METADATA_PROGRAM_ID } from "./constants.js"; diff --git a/sdk/src/performance_package_v2/v0.7/PerformancePackageV2Client.ts b/sdk/src/performance_package_v2/v0.7/PerformancePackageV2Client.ts index d70bed07c..a5200be1c 100644 --- a/sdk/src/performance_package_v2/v0.7/PerformancePackageV2Client.ts +++ b/sdk/src/performance_package_v2/v0.7/PerformancePackageV2Client.ts @@ -1,4 +1,4 @@ -import { AnchorProvider, Program } from "@coral-xyz/anchor"; +import { AnchorProvider, Program } from "@anchor-lang/core"; import { AccountInfo, PublicKey, SystemProgram } from "@solana/web3.js"; import { TOKEN_PROGRAM_ID, @@ -12,9 +12,9 @@ import { import { getPerformancePackageV2Addr, getChangeRequestV2Addr } from "./pda.js"; import { getEventAuthorityAddr } from "../../pda.js"; import { - PerformancePackageV2 as PerformancePackageV2Program, - IDL as PerformancePackageV2IDL, -} from "./types/performance_package_v2.js"; + PerformancePackageV2Program, + PerformancePackageV2IDL, +} from "./types/index.js"; import type { PerformancePackageV2Account, PerformancePackageV2ChangeRequestAccount, @@ -36,8 +36,7 @@ export class PerformancePackageV2Client { this.provider = provider; this.programId = programId; this.program = new Program( - PerformancePackageV2IDL, - programId, + { ...PerformancePackageV2IDL, address: programId.toBase58() }, provider, ); } @@ -135,7 +134,7 @@ export class PerformancePackageV2Client { rewardFunction, minUnlockTimestamp, }) - .accounts({ + .accountsPartial({ performancePackage, mint, mintGovernor, @@ -157,7 +156,7 @@ export class PerformancePackageV2Client { signer?: PublicKey; dao?: PublicKey; }) { - const builder = this.program.methods.startUnlock().accounts({ + const builder = this.program.methods.startUnlock().accountsPartial({ performancePackage, signer, }); @@ -194,7 +193,7 @@ export class PerformancePackageV2Client { MINT_GOVERNOR_V0_7_PROGRAM_ID, ); - const builder = this.program.methods.completeUnlock().accounts({ + const builder = this.program.methods.completeUnlock().accountsPartial({ performancePackage, mintGovernor, mintAuthority, @@ -224,7 +223,7 @@ export class PerformancePackageV2Client { authority?: PublicKey; newAuthority: PublicKey; }) { - return this.program.methods.changeAuthority().accounts({ + return this.program.methods.changeAuthority().accountsPartial({ performancePackage, authority, newAuthority, @@ -261,7 +260,7 @@ export class PerformancePackageV2Client { newOracleReader, newRewardFunction, }) - .accounts({ + .accountsPartial({ performancePackage, changeRequest, proposer, @@ -281,7 +280,7 @@ export class PerformancePackageV2Client { executor?: PublicKey; rentDestination?: PublicKey; }) { - return this.program.methods.executeChange().accounts({ + return this.program.methods.executeChange().accountsPartial({ performancePackage, changeRequest, executor, @@ -298,7 +297,7 @@ export class PerformancePackageV2Client { admin?: PublicKey; rentDestination?: PublicKey; }) { - return this.program.methods.closePerformancePackage().accounts({ + return this.program.methods.closePerformancePackage().accountsPartial({ performancePackage, admin, rentDestination, diff --git a/sdk/src/performance_package_v2/v0.7/types/index.ts b/sdk/src/performance_package_v2/v0.7/types/index.ts index 25a6141ca..ff779e2f5 100644 --- a/sdk/src/performance_package_v2/v0.7/types/index.ts +++ b/sdk/src/performance_package_v2/v0.7/types/index.ts @@ -1,41 +1,41 @@ -import { IdlAccounts, IdlEvents, IdlTypes } from "@coral-xyz/anchor"; -import { - PerformancePackageV2 as PerformancePackageV2Program, - IDL as PerformancePackageV2IDL, -} from "./performance_package_v2.js"; -export { PerformancePackageV2Program, PerformancePackageV2IDL }; +import { IdlAccounts, IdlEvents, IdlTypes } from "@anchor-lang/core"; +import type { PerformancePackageV2 as PerformancePackageV2Program } from "./performance_package_v2.js"; +import performancePackageV2Idl from "./performance_package_v2.json" with { type: "json" }; +export type { PerformancePackageV2Program }; +export const PerformancePackageV2IDL = + performancePackageV2Idl as PerformancePackageV2Program; export type PerformancePackageV2Account = IdlAccounts["performancePackage"]; export type PerformancePackageV2ChangeRequestAccount = IdlAccounts["changeRequest"]; export type PerformancePackageV2OracleReader = - IdlTypes["OracleReader"]; + IdlTypes["oracleReader"]; export type PerformancePackageV2RewardFunction = - IdlTypes["RewardFunction"]; + IdlTypes["rewardFunction"]; export type PerformancePackageV2PackageStatus = - IdlTypes["PackageStatus"]; + IdlTypes["packageStatus"]; export type PerformancePackageV2ThresholdTranche = - IdlTypes["ThresholdTranche"]; + IdlTypes["thresholdTranche"]; // Event aliases are prefixed because several event names (UnlockStartedEvent, // UnlockCompletedEvent, ChangeProposedEvent, ChangeExecutedEvent) collide with // the v1 `price_based_performance_package` module, which also re-exports them // unqualified from the package root. export type PerformancePackageV2CreatedEvent = - IdlEvents["PerformancePackageCreatedEvent"]; + IdlEvents["performancePackageCreatedEvent"]; export type PerformancePackageV2UnlockStartedEvent = - IdlEvents["UnlockStartedEvent"]; + IdlEvents["unlockStartedEvent"]; export type PerformancePackageV2UnlockCompletedEvent = - IdlEvents["UnlockCompletedEvent"]; + IdlEvents["unlockCompletedEvent"]; export type PerformancePackageV2AuthorityChangedEvent = - IdlEvents["AuthorityChangedEvent"]; + IdlEvents["authorityChangedEvent"]; export type PerformancePackageV2ChangeProposedEvent = - IdlEvents["ChangeProposedEvent"]; + IdlEvents["changeProposedEvent"]; export type PerformancePackageV2ChangeExecutedEvent = - IdlEvents["ChangeExecutedEvent"]; + IdlEvents["changeExecutedEvent"]; export type PerformancePackageV2ClosedEvent = - IdlEvents["PerformancePackageClosedEvent"]; + IdlEvents["performancePackageClosedEvent"]; export type PerformancePackageV2Event = | PerformancePackageV2CreatedEvent | PerformancePackageV2UnlockStartedEvent diff --git a/sdk/src/performance_package_v2/v0.7/types/performance_package_v2.json b/sdk/src/performance_package_v2/v0.7/types/performance_package_v2.json new file mode 100644 index 000000000..95a8db4e3 --- /dev/null +++ b/sdk/src/performance_package_v2/v0.7/types/performance_package_v2.json @@ -0,0 +1,1928 @@ +{ + "address": "pPV2pfrxnmstSb9j7kEeCLny5BGj6SNwCWGd6xbGGzz", + "metadata": { + "name": "performance_package_v2", + "version": "0.7.0", + "spec": "0.1.0", + "description": "Created with Anchor" + }, + "instructions": [ + { + "name": "change_authority", + "discriminator": [ + 50, + 106, + 66, + 104, + 99, + 118, + 145, + 88 + ], + "accounts": [ + { + "name": "performance_package", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 101, + 114, + 102, + 111, + 114, + 109, + 97, + 110, + 99, + 101, + 95, + 112, + 97, + 99, + 107, + 97, + 103, + 101 + ] + }, + { + "kind": "account", + "path": "performance_package.create_key", + "account": "PerformancePackage" + } + ] + } + }, + { + "name": "authority", + "docs": [ + "Must be the current authority of the performance package" + ], + "signer": true, + "relations": [ + "performance_package" + ] + }, + { + "name": "new_authority", + "docs": [ + "The new authority address" + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "close_performance_package", + "discriminator": [ + 166, + 35, + 29, + 1, + 172, + 39, + 254, + 135 + ], + "accounts": [ + { + "name": "performance_package", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 101, + 114, + 102, + 111, + 114, + 109, + 97, + 110, + 99, + 101, + 95, + 112, + 97, + 99, + 107, + 97, + 103, + 101 + ] + }, + { + "kind": "account", + "path": "performance_package.create_key", + "account": "PerformancePackage" + } + ] + } + }, + { + "name": "admin", + "signer": true + }, + { + "name": "rent_destination", + "writable": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "complete_unlock", + "discriminator": [ + 22, + 203, + 15, + 189, + 239, + 125, + 25, + 132 + ], + "accounts": [ + { + "name": "performance_package", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 101, + 114, + 102, + 111, + 114, + 109, + 97, + 110, + 99, + 101, + 95, + 112, + 97, + 99, + 107, + 97, + 103, + 101 + ] + }, + { + "kind": "account", + "path": "performance_package.create_key", + "account": "PerformancePackage" + } + ] + } + }, + { + "name": "mint_governor", + "writable": true + }, + { + "name": "mint_authority", + "writable": true + }, + { + "name": "mint", + "writable": true + }, + { + "name": "recipient_ata", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "performance_package.recipient", + "account": "PerformancePackage" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "signer", + "signer": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "mint_governor_program", + "address": "gvnr27cVeyW3AVf3acL7VCJ5WjGAphytnsgcK1feHyH" + }, + { + "name": "mint_governor_event_authority" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "execute_change", + "discriminator": [ + 104, + 53, + 136, + 238, + 82, + 222, + 200, + 42 + ], + "accounts": [ + { + "name": "performance_package", + "writable": true, + "relations": [ + "change_request" + ] + }, + { + "name": "change_request", + "writable": true + }, + { + "name": "executor", + "signer": true + }, + { + "name": "rent_destination", + "writable": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "initialize_performance_package", + "discriminator": [ + 3, + 171, + 56, + 55, + 135, + 100, + 163, + 186 + ], + "accounts": [ + { + "name": "performance_package", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 101, + 114, + 102, + 111, + 114, + 109, + 97, + 110, + 99, + 101, + 95, + 112, + 97, + 99, + 107, + 97, + 103, + 101 + ] + }, + { + "kind": "account", + "path": "create_key" + } + ] + } + }, + { + "name": "mint", + "relations": [ + "mint_governor" + ] + }, + { + "name": "mint_governor", + "relations": [ + "mint_authority" + ] + }, + { + "name": "mint_authority" + }, + { + "name": "create_key", + "signer": true + }, + { + "name": "authority" + }, + { + "name": "recipient" + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "InitializePerformancePackageArgs" + } + } + } + ] + }, + { + "name": "propose_change", + "discriminator": [ + 167, + 211, + 18, + 222, + 93, + 215, + 74, + 159 + ], + "accounts": [ + { + "name": "performance_package", + "writable": true + }, + { + "name": "change_request", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 99, + 104, + 97, + 110, + 103, + 101, + 95, + 114, + 101, + 113, + 117, + 101, + 115, + 116 + ] + }, + { + "kind": "account", + "path": "performance_package" + }, + { + "kind": "account", + "path": "proposer" + }, + { + "kind": "arg", + "path": "args.pda_nonce" + } + ] + } + }, + { + "name": "proposer", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "args", + "type": { + "defined": { + "name": "ProposeChangeArgs" + } + } + } + ] + }, + { + "name": "start_unlock", + "discriminator": [ + 53, + 202, + 212, + 31, + 76, + 178, + 31, + 123 + ], + "accounts": [ + { + "name": "performance_package", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 101, + 114, + 102, + 111, + 114, + 109, + 97, + 110, + 99, + 101, + 95, + 112, + 97, + 99, + 107, + 97, + 103, + 101 + ] + }, + { + "kind": "account", + "path": "performance_package.create_key", + "account": "PerformancePackage" + } + ] + } + }, + { + "name": "signer", + "signer": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + } + ], + "accounts": [ + { + "name": "ChangeRequest", + "discriminator": [ + 75, + 130, + 166, + 47, + 15, + 217, + 131, + 190 + ] + }, + { + "name": "MintAuthority", + "discriminator": [ + 148, + 0, + 219, + 228, + 254, + 237, + 76, + 128 + ] + }, + { + "name": "MintGovernor", + "discriminator": [ + 110, + 173, + 19, + 114, + 217, + 193, + 37, + 71 + ] + }, + { + "name": "PerformancePackage", + "discriminator": [ + 228, + 146, + 174, + 131, + 121, + 249, + 99, + 132 + ] + } + ], + "events": [ + { + "name": "AuthorityChangedEvent", + "discriminator": [ + 85, + 105, + 159, + 188, + 6, + 44, + 52, + 28 + ] + }, + { + "name": "ChangeExecutedEvent", + "discriminator": [ + 210, + 68, + 107, + 108, + 205, + 125, + 171, + 37 + ] + }, + { + "name": "ChangeProposedEvent", + "discriminator": [ + 235, + 3, + 116, + 187, + 11, + 199, + 254, + 249 + ] + }, + { + "name": "PerformancePackageClosedEvent", + "discriminator": [ + 6, + 236, + 112, + 207, + 221, + 238, + 59, + 75 + ] + }, + { + "name": "PerformancePackageCreatedEvent", + "discriminator": [ + 201, + 17, + 26, + 145, + 170, + 42, + 219, + 154 + ] + }, + { + "name": "UnlockCompletedEvent", + "discriminator": [ + 218, + 116, + 8, + 71, + 184, + 86, + 230, + 9 + ] + }, + { + "name": "UnlockStartedEvent", + "discriminator": [ + 143, + 238, + 115, + 206, + 153, + 246, + 44, + 253 + ] + } + ], + "errors": [ + { + "code": 6000, + "name": "Unauthorized", + "msg": "Signer is neither authority nor recipient" + }, + { + "code": 6001, + "name": "InvalidExecutor", + "msg": "Executor is not the opposite party from proposer" + }, + { + "code": 6002, + "name": "InvalidAuthority", + "msg": "Signer is not the current authority" + }, + { + "code": 6003, + "name": "InvalidAdmin", + "msg": "Signer is not the admin" + }, + { + "code": 6004, + "name": "InvalidMintGovernor", + "msg": "Mint governor does not match the provided mint" + }, + { + "code": 6005, + "name": "InvalidMintAuthority", + "msg": "Mint authority does not match expected configuration" + }, + { + "code": 6006, + "name": "NotLocked", + "msg": "Expected Locked status" + }, + { + "code": 6007, + "name": "NotUnlocking", + "msg": "Expected Unlocking status" + }, + { + "code": 6008, + "name": "OracleMissingAccount", + "msg": "Expected remaining_accounts not provided" + }, + { + "code": 6009, + "name": "OracleInvalidAccount", + "msg": "Account pubkey doesn't match expected" + }, + { + "code": 6010, + "name": "OracleParseError", + "msg": "Failed to parse account data" + }, + { + "code": 6011, + "name": "OracleInvalidState", + "msg": "Oracle state invalid" + }, + { + "code": 6012, + "name": "OracleMinDurationNotReached", + "msg": "Minimum duration hasn't passed yet" + }, + { + "code": 6013, + "name": "UnlockTimestampNotReached", + "msg": "Minimum unlock timestamp not yet reached" + }, + { + "code": 6014, + "name": "RewardCalculationOverflow", + "msg": "Math overflow in reward function" + }, + { + "code": 6015, + "name": "InvalidTranches", + "msg": "Tranches should be sorted and non-empty" + }, + { + "code": 6016, + "name": "InvalidVestingSchedule", + "msg": "Invalid vesting schedule configuration" + }, + { + "code": 6017, + "name": "ChangeRequestNotFound", + "msg": "Missing proposal for execute" + }, + { + "code": 6018, + "name": "NoChangesProposed", + "msg": "All optional change fields are None" + }, + { + "code": 6019, + "name": "MinDurationTooLarge", + "msg": "min_duration exceeds maximum allowed (365 days)" + }, + { + "code": 6020, + "name": "StaleChangeRequest", + "msg": "Change request is stale: PP was recreated or the proposing party has changed" + } + ], + "types": [ + { + "name": "AuthorityChangedEvent", + "docs": [ + "Emitted by: `change_authority`" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "performance_package", + "type": "pubkey" + }, + { + "name": "old_authority", + "type": "pubkey" + }, + { + "name": "new_authority", + "type": "pubkey" + }, + { + "name": "pp_created_at_timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "ChangeExecutedEvent", + "docs": [ + "Emitted by: `execute_change`" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "performance_package", + "type": "pubkey" + }, + { + "name": "executed_by", + "type": "pubkey" + }, + { + "name": "new_recipient", + "type": { + "option": "pubkey" + } + }, + { + "name": "new_oracle_reader", + "type": { + "option": { + "defined": { + "name": "OracleReader" + } + } + } + }, + { + "name": "new_reward_function", + "type": { + "option": { + "defined": { + "name": "RewardFunction" + } + } + } + }, + { + "name": "change_request", + "docs": [ + "The ChangeRequest PDA that was executed (and closed) by this instruction" + ], + "type": "pubkey" + }, + { + "name": "pp_created_at_timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "ChangeProposedEvent", + "docs": [ + "Emitted by: `propose_change`" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "performance_package", + "type": "pubkey" + }, + { + "name": "change_request", + "type": "pubkey" + }, + { + "name": "proposer", + "type": "pubkey" + }, + { + "name": "pda_nonce", + "type": "u32" + }, + { + "name": "new_recipient", + "type": { + "option": "pubkey" + } + }, + { + "name": "new_oracle_reader", + "type": { + "option": { + "defined": { + "name": "OracleReader" + } + } + } + }, + { + "name": "new_reward_function", + "type": { + "option": { + "defined": { + "name": "RewardFunction" + } + } + } + }, + { + "name": "pp_created_at_timestamp", + "docs": [ + "`PerformancePackage.created_at_timestamp` as stamped onto the ChangeRequest" + ], + "type": "i64" + } + ] + } + }, + { + "name": "ChangeRequest", + "docs": [ + "Temporary account for two-party approval flow.", + "Seeds: `[\"change_request\", performance_package, proposer, pda_nonce.to_le_bytes()]`" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "performance_package", + "docs": [ + "The performance package this change applies to" + ], + "type": "pubkey" + }, + { + "name": "proposer", + "docs": [ + "The proposer's pubkey at proposal time" + ], + "type": "pubkey" + }, + { + "name": "pp_created_at_timestamp", + "docs": [ + "PP's created_at_timestamp at proposal time; used to detect stale CRs after close/recreate" + ], + "type": "i64" + }, + { + "name": "proposed_at", + "docs": [ + "When the change was proposed" + ], + "type": "i64" + }, + { + "name": "pda_nonce", + "docs": [ + "For unique PDA derivation (allows multiple concurrent proposals)" + ], + "type": "u32" + }, + { + "name": "bump", + "type": "u8" + }, + { + "name": "new_recipient", + "docs": [ + "New recipient address (if changing)" + ], + "type": { + "option": "pubkey" + } + }, + { + "name": "new_oracle_reader", + "docs": [ + "New oracle configuration (if changing)" + ], + "type": { + "option": { + "defined": { + "name": "OracleReader" + } + } + } + }, + { + "name": "new_reward_function", + "docs": [ + "New reward function (if changing)" + ], + "type": { + "option": { + "defined": { + "name": "RewardFunction" + } + } + } + } + ] + } + }, + { + "name": "CommonFields", + "docs": [ + "Common fields included in all events for consistent metadata." + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "slot", + "type": "u64" + }, + { + "name": "unix_timestamp", + "type": "i64" + }, + { + "name": "performance_package_seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "InitializePerformancePackageArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "oracle_reader", + "type": { + "defined": { + "name": "OracleReader" + } + } + }, + { + "name": "reward_function", + "type": { + "defined": { + "name": "RewardFunction" + } + } + }, + { + "name": "min_unlock_timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "MintAuthority", + "type": { + "kind": "struct", + "fields": [ + { + "name": "mint_governor", + "type": "pubkey" + }, + { + "name": "authorized_minter", + "type": "pubkey" + }, + { + "name": "max_total", + "type": { + "option": "u64" + } + }, + { + "name": "total_minted", + "type": "u64" + }, + { + "name": "bump", + "type": "u8" + } + ] + } + }, + { + "name": "MintGovernor", + "type": { + "kind": "struct", + "fields": [ + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "admin", + "type": "pubkey" + }, + { + "name": "create_key", + "type": "pubkey" + }, + { + "name": "seq_num", + "type": "u64" + }, + { + "name": "bump", + "type": "u8" + } + ] + } + }, + { + "name": "OracleReader", + "docs": [ + "Oracle reader that knows how to read from an external oracle account.", + "Extracts a `value: u128` for reward calculations." + ], + "type": { + "kind": "enum", + "variants": [ + { + "name": "Time" + }, + { + "name": "FutarchyTwap", + "fields": [ + { + "name": "amm", + "docs": [ + "The Futarchy DAO account to read (contains embedded AMM)" + ], + "type": "pubkey" + }, + { + "name": "min_duration", + "docs": [ + "Minimum seconds between start and end" + ], + "type": "u32" + }, + { + "name": "start_value", + "docs": [ + "Start snapshot (recorded on start_unlock)" + ], + "type": "u128" + }, + { + "name": "start_time", + "type": "i64" + }, + { + "name": "end_value", + "docs": [ + "End snapshot (recorded on complete_unlock)" + ], + "type": "u128" + }, + { + "name": "end_time", + "type": "i64" + } + ] + } + ] + } + }, + { + "name": "PackageStatus", + "docs": [ + "Lifecycle state for the performance package." + ], + "type": { + "kind": "enum", + "variants": [ + { + "name": "Locked" + }, + { + "name": "Unlocking" + } + ] + } + }, + { + "name": "PerformancePackage", + "docs": [ + "The main account representing a performance package.", + "Acts as the `authorized_minter` in mint_governor.", + "Seeds: `[\"performance_package\", create_key]`" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "mint", + "docs": [ + "Token mint controlled by mint_governor" + ], + "type": "pubkey" + }, + { + "name": "mint_governor", + "docs": [ + "MintGovernor account" + ], + "type": "pubkey" + }, + { + "name": "mint_authority", + "docs": [ + "MintAuthority PDA for this PP" + ], + "type": "pubkey" + }, + { + "name": "authority", + "docs": [ + "Usually the DAO multisig vault - can modify PP" + ], + "type": "pubkey" + }, + { + "name": "recipient", + "docs": [ + "Usually the team multisig - receives minted tokens" + ], + "type": "pubkey" + }, + { + "name": "oracle_reader", + "docs": [ + "Stores start/end snapshots for oracle calculations" + ], + "type": { + "defined": { + "name": "OracleReader" + } + } + }, + { + "name": "reward_function", + "docs": [ + "How to calculate rewards" + ], + "type": { + "defined": { + "name": "RewardFunction" + } + } + }, + { + "name": "status", + "docs": [ + "Locked or Unlocking state" + ], + "type": { + "defined": { + "name": "PackageStatus" + } + } + }, + { + "name": "min_unlock_timestamp", + "docs": [ + "Can't start unlock before this time" + ], + "type": "i64" + }, + { + "name": "created_at_timestamp", + "docs": [ + "Timestamp when this PP was created; used to invalidate stale ChangeRequests" + ], + "type": "i64" + }, + { + "name": "total_rewards_paid_out", + "docs": [ + "Cumulative tokens minted to the recipient" + ], + "type": "u64" + }, + { + "name": "seq_num", + "docs": [ + "Event sequence number" + ], + "type": "u64" + }, + { + "name": "create_key", + "docs": [ + "Used for PDA derivation" + ], + "type": "pubkey" + }, + { + "name": "bump", + "docs": [ + "PDA bump" + ], + "type": "u8" + } + ] + } + }, + { + "name": "PerformancePackageClosedEvent", + "docs": [ + "Emitted by: `close_performance_package`" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "performance_package", + "type": "pubkey" + }, + { + "name": "total_rewards_paid_out", + "docs": [ + "Final cumulative amount paid" + ], + "type": "u64" + }, + { + "name": "pp_created_at_timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "PerformancePackageCreatedEvent", + "docs": [ + "Emitted by: `initialize_performance_package`" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "performance_package", + "type": "pubkey" + }, + { + "name": "mint", + "type": "pubkey" + }, + { + "name": "mint_governor", + "type": "pubkey" + }, + { + "name": "authority", + "type": "pubkey" + }, + { + "name": "recipient", + "type": "pubkey" + }, + { + "name": "create_key", + "type": "pubkey" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "oracle_reader", + "type": { + "defined": { + "name": "OracleReader" + } + } + }, + { + "name": "reward_function", + "type": { + "defined": { + "name": "RewardFunction" + } + } + }, + { + "name": "min_unlock_timestamp", + "type": "i64" + }, + { + "name": "pp_created_at_timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "ProposeChangeArgs", + "type": { + "kind": "struct", + "fields": [ + { + "name": "pda_nonce", + "type": "u32" + }, + { + "name": "new_recipient", + "type": { + "option": "pubkey" + } + }, + { + "name": "new_oracle_reader", + "type": { + "option": { + "defined": { + "name": "OracleReader" + } + } + } + }, + { + "name": "new_reward_function", + "type": { + "option": { + "defined": { + "name": "RewardFunction" + } + } + } + } + ] + } + }, + { + "name": "RewardFunction", + "docs": [ + "Reward function that calculates cumulative rewards from oracle values.", + "Returns total tokens deserved so far (not incremental)." + ], + "type": { + "kind": "enum", + "variants": [ + { + "name": "CliffLinear", + "fields": [ + { + "name": "cliff_value", + "type": "u128" + }, + { + "name": "end_value", + "type": "u128" + }, + { + "name": "cliff_amount", + "type": "u64" + }, + { + "name": "total_amount", + "docs": [ + "Total amount including cliff" + ], + "type": "u64" + } + ] + }, + { + "name": "Threshold", + "fields": [ + { + "name": "tranches", + "docs": [ + "Must be sorted by threshold ascending" + ], + "type": { + "vec": { + "defined": { + "name": "ThresholdTranche" + } + } + } + } + ] + } + ] + } + }, + { + "name": "ThresholdTranche", + "docs": [ + "A threshold tranche for step-based rewards." + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "threshold", + "docs": [ + "Oracle value threshold" + ], + "type": "u128" + }, + { + "name": "cumulative_amount", + "docs": [ + "Total tokens at this tranche (cumulative, not incremental)" + ], + "type": "u64" + } + ] + } + }, + { + "name": "UnlockCompletedEvent", + "docs": [ + "Emitted by: `complete_unlock`" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "performance_package", + "type": "pubkey" + }, + { + "name": "oracle_value", + "type": "u128" + }, + { + "name": "recipient", + "type": "pubkey" + }, + { + "name": "amount_minted", + "type": "u64" + }, + { + "name": "total_rewards_paid_out", + "docs": [ + "Cumulative after this unlock" + ], + "type": "u64" + }, + { + "name": "pp_created_at_timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "UnlockStartedEvent", + "docs": [ + "Emitted by: `start_unlock`" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "performance_package", + "type": "pubkey" + }, + { + "name": "start_time", + "type": "i64" + }, + { + "name": "start_oracle_value", + "type": "u128" + }, + { + "name": "pp_created_at_timestamp", + "type": "i64" + } + ] + } + } + ], + "constants": [ + { + "name": "MAX_MIN_DURATION", + "type": "u32", + "value": "31536000" + } + ] +} \ No newline at end of file diff --git a/sdk/src/performance_package_v2/v0.7/types/performance_package_v2.ts b/sdk/src/performance_package_v2/v0.7/types/performance_package_v2.ts index 64b030d7b..8a3ac46c8 100644 --- a/sdk/src/performance_package_v2/v0.7/types/performance_package_v2.ts +++ b/sdk/src/performance_package_v2/v0.7/types/performance_package_v2.ts @@ -1,320 +1,732 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL can be found at `target/idl/performance_package_v2.json`. + */ export type PerformancePackageV2 = { - version: "0.7.0"; - name: "performance_package_v2"; - constants: [ - { - name: "MAX_TRANCHES"; - type: { - defined: "usize"; - }; - value: "10"; - }, - { - name: "MAX_MIN_DURATION"; - type: "u32"; - value: "60 * 60 * 24 * 365"; - }, - ]; + address: "pPV2pfrxnmstSb9j7kEeCLny5BGj6SNwCWGd6xbGGzz"; + metadata: { + name: "performancePackageV2"; + version: "0.7.0"; + spec: "0.1.0"; + description: "Created with Anchor"; + }; instructions: [ { - name: "initializePerformancePackage"; + name: "changeAuthority"; + discriminator: [50, 106, 66, 104, 99, 118, 145, 88]; accounts: [ { name: "performancePackage"; - isMut: true; - isSigner: false; - }, - { - name: "mint"; - isMut: false; - isSigner: false; - }, - { - name: "mintGovernor"; - isMut: false; - isSigner: false; - }, - { - name: "mintAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "createKey"; - isMut: false; - isSigner: true; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 112, + 101, + 114, + 102, + 111, + 114, + 109, + 97, + 110, + 99, + 101, + 95, + 112, + 97, + 99, + 107, + 97, + 103, + 101, + ]; + }, + { + kind: "account"; + path: "performance_package.create_key"; + account: "performancePackage"; + }, + ]; + }; }, { name: "authority"; - isMut: false; - isSigner: false; - }, - { - name: "recipient"; - isMut: false; - isSigner: false; - }, - { - name: "payer"; - isMut: true; - isSigner: true; + docs: ["Must be the current authority of the performance package"]; + signer: true; + relations: ["performancePackage"]; }, { - name: "systemProgram"; - isMut: false; - isSigner: false; + name: "newAuthority"; + docs: ["The new authority address"]; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "args"; - type: { - defined: "InitializePerformancePackageArgs"; - }; }, ]; + args: []; }, { - name: "startUnlock"; + name: "closePerformancePackage"; + discriminator: [166, 35, 29, 1, 172, 39, 254, 135]; accounts: [ { name: "performancePackage"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 112, + 101, + 114, + 102, + 111, + 114, + 109, + 97, + 110, + 99, + 101, + 95, + 112, + 97, + 99, + 107, + 97, + 103, + 101, + ]; + }, + { + kind: "account"; + path: "performance_package.create_key"; + account: "performancePackage"; + }, + ]; + }; }, { - name: "signer"; - isMut: false; - isSigner: true; + name: "admin"; + signer: true; + }, + { + name: "rentDestination"; + writable: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { name: "completeUnlock"; + discriminator: [22, 203, 15, 189, 239, 125, 25, 132]; accounts: [ { name: "performancePackage"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 112, + 101, + 114, + 102, + 111, + 114, + 109, + 97, + 110, + 99, + 101, + 95, + 112, + 97, + 99, + 107, + 97, + 103, + 101, + ]; + }, + { + kind: "account"; + path: "performance_package.create_key"; + account: "performancePackage"; + }, + ]; + }; }, { name: "mintGovernor"; - isMut: true; - isSigner: false; + writable: true; }, { name: "mintAuthority"; - isMut: true; - isSigner: false; + writable: true; }, { name: "mint"; - isMut: true; - isSigner: false; + writable: true; }, { name: "recipientAta"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "performance_package.recipient"; + account: "performancePackage"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "mint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "signer"; - isMut: false; - isSigner: true; + signer: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "mintGovernorProgram"; - isMut: false; - isSigner: false; + address: "gvnr27cVeyW3AVf3acL7VCJ5WjGAphytnsgcK1feHyH"; }, { name: "mintGovernorEventAuthority"; - isMut: false; - isSigner: false; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { - name: "changeAuthority"; + name: "executeChange"; + discriminator: [104, 53, 136, 238, 82, 222, 200, 42]; accounts: [ { name: "performancePackage"; - isMut: true; - isSigner: false; + writable: true; + relations: ["changeRequest"]; }, { - name: "authority"; - isMut: false; - isSigner: true; - docs: ["Must be the current authority of the performance package"]; + name: "changeRequest"; + writable: true; }, { - name: "newAuthority"; - isMut: false; - isSigner: false; - docs: ["The new authority address"]; + name: "executor"; + signer: true; + }, + { + name: "rentDestination"; + writable: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; }, { - name: "proposeChange"; + name: "initializePerformancePackage"; + discriminator: [3, 171, 56, 55, 135, 100, 163, 186]; accounts: [ { name: "performancePackage"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 112, + 101, + 114, + 102, + 111, + 114, + 109, + 97, + 110, + 99, + 101, + 95, + 112, + 97, + 99, + 107, + 97, + 103, + 101, + ]; + }, + { + kind: "account"; + path: "createKey"; + }, + ]; + }; }, { - name: "changeRequest"; - isMut: true; - isSigner: false; + name: "mint"; + relations: ["mintGovernor"]; }, { - name: "proposer"; - isMut: false; - isSigner: true; + name: "mintGovernor"; + relations: ["mintAuthority"]; + }, + { + name: "mintAuthority"; + }, + { + name: "createKey"; + signer: true; + }, + { + name: "authority"; + }, + { + name: "recipient"; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "args"; type: { - defined: "ProposeChangeArgs"; + defined: { + name: "initializePerformancePackageArgs"; + }; }; }, ]; }, { - name: "executeChange"; + name: "proposeChange"; + discriminator: [167, 211, 18, 222, 93, 215, 74, 159]; accounts: [ { name: "performancePackage"; - isMut: true; - isSigner: false; + writable: true; }, { name: "changeRequest"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 99, + 104, + 97, + 110, + 103, + 101, + 95, + 114, + 101, + 113, + 117, + 101, + 115, + 116, + ]; + }, + { + kind: "account"; + path: "performancePackage"; + }, + { + kind: "account"; + path: "proposer"; + }, + { + kind: "arg"; + path: "args.pda_nonce"; + }, + ]; + }; }, { - name: "executor"; - isMut: false; - isSigner: true; + name: "proposer"; + signer: true; }, { - name: "rentDestination"; - isMut: true; - isSigner: false; + name: "payer"; + writable: true; + signer: true; + }, + { + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; - args: []; + args: [ + { + name: "args"; + type: { + defined: { + name: "proposeChangeArgs"; + }; + }; + }, + ]; }, { - name: "closePerformancePackage"; + name: "startUnlock"; + discriminator: [53, 202, 212, 31, 76, 178, 31, 123]; accounts: [ { name: "performancePackage"; - isMut: true; - isSigner: false; - }, - { - name: "admin"; - isMut: false; - isSigner: true; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 112, + 101, + 114, + 102, + 111, + 114, + 109, + 97, + 110, + 99, + 101, + 95, + 112, + 97, + 99, + 107, + 97, + 103, + 101, + ]; + }, + { + kind: "account"; + path: "performance_package.create_key"; + account: "performancePackage"; + }, + ]; + }; }, { - name: "rentDestination"; - isMut: true; - isSigner: false; + name: "signer"; + signer: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: []; @@ -323,217 +735,280 @@ export type PerformancePackageV2 = { accounts: [ { name: "changeRequest"; - docs: [ - "Temporary account for two-party approval flow.", - 'Seeds: `["change_request", performance_package, proposer, pda_nonce.to_le_bytes()]`', - ]; - type: { - kind: "struct"; - fields: [ - { - name: "performancePackage"; - docs: ["The performance package this change applies to"]; - type: "publicKey"; - }, - { - name: "proposer"; - docs: ["The proposer's pubkey at proposal time"]; - type: "publicKey"; - }, - { - name: "ppCreatedAtTimestamp"; - docs: [ - "PP's created_at_timestamp at proposal time; used to detect stale CRs after close/recreate", - ]; - type: "i64"; - }, - { - name: "proposedAt"; - docs: ["When the change was proposed"]; - type: "i64"; - }, - { - name: "pdaNonce"; - docs: [ - "For unique PDA derivation (allows multiple concurrent proposals)", - ]; - type: "u32"; - }, - { - name: "bump"; - type: "u8"; - }, - { - name: "newRecipient"; - docs: ["New recipient address (if changing)"]; - type: { - option: "publicKey"; - }; - }, - { - name: "newOracleReader"; - docs: ["New oracle configuration (if changing)"]; - type: { - option: { - defined: "OracleReader"; - }; - }; - }, - { - name: "newRewardFunction"; - docs: ["New reward function (if changing)"]; - type: { - option: { - defined: "RewardFunction"; - }; - }; - }, - ]; - }; + discriminator: [75, 130, 166, 47, 15, 217, 131, 190]; + }, + { + name: "mintAuthority"; + discriminator: [148, 0, 219, 228, 254, 237, 76, 128]; + }, + { + name: "mintGovernor"; + discriminator: [110, 173, 19, 114, 217, 193, 37, 71]; }, { name: "performancePackage"; - docs: [ - "The main account representing a performance package.", - "Acts as the `authorized_minter` in mint_governor.", - 'Seeds: `["performance_package", create_key]`', - ]; + discriminator: [228, 146, 174, 131, 121, 249, 99, 132]; + }, + ]; + events: [ + { + name: "authorityChangedEvent"; + discriminator: [85, 105, 159, 188, 6, 44, 52, 28]; + }, + { + name: "changeExecutedEvent"; + discriminator: [210, 68, 107, 108, 205, 125, 171, 37]; + }, + { + name: "changeProposedEvent"; + discriminator: [235, 3, 116, 187, 11, 199, 254, 249]; + }, + { + name: "performancePackageClosedEvent"; + discriminator: [6, 236, 112, 207, 221, 238, 59, 75]; + }, + { + name: "performancePackageCreatedEvent"; + discriminator: [201, 17, 26, 145, 170, 42, 219, 154]; + }, + { + name: "unlockCompletedEvent"; + discriminator: [218, 116, 8, 71, 184, 86, 230, 9]; + }, + { + name: "unlockStartedEvent"; + discriminator: [143, 238, 115, 206, 153, 246, 44, 253]; + }, + ]; + errors: [ + { + code: 6000; + name: "unauthorized"; + msg: "Signer is neither authority nor recipient"; + }, + { + code: 6001; + name: "invalidExecutor"; + msg: "Executor is not the opposite party from proposer"; + }, + { + code: 6002; + name: "invalidAuthority"; + msg: "Signer is not the current authority"; + }, + { + code: 6003; + name: "invalidAdmin"; + msg: "Signer is not the admin"; + }, + { + code: 6004; + name: "invalidMintGovernor"; + msg: "Mint governor does not match the provided mint"; + }, + { + code: 6005; + name: "invalidMintAuthority"; + msg: "Mint authority does not match expected configuration"; + }, + { + code: 6006; + name: "notLocked"; + msg: "Expected Locked status"; + }, + { + code: 6007; + name: "notUnlocking"; + msg: "Expected Unlocking status"; + }, + { + code: 6008; + name: "oracleMissingAccount"; + msg: "Expected remaining_accounts not provided"; + }, + { + code: 6009; + name: "oracleInvalidAccount"; + msg: "Account pubkey doesn't match expected"; + }, + { + code: 6010; + name: "oracleParseError"; + msg: "Failed to parse account data"; + }, + { + code: 6011; + name: "oracleInvalidState"; + msg: "Oracle state invalid"; + }, + { + code: 6012; + name: "oracleMinDurationNotReached"; + msg: "Minimum duration hasn't passed yet"; + }, + { + code: 6013; + name: "unlockTimestampNotReached"; + msg: "Minimum unlock timestamp not yet reached"; + }, + { + code: 6014; + name: "rewardCalculationOverflow"; + msg: "Math overflow in reward function"; + }, + { + code: 6015; + name: "invalidTranches"; + msg: "Tranches should be sorted and non-empty"; + }, + { + code: 6016; + name: "invalidVestingSchedule"; + msg: "Invalid vesting schedule configuration"; + }, + { + code: 6017; + name: "changeRequestNotFound"; + msg: "Missing proposal for execute"; + }, + { + code: 6018; + name: "noChangesProposed"; + msg: "All optional change fields are None"; + }, + { + code: 6019; + name: "minDurationTooLarge"; + msg: "min_duration exceeds maximum allowed (365 days)"; + }, + { + code: 6020; + name: "staleChangeRequest"; + msg: "Change request is stale: PP was recreated or the proposing party has changed"; + }, + ]; + types: [ + { + name: "authorityChangedEvent"; + docs: ["Emitted by: `change_authority`"]; type: { kind: "struct"; fields: [ { - name: "mint"; - docs: ["Token mint controlled by mint_governor"]; - type: "publicKey"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "mintGovernor"; - docs: ["MintGovernor account"]; - type: "publicKey"; + name: "performancePackage"; + type: "pubkey"; }, { - name: "mintAuthority"; - docs: ["MintAuthority PDA for this PP"]; - type: "publicKey"; + name: "oldAuthority"; + type: "pubkey"; }, { - name: "authority"; - docs: ["Usually the DAO multisig vault - can modify PP"]; - type: "publicKey"; + name: "newAuthority"; + type: "pubkey"; }, { - name: "recipient"; - docs: ["Usually the team multisig - receives minted tokens"]; - type: "publicKey"; + name: "ppCreatedAtTimestamp"; + type: "i64"; }, + ]; + }; + }, + { + name: "changeExecutedEvent"; + docs: ["Emitted by: `execute_change`"]; + type: { + kind: "struct"; + fields: [ { - name: "oracleReader"; - docs: ["Stores start/end snapshots for oracle calculations"]; + name: "common"; type: { - defined: "OracleReader"; + defined: { + name: "commonFields"; + }; }; }, { - name: "rewardFunction"; - docs: ["How to calculate rewards"]; + name: "performancePackage"; + type: "pubkey"; + }, + { + name: "executedBy"; + type: "pubkey"; + }, + { + name: "newRecipient"; type: { - defined: "RewardFunction"; + option: "pubkey"; }; }, { - name: "status"; - docs: ["Locked or Unlocking state"]; + name: "newOracleReader"; type: { - defined: "PackageStatus"; + option: { + defined: { + name: "oracleReader"; + }; + }; }; }, { - name: "minUnlockTimestamp"; - docs: ["Can't start unlock before this time"]; - type: "i64"; + name: "newRewardFunction"; + type: { + option: { + defined: { + name: "rewardFunction"; + }; + }; + }; }, { - name: "createdAtTimestamp"; + name: "changeRequest"; docs: [ - "Timestamp when this PP was created; used to invalidate stale ChangeRequests", + "The ChangeRequest PDA that was executed (and closed) by this instruction", ]; - type: "i64"; - }, - { - name: "totalRewardsPaidOut"; - docs: ["Cumulative tokens minted to the recipient"]; - type: "u64"; - }, - { - name: "seqNum"; - docs: ["Event sequence number"]; - type: "u64"; - }, - { - name: "createKey"; - docs: ["Used for PDA derivation"]; - type: "publicKey"; - }, - { - name: "bump"; - docs: ["PDA bump"]; - type: "u8"; - }, - ]; - }; - }, - ]; - types: [ - { - name: "CommonFields"; - docs: ["Common fields included in all events for consistent metadata."]; - type: { - kind: "struct"; - fields: [ - { - name: "slot"; - type: "u64"; + type: "pubkey"; }, { - name: "unixTimestamp"; + name: "ppCreatedAtTimestamp"; type: "i64"; }, - { - name: "performancePackageSeqNum"; - type: "u64"; - }, ]; }; }, { - name: "InitializePerformancePackageArgs"; + name: "changeProposedEvent"; + docs: ["Emitted by: `propose_change`"]; type: { kind: "struct"; fields: [ { - name: "oracleReader"; + name: "common"; type: { - defined: "OracleReader"; + defined: { + name: "commonFields"; + }; }; }, { - name: "rewardFunction"; - type: { - defined: "RewardFunction"; - }; + name: "performancePackage"; + type: "pubkey"; }, { - name: "minUnlockTimestamp"; - type: "i64"; + name: "changeRequest"; + type: "pubkey"; + }, + { + name: "proposer"; + type: "pubkey"; }, - ]; - }; - }, - { - name: "ProposeChangeArgs"; - type: { - kind: "struct"; - fields: [ { name: "pdaNonce"; type: "u32"; @@ -541,14 +1016,16 @@ export type PerformancePackageV2 = { { name: "newRecipient"; type: { - option: "publicKey"; + option: "pubkey"; }; }, { name: "newOracleReader"; type: { option: { - defined: "OracleReader"; + defined: { + name: "oracleReader"; + }; }; }; }, @@ -556,51 +1033,205 @@ export type PerformancePackageV2 = { name: "newRewardFunction"; type: { option: { - defined: "RewardFunction"; + defined: { + name: "rewardFunction"; + }; }; }; }, + { + name: "ppCreatedAtTimestamp"; + docs: [ + "`PerformancePackage.created_at_timestamp` as stamped onto the ChangeRequest", + ]; + type: "i64"; + }, ]; }; }, { - name: "ThresholdTranche"; - docs: ["A threshold tranche for step-based rewards."]; + name: "changeRequest"; + docs: [ + "Temporary account for two-party approval flow.", + 'Seeds: `["change_request", performance_package, proposer, pda_nonce.to_le_bytes()]`', + ]; type: { kind: "struct"; fields: [ { - name: "threshold"; - docs: ["Oracle value threshold"]; - type: "u128"; + name: "performancePackage"; + docs: ["The performance package this change applies to"]; + type: "pubkey"; }, { - name: "cumulativeAmount"; + name: "proposer"; + docs: ["The proposer's pubkey at proposal time"]; + type: "pubkey"; + }, + { + name: "ppCreatedAtTimestamp"; docs: [ - "Total tokens at this tranche (cumulative, not incremental)", + "PP's created_at_timestamp at proposal time; used to detect stale CRs after close/recreate", ]; - type: "u64"; + type: "i64"; }, - ]; - }; - }, + { + name: "proposedAt"; + docs: ["When the change was proposed"]; + type: "i64"; + }, + { + name: "pdaNonce"; + docs: [ + "For unique PDA derivation (allows multiple concurrent proposals)", + ]; + type: "u32"; + }, + { + name: "bump"; + type: "u8"; + }, + { + name: "newRecipient"; + docs: ["New recipient address (if changing)"]; + type: { + option: "pubkey"; + }; + }, + { + name: "newOracleReader"; + docs: ["New oracle configuration (if changing)"]; + type: { + option: { + defined: { + name: "oracleReader"; + }; + }; + }; + }, + { + name: "newRewardFunction"; + docs: ["New reward function (if changing)"]; + type: { + option: { + defined: { + name: "rewardFunction"; + }; + }; + }; + }, + ]; + }; + }, { - name: "PackageStatus"; - docs: ["Lifecycle state for the performance package."]; + name: "commonFields"; + docs: ["Common fields included in all events for consistent metadata."]; type: { - kind: "enum"; - variants: [ + kind: "struct"; + fields: [ + { + name: "slot"; + type: "u64"; + }, + { + name: "unixTimestamp"; + type: "i64"; + }, + { + name: "performancePackageSeqNum"; + type: "u64"; + }, + ]; + }; + }, + { + name: "initializePerformancePackageArgs"; + type: { + kind: "struct"; + fields: [ + { + name: "oracleReader"; + type: { + defined: { + name: "oracleReader"; + }; + }; + }, + { + name: "rewardFunction"; + type: { + defined: { + name: "rewardFunction"; + }; + }; + }, + { + name: "minUnlockTimestamp"; + type: "i64"; + }, + ]; + }; + }, + { + name: "mintAuthority"; + type: { + kind: "struct"; + fields: [ + { + name: "mintGovernor"; + type: "pubkey"; + }, + { + name: "authorizedMinter"; + type: "pubkey"; + }, { - name: "Locked"; + name: "maxTotal"; + type: { + option: "u64"; + }; + }, + { + name: "totalMinted"; + type: "u64"; + }, + { + name: "bump"; + type: "u8"; + }, + ]; + }; + }, + { + name: "mintGovernor"; + type: { + kind: "struct"; + fields: [ + { + name: "mint"; + type: "pubkey"; + }, + { + name: "admin"; + type: "pubkey"; + }, + { + name: "createKey"; + type: "pubkey"; }, { - name: "Unlocking"; + name: "seqNum"; + type: "u64"; + }, + { + name: "bump"; + type: "u8"; }, ]; }; }, { - name: "OracleReader"; + name: "oracleReader"; docs: [ "Oracle reader that knows how to read from an external oracle account.", "Extracts a `value: u128` for reward calculations.", @@ -609,17 +1240,17 @@ export type PerformancePackageV2 = { kind: "enum"; variants: [ { - name: "Time"; + name: "time"; }, { - name: "FutarchyTwap"; + name: "futarchyTwap"; fields: [ { name: "amm"; docs: [ "The Futarchy DAO account to read (contains embedded AMM)", ]; - type: "publicKey"; + type: "pubkey"; }, { name: "minDuration"; @@ -650,1618 +1281,406 @@ export type PerformancePackageV2 = { }; }, { - name: "RewardFunction"; - docs: [ - "Reward function that calculates cumulative rewards from oracle values.", - "Returns total tokens deserved so far (not incremental).", - ]; + name: "packageStatus"; + docs: ["Lifecycle state for the performance package."]; type: { kind: "enum"; variants: [ { - name: "CliffLinear"; - fields: [ - { - name: "cliffValue"; - type: "u128"; - }, - { - name: "endValue"; - type: "u128"; - }, - { - name: "cliffAmount"; - type: "u64"; - }, - { - name: "totalAmount"; - docs: ["Total amount including cliff"]; - type: "u64"; - }, - ]; + name: "locked"; }, { - name: "Threshold"; - fields: [ - { - name: "tranches"; - docs: ["Must be sorted by threshold ascending"]; - type: { - vec: { - defined: "ThresholdTranche"; - }; - }; - }, - ]; + name: "unlocking"; }, ]; }; }, - ]; - events: [ - { - name: "PerformancePackageCreatedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "performancePackage"; - type: "publicKey"; - index: false; - }, - { - name: "mint"; - type: "publicKey"; - index: false; - }, - { - name: "mintGovernor"; - type: "publicKey"; - index: false; - }, - { - name: "authority"; - type: "publicKey"; - index: false; - }, - { - name: "recipient"; - type: "publicKey"; - index: false; - }, - { - name: "createKey"; - type: "publicKey"; - index: false; - }, - { - name: "pdaBump"; - type: "u8"; - index: false; - }, - { - name: "oracleReader"; - type: { - defined: "OracleReader"; - }; - index: false; - }, - { - name: "rewardFunction"; - type: { - defined: "RewardFunction"; - }; - index: false; - }, - { - name: "minUnlockTimestamp"; - type: "i64"; - index: false; - }, - { - name: "ppCreatedAtTimestamp"; - type: "i64"; - index: false; - }, - ]; - }, - { - name: "UnlockStartedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "performancePackage"; - type: "publicKey"; - index: false; - }, - { - name: "startTime"; - type: "i64"; - index: false; - }, - { - name: "startOracleValue"; - type: "u128"; - index: false; - }, - { - name: "ppCreatedAtTimestamp"; - type: "i64"; - index: false; - }, - ]; - }, { - name: "UnlockCompletedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "performancePackage"; - type: "publicKey"; - index: false; - }, - { - name: "oracleValue"; - type: "u128"; - index: false; - }, - { - name: "recipient"; - type: "publicKey"; - index: false; - }, - { - name: "amountMinted"; - type: "u64"; - index: false; - }, - { - name: "totalRewardsPaidOut"; - type: "u64"; - index: false; - }, - { - name: "ppCreatedAtTimestamp"; - type: "i64"; - index: false; - }, + name: "performancePackage"; + docs: [ + "The main account representing a performance package.", + "Acts as the `authorized_minter` in mint_governor.", + 'Seeds: `["performance_package", create_key]`', ]; - }, - { - name: "AuthorityChangedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "performancePackage"; - type: "publicKey"; - index: false; - }, - { - name: "oldAuthority"; - type: "publicKey"; - index: false; - }, - { - name: "newAuthority"; - type: "publicKey"; - index: false; - }, - { - name: "ppCreatedAtTimestamp"; - type: "i64"; - index: false; - }, - ]; - }, - { - name: "ChangeProposedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "performancePackage"; - type: "publicKey"; - index: false; - }, - { - name: "changeRequest"; - type: "publicKey"; - index: false; - }, - { - name: "proposer"; - type: "publicKey"; - index: false; - }, - { - name: "pdaNonce"; - type: "u32"; - index: false; - }, - { - name: "newRecipient"; - type: { - option: "publicKey"; - }; - index: false; - }, - { - name: "newOracleReader"; - type: { - option: { - defined: "OracleReader"; - }; - }; - index: false; - }, - { - name: "newRewardFunction"; - type: { - option: { - defined: "RewardFunction"; - }; - }; - index: false; - }, - { - name: "ppCreatedAtTimestamp"; - type: "i64"; - index: false; - }, - ]; - }, - { - name: "ChangeExecutedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "performancePackage"; - type: "publicKey"; - index: false; - }, - { - name: "executedBy"; - type: "publicKey"; - index: false; - }, - { - name: "newRecipient"; - type: { - option: "publicKey"; - }; - index: false; - }, - { - name: "newOracleReader"; - type: { - option: { - defined: "OracleReader"; - }; - }; - index: false; - }, - { - name: "newRewardFunction"; - type: { - option: { - defined: "RewardFunction"; - }; - }; - index: false; - }, - { - name: "changeRequest"; - type: "publicKey"; - index: false; - }, - { - name: "ppCreatedAtTimestamp"; - type: "i64"; - index: false; - }, - ]; - }, - { - name: "PerformancePackageClosedEvent"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "performancePackage"; - type: "publicKey"; - index: false; - }, - { - name: "totalRewardsPaidOut"; - type: "u64"; - index: false; - }, - { - name: "ppCreatedAtTimestamp"; - type: "i64"; - index: false; - }, - ]; - }, - ]; - errors: [ - { - code: 6000; - name: "Unauthorized"; - msg: "Signer is neither authority nor recipient"; - }, - { - code: 6001; - name: "InvalidExecutor"; - msg: "Executor is not the opposite party from proposer"; - }, - { - code: 6002; - name: "InvalidAuthority"; - msg: "Signer is not the current authority"; - }, - { - code: 6003; - name: "InvalidAdmin"; - msg: "Signer is not the admin"; - }, - { - code: 6004; - name: "InvalidMintGovernor"; - msg: "Mint governor does not match the provided mint"; - }, - { - code: 6005; - name: "InvalidMintAuthority"; - msg: "Mint authority does not match expected configuration"; - }, - { - code: 6006; - name: "NotLocked"; - msg: "Expected Locked status"; - }, - { - code: 6007; - name: "NotUnlocking"; - msg: "Expected Unlocking status"; - }, - { - code: 6008; - name: "OracleMissingAccount"; - msg: "Expected remaining_accounts not provided"; - }, - { - code: 6009; - name: "OracleInvalidAccount"; - msg: "Account pubkey doesn't match expected"; - }, - { - code: 6010; - name: "OracleParseError"; - msg: "Failed to parse account data"; - }, - { - code: 6011; - name: "OracleInvalidState"; - msg: "Oracle state invalid"; - }, - { - code: 6012; - name: "OracleMinDurationNotReached"; - msg: "Minimum duration hasn't passed yet"; - }, - { - code: 6013; - name: "UnlockTimestampNotReached"; - msg: "Minimum unlock timestamp not yet reached"; - }, - { - code: 6014; - name: "RewardCalculationOverflow"; - msg: "Math overflow in reward function"; - }, - { - code: 6015; - name: "InvalidTranches"; - msg: "Tranches should be sorted and non-empty"; - }, - { - code: 6016; - name: "InvalidVestingSchedule"; - msg: "Invalid vesting schedule configuration"; - }, - { - code: 6017; - name: "ChangeRequestNotFound"; - msg: "Missing proposal for execute"; - }, - { - code: 6018; - name: "NoChangesProposed"; - msg: "All optional change fields are None"; - }, - { - code: 6019; - name: "MinDurationTooLarge"; - msg: "min_duration exceeds maximum allowed (365 days)"; - }, - { - code: 6020; - name: "StaleChangeRequest"; - msg: "Change request is stale: PP was recreated or the proposing party has changed"; - }, - ]; -}; - -export const IDL: PerformancePackageV2 = { - version: "0.7.0", - name: "performance_package_v2", - constants: [ - { - name: "MAX_TRANCHES", - type: { - defined: "usize", - }, - value: "10", - }, - { - name: "MAX_MIN_DURATION", - type: "u32", - value: "60 * 60 * 24 * 365", - }, - ], - instructions: [ - { - name: "initializePerformancePackage", - accounts: [ - { - name: "performancePackage", - isMut: true, - isSigner: false, - }, - { - name: "mint", - isMut: false, - isSigner: false, - }, - { - name: "mintGovernor", - isMut: false, - isSigner: false, - }, - { - name: "mintAuthority", - isMut: false, - isSigner: false, - }, - { - name: "createKey", - isMut: false, - isSigner: true, - }, - { - name: "authority", - isMut: false, - isSigner: false, - }, - { - name: "recipient", - isMut: false, - 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: "InitializePerformancePackageArgs", - }, - }, - ], - }, - { - name: "startUnlock", - accounts: [ - { - name: "performancePackage", - isMut: true, - isSigner: false, - }, - { - name: "signer", - isMut: false, - isSigner: true, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "completeUnlock", - accounts: [ - { - name: "performancePackage", - isMut: true, - isSigner: false, - }, - { - name: "mintGovernor", - isMut: true, - isSigner: false, - }, - { - name: "mintAuthority", - isMut: true, - isSigner: false, - }, - { - name: "mint", - isMut: true, - isSigner: false, - }, - { - name: "recipientAta", - isMut: true, - isSigner: false, - }, - { - name: "signer", - isMut: false, - isSigner: true, - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - { - name: "mintGovernorProgram", - isMut: false, - isSigner: false, - }, - { - name: "mintGovernorEventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "changeAuthority", - accounts: [ - { - name: "performancePackage", - isMut: true, - isSigner: false, - }, - { - name: "authority", - isMut: false, - isSigner: true, - docs: ["Must be the current authority of the performance package"], - }, - { - name: "newAuthority", - isMut: false, - isSigner: false, - docs: ["The new authority address"], - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "proposeChange", - accounts: [ - { - name: "performancePackage", - isMut: true, - isSigner: false, - }, - { - name: "changeRequest", - 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: "args", - type: { - defined: "ProposeChangeArgs", - }, - }, - ], - }, - { - name: "executeChange", - accounts: [ - { - name: "performancePackage", - isMut: true, - isSigner: false, - }, - { - name: "changeRequest", - isMut: true, - isSigner: false, - }, - { - name: "executor", - isMut: false, - isSigner: true, - }, - { - name: "rentDestination", - isMut: true, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "closePerformancePackage", - accounts: [ - { - name: "performancePackage", - isMut: true, - isSigner: false, - }, - { - name: "admin", - isMut: false, - isSigner: true, - }, - { - name: "rentDestination", - isMut: true, - isSigner: false, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: "changeRequest", - docs: [ - "Temporary account for two-party approval flow.", - 'Seeds: `["change_request", performance_package, proposer, pda_nonce.to_le_bytes()]`', - ], type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "performancePackage", - docs: ["The performance package this change applies to"], - type: "publicKey", - }, - { - name: "proposer", - docs: ["The proposer's pubkey at proposal time"], - type: "publicKey", + name: "mint"; + docs: ["Token mint controlled by mint_governor"]; + type: "pubkey"; }, { - name: "ppCreatedAtTimestamp", - docs: [ - "PP's created_at_timestamp at proposal time; used to detect stale CRs after close/recreate", - ], - type: "i64", + name: "mintGovernor"; + docs: ["MintGovernor account"]; + type: "pubkey"; }, { - name: "proposedAt", - docs: ["When the change was proposed"], - type: "i64", + name: "mintAuthority"; + docs: ["MintAuthority PDA for this PP"]; + type: "pubkey"; }, { - name: "pdaNonce", - docs: [ - "For unique PDA derivation (allows multiple concurrent proposals)", - ], - type: "u32", + name: "authority"; + docs: ["Usually the DAO multisig vault - can modify PP"]; + type: "pubkey"; }, { - name: "bump", - type: "u8", + name: "recipient"; + docs: ["Usually the team multisig - receives minted tokens"]; + type: "pubkey"; }, { - name: "newRecipient", - docs: ["New recipient address (if changing)"], + name: "oracleReader"; + docs: ["Stores start/end snapshots for oracle calculations"]; type: { - option: "publicKey", - }, + defined: { + name: "oracleReader"; + }; + }; }, { - name: "newOracleReader", - docs: ["New oracle configuration (if changing)"], + name: "rewardFunction"; + docs: ["How to calculate rewards"]; type: { - option: { - defined: "OracleReader", - }, - }, + defined: { + name: "rewardFunction"; + }; + }; }, { - name: "newRewardFunction", - docs: ["New reward function (if changing)"], + name: "status"; + docs: ["Locked or Unlocking state"]; type: { - option: { - defined: "RewardFunction", - }, - }, - }, - ], - }, - }, - { - name: "performancePackage", - docs: [ - "The main account representing a performance package.", - "Acts as the `authorized_minter` in mint_governor.", - 'Seeds: `["performance_package", create_key]`', - ], - type: { - kind: "struct", - fields: [ - { - name: "mint", - docs: ["Token mint controlled by mint_governor"], - type: "publicKey", + defined: { + name: "packageStatus"; + }; + }; }, { - name: "mintGovernor", - docs: ["MintGovernor account"], - type: "publicKey", + name: "minUnlockTimestamp"; + docs: ["Can't start unlock before this time"]; + type: "i64"; }, { - name: "mintAuthority", - docs: ["MintAuthority PDA for this PP"], - type: "publicKey", + name: "createdAtTimestamp"; + docs: [ + "Timestamp when this PP was created; used to invalidate stale ChangeRequests", + ]; + type: "i64"; }, { - name: "authority", - docs: ["Usually the DAO multisig vault - can modify PP"], - type: "publicKey", + name: "totalRewardsPaidOut"; + docs: ["Cumulative tokens minted to the recipient"]; + type: "u64"; }, { - name: "recipient", - docs: ["Usually the team multisig - receives minted tokens"], - type: "publicKey", + name: "seqNum"; + docs: ["Event sequence number"]; + type: "u64"; }, { - name: "oracleReader", - docs: ["Stores start/end snapshots for oracle calculations"], - type: { - defined: "OracleReader", - }, + name: "createKey"; + docs: ["Used for PDA derivation"]; + type: "pubkey"; }, { - name: "rewardFunction", - docs: ["How to calculate rewards"], - type: { - defined: "RewardFunction", - }, + name: "bump"; + docs: ["PDA bump"]; + type: "u8"; }, + ]; + }; + }, + { + name: "performancePackageClosedEvent"; + docs: ["Emitted by: `close_performance_package`"]; + type: { + kind: "struct"; + fields: [ { - name: "status", - docs: ["Locked or Unlocking state"], + name: "common"; type: { - defined: "PackageStatus", - }, - }, - { - name: "minUnlockTimestamp", - docs: ["Can't start unlock before this time"], - type: "i64", - }, - { - name: "createdAtTimestamp", - docs: [ - "Timestamp when this PP was created; used to invalidate stale ChangeRequests", - ], - type: "i64", - }, - { - name: "totalRewardsPaidOut", - docs: ["Cumulative tokens minted to the recipient"], - type: "u64", + defined: { + name: "commonFields"; + }; + }; }, { - name: "seqNum", - docs: ["Event sequence number"], - type: "u64", + name: "performancePackage"; + type: "pubkey"; }, { - name: "createKey", - docs: ["Used for PDA derivation"], - type: "publicKey", + name: "totalRewardsPaidOut"; + docs: ["Final cumulative amount paid"]; + type: "u64"; }, { - name: "bump", - docs: ["PDA bump"], - type: "u8", + name: "ppCreatedAtTimestamp"; + type: "i64"; }, - ], - }, + ]; + }; }, - ], - types: [ { - name: "CommonFields", - docs: ["Common fields included in all events for consistent metadata."], + name: "performancePackageCreatedEvent"; + docs: ["Emitted by: `initialize_performance_package`"]; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "slot", - type: "u64", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "unixTimestamp", - type: "i64", + name: "performancePackage"; + type: "pubkey"; }, { - name: "performancePackageSeqNum", - type: "u64", + name: "mint"; + type: "pubkey"; }, - ], - }, - }, - { - name: "InitializePerformancePackageArgs", - type: { - kind: "struct", - fields: [ { - name: "oracleReader", - type: { - defined: "OracleReader", - }, + name: "mintGovernor"; + type: "pubkey"; }, { - name: "rewardFunction", - type: { - defined: "RewardFunction", - }, + name: "authority"; + type: "pubkey"; }, { - name: "minUnlockTimestamp", - type: "i64", + name: "recipient"; + type: "pubkey"; }, - ], - }, - }, - { - name: "ProposeChangeArgs", - type: { - kind: "struct", - fields: [ { - name: "pdaNonce", - type: "u32", + name: "createKey"; + type: "pubkey"; }, { - name: "newRecipient", - type: { - option: "publicKey", - }, + name: "pdaBump"; + type: "u8"; }, { - name: "newOracleReader", + name: "oracleReader"; type: { - option: { - defined: "OracleReader", - }, - }, + defined: { + name: "oracleReader"; + }; + }; }, { - name: "newRewardFunction", + name: "rewardFunction"; type: { - option: { - defined: "RewardFunction", - }, - }, + defined: { + name: "rewardFunction"; + }; + }; }, - ], - }, - }, - { - name: "ThresholdTranche", - docs: ["A threshold tranche for step-based rewards."], - type: { - kind: "struct", - fields: [ { - name: "threshold", - docs: ["Oracle value threshold"], - type: "u128", + name: "minUnlockTimestamp"; + type: "i64"; }, { - name: "cumulativeAmount", - docs: [ - "Total tokens at this tranche (cumulative, not incremental)", - ], - type: "u64", + name: "ppCreatedAtTimestamp"; + type: "i64"; }, - ], - }, + ]; + }; }, { - name: "PackageStatus", - docs: ["Lifecycle state for the performance package."], + name: "proposeChangeArgs"; type: { - kind: "enum", - variants: [ + kind: "struct"; + fields: [ { - name: "Locked", + name: "pdaNonce"; + type: "u32"; }, { - name: "Unlocking", + name: "newRecipient"; + type: { + option: "pubkey"; + }; }, - ], - }, - }, - { - name: "OracleReader", - docs: [ - "Oracle reader that knows how to read from an external oracle account.", - "Extracts a `value: u128` for reward calculations.", - ], - type: { - kind: "enum", - variants: [ { - name: "Time", + name: "newOracleReader"; + type: { + option: { + defined: { + name: "oracleReader"; + }; + }; + }; }, - { - name: "FutarchyTwap", - fields: [ - { - name: "amm", - docs: [ - "The Futarchy DAO account to read (contains embedded AMM)", - ], - type: "publicKey", - }, - { - name: "minDuration", - docs: ["Minimum seconds between start and end"], - type: "u32", - }, - { - name: "startValue", - docs: ["Start snapshot (recorded on start_unlock)"], - type: "u128", - }, - { - name: "startTime", - type: "i64", - }, - { - name: "endValue", - docs: ["End snapshot (recorded on complete_unlock)"], - type: "u128", - }, - { - name: "endTime", - type: "i64", - }, - ], + { + name: "newRewardFunction"; + type: { + option: { + defined: { + name: "rewardFunction"; + }; + }; + }; }, - ], - }, + ]; + }; }, { - name: "RewardFunction", + name: "rewardFunction"; docs: [ "Reward function that calculates cumulative rewards from oracle values.", "Returns total tokens deserved so far (not incremental).", - ], + ]; type: { - kind: "enum", + kind: "enum"; variants: [ { - name: "CliffLinear", + name: "cliffLinear"; fields: [ { - name: "cliffValue", - type: "u128", + name: "cliffValue"; + type: "u128"; }, { - name: "endValue", - type: "u128", + name: "endValue"; + type: "u128"; }, { - name: "cliffAmount", - type: "u64", + name: "cliffAmount"; + type: "u64"; }, { - name: "totalAmount", - docs: ["Total amount including cliff"], - type: "u64", + name: "totalAmount"; + docs: ["Total amount including cliff"]; + type: "u64"; }, - ], + ]; }, { - name: "Threshold", + name: "threshold"; fields: [ { - name: "tranches", - docs: ["Must be sorted by threshold ascending"], + name: "tranches"; + docs: ["Must be sorted by threshold ascending"]; type: { vec: { - defined: "ThresholdTranche", - }, - }, + defined: { + name: "thresholdTranche"; + }; + }; + }; }, - ], + ]; }, - ], - }, + ]; + }; }, - ], - events: [ { - name: "PerformancePackageCreatedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "performancePackage", - type: "publicKey", - index: false, - }, - { - name: "mint", - type: "publicKey", - index: false, - }, - { - name: "mintGovernor", - type: "publicKey", - index: false, - }, - { - name: "authority", - type: "publicKey", - index: false, - }, - { - name: "recipient", - type: "publicKey", - index: false, - }, - { - name: "createKey", - type: "publicKey", - index: false, - }, - { - name: "pdaBump", - type: "u8", - index: false, - }, - { - name: "oracleReader", - type: { - defined: "OracleReader", + name: "thresholdTranche"; + docs: ["A threshold tranche for step-based rewards."]; + type: { + kind: "struct"; + fields: [ + { + name: "threshold"; + docs: ["Oracle value threshold"]; + type: "u128"; }, - index: false, - }, - { - name: "rewardFunction", - type: { - defined: "RewardFunction", + { + name: "cumulativeAmount"; + docs: [ + "Total tokens at this tranche (cumulative, not incremental)", + ]; + type: "u64"; }, - index: false, - }, - { - name: "minUnlockTimestamp", - type: "i64", - index: false, - }, - { - name: "ppCreatedAtTimestamp", - type: "i64", - index: false, - }, - ], + ]; + }; }, { - name: "UnlockStartedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "unlockCompletedEvent"; + docs: ["Emitted by: `complete_unlock`"]; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, - index: false, - }, - { - name: "performancePackage", - type: "publicKey", - index: false, - }, - { - name: "startTime", - type: "i64", - index: false, - }, - { - name: "startOracleValue", - type: "u128", - index: false, - }, - { - name: "ppCreatedAtTimestamp", - type: "i64", - index: false, - }, - ], - }, - { - name: "UnlockCompletedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "performancePackage"; + type: "pubkey"; }, - index: false, - }, - { - name: "performancePackage", - type: "publicKey", - index: false, - }, - { - name: "oracleValue", - type: "u128", - index: false, - }, - { - name: "recipient", - type: "publicKey", - index: false, - }, - { - name: "amountMinted", - type: "u64", - index: false, - }, - { - name: "totalRewardsPaidOut", - type: "u64", - index: false, - }, - { - name: "ppCreatedAtTimestamp", - type: "i64", - index: false, - }, - ], - }, - { - name: "AuthorityChangedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "oracleValue"; + type: "u128"; }, - index: false, - }, - { - name: "performancePackage", - type: "publicKey", - index: false, - }, - { - name: "oldAuthority", - type: "publicKey", - index: false, - }, - { - name: "newAuthority", - type: "publicKey", - index: false, - }, - { - name: "ppCreatedAtTimestamp", - type: "i64", - index: false, - }, - ], - }, - { - name: "ChangeProposedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "recipient"; + type: "pubkey"; }, - index: false, - }, - { - name: "performancePackage", - type: "publicKey", - index: false, - }, - { - name: "changeRequest", - type: "publicKey", - index: false, - }, - { - name: "proposer", - type: "publicKey", - index: false, - }, - { - name: "pdaNonce", - type: "u32", - index: false, - }, - { - name: "newRecipient", - type: { - option: "publicKey", + { + name: "amountMinted"; + type: "u64"; }, - index: false, - }, - { - name: "newOracleReader", - type: { - option: { - defined: "OracleReader", - }, + { + name: "totalRewardsPaidOut"; + docs: ["Cumulative after this unlock"]; + type: "u64"; }, - index: false, - }, - { - name: "newRewardFunction", - type: { - option: { - defined: "RewardFunction", - }, + { + name: "ppCreatedAtTimestamp"; + type: "i64"; }, - index: false, - }, - { - name: "ppCreatedAtTimestamp", - type: "i64", - index: false, - }, - ], + ]; + }; }, { - name: "ChangeExecutedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + name: "unlockStartedEvent"; + docs: ["Emitted by: `start_unlock`"]; + type: { + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, - index: false, - }, - { - name: "performancePackage", - type: "publicKey", - index: false, - }, - { - name: "executedBy", - type: "publicKey", - index: false, - }, - { - name: "newRecipient", - type: { - option: "publicKey", + { + name: "performancePackage"; + type: "pubkey"; }, - index: false, - }, - { - name: "newOracleReader", - type: { - option: { - defined: "OracleReader", - }, + { + name: "startTime"; + type: "i64"; }, - index: false, - }, - { - name: "newRewardFunction", - type: { - option: { - defined: "RewardFunction", - }, + { + name: "startOracleValue"; + type: "u128"; }, - index: false, - }, - { - name: "changeRequest", - type: "publicKey", - index: false, - }, - { - name: "ppCreatedAtTimestamp", - type: "i64", - index: false, - }, - ], - }, - { - name: "PerformancePackageClosedEvent", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", + { + name: "ppCreatedAtTimestamp"; + type: "i64"; }, - index: false, - }, - { - name: "performancePackage", - type: "publicKey", - index: false, - }, - { - name: "totalRewardsPaidOut", - type: "u64", - index: false, - }, - { - name: "ppCreatedAtTimestamp", - type: "i64", - index: false, - }, - ], - }, - ], - errors: [ - { - code: 6000, - name: "Unauthorized", - msg: "Signer is neither authority nor recipient", - }, - { - code: 6001, - name: "InvalidExecutor", - msg: "Executor is not the opposite party from proposer", - }, - { - code: 6002, - name: "InvalidAuthority", - msg: "Signer is not the current authority", - }, - { - code: 6003, - name: "InvalidAdmin", - msg: "Signer is not the admin", - }, - { - code: 6004, - name: "InvalidMintGovernor", - msg: "Mint governor does not match the provided mint", - }, - { - code: 6005, - name: "InvalidMintAuthority", - msg: "Mint authority does not match expected configuration", - }, - { - code: 6006, - name: "NotLocked", - msg: "Expected Locked status", - }, - { - code: 6007, - name: "NotUnlocking", - msg: "Expected Unlocking status", - }, - { - code: 6008, - name: "OracleMissingAccount", - msg: "Expected remaining_accounts not provided", - }, - { - code: 6009, - name: "OracleInvalidAccount", - msg: "Account pubkey doesn't match expected", - }, - { - code: 6010, - name: "OracleParseError", - msg: "Failed to parse account data", - }, - { - code: 6011, - name: "OracleInvalidState", - msg: "Oracle state invalid", - }, - { - code: 6012, - name: "OracleMinDurationNotReached", - msg: "Minimum duration hasn't passed yet", - }, - { - code: 6013, - name: "UnlockTimestampNotReached", - msg: "Minimum unlock timestamp not yet reached", - }, - { - code: 6014, - name: "RewardCalculationOverflow", - msg: "Math overflow in reward function", - }, - { - code: 6015, - name: "InvalidTranches", - msg: "Tranches should be sorted and non-empty", - }, - { - code: 6016, - name: "InvalidVestingSchedule", - msg: "Invalid vesting schedule configuration", - }, - { - code: 6017, - name: "ChangeRequestNotFound", - msg: "Missing proposal for execute", - }, - { - code: 6018, - name: "NoChangesProposed", - msg: "All optional change fields are None", - }, - { - code: 6019, - name: "MinDurationTooLarge", - msg: "min_duration exceeds maximum allowed (365 days)", + ]; + }; }, + ]; + constants: [ { - code: 6020, - name: "StaleChangeRequest", - msg: "Change request is stale: PP was recreated or the proposing party has changed", + name: "maxMinDuration"; + type: "u32"; + value: "31536000"; }, - ], + ]; }; diff --git a/sdk/src/price_based_performance_package/v0.6/PriceBasedPerformancePackageClient.ts b/sdk/src/price_based_performance_package/v0.6/PriceBasedPerformancePackageClient.ts index 0c08225f1..f688c9e3e 100644 --- a/sdk/src/price_based_performance_package/v0.6/PriceBasedPerformancePackageClient.ts +++ b/sdk/src/price_based_performance_package/v0.6/PriceBasedPerformancePackageClient.ts @@ -1,4 +1,4 @@ -import { AnchorProvider, Program } from "@coral-xyz/anchor"; +import { AnchorProvider, Program } from "@anchor-lang/core"; import { ComputeBudgetProgram, PublicKey, @@ -13,9 +13,9 @@ import { getAssociatedTokenAddressSync, } from "@solana/spl-token"; import { - PriceBasedPerformancePackage, - IDL as PriceBasedPerformancePackageIDL, -} from "./types/price_based_performance_package.js"; + PriceBasedPerformancePackageProgram as PriceBasedPerformancePackage, + PriceBasedPerformancePackageIDL, +} from "./types/index.js"; import { FUTARCHY_V0_6_PROGRAM_ID, PRICE_BASED_PERFORMANCE_PACKAGE_PROGRAM_ID, @@ -56,8 +56,10 @@ export class PriceBasedPerformancePackageClient { this.provider = provider; this.programId = priceBasedTokenLockProgramId; this.program = new Program( - PriceBasedPerformancePackageIDL, - priceBasedTokenLockProgramId, + { + ...PriceBasedPerformancePackageIDL, + address: priceBasedTokenLockProgramId.toBase58(), + }, provider, ); } @@ -86,7 +88,7 @@ export class PriceBasedPerformancePackageClient { }) { return this.program.methods .initializePerformancePackage(params.params) - .accounts(this.initializePerformancePackageAccounts(params)); + .accountsPartial(this.initializePerformancePackageAccounts(params)); } public initializePerformancePackageWithLimitsIx(params: { @@ -98,7 +100,7 @@ export class PriceBasedPerformancePackageClient { }) { return this.program.methods .initializePerformancePackageWithLimits(params.params) - .accounts(this.initializePerformancePackageAccounts(params)); + .accountsPartial(this.initializePerformancePackageAccounts(params)); } // Both initialisers share one accounts struct. @@ -139,7 +141,7 @@ export class PriceBasedPerformancePackageClient { oracleAccount: PublicKey; recipient: PublicKey; }) { - return this.program.methods.startUnlock().accounts({ + return this.program.methods.startUnlock().accountsPartial({ performancePackage: params.performancePackage, oracleAccount: params.oracleAccount, recipient: params.recipient, @@ -150,7 +152,7 @@ export class PriceBasedPerformancePackageClient { performancePackage: PublicKey; oracleAccount: PublicKey; }) { - return this.program.methods.completeUnlock().accounts({ + return this.program.methods.completeUnlock().accountsPartial({ performancePackage: params.performancePackage, oracleAccount: params.oracleAccount, }); @@ -176,7 +178,7 @@ export class PriceBasedPerformancePackageClient { }) { return this.program.methods .withdrawTokens({ amount, maxQuoteValue }) - .accounts({ + .accountsPartial({ performancePackage, oracleAccount, performancePackageTokenVault: getAssociatedTokenAddressSync( @@ -220,7 +222,7 @@ export class PriceBasedPerformancePackageClient { }) { return this.program.methods .withdrawViaSell({ amount, minQuoteOut }) - .accounts({ + .accountsPartial({ performancePackage, dao, performancePackageTokenVault: getAssociatedTokenAddressSync( @@ -268,7 +270,7 @@ export class PriceBasedPerformancePackageClient { params.params.pdaNonce, ); - return this.program.methods.proposeChange(params.params).accounts({ + return this.program.methods.proposeChange(params.params).accountsPartial({ changeRequest: changeRequestAddress, performancePackage: params.performancePackage, proposer: params.proposer, @@ -284,7 +286,7 @@ export class PriceBasedPerformancePackageClient { }) { return this.program.methods .executeChange({ expectedProposedAt: params.expectedProposedAt }) - .accounts({ + .accountsPartial({ changeRequest: params.changeRequest, performancePackage: params.performancePackage, executor: params.executor, @@ -300,7 +302,7 @@ export class PriceBasedPerformancePackageClient { .changePerformancePackageAuthority({ newPerformancePackageAuthority: params.newPerformancePackageAuthority, }) - .accounts({ + .accountsPartial({ performancePackage: params.performancePackage, currentAuthority: params.currentAuthority, }); @@ -330,29 +332,31 @@ export class PriceBasedPerformancePackageClient { true, ); - const builder = this.program.methods.burnPerformancePackage().accounts({ - performancePackage, - performancePackageTokenVault: getAssociatedTokenAddressSync( - tokenMint, + const builder = this.program.methods + .burnPerformancePackage() + .accountsPartial({ performancePackage, - true, - ), - recipient, - recipientTokenAccount: recipientTokenAccount ?? recipientAta, - admin, - spillAccount, - tokenMint, - quoteMint: quoteSweep?.quoteMint ?? null, - packageQuoteAccount: quoteSweep - ? getAssociatedTokenAddressSync( - quoteSweep.quoteMint, - performancePackage, - true, - ) - : null, - quoteDestination: quoteSweep?.quoteDestination ?? null, - tokenProgram: TOKEN_PROGRAM_ID, - }); + performancePackageTokenVault: getAssociatedTokenAddressSync( + tokenMint, + performancePackage, + true, + ), + recipient, + recipientTokenAccount: recipientTokenAccount ?? recipientAta, + admin, + spillAccount, + tokenMint, + quoteMint: quoteSweep?.quoteMint ?? null, + packageQuoteAccount: quoteSweep + ? getAssociatedTokenAddressSync( + quoteSweep.quoteMint, + performancePackage, + true, + ) + : null, + quoteDestination: quoteSweep?.quoteDestination ?? null, + tokenProgram: TOKEN_PROGRAM_ID, + }); if (recipientTokenAccount) { return builder; @@ -373,7 +377,7 @@ export class PriceBasedPerformancePackageClient { performancePackage: PublicKey; payer: PublicKey; }) { - return this.program.methods.resizePerformancePackage().accounts({ + return this.program.methods.resizePerformancePackage().accountsPartial({ performancePackage: params.performancePackage, payer: params.payer, systemProgram: SystemProgram.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 index 6138459d8..42e3f82b4 100644 --- a/sdk/src/price_based_performance_package/v0.6/types/index.ts +++ b/sdk/src/price_based_performance_package/v0.6/types/index.ts @@ -1,57 +1,57 @@ -import { IdlAccounts, IdlEvents, IdlTypes } from "@coral-xyz/anchor"; +import { IdlAccounts, IdlEvents, IdlTypes } from "@anchor-lang/core"; -import { - PriceBasedPerformancePackage as PriceBasedPerformancePackageProgram, - IDL as PriceBasedPerformancePackageIDL, -} from "./price_based_performance_package.js"; -export { PriceBasedPerformancePackageProgram, PriceBasedPerformancePackageIDL }; +import type { PriceBasedPerformancePackage as PriceBasedPerformancePackageProgram } from "./price_based_performance_package.js"; +import priceBasedPerformancePackageIdl from "./price_based_performance_package.json" with { type: "json" }; +export type { PriceBasedPerformancePackageProgram }; +export const PriceBasedPerformancePackageIDL = + priceBasedPerformancePackageIdl as PriceBasedPerformancePackageProgram; export type InitializePerformancePackageParams = - IdlTypes["InitializePerformancePackageParams"]; + IdlTypes["initializePerformancePackageParams"]; export type PerformancePackage = IdlAccounts["performancePackage"]; export type OracleConfig = - IdlTypes["OracleConfig"]; -export type Tranche = IdlTypes["Tranche"]; + IdlTypes["oracleConfig"]; +export type Tranche = IdlTypes["tranche"]; export type WithdrawTokensParams = - IdlTypes["WithdrawTokensParams"]; + IdlTypes["withdrawTokensParams"]; export type WithdrawViaSellParams = - IdlTypes["WithdrawViaSellParams"]; + IdlTypes["withdrawViaSellParams"]; export type WithdrawalPolicy = - IdlTypes["WithdrawalPolicy"]; + IdlTypes["withdrawalPolicy"]; export type CappedWithdrawal = - IdlTypes["CappedWithdrawal"]; + IdlTypes["cappedWithdrawal"]; export type WithdrawalLimits = - IdlTypes["WithdrawalLimits"]; + IdlTypes["withdrawalLimits"]; export type WindowUsage = - IdlTypes["WindowUsage"]; + IdlTypes["windowUsage"]; export type WithdrawalMode = - IdlTypes["WithdrawalMode"]; + IdlTypes["withdrawalMode"]; export type LimitsParams = - IdlTypes["LimitsParams"]; + IdlTypes["limitsParams"]; export type InitializePerformancePackageWithLimitsParams = - IdlTypes["InitializePerformancePackageWithLimitsParams"]; + IdlTypes["initializePerformancePackageWithLimitsParams"]; export type ChangeType = - IdlTypes["ChangeType"]; + IdlTypes["changeType"]; export type ProposeChangeParams = - IdlTypes["ProposeChangeParams"]; + IdlTypes["proposeChangeParams"]; export type PerformancePackageInitializedEvent = - IdlEvents["PerformancePackageInitialized"]; + IdlEvents["performancePackageInitialized"]; export type UnlockStartedEvent = - IdlEvents["UnlockStarted"]; + IdlEvents["unlockStarted"]; export type UnlockCompletedEvent = - IdlEvents["UnlockCompleted"]; + IdlEvents["unlockCompleted"]; export type TokensWithdrawnEvent = - IdlEvents["TokensWithdrawn"]; + IdlEvents["tokensWithdrawn"]; export type TokensSoldEvent = - IdlEvents["TokensSold"]; + IdlEvents["tokensSold"]; export type ChangeProposedEvent = - IdlEvents["ChangeProposed"]; + IdlEvents["changeProposed"]; export type ChangeExecutedEvent = - IdlEvents["ChangeExecuted"]; + IdlEvents["changeExecuted"]; export type PerformancePackageAuthorityChangedEvent = - IdlEvents["PerformancePackageAuthorityChanged"]; + IdlEvents["performancePackageAuthorityChanged"]; export type PriceBasedPerformancePackageEvent = | PerformancePackageInitializedEvent | UnlockStartedEvent diff --git a/sdk/src/price_based_performance_package/v0.6/types/price_based_performance_package.json b/sdk/src/price_based_performance_package/v0.6/types/price_based_performance_package.json new file mode 100644 index 000000000..10cbbe3e3 --- /dev/null +++ b/sdk/src/price_based_performance_package/v0.6/types/price_based_performance_package.json @@ -0,0 +1,3442 @@ +{ + "address": "pbPPQH7jyKoSLu8QYs3rSY3YkDRXEBojKbTgnUg7NDS", + "metadata": { + "name": "price_based_performance_package", + "version": "0.6.1", + "spec": "0.1.0", + "description": "Created with Anchor" + }, + "instructions": [ + { + "name": "burn_performance_package", + "discriminator": [ + 232, + 251, + 10, + 122, + 204, + 255, + 248, + 208 + ], + "accounts": [ + { + "name": "performance_package", + "writable": true + }, + { + "name": "performance_package_token_vault", + "docs": [ + "Emptied by the payout and the burn, then closed to the spill account" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "performance_package" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "token_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + }, + "relations": [ + "performance_package" + ] + }, + { + "name": "recipient", + "relations": [ + "performance_package" + ] + }, + { + "name": "recipient_token_account", + "docs": [ + "Any token account owned by the recipient; receives the unlocked balance" + ], + "writable": true + }, + { + "name": "admin", + "signer": true + }, + { + "name": "spill_account", + "writable": true + }, + { + "name": "token_mint", + "writable": true, + "relations": [ + "performance_package" + ] + }, + { + "name": "quote_mint", + "docs": [ + "The mint of the package's quote ATA; any mint other than the package's token mint" + ], + "optional": true + }, + { + "name": "package_quote_account", + "docs": [ + "The package's quote ATA, swept into `quote_destination` and closed when passed" + ], + "writable": true, + "optional": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "performance_package" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "quote_destination", + "docs": [ + "Where the quote balance goes, chosen by the admin" + ], + "writable": true, + "optional": true + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + } + ], + "args": [] + }, + { + "name": "change_performance_package_authority", + "discriminator": [ + 167, + 96, + 117, + 32, + 209, + 186, + 226, + 179 + ], + "accounts": [ + { + "name": "performance_package", + "writable": true + }, + { + "name": "current_authority", + "signer": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "ChangePerformancePackageAuthorityParams" + } + } + } + ] + }, + { + "name": "complete_unlock", + "discriminator": [ + 22, + 203, + 15, + 189, + 239, + 125, + 25, + 132 + ], + "accounts": [ + { + "name": "performance_package", + "writable": true + }, + { + "name": "oracle_account" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "execute_change", + "discriminator": [ + 104, + 53, + 136, + 238, + 82, + 222, + 200, + 42 + ], + "accounts": [ + { + "name": "change_request", + "writable": true + }, + { + "name": "performance_package", + "writable": true, + "relations": [ + "change_request" + ] + }, + { + "name": "executor", + "docs": [ + "The party executing the change (must be opposite of proposer)" + ], + "writable": true, + "signer": true + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "ExecuteChangeParams" + } + } + } + ] + }, + { + "name": "initialize_performance_package", + "discriminator": [ + 3, + 171, + 56, + 55, + 135, + 100, + 163, + 186 + ], + "accounts": [ + { + "name": "performance_package", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 101, + 114, + 102, + 111, + 114, + 109, + 97, + 110, + 99, + 101, + 95, + 112, + 97, + 99, + 107, + 97, + 103, + 101 + ] + }, + { + "kind": "account", + "path": "create_key" + } + ] + } + }, + { + "name": "create_key", + "docs": [ + "Used to derive the PDA" + ], + "signer": true + }, + { + "name": "token_mint", + "docs": [ + "The mint of the tokens to be locked" + ] + }, + { + "name": "grantor_token_account", + "docs": [ + "The token account containing the tokens to be locked" + ], + "writable": true + }, + { + "name": "grantor", + "docs": [ + "The authority of the token account" + ], + "signer": true + }, + { + "name": "performance_package_token_vault", + "docs": [ + "The locker's token account where tokens will be stored" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "performance_package" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "token_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "InitializePerformancePackageParams" + } + } + } + ] + }, + { + "name": "initialize_performance_package_with_limits", + "discriminator": [ + 49, + 132, + 41, + 239, + 119, + 107, + 42, + 229 + ], + "accounts": [ + { + "name": "performance_package", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 112, + 101, + 114, + 102, + 111, + 114, + 109, + 97, + 110, + 99, + 101, + 95, + 112, + 97, + 99, + 107, + 97, + 103, + 101 + ] + }, + { + "kind": "account", + "path": "create_key" + } + ] + } + }, + { + "name": "create_key", + "docs": [ + "Used to derive the PDA" + ], + "signer": true + }, + { + "name": "token_mint", + "docs": [ + "The mint of the tokens to be locked" + ] + }, + { + "name": "grantor_token_account", + "docs": [ + "The token account containing the tokens to be locked" + ], + "writable": true + }, + { + "name": "grantor", + "docs": [ + "The authority of the token account" + ], + "signer": true + }, + { + "name": "performance_package_token_vault", + "docs": [ + "The locker's token account where tokens will be stored" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "performance_package" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "token_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "InitializePerformancePackageWithLimitsParams" + } + } + } + ] + }, + { + "name": "propose_change", + "discriminator": [ + 167, + 211, + 18, + 222, + 93, + 215, + 74, + 159 + ], + "accounts": [ + { + "name": "change_request", + "writable": true, + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 99, + 104, + 97, + 110, + 103, + 101, + 95, + 114, + 101, + 113, + 117, + 101, + 115, + 116 + ] + }, + { + "kind": "account", + "path": "performance_package" + }, + { + "kind": "account", + "path": "proposer" + }, + { + "kind": "arg", + "path": "params.pda_nonce" + } + ] + } + }, + { + "name": "performance_package", + "writable": true + }, + { + "name": "proposer", + "signer": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "ProposeChangeParams" + } + } + } + ] + }, + { + "name": "resize_performance_package", + "discriminator": [ + 99, + 88, + 136, + 7, + 47, + 157, + 30, + 167 + ], + "accounts": [ + { + "name": "performance_package", + "writable": true + }, + { + "name": "payer", + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + } + ], + "args": [] + }, + { + "name": "start_unlock", + "discriminator": [ + 53, + 202, + 212, + 31, + 76, + 178, + 31, + 123 + ], + "accounts": [ + { + "name": "performance_package", + "writable": true + }, + { + "name": "oracle_account" + }, + { + "name": "recipient", + "docs": [ + "Only the token recipient can start unlock" + ], + "signer": true, + "relations": [ + "performance_package" + ] + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [] + }, + { + "name": "withdraw_tokens", + "discriminator": [ + 2, + 4, + 225, + 61, + 19, + 182, + 106, + 170 + ], + "accounts": [ + { + "name": "performance_package", + "writable": true + }, + { + "name": "oracle_account" + }, + { + "name": "performance_package_token_vault", + "docs": [ + "The token account where locked tokens are stored" + ], + "writable": true, + "relations": [ + "performance_package" + ] + }, + { + "name": "token_mint", + "relations": [ + "performance_package" + ] + }, + { + "name": "recipient_token_account", + "docs": [ + "The recipient's ATA where tokens will be sent - created if needed" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "recipient" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "token_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "recipient", + "docs": [ + "Only the recipient can withdraw" + ], + "signer": true, + "relations": [ + "performance_package" + ] + }, + { + "name": "payer", + "docs": [ + "Payer for creating the ATA if needed" + ], + "writable": true, + "signer": true + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "WithdrawTokensParams" + } + } + } + ] + }, + { + "name": "withdraw_via_sell", + "discriminator": [ + 14, + 241, + 77, + 159, + 41, + 120, + 59, + 96 + ], + "accounts": [ + { + "name": "performance_package", + "writable": true + }, + { + "name": "dao", + "docs": [ + "The futarchy Dao whose spot pool buys the tokens" + ], + "writable": true + }, + { + "name": "performance_package_token_vault", + "docs": [ + "The token account where locked tokens are stored; the sale is paid out of it" + ], + "writable": true, + "relations": [ + "performance_package" + ] + }, + { + "name": "token_mint", + "relations": [ + "performance_package" + ] + }, + { + "name": "quote_mint" + }, + { + "name": "amm_base_vault", + "writable": true + }, + { + "name": "amm_quote_vault", + "writable": true + }, + { + "name": "package_quote_account", + "docs": [ + "The package's quote ATA that receives the proceeds before they are forwarded" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "performance_package" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "recipient_quote_account", + "docs": [ + "The recipient's quote ATA where the proceeds are sent" + ], + "writable": true, + "pda": { + "seeds": [ + { + "kind": "account", + "path": "recipient" + }, + { + "kind": "const", + "value": [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169 + ] + }, + { + "kind": "account", + "path": "quote_mint" + } + ], + "program": { + "kind": "const", + "value": [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89 + ] + } + } + }, + { + "name": "recipient", + "docs": [ + "Only the recipient can withdraw" + ], + "signer": true, + "relations": [ + "performance_package" + ] + }, + { + "name": "payer", + "docs": [ + "Payer for creating the ATAs if needed" + ], + "writable": true, + "signer": true + }, + { + "name": "futarchy_program", + "address": "FUTARELBfJfQ8RDGhg1wdhddq1odMAJUePHFuBYfUxKq" + }, + { + "name": "futarchy_event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ], + "program": { + "kind": "account", + "path": "futarchy_program" + } + } + }, + { + "name": "system_program", + "address": "11111111111111111111111111111111" + }, + { + "name": "token_program", + "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "name": "associated_token_program", + "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL" + }, + { + "name": "event_authority", + "pda": { + "seeds": [ + { + "kind": "const", + "value": [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121 + ] + } + ] + } + }, + { + "name": "program" + } + ], + "args": [ + { + "name": "params", + "type": { + "defined": { + "name": "WithdrawViaSellParams" + } + } + } + ] + } + ], + "accounts": [ + { + "name": "ChangeRequest", + "discriminator": [ + 75, + 130, + 166, + 47, + 15, + 217, + 131, + 190 + ] + }, + { + "name": "Dao", + "discriminator": [ + 163, + 9, + 47, + 31, + 52, + 85, + 197, + 49 + ] + }, + { + "name": "PerformancePackage", + "discriminator": [ + 228, + 146, + 174, + 131, + 121, + 249, + 99, + 132 + ] + } + ], + "events": [ + { + "name": "ChangeExecuted", + "discriminator": [ + 50, + 115, + 8, + 12, + 139, + 8, + 191, + 26 + ] + }, + { + "name": "ChangeProposed", + "discriminator": [ + 170, + 10, + 10, + 8, + 244, + 196, + 146, + 151 + ] + }, + { + "name": "PerformancePackageAuthorityChanged", + "discriminator": [ + 61, + 106, + 117, + 16, + 219, + 103, + 0, + 43 + ] + }, + { + "name": "PerformancePackageInitialized", + "discriminator": [ + 215, + 87, + 36, + 3, + 199, + 219, + 188, + 121 + ] + }, + { + "name": "TokensSold", + "discriminator": [ + 217, + 83, + 68, + 137, + 134, + 225, + 94, + 45 + ] + }, + { + "name": "TokensWithdrawn", + "discriminator": [ + 30, + 116, + 110, + 147, + 87, + 89, + 9, + 158 + ] + }, + { + "name": "UnlockCompleted", + "discriminator": [ + 9, + 6, + 169, + 127, + 233, + 218, + 94, + 165 + ] + }, + { + "name": "UnlockStarted", + "discriminator": [ + 156, + 214, + 102, + 63, + 177, + 19, + 228, + 124 + ] + } + ], + "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" + }, + { + "code": 6014, + "name": "TotalTokenAmountOverflow", + "msg": "Total token amount calculation would overflow" + }, + { + "code": 6015, + "name": "RecipientAuthorityMustDiffer", + "msg": "Recipient and performance package authority must be different keys" + }, + { + "code": 6016, + "name": "InvalidWithdrawalLimits", + "msg": "Withdrawal limits must have non-zero caps, a future end, and a window of at least one second" + }, + { + "code": 6017, + "name": "InsufficientWithdrawableBalance", + "msg": "Amount exceeds the withdrawable balance" + }, + { + "code": 6018, + "name": "TokenWindowLimitExceeded", + "msg": "Token cap for the current window exceeded" + }, + { + "code": 6019, + "name": "QuoteWindowLimitExceeded", + "msg": "Quote cap for the current window exceeded" + }, + { + "code": 6020, + "name": "InvalidPriceObservation", + "msg": "Oracle price observation is missing or zero" + }, + { + "code": 6021, + "name": "WithdrawTokensDisabled", + "msg": "Token withdrawals are disabled by the withdrawal mode" + }, + { + "code": 6022, + "name": "WithdrawViaSellDisabled", + "msg": "Sell withdrawals are disabled by the withdrawal mode" + }, + { + "code": 6023, + "name": "AccountNotMigrated", + "msg": "Performance package has not been resized to the current layout" + }, + { + "code": 6024, + "name": "InvalidQuoteMint", + "msg": "Quote mint must differ from the package's token mint" + }, + { + "code": 6025, + "name": "QuoteSweepAccountsIncomplete", + "msg": "The package's quote account and the quote destination must be passed together" + }, + { + "code": 6026, + "name": "OracleMintMismatch", + "msg": "Oracle Dao's base mint must be the package's token mint" + }, + { + "code": 6027, + "name": "MaxQuoteValueExceeded", + "msg": "Withdrawal is valued above the recipient's maximum quote value" + }, + { + "code": 6028, + "name": "StaleChangeRequest", + "msg": "Change request was proposed before the last executed change was proposed" + }, + { + "code": 6029, + "name": "ChangeRequestMismatch", + "msg": "Change request was proposed at a different time than the executor expected" + } + ], + "types": [ + { + "name": "CappedWithdrawal", + "docs": [ + "Present on a withdrawal that ran under active limits" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "price", + "docs": [ + "The price the withdrawal was valued at: the higher of the spot pool's observation and its reserve price" + ], + "type": "u128" + }, + { + "name": "quote_value", + "docs": [ + "`amount` valued at that price, in quote atoms" + ], + "type": "u64" + }, + { + "name": "usage", + "docs": [ + "Window usage after this withdrawal" + ], + "type": { + "defined": { + "name": "WindowUsage" + } + } + } + ] + } + }, + { + "name": "ChangeExecuted", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "performance_package", + "type": "pubkey" + }, + { + "name": "change_request", + "type": "pubkey" + }, + { + "name": "executor", + "type": "pubkey" + }, + { + "name": "change_type", + "type": { + "defined": { + "name": "ChangeType" + } + } + } + ] + } + }, + { + "name": "ChangePerformancePackageAuthorityParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "new_performance_package_authority", + "type": "pubkey" + } + ] + } + }, + { + "name": "ChangeProposed", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "locker", + "type": "pubkey" + }, + { + "name": "change_request", + "type": "pubkey" + }, + { + "name": "proposer", + "type": "pubkey" + }, + { + "name": "change_type", + "type": { + "defined": { + "name": "ChangeType" + } + } + } + ] + } + }, + { + "name": "ChangeRequest", + "type": { + "kind": "struct", + "fields": [ + { + "name": "performance_package", + "docs": [ + "The performance package this change applies to" + ], + "type": "pubkey" + }, + { + "name": "change_type", + "docs": [ + "What is being changed" + ], + "type": { + "defined": { + "name": "ChangeType" + } + } + }, + { + "name": "proposed_at", + "docs": [ + "When the change was proposed" + ], + "type": "i64" + }, + { + "name": "proposer_type", + "docs": [ + "Who proposed this change (either token_recipient or locker_authority)" + ], + "type": { + "defined": { + "name": "ProposerType" + } + } + }, + { + "name": "pda_nonce", + "docs": [ + "Used to derive the PDA along with the proposer" + ], + "type": "u32" + }, + { + "name": "pda_bump", + "docs": [ + "The PDA bump" + ], + "type": "u8" + } + ] + } + }, + { + "name": "ChangeType", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Oracle", + "fields": [ + { + "name": "new_oracle_config", + "type": { + "defined": { + "name": "OracleConfig" + } + } + } + ] + }, + { + "name": "Recipient", + "fields": [ + { + "name": "new_recipient", + "type": "pubkey" + } + ] + }, + { + "name": "UnlockTerms", + "fields": [ + { + "name": "min_unlock_timestamp", + "type": "i64" + }, + { + "name": "limits", + "type": { + "option": { + "defined": { + "name": "LimitsParams" + } + } + } + } + ] + } + ] + } + }, + { + "name": "CommonFields", + "type": { + "kind": "struct", + "fields": [ + { + "name": "slot", + "type": "u64" + }, + { + "name": "unix_timestamp", + "type": "i64" + }, + { + "name": "performance_package_seq_num", + "type": "u64" + } + ] + } + }, + { + "name": "Dao", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amm", + "docs": [ + "Embedded FutarchyAmm - 1:1 relationship" + ], + "type": { + "defined": { + "name": "FutarchyAmm" + } + } + }, + { + "name": "nonce", + "docs": [ + "`nonce` + `dao_creator` are PDA seeds" + ], + "type": "u64" + }, + { + "name": "dao_creator", + "type": "pubkey" + }, + { + "name": "pda_bump", + "type": "u8" + }, + { + "name": "squads_multisig", + "type": "pubkey" + }, + { + "name": "squads_multisig_vault", + "type": "pubkey" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "proposal_count", + "type": "u32" + }, + { + "name": "pass_threshold_bps", + "type": "u16" + }, + { + "name": "seconds_per_proposal", + "type": "u32" + }, + { + "name": "twap_initial_observation", + "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": "twap_max_observation_change_per_update", + "type": "u128" + }, + { + "name": "twap_start_delay_seconds", + "docs": [ + "Forces TWAP calculation to start after `twap_start_delay_seconds` seconds" + ], + "type": "u32" + }, + { + "name": "min_quote_futarchic_liquidity", + "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": "min_base_futarchic_liquidity", + "type": "u64" + }, + { + "name": "base_to_stake", + "docs": [ + "Minimum amount of base tokens that must be staked to launch a proposal" + ], + "type": "u64" + }, + { + "name": "seq_num", + "type": "u64" + }, + { + "name": "initial_spending_limit", + "docs": [ + "The authoritative record of what the Squads spending limit should be.", + "`None` = no limit. Kept in sync with the Squads-side account by", + "`sync_spending_limit`. (Named for its original init-only role)" + ], + "type": { + "option": { + "defined": { + "name": "InitialSpendingLimit" + } + } + } + }, + { + "name": "team_sponsored_pass_threshold_bps", + "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": "team_address", + "type": "pubkey" + }, + { + "name": "optimistic_proposal", + "docs": [ + "Deprecated in favor of typed proposals" + ], + "type": { + "option": { + "defined": { + "name": "OptimisticProposal" + } + } + } + }, + { + "name": "is_optimistic_governance_enabled", + "docs": [ + "Deprecated in favor of typed proposals" + ], + "type": "bool" + }, + { + "name": "liquidator", + "docs": [ + "`Some` means the DAO has been liquidated, and holds who runs the estate.", + "Set once by `finalize_proposal` the moment a hostile liquidation", + "passes, never cleared." + ], + "type": { + "option": "pubkey" + } + }, + { + "name": "last_failed_takeover_at", + "docs": [ + "Unix time of the last failed hostile takeover. 0 = never." + ], + "type": "i64" + }, + { + "name": "last_failed_liquidation_at", + "docs": [ + "Unix time of the last failed hostile liquidation. 0 = never." + ], + "type": "i64" + }, + { + "name": "spending_limit_dirty", + "docs": [ + "Set by every write to the spending-limit record (`initial_spending_limit`),", + "consumed by `sync_spending_limit`." + ], + "type": "bool" + }, + { + "name": "last_buyback_finalized_at", + "docs": [ + "Unix time of the last buyback finalization. 0 = never." + ], + "type": "i64" + }, + { + "name": "typed_proposals_enabled", + "docs": [ + "Whether the DAO runs on the mini-instructions catalog. Never turns off." + ], + "type": "bool" + } + ] + } + }, + { + "name": "ExecuteChangeParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "expected_proposed_at", + "type": "i64" + } + ] + } + }, + { + "name": "FutarchyAmm", + "type": { + "kind": "struct", + "fields": [ + { + "name": "state", + "type": { + "defined": { + "name": "PoolState" + } + } + }, + { + "name": "total_liquidity", + "type": "u128" + }, + { + "name": "base_mint", + "type": "pubkey" + }, + { + "name": "quote_mint", + "type": "pubkey" + }, + { + "name": "amm_base_vault", + "type": "pubkey" + }, + { + "name": "amm_quote_vault", + "type": "pubkey" + } + ] + } + }, + { + "name": "InitialSpendingLimit", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amount_per_month", + "type": "u64" + }, + { + "name": "members", + "type": { + "vec": "pubkey" + } + } + ] + } + }, + { + "name": "InitializePerformancePackageParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "tranches", + "type": { + "vec": { + "defined": { + "name": "Tranche" + } + } + } + }, + { + "name": "min_unlock_timestamp", + "type": "i64" + }, + { + "name": "oracle_config", + "type": { + "defined": { + "name": "OracleConfig" + } + } + }, + { + "name": "twap_length_seconds", + "type": "u32" + }, + { + "name": "grantee", + "type": "pubkey" + }, + { + "name": "performance_package_authority", + "type": "pubkey" + } + ] + } + }, + { + "name": "InitializePerformancePackageWithLimitsParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "base", + "type": { + "defined": { + "name": "InitializePerformancePackageParams" + } + } + }, + { + "name": "limits", + "type": { + "option": { + "defined": { + "name": "LimitsParams" + } + } + } + } + ] + } + }, + { + "name": "LimitsParams", + "docs": [ + "What the two parties agree on; the program supplies `start_timestamp`" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "end_timestamp", + "type": "i64" + }, + { + "name": "window_seconds", + "type": "u32" + }, + { + "name": "max_tokens_per_window", + "type": "u64" + }, + { + "name": "max_quote_per_window", + "type": "u64" + }, + { + "name": "withdrawal_mode", + "type": { + "defined": { + "name": "WithdrawalMode" + } + } + } + ] + } + }, + { + "name": "OptimisticProposal", + "type": { + "kind": "struct", + "fields": [ + { + "name": "squads_proposal", + "docs": [ + "The squads proposal currently enqueued for execution if not challenged by a new proposal." + ], + "type": "pubkey" + }, + { + "name": "enqueued_timestamp", + "docs": [ + "The timestamp when the active optimistic squads proposal was enqueued." + ], + "type": "i64" + } + ] + } + }, + { + "name": "OracleConfig", + "docs": [ + "Starting at `byte_offset` in `oracle_account`, the unlock instructions read:", + "- 16 bytes for the aggregator, stored as a little endian u128", + "- 8 bytes for the timestamp that the aggregator was last updated, stored as", + "a little endian i64", + "", + "While withdrawal limits are active, `oracle_account` must also be a futarchy", + "`Dao`: the withdraw instructions value withdrawals from its spot pool, at the", + "higher of the pool's damped observation and its reserve price.", + "", + "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": "oracle_account", + "type": "pubkey" + }, + { + "name": "byte_offset", + "type": "u32" + } + ] + } + }, + { + "name": "PerformancePackage", + "type": { + "kind": "struct", + "fields": [ + { + "name": "tranches", + "docs": [ + "The tranches that make up the performance package" + ], + "type": { + "vec": { + "defined": { + "name": "StoredTranche" + } + } + } + }, + { + "name": "total_token_amount", + "docs": [ + "Total amount of tokens in the performance package" + ], + "type": "u64" + }, + { + "name": "already_unlocked_amount", + "docs": [ + "Amount of tokens already unlocked" + ], + "type": "u64" + }, + { + "name": "min_unlock_timestamp", + "docs": [ + "The timestamp when unlocking can begin" + ], + "type": "i64" + }, + { + "name": "oracle_config", + "docs": [ + "Where to pull price data from" + ], + "type": { + "defined": { + "name": "OracleConfig" + } + } + }, + { + "name": "twap_length_seconds", + "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": "pubkey" + }, + { + "name": "state", + "docs": [ + "The current state of the locker" + ], + "type": { + "defined": { + "name": "PerformancePackageState" + } + } + }, + { + "name": "create_key", + "docs": [ + "Used to derive the PDA" + ], + "type": "pubkey" + }, + { + "name": "pda_bump", + "docs": [ + "The PDA bump" + ], + "type": "u8" + }, + { + "name": "performance_package_authority", + "docs": [ + "The authorized locker authority that can execute changes, usually the organization" + ], + "type": "pubkey" + }, + { + "name": "token_mint", + "docs": [ + "The mint of the locked tokens" + ], + "type": "pubkey" + }, + { + "name": "seq_num", + "docs": [ + "The sequence number of the performance package, used for indexing events" + ], + "type": "u64" + }, + { + "name": "performance_package_token_vault", + "docs": [ + "The vault that stores the tokens" + ], + "type": "pubkey" + }, + { + "name": "withdrawal_policy", + "docs": [ + "`None` means uncapped, and so do expired limits" + ], + "type": { + "option": { + "defined": { + "name": "WithdrawalPolicy" + } + } + } + }, + { + "name": "last_change_proposed_at", + "docs": [ + "When the last executed change was proposed (the creation time until then); requests proposed earlier can no longer be executed" + ], + "type": "i64" + } + ] + } + }, + { + "name": "PerformancePackageAuthorityChanged", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "locker", + "type": "pubkey" + }, + { + "name": "old_authority", + "type": "pubkey" + }, + { + "name": "new_authority", + "type": "pubkey" + } + ] + } + }, + { + "name": "PerformancePackageInitialized", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "performance_package", + "type": "pubkey" + } + ] + } + }, + { + "name": "PerformancePackageState", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Locked" + }, + { + "name": "Unlocking", + "fields": [ + { + "name": "start_aggregator", + "docs": [ + "The aggregator value when unlocking started" + ], + "type": "u128" + }, + { + "name": "start_timestamp", + "docs": [ + "The timestamp when unlocking started" + ], + "type": "i64" + } + ] + } + ] + } + }, + { + "name": "Pool", + "type": { + "kind": "struct", + "fields": [ + { + "name": "oracle", + "type": { + "defined": { + "name": "TwapOracle" + } + } + }, + { + "name": "quote_reserves", + "type": "u64" + }, + { + "name": "base_reserves", + "type": "u64" + }, + { + "name": "quote_protocol_fee_balance", + "type": "u64" + }, + { + "name": "base_protocol_fee_balance", + "type": "u64" + } + ] + } + }, + { + "name": "PoolState", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Spot", + "fields": [ + { + "name": "spot", + "type": { + "defined": { + "name": "Pool" + } + } + } + ] + }, + { + "name": "Futarchy", + "fields": [ + { + "name": "spot", + "type": { + "defined": { + "name": "Pool" + } + } + }, + { + "name": "pass", + "type": { + "defined": { + "name": "Pool" + } + } + }, + { + "name": "fail", + "type": { + "defined": { + "name": "Pool" + } + } + } + ] + } + ] + } + }, + { + "name": "ProposeChangeParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "change_type", + "type": { + "defined": { + "name": "ChangeType" + } + } + }, + { + "name": "pda_nonce", + "type": "u32" + } + ] + } + }, + { + "name": "ProposerType", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Recipient" + }, + { + "name": "Authority" + } + ] + } + }, + { + "name": "StoredTranche", + "type": { + "kind": "struct", + "fields": [ + { + "name": "price_threshold", + "type": "u128" + }, + { + "name": "token_amount", + "type": "u64" + }, + { + "name": "is_unlocked", + "type": "bool" + } + ] + } + }, + { + "name": "TokensSold", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "performance_package", + "type": "pubkey" + }, + { + "name": "recipient", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "quote_received", + "type": "u64" + }, + { + "name": "min_quote_out", + "type": "u64" + }, + { + "name": "capped", + "docs": [ + "Window usage after this sale; `None` when no limits were active" + ], + "type": { + "option": { + "defined": { + "name": "WindowUsage" + } + } + } + } + ] + } + }, + { + "name": "TokensWithdrawn", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "performance_package", + "type": "pubkey" + }, + { + "name": "recipient", + "type": "pubkey" + }, + { + "name": "amount", + "type": "u64" + }, + { + "name": "capped", + "docs": [ + "`None` when no limits were active" + ], + "type": { + "option": { + "defined": { + "name": "CappedWithdrawal" + } + } + } + } + ] + } + }, + { + "name": "Tranche", + "type": { + "kind": "struct", + "fields": [ + { + "name": "price_threshold", + "docs": [ + "The price at which this tranch unlocks" + ], + "type": "u128" + }, + { + "name": "token_amount", + "docs": [ + "The amount of tokens in this tranch" + ], + "type": "u64" + } + ] + } + }, + { + "name": "TwapOracle", + "type": { + "kind": "struct", + "fields": [ + { + "name": "aggregator", + "docs": [ + "Running sum of seconds_since_last_update * last_observation.", + "", + "Assuming latest observations are as big as possible (u64::MAX * 1e12),", + "we can store 18 million seconds worth of observations, which turns out to", + "be ~213 days.", + "", + "Assuming that latest observations are 100x smaller than they could theoretically", + "be, we can store ~57 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.", + "", + "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": "last_updated_timestamp", + "type": "i64" + }, + { + "name": "created_at_timestamp", + "type": "i64" + }, + { + "name": "last_price", + "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": "last_observation", + "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": "max_observation_change_per_update", + "docs": [ + "The most that an observation can change per update." + ], + "type": "u128" + }, + { + "name": "initial_observation", + "docs": [ + "What the initial `latest_observation` is set to." + ], + "type": "u128" + }, + { + "name": "start_delay_seconds", + "docs": [ + "Number of seconds after amm.created_at_slot to start recording TWAP" + ], + "type": "u32" + } + ] + } + }, + { + "name": "UnlockCompleted", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "performance_package", + "type": "pubkey" + }, + { + "name": "token_amount", + "type": "u64" + }, + { + "name": "recipient", + "type": "pubkey" + }, + { + "name": "twap_price", + "type": "u128" + } + ] + } + }, + { + "name": "UnlockStarted", + "type": { + "kind": "struct", + "fields": [ + { + "name": "common", + "type": { + "defined": { + "name": "CommonFields" + } + } + }, + { + "name": "performance_package", + "type": "pubkey" + }, + { + "name": "start_aggregator", + "type": "u128" + }, + { + "name": "start_timestamp", + "type": "i64" + } + ] + } + }, + { + "name": "WindowUsage", + "docs": [ + "Usage in the window the last withdrawal fell in" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "window_index", + "docs": [ + "`(now - limits.start_timestamp) / limits.window_seconds` at the last withdrawal" + ], + "type": "i64" + }, + { + "name": "tokens_used", + "type": "u64" + }, + { + "name": "quote_used", + "type": "u64" + } + ] + } + }, + { + "name": "WithdrawTokensParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amount", + "type": "u64" + }, + { + "name": "max_quote_value", + "type": "u64" + } + ] + } + }, + { + "name": "WithdrawViaSellParams", + "type": { + "kind": "struct", + "fields": [ + { + "name": "amount", + "type": "u64" + }, + { + "name": "min_quote_out", + "type": "u64" + } + ] + } + }, + { + "name": "WithdrawalLimits", + "type": { + "kind": "struct", + "fields": [ + { + "name": "start_timestamp", + "docs": [ + "Anchor for window boundaries; set by the program when limits take effect or `window_seconds` changes" + ], + "type": "i64" + }, + { + "name": "end_timestamp", + "docs": [ + "Caps apply while `now < end_timestamp`" + ], + "type": "i64" + }, + { + "name": "window_seconds", + "docs": [ + "Duration of the window in seconds" + ], + "type": "u32" + }, + { + "name": "max_tokens_per_window", + "docs": [ + "Max base tokens withdrawn per window" + ], + "type": "u64" + }, + { + "name": "max_quote_per_window", + "docs": [ + "Max quote value withdrawn per window, in quote atoms" + ], + "type": "u64" + }, + { + "name": "withdrawal_mode", + "docs": [ + "Which withdrawal routes the recipient may use while the caps are active" + ], + "type": { + "defined": { + "name": "WithdrawalMode" + } + } + } + ] + } + }, + { + "name": "WithdrawalMode", + "type": { + "kind": "enum", + "variants": [ + { + "name": "Tokens" + }, + { + "name": "Sell" + }, + { + "name": "Both" + } + ] + } + }, + { + "name": "WithdrawalPolicy", + "docs": [ + "The agreed limits together with the usage they are enforced against" + ], + "type": { + "kind": "struct", + "fields": [ + { + "name": "limits", + "type": { + "defined": { + "name": "WithdrawalLimits" + } + } + }, + { + "name": "usage", + "type": { + "defined": { + "name": "WindowUsage" + } + } + } + ] + } + } + ], + "constants": [ + { + "name": "PRICE_SCALE", + "docs": [ + "Scale of oracle prices: quote atoms per base atom, times 1e12" + ], + "type": "u128", + "value": "1000000000000" + } + ] +} \ No newline at end of file diff --git a/sdk/src/price_based_performance_package/v0.6/types/price_based_performance_package.ts b/sdk/src/price_based_performance_package/v0.6/types/price_based_performance_package.ts index 6d4e20f27..0dc784696 100644 --- a/sdk/src/price_based_performance_package/v0.6/types/price_based_performance_package.ts +++ b/sdk/src/price_based_performance_package/v0.6/types/price_based_performance_package.ts @@ -1,825 +1,1734 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL can be found at `target/idl/price_based_performance_package.json`. + */ export type PriceBasedPerformancePackage = { - version: "0.6.1"; - name: "price_based_performance_package"; - constants: [ - { - name: "MAX_TRANCHES"; - type: { - defined: "usize"; - }; - value: "10"; - }, - { - name: "PRICE_SCALE"; - type: "u128"; - value: "1_000_000_000_000"; - }, - ]; + address: "pbPPQH7jyKoSLu8QYs3rSY3YkDRXEBojKbTgnUg7NDS"; + metadata: { + name: "priceBasedPerformancePackage"; + version: "0.6.1"; + spec: "0.1.0"; + description: "Created with Anchor"; + }; instructions: [ { - name: "initializePerformancePackage"; + name: "burnPerformancePackage"; + discriminator: [232, 251, 10, 122, 204, 255, 248, 208]; accounts: [ { name: "performancePackage"; - isMut: true; - isSigner: false; + writable: true; }, { - name: "createKey"; - isMut: false; - isSigner: true; - docs: ["Used to derive the PDA"]; + name: "performancePackageTokenVault"; + docs: [ + "Emptied by the payout and the burn, then closed to the spill account", + ]; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "performancePackage"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "tokenMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; + relations: ["performancePackage"]; }, { - name: "tokenMint"; - isMut: false; - isSigner: false; - docs: ["The mint of the tokens to be locked"]; + name: "recipient"; + relations: ["performancePackage"]; }, { - name: "grantorTokenAccount"; - isMut: true; - isSigner: false; - docs: ["The token account containing the tokens to be locked"]; + name: "recipientTokenAccount"; + docs: [ + "Any token account owned by the recipient; receives the unlocked balance", + ]; + writable: true; }, { - name: "grantor"; - isMut: false; - isSigner: true; - docs: ["The authority of the token account"]; + name: "admin"; + signer: true; }, { - name: "performancePackageTokenVault"; - isMut: true; - isSigner: false; - docs: ["The locker's token account where tokens will be stored"]; + name: "spillAccount"; + writable: true; }, { - name: "payer"; - isMut: true; - isSigner: true; + name: "tokenMint"; + writable: true; + relations: ["performancePackage"]; }, { - name: "systemProgram"; - isMut: false; - isSigner: false; + name: "quoteMint"; + docs: [ + "The mint of the package's quote ATA; any mint other than the package's token mint", + ]; + optional: true; + }, + { + name: "packageQuoteAccount"; + docs: [ + "The package's quote ATA, swept into `quote_destination` and closed when passed", + ]; + writable: true; + optional: true; + pda: { + seeds: [ + { + kind: "account"; + path: "performancePackage"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; + }, + { + name: "quoteDestination"; + docs: ["Where the quote balance goes, chosen by the admin"]; + writable: true; + optional: true; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; + }, + ]; + args: []; + }, + { + name: "changePerformancePackageAuthority"; + discriminator: [167, 96, 117, 32, 209, 186, 226, 179]; + accounts: [ + { + name: "performancePackage"; + writable: true; }, { - name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + name: "currentAuthority"; + signer: true; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "params"; type: { - defined: "InitializePerformancePackageParams"; + defined: { + name: "changePerformancePackageAuthorityParams"; + }; }; }, ]; }, { - name: "initializePerformancePackageWithLimits"; + name: "completeUnlock"; + discriminator: [22, 203, 15, 189, 239, 125, 25, 132]; + accounts: [ + { + name: "performancePackage"; + writable: true; + }, + { + name: "oracleAccount"; + }, + { + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; + }, + { + name: "program"; + }, + ]; + args: []; + }, + { + name: "executeChange"; + discriminator: [104, 53, 136, 238, 82, 222, 200, 42]; + accounts: [ + { + name: "changeRequest"; + writable: true; + }, + { + name: "performancePackage"; + writable: true; + relations: ["changeRequest"]; + }, + { + name: "executor"; + docs: [ + "The party executing the change (must be opposite of proposer)", + ]; + writable: true; + signer: true; + }, + { + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; + }, + { + name: "program"; + }, + ]; + args: [ + { + name: "params"; + type: { + defined: { + name: "executeChangeParams"; + }; + }; + }, + ]; + }, + { + name: "initializePerformancePackage"; + discriminator: [3, 171, 56, 55, 135, 100, 163, 186]; accounts: [ { name: "performancePackage"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 112, + 101, + 114, + 102, + 111, + 114, + 109, + 97, + 110, + 99, + 101, + 95, + 112, + 97, + 99, + 107, + 97, + 103, + 101, + ]; + }, + { + kind: "account"; + path: "createKey"; + }, + ]; + }; }, { name: "createKey"; - isMut: false; - isSigner: true; docs: ["Used to derive the PDA"]; + signer: true; }, { 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"]; + writable: true; }, { name: "grantor"; - isMut: false; - isSigner: true; docs: ["The authority of the token account"]; + signer: true; }, { name: "performancePackageTokenVault"; - isMut: true; - isSigner: false; docs: ["The locker's token account where tokens will be stored"]; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "performancePackage"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "tokenMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "params"; type: { - defined: "InitializePerformancePackageWithLimitsParams"; + defined: { + name: "initializePerformancePackageParams"; + }; }; }, ]; }, { - name: "startUnlock"; + name: "initializePerformancePackageWithLimits"; + discriminator: [49, 132, 41, 239, 119, 107, 42, 229]; accounts: [ { name: "performancePackage"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 112, + 101, + 114, + 102, + 111, + 114, + 109, + 97, + 110, + 99, + 101, + 95, + 112, + 97, + 99, + 107, + 97, + 103, + 101, + ]; + }, + { + kind: "account"; + path: "createKey"; + }, + ]; + }; }, { - name: "oracleAccount"; - isMut: false; - isSigner: false; + name: "createKey"; + docs: ["Used to derive the PDA"]; + signer: true; }, { - name: "recipient"; - isMut: false; - isSigner: true; - docs: ["Only the token recipient can start unlock"]; + name: "tokenMint"; + docs: ["The mint of the tokens to be locked"]; }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + name: "grantorTokenAccount"; + docs: ["The token account containing the tokens to be locked"]; + writable: true; }, { - name: "program"; - isMut: false; - isSigner: false; + name: "grantor"; + docs: ["The authority of the token account"]; + signer: true; }, - ]; - args: []; - }, - { - name: "completeUnlock"; - accounts: [ { - name: "performancePackage"; - isMut: true; - isSigner: false; + name: "performancePackageTokenVault"; + docs: ["The locker's token account where tokens will be stored"]; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "performancePackage"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "tokenMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { - name: "oracleAccount"; - isMut: false; - isSigner: false; + name: "payer"; + writable: true; + signer: true; + }, + { + name: "systemProgram"; + address: "11111111111111111111111111111111"; + }, + { + name: "tokenProgram"; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; + }, + { + name: "associatedTokenProgram"; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; - args: []; + args: [ + { + name: "params"; + type: { + defined: { + name: "initializePerformancePackageWithLimitsParams"; + }; + }; + }, + ]; }, { name: "proposeChange"; + discriminator: [167, 211, 18, 222, 93, 215, 74, 159]; accounts: [ { name: "changeRequest"; - isMut: true; - isSigner: false; + writable: true; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 99, + 104, + 97, + 110, + 103, + 101, + 95, + 114, + 101, + 113, + 117, + 101, + 115, + 116, + ]; + }, + { + kind: "account"; + path: "performancePackage"; + }, + { + kind: "account"; + path: "proposer"; + }, + { + kind: "arg"; + path: "params.pda_nonce"; + }, + ]; + }; }, { name: "performancePackage"; - isMut: true; - isSigner: false; + writable: true; }, { name: "proposer"; - isMut: false; - isSigner: true; + signer: true; }, { name: "payer"; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "params"; type: { - defined: "ProposeChangeParams"; + defined: { + name: "proposeChangeParams"; + }; }; }, ]; }, { - name: "executeChange"; + name: "resizePerformancePackage"; + discriminator: [99, 88, 136, 7, 47, 157, 30, 167]; 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)", - ]; + writable: true; }, { - name: "eventAuthority"; - isMut: false; - isSigner: false; + name: "payer"; + writable: true; + signer: true; }, { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "ExecuteChangeParams"; - }; - }, - ]; - }, - { - name: "changePerformancePackageAuthority"; - accounts: [ - { - name: "performancePackage"; - isMut: true; - isSigner: false; - }, - { - name: "currentAuthority"; - isMut: false; - isSigner: true; - }, - { - name: "eventAuthority"; - isMut: false; - isSigner: false; - }, - { - name: "program"; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: "params"; - type: { - defined: "ChangePerformancePackageAuthorityParams"; - }; + name: "systemProgram"; + address: "11111111111111111111111111111111"; }, ]; + args: []; }, { - name: "burnPerformancePackage"; + name: "startUnlock"; + discriminator: [53, 202, 212, 31, 76, 178, 31, 123]; accounts: [ { name: "performancePackage"; - isMut: true; - isSigner: false; + writable: true; }, { - name: "performancePackageTokenVault"; - isMut: true; - isSigner: false; - docs: [ - "Emptied by the payout and the burn, then closed to the spill account", - ]; + name: "oracleAccount"; }, { name: "recipient"; - isMut: false; - isSigner: false; - }, - { - name: "recipientTokenAccount"; - isMut: true; - isSigner: false; - docs: [ - "Any token account owned by the recipient; receives the unlocked balance", - ]; - }, - { - name: "admin"; - isMut: false; - isSigner: true; - }, - { - name: "spillAccount"; - isMut: true; - isSigner: false; - }, - { - name: "tokenMint"; - isMut: true; - isSigner: false; - }, - { - name: "quoteMint"; - isMut: false; - isSigner: false; - isOptional: true; - docs: [ - "The mint of the package's quote ATA; any mint other than the package's token mint", - ]; - }, - { - name: "packageQuoteAccount"; - isMut: true; - isSigner: false; - isOptional: true; - docs: [ - "The package's quote ATA, swept into `quote_destination` and closed when passed", - ]; - }, - { - name: "quoteDestination"; - isMut: true; - isSigner: false; - isOptional: true; - docs: ["Where the quote balance goes, chosen by the admin"]; - }, - { - name: "tokenProgram"; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: "resizePerformancePackage"; - accounts: [ - { - name: "performancePackage"; - isMut: true; - isSigner: false; + docs: ["Only the token recipient can start unlock"]; + signer: true; + relations: ["performancePackage"]; }, { - name: "payer"; - isMut: true; - isSigner: true; + name: "eventAuthority"; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { - name: "systemProgram"; - isMut: false; - isSigner: false; + name: "program"; }, ]; args: []; }, { name: "withdrawTokens"; + discriminator: [2, 4, 225, 61, 19, 182, 106, 170]; accounts: [ { name: "performancePackage"; - isMut: true; - isSigner: false; + writable: true; }, { name: "oracleAccount"; - isMut: false; - isSigner: false; }, { name: "performancePackageTokenVault"; - isMut: true; - isSigner: false; docs: ["The token account where locked tokens are stored"]; + writable: true; + relations: ["performancePackage"]; }, { name: "tokenMint"; - isMut: false; - isSigner: false; + relations: ["performancePackage"]; }, { name: "recipientTokenAccount"; - isMut: true; - isSigner: false; docs: [ "The recipient's ATA where tokens will be sent - created if needed", ]; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "recipient"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "tokenMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "recipient"; - isMut: false; - isSigner: true; docs: ["Only the recipient can withdraw"]; + signer: true; + relations: ["performancePackage"]; }, { name: "payer"; - isMut: true; - isSigner: true; docs: ["Payer for creating the ATA if needed"]; + writable: true; + signer: true; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "params"; type: { - defined: "WithdrawTokensParams"; + defined: { + name: "withdrawTokensParams"; + }; }; }, ]; }, { name: "withdrawViaSell"; + discriminator: [14, 241, 77, 159, 41, 120, 59, 96]; accounts: [ { name: "performancePackage"; - isMut: true; - isSigner: false; + writable: true; }, { name: "dao"; - isMut: true; - isSigner: false; docs: ["The futarchy Dao whose spot pool buys the tokens"]; + writable: true; }, { name: "performancePackageTokenVault"; - isMut: true; - isSigner: false; docs: [ "The token account where locked tokens are stored; the sale is paid out of it", ]; + writable: true; + relations: ["performancePackage"]; }, { name: "tokenMint"; - isMut: false; - isSigner: false; + relations: ["performancePackage"]; }, { name: "quoteMint"; - isMut: false; - isSigner: false; }, { name: "ammBaseVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "ammQuoteVault"; - isMut: true; - isSigner: false; + writable: true; }, { name: "packageQuoteAccount"; - isMut: true; - isSigner: false; docs: [ "The package's quote ATA that receives the proceeds before they are forwarded", ]; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "performancePackage"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "recipientQuoteAccount"; - isMut: true; - isSigner: false; docs: ["The recipient's quote ATA where the proceeds are sent"]; + writable: true; + pda: { + seeds: [ + { + kind: "account"; + path: "recipient"; + }, + { + kind: "const"; + value: [ + 6, + 221, + 246, + 225, + 215, + 101, + 161, + 147, + 217, + 203, + 225, + 70, + 206, + 235, + 121, + 172, + 28, + 180, + 133, + 237, + 95, + 91, + 55, + 145, + 58, + 140, + 245, + 133, + 126, + 255, + 0, + 169, + ]; + }, + { + kind: "account"; + path: "quoteMint"; + }, + ]; + program: { + kind: "const"; + value: [ + 140, + 151, + 37, + 143, + 78, + 36, + 137, + 241, + 187, + 61, + 16, + 41, + 20, + 142, + 13, + 131, + 11, + 90, + 19, + 153, + 218, + 255, + 16, + 132, + 4, + 142, + 123, + 216, + 219, + 233, + 248, + 89, + ]; + }; + }; }, { name: "recipient"; - isMut: false; - isSigner: true; docs: ["Only the recipient can withdraw"]; + signer: true; + relations: ["performancePackage"]; }, { name: "payer"; - isMut: true; - isSigner: true; docs: ["Payer for creating the ATAs if needed"]; + writable: true; + signer: true; }, { name: "futarchyProgram"; - isMut: false; - isSigner: false; + address: "FUTARELBfJfQ8RDGhg1wdhddq1odMAJUePHFuBYfUxKq"; }, { name: "futarchyEventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + program: { + kind: "account"; + path: "futarchyProgram"; + }; + }; }, { name: "systemProgram"; - isMut: false; - isSigner: false; + address: "11111111111111111111111111111111"; }, { name: "tokenProgram"; - isMut: false; - isSigner: false; + address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"; }, { name: "associatedTokenProgram"; - isMut: false; - isSigner: false; + address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"; }, { name: "eventAuthority"; - isMut: false; - isSigner: false; + pda: { + seeds: [ + { + kind: "const"; + value: [ + 95, + 95, + 101, + 118, + 101, + 110, + 116, + 95, + 97, + 117, + 116, + 104, + 111, + 114, + 105, + 116, + 121, + ]; + }, + ]; + }; }, { name: "program"; - isMut: false; - isSigner: false; }, ]; args: [ { name: "params"; type: { - defined: "WithdrawViaSellParams"; + defined: { + name: "withdrawViaSellParams"; + }; }; }, ]; }, ]; accounts: [ + { + name: "changeRequest"; + discriminator: [75, 130, 166, 47, 15, 217, 131, 190]; + }, + { + name: "dao"; + discriminator: [163, 9, 47, 31, 52, 85, 197, 49]; + }, { 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: "withdrawalPolicy"; - docs: ["`None` means uncapped, and so do expired limits"]; - type: { - option: { - defined: "WithdrawalPolicy"; - }; - }; - }, - { - name: "lastChangeProposedAt"; - docs: [ - "When the last executed change was proposed (the creation time until then); requests proposed earlier can no longer be executed", - ]; - type: "i64"; - }, - ]; - }; + discriminator: [228, 146, 174, 131, 121, 249, 99, 132]; }, + ]; + events: [ { - 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"; - }, - ]; - }; + name: "changeExecuted"; + discriminator: [50, 115, 8, 12, 139, 8, 191, 26]; + }, + { + name: "changeProposed"; + discriminator: [170, 10, 10, 8, 244, 196, 146, 151]; + }, + { + name: "performancePackageAuthorityChanged"; + discriminator: [61, 106, 117, 16, 219, 103, 0, 43]; + }, + { + name: "performancePackageInitialized"; + discriminator: [215, 87, 36, 3, 199, 219, 188, 121]; + }, + { + name: "tokensSold"; + discriminator: [217, 83, 68, 137, 134, 225, 94, 45]; + }, + { + name: "tokensWithdrawn"; + discriminator: [30, 116, 110, 147, 87, 89, 9, 158]; + }, + { + name: "unlockCompleted"; + discriminator: [9, 6, 169, 127, 233, 218, 94, 165]; + }, + { + name: "unlockStarted"; + discriminator: [156, 214, 102, 63, 177, 19, 228, 124]; }, ]; - types: [ + errors: [ { - name: "CommonFields"; - type: { - kind: "struct"; - fields: [ - { - name: "slot"; - type: "u64"; - }, - { - name: "unixTimestamp"; - type: "i64"; - }, - { - name: "performancePackageSeqNum"; - type: "u64"; - }, - ]; - }; + 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"; + }, + { + code: 6014; + name: "totalTokenAmountOverflow"; + msg: "Total token amount calculation would overflow"; + }, + { + code: 6015; + name: "recipientAuthorityMustDiffer"; + msg: "Recipient and performance package authority must be different keys"; + }, + { + code: 6016; + name: "invalidWithdrawalLimits"; + msg: "Withdrawal limits must have non-zero caps, a future end, and a window of at least one second"; + }, + { + code: 6017; + name: "insufficientWithdrawableBalance"; + msg: "Amount exceeds the withdrawable balance"; + }, + { + code: 6018; + name: "tokenWindowLimitExceeded"; + msg: "Token cap for the current window exceeded"; + }, + { + code: 6019; + name: "quoteWindowLimitExceeded"; + msg: "Quote cap for the current window exceeded"; + }, + { + code: 6020; + name: "invalidPriceObservation"; + msg: "Oracle price observation is missing or zero"; + }, + { + code: 6021; + name: "withdrawTokensDisabled"; + msg: "Token withdrawals are disabled by the withdrawal mode"; + }, + { + code: 6022; + name: "withdrawViaSellDisabled"; + msg: "Sell withdrawals are disabled by the withdrawal mode"; + }, + { + code: 6023; + name: "accountNotMigrated"; + msg: "Performance package has not been resized to the current layout"; + }, + { + code: 6024; + name: "invalidQuoteMint"; + msg: "Quote mint must differ from the package's token mint"; + }, + { + code: 6025; + name: "quoteSweepAccountsIncomplete"; + msg: "The package's quote account and the quote destination must be passed together"; + }, + { + code: 6026; + name: "oracleMintMismatch"; + msg: "Oracle Dao's base mint must be the package's token mint"; + }, + { + code: 6027; + name: "maxQuoteValueExceeded"; + msg: "Withdrawal is valued above the recipient's maximum quote value"; + }, + { + code: 6028; + name: "staleChangeRequest"; + msg: "Change request was proposed before the last executed change was proposed"; + }, + { + code: 6029; + name: "changeRequestMismatch"; + msg: "Change request was proposed at a different time than the executor expected"; }, + ]; + types: [ { - name: "CappedWithdrawal"; + name: "cappedWithdrawal"; docs: ["Present on a withdrawal that ran under active limits"]; type: { kind: "struct"; @@ -840,52 +1749,92 @@ export type PriceBasedPerformancePackage = { name: "usage"; docs: ["Window usage after this withdrawal"]; type: { - defined: "WindowUsage"; + defined: { + name: "windowUsage"; + }; }; }, ]; }; }, { - name: "ChangePerformancePackageAuthorityParams"; + name: "changeExecuted"; type: { kind: "struct"; fields: [ { - name: "newPerformancePackageAuthority"; - type: "publicKey"; + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "performancePackage"; + type: "pubkey"; + }, + { + name: "changeRequest"; + type: "pubkey"; + }, + { + name: "executor"; + type: "pubkey"; + }, + { + name: "changeType"; + type: { + defined: { + name: "changeType"; + }; + }; }, ]; }; }, { - name: "ExecuteChangeParams"; + name: "changePerformancePackageAuthorityParams"; type: { kind: "struct"; fields: [ { - name: "expectedProposedAt"; - type: "i64"; + name: "newPerformancePackageAuthority"; + type: "pubkey"; }, ]; }; }, { - name: "InitializePerformancePackageWithLimitsParams"; + name: "changeProposed"; type: { kind: "struct"; fields: [ { - name: "base"; + name: "common"; type: { - defined: "InitializePerformancePackageParams"; + defined: { + name: "commonFields"; + }; }; }, { - name: "limits"; + name: "locker"; + type: "pubkey"; + }, + { + name: "changeRequest"; + type: "pubkey"; + }, + { + name: "proposer"; + type: "pubkey"; + }, + { + name: "changeType"; type: { - option: { - defined: "LimitsParams"; + defined: { + name: "changeType"; }; }; }, @@ -893,2643 +1842,1271 @@ export type PriceBasedPerformancePackage = { }; }, { - name: "InitializePerformancePackageParams"; + name: "changeRequest"; type: { kind: "struct"; fields: [ { - name: "tranches"; + name: "performancePackage"; + docs: ["The performance package this change applies to"]; + type: "pubkey"; + }, + { + name: "changeType"; + docs: ["What is being changed"]; type: { - vec: { - defined: "Tranche"; + defined: { + name: "changeType"; }; }; }, { - name: "minUnlockTimestamp"; + name: "proposedAt"; + docs: ["When the change was proposed"]; type: "i64"; }, { - name: "oracleConfig"; + name: "proposerType"; + docs: [ + "Who proposed this change (either token_recipient or locker_authority)", + ]; type: { - defined: "OracleConfig"; + defined: { + name: "proposerType"; + }; }; }, { - name: "twapLengthSeconds"; + name: "pdaNonce"; + docs: ["Used to derive the PDA along with the proposer"]; type: "u32"; }, { - name: "grantee"; - type: "publicKey"; - }, - { - name: "performancePackageAuthority"; - type: "publicKey"; + name: "pdaBump"; + docs: ["The PDA bump"]; + type: "u8"; }, ]; }; }, { - name: "ProposeChangeParams"; + name: "changeType"; type: { - kind: "struct"; - fields: [ + kind: "enum"; + variants: [ { - name: "changeType"; - type: { - defined: "ChangeType"; - }; + name: "oracle"; + fields: [ + { + name: "newOracleConfig"; + type: { + defined: { + name: "oracleConfig"; + }; + }; + }, + ]; }, { - name: "pdaNonce"; - type: "u32"; + name: "recipient"; + fields: [ + { + name: "newRecipient"; + type: "pubkey"; + }, + ]; }, - ]; - }; + { + name: "unlockTerms"; + fields: [ + { + name: "minUnlockTimestamp"; + type: "i64"; + }, + { + name: "limits"; + type: { + option: { + defined: { + name: "limitsParams"; + }; + }; + }; + }, + ]; + }, + ]; + }; }, { - name: "WithdrawTokensParams"; + name: "commonFields"; type: { kind: "struct"; fields: [ { - name: "amount"; + name: "slot"; type: "u64"; }, { - name: "maxQuoteValue"; + name: "unixTimestamp"; + type: "i64"; + }, + { + name: "performancePackageSeqNum"; type: "u64"; }, ]; }; }, { - name: "WithdrawViaSellParams"; + name: "dao"; type: { kind: "struct"; fields: [ { - name: "amount"; - type: "u64"; + name: "amm"; + docs: ["Embedded FutarchyAmm - 1:1 relationship"]; + type: { + defined: { + name: "futarchyAmm"; + }; + }; }, { - name: "minQuoteOut"; + name: "nonce"; + docs: ["`nonce` + `dao_creator` are PDA seeds"]; type: "u64"; }, - ]; - }; - }, - { - name: "OracleConfig"; - docs: [ - "Starting at `byte_offset` in `oracle_account`, the unlock instructions read:", - "- 16 bytes for the aggregator, stored as a little endian u128", - "- 8 bytes for the timestamp that the aggregator was last updated, stored as", - "a little endian i64", - "", - "While withdrawal limits are active, `oracle_account` must also be a futarchy", - "`Dao`: the withdraw instructions value withdrawals from its spot pool, at the", - "higher of the pool's damped observation and its reserve price.", - "", - "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: "daoCreator"; + type: "pubkey"; }, { - name: "byteOffset"; + name: "pdaBump"; + type: "u8"; + }, + { + name: "squadsMultisig"; + type: "pubkey"; + }, + { + name: "squadsMultisigVault"; + type: "pubkey"; + }, + { + name: "baseMint"; + type: "pubkey"; + }, + { + name: "quoteMint"; + type: "pubkey"; + }, + { + name: "proposalCount"; type: "u32"; }, - ]; - }; - }, - { - name: "Tranche"; - type: { - kind: "struct"; - fields: [ { - name: "priceThreshold"; - docs: ["The price at which this tranch unlocks"]; - type: "u128"; + name: "passThresholdBps"; + type: "u16"; }, { - name: "tokenAmount"; - docs: ["The amount of tokens in this tranch"]; - type: "u64"; + name: "secondsPerProposal"; + type: "u32"; }, - ]; - }; - }, - { - name: "StoredTranche"; - type: { - kind: "struct"; - fields: [ { - name: "priceThreshold"; + 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: "tokenAmount"; - type: "u64"; + name: "twapMaxObservationChangePerUpdate"; + type: "u128"; }, { - name: "isUnlocked"; - type: "bool"; + name: "twapStartDelaySeconds"; + docs: [ + "Forces TWAP calculation to start after `twap_start_delay_seconds` seconds", + ]; + type: "u32"; }, - ]; - }; - }, - { - name: "OldPerformancePackage"; - docs: [ - "The 0.6.0 layout, decoded by the resize before an account is migrated", - ]; - type: { - kind: "struct"; - fields: [ { - name: "tranches"; - type: { - vec: { - defined: "StoredTranche"; - }; - }; + 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: "totalTokenAmount"; + name: "minBaseFutarchicLiquidity"; type: "u64"; }, { - name: "alreadyUnlockedAmount"; + name: "baseToStake"; + docs: [ + "Minimum amount of base tokens that must be staked to launch a proposal", + ]; type: "u64"; }, { - name: "minUnlockTimestamp"; - type: "i64"; + name: "seqNum"; + type: "u64"; }, { - name: "oracleConfig"; + name: "initialSpendingLimit"; + docs: [ + "The authoritative record of what the Squads spending limit should be.", + "`None` = no limit. Kept in sync with the Squads-side account by", + "`sync_spending_limit`. (Named for its original init-only role)", + ]; type: { - defined: "OracleConfig"; + option: { + defined: { + name: "initialSpendingLimit"; + }; + }; }; }, { - name: "twapLengthSeconds"; - type: "u32"; + 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: "recipient"; - type: "publicKey"; + name: "teamAddress"; + type: "pubkey"; }, { - name: "state"; + name: "optimisticProposal"; + docs: ["Deprecated in favor of typed proposals"]; type: { - defined: "PerformancePackageState"; + option: { + defined: { + name: "optimisticProposal"; + }; + }; }; }, { - name: "createKey"; - type: "publicKey"; - }, - { - name: "pdaBump"; - type: "u8"; + name: "isOptimisticGovernanceEnabled"; + docs: ["Deprecated in favor of typed proposals"]; + type: "bool"; }, { - name: "performancePackageAuthority"; - type: "publicKey"; + name: "liquidator"; + docs: [ + "`Some` means the DAO has been liquidated, and holds who runs the estate.", + "Set once by `finalize_proposal` the moment a hostile liquidation", + "passes, never cleared.", + ]; + type: { + option: "pubkey"; + }; }, { - name: "tokenMint"; - type: "publicKey"; + name: "lastFailedTakeoverAt"; + docs: ["Unix time of the last failed hostile takeover. 0 = never."]; + type: "i64"; }, { - name: "seqNum"; - type: "u64"; + name: "lastFailedLiquidationAt"; + docs: [ + "Unix time of the last failed hostile liquidation. 0 = never.", + ]; + type: "i64"; }, { - name: "performancePackageTokenVault"; - type: "publicKey"; + name: "spendingLimitDirty"; + docs: [ + "Set by every write to the spending-limit record (`initial_spending_limit`),", + "consumed by `sync_spending_limit`.", + ]; + type: "bool"; }, - ]; - }; - }, - { - name: "WithdrawalPolicy"; - docs: [ - "The agreed limits together with the usage they are enforced against", - ]; - type: { - kind: "struct"; - fields: [ { - name: "limits"; - type: { - defined: "WithdrawalLimits"; - }; + name: "lastBuybackFinalizedAt"; + docs: ["Unix time of the last buyback finalization. 0 = never."]; + type: "i64"; }, { - name: "usage"; - type: { - defined: "WindowUsage"; - }; + name: "typedProposalsEnabled"; + docs: [ + "Whether the DAO runs on the mini-instructions catalog. Never turns off.", + ]; + type: "bool"; }, ]; }; }, { - name: "WindowUsage"; - docs: ["Usage in the window the last withdrawal fell in"]; + name: "executeChangeParams"; type: { kind: "struct"; fields: [ { - name: "windowIndex"; - docs: [ - "`(now - limits.start_timestamp) / limits.window_seconds` at the last withdrawal", - ]; + name: "expectedProposedAt"; type: "i64"; }, - { - name: "tokensUsed"; - type: "u64"; - }, - { - name: "quoteUsed"; - type: "u64"; - }, ]; }; }, { - name: "WithdrawalLimits"; + name: "futarchyAmm"; type: { kind: "struct"; fields: [ { - name: "startTimestamp"; - docs: [ - "Anchor for window boundaries; set by the program when limits take effect or `window_seconds` changes", - ]; - type: "i64"; + name: "state"; + type: { + defined: { + name: "poolState"; + }; + }; }, { - name: "endTimestamp"; - docs: ["Caps apply while `now < end_timestamp`"]; - type: "i64"; + name: "totalLiquidity"; + type: "u128"; }, { - name: "windowSeconds"; - docs: ["Duration of the window in seconds"]; - type: "u32"; + name: "baseMint"; + type: "pubkey"; }, { - name: "maxTokensPerWindow"; - docs: ["Max base tokens withdrawn per window"]; - type: "u64"; + name: "quoteMint"; + type: "pubkey"; }, { - name: "maxQuotePerWindow"; - docs: ["Max quote value withdrawn per window, in quote atoms"]; - type: "u64"; + name: "ammBaseVault"; + type: "pubkey"; }, { - name: "withdrawalMode"; - docs: [ - "Which withdrawal routes the recipient may use while the caps are active", - ]; - type: { - defined: "WithdrawalMode"; - }; + name: "ammQuoteVault"; + type: "pubkey"; }, ]; }; }, { - name: "LimitsParams"; - docs: [ - "What the two parties agree on; the program supplies `start_timestamp`", - ]; + name: "initialSpendingLimit"; type: { kind: "struct"; fields: [ { - name: "endTimestamp"; - type: "i64"; - }, - { - name: "windowSeconds"; - type: "u32"; - }, - { - name: "maxTokensPerWindow"; - type: "u64"; - }, - { - name: "maxQuotePerWindow"; + name: "amountPerMonth"; type: "u64"; }, { - name: "withdrawalMode"; + name: "members"; type: { - defined: "WithdrawalMode"; + vec: "pubkey"; }; }, ]; }; }, { - name: "WithdrawalMode"; + name: "initializePerformancePackageParams"; type: { - kind: "enum"; - variants: [ + kind: "struct"; + fields: [ { - name: "Tokens"; + name: "tranches"; + type: { + vec: { + defined: { + name: "tranche"; + }; + }; + }; }, { - name: "Sell"; + name: "minUnlockTimestamp"; + type: "i64"; + }, + { + name: "oracleConfig"; + type: { + defined: { + name: "oracleConfig"; + }; + }; }, { - name: "Both"; + name: "twapLengthSeconds"; + type: "u32"; + }, + { + name: "grantee"; + type: "pubkey"; + }, + { + name: "performancePackageAuthority"; + type: "pubkey"; }, ]; }; }, { - name: "PerformancePackageState"; + name: "initializePerformancePackageWithLimitsParams"; type: { - kind: "enum"; - variants: [ + kind: "struct"; + fields: [ { - name: "Locked"; + name: "base"; + type: { + defined: { + name: "initializePerformancePackageParams"; + }; + }; }, { - 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: "limits"; + type: { + option: { + defined: { + name: "limitsParams"; + }; + }; + }; + }, + ]; + }; + }, + { + name: "limitsParams"; + docs: [ + "What the two parties agree on; the program supplies `start_timestamp`", + ]; + type: { + kind: "struct"; + fields: [ + { + name: "endTimestamp"; + type: "i64"; + }, + { + name: "windowSeconds"; + type: "u32"; + }, + { + name: "maxTokensPerWindow"; + type: "u64"; + }, + { + name: "maxQuotePerWindow"; + type: "u64"; + }, + { + name: "withdrawalMode"; + type: { + defined: { + name: "withdrawalMode"; + }; + }; + }, + ]; + }; + }, + { + name: "optimisticProposal"; + type: { + kind: "struct"; + fields: [ + { + name: "squadsProposal"; + docs: [ + "The squads proposal currently enqueued for execution if not challenged by a new proposal.", + ]; + type: "pubkey"; + }, + { + name: "enqueuedTimestamp"; + docs: [ + "The timestamp when the active optimistic squads proposal was enqueued.", ]; + type: "i64"; }, ]; }; }, { - name: "ChangeType"; + name: "oracleConfig"; + docs: [ + "Starting at `byte_offset` in `oracle_account`, the unlock instructions read:", + "- 16 bytes for the aggregator, stored as a little endian u128", + "- 8 bytes for the timestamp that the aggregator was last updated, stored as", + "a little endian i64", + "", + "While withdrawal limits are active, `oracle_account` must also be a futarchy", + "`Dao`: the withdraw instructions value withdrawals from its spot pool, at the", + "higher of the pool's damped observation and its reserve price.", + "", + "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: "enum"; - variants: [ + kind: "struct"; + fields: [ { - name: "Oracle"; - fields: [ - { - name: "newOracleConfig"; - type: { - defined: "OracleConfig"; + name: "oracleAccount"; + type: "pubkey"; + }, + { + name: "byteOffset"; + type: "u32"; + }, + ]; + }; + }, + { + name: "performancePackage"; + type: { + kind: "struct"; + fields: [ + { + name: "tranches"; + docs: ["The tranches that make up the performance package"]; + type: { + vec: { + defined: { + name: "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: { + name: "oracleConfig"; + }; + }; + }, + { + name: "twapLengthSeconds"; + docs: [ + "Length of time in seconds for TWAP calculation, between 1 day and 1 year", ]; + type: "u32"; }, { - name: "Recipient"; - fields: [ - { - name: "newRecipient"; - type: "publicKey"; - }, + name: "recipient"; + docs: ["The recipient of the tokens when unlocked"]; + type: "pubkey"; + }, + { + name: "state"; + docs: ["The current state of the locker"]; + type: { + defined: { + name: "performancePackageState"; + }; + }; + }, + { + name: "createKey"; + docs: ["Used to derive the PDA"]; + type: "pubkey"; + }, + { + name: "pdaBump"; + docs: ["The PDA bump"]; + type: "u8"; + }, + { + name: "performancePackageAuthority"; + docs: [ + "The authorized locker authority that can execute changes, usually the organization", ]; + type: "pubkey"; }, { - name: "UnlockTerms"; - fields: [ - { - name: "minUnlockTimestamp"; - type: "i64"; - }, - { - name: "limits"; - type: { - option: { - defined: "LimitsParams"; - }; + name: "tokenMint"; + docs: ["The mint of the locked tokens"]; + type: "pubkey"; + }, + { + 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: "pubkey"; + }, + { + name: "withdrawalPolicy"; + docs: ["`None` means uncapped, and so do expired limits"]; + type: { + option: { + defined: { + name: "withdrawalPolicy"; }; - }, + }; + }; + }, + { + name: "lastChangeProposedAt"; + docs: [ + "When the last executed change was proposed (the creation time until then); requests proposed earlier can no longer be executed", ]; + type: "i64"; }, ]; }; }, { - name: "ProposerType"; + name: "performancePackageAuthorityChanged"; type: { - kind: "enum"; - variants: [ + kind: "struct"; + fields: [ + { + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; + }, + { + name: "locker"; + type: "pubkey"; + }, { - name: "Recipient"; + name: "oldAuthority"; + type: "pubkey"; }, { - name: "Authority"; + name: "newAuthority"; + type: "pubkey"; }, ]; }; }, - ]; - 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: "TokensWithdrawn"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "performancePackage"; - type: "publicKey"; - index: false; - }, - { - name: "recipient"; - type: "publicKey"; - index: false; - }, - { - name: "amount"; - type: "u64"; - index: false; - }, - { - name: "capped"; - type: { - option: { - defined: "CappedWithdrawal"; - }; - }; - index: false; - }, - ]; - }, - { - name: "TokensSold"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - name: "performancePackage"; - type: "publicKey"; - index: false; - }, - { - name: "recipient"; - type: "publicKey"; - index: false; - }, - { - name: "amount"; - type: "u64"; - index: false; - }, - { - name: "quoteReceived"; - type: "u64"; - index: false; - }, - { - name: "minQuoteOut"; - type: "u64"; - index: false; - }, - { - name: "capped"; - type: { - option: { - defined: "WindowUsage"; - }; - }; - index: false; - }, - ]; - }, - { - name: "ChangeProposed"; - fields: [ - { - name: "common"; - type: { - defined: "CommonFields"; - }; - index: false; - }, - { - 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"; - }, - { - code: 6014; - name: "TotalTokenAmountOverflow"; - msg: "Total token amount calculation would overflow"; - }, - { - code: 6015; - name: "RecipientAuthorityMustDiffer"; - msg: "Recipient and performance package authority must be different keys"; - }, - { - code: 6016; - name: "InvalidWithdrawalLimits"; - msg: "Withdrawal limits must have non-zero caps, a future end, and a window of at least one second"; - }, - { - code: 6017; - name: "InsufficientWithdrawableBalance"; - msg: "Amount exceeds the withdrawable balance"; - }, - { - code: 6018; - name: "TokenWindowLimitExceeded"; - msg: "Token cap for the current window exceeded"; - }, - { - code: 6019; - name: "QuoteWindowLimitExceeded"; - msg: "Quote cap for the current window exceeded"; - }, - { - code: 6020; - name: "InvalidPriceObservation"; - msg: "Oracle price observation is missing or zero"; - }, - { - code: 6021; - name: "WithdrawTokensDisabled"; - msg: "Token withdrawals are disabled by the withdrawal mode"; - }, - { - code: 6022; - name: "WithdrawViaSellDisabled"; - msg: "Sell withdrawals are disabled by the withdrawal mode"; - }, - { - code: 6023; - name: "AccountNotMigrated"; - msg: "Performance package has not been resized to the current layout"; - }, - { - code: 6024; - name: "InvalidQuoteMint"; - msg: "Quote mint must differ from the package's token mint"; - }, - { - code: 6025; - name: "QuoteSweepAccountsIncomplete"; - msg: "The package's quote account and the quote destination must be passed together"; - }, - { - code: 6026; - name: "OracleMintMismatch"; - msg: "Oracle Dao's base mint must be the package's token mint"; - }, - { - code: 6027; - name: "MaxQuoteValueExceeded"; - msg: "Withdrawal is valued above the recipient's maximum quote value"; - }, - { - code: 6028; - name: "StaleChangeRequest"; - msg: "Change request was proposed before the last executed change was proposed"; - }, - { - code: 6029; - name: "ChangeRequestMismatch"; - msg: "Change request was proposed at a different time than the executor expected"; - }, - ]; -}; - -export const IDL: PriceBasedPerformancePackage = { - version: "0.6.1", - name: "price_based_performance_package", - constants: [ - { - name: "MAX_TRANCHES", - type: { - defined: "usize", - }, - value: "10", - }, - { - name: "PRICE_SCALE", - type: "u128", - value: "1_000_000_000_000", - }, - ], - 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: "initializePerformancePackageWithLimits", - 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: "InitializePerformancePackageWithLimitsParams", - }, - }, - ], - }, - { - 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: "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)", - ], - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "ExecuteChangeParams", - }, - }, - ], - }, - { - name: "changePerformancePackageAuthority", - accounts: [ - { - name: "performancePackage", - isMut: true, - isSigner: false, - }, - { - name: "currentAuthority", - isMut: false, - isSigner: true, - }, - { - name: "eventAuthority", - isMut: false, - isSigner: false, - }, - { - name: "program", - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: "params", - type: { - defined: "ChangePerformancePackageAuthorityParams", - }, - }, - ], - }, - { - name: "burnPerformancePackage", - accounts: [ - { - name: "performancePackage", - isMut: true, - isSigner: false, - }, - { - name: "performancePackageTokenVault", - isMut: true, - isSigner: false, - docs: [ - "Emptied by the payout and the burn, then closed to the spill account", - ], - }, - { - name: "recipient", - isMut: false, - isSigner: false, - }, - { - name: "recipientTokenAccount", - isMut: true, - isSigner: false, - docs: [ - "Any token account owned by the recipient; receives the unlocked balance", - ], - }, - { - name: "admin", - isMut: false, - isSigner: true, - }, - { - name: "spillAccount", - isMut: true, - isSigner: false, - }, - { - name: "tokenMint", - isMut: true, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - isOptional: true, - docs: [ - "The mint of the package's quote ATA; any mint other than the package's token mint", - ], - }, - { - name: "packageQuoteAccount", - isMut: true, - isSigner: false, - isOptional: true, - docs: [ - "The package's quote ATA, swept into `quote_destination` and closed when passed", - ], - }, - { - name: "quoteDestination", - isMut: true, - isSigner: false, - isOptional: true, - docs: ["Where the quote balance goes, chosen by the admin"], - }, - { - name: "tokenProgram", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "resizePerformancePackage", - accounts: [ - { - name: "performancePackage", - isMut: true, - isSigner: false, - }, - { - name: "payer", - isMut: true, - isSigner: true, - }, - { - name: "systemProgram", - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: "withdrawTokens", - 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, - }, - { - name: "recipientTokenAccount", - isMut: true, - isSigner: false, - docs: [ - "The recipient's ATA where tokens will be sent - created if needed", - ], - }, - { - name: "recipient", - isMut: false, - isSigner: true, - docs: ["Only the recipient can withdraw"], - }, - { - 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: "params", - type: { - defined: "WithdrawTokensParams", - }, - }, - ], - }, - { - name: "withdrawViaSell", - accounts: [ - { - name: "performancePackage", - isMut: true, - isSigner: false, - }, - { - name: "dao", - isMut: true, - isSigner: false, - docs: ["The futarchy Dao whose spot pool buys the tokens"], - }, - { - name: "performancePackageTokenVault", - isMut: true, - isSigner: false, - docs: [ - "The token account where locked tokens are stored; the sale is paid out of it", - ], - }, - { - name: "tokenMint", - isMut: false, - isSigner: false, - }, - { - name: "quoteMint", - isMut: false, - isSigner: false, - }, - { - name: "ammBaseVault", - isMut: true, - isSigner: false, - }, - { - name: "ammQuoteVault", - isMut: true, - isSigner: false, - }, - { - name: "packageQuoteAccount", - isMut: true, - isSigner: false, - docs: [ - "The package's quote ATA that receives the proceeds before they are forwarded", - ], - }, - { - name: "recipientQuoteAccount", - isMut: true, - isSigner: false, - docs: ["The recipient's quote ATA where the proceeds are sent"], - }, - { - name: "recipient", - isMut: false, - isSigner: true, - docs: ["Only the recipient can withdraw"], - }, - { - name: "payer", - isMut: true, - isSigner: true, - docs: ["Payer for creating the ATAs if needed"], - }, - { - name: "futarchyProgram", - isMut: false, - isSigner: false, - }, - { - name: "futarchyEventAuthority", - 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: "params", - type: { - defined: "WithdrawViaSellParams", - }, - }, - ], - }, - ], - accounts: [ - { - name: "performancePackage", + name: "performancePackageInitialized"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "tranches", - docs: ["The tranches that make up the performance package"], + name: "common"; 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", + defined: { + name: "commonFields"; + }; + }; }, { - name: "oracleConfig", - docs: ["Where to pull price data from"], - type: { - defined: "OracleConfig", - }, + name: "performancePackage"; + type: "pubkey"; }, + ]; + }; + }, + { + name: "performancePackageState"; + type: { + kind: "enum"; + variants: [ { - name: "twapLengthSeconds", - docs: [ - "Length of time in seconds for TWAP calculation, between 1 day and 1 year", - ], - type: "u32", + name: "locked"; }, { - name: "recipient", - docs: ["The recipient of the tokens when unlocked"], - type: "publicKey", + 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: "pool"; + type: { + kind: "struct"; + fields: [ { - name: "state", - docs: ["The current state of the locker"], + name: "oracle"; type: { - defined: "PerformancePackageState", - }, - }, - { - name: "createKey", - docs: ["Used to derive the PDA"], - type: "publicKey", + defined: { + name: "twapOracle"; + }; + }; }, { - name: "pdaBump", - docs: ["The PDA bump"], - type: "u8", + name: "quoteReserves"; + type: "u64"; }, { - name: "performancePackageAuthority", - docs: [ - "The authorized locker authority that can execute changes, usually the organization", - ], - type: "publicKey", + name: "baseReserves"; + type: "u64"; }, { - name: "tokenMint", - docs: ["The mint of the locked tokens"], - type: "publicKey", + name: "quoteProtocolFeeBalance"; + type: "u64"; }, { - name: "seqNum", - docs: [ - "The sequence number of the performance package, used for indexing events", - ], - type: "u64", + name: "baseProtocolFeeBalance"; + type: "u64"; }, + ]; + }; + }, + { + name: "poolState"; + type: { + kind: "enum"; + variants: [ { - name: "performancePackageTokenVault", - docs: ["The vault that stores the tokens"], - type: "publicKey", + name: "spot"; + fields: [ + { + name: "spot"; + type: { + defined: { + name: "pool"; + }; + }; + }, + ]; }, { - name: "withdrawalPolicy", - docs: ["`None` means uncapped, and so do expired limits"], - type: { - option: { - defined: "WithdrawalPolicy", + name: "futarchy"; + fields: [ + { + name: "spot"; + type: { + defined: { + name: "pool"; + }; + }; + }, + { + name: "pass"; + type: { + defined: { + name: "pool"; + }; + }; + }, + { + name: "fail"; + type: { + defined: { + name: "pool"; + }; + }; }, - }, - }, - { - name: "lastChangeProposedAt", - docs: [ - "When the last executed change was proposed (the creation time until then); requests proposed earlier can no longer be executed", - ], - type: "i64", + ]; }, - ], - }, + ]; + }; }, { - name: "changeRequest", + name: "proposeChangeParams"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "performancePackage", - docs: ["The performance package this change applies to"], - type: "publicKey", - }, - { - name: "changeType", - docs: ["What is being changed"], + name: "changeType"; type: { - defined: "ChangeType", - }, - }, - { - name: "proposedAt", - docs: ["When the change was proposed"], - type: "i64", + defined: { + name: "changeType"; + }; + }; }, { - name: "proposerType", - docs: [ - "Who proposed this change (either token_recipient or locker_authority)", - ], - type: { - defined: "ProposerType", - }, + name: "pdaNonce"; + type: "u32"; }, + ]; + }; + }, + { + name: "proposerType"; + type: { + kind: "enum"; + variants: [ { - name: "pdaNonce", - docs: ["Used to derive the PDA along with the proposer"], - type: "u32", + name: "recipient"; }, { - name: "pdaBump", - docs: ["The PDA bump"], - type: "u8", + name: "authority"; }, - ], - }, + ]; + }; }, - ], - types: [ { - name: "CommonFields", + name: "storedTranche"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "slot", - type: "u64", + name: "priceThreshold"; + type: "u128"; }, { - name: "unixTimestamp", - type: "i64", + name: "tokenAmount"; + type: "u64"; }, { - name: "performancePackageSeqNum", - type: "u64", + name: "isUnlocked"; + type: "bool"; }, - ], - }, + ]; + }; }, { - name: "CappedWithdrawal", - docs: ["Present on a withdrawal that ran under active limits"], + name: "tokensSold"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "price", - docs: [ - "The price the withdrawal was valued at: the higher of the spot pool's observation and its reserve price", - ], - type: "u128", + name: "common"; + type: { + defined: { + name: "commonFields"; + }; + }; }, { - name: "quoteValue", - docs: ["`amount` valued at that price, in quote atoms"], - type: "u64", + name: "performancePackage"; + type: "pubkey"; }, { - name: "usage", - docs: ["Window usage after this withdrawal"], - type: { - defined: "WindowUsage", - }, + name: "recipient"; + type: "pubkey"; }, - ], - }, - }, - { - name: "ChangePerformancePackageAuthorityParams", - type: { - kind: "struct", - fields: [ { - name: "newPerformancePackageAuthority", - type: "publicKey", + name: "amount"; + type: "u64"; }, - ], - }, - }, - { - name: "ExecuteChangeParams", - type: { - kind: "struct", - fields: [ { - name: "expectedProposedAt", - type: "i64", + name: "quoteReceived"; + type: "u64"; }, - ], - }, - }, - { - name: "InitializePerformancePackageWithLimitsParams", - type: { - kind: "struct", - fields: [ { - name: "base", - type: { - defined: "InitializePerformancePackageParams", - }, + name: "minQuoteOut"; + type: "u64"; }, { - name: "limits", + name: "capped"; + docs: [ + "Window usage after this sale; `None` when no limits were active", + ]; type: { option: { - defined: "LimitsParams", - }, - }, + defined: { + name: "windowUsage"; + }; + }; + }; }, - ], - }, + ]; + }; }, { - name: "InitializePerformancePackageParams", + name: "tokensWithdrawn"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "tranches", - type: { - vec: { - defined: "Tranche", - }, - }, - }, - { - name: "minUnlockTimestamp", - type: "i64", - }, - { - name: "oracleConfig", + name: "common"; type: { - defined: "OracleConfig", - }, + defined: { + name: "commonFields"; + }; + }; }, { - name: "twapLengthSeconds", - type: "u32", + name: "performancePackage"; + type: "pubkey"; }, { - name: "grantee", - type: "publicKey", + name: "recipient"; + type: "pubkey"; }, { - name: "performancePackageAuthority", - type: "publicKey", + name: "amount"; + type: "u64"; }, - ], - }, - }, - { - name: "ProposeChangeParams", - type: { - kind: "struct", - fields: [ { - name: "changeType", + name: "capped"; + docs: ["`None` when no limits were active"]; type: { - defined: "ChangeType", - }, - }, - { - name: "pdaNonce", - type: "u32", + option: { + defined: { + name: "cappedWithdrawal"; + }; + }; + }; }, - ], - }, + ]; + }; }, { - name: "WithdrawTokensParams", + name: "tranche"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "amount", - type: "u64", + name: "priceThreshold"; + docs: ["The price at which this tranch unlocks"]; + type: "u128"; }, { - name: "maxQuoteValue", - type: "u64", + name: "tokenAmount"; + docs: ["The amount of tokens in this tranch"]; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "WithdrawViaSellParams", + name: "twapOracle"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "amount", - type: "u64", - }, - { - name: "minQuoteOut", - type: "u64", + name: "aggregator"; + docs: [ + "Running sum of seconds_since_last_update * last_observation.", + "", + "Assuming latest observations are as big as possible (u64::MAX * 1e12),", + "we can store 18 million seconds worth of observations, which turns out to", + "be ~213 days.", + "", + "Assuming that latest observations are 100x smaller than they could theoretically", + "be, we can store ~57 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.", + "", + "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: "OracleConfig", - docs: [ - "Starting at `byte_offset` in `oracle_account`, the unlock instructions read:", - "- 16 bytes for the aggregator, stored as a little endian u128", - "- 8 bytes for the timestamp that the aggregator was last updated, stored as", - "a little endian i64", - "", - "While withdrawal limits are active, `oracle_account` must also be a futarchy", - "`Dao`: the withdraw instructions value withdrawals from its spot pool, at the", - "higher of the pool's damped observation and its reserve price.", - "", - "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: "lastUpdatedTimestamp"; + type: "i64"; }, { - name: "byteOffset", - type: "u32", + name: "createdAtTimestamp"; + type: "i64"; }, - ], - }, - }, - { - name: "Tranche", - type: { - kind: "struct", - fields: [ { - name: "priceThreshold", - docs: ["The price at which this tranch unlocks"], - type: "u128", + 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: "tokenAmount", - docs: ["The amount of tokens in this tranch"], - type: "u64", + 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: "StoredTranche", - type: { - kind: "struct", - fields: [ { - name: "priceThreshold", - type: "u128", + name: "maxObservationChangePerUpdate"; + docs: ["The most that an observation can change per update."]; + type: "u128"; }, { - name: "tokenAmount", - type: "u64", + name: "initialObservation"; + docs: ["What the initial `latest_observation` is set to."]; + type: "u128"; }, { - name: "isUnlocked", - type: "bool", + name: "startDelaySeconds"; + docs: [ + "Number of seconds after amm.created_at_slot to start recording TWAP", + ]; + type: "u32"; }, - ], - }, + ]; + }; }, { - name: "OldPerformancePackage", - docs: [ - "The 0.6.0 layout, decoded by the resize before an account is migrated", - ], + name: "unlockCompleted"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "tranches", - type: { - vec: { - defined: "StoredTranche", - }, - }, - }, - { - name: "totalTokenAmount", - type: "u64", - }, - { - name: "alreadyUnlockedAmount", - type: "u64", - }, - { - name: "minUnlockTimestamp", - type: "i64", - }, - { - name: "oracleConfig", - type: { - defined: "OracleConfig", - }, - }, - { - name: "twapLengthSeconds", - type: "u32", - }, - { - name: "recipient", - type: "publicKey", - }, - { - name: "state", + name: "common"; type: { - defined: "PerformancePackageState", - }, - }, - { - name: "createKey", - type: "publicKey", - }, - { - name: "pdaBump", - type: "u8", + defined: { + name: "commonFields"; + }; + }; }, { - name: "performancePackageAuthority", - type: "publicKey", + name: "performancePackage"; + type: "pubkey"; }, { - name: "tokenMint", - type: "publicKey", + name: "tokenAmount"; + type: "u64"; }, { - name: "seqNum", - type: "u64", + name: "recipient"; + type: "pubkey"; }, { - name: "performancePackageTokenVault", - type: "publicKey", + name: "twapPrice"; + type: "u128"; }, - ], - }, + ]; + }; }, { - name: "WithdrawalPolicy", - docs: [ - "The agreed limits together with the usage they are enforced against", - ], + name: "unlockStarted"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "limits", + name: "common"; type: { - defined: "WithdrawalLimits", - }, + defined: { + name: "commonFields"; + }; + }; }, { - name: "usage", - type: { - defined: "WindowUsage", - }, + name: "performancePackage"; + type: "pubkey"; + }, + { + name: "startAggregator"; + type: "u128"; }, - ], - }, + { + name: "startTimestamp"; + type: "i64"; + }, + ]; + }; }, { - name: "WindowUsage", - docs: ["Usage in the window the last withdrawal fell in"], + name: "windowUsage"; + docs: ["Usage in the window the last withdrawal fell in"]; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "windowIndex", + name: "windowIndex"; docs: [ "`(now - limits.start_timestamp) / limits.window_seconds` at the last withdrawal", - ], - type: "i64", + ]; + type: "i64"; }, { - name: "tokensUsed", - type: "u64", + name: "tokensUsed"; + type: "u64"; }, { - name: "quoteUsed", - type: "u64", + name: "quoteUsed"; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "WithdrawalLimits", + name: "withdrawTokensParams"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "startTimestamp", - docs: [ - "Anchor for window boundaries; set by the program when limits take effect or `window_seconds` changes", - ], - type: "i64", - }, - { - name: "endTimestamp", - docs: ["Caps apply while `now < end_timestamp`"], - type: "i64", - }, - { - name: "windowSeconds", - docs: ["Duration of the window in seconds"], - type: "u32", - }, - { - name: "maxTokensPerWindow", - docs: ["Max base tokens withdrawn per window"], - type: "u64", - }, - { - name: "maxQuotePerWindow", - docs: ["Max quote value withdrawn per window, in quote atoms"], - type: "u64", + name: "amount"; + type: "u64"; }, { - name: "withdrawalMode", - docs: [ - "Which withdrawal routes the recipient may use while the caps are active", - ], - type: { - defined: "WithdrawalMode", - }, + name: "maxQuoteValue"; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "LimitsParams", - docs: [ - "What the two parties agree on; the program supplies `start_timestamp`", - ], + name: "withdrawViaSellParams"; type: { - kind: "struct", + kind: "struct"; fields: [ { - name: "endTimestamp", - type: "i64", - }, - { - name: "windowSeconds", - type: "u32", - }, - { - name: "maxTokensPerWindow", - type: "u64", - }, - { - name: "maxQuotePerWindow", - type: "u64", + name: "amount"; + type: "u64"; }, { - name: "withdrawalMode", - type: { - defined: "WithdrawalMode", - }, + name: "minQuoteOut"; + type: "u64"; }, - ], - }, + ]; + }; }, { - name: "WithdrawalMode", + name: "withdrawalLimits"; type: { - kind: "enum", - variants: [ + kind: "struct"; + fields: [ { - name: "Tokens", + name: "startTimestamp"; + docs: [ + "Anchor for window boundaries; set by the program when limits take effect or `window_seconds` changes", + ]; + type: "i64"; }, { - name: "Sell", + name: "endTimestamp"; + docs: ["Caps apply while `now < end_timestamp`"]; + type: "i64"; }, { - name: "Both", + name: "windowSeconds"; + docs: ["Duration of the window in seconds"]; + type: "u32"; }, - ], - }, - }, - { - name: "PerformancePackageState", - type: { - kind: "enum", - variants: [ { - name: "Locked", + name: "maxTokensPerWindow"; + docs: ["Max base tokens withdrawn per window"]; + type: "u64"; }, { - 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: "maxQuotePerWindow"; + docs: ["Max quote value withdrawn per window, in quote atoms"]; + type: "u64"; + }, + { + name: "withdrawalMode"; + docs: [ + "Which withdrawal routes the recipient may use while the caps are active", + ]; + type: { + defined: { + name: "withdrawalMode"; + }; + }; }, - ], - }, + ]; + }; }, { - name: "ChangeType", + name: "withdrawalMode"; type: { - kind: "enum", + kind: "enum"; variants: [ { - name: "Oracle", - fields: [ - { - name: "newOracleConfig", - type: { - defined: "OracleConfig", - }, - }, - ], + name: "tokens"; }, { - name: "Recipient", - fields: [ - { - name: "newRecipient", - type: "publicKey", - }, - ], + name: "sell"; }, { - name: "UnlockTerms", - fields: [ - { - name: "minUnlockTimestamp", - type: "i64", - }, - { - name: "limits", - type: { - option: { - defined: "LimitsParams", - }, - }, - }, - ], + name: "both"; }, - ], - }, + ]; + }; }, { - name: "ProposerType", + name: "withdrawalPolicy"; + docs: [ + "The agreed limits together with the usage they are enforced against", + ]; type: { - kind: "enum", - variants: [ + kind: "struct"; + fields: [ { - name: "Recipient", + name: "limits"; + type: { + defined: { + name: "withdrawalLimits"; + }; + }; }, { - 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: "TokensWithdrawn", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "performancePackage", - type: "publicKey", - index: false, - }, - { - name: "recipient", - type: "publicKey", - index: false, - }, - { - name: "amount", - type: "u64", - index: false, - }, - { - name: "capped", - type: { - option: { - defined: "CappedWithdrawal", - }, - }, - index: false, - }, - ], - }, - { - name: "TokensSold", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - name: "performancePackage", - type: "publicKey", - index: false, - }, - { - name: "recipient", - type: "publicKey", - index: false, - }, - { - name: "amount", - type: "u64", - index: false, - }, - { - name: "quoteReceived", - type: "u64", - index: false, - }, - { - name: "minQuoteOut", - type: "u64", - index: false, - }, - { - name: "capped", - type: { - option: { - defined: "WindowUsage", - }, - }, - index: false, - }, - ], - }, - { - name: "ChangeProposed", - fields: [ - { - name: "common", - type: { - defined: "CommonFields", - }, - index: false, - }, - { - 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", + name: "usage"; + type: { + defined: { + name: "windowUsage"; + }; + }; }, - 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", - }, - { - code: 6014, - name: "TotalTokenAmountOverflow", - msg: "Total token amount calculation would overflow", - }, - { - code: 6015, - name: "RecipientAuthorityMustDiffer", - msg: "Recipient and performance package authority must be different keys", - }, - { - code: 6016, - name: "InvalidWithdrawalLimits", - msg: "Withdrawal limits must have non-zero caps, a future end, and a window of at least one second", - }, - { - code: 6017, - name: "InsufficientWithdrawableBalance", - msg: "Amount exceeds the withdrawable balance", - }, - { - code: 6018, - name: "TokenWindowLimitExceeded", - msg: "Token cap for the current window exceeded", - }, - { - code: 6019, - name: "QuoteWindowLimitExceeded", - msg: "Quote cap for the current window exceeded", - }, - { - code: 6020, - name: "InvalidPriceObservation", - msg: "Oracle price observation is missing or zero", - }, - { - code: 6021, - name: "WithdrawTokensDisabled", - msg: "Token withdrawals are disabled by the withdrawal mode", - }, - { - code: 6022, - name: "WithdrawViaSellDisabled", - msg: "Sell withdrawals are disabled by the withdrawal mode", - }, - { - code: 6023, - name: "AccountNotMigrated", - msg: "Performance package has not been resized to the current layout", - }, - { - code: 6024, - name: "InvalidQuoteMint", - msg: "Quote mint must differ from the package's token mint", - }, - { - code: 6025, - name: "QuoteSweepAccountsIncomplete", - msg: "The package's quote account and the quote destination must be passed together", - }, - { - code: 6026, - name: "OracleMintMismatch", - msg: "Oracle Dao's base mint must be the package's token mint", - }, - { - code: 6027, - name: "MaxQuoteValueExceeded", - msg: "Withdrawal is valued above the recipient's maximum quote value", - }, - { - code: 6028, - name: "StaleChangeRequest", - msg: "Change request was proposed before the last executed change was proposed", + ]; + }; }, + ]; + constants: [ { - code: 6029, - name: "ChangeRequestMismatch", - msg: "Change request was proposed at a different time than the executor expected", + name: "priceScale"; + docs: ["Scale of oracle prices: quote atoms per base atom, times 1e12"]; + type: "u128"; + value: "1000000000000"; }, - ], + ]; }; diff --git a/sdk/src/price_based_performance_package/v0.6/withdrawalLimits/index.ts b/sdk/src/price_based_performance_package/v0.6/withdrawalLimits/index.ts index b7b78a550..22754207e 100644 --- a/sdk/src/price_based_performance_package/v0.6/withdrawalLimits/index.ts +++ b/sdk/src/price_based_performance_package/v0.6/withdrawalLimits/index.ts @@ -1,4 +1,4 @@ -import type { IdlTypes } from "@coral-xyz/anchor"; +import type { IdlTypes } from "@anchor-lang/core"; import BN from "bn.js"; import type { @@ -19,7 +19,7 @@ const MAX_BPS = new BN(10_000); const PROTOCOL_TAKER_FEE_BPS = new BN(50); const LP_TAKER_FEE_BPS = new BN(0); -type SpotPool = IdlTypes["Pool"]; +type SpotPool = IdlTypes["pool"]; // Anchor's decoded Dao type drops the pool struct nested in the PoolState enum, so it is retyped here. function getSpotPool(dao: Dao): SpotPool { diff --git a/sdk/src/shared_liquidity_manager/v0.5/SharedLiquidityManagerClient.ts b/sdk/src/shared_liquidity_manager/v0.5/SharedLiquidityManagerClient.ts index 367075bd1..c42692278 100644 --- a/sdk/src/shared_liquidity_manager/v0.5/SharedLiquidityManagerClient.ts +++ b/sdk/src/shared_liquidity_manager/v0.5/SharedLiquidityManagerClient.ts @@ -1,4 +1,4 @@ -import { AnchorProvider, IdlTypes, Program } from "@coral-xyz/anchor"; +import { AnchorProvider, IdlTypes, Program } from "@anchor-lang/core"; import { AccountInfo, AddressLookupTableAccount, @@ -13,12 +13,12 @@ import { createAssociatedTokenAccountIdempotentInstruction, } from "@solana/spl-token"; import { getAssociatedTokenAddressSync } from "@solana/spl-token"; -import * as anchor from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; import { - SharedLiquidityManager as SharedLiquidityManagerIDLType, - IDL as SharedLiquidityManagerIDL, -} from "./types/shared_liquidity_manager.js"; + SharedLiquidityManagerProgram as SharedLiquidityManagerIDLType, + SharedLiquidityManagerIDL, +} from "./types/index.js"; // import { // SharedLiquidityPool, // SharedLiquidityPoolPosition, @@ -76,9 +76,13 @@ export class SharedLiquidityManagerClient { constructor(params: CreateSharedLiquidityManagerClientParams) { this.provider = params.provider; this.program = new Program( - SharedLiquidityManagerIDL, - params.sharedLiquidityManagerProgramId || - SHARED_LIQUIDITY_MANAGER_PROGRAM_ID, + { + ...SharedLiquidityManagerIDL, + address: ( + params.sharedLiquidityManagerProgramId || + SHARED_LIQUIDITY_MANAGER_PROGRAM_ID + ).toBase58(), + }, this.provider, ); this.autocratClient = AutocratClient.createClient({ @@ -144,7 +148,7 @@ export class SharedLiquidityManagerClient { // quoteAmount, // proposalStakeRateThresholdBps, // }) - // .accounts({ + // .accountsPartial({ // slPool, // baseMint, // quoteMint, @@ -244,7 +248,7 @@ export class SharedLiquidityManagerClient { // maxBaseTokenAmount, // maxQuoteTokenAmount, // }) - // .accounts({ + // .accountsPartial({ // slPool, // activeSpotPool, // user, @@ -311,7 +315,7 @@ export class SharedLiquidityManagerClient { // minimumToken0Amount, // minimumToken1Amount, // }) - // .accounts({ + // .accountsPartial({ // slPool, // slPoolSigner, // activeSpotPool, @@ -409,7 +413,7 @@ export class SharedLiquidityManagerClient { // .initializeProposalWithLiquidity({ // nonce, // }) - // .accounts({ + // .accountsPartial({ // sharedLiquidityPool: slPool, // draftProposal, // proposalCreator: this.provider.wallet.publicKey, @@ -567,7 +571,7 @@ export class SharedLiquidityManagerClient { // instruction, // draftProposalNonce, // }) - // .accounts({ + // .accountsPartial({ // draftProposal, // sharedLiquidityPool, // baseMint, @@ -595,7 +599,7 @@ export class SharedLiquidityManagerClient { // .stakeToDraftProposal({ // amount, // }) - // .accounts({ + // .accountsPartial({ // draftProposal, // staker, // stakerTokenAccount: getAssociatedTokenAddressSync( @@ -628,7 +632,7 @@ export class SharedLiquidityManagerClient { // .unstakeFromDraftProposal({ // amount, // }) - // .accounts({ + // .accountsPartial({ // draftProposal, // staker, // stakerTokenAccount: getAssociatedTokenAddressSync( @@ -710,7 +714,7 @@ export class SharedLiquidityManagerClient { // spotPoolIndex + 1 // ); - // return this.program.methods.removeProposalLiquidity().accounts({ + // return this.program.methods.removeProposalLiquidity().accountsPartial({ // slPool, // proposal, // baseMint, diff --git a/sdk/src/shared_liquidity_manager/v0.5/pda.ts b/sdk/src/shared_liquidity_manager/v0.5/pda.ts index a53de20d6..177fd77eb 100644 --- a/sdk/src/shared_liquidity_manager/v0.5/pda.ts +++ b/sdk/src/shared_liquidity_manager/v0.5/pda.ts @@ -1,5 +1,5 @@ import { PublicKey } from "@solana/web3.js"; -import { utils } from "@coral-xyz/anchor"; +import { utils } from "@anchor-lang/core"; import BN from "bn.js"; import { SHARED_LIQUIDITY_MANAGER_PROGRAM_ID, diff --git a/sdk/src/shared_liquidity_manager/v0.5/types/index.ts b/sdk/src/shared_liquidity_manager/v0.5/types/index.ts index 8a508c696..32df40425 100644 --- a/sdk/src/shared_liquidity_manager/v0.5/types/index.ts +++ b/sdk/src/shared_liquidity_manager/v0.5/types/index.ts @@ -1,5 +1,5 @@ -import { - SharedLiquidityManager as SharedLiquidityManagerProgram, - IDL as SharedLiquidityManagerIDL, -} from "./shared_liquidity_manager.js"; -export { SharedLiquidityManagerProgram, SharedLiquidityManagerIDL }; +import type { SharedLiquidityManager as SharedLiquidityManagerProgram } from "./shared_liquidity_manager.js"; +import sharedLiquidityManagerIdl from "./shared_liquidity_manager.json" with { type: "json" }; +export type { SharedLiquidityManagerProgram }; +export const SharedLiquidityManagerIDL = + sharedLiquidityManagerIdl as SharedLiquidityManagerProgram; diff --git a/sdk/src/shared_liquidity_manager/v0.5/types/shared_liquidity_manager.json b/sdk/src/shared_liquidity_manager/v0.5/types/shared_liquidity_manager.json new file mode 100644 index 000000000..c204d9d72 --- /dev/null +++ b/sdk/src/shared_liquidity_manager/v0.5/types/shared_liquidity_manager.json @@ -0,0 +1,96 @@ +{ + "address": "EoJc1PYxZbnCjszampLcwJGYcB5Md47jM4oSQacRtD4d", + "metadata": { + "name": "shared_liquidity_manager", + "version": "0.1.0", + "spec": "0.1.0" + }, + "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" + } + ] +} \ No newline at end of file diff --git a/sdk/src/shared_liquidity_manager/v0.5/types/shared_liquidity_manager.ts b/sdk/src/shared_liquidity_manager/v0.5/types/shared_liquidity_manager.ts index 124942da9..e94d18951 100644 --- a/sdk/src/shared_liquidity_manager/v0.5/types/shared_liquidity_manager.ts +++ b/sdk/src/shared_liquidity_manager/v0.5/types/shared_liquidity_manager.ts @@ -1,177 +1,99 @@ +/** + * Program IDL in camelCase format in order to be used in JS/TS. + * + * Note that this is only a type helper and is not the actual IDL. The original + * IDL was converted from the legacy format with `anchor idl convert` and lives in + * the `.json` file next to this one. + */ export type SharedLiquidityManager = { - version: "0.1.0"; - name: "shared_liquidity_manager"; + address: "EoJc1PYxZbnCjszampLcwJGYcB5Md47jM4oSQacRtD4d"; + metadata: { + name: "sharedLiquidityManager"; + version: "0.1.0"; + spec: "0.1.0"; + }; docs: ["TODO:", "- add unstake", "- add unit tests"]; instructions: []; errors: [ { code: 6000; - name: "InsufficientStake"; + name: "insufficientStake"; msg: "Insufficient stake amount"; }, { code: 6001; - name: "ProposalNotFinalized"; + name: "proposalNotFinalized"; msg: "Proposal is not finalized"; }, { code: 6002; - name: "NoLpTokensToRemove"; + name: "noLpTokensToRemove"; msg: "No LP tokens to remove from AMM"; }, { code: 6003; - name: "NoTokensFromAmm"; + name: "noTokensFromAmm"; msg: "No tokens received from AMM removal"; }, { code: 6004; - name: "InsufficientReservesReturned"; + name: "insufficientReservesReturned"; msg: "Insufficient reserves returned to spot AMM (less than 99.5%)"; }, { code: 6005; - name: "PoolInUse"; + name: "poolInUse"; msg: "Pool is currently being used by an active proposal"; }, { code: 6006; - name: "InsufficientLpShares"; + name: "insufficientLpShares"; msg: "User does not have enough LP shares to withdraw"; }, { code: 6007; - name: "SlippageExceeded"; + name: "slippageExceeded"; msg: "Slippage exceeded minimum token amounts"; }, { code: 6008; - name: "NoLpTokensInPool"; + name: "noLpTokensInPool"; msg: "No LP tokens in pool's LP token account"; }, { code: 6009; - name: "NotEnoughLpTokens"; + name: "notEnoughLpTokens"; msg: "Not enough LP tokens to provide liquidity to proposal"; }, { code: 6010; - name: "InsufficientFunds"; + name: "insufficientFunds"; msg: "Insufficient funds"; }, { code: 6011; - name: "NoActiveProposal"; + name: "noActiveProposal"; msg: "No active proposal"; }, { code: 6012; - name: "ProposalNotInDraftStatus"; + name: "proposalNotInDraftStatus"; msg: "Proposal is not in draft status"; }, { code: 6013; - name: "ProposalAlreadyActive"; + name: "proposalAlreadyActive"; msg: "Proposal already active"; }, { code: 6014; - name: "AmmAlreadyHasLiquidity"; + name: "ammAlreadyHasLiquidity"; msg: "AMM already has liquidity"; }, { code: 6015; - name: "QuestionAlreadyResolved"; + 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/sync-types.sh b/sdk/sync-types.sh index d8eb5a75c..fece16945 100755 --- a/sdk/sync-types.sh +++ b/sdk/sync-types.sh @@ -1,16 +1,20 @@ #!/bin/bash -# Copies IDL type files from anchor build output into sdk2 program type directories. +# Copies each program's IDL JSON and TypeScript type helper from the anchor build output into +# the SDK module for that program version. +set -e +cd "$(dirname "$0")" +IDL_DIR="../target/idl" 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/gated_mint.ts" ./src/gated_mint/v0.1/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/launchpad_v8.ts" ./src/launchpad/v0.8/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/ +cp "$IDL_DIR/bid_wall.json" "$TYPES_DIR/bid_wall.ts" ./src/bid_wall/v0.7/types/ +cp "$IDL_DIR/conditional_vault.json" "$TYPES_DIR/conditional_vault.ts" ./src/conditional_vault/v0.4/types/ +cp "$IDL_DIR/futarchy.json" "$TYPES_DIR/futarchy.ts" ./src/futarchy/v0.6/types/ +cp "$IDL_DIR/gated_mint.json" "$TYPES_DIR/gated_mint.ts" ./src/gated_mint/v0.1/types/ +cp "$IDL_DIR/launchpad.json" "$TYPES_DIR/launchpad.ts" ./src/launchpad/v0.6/types/ +cp "$IDL_DIR/launchpad_v7.json" "$TYPES_DIR/launchpad_v7.ts" ./src/launchpad/v0.7/types/ +cp "$IDL_DIR/launchpad_v8.json" "$TYPES_DIR/launchpad_v8.ts" ./src/launchpad/v0.8/types/ +cp "$IDL_DIR/liquidation.json" "$TYPES_DIR/liquidation.ts" ./src/liquidation/v0.7/types/ +cp "$IDL_DIR/mint_governor.json" "$TYPES_DIR/mint_governor.ts" ./src/mint_governor/v0.7/types/ +cp "$IDL_DIR/performance_package_v2.json" "$TYPES_DIR/performance_package_v2.ts" ./src/performance_package_v2/v0.7/types/ +cp "$IDL_DIR/price_based_performance_package.json" "$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 bba6b521f..2bc63e685 100644 --- a/sdk/tsconfig.json +++ b/sdk/tsconfig.json @@ -8,6 +8,7 @@ "esModuleInterop": true, "skipLibCheck": true, "moduleResolution": "nodenext", + "resolveJsonModule": true, "sourceMap": true, "outDir": "dist", "strict": true, diff --git a/sdk/yarn.lock b/sdk/yarn.lock index e9047bfe2..c7ffaf33d 100644 --- a/sdk/yarn.lock +++ b/sdk/yarn.lock @@ -2,38 +2,42 @@ # yarn lockfile v1 -"@babel/runtime@^7.25.0": - version "7.28.4" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.28.4.tgz#a70226016fabe25c5783b2f22d3e1c9bc5ca3326" - integrity sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ== +"@anchor-lang/borsh@^0.32.2": + version "0.32.2" + resolved "https://registry.yarnpkg.com/@anchor-lang/borsh/-/borsh-0.32.2.tgz#0bf4af2d3b2b7dbe2b296f1df49be8f1a7375c46" + integrity sha512-pjtaNcA+LgLri4M35LajTpR7J6zlbUl1tiaBIb0cAOkzChCd/QsAZ/HJJEVQHZ4TMtHerDKkkk26Gor8Hq9Ihw== + dependencies: + bn.js "^5.1.2" + buffer-layout "^1.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" - integrity sha512-eny6QNG0WOwqV0zQ7cs/b1tIuzZGmP7U7EcH+ogt4Gdbl8HDmIYVMh/9aTmYZPaFWjtUaI8qSn73uYEXWfATdA== +"@anchor-lang/core@0.32.2": + version "0.32.2" + resolved "https://registry.yarnpkg.com/@anchor-lang/core/-/core-0.32.2.tgz#2e48dc05a05e89db942535965419d1830a45bd44" + integrity sha512-I1L83T3iEw2FKms/yVKHt2N/HMYyTBmqYNzMjVlZ+bvX2KCVYvH0o75TgddlVcVOA/hdY8WzHzG0xR0e6Ucpug== dependencies: - "@coral-xyz/borsh" "^0.29.0" + "@anchor-lang/borsh" "^0.32.2" + "@anchor-lang/errors" "^0.32.2" "@noble/hashes" "^1.3.1" - "@solana/web3.js" "^1.68.0" + "@solana/web3.js" "1.99.0" bn.js "^5.1.2" bs58 "^4.0.1" buffer-layout "^1.2.2" camelcase "^6.3.0" cross-fetch "^3.1.5" - crypto-hash "^1.3.0" eventemitter3 "^4.0.7" pako "^2.0.3" - snake-case "^3.0.4" superstruct "^0.15.4" toml "^3.0.0" -"@coral-xyz/borsh@^0.29.0": - version "0.29.0" - resolved "https://registry.yarnpkg.com/@coral-xyz/borsh/-/borsh-0.29.0.tgz#79f7045df2ef66da8006d47f5399c7190363e71f" - integrity sha512-s7VFVa3a0oqpkuRloWVPdCK7hMbAMY270geZOGfCnaqexrP5dTIpbEHL33req6IYPPJ0hYa71cdvJ1h6V55/oQ== - dependencies: - bn.js "^5.1.2" - buffer-layout "^1.2.0" +"@anchor-lang/errors@^0.32.2": + version "0.32.2" + resolved "https://registry.yarnpkg.com/@anchor-lang/errors/-/errors-0.32.2.tgz#93b95a3d0c6118a428fe990b4b49bf31cc9e79c5" + integrity sha512-sa6bvOITFUfSJ0wOCQ2/7ye/SA9hUZCkU6TL6mN5hSxin7SM6omgIR0OTPd7NH0iP+rTYyIIHsIJbGXBnN4fDw== + +"@babel/runtime@^7.29.7": + version "7.29.10" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.29.10.tgz#fe9920782f7ee34029165ac6f272984917a1641b" + integrity sha512-NpugTzbKgGrNe45Ui32cN8vCFFMxVtP/9rtfwv0nP5FRDAjvYBxJcLVpYA9mr1jxP6cnIT7x9LUzuDTbWYYNRA== "@metaplex-foundation/beet-solana@0.4.0": version "0.4.0" @@ -69,14 +73,14 @@ resolved "https://registry.yarnpkg.com/@metaplex-foundation/cusper/-/cusper-0.0.2.tgz#dc2032a452d6c269e25f016aa4dd63600e2af975" integrity sha512-S9RulC2fFCFOQraz61bij+5YCHhSO9llJegK8c8Y6731fSi6snUSQJdCUqYS8AIgR0TKbQvdvgSyIIdbDFZbBA== -"@noble/curves@^1.4.2": +"@noble/curves@^1.9.7": 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/hashes@1.8.0", "@noble/hashes@^1.3.1", "@noble/hashes@^1.4.0": +"@noble/hashes@1.8.0", "@noble/hashes@^1.3.1", "@noble/hashes@^1.8.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== @@ -105,12 +109,12 @@ dependencies: "@solana/errors" "2.0.0-rc.1" -"@solana/codecs-core@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/codecs-core/-/codecs-core-2.3.0.tgz#6bf2bb565cb1ae880f8018635c92f751465d8695" - integrity sha512-oG+VZzN6YhBHIoSKgS5ESM9VIGzhWjEHEGNPSibiDTxFhsFWxNaz8LbMDPjBUE69r9wmdGLkrQ+wVPbnJcZPvw== +"@solana/codecs-core@5.5.1": + version "5.5.1" + resolved "https://registry.yarnpkg.com/@solana/codecs-core/-/codecs-core-5.5.1.tgz#1b2619c697ad04c99f98cc468135d584b7e2b16d" + integrity sha512-TgBt//bbKBct0t6/MpA8ElaOA3sa8eYVvR7LGslCZ84WiAwwjCY0lW/lOYsFHJQzwREMdUyuEyy5YWBKtdh8Rw== dependencies: - "@solana/errors" "2.3.0" + "@solana/errors" "5.5.1" "@solana/codecs-data-structures@2.0.0-rc.1": version "2.0.0-rc.1" @@ -129,13 +133,13 @@ "@solana/codecs-core" "2.0.0-rc.1" "@solana/errors" "2.0.0-rc.1" -"@solana/codecs-numbers@^2.1.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/codecs-numbers/-/codecs-numbers-2.3.0.tgz#ac7e7f38aaf7fcd22ce2061fbdcd625e73828dc6" - integrity sha512-jFvvwKJKffvG7Iz9dmN51OGB7JBcy2CJ6Xf3NqD/VP90xak66m/Lg48T01u5IQ/hc15mChVHiBm+HHuOFDUrQg== +"@solana/codecs-numbers@^5.5.1": + version "5.5.1" + resolved "https://registry.yarnpkg.com/@solana/codecs-numbers/-/codecs-numbers-5.5.1.tgz#6ebc43250133ceb7836f1ac5780a7767e383efde" + integrity sha512-rllMIZAHqmtvC0HO/dc/21wDuWaD0B8Ryv8o+YtsICQBuiL/0U4AGwH7Pi5GNFySYk0/crSuwfIqQFtmxNSPFw== dependencies: - "@solana/codecs-core" "2.3.0" - "@solana/errors" "2.3.0" + "@solana/codecs-core" "5.5.1" + "@solana/errors" "5.5.1" "@solana/codecs-strings@2.0.0-rc.1": version "2.0.0-rc.1" @@ -165,13 +169,13 @@ chalk "^5.3.0" commander "^12.1.0" -"@solana/errors@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/errors/-/errors-2.3.0.tgz#4ac9380343dbeffb9dffbcb77c28d0e457c5fa31" - integrity sha512-66RI9MAbwYV0UtP7kGcTBVLxJgUxoZGm8Fbc0ah+lGiAw17Gugco6+9GrJCV83VyF2mDWyYnYM9qdI3yjgpnaQ== +"@solana/errors@5.5.1": + version "5.5.1" + resolved "https://registry.yarnpkg.com/@solana/errors/-/errors-5.5.1.tgz#1c17bc822264fd5a6305d8bfb9d597858e4ce17b" + integrity sha512-vFO3p+S7HoyyrcAectnXbdsMfwUzY2zYFUc2DEe5BwpiE9J1IAxPBGjOWO6hL1bbYdBrlmjNx8DXCslqS+Kcmg== dependencies: - chalk "^5.4.1" - commander "^14.0.0" + chalk "5.6.2" + commander "14.0.2" "@solana/options@2.0.0-rc.1": version "2.0.0-rc.1" @@ -191,7 +195,7 @@ dependencies: "@solana/codecs" "2.0.0-rc.1" -"@solana/spl-token@0.3.11", "@solana/spl-token@^0.3.6", "@solana/spl-token@^0.3.8": +"@solana/spl-token@0.3.11", "@solana/spl-token@^0.3.6": version "0.3.11" resolved "https://registry.yarnpkg.com/@solana/spl-token/-/spl-token-0.3.11.tgz#cdc10f9472b29b39c8983c92592cadd06627fb9a" integrity sha512-bvohO3rIMSVL24Pb+I4EYTJ6cL82eFpInEXD/I8K8upOGjpqHsKUoAempR/RnUlI1qSFNyFlWJfu6MNUgfbCQQ== @@ -201,23 +205,23 @@ "@solana/spl-token-metadata" "^0.1.2" buffer "^6.0.3" -"@solana/web3.js@1.98.4", "@solana/web3.js@^1.32.0", "@solana/web3.js@^1.56.2", "@solana/web3.js@^1.68.0", "@solana/web3.js@^1.70.3": - version "1.98.4" - resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.98.4.tgz#df51d78be9d865181ec5138b4e699d48e6895bbe" - integrity sha512-vv9lfnvjUsRiq//+j5pBdXig0IQdtzA0BRZ3bXEP4KaIyF1CcaydWqgyzQgfZMNIsWNWmG+AUHwPy4AHOD6gpw== +"@solana/web3.js@1.99.0", "@solana/web3.js@^1.32.0", "@solana/web3.js@^1.56.2", "@solana/web3.js@^1.70.3": + version "1.99.0" + resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.99.0.tgz#864ce3fefe03b258c430e31e6672b422426821f7" + integrity sha512-QZYQ2T1z6xWisoyALPq25i/QZTsRlM02BABtAsfaQ1p8wX4SdTfxrKTRue/ZZqrhNVh5oL7T/DUFiTS9DRgxow== dependencies: - "@babel/runtime" "^7.25.0" - "@noble/curves" "^1.4.2" - "@noble/hashes" "^1.4.0" + "@babel/runtime" "^7.29.7" + "@noble/curves" "^1.9.7" + "@noble/hashes" "^1.8.0" "@solana/buffer-layout" "^4.0.1" - "@solana/codecs-numbers" "^2.1.0" - agentkeepalive "^4.5.0" - bn.js "^5.2.1" + "@solana/codecs-numbers" "^5.5.1" + agentkeepalive "^4.6.0" + bn.js "^5.2.5" borsh "^0.7.0" bs58 "^4.0.1" buffer "6.0.3" fast-stable-stringify "^1.0.0" - jayson "^4.1.1" + jayson "^4.3.0" node-fetch "^2.7.0" rpc-websockets "^9.0.2" superstruct "^2.0.2" @@ -274,7 +278,7 @@ resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-9.1.1.tgz#e7c4f1001eefa4b8afbd1eee27a237fee3bf29c4" integrity sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw== -"@types/node@*": +"@types/node@*", "@types/node@25.0.3": version "25.0.3" resolved "https://registry.yarnpkg.com/@types/node/-/node-25.0.3.tgz#79b9ac8318f373fbfaaf6e2784893efa9701f269" integrity sha512-W609buLVRVmeW693xKfzHeIV6nJGGz98uCPfeXI1ELMLXVeKYZ9m15fAMSaUPBHYLGFsVRcMmSCksQOrZV9BYA== @@ -310,7 +314,7 @@ resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== -agentkeepalive@^4.5.0: +agentkeepalive@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.6.0.tgz#35f73e94b3f40bf65f105219c623ad19c136ea6a" integrity sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ== @@ -436,6 +440,11 @@ bn.js@5.2.2, bn.js@^5.1.2, bn.js@^5.2.0, bn.js@^5.2.1: resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.2.tgz#82c09f9ebbb17107cd72cb7fd39bd1f9d0aaa566" integrity sha512-v2YAxEmKaBLahNwE1mjp4WON6huMNeuDvagFZW+ASCuA/ku0bXR9hSMw0XpiqMoA3+rmnyck/tPRSFQkoC9Cuw== +bn.js@^5.2.5: + version "5.2.5" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.5.tgz#e81ce41cf25e6f0cd1e05f20a9db8c18405e375f" + integrity sha512-Vq886eXykuP5E6HcKSSStP3bJgrE6In5WKxVUvJ8XGpWWYs2xZHWqUwzCtGgEtBcxyd57KBFDPFoUfNzdaHCNg== + borsh@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/borsh/-/borsh-0.7.0.tgz#6e9560d719d86d90dc589bca60ffc8a6c51fec2a" @@ -555,7 +564,7 @@ chalk-template@0.4.0: dependencies: chalk "^4.1.2" -chalk@4.1.2, chalk@^4.1.0, chalk@^4.1.2, chalk@^5.3.0, chalk@^5.4.1: +chalk@4.1.2, chalk@5.6.2, chalk@^4.1.0, chalk@^4.1.2, chalk@^5.3.0: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== @@ -621,16 +630,16 @@ color@4.2.3: color-convert "^2.0.1" color-string "^1.9.0" +commander@14.0.2: + version "14.0.2" + resolved "https://registry.yarnpkg.com/commander/-/commander-14.0.2.tgz#b71fd37fe4069e4c3c7c13925252ada4eba14e8e" + integrity sha512-TywoWNNRbhoD0BXs1P3ZEScW8W5iKrnbithIl0YH+uCmBd0QpPOA8yc82DS3BIE5Ma6FnBVUsJ7wVUDz4dvOWQ== + commander@^12.1.0: version "12.1.0" resolved "https://registry.yarnpkg.com/commander/-/commander-12.1.0.tgz#01423b36f501259fdaac4d0e4d60c96c991585d3" integrity sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA== -commander@^14.0.0: - version "14.0.2" - resolved "https://registry.yarnpkg.com/commander/-/commander-14.0.2.tgz#b71fd37fe4069e4c3c7c13925252ada4eba14e8e" - integrity sha512-TywoWNNRbhoD0BXs1P3ZEScW8W5iKrnbithIl0YH+uCmBd0QpPOA8yc82DS3BIE5Ma6FnBVUsJ7wVUDz4dvOWQ== - commander@^2.20.3: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" @@ -648,11 +657,6 @@ cross-fetch@^3.1.5: dependencies: node-fetch "^2.7.0" -crypto-hash@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/crypto-hash/-/crypto-hash-1.3.0.tgz#b402cb08f4529e9f4f09346c3e275942f845e247" - integrity sha512-lyAZ0EMyjDkVvz8WOeVnuCPvKVBXcMv1l5SVqO1yC7PzTwrD/pPje/BIRbWhMoPe436U+Y2nD7f5bFx0kt+Sbg== - 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" @@ -705,14 +709,6 @@ diff@^3.1.0: resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA== -dot-case@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/dot-case/-/dot-case-3.0.4.tgz#9b2b670d00a431667a8a75ba29cd1b98809ce751" - integrity sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w== - dependencies: - no-case "^3.0.4" - tslib "^2.0.3" - dunder-proto@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/dunder-proto/-/dunder-proto-1.0.1.tgz#d7ae667e1dc83482f8b70fd0f6eefc50da30f58a" @@ -1091,10 +1087,10 @@ isomorphic-ws@^4.0.1: resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz#55fd4cd6c5e6491e76dc125938dd863f5cd4f2dc" integrity sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w== -jayson@^4.1.1: - version "4.2.0" - resolved "https://registry.yarnpkg.com/jayson/-/jayson-4.2.0.tgz#b71762393fa40bc9637eaf734ca6f40d3b8c0c93" - integrity sha512-VfJ9t1YLwacIubLhONk0KFeosUBwstRWQ0IRT1KDjEjnVnSOVHC3uwugyV7L0c7R9lpVyrUGT2XWiBA1UTtpyg== +jayson@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/jayson/-/jayson-4.3.0.tgz#22eb8f3dcf37a5e893830e5451f32bde6d1bde4d" + integrity sha512-AauzHcUcqs8OBnCHOkJY280VaTiCm57AbuO7lqzcw7JapGj50BisE3xhksye4zlTSR1+1tAz67wLTl8tEH1obQ== dependencies: "@types/connect" "^3.4.33" "@types/node" "^12.12.54" @@ -1162,13 +1158,6 @@ loupe@^2.3.6: dependencies: get-func-name "^2.0.1" -lower-case@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-2.0.2.tgz#6fa237c63dbdc4a82ca0fd882e4722dc5e634e28" - integrity sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg== - dependencies: - tslib "^2.0.3" - make-error@^1.1.1: version "1.3.6" resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" @@ -1245,14 +1234,6 @@ nanoid@3.3.1: resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.1.tgz#6347a18cac88af88f58af0b3594b723d5e99bb35" integrity sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw== -no-case@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/no-case/-/no-case-3.0.4.tgz#d361fd5c9800f558551a8369fc0dcd4662b6124d" - integrity sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg== - dependencies: - lower-case "^2.0.2" - tslib "^2.0.3" - node-fetch@^2.7.0: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" @@ -1434,53 +1415,6 @@ slice-ansi@5.0.0: ansi-styles "^6.0.0" is-fullwidth-code-point "^4.0.0" -snake-case@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/snake-case/-/snake-case-3.0.4.tgz#4f2bbd568e9935abdfd593f34c691dadb49c452c" - integrity sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg== - dependencies: - dot-case "^3.0.4" - tslib "^2.0.3" - -solana-bankrun-darwin-arm64@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/solana-bankrun-darwin-arm64/-/solana-bankrun-darwin-arm64-0.2.0.tgz#747e27f38e30d9022c9cccdead2e8d37cf006d55" - integrity sha512-ENQ5Z/CYeY8ZVWIc2VutY/gMlBaHi93/kDw9w0iVwewoV+/YpQmP2irwrshIKu6ggRPTF3Ehlh2V6fGVIYWcXw== - -solana-bankrun-darwin-universal@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/solana-bankrun-darwin-universal/-/solana-bankrun-darwin-universal-0.2.0.tgz#5b325b49578d7a9d74b02f7a05741658e46fd073" - integrity sha512-HE45TvZXzBipm1fMn87+fkHeIuQ/KFAi5G/S29y/TLuBYt4RDI935RkWiT0rEQ7KwnwO6Y1aTsOaQXldY5R7uQ== - -solana-bankrun-darwin-x64@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/solana-bankrun-darwin-x64/-/solana-bankrun-darwin-x64-0.2.0.tgz#d03eafd69c8dd9a53c84e993660c67cc71d531de" - integrity sha512-42UsVrnac2Oo4UaIDo60zfI3Xn1i8W6fmcc9ixJQZNTtdO8o2/sY4mFxcJx9lhLMhda5FPHrQbGYgYdIs0kK0g== - -solana-bankrun-linux-x64-gnu@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/solana-bankrun-linux-x64-gnu/-/solana-bankrun-linux-x64-gnu-0.2.0.tgz#eb133902e78afc5271ba034bd5353ad5f4005c10" - integrity sha512-WnqQjfBBdcI0ZLysjvRStI8gX7vm1c3CI6CC03lgkUztH+Chcq9C4LI9m2M8mXza8Xkn9ryeKAmX36Bx/yoVzg== - -solana-bankrun-linux-x64-musl@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/solana-bankrun-linux-x64-musl/-/solana-bankrun-linux-x64-musl-0.2.0.tgz#a99c5187f34ab5979c708281da74093c64baab4a" - integrity sha512-8mtf14ZBoah30+MIJBUwb5BlGLRZyK5cZhCkYnC/ROqaIDN8RxMM44NL63gTUIaNHsFwWGA9xR0KSeljeh3PKQ== - -solana-bankrun@0.2.0, solana-bankrun@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/solana-bankrun/-/solana-bankrun-0.2.0.tgz#e1df2126ee887b9eae17962f09db18aaa25d736f" - integrity sha512-TS6vYoO/9YJZng7oiLOVyuz8V7yLow5Hp4SLYWW71XM3702v+z9f1fvUBKudRfa4dfpta4tRNufApSiBIALxJQ== - dependencies: - "@solana/web3.js" "^1.68.0" - bs58 "^4.0.1" - optionalDependencies: - solana-bankrun-darwin-arm64 "0.2.0" - solana-bankrun-darwin-universal "0.2.0" - solana-bankrun-darwin-x64 "0.2.0" - solana-bankrun-linux-x64-gnu "0.2.0" - solana-bankrun-linux-x64-musl "0.2.0" - source-map-support@^0.5.6: version "0.5.21" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" @@ -1494,14 +1428,6 @@ source-map@^0.6.0: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -spl-token-bankrun@0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/spl-token-bankrun/-/spl-token-bankrun-0.2.3.tgz#929e7ea8872ad4f2065d97b185b8cb1b92b2366d" - integrity sha512-jQ0V+2GsL6rMrZfqLSbYBtYc5EvdVgsgVeYsZlJLRqrBoVENGve6oDAnJnuiY8JMXGxUs53iYYhG871knI7Vww== - dependencies: - "@solana/spl-token" "^0.3.8" - solana-bankrun "^0.2.0" - stream-chain@^2.2.5: version "2.2.5" resolved "https://registry.yarnpkg.com/stream-chain/-/stream-chain-2.2.5.tgz#b30967e8f14ee033c5b9a19bbe8a2cba90ba0d09" @@ -1620,7 +1546,7 @@ tsconfig-paths@^3.5.0: minimist "^1.2.6" strip-bom "^3.0.0" -tslib@^2.0.3, tslib@^2.8.0: +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== diff --git a/tests/bidWall/utils.ts b/tests/bidWall/utils.ts index fe2f8ce47..82500dea1 100644 --- a/tests/bidWall/utils.ts +++ b/tests/bidWall/utils.ts @@ -1,6 +1,6 @@ import { PublicKey, Signer, SystemProgram, Transaction } from "@solana/web3.js"; import * as token from "@solana/spl-token"; -import { BanksClient } from "solana-bankrun"; +import { BanksClient } from "../litesvm/index.js"; import { LaunchpadClient, getLaunchAddr, diff --git a/tests/conditionalVault/unit.ts b/tests/conditionalVault/unit.ts index f016a4c05..673001d51 100644 --- a/tests/conditionalVault/unit.ts +++ b/tests/conditionalVault/unit.ts @@ -1,5 +1,5 @@ -import * as anchor from "@coral-xyz/anchor"; -import { BN, Program, web3 } from "@coral-xyz/anchor"; +import * as anchor from "@anchor-lang/core"; +import { BN, Program, web3 } from "@anchor-lang/core"; import { MPL_TOKEN_METADATA_PROGRAM_ID as UMI_MPL_TOKEN_METADATA_PROGRAM_ID } from "@metaplex-foundation/mpl-token-metadata"; import { Umi, keypairIdentity } from "@metaplex-foundation/umi"; import { createUmi } from "@metaplex-foundation/umi-bundle-defaults"; @@ -8,9 +8,13 @@ import { toWeb3JsPublicKey, } from "@metaplex-foundation/umi-web3js-adapters"; import * as token from "@solana/spl-token"; -import { BankrunProvider } from "anchor-bankrun"; +import { LiteSVMProvider } from "../litesvm/index.js"; import { assert } from "chai"; -import { BanksClient, ProgramTestContext, startAnchor } from "solana-bankrun"; +import { + BanksClient, + ProgramTestContext, + startAnchor, +} from "../litesvm/index.js"; import { createAssociatedTokenAccount, createMint, @@ -18,17 +22,15 @@ import { getMint, mintTo, transfer, -} from "spl-token-bankrun"; +} from "../litesvm/index.js"; const { PublicKey, Keypair } = web3; -import { - ConditionalVault, - IDL as ConditionalVaultIDL, -} from "../../target/types/conditional_vault.js"; import { CONDITIONAL_VAULT_V0_4_PROGRAM_ID, ConditionalVaultClient, + ConditionalVaultIDL, + ConditionalVaultProgram as ConditionalVault, getConditionalTokenMintAddr, getQuestionAddr, getVaultAddr, @@ -90,14 +92,16 @@ describe("conditional_vault", async function () { [], ); banksClient = context.banksClient; - provider = new BankrunProvider(context); + provider = new LiteSVMProvider(context); anchor.setProvider(provider); umi = createUmi(anchor.AnchorProvider.env().connection); vaultProgram = new Program( - ConditionalVaultIDL, - CONDITIONAL_VAULT_V0_4_PROGRAM_ID, + { + ...ConditionalVaultIDL, + address: CONDITIONAL_VAULT_V0_4_PROGRAM_ID.toBase58(), + }, provider, ); @@ -363,7 +367,7 @@ describe("conditional_vault", async function () { ).then((acc) => acc.amount); assert.isTrue(balanceAfter > balanceBefore); - assert.equal(balanceAfter - balanceBefore, 600); + assert.equal(balanceAfter - balanceBefore, 600n); }); }); @@ -826,7 +830,7 @@ describe("conditional_vault", async function () { // await vaultProgram.methods // .settleConditionalVault({ finalized: {} }) -// .accounts({ +// .accountsPartial({ // settlementAuthority: settlementAuthority.publicKey, // vault, // }) @@ -845,7 +849,7 @@ describe("conditional_vault", async function () { // await vaultProgram.methods // .settleConditionalVault({ reverted: {} }) -// .accounts({ +// .accountsPartial({ // settlementAuthority: settlementAuthority.publicKey, // vault, // }) @@ -864,7 +868,7 @@ describe("conditional_vault", async function () { // await vaultProgram.methods // .settleConditionalVault({ finalized: {} }) -// .accounts({ +// .accountsPartial({ // settlementAuthority: settlementAuthority.publicKey, // vault, // }) @@ -878,7 +882,7 @@ describe("conditional_vault", async function () { // await vaultProgram.methods // .settleConditionalVault({ reverted: {} }) -// .accounts({ +// .accountsPartial({ // settlementAuthority: settlementAuthority.publicKey, // vault, // }) @@ -975,7 +979,7 @@ describe("conditional_vault", async function () { // it("prevents users from merging conditional tokens after the vault has been finalized", async function () { // await vaultProgram.methods // .settleConditionalVault({ finalized: {} }) -// .accounts({ +// .accountsPartial({ // settlementAuthority: settlementAuthority.publicKey, // vault, // }) @@ -1004,7 +1008,7 @@ describe("conditional_vault", async function () { // it("allows users to redeem conditional-on-finalize tokens for underlying tokens when a vault has been finalized", async function () { // await vaultProgram.methods // .settleConditionalVault({ finalized: {} }) -// .accounts({ +// .accountsPartial({ // settlementAuthority: settlementAuthority.publicKey, // vault, // }) @@ -1028,7 +1032,7 @@ describe("conditional_vault", async function () { // it("allows user to redeeming conditional-on-revert tokens for underlying tokens when a vault is reverted", async function () { // await vaultProgram.methods // .settleConditionalVault({ reverted: {} }) -// .accounts({ +// .accountsPartial({ // settlementAuthority: settlementAuthority.publicKey, // vault, // }) @@ -1216,7 +1220,7 @@ describe("conditional_vault", async function () { // // onFinalizeUri: METADATA_URI, // // onRevertUri: METADATA_URI, // // }) -// // .accounts({ +// // .accountsPartial({ // // payer: payer.publicKey, // // vault, // // underlyingTokenMint, @@ -1315,7 +1319,7 @@ describe("conditional_vault", async function () { // /* try { */ // await program.methods // .mintConditionalTokens(bnAmount) -// .accounts({ +// .accountsPartial({ // authority: user.publicKey, // vault, // vaultUnderlyingTokenAccount, @@ -1396,7 +1400,7 @@ describe("conditional_vault", async function () { // const bnAmount = new anchor.BN(amount.toString()); // await vaultProgram.methods // .mergeConditionalTokensForUnderlyingTokens(bnAmount) -// .accounts({ +// .accountsPartial({ // authority: user.publicKey, // userConditionalOnFinalizeTokenAccount, // userConditionalOnRevertTokenAccount, @@ -1476,7 +1480,7 @@ describe("conditional_vault", async function () { // await vaultProgram.methods // .redeemConditionalTokensForUnderlyingTokens() -// .accounts({ +// .accountsPartial({ // authority: user.publicKey, // userConditionalOnFinalizeTokenAccount, // userConditionalOnRevertTokenAccount, diff --git a/tests/conditionalVault/unit/addMetadataToConditionalTokens.test.ts b/tests/conditionalVault/unit/addMetadataToConditionalTokens.test.ts index e0616b427..06271d542 100644 --- a/tests/conditionalVault/unit/addMetadataToConditionalTokens.test.ts +++ b/tests/conditionalVault/unit/addMetadataToConditionalTokens.test.ts @@ -7,7 +7,7 @@ import { } from "@metadaoproject/programs"; import { ComputeBudgetProgram, Keypair, PublicKey } from "@solana/web3.js"; import { assert } from "chai"; -import { createMint } from "spl-token-bankrun"; +import { createMint } from "../../litesvm/index.js"; import { expectError } from "../../utils.js"; import { getMetadataAccountDataSerializer } from "@metaplex-foundation/mpl-token-metadata"; diff --git a/tests/conditionalVault/unit/initializeConditionalVault.test.ts b/tests/conditionalVault/unit/initializeConditionalVault.test.ts index 663770928..ed131e4ed 100644 --- a/tests/conditionalVault/unit/initializeConditionalVault.test.ts +++ b/tests/conditionalVault/unit/initializeConditionalVault.test.ts @@ -11,7 +11,7 @@ import { Transaction, } from "@solana/web3.js"; import { assert } from "chai"; -import { createMint, getAccount, getMint } from "spl-token-bankrun"; +import { createMint, getAccount, getMint } from "../../litesvm/index.js"; import * as token from "@solana/spl-token"; import { expectError } from "../../utils.js"; diff --git a/tests/conditionalVault/unit/mergeTokens.test.ts b/tests/conditionalVault/unit/mergeTokens.test.ts index fd54c5796..227af9e3b 100644 --- a/tests/conditionalVault/unit/mergeTokens.test.ts +++ b/tests/conditionalVault/unit/mergeTokens.test.ts @@ -6,7 +6,7 @@ import { createMint, getAccount, mintTo, -} from "spl-token-bankrun"; +} from "../../litesvm/index.js"; import * as token from "@solana/spl-token"; import { expectError } from "../../utils.js"; import { BN } from "bn.js"; @@ -85,7 +85,7 @@ export default function suite() { ).then((acc) => acc.amount); assert.isTrue(balanceAfter > balanceBefore); - assert.equal(balanceAfter - balanceBefore, 600); + assert.equal(balanceAfter - balanceBefore, 600n); const updatedVault = await vaultClient.fetchVault(vault); assert.equal(updatedVault.seqNum.toString(), "2"); }); @@ -122,7 +122,7 @@ export default function suite() { ).then((acc) => acc.amount); assert.isTrue(balanceAfter > balanceBefore); - assert.equal(balanceAfter - balanceBefore, 500); + assert.equal(balanceAfter - balanceBefore, 500n); let updatedVault = await vaultClient.fetchVault(vault); assert.equal(updatedVault.seqNum.toString(), "2"); @@ -148,7 +148,7 @@ export default function suite() { ).then((acc) => acc.amount); assert.isTrue(balanceAfter > balanceBefore); - assert.equal(balanceAfter - balanceBefore, 500); + assert.equal(balanceAfter - balanceBefore, 500n); updatedVault = await vaultClient.fetchVault(vault); assert.equal(updatedVault.seqNum.toString(), "3"); }); @@ -157,7 +157,7 @@ export default function suite() { // Resolve the question await vaultClient.vaultProgram.methods .resolveQuestion({ payoutNumerators: [1, 0] }) - .accounts({ + .accountsPartial({ question, oracle: oracle.publicKey, }) diff --git a/tests/conditionalVault/unit/redeemTokens.test.ts b/tests/conditionalVault/unit/redeemTokens.test.ts index 15576522a..52719b69a 100644 --- a/tests/conditionalVault/unit/redeemTokens.test.ts +++ b/tests/conditionalVault/unit/redeemTokens.test.ts @@ -6,7 +6,7 @@ import { createMint, getAccount, mintTo, -} from "spl-token-bankrun"; +} from "../../litesvm/index.js"; import * as token from "@solana/spl-token"; import { BN } from "bn.js"; @@ -100,7 +100,7 @@ export default function suite() { ).then((acc) => acc.amount); assert.isTrue(balanceAfter > balanceBefore); - assert.equal(balanceAfter - balanceBefore, 1000); + assert.equal(balanceAfter - balanceBefore, 1000n); const updatedVault = await vaultClient.fetchVault(vault); assert.equal(updatedVault.seqNum.toString(), "2"); @@ -137,7 +137,7 @@ export default function suite() { // console.log('balanceAfter', balanceAfter); assert.isTrue(balanceAfter > balanceBefore); - assert.equal(balanceAfter - balanceBefore, 1000); + assert.equal(balanceAfter - balanceBefore, 1000n); let updatedVault = await vaultClient.fetchVault(vault); assert.equal(updatedVault.seqNum.toString(), "2"); @@ -154,7 +154,7 @@ export default function suite() { // console.log('balanceAfter', balanceAfter); assert.isTrue(balanceAfter > balanceBefore); - assert.equal(balanceAfter - balanceBefore, 1000); + assert.equal(balanceAfter - balanceBefore, 1000n); updatedVault = await vaultClient.fetchVault(vault); assert.equal(updatedVault.seqNum.toString(), "3"); @@ -185,7 +185,7 @@ export default function suite() { ).then((acc) => acc.amount); assert.isTrue(balanceAfter > balanceBefore); - assert.isTrue(balanceAfter - balanceBefore == 1000); + assert.isTrue(balanceAfter - balanceBefore == 1000n); // console.log('balanceAfter', balanceAfter); diff --git a/tests/conditionalVault/unit/splitTokens.test.ts b/tests/conditionalVault/unit/splitTokens.test.ts index 28160329c..afaa5942a 100644 --- a/tests/conditionalVault/unit/splitTokens.test.ts +++ b/tests/conditionalVault/unit/splitTokens.test.ts @@ -1,7 +1,7 @@ import { sha256, ConditionalVaultClient } from "@metadaoproject/programs"; import { ComputeBudgetProgram, Keypair, PublicKey } from "@solana/web3.js"; import { assert } from "chai"; -import { getMint } from "spl-token-bankrun"; +import { getMint } from "../../litesvm/index.js"; import * as token from "@solana/spl-token"; import { expectError } from "../../utils.js"; import { BN } from "bn.js"; @@ -75,7 +75,7 @@ export default function suite() { await vaultClient.vaultProgram.methods .splitTokens(new BN(1000)) - .accounts({ + .accountsPartial({ question, authority: this.payer.publicKey, vault, @@ -118,7 +118,7 @@ export default function suite() { // Attempt to split tokens using the original vault but with the malicious vault's conditional token accounts await vaultClient.vaultProgram.methods .splitTokens(new BN(1000)) - .accounts({ + .accountsPartial({ question, authority: this.payer.publicKey, vault, @@ -157,7 +157,7 @@ export default function suite() { await vaultClient .splitTokensIx(question, vault, underlyingTokenMint, new BN(1000), 2) - .accounts({ + .accountsPartial({ vaultUnderlyingTokenAccount: invalidVaultUnderlyingTokenAccount, }) .rpc() @@ -179,7 +179,7 @@ export default function suite() { await vaultClient.vaultProgram.methods .splitTokens(new BN(1000)) - .accounts({ + .accountsPartial({ question, authority: this.payer.publicKey, vault, @@ -248,7 +248,7 @@ export default function suite() { // Resolve the question await vaultClient.vaultProgram.methods .resolveQuestion({ payoutNumerators: [1, 0] }) - .accounts({ + .accountsPartial({ question, oracle: oracle.publicKey, }) diff --git a/tests/futarchy/integration/gatedLiquidationUnwind.test.ts b/tests/futarchy/integration/gatedLiquidationUnwind.test.ts index bc01828bf..0c6531f9e 100644 --- a/tests/futarchy/integration/gatedLiquidationUnwind.test.ts +++ b/tests/futarchy/integration/gatedLiquidationUnwind.test.ts @@ -229,7 +229,7 @@ export default function suite() { minBaseAmount: new BN(0), minQuoteAmount: new BN(0), }) - .accounts({ + .accountsPartial({ dao, positionAuthority: vault, liquidityProviderBaseAccount: vaultBaseAta, diff --git a/tests/futarchy/integration/gatedProposalSettlement.test.ts b/tests/futarchy/integration/gatedProposalSettlement.test.ts index 6e232a2a2..bd7190dfe 100644 --- a/tests/futarchy/integration/gatedProposalSettlement.test.ts +++ b/tests/futarchy/integration/gatedProposalSettlement.test.ts @@ -65,7 +65,7 @@ function adminCancelProposalIx( CONDITIONAL_VAULT_V0_4_PROGRAM_ID, ); - return ctx.futarchy.futarchy.methods.adminCancelProposal().accounts({ + return ctx.futarchy.futarchy.methods.adminCancelProposal().accountsPartial({ proposal, dao, question, diff --git a/tests/futarchy/integration/liquidationEndToEnd.test.ts b/tests/futarchy/integration/liquidationEndToEnd.test.ts index 0e46e183b..ea1e317b3 100644 --- a/tests/futarchy/integration/liquidationEndToEnd.test.ts +++ b/tests/futarchy/integration/liquidationEndToEnd.test.ts @@ -253,7 +253,7 @@ export default function suite() { minBaseAmount: new BN(0), minQuoteAmount: new BN(0), }) - .accounts({ + .accountsPartial({ dao, positionAuthority: vault, liquidityProviderBaseAccount: getAssociatedTokenAddressSync( @@ -309,7 +309,7 @@ export default function suite() { minBaseAmount: new BN(0), minQuoteAmount: new BN(0), }) - .accounts({ + .accountsPartial({ dao, positionAuthority: this.payer.publicKey, liquidityProviderBaseAccount: getAssociatedTokenAddressSync( diff --git a/tests/futarchy/unit/adminCancelProposal.test.ts b/tests/futarchy/unit/adminCancelProposal.test.ts index e24bd9b9c..31d26c7ec 100644 --- a/tests/futarchy/unit/adminCancelProposal.test.ts +++ b/tests/futarchy/unit/adminCancelProposal.test.ts @@ -165,7 +165,7 @@ export default function suite() { await this.futarchy.futarchy.methods .adminCancelProposal() - .accounts({ + .accountsPartial({ proposal, dao, question, @@ -314,7 +314,7 @@ export default function suite() { // Cancel the proposal first await this.futarchy.futarchy.methods .adminCancelProposal() - .accounts(accounts) + .accountsPartial(accounts) .preInstructions([ ComputeBudgetProgram.setComputeUnitLimit({ units: 300_000 }), ]) @@ -332,7 +332,7 @@ export default function suite() { await this.futarchy.futarchy.methods .adminCancelProposal() - .accounts(accounts) + .accountsPartial(accounts) .preInstructions([ ComputeBudgetProgram.setComputeUnitLimit({ units: 300_001 }), ]) @@ -388,7 +388,7 @@ export default function suite() { await this.futarchy.futarchy.methods .adminCancelProposal() - .accounts({ + .accountsPartial({ proposal, dao, question, @@ -489,7 +489,7 @@ export default function suite() { await this.futarchy.futarchy.methods .adminCancelProposal() - .accounts({ + .accountsPartial({ proposal, dao, question, @@ -631,7 +631,7 @@ export default function suite() { await this.futarchy.futarchy.methods .adminCancelProposal() - .accounts({ + .accountsPartial({ proposal: hostileProposal, dao: hostileDao, question, diff --git a/tests/futarchy/unit/adminEnqueueMultisigProposalApproval.test.ts b/tests/futarchy/unit/adminEnqueueMultisigProposalApproval.test.ts index fb5ee2f51..febd1ea4d 100644 --- a/tests/futarchy/unit/adminEnqueueMultisigProposalApproval.test.ts +++ b/tests/futarchy/unit/adminEnqueueMultisigProposalApproval.test.ts @@ -329,7 +329,7 @@ export default function suite() { await this.futarchy.futarchy.methods .adminExecuteMultisigProposal() - .accounts({ + .accountsPartial({ dao, squadsMultisig: daoAccount.squadsMultisig, squadsMultisigProposal: configProposalPda, diff --git a/tests/futarchy/unit/adminExecuteMultisigProposal.test.ts b/tests/futarchy/unit/adminExecuteMultisigProposal.test.ts index e35ab56ff..d47d7bd6a 100644 --- a/tests/futarchy/unit/adminExecuteMultisigProposal.test.ts +++ b/tests/futarchy/unit/adminExecuteMultisigProposal.test.ts @@ -116,7 +116,7 @@ export default function suite() { // Then execute await this.futarchy.futarchy.methods .adminExecuteMultisigProposal() - .accounts({ + .accountsPartial({ dao: dao, squadsMultisig: daoAccount.squadsMultisig, squadsMultisigProposal: squadsProposalPda, @@ -220,7 +220,7 @@ export default function suite() { await this.futarchy.futarchy.methods .adminExecuteMultisigProposal() - .accounts({ + .accountsPartial({ dao: dao, squadsMultisig: daoAccount.squadsMultisig, squadsMultisigProposal: squadsProposalPda, diff --git a/tests/futarchy/unit/adminRemoveProposal.test.ts b/tests/futarchy/unit/adminRemoveProposal.test.ts index 63ecd9bc4..20f279db7 100644 --- a/tests/futarchy/unit/adminRemoveProposal.test.ts +++ b/tests/futarchy/unit/adminRemoveProposal.test.ts @@ -102,7 +102,7 @@ export default function suite() { // Call admin_remove_proposal await this.futarchy.futarchy.methods .adminRemoveProposal() - .accounts({ + .accountsPartial({ proposal, dao, admin: this.payer.publicKey, @@ -133,7 +133,7 @@ export default function suite() { // Remove the proposal await this.futarchy.futarchy.methods .adminRemoveProposal() - .accounts({ + .accountsPartial({ proposal, dao, admin: this.payer.publicKey, @@ -169,7 +169,7 @@ export default function suite() { // Remove the proposal first await this.futarchy.futarchy.methods .adminRemoveProposal() - .accounts({ + .accountsPartial({ proposal, dao, admin: this.payer.publicKey, @@ -253,7 +253,7 @@ export default function suite() { await this.futarchy.futarchy.methods .adminRemoveProposal() - .accounts({ + .accountsPartial({ proposal, dao, admin: this.payer.publicKey, diff --git a/tests/futarchy/unit/adminUpdateProposalParams.test.ts b/tests/futarchy/unit/adminUpdateProposalParams.test.ts index 53bfe45c1..62e100ce3 100644 --- a/tests/futarchy/unit/adminUpdateProposalParams.test.ts +++ b/tests/futarchy/unit/adminUpdateProposalParams.test.ts @@ -323,7 +323,7 @@ export default function suite() { it("rejects a removed proposal", async function () { await this.futarchy.futarchy.methods .adminRemoveProposal() - .accounts({ proposal, dao, admin: this.payer.publicKey }) + .accountsPartial({ proposal, dao, admin: this.payer.publicKey }) .rpc(); const callbacks = expectError( diff --git a/tests/futarchy/unit/collectMeteoraDammFees.test.ts b/tests/futarchy/unit/collectMeteoraDammFees.test.ts index 70adb3cf3..5c0e6261e 100644 --- a/tests/futarchy/unit/collectMeteoraDammFees.test.ts +++ b/tests/futarchy/unit/collectMeteoraDammFees.test.ts @@ -182,7 +182,7 @@ export default function suite() { amountIn: new BN(1_000_000), // 1 USDC swap minimumAmountOut: new BN(0), }) - .accounts({ + .accountsPartial({ tokenAMint: META, tokenBMint: MAINNET_USDC, tokenAProgram: TOKEN_PROGRAM_ID, diff --git a/tests/futarchy/unit/conditionalSwap.test.ts b/tests/futarchy/unit/conditionalSwap.test.ts index 641093e6b..250389156 100644 --- a/tests/futarchy/unit/conditionalSwap.test.ts +++ b/tests/futarchy/unit/conditionalSwap.test.ts @@ -13,7 +13,6 @@ import { BN } from "bn.js"; import { assert } from "chai"; import { PERMISSIONLESS_ACCOUNT } from "@metadaoproject/programs"; import { MEMO_PROGRAM_ID } from "@solana/spl-memo"; -import { ComputeBudget } from "litesvm"; export default function suite() { let META: PublicKey, USDC: PublicKey, dao: PublicKey; diff --git a/tests/futarchy/unit/executeMultisigProposalApproval.test.ts b/tests/futarchy/unit/executeMultisigProposalApproval.test.ts index ffe5b75a7..6239b6afb 100644 --- a/tests/futarchy/unit/executeMultisigProposalApproval.test.ts +++ b/tests/futarchy/unit/executeMultisigProposalApproval.test.ts @@ -286,7 +286,7 @@ export default function suite() { await this.futarchy.futarchy.methods .adminExecuteMultisigProposal() - .accounts({ + .accountsPartial({ dao, squadsMultisig: daoAccount.squadsMultisig, squadsMultisigProposal: configProposalPda, diff --git a/tests/futarchy/unit/executeMultisigProposalCancellation.test.ts b/tests/futarchy/unit/executeMultisigProposalCancellation.test.ts index 51921d243..0b1db1040 100644 --- a/tests/futarchy/unit/executeMultisigProposalCancellation.test.ts +++ b/tests/futarchy/unit/executeMultisigProposalCancellation.test.ts @@ -148,7 +148,7 @@ export default function suite() { await context.futarchy.futarchy.methods .adminExecuteMultisigProposal() - .accounts({ + .accountsPartial({ dao, squadsMultisig, squadsMultisigProposal: configProposal, diff --git a/tests/futarchy/unit/initializeBuybackTokenProposal.test.ts b/tests/futarchy/unit/initializeBuybackTokenProposal.test.ts index e8ea97171..f0ce03e68 100644 --- a/tests/futarchy/unit/initializeBuybackTokenProposal.test.ts +++ b/tests/futarchy/unit/initializeBuybackTokenProposal.test.ts @@ -111,7 +111,7 @@ async function adminCancel( await context.futarchy.futarchy.methods .adminCancelProposal() - .accounts({ + .accountsPartial({ proposal, dao, question, diff --git a/tests/futarchy/unit/initializeMintTokensProposal.test.ts b/tests/futarchy/unit/initializeMintTokensProposal.test.ts index 3ee81d478..703bb3443 100644 --- a/tests/futarchy/unit/initializeMintTokensProposal.test.ts +++ b/tests/futarchy/unit/initializeMintTokensProposal.test.ts @@ -11,7 +11,7 @@ import { getMintAuthorityAddr, MintGovernorClient, } from "@metadaoproject/programs"; -import { BankrunProvider } from "anchor-bankrun"; +import { LiteSVMProvider } from "../../litesvm/index.js"; import { initializeMintGovernorWithDefaults } from "../../mintGovernor/utils.js"; import { assertVaultTransactionPayload, @@ -49,7 +49,7 @@ export default function suite() { before(async function () { mintGovernorClient = MintGovernorClient.createClient({ - provider: new BankrunProvider(this.context) as any, + provider: new LiteSVMProvider(this.context) as any, }); }); diff --git a/tests/futarchy/unit/liquidatedGuards.test.ts b/tests/futarchy/unit/liquidatedGuards.test.ts index 5b3da3279..139a255b4 100644 --- a/tests/futarchy/unit/liquidatedGuards.test.ts +++ b/tests/futarchy/unit/liquidatedGuards.test.ts @@ -559,7 +559,7 @@ export default function suite() { minBaseAmount: new BN(0), minQuoteAmount: new BN(0), }) - .accounts({ + .accountsPartial({ dao, positionAuthority: this.payer.publicKey, liquidityProviderBaseAccount: getAssociatedTokenAddressSync( diff --git a/tests/futarchy/unit/provideLiquidity.test.ts b/tests/futarchy/unit/provideLiquidity.test.ts index 006092d7b..c88956dbc 100644 --- a/tests/futarchy/unit/provideLiquidity.test.ts +++ b/tests/futarchy/unit/provideLiquidity.test.ts @@ -177,7 +177,7 @@ export default function suite() { minBaseAmount: new BN(0), minQuoteAmount: new BN(0), }) - .accounts({ + .accountsPartial({ dao, positionAuthority: this.payer.publicKey, liquidityProviderBaseAccount: getAssociatedTokenAddressSync( diff --git a/tests/futarchy/unit/resizeDao.test.ts b/tests/futarchy/unit/resizeDao.test.ts index c8a5a3c36..d6a1ea2a6 100644 --- a/tests/futarchy/unit/resizeDao.test.ts +++ b/tests/futarchy/unit/resizeDao.test.ts @@ -346,7 +346,7 @@ export default function suite() { ); await this.futarchy.futarchy.methods .resizeDao() - .accounts({ + .accountsPartial({ dao, spendingLimit: Keypair.generate().publicKey, payer: this.payer.publicKey, diff --git a/tests/futarchy/unit/resizeProposal.test.ts b/tests/futarchy/unit/resizeProposal.test.ts index 612beb28a..2a46a17ed 100644 --- a/tests/futarchy/unit/resizeProposal.test.ts +++ b/tests/futarchy/unit/resizeProposal.test.ts @@ -13,10 +13,10 @@ import { TestContext } from "../../main.test.js"; import { assert } from "chai"; // Rewrites a real (new-layout) Proposal account to the pre-migration on-chain -// layout by re-encoding its body as the `oldProposal` IDL type (dropping the -// appended `pass_threshold_bps`, `council_can_block`, `action` and -// `params_overridden`, and collapsing `sponsored_by` back to the -// `is_team_sponsored` bit). The optional overrides let a test pin +// layout by re-encoding its body with the v0.6.1 snapshot IDL's `proposal` +// layout, which predates the appended `pass_threshold_bps`, `council_can_block`, +// `action` and `params_overridden` and still has the `is_team_sponsored` bit in +// place of `sponsored_by`. The optional overrides let a test pin // `is_team_sponsored`, the state, or the duration without driving the // sponsor/launch flows. async function makeOldLayout( @@ -44,7 +44,10 @@ async function makeOldLayout( if (overrides.durationInSeconds !== undefined) decoded.durationInSeconds = overrides.durationInSeconds; - const body = await coder.encode("oldProposal", decoded); + const body = await ctx.futarchy.v0_6_1_futarchy.coder.accounts.encode( + "proposal", + decoded, + ); const buf = Buffer.alloc(BEFORE); disc.copy(buf, 0); body.subarray(8).copy(buf, 8); @@ -140,7 +143,7 @@ export default function suite() { await this.futarchy.futarchy.methods .resizeProposal() - .accounts({ proposal, dao, payer: this.payer.publicKey }) + .accountsPartial({ proposal, dao, payer: this.payer.publicKey }) .rpc(); const resized = await this.banksClient.getAccount(proposal); @@ -164,7 +167,7 @@ export default function suite() { // Idempotent: a second crank is a no-op (compute-budget bump for a unique sig). await this.futarchy.futarchy.methods .resizeProposal() - .accounts({ proposal, dao, payer: this.payer.publicKey }) + .accountsPartial({ proposal, dao, payer: this.payer.publicKey }) .preInstructions([ ComputeBudgetProgram.setComputeUnitLimit({ units: 200_000 }), ]) @@ -185,7 +188,7 @@ export default function suite() { await this.futarchy.futarchy.methods .resizeProposal() - .accounts({ proposal, dao, payer: this.payer.publicKey }) + .accountsPartial({ proposal, dao, payer: this.payer.publicKey }) .rpc(); const migrated = await this.futarchy.getProposal(proposal); @@ -207,7 +210,7 @@ export default function suite() { await this.futarchy.futarchy.methods .resizeProposal() - .accounts({ proposal, dao, payer: this.payer.publicKey }) + .accountsPartial({ proposal, dao, payer: this.payer.publicKey }) .rpc(); const migrated = await this.futarchy.getProposal(proposal); @@ -226,7 +229,7 @@ export default function suite() { await this.futarchy.futarchy.methods .resizeProposal() - .accounts({ proposal, dao, payer: this.payer.publicKey }) + .accountsPartial({ proposal, dao, payer: this.payer.publicKey }) .rpc(); const migrated = await this.futarchy.getProposal(proposal); @@ -248,7 +251,7 @@ export default function suite() { await this.futarchy.futarchy.methods .resizeProposal() - .accounts({ proposal, dao, payer: this.payer.publicKey }) + .accountsPartial({ proposal, dao, payer: this.payer.publicKey }) .rpc(); const migrated = await this.futarchy.getProposal(proposal); @@ -270,7 +273,7 @@ export default function suite() { await this.futarchy.futarchy.methods .resizeProposal() - .accounts({ proposal, dao, payer: this.payer.publicKey }) + .accountsPartial({ proposal, dao, payer: this.payer.publicKey }) .rpc(); const migrated = await this.futarchy.getProposal(proposal); @@ -288,7 +291,7 @@ export default function suite() { await this.futarchy.futarchy.methods .resizeProposal() - .accounts({ proposal, dao, payer: this.payer.publicKey }) + .accountsPartial({ proposal, dao, payer: this.payer.publicKey }) .rpc(); const afterRaw = await this.banksClient.getAccount(proposal); @@ -306,7 +309,7 @@ export default function suite() { await this.futarchy.futarchy.methods .resizeProposal() - .accounts({ proposal, dao, payer: this.payer.publicKey }) + .accountsPartial({ proposal, dao, payer: this.payer.publicKey }) .rpc(); const migrated = await this.futarchy.getProposal(proposal); @@ -345,7 +348,7 @@ export default function suite() { await this.futarchy.futarchy.methods .resizeProposal() - .accounts({ proposal, dao: otherDao, payer: this.payer.publicKey }) + .accountsPartial({ proposal, dao: otherDao, payer: this.payer.publicKey }) .rpc() .then(callbacks[0], callbacks[1]); }); diff --git a/tests/futarchy/unit/setSpendingLimit.test.ts b/tests/futarchy/unit/setSpendingLimit.test.ts index d01975d44..d1f07a700 100644 --- a/tests/futarchy/unit/setSpendingLimit.test.ts +++ b/tests/futarchy/unit/setSpendingLimit.test.ts @@ -193,7 +193,7 @@ export default function suite() { await this.futarchy.futarchy.methods .setSpendingLimit({ config: null }) - .accounts({ + .accountsPartial({ dao, squadsMultisigVault: attacker.publicKey, }) diff --git a/tests/futarchy/unit/withdrawLiquidity.test.ts b/tests/futarchy/unit/withdrawLiquidity.test.ts index 80a4047ad..4c1611de0 100644 --- a/tests/futarchy/unit/withdrawLiquidity.test.ts +++ b/tests/futarchy/unit/withdrawLiquidity.test.ts @@ -47,7 +47,7 @@ export default function suite() { minBaseAmount, minQuoteAmount, }) - .accounts({ + .accountsPartial({ dao, positionAuthority: authority, liquidityProviderBaseAccount: getAssociatedTokenAddressSync( diff --git a/tests/futarchy/utils.ts b/tests/futarchy/utils.ts index 9e9c247bb..db3fc14ff 100644 --- a/tests/futarchy/utils.ts +++ b/tests/futarchy/utils.ts @@ -162,7 +162,7 @@ export async function expectVaultExecutionError( execution: Promise, errorName: string, ) { - const error = ctx.futarchy.futarchy.idl.errors.find( + const error = ctx.futarchy.futarchy.rawIdl.errors.find( (e) => e.name === errorName, ); assert.exists(error, `unknown futarchy error ${errorName}`); diff --git a/tests/gatedMint/main.test.ts b/tests/gatedMint/main.test.ts index a131f459f..716d6479e 100644 --- a/tests/gatedMint/main.test.ts +++ b/tests/gatedMint/main.test.ts @@ -6,11 +6,11 @@ import gatedInvoke from "./unit/gatedInvoke.test.js"; import disableGating from "./unit/disableGating.test.js"; import thawAccount from "./unit/thawAccount.test.js"; import { GatedMintClient } from "@metadaoproject/programs"; -import { BankrunProvider } from "anchor-bankrun"; +import { LiteSVMProvider } from "../litesvm/index.js"; export default function suite() { before(async function () { - const provider = new BankrunProvider(this.context); + const provider = new LiteSVMProvider(this.context); this.gatedMint = GatedMintClient.createClient({ provider: provider as any, }); diff --git a/tests/gatedMint/unit/gatedInvoke.test.ts b/tests/gatedMint/unit/gatedInvoke.test.ts index 0feefe591..72f17cd13 100644 --- a/tests/gatedMint/unit/gatedInvoke.test.ts +++ b/tests/gatedMint/unit/gatedInvoke.test.ts @@ -27,7 +27,7 @@ import { } from "../utils.js"; import { initializeMintGovernorWithDefaults } from "../../mintGovernor/utils.js"; import { expectError } from "../../utils.js"; -import { mintTo } from "spl-token-bankrun"; +import { mintTo } from "../../litesvm/index.js"; export default function suite() { let gatedMintClient: GatedMintClient; @@ -232,7 +232,7 @@ export default function suite() { await gatedMintClient.program.methods .gatedInvoke({ instructionData: transferIx.data }) - .accounts({ + .accountsPartial({ caller: alice.publicKey, gatedMintConfig, whitelistedUser, @@ -289,7 +289,7 @@ export default function suite() { await gatedMintClient.program.methods .gatedInvoke({ instructionData: transferIx.data }) - .accounts({ + .accountsPartial({ caller: alice.publicKey, gatedMintConfig, whitelistedUser, diff --git a/tests/gatedMint/unit/removeWhitelistedUser.test.ts b/tests/gatedMint/unit/removeWhitelistedUser.test.ts index 47d8281d7..4369d9da8 100644 --- a/tests/gatedMint/unit/removeWhitelistedUser.test.ts +++ b/tests/gatedMint/unit/removeWhitelistedUser.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 { mintTo } from "spl-token-bankrun"; +import { mintTo } from "../../litesvm/index.js"; import { GatedMintClient, getWhitelistedUserAddr, diff --git a/tests/gatedMint/utils.ts b/tests/gatedMint/utils.ts index 88fcb171e..ecbfb25e4 100644 --- a/tests/gatedMint/utils.ts +++ b/tests/gatedMint/utils.ts @@ -6,7 +6,7 @@ import { SystemProgram, } from "@solana/web3.js"; import * as token from "@solana/spl-token"; -import { BanksClient, ProgramTestContext } from "solana-bankrun"; +import { BanksClient, ProgramTestContext } from "../litesvm/index.js"; import { GatedMintClient, getGatedMintConfigAddr, diff --git a/tests/integration/gatedLaunchpadV8.test.ts b/tests/integration/gatedLaunchpadV8.test.ts index c2a5eb6cd..583b11a4d 100644 --- a/tests/integration/gatedLaunchpadV8.test.ts +++ b/tests/integration/gatedLaunchpadV8.test.ts @@ -505,7 +505,7 @@ export default async function suite() { amountIn: new BN(100_000_000), minimumAmountOut: new BN(0), }) - .accounts({ + .accountsPartial({ tokenAMint: META, tokenBMint: MAINNET_USDC, tokenAProgram: token.TOKEN_PROGRAM_ID, diff --git a/tests/launchpad/unit/fund.test.ts b/tests/launchpad/unit/fund.test.ts index f94641f9f..d864b5005 100644 --- a/tests/launchpad/unit/fund.test.ts +++ b/tests/launchpad/unit/fund.test.ts @@ -5,7 +5,7 @@ import { LaunchpadClient, } from "@metadaoproject/programs/launchpad/v0.6"; import { MAINNET_USDC } from "@metadaoproject/programs"; -import { getAccount } from "spl-token-bankrun"; +import { getAccount } from "../../litesvm/index.js"; import { BN } from "bn.js"; import { getAssociatedTokenAddressSync } from "@solana/spl-token"; import { initializeMintWithSeeds } from "../utils.js"; diff --git a/tests/launchpad/unit/initializeLaunch.test.ts b/tests/launchpad/unit/initializeLaunch.test.ts index 6ed91c34a..8dd8d791d 100644 --- a/tests/launchpad/unit/initializeLaunch.test.ts +++ b/tests/launchpad/unit/initializeLaunch.test.ts @@ -164,7 +164,7 @@ export default function suite() { monthsUntilInsidersCanUnlock: 18, teamAddress: PublicKey.default, }) - .accounts({ + .accountsPartial({ launch, launchSigner: fakeLaunchSigner.publicKey, quoteVault: token.getAssociatedTokenAddressSync( diff --git a/tests/launchpad/unit/returnFunds.test.ts b/tests/launchpad/unit/returnFunds.test.ts index dfa22f157..41f8dcfb5 100644 --- a/tests/launchpad/unit/returnFunds.test.ts +++ b/tests/launchpad/unit/returnFunds.test.ts @@ -90,7 +90,7 @@ export default function suite() { await launchpadClient.launchpad.methods .returnFunds({ amount: amount_wrongly_sent }) - .accounts({ + .accountsPartial({ launch, recipient: this.payer.publicKey, recipientQuoteAccount, diff --git a/tests/launchpad/utils.ts b/tests/launchpad/utils.ts index e5e523513..b1c0aaff3 100644 --- a/tests/launchpad/utils.ts +++ b/tests/launchpad/utils.ts @@ -1,6 +1,6 @@ import { PublicKey, Signer, SystemProgram, Transaction } from "@solana/web3.js"; import * as token from "@solana/spl-token"; -import { BanksClient } from "solana-bankrun"; +import { BanksClient } from "../litesvm/index.js"; import { LaunchpadClient, getLaunchAddr, diff --git a/tests/launchpad_v7/unit/fund.test.ts b/tests/launchpad_v7/unit/fund.test.ts index de60a8a46..bf3db374c 100644 --- a/tests/launchpad_v7/unit/fund.test.ts +++ b/tests/launchpad_v7/unit/fund.test.ts @@ -10,7 +10,7 @@ import { LaunchpadClient, MAINNET_USDC, } from "@metadaoproject/programs"; -import { getAccount } from "spl-token-bankrun"; +import { getAccount } from "../../litesvm/index.js"; import { BN } from "bn.js"; import { getAssociatedTokenAddressSync } from "@solana/spl-token"; import { initializeMintWithSeeds } from "../utils.js"; diff --git a/tests/launchpad_v7/unit/initializeLaunch.test.ts b/tests/launchpad_v7/unit/initializeLaunch.test.ts index 61d309f50..3abf5b4e1 100644 --- a/tests/launchpad_v7/unit/initializeLaunch.test.ts +++ b/tests/launchpad_v7/unit/initializeLaunch.test.ts @@ -279,7 +279,7 @@ export default function suite() { launchAuthority: launchAuthority.publicKey, hasBidWall: false, }) - .accounts({ + .accountsPartial({ launch, launchSigner: fakeLaunchSigner.publicKey, quoteVault: token.getAssociatedTokenAddressSync( diff --git a/tests/launchpad_v7/utils.ts b/tests/launchpad_v7/utils.ts index 3d3af5af3..1649f0b25 100644 --- a/tests/launchpad_v7/utils.ts +++ b/tests/launchpad_v7/utils.ts @@ -1,6 +1,6 @@ import { PublicKey, Signer, SystemProgram, Transaction } from "@solana/web3.js"; import * as token from "@solana/spl-token"; -import { BanksClient } from "solana-bankrun"; +import { BanksClient } from "../litesvm/index.js"; import { LaunchpadClient } from "@metadaoproject/programs"; import { getLaunchAddr, getLaunchSignerAddr } from "@metadaoproject/programs"; diff --git a/tests/launchpad_v8/unit/fund.test.ts b/tests/launchpad_v8/unit/fund.test.ts index ffd38bf09..c045465e0 100644 --- a/tests/launchpad_v8/unit/fund.test.ts +++ b/tests/launchpad_v8/unit/fund.test.ts @@ -5,7 +5,7 @@ import { getFundingRecordAddr, } from "@metadaoproject/programs/launchpad/v0.8"; import { MAINNET_USDC } from "@metadaoproject/programs"; -import { getAccount } from "spl-token-bankrun"; +import { getAccount } from "../../litesvm/index.js"; import { BN } from "bn.js"; import { getAssociatedTokenAddressSync } from "@solana/spl-token"; import { initializeMintWithSeeds } from "../utils.js"; diff --git a/tests/launchpad_v8/unit/initializeLaunch.test.ts b/tests/launchpad_v8/unit/initializeLaunch.test.ts index cdb73fb20..fa9a72302 100644 --- a/tests/launchpad_v8/unit/initializeLaunch.test.ts +++ b/tests/launchpad_v8/unit/initializeLaunch.test.ts @@ -321,7 +321,7 @@ export default function suite() { launchAuthority: launchAuthority.publicKey, hasBidWall: false, }) - .accounts({ + .accountsPartial({ launch, launchSigner: fakeLaunchSigner.publicKey, quoteVault: token.getAssociatedTokenAddressSync( diff --git a/tests/launchpad_v8/utils.ts b/tests/launchpad_v8/utils.ts index 01824c5c6..ad0df43a2 100644 --- a/tests/launchpad_v8/utils.ts +++ b/tests/launchpad_v8/utils.ts @@ -1,6 +1,6 @@ import { PublicKey, Signer, SystemProgram, Transaction } from "@solana/web3.js"; import * as token from "@solana/spl-token"; -import { BanksClient } from "solana-bankrun"; +import { BanksClient } from "../litesvm/index.js"; import { LaunchpadClient, getLaunchAddr, diff --git a/tests/liquidation/main.test.ts b/tests/liquidation/main.test.ts index 2d717d775..ac906540d 100644 --- a/tests/liquidation/main.test.ts +++ b/tests/liquidation/main.test.ts @@ -1,5 +1,5 @@ import { LiquidationClient } from "@metadaoproject/programs"; -import { BankrunProvider } from "anchor-bankrun"; +import { LiteSVMProvider } from "../litesvm/index.js"; import initializeLiquidation from "./unit/initializeLiquidation.test.js"; import setRefundRecord from "./unit/setRefundRecord.test.js"; import activateLiquidation from "./unit/activateLiquidation.test.js"; @@ -8,7 +8,7 @@ import withdrawRemainingQuote from "./unit/withdrawRemainingQuote.test.js"; export default function suite() { before(async function () { - const provider = new BankrunProvider(this.context); + const provider = new LiteSVMProvider(this.context); this.liquidation = LiquidationClient.createClient({ provider: provider as any, }); diff --git a/tests/liquidation/unit/refund.test.ts b/tests/liquidation/unit/refund.test.ts index 9ef7157be..5ddca8f1d 100644 --- a/tests/liquidation/unit/refund.test.ts +++ b/tests/liquidation/unit/refund.test.ts @@ -379,7 +379,7 @@ export default function suite() { baseMint, quoteMint, }) - .accounts({ + .accountsPartial({ refundRecord: realRefundRecord, }) .signers([wrongRecipient]) diff --git a/tests/litesvm/client.ts b/tests/litesvm/client.ts new file mode 100644 index 000000000..845b52f3f --- /dev/null +++ b/tests/litesvm/client.ts @@ -0,0 +1,127 @@ +import { address, getTransactionDecoder } from "@solana/kit"; +import { PublicKey, Transaction, VersionedTransaction } from "@solana/web3.js"; +import { + Clock, + FailedTransactionMetadata, + LiteSVM, + Rent, + TransactionMetadata, +} from "litesvm"; +import { renderTransactionError } from "./errors.js"; + +export type AccountInfoBytes = { + executable: boolean; + owner: PublicKey; + lamports: number; + data: Uint8Array; + rentEpoch: number; +}; + +export type BanksTransactionMeta = { + logMessages: string[]; + computeUnitsConsumed: bigint; + returnData: { programId: PublicKey; data: Uint8Array }; +}; + +export type BanksTransactionResultWithMeta = { + result: string | null; + meta: BanksTransactionMeta; +}; + +export const toAddress = (key: PublicKey) => address(key.toBase58()); + +// web3.js signs and serializes; kit decodes the bytes into the shape LiteSVM accepts. +export const toKitTransaction = (tx: Transaction | VersionedTransaction) => + getTransactionDecoder().decode(tx.serialize()); + +// The bankrun BanksClient surface the tests use, served by an in-process LiteSVM. +export class BanksClient { + constructor(readonly svm: LiteSVM) {} + + async getLatestBlockhash(_commitment?: unknown): Promise<[string, bigint]> { + return [this.svm.latestBlockhash(), 0n]; + } + + async getAccount( + key: PublicKey, + _commitment?: unknown, + ): Promise { + const account = this.svm.getAccount(toAddress(key)); + if (!account.exists) return null; + return { + executable: account.executable, + owner: new PublicKey(account.programAddress), + lamports: Number(account.lamports), + data: new Uint8Array(account.data), + rentEpoch: 0, + }; + } + + async getBalance(key: PublicKey, _commitment?: unknown): Promise { + return this.svm.getBalance(toAddress(key)) ?? 0n; + } + + async getClock(): Promise { + return this.svm.getClock(); + } + + async getSlot(_commitment?: unknown): Promise { + return this.svm.getClock().slot; + } + + async getRent(): Promise { + return this.svm.getRent(); + } + + async tryProcessTransaction( + tx: Transaction | VersionedTransaction, + ): Promise { + const result = this.svm.sendTransaction(toKitTransaction(tx)); + // Rotate the blockhash like a live chain, so repeated identical instructions never collide in the transaction history. + this.svm.expireBlockhash(); + if (result instanceof FailedTransactionMetadata) { + return { + result: renderTransactionError(result.err()), + meta: toMeta(result.meta()), + }; + } + return { result: null, meta: toMeta(result) }; + } + + // Throws with Agave's error text followed by the program logs. + async processTransaction( + tx: Transaction | VersionedTransaction, + ): Promise { + const { result, meta } = await this.tryProcessTransaction(tx); + if (result !== null) { + throw new Error([result, ...meta.logMessages].join("\n")); + } + return meta; + } + + async simulateTransaction( + tx: Transaction | VersionedTransaction, + _commitment?: unknown, + ): Promise { + const result = this.svm.simulateTransaction(toKitTransaction(tx)); + if (result instanceof FailedTransactionMetadata) { + return { + result: renderTransactionError(result.err()), + meta: toMeta(result.meta()), + }; + } + return { result: null, meta: toMeta(result.meta()) }; + } +} + +function toMeta(meta: TransactionMetadata): BanksTransactionMeta { + const returnData = meta.returnData(); + return { + logMessages: meta.logs(), + computeUnitsConsumed: meta.computeUnitsConsumed(), + returnData: { + programId: new PublicKey(returnData.programId()), + data: returnData.data(), + }, + }; +} diff --git a/tests/litesvm/context.ts b/tests/litesvm/context.ts new file mode 100644 index 000000000..7edea1c66 --- /dev/null +++ b/tests/litesvm/context.ts @@ -0,0 +1,59 @@ +import { address, lamports } from "@solana/kit"; +import { Keypair, PublicKey } from "@solana/web3.js"; +import { Clock, LiteSVM, SlotHash } from "litesvm"; +import { AccountInfoBytes, BanksClient } from "./client.js"; + +export type AccountInfoInput = Omit< + AccountInfoBytes, + "rentEpoch" | "lamports" +> & { + lamports: number | bigint; + rentEpoch?: number; +}; + +const SLOT_HASHES_WINDOW = 512n; + +// The bankrun ProgramTestContext surface the tests use. +export class ProgramTestContext { + readonly banksClient: BanksClient; + + constructor( + readonly svm: LiteSVM, + readonly payer: Keypair, + ) { + this.banksClient = new BanksClient(svm); + } + + get lastBlockhash(): string { + return this.svm.latestBlockhash(); + } + + setAccount(key: PublicKey, account: AccountInfoInput): void { + const data = new Uint8Array(account.data); + this.svm.setAccount({ + address: address(key.toBase58()), + data, + executable: account.executable, + lamports: lamports(BigInt(account.lamports)), + programAddress: address(account.owner.toBase58()), + space: BigInt(data.length), + }); + } + + // Also rewrite SlotHashes so recent-slot checks (lookup-table creation) see the new slot. + setClock(clock: Clock): void { + this.svm.setClock(clock); + const hash = this.svm.latestBlockhash(); + const hashes: { slot: bigint; hash: string }[] = []; + for (let i = 0n; i < SLOT_HASHES_WINDOW && clock.slot >= i; i++) { + hashes.push({ slot: clock.slot - i, hash }); + } + this.svm.setSlotHashes(hashes as unknown as SlotHash[]); + } + + warpToSlot(slot: bigint): void { + const clock = this.svm.getClock(); + clock.slot = slot; + this.setClock(clock); + } +} diff --git a/tests/litesvm/errors.ts b/tests/litesvm/errors.ts new file mode 100644 index 000000000..9951ae725 --- /dev/null +++ b/tests/litesvm/errors.ts @@ -0,0 +1,137 @@ +import type { FailedTransactionMetadata } from "litesvm"; + +// Agave's display text for each fieldless TransactionError variant, indexed by LiteSVM's enum value. +const TRANSACTION_ERRORS: Record = { + 0: "Account in use", + 1: "Account loaded twice", + 2: "Attempt to debit an account but found no record of a prior credit.", + 3: "Attempt to load a program that does not exist", + 4: "Insufficient funds for fee", + 5: "This account may not be used to pay transaction fees", + 6: "This transaction has already been processed", + 7: "Blockhash not found", + 8: "Loader call chain is too deep", + 9: "Transaction requires a fee but has no signature present", + 10: "Transaction contains an invalid account reference", + 11: "Transaction did not pass signature verification", + 12: "This program may not be used for executing instructions", + 13: "Transaction failed to sanitize accounts offsets correctly", + 14: "Transactions are currently disabled due to cluster maintenance", + 15: "Transaction processing left an account with an outstanding borrowed reference", + 16: "Transaction would exceed max Block Cost Limit", + 17: "Transaction version is unsupported", + 18: "Transaction loads a writable account that cannot be written", + 19: "Transaction would exceed max account limit within the block", + 20: "Transaction would exceed account data limit within the block", + 21: "Transaction locked too many accounts", + 22: "Transaction loads an address table account that doesn't exist", + 23: "Transaction loads an address table account with an invalid owner", + 24: "Transaction loads an address table account with invalid data", + 25: "Transaction address table lookup uses an invalid index", + 26: "Transaction leaves an account with a lower balance than rent-exempt minimum", + 27: "Transaction would exceed max Vote Cost Limit", + 28: "Transaction would exceed total account data limit", + 29: "Transaction exceeds max loaded accounts data size cap", + 30: "ResanitizationNeeded", + 31: "LoadedAccountsDataSizeLimit set for transaction must be greater than 0.", + 32: "Sum of account balances before and after transaction do not match", + 33: "Program cache hit max limit", + 34: "CommitCancelled", +}; + +// Agave's display text for each fieldless InstructionError variant, indexed by LiteSVM's enum value. +const INSTRUCTION_ERRORS: Record = { + 0: "generic instruction error", + 1: "invalid program argument", + 2: "invalid instruction data", + 3: "invalid account data for instruction", + 4: "account data too small for instruction", + 5: "insufficient funds for instruction", + 6: "incorrect program id for instruction", + 7: "missing required signature for instruction", + 8: "instruction requires an uninitialized account", + 9: "instruction requires an initialized account", + 10: "sum of account balances before and after instruction do not match", + 11: "instruction illegally modified the program id of an account", + 12: "instruction spent from the balance of an account it does not own", + 13: "instruction modified data of an account it does not own", + 14: "instruction changed the balance of a read-only account", + 15: "instruction modified data of a read-only account", + 16: "instruction contains duplicate accounts", + 17: "instruction changed executable bit of an account", + 18: "instruction modified rent epoch of an account", + 19: "insufficient account keys for instruction", + 20: "program other than the account's owner changed the size of the account data", + 21: "instruction expected an executable account", + 22: "instruction tries to borrow reference for an account which is already borrowed", + 23: "instruction left account with an outstanding borrowed reference", + 24: "instruction modifications of multiply-passed account differ", + 25: "program returned invalid error code", + 26: "instruction changed executable accounts data", + 27: "instruction changed the balance of an executable account", + 28: "executable accounts must be rent exempt", + 29: "Unsupported program id", + 30: "Cross-program invocation call depth too deep", + 31: "An account required by the instruction is missing", + 32: "Cross-program invocation reentrancy not allowed for this instruction", + 33: "Length of the seed is too long for address generation", + 34: "Provided seeds do not result in a valid address", + 35: "Failed to reallocate account data", + 36: "Computational budget exceeded", + 37: "Cross-program invocation with unauthorized signer or writable account", + 38: "Failed to create program execution environment", + 39: "Program failed to complete", + 40: "Program failed to compile", + 41: "Account is immutable", + 42: "Incorrect authority provided", + 43: "An account does not have enough lamports to be rent-exempt", + 44: "Invalid account owner", + 45: "Program arithmetic overflowed", + 46: "Unsupported sysvar", + 47: "Provided owner is not allowed", + 48: "Accounts data allocations exceeded the maximum allowed per transaction", + 49: "Max accounts exceeded", + 50: "Max instruction trace length exceeded", + 51: "Builtin programs must consume compute units", + 52: "Failed to serialize or deserialize account data", +}; + +export type TransactionError = ReturnType; + +// Render a LiteSVM transaction error the way Agave (and therefore bankrun) prints it. +// The tests were written against bankrun and assert on this exact text (e.g. `custom program error: 0x0`), +// while LiteSVM's own toString() only yields the debug shape `TransactionErrorInstructionError { index: 0, ... }`. +export function renderTransactionError(error: TransactionError): string { + if (typeof error === "number") { + return TRANSACTION_ERRORS[error] ?? `TransactionError(${error})`; + } + const value = error as unknown as Record; + if (typeof value.err === "function" && typeof value.index === "number") { + const inner = (value.err as () => unknown)(); + return `Error processing Instruction ${value.index}: ${renderInstructionError(inner)}`; + } + switch (error.constructor?.name) { + case "TransactionErrorDuplicateInstruction": + return `Transaction contains a duplicate instruction (${value.index}) that is not allowed`; + case "TransactionErrorInsufficientFundsForRent": + return `Transaction results in an account (${value.accountIndex}) with insufficient funds for rent`; + case "TransactionErrorProgramExecutionTemporarilyRestricted": + return `Execution of the program referenced by account at index ${value.accountIndex} is temporarily restricted.`; + default: + return String(error); + } +} + +function renderInstructionError(error: unknown): string { + if (typeof error === "number") { + return INSTRUCTION_ERRORS[error] ?? `InstructionError(${error})`; + } + const value = error as Record; + if (typeof value.code === "number") { + return `custom program error: 0x${value.code.toString(16)}`; + } + if (typeof value.msg === "string") { + return `Failed to serialize or deserialize account data: ${value.msg}`; + } + return String(error); +} diff --git a/tests/litesvm/index.ts b/tests/litesvm/index.ts new file mode 100644 index 000000000..36e77f696 --- /dev/null +++ b/tests/litesvm/index.ts @@ -0,0 +1,25 @@ +export { Clock } from "litesvm"; +export { + BanksClient, + type AccountInfoBytes, + type BanksTransactionMeta, + type BanksTransactionResultWithMeta, +} from "./client.js"; +export { ProgramTestContext, type AccountInfoInput } from "./context.js"; +export { + startAnchor, + type AddedAccount, + type AddedProgram, +} from "./workspace.js"; +export { LiteSVMProvider } from "./provider.js"; +export { + createAccount, + createAssociatedTokenAccount, + createMint, + getAccount, + getMint, + getSigners, + mintTo, + mintToOverride, + transfer, +} from "./token.js"; diff --git a/tests/litesvm/provider.ts b/tests/litesvm/provider.ts new file mode 100644 index 000000000..fda857f3b --- /dev/null +++ b/tests/litesvm/provider.ts @@ -0,0 +1,196 @@ +import { Provider, Wallet, utils } from "@anchor-lang/core"; +import { + AccountInfo, + Commitment, + ConfirmOptions, + Connection, + PublicKey, + SendOptions, + SendTransactionError, + Signer, + Transaction, + TransactionSignature, + VersionedTransaction, +} from "@solana/web3.js"; +import { BanksClient } from "./client.js"; +import { ProgramTestContext } from "./context.js"; + +// The Connection methods Anchor, the SDK and @solana/spl-token call on provider.connection. +class LiteSVMConnection { + constructor(private readonly banksClient: BanksClient) {} + + private async accountInfo( + key: PublicKey, + ): Promise | null> { + const account = await this.banksClient.getAccount(key); + return account ? { ...account, data: Buffer.from(account.data) } : null; + } + + private async slot(): Promise { + return Number(await this.banksClient.getSlot()); + } + + async getAccountInfo(key: PublicKey, _commitment?: unknown) { + return this.accountInfo(key); + } + + async getAccountInfoAndContext(key: PublicKey, _commitment?: unknown) { + return { + context: { slot: await this.slot() }, + value: await this.accountInfo(key), + }; + } + + async getMultipleAccountsInfo(keys: PublicKey[], _commitment?: unknown) { + return Promise.all(keys.map((key) => this.accountInfo(key))); + } + + async getMultipleAccountsInfoAndContext( + keys: PublicKey[], + _commitment?: unknown, + ) { + return { + context: { slot: await this.slot() }, + value: await this.getMultipleAccountsInfo(keys), + }; + } + + async getMinimumBalanceForRentExemption( + dataLength: number, + _commitment?: unknown, + ) { + const rent = await this.banksClient.getRent(); + return Number(rent.minimumBalance(BigInt(dataLength))); + } + + async getLatestBlockhash(_commitment?: unknown) { + const [blockhash] = await this.banksClient.getLatestBlockhash(); + return { blockhash, lastValidBlockHeight: 0 }; + } + + async getSlot(_commitment?: unknown) { + return this.slot(); + } + + async getBalance(key: PublicKey, _commitment?: unknown) { + return Number(await this.banksClient.getBalance(key)); + } +} + +// Anchor reads err.logs off the thrown error to translate it into an AnchorError. +function sendTransactionError( + signature: string, + message: string, + logs: string[], +): SendTransactionError { + return new SendTransactionError({ + action: "send", + signature, + transactionMessage: message, + logs, + }); +} + +// The anchor-bankrun BankrunProvider, re-based on the LiteSVM facade. +export class LiteSVMProvider implements Provider { + readonly wallet: Wallet; + readonly connection: Connection; + readonly publicKey: PublicKey; + + constructor( + readonly context: ProgramTestContext, + wallet?: Wallet, + ) { + this.wallet = wallet ?? new Wallet(context.payer); + this.connection = new LiteSVMConnection( + context.banksClient, + ) as unknown as Connection; + this.publicKey = this.wallet.publicKey; + } + + private async sign( + tx: Transaction | VersionedTransaction, + signers?: Signer[], + ): Promise { + if ("version" in tx) { + signers?.forEach((signer) => tx.sign([signer])); + } else { + tx.feePayer = tx.feePayer ?? this.wallet.publicKey; + tx.recentBlockhash = this.context.lastBlockhash; + signers?.forEach((signer) => tx.partialSign(signer)); + } + await this.wallet.signTransaction(tx); + const signature = "version" in tx ? tx.signatures[0] : tx.signature; + if (!signature) throw new Error("Missing fee payer signature"); + return utils.bytes.bs58.encode(signature); + } + + private async sendSigned( + tx: Transaction | VersionedTransaction, + signature: string, + ): Promise { + const { result, meta } = + await this.context.banksClient.tryProcessTransaction(tx); + if (result !== null) { + throw sendTransactionError(signature, result, meta.logMessages); + } + } + + async send( + tx: Transaction | VersionedTransaction, + signers?: Signer[], + _opts?: SendOptions, + ): Promise { + const signature = await this.sign(tx, signers); + await this.context.banksClient.tryProcessTransaction(tx); + return signature; + } + + async sendAndConfirm( + tx: Transaction | VersionedTransaction, + signers?: Signer[], + _opts?: ConfirmOptions, + ): Promise { + const signature = await this.sign(tx, signers); + await this.sendSigned(tx, signature); + return signature; + } + + async sendAll( + txWithSigners: { tx: T; signers?: Signer[] }[], + _opts?: ConfirmOptions, + ): Promise { + const signatures: TransactionSignature[] = []; + for (const { tx, signers } of txWithSigners) { + const signature = await this.sign(tx, signers); + await this.sendSigned(tx, signature); + signatures.push(signature); + } + return signatures; + } + + async simulate( + tx: Transaction | VersionedTransaction, + signers?: Signer[], + _commitment?: Commitment, + includeAccounts?: boolean | PublicKey[], + ): ReturnType> { + if (includeAccounts !== undefined) { + throw new Error("includeAccounts cannot be used with LiteSVMProvider"); + } + const signature = await this.sign(tx, signers); + const { result, meta } = + await this.context.banksClient.simulateTransaction(tx); + if (result !== null) { + throw sendTransactionError(signature, result, meta.logMessages); + } + return { + logs: meta.logMessages, + unitsConsumed: Number(meta.computeUnitsConsumed), + returnData: { + programId: meta.returnData.programId.toString(), + data: [Buffer.from(meta.returnData.data).toString("base64"), "base64"], + }, + }; + } +} diff --git a/tests/litesvm/token.ts b/tests/litesvm/token.ts new file mode 100644 index 000000000..8b440bb87 --- /dev/null +++ b/tests/litesvm/token.ts @@ -0,0 +1,238 @@ +import * as token from "@solana/spl-token"; +import { + Keypair, + PublicKey, + Signer, + SystemProgram, + Transaction, +} from "@solana/web3.js"; +import { BanksClient } from "./client.js"; +import { ProgramTestContext } from "./context.js"; + +// Ports of the spl-token-bankrun 0.2.6 helpers (https://github.com/metaDAOproject/spl-token-bankrun, +// https://www.npmjs.com/package/spl-token-bankrun), same signatures, served by the LiteSVM facade. + +export async function createMint( + banksClient: BanksClient, + payer: Signer, + mintAuthority: PublicKey, + freezeAuthority: PublicKey | null, + decimals: number, + keypair = Keypair.generate(), + programId = token.TOKEN_PROGRAM_ID, +): Promise { + const rent = await banksClient.getRent(); + const tx = new Transaction().add( + SystemProgram.createAccount({ + fromPubkey: payer.publicKey, + newAccountPubkey: keypair.publicKey, + space: token.MINT_SIZE, + lamports: Number(rent.minimumBalance(BigInt(token.MINT_SIZE))), + programId, + }), + token.createInitializeMint2Instruction( + keypair.publicKey, + decimals, + mintAuthority, + freezeAuthority, + programId, + ), + ); + [tx.recentBlockhash] = await banksClient.getLatestBlockhash(); + tx.sign(payer, keypair); + await banksClient.processTransaction(tx); + return keypair.publicKey; +} + +export async function createAccount( + banksClient: BanksClient, + payer: Signer, + mint: PublicKey, + owner: PublicKey, + keypair?: Keypair, + programId = token.TOKEN_PROGRAM_ID, +): Promise { + if (!keypair) { + return createAssociatedTokenAccount( + banksClient, + payer, + mint, + owner, + programId, + ); + } + const rent = await banksClient.getRent(); + const mintState = await getMint(banksClient, mint, undefined, programId); + const space = token.getAccountLenForMint(mintState); + const tx = new Transaction().add( + SystemProgram.createAccount({ + fromPubkey: payer.publicKey, + newAccountPubkey: keypair.publicKey, + space, + lamports: Number(rent.minimumBalance(BigInt(space))), + programId, + }), + token.createInitializeAccountInstruction( + keypair.publicKey, + mint, + owner, + programId, + ), + ); + [tx.recentBlockhash] = await banksClient.getLatestBlockhash(); + tx.sign(payer, keypair); + await banksClient.processTransaction(tx); + return keypair.publicKey; +} + +export async function createAssociatedTokenAccount( + banksClient: BanksClient, + payer: Signer, + mint: PublicKey, + owner: PublicKey, + programId = token.TOKEN_PROGRAM_ID, + associatedTokenProgramId = token.ASSOCIATED_TOKEN_PROGRAM_ID, +): Promise { + const associatedToken = token.getAssociatedTokenAddressSync( + mint, + owner, + true, + programId, + associatedTokenProgramId, + ); + const tx = new Transaction().add( + token.createAssociatedTokenAccountInstruction( + payer.publicKey, + associatedToken, + owner, + mint, + programId, + associatedTokenProgramId, + ), + ); + [tx.recentBlockhash] = await banksClient.getLatestBlockhash(); + tx.sign(payer); + await banksClient.processTransaction(tx); + return associatedToken; +} + +export async function getMint( + banksClient: BanksClient, + address: PublicKey, + _commitment?: unknown, + programId = token.TOKEN_PROGRAM_ID, +): Promise { + const info = await banksClient.getAccount(address); + return token.unpackMint( + address, + info ? { ...info, data: Buffer.from(info.data) } : null, + programId, + ); +} + +export async function getAccount( + banksClient: BanksClient, + address: PublicKey, + _commitment?: unknown, + programId = token.TOKEN_PROGRAM_ID, +): Promise { + const info = await banksClient.getAccount(address); + return token.unpackAccount( + address, + info ? { ...info, data: Buffer.from(info.data) } : null, + programId, + ); +} + +// Sets a token account's balance directly, without the mint authority. +export async function mintToOverride( + context: ProgramTestContext, + destination: PublicKey, + amount: bigint, +): Promise { + const existing = await getAccount(context.banksClient, destination); + const data = Buffer.alloc(token.ACCOUNT_SIZE); + token.AccountLayout.encode( + { + mint: existing.mint, + owner: existing.owner, + amount, + delegateOption: 0, + delegate: PublicKey.default, + delegatedAmount: 0n, + state: 1, + isNativeOption: 0, + isNative: 0n, + closeAuthorityOption: 0, + closeAuthority: PublicKey.default, + }, + data, + ); + context.setAccount(destination, { + data, + executable: false, + lamports: 1_000_000_000, + owner: token.TOKEN_PROGRAM_ID, + }); +} + +export async function mintTo( + banksClient: BanksClient, + payer: Signer, + mint: PublicKey, + destination: PublicKey, + authority: Signer | PublicKey, + amount: number | bigint, + multiSigners: Signer[] = [], + programId = token.TOKEN_PROGRAM_ID, +) { + const [authorityPublicKey, signers] = getSigners(authority, multiSigners); + const tx = new Transaction().add( + token.createMintToInstruction( + mint, + destination, + authorityPublicKey, + amount, + multiSigners, + programId, + ), + ); + [tx.recentBlockhash] = await banksClient.getLatestBlockhash(); + tx.sign(payer, ...signers); + return banksClient.processTransaction(tx); +} + +export async function transfer( + banksClient: BanksClient, + payer: Signer, + source: PublicKey, + destination: PublicKey, + owner: Signer | PublicKey, + amount: number | bigint, + multiSigners: Signer[] = [], + programId = token.TOKEN_PROGRAM_ID, +) { + const [ownerPublicKey, signers] = getSigners(owner, multiSigners); + const tx = new Transaction().add( + token.createTransferInstruction( + source, + destination, + ownerPublicKey, + amount, + multiSigners, + programId, + ), + ); + [tx.recentBlockhash] = await banksClient.getLatestBlockhash(); + tx.sign(payer, ...signers); + return banksClient.processTransaction(tx); +} + +export function getSigners( + signerOrMultisig: Signer | PublicKey, + multiSigners: Signer[], +): [PublicKey, Signer[]] { + return signerOrMultisig instanceof PublicKey + ? [signerOrMultisig, multiSigners] + : [signerOrMultisig.publicKey, [signerOrMultisig]]; +} diff --git a/tests/litesvm/workspace.ts b/tests/litesvm/workspace.ts new file mode 100644 index 000000000..7e09e3fb7 --- /dev/null +++ b/tests/litesvm/workspace.ts @@ -0,0 +1,96 @@ +import * as fs from "fs"; +import * as path from "path"; +import { address, lamports } from "@solana/kit"; +import { Keypair, LAMPORTS_PER_SOL, PublicKey } from "@solana/web3.js"; +import { Clock, FailedTransactionMetadata, LiteSVM } from "litesvm"; +import { AccountInfoInput, ProgramTestContext } from "./context.js"; + +export type AddedProgram = { name: string; programId: PublicKey }; +export type AddedAccount = { address: PublicKey; info: AccountInfoInput }; + +// Same payer balance bankrun's genesis grants. +const PAYER_LAMPORTS = 1_000_000n * BigInt(LAMPORTS_PER_SOL); + +// Loads every [programs.localnet] program from target/deploy plus the named fixtures, like bankrun's startAnchor. +export async function startAnchor( + workspacePath: string, + extraPrograms: AddedProgram[] = [], + accounts: AddedAccount[] = [], +): Promise { + const root = path.resolve(workspacePath); + // Blockhash age is not checked: the facade rotates the blockhash after every transaction (see client.ts). + const svm = new LiteSVM() + .withLamports(PAYER_LAMPORTS * 2n) + .withBlockhashCheck(false); + + for (const [name, programId] of readLocalnetPrograms( + path.join(root, "Anchor.toml"), + )) { + svm.addProgramFromFile( + address(programId), + path.join(root, "target", "deploy", `${name}.so`), + ); + } + for (const { name, programId } of extraPrograms) { + svm.addProgramFromFile( + address(programId.toBase58()), + findProgramFile(root, name), + ); + } + + const payer = Keypair.generate(); + const airdrop = svm.airdrop( + address(payer.publicKey.toBase58()), + lamports(PAYER_LAMPORTS), + ); + if (airdrop instanceof FailedTransactionMetadata) { + throw new Error(`payer airdrop failed: ${airdrop.toString()}`); + } + + const context = new ProgramTestContext(svm, payer); + for (const { address: key, info } of accounts) { + context.setAccount(key, info); + } + + // LiteSVM starts at Unix time 0; tests derive deadlines from the clock, so start at wall-clock time. + const clock = svm.getClock(); + context.setClock( + new Clock( + clock.slot, + clock.epochStartTimestamp, + clock.epoch, + clock.leaderScheduleEpoch, + BigInt(Math.floor(Date.now() / 1000)), + ), + ); + return context; +} + +function readLocalnetPrograms(anchorToml: string): [string, string][] { + const lines = fs.readFileSync(anchorToml, "utf8").split(/\r?\n/); + const start = lines.findIndex( + (line) => line.trim() === "[programs.localnet]", + ); + if (start < 0) { + throw new Error(`no [programs.localnet] table in ${anchorToml}`); + } + const programs: [string, string][] = []; + for (const line of lines.slice(start + 1)) { + if (line.trim().startsWith("[")) break; + const match = line.match(/^\s*([A-Za-z0-9_-]+)\s*=\s*"([^"]+)"/); + if (match) programs.push([match[1].replace(/-/g, "_"), match[2]]); + } + return programs; +} + +function findProgramFile(root: string, name: string): string { + const candidates = [ + path.join(root, "tests", "fixtures", `${name}.so`), + path.join(root, "target", "deploy", `${name}.so`), + ]; + const found = candidates.find((candidate) => fs.existsSync(candidate)); + if (!found) { + throw new Error(`${name}.so not found in tests/fixtures or target/deploy`); + } + return found; +} diff --git a/tests/main.test.ts b/tests/main.test.ts index 76e0cb681..d70764bc6 100644 --- a/tests/main.test.ts +++ b/tests/main.test.ts @@ -15,9 +15,9 @@ import { Clock, ProgramTestContext, startAnchor, -} from "solana-bankrun"; -import { BankrunProvider } from "anchor-bankrun"; -import * as anchor from "@coral-xyz/anchor"; +} from "./litesvm/index.js"; +import { LiteSVMProvider } from "./litesvm/index.js"; +import * as anchor from "@anchor-lang/core"; import { FutarchyClient, ConditionalVaultClient, @@ -67,7 +67,7 @@ import { transfer, getMint, mintToOverride, -} from "spl-token-bankrun"; +} from "./litesvm/index.js"; import * as token from "@solana/spl-token"; import { assert } from "chai"; import { MPL_TOKEN_METADATA_PROGRAM_ID as UMI_MPL_TOKEN_METADATA_PROGRAM_ID } from "@metaplex-foundation/mpl-token-metadata"; @@ -276,7 +276,7 @@ before(async function () { ], ); this.banksClient = this.context.banksClient; - const provider = new BankrunProvider(this.context); + const provider = new LiteSVMProvider(this.context); anchor.setProvider(provider); this.conditionalVault = ConditionalVaultClient.createClient({ diff --git a/tests/mintGovernor/main.test.ts b/tests/mintGovernor/main.test.ts index 1c18af131..fbc9b2675 100644 --- a/tests/mintGovernor/main.test.ts +++ b/tests/mintGovernor/main.test.ts @@ -7,11 +7,11 @@ 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/programs"; -import { BankrunProvider } from "anchor-bankrun"; +import { LiteSVMProvider } from "../litesvm/index.js"; export default function suite() { before(async function () { - const provider = new BankrunProvider(this.context); + const provider = new LiteSVMProvider(this.context); this.mintGovernor = MintGovernorClient.createClient({ provider: provider as any, }); diff --git a/tests/mintGovernor/unit/mintTokens.test.ts b/tests/mintGovernor/unit/mintTokens.test.ts index 5eafa6f91..05a71ad57 100644 --- a/tests/mintGovernor/unit/mintTokens.test.ts +++ b/tests/mintGovernor/unit/mintTokens.test.ts @@ -301,7 +301,7 @@ export default function suite() { // but use the mint_authority created for the real authorizedMinter await mintGovernorClient.program.methods .mintTokens({ amount: new BN(500) }) - .accounts({ + .accountsPartial({ mintGovernor, mintAuthority, mint, @@ -387,7 +387,7 @@ export default function suite() { // Manually construct the instruction to pass the wrong mint_authority await mintGovernorClient.program.methods .mintTokens({ amount: new BN(500) }) - .accounts({ + .accountsPartial({ mintGovernor, mintAuthority: wrongMintAuthority, mint, @@ -435,7 +435,7 @@ export default function suite() { try { await mintGovernorClient.program.methods .mintTokens({ amount: new BN(500) }) - .accounts({ + .accountsPartial({ mintGovernor, mintAuthority: getMintAuthorityAddr({ mintGovernor, diff --git a/tests/mintGovernor/utils.ts b/tests/mintGovernor/utils.ts index a732db38a..77cb89310 100644 --- a/tests/mintGovernor/utils.ts +++ b/tests/mintGovernor/utils.ts @@ -5,7 +5,7 @@ import { SystemProgram, } from "@solana/web3.js"; import * as token from "@solana/spl-token"; -import { BanksClient } from "solana-bankrun"; +import { BanksClient } from "../litesvm/index.js"; import { MintGovernorClient, getMintGovernorAddr, diff --git a/tests/performancePackageV2/main.test.ts b/tests/performancePackageV2/main.test.ts index e6e30a9e4..7495bd746 100644 --- a/tests/performancePackageV2/main.test.ts +++ b/tests/performancePackageV2/main.test.ts @@ -9,11 +9,11 @@ import { MintGovernorClient, PerformancePackageV2Client, } from "@metadaoproject/programs"; -import { BankrunProvider } from "anchor-bankrun"; +import { LiteSVMProvider } from "../litesvm/index.js"; export default function suite() { before(async function () { - const provider = new BankrunProvider(this.context); + const provider = new LiteSVMProvider(this.context); this.mintGovernor = MintGovernorClient.createClient({ provider: provider as any, }); diff --git a/tests/performancePackageV2/unit/completeUnlock.test.ts b/tests/performancePackageV2/unit/completeUnlock.test.ts index dcf23871e..7bbf6faa7 100644 --- a/tests/performancePackageV2/unit/completeUnlock.test.ts +++ b/tests/performancePackageV2/unit/completeUnlock.test.ts @@ -509,7 +509,7 @@ export default function suite() { // This would calculate only 100 + 10% of 400 = 140 tokens // But since we've already paid 300, no new tokens should be minted const clockAfterFirstUnlock = await this.banksClient.getClock(); - const { Clock } = await import("solana-bankrun"); + const { Clock } = await import("../../litesvm/index.js"); this.context.setClock( new Clock( clockAfterFirstUnlock.slot, diff --git a/tests/performancePackageV2/utils.ts b/tests/performancePackageV2/utils.ts index c9ab04597..df6825676 100644 --- a/tests/performancePackageV2/utils.ts +++ b/tests/performancePackageV2/utils.ts @@ -6,7 +6,7 @@ import { ComputeBudgetProgram, } from "@solana/web3.js"; import * as token from "@solana/spl-token"; -import { BanksClient } from "solana-bankrun"; +import { BanksClient } from "../litesvm/index.js"; import BN from "bn.js"; import { MintGovernorClient, diff --git a/tests/priceBasedPerformancePackage/unit/burnPerformancePackage.test.ts b/tests/priceBasedPerformancePackage/unit/burnPerformancePackage.test.ts index 54046ad7a..4c2955c6f 100644 --- a/tests/priceBasedPerformancePackage/unit/burnPerformancePackage.test.ts +++ b/tests/priceBasedPerformancePackage/unit/burnPerformancePackage.test.ts @@ -5,8 +5,8 @@ import { SystemProgram, } from "@solana/web3.js"; import { assert } from "chai"; +import { getAccount, getMint } from "../../litesvm/index.js"; import BN from "bn.js"; -import { getAccount, getMint } from "spl-token-bankrun"; import { ACCOUNT_SIZE, AuthorityType, @@ -425,7 +425,7 @@ export default function () { // The SDK only builds the sweep as a pair, so the accounts are assembled by hand await this.priceBasedPerformancePackage.program.methods .burnPerformancePackage() - .accounts({ + .accountsPartial({ performancePackage, performancePackageTokenVault: vaultAddress(), recipient: recipient.publicKey, diff --git a/tests/priceBasedPerformancePackage/unit/initializePerformancePackage.test.ts b/tests/priceBasedPerformancePackage/unit/initializePerformancePackage.test.ts index a0dab3562..00b03b517 100644 --- a/tests/priceBasedPerformancePackage/unit/initializePerformancePackage.test.ts +++ b/tests/priceBasedPerformancePackage/unit/initializePerformancePackage.test.ts @@ -5,7 +5,7 @@ import { SystemProgram, } from "@solana/web3.js"; import { assert } from "chai"; -import { mintTo, getAccount } from "spl-token-bankrun"; +import { mintTo, getAccount } from "../../litesvm/index.js"; import BN from "bn.js"; import { getPerformancePackageAddr, diff --git a/tests/priceBasedPerformancePackage/unit/withdrawViaSell.test.ts b/tests/priceBasedPerformancePackage/unit/withdrawViaSell.test.ts index 413393e6d..2fdc53786 100644 --- a/tests/priceBasedPerformancePackage/unit/withdrawViaSell.test.ts +++ b/tests/priceBasedPerformancePackage/unit/withdrawViaSell.test.ts @@ -583,7 +583,7 @@ export default function () { "sold through a Dao on another token", ); await sellIx(this, 1, { oracle: otherDao }) - .accounts({ + .accountsPartial({ ammBaseVault: getAssociatedTokenAddressSync(otherMint, otherDao, true), }) .signers([recipient]) diff --git a/tests/utils.ts b/tests/utils.ts index 2b903281b..0eae718af 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -1,5 +1,5 @@ import { assert } from "chai"; -import { Clock, ProgramTestContext } from "solana-bankrun"; +import { Clock, ProgramTestContext } from "./litesvm/index.js"; import { BN } from "bn.js"; import { AddressLookupTableAccount, @@ -133,8 +133,11 @@ export async function makeOldDaoLayout( if (overrides.minBaseFutarchicLiquidity !== undefined) decoded.minBaseFutarchicLiquidity = overrides.minBaseFutarchicLiquidity; - // Encode as oldDao and truncate to the pre-migration size. - const body = await coder.encode("oldDao", decoded); + // Encode with the v0.6.1 layout, the last one before these fields were appended, and truncate. + const body = await ctx.futarchy.v0_6_1_futarchy.coder.accounts.encode( + "dao", + decoded, + ); const buf = Buffer.alloc(BEFORE); disc.copy(buf, 0); body.subarray(8).copy(buf, 8); diff --git a/yarn.lock b/yarn.lock index 7a0c3f06d..9b505e32f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,16 +2,48 @@ # yarn lockfile v1 -"@babel/runtime@^7.12.5": - version "7.29.7" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.29.7.tgz#12022450c45a4da6d8d8287b18a4ff2ddb23f768" - integrity sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw== +"@anchor-lang/borsh@^0.32.2": + version "0.32.2" + resolved "https://registry.yarnpkg.com/@anchor-lang/borsh/-/borsh-0.32.2.tgz#0bf4af2d3b2b7dbe2b296f1df49be8f1a7375c46" + integrity sha512-pjtaNcA+LgLri4M35LajTpR7J6zlbUl1tiaBIb0cAOkzChCd/QsAZ/HJJEVQHZ4TMtHerDKkkk26Gor8Hq9Ihw== + dependencies: + bn.js "^5.1.2" + buffer-layout "^1.2.0" + +"@anchor-lang/core@0.32.2": + version "0.32.2" + resolved "https://registry.yarnpkg.com/@anchor-lang/core/-/core-0.32.2.tgz#2e48dc05a05e89db942535965419d1830a45bd44" + integrity sha512-I1L83T3iEw2FKms/yVKHt2N/HMYyTBmqYNzMjVlZ+bvX2KCVYvH0o75TgddlVcVOA/hdY8WzHzG0xR0e6Ucpug== + dependencies: + "@anchor-lang/borsh" "^0.32.2" + "@anchor-lang/errors" "^0.32.2" + "@noble/hashes" "^1.3.1" + "@solana/web3.js" "1.99.0" + bn.js "^5.1.2" + bs58 "^4.0.1" + buffer-layout "^1.2.2" + camelcase "^6.3.0" + cross-fetch "^3.1.5" + eventemitter3 "^4.0.7" + pako "^2.0.3" + superstruct "^0.15.4" + toml "^3.0.0" + +"@anchor-lang/errors@^0.32.2": + version "0.32.2" + resolved "https://registry.yarnpkg.com/@anchor-lang/errors/-/errors-0.32.2.tgz#93b95a3d0c6118a428fe990b4b49bf31cc9e79c5" + integrity sha512-sa6bvOITFUfSJ0wOCQ2/7ye/SA9hUZCkU6TL6mN5hSxin7SM6omgIR0OTPd7NH0iP+rTYyIIHsIJbGXBnN4fDw== -"@babel/runtime@^7.17.2", "@babel/runtime@^7.25.0": +"@babel/runtime@^7.17.2": version "7.28.4" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.28.4.tgz#a70226016fabe25c5783b2f22d3e1c9bc5ca3326" integrity sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ== +"@babel/runtime@^7.29.7": + version "7.29.10" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.29.10.tgz#fe9920782f7ee34029165ac6f272984917a1641b" + integrity sha512-NpugTzbKgGrNe45Ui32cN8vCFFMxVtP/9rtfwv0nP5FRDAjvYBxJcLVpYA9mr1jxP6cnIT7x9LUzuDTbWYYNRA== + "@bundlr-network/client@^0.8.8": version "0.8.9" resolved "https://registry.yarnpkg.com/@bundlr-network/client/-/client-0.8.9.tgz#58e969a5d80f8d25d212d46bb7a060730a3c1736" @@ -37,57 +69,11 @@ near-api-js "^0.44.2" near-seed-phrase "^0.2.0" -"@coral-xyz/anchor-errors@^0.30.1": - version "0.30.1" - resolved "https://registry.yarnpkg.com/@coral-xyz/anchor-errors/-/anchor-errors-0.30.1.tgz#bdfd3a353131345244546876eb4afc0e125bec30" - integrity sha512-9Mkradf5yS5xiLWrl9WrpjqOrAV+/W2RQHDlbnAZBivoGpOs1ECjoDCkVk4aRG8ZdiFiB8zQEVlxf+8fKkmSfQ== - "@coral-xyz/anchor-errors@^0.31.1": version "0.31.1" resolved "https://registry.yarnpkg.com/@coral-xyz/anchor-errors/-/anchor-errors-0.31.1.tgz#d635cbac2533973ae6bfb5d3ba1de89ce5aece2d" integrity sha512-NhNEku4F3zzUSBtrYz84FzYWm48+9OvmT1Hhnwr6GnPQry2dsEqH/ti/7ASjjpoFTWRnPXrjAIT1qM6Isop+LQ== -"@coral-xyz/anchor@0.29.0": - version "0.29.0" - resolved "https://registry.yarnpkg.com/@coral-xyz/anchor/-/anchor-0.29.0.tgz#bd0be95bedfb30a381c3e676e5926124c310ff12" - integrity sha512-eny6QNG0WOwqV0zQ7cs/b1tIuzZGmP7U7EcH+ogt4Gdbl8HDmIYVMh/9aTmYZPaFWjtUaI8qSn73uYEXWfATdA== - dependencies: - "@coral-xyz/borsh" "^0.29.0" - "@noble/hashes" "^1.3.1" - "@solana/web3.js" "^1.68.0" - bn.js "^5.1.2" - bs58 "^4.0.1" - buffer-layout "^1.2.2" - camelcase "^6.3.0" - cross-fetch "^3.1.5" - crypto-hash "^1.3.0" - eventemitter3 "^4.0.7" - pako "^2.0.3" - snake-case "^3.0.4" - superstruct "^0.15.4" - toml "^3.0.0" - -"@coral-xyz/anchor@^0.30.0": - version "0.30.1" - resolved "https://registry.yarnpkg.com/@coral-xyz/anchor/-/anchor-0.30.1.tgz#17f3e9134c28cd0ea83574c6bab4e410bcecec5d" - integrity sha512-gDXFoF5oHgpriXAaLpxyWBHdCs8Awgf/gLHIo6crv7Aqm937CNdY+x+6hoj7QR5vaJV7MxWSQ0NGFzL3kPbWEQ== - dependencies: - "@coral-xyz/anchor-errors" "^0.30.1" - "@coral-xyz/borsh" "^0.30.1" - "@noble/hashes" "^1.3.1" - "@solana/web3.js" "^1.68.0" - bn.js "^5.1.2" - bs58 "^4.0.1" - buffer-layout "^1.2.2" - camelcase "^6.3.0" - cross-fetch "^3.1.5" - crypto-hash "^1.3.0" - eventemitter3 "^4.0.7" - pako "^2.0.3" - snake-case "^3.0.4" - superstruct "^0.15.4" - toml "^3.0.0" - "@coral-xyz/anchor@^0.31.0": version "0.31.1" resolved "https://registry.yarnpkg.com/@coral-xyz/anchor/-/anchor-0.31.1.tgz#0fdeebf45a3cb2e47e8ebbb815ca98542152962c" @@ -107,22 +93,6 @@ superstruct "^0.15.4" toml "^3.0.0" -"@coral-xyz/borsh@^0.29.0": - version "0.29.0" - resolved "https://registry.yarnpkg.com/@coral-xyz/borsh/-/borsh-0.29.0.tgz#79f7045df2ef66da8006d47f5399c7190363e71f" - integrity sha512-s7VFVa3a0oqpkuRloWVPdCK7hMbAMY270geZOGfCnaqexrP5dTIpbEHL33req6IYPPJ0hYa71cdvJ1h6V55/oQ== - dependencies: - bn.js "^5.1.2" - buffer-layout "^1.2.0" - -"@coral-xyz/borsh@^0.30.1": - version "0.30.1" - resolved "https://registry.yarnpkg.com/@coral-xyz/borsh/-/borsh-0.30.1.tgz#869d8833abe65685c72e9199b8688477a4f6b0e3" - integrity sha512-aaxswpPrCFKl8vZTbxLssA2RvwX2zmKLlRCIktJOwW+VpVwYtXRtlWiIP+c2pPRKneiTiWCN2GEMSH9j1zTlWQ== - dependencies: - bn.js "^5.1.2" - buffer-layout "^1.2.0" - "@coral-xyz/borsh@^0.31.1": version "0.31.1" resolved "https://registry.yarnpkg.com/@coral-xyz/borsh/-/borsh-0.31.1.tgz#5328e1e0921b75d7f4a62dd3f61885a938bc7241" @@ -701,11 +671,6 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/retry/-/retry-0.4.3.tgz#c2b9d2e374ee62c586d3adbea87199b1d7a7a6ba" integrity sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ== -"@iarna/toml@^2.2.5": - version "2.2.5" - resolved "https://registry.yarnpkg.com/@iarna/toml/-/toml-2.2.5.tgz#b32366c89b43c6f8cefbdefac778b9c828e3ba8c" - integrity sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg== - "@inquirer/ansi@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@inquirer/ansi/-/ansi-1.0.1.tgz#994f7dd16a00c547a7b110e04bf4f4eca1857929" @@ -1141,7 +1106,7 @@ decimal.js "^10.4.2" invariant "^2.2.4" -"@noble/curves@^1.0.0", "@noble/curves@^1.4.2": +"@noble/curves@^1.0.0", "@noble/curves@^1.9.7": version "1.9.7" resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.9.7.tgz#79d04b4758a43e4bca2cbdc62e7771352fa6b951" integrity sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw== @@ -1158,7 +1123,7 @@ 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.0", "@noble/hashes@^1.3.1", "@noble/hashes@^1.4.0": +"@noble/hashes@1.8.0", "@noble/hashes@^1.3.1", "@noble/hashes@^1.8.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== @@ -1201,6 +1166,48 @@ dependencies: "@randlabs/communication-bridge" "1.0.1" +"@solana-program/system@^0.14.0": + version "0.14.1" + resolved "https://registry.yarnpkg.com/@solana-program/system/-/system-0.14.1.tgz#9c035233cc55b4ca6e57bd8a1d0dd66043af4135" + integrity sha512-K6ZiIrAKoJAfcwfUdsoFvfSAxeRJaRrV7BPFTJvUVRS4m3zszN+nLcdaNMMe2F1/zTriZqC+xh+Kgw6ziGUqpQ== + +"@solana-program/token@^0.16.0": + version "0.16.1" + resolved "https://registry.yarnpkg.com/@solana-program/token/-/token-0.16.1.tgz#25be257eea197b1ce7db8b0e2764840096399c3b" + integrity sha512-X9dsvbh+VDq4SuCfvxn95P1DCvtBYHJOBiVmgBJMfW8l/lp8uSwEhy9IurpcdltnGi5kNIkCm4sk4YOXKAMiCw== + dependencies: + "@solana-program/system" "^0.14.0" + +"@solana/accounts@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/accounts/-/accounts-8.3.0.tgz#15b283c7bc7702934b1a5514e228267b0621b687" + integrity sha512-HNVCs4yyE5kTRHVD3ApuKuByuO85GHE6Ns7I/yMB9vXhFgZjGzFhOGi/YCjlWpIk3RqTyX7wGniHyEb49R3ELQ== + dependencies: + "@solana/addresses" "8.3.0" + "@solana/codecs-core" "8.3.0" + "@solana/codecs-strings" "8.3.0" + "@solana/errors" "8.3.0" + "@solana/rpc-spec" "8.3.0" + "@solana/rpc-types" "8.3.0" + +"@solana/addresses@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/addresses/-/addresses-8.3.0.tgz#55de3748be2483e38f26c6f7a53135d269c9ddde" + integrity sha512-HSAPbu5TpHYZqUo9SBALvDeOyfU1Cdtk9PCmxv+YjclNuDVbh+yMnesZ614zjhKJ8clvyidWSgmISjlFCJv6qA== + dependencies: + "@solana/assertions" "8.3.0" + "@solana/codecs-core" "8.3.0" + "@solana/codecs-strings" "8.3.0" + "@solana/errors" "8.3.0" + "@solana/nominal-types" "8.3.0" + +"@solana/assertions@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/assertions/-/assertions-8.3.0.tgz#3edae9b999374097a103ed0b32211ab5eec8f514" + integrity sha512-6NI79X6VANpq1b1BAnQevCs63dW4l3XKSbikVd5k8mlIsURlCTFdtrbXfQInqsUWZJWElf7ZLQu7RkbBOj6wuw== + dependencies: + "@solana/errors" "8.3.0" + "@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" @@ -1225,12 +1232,19 @@ dependencies: "@solana/errors" "2.0.0-rc.1" -"@solana/codecs-core@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/codecs-core/-/codecs-core-2.3.0.tgz#6bf2bb565cb1ae880f8018635c92f751465d8695" - integrity sha512-oG+VZzN6YhBHIoSKgS5ESM9VIGzhWjEHEGNPSibiDTxFhsFWxNaz8LbMDPjBUE69r9wmdGLkrQ+wVPbnJcZPvw== +"@solana/codecs-core@5.5.1": + version "5.5.1" + resolved "https://registry.yarnpkg.com/@solana/codecs-core/-/codecs-core-5.5.1.tgz#1b2619c697ad04c99f98cc468135d584b7e2b16d" + integrity sha512-TgBt//bbKBct0t6/MpA8ElaOA3sa8eYVvR7LGslCZ84WiAwwjCY0lW/lOYsFHJQzwREMdUyuEyy5YWBKtdh8Rw== + dependencies: + "@solana/errors" "5.5.1" + +"@solana/codecs-core@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/codecs-core/-/codecs-core-8.3.0.tgz#d07e63a6a861b4023df83457afcf682c26b63319" + integrity sha512-rpt01CPeF4FhTTJHyr0Tr4n8U1shYPhe7q2mcmTYyKPATYAkyb5CLHnYKnN6LO71EZSFq3Y2Wm27rwWcBvAJzg== dependencies: - "@solana/errors" "2.3.0" + "@solana/errors" "8.3.0" "@solana/codecs-data-structures@2.0.0-rc.1": version "2.0.0-rc.1" @@ -1241,6 +1255,15 @@ "@solana/codecs-numbers" "2.0.0-rc.1" "@solana/errors" "2.0.0-rc.1" +"@solana/codecs-data-structures@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/codecs-data-structures/-/codecs-data-structures-8.3.0.tgz#e644ef57c85b9363e02175be55e3289743a61965" + integrity sha512-ojwHBnDia6VtkoCzppJGXJ1JZkQ4teYToTRu0e4N5dEkZlFU5EmpeX+1xsw7gu4bR9cNXXMWbWw4uFgVM8Nd6Q== + dependencies: + "@solana/codecs-core" "8.3.0" + "@solana/codecs-numbers" "8.3.0" + "@solana/errors" "8.3.0" + "@solana/codecs-numbers@2.0.0-rc.1": version "2.0.0-rc.1" resolved "https://registry.yarnpkg.com/@solana/codecs-numbers/-/codecs-numbers-2.0.0-rc.1.tgz#f34978ddf7ea4016af3aaed5f7577c1d9869a614" @@ -1249,13 +1272,21 @@ "@solana/codecs-core" "2.0.0-rc.1" "@solana/errors" "2.0.0-rc.1" -"@solana/codecs-numbers@^2.1.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/codecs-numbers/-/codecs-numbers-2.3.0.tgz#ac7e7f38aaf7fcd22ce2061fbdcd625e73828dc6" - integrity sha512-jFvvwKJKffvG7Iz9dmN51OGB7JBcy2CJ6Xf3NqD/VP90xak66m/Lg48T01u5IQ/hc15mChVHiBm+HHuOFDUrQg== +"@solana/codecs-numbers@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/codecs-numbers/-/codecs-numbers-8.3.0.tgz#8f5e07340466ebc238b19749af2655fe6cd11c02" + integrity sha512-12u+Y9ERE+gqraV1g0BP/5QxbamukFub05kyj3d3s6V/26ZEby6ReHJ8yuKtPl9fIUnfoQ2M4+th/7u5+5v14w== + dependencies: + "@solana/codecs-core" "8.3.0" + "@solana/errors" "8.3.0" + +"@solana/codecs-numbers@^5.5.1": + version "5.5.1" + resolved "https://registry.yarnpkg.com/@solana/codecs-numbers/-/codecs-numbers-5.5.1.tgz#6ebc43250133ceb7836f1ac5780a7767e383efde" + integrity sha512-rllMIZAHqmtvC0HO/dc/21wDuWaD0B8Ryv8o+YtsICQBuiL/0U4AGwH7Pi5GNFySYk0/crSuwfIqQFtmxNSPFw== dependencies: - "@solana/codecs-core" "2.3.0" - "@solana/errors" "2.3.0" + "@solana/codecs-core" "5.5.1" + "@solana/errors" "5.5.1" "@solana/codecs-strings@2.0.0-rc.1": version "2.0.0-rc.1" @@ -1266,6 +1297,15 @@ "@solana/codecs-numbers" "2.0.0-rc.1" "@solana/errors" "2.0.0-rc.1" +"@solana/codecs-strings@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/codecs-strings/-/codecs-strings-8.3.0.tgz#23b72b90256bb99e85a22b4416429b2943ee595a" + integrity sha512-S7rZrc1B90AS0QVRlo6+6cX2t+0TGtsadsPWdfA7tXcaDKQfQn4C/6OJxJ7/n8ugw8LMgGC+Xcs81ii4nIp6aQ== + dependencies: + "@solana/codecs-core" "8.3.0" + "@solana/codecs-numbers" "8.3.0" + "@solana/errors" "8.3.0" + "@solana/codecs@2.0.0-rc.1": version "2.0.0-rc.1" resolved "https://registry.yarnpkg.com/@solana/codecs/-/codecs-2.0.0-rc.1.tgz#146dc5db58bd3c28e04b4c805e6096c2d2a0a875" @@ -1277,6 +1317,18 @@ "@solana/codecs-strings" "2.0.0-rc.1" "@solana/options" "2.0.0-rc.1" +"@solana/codecs@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/codecs/-/codecs-8.3.0.tgz#94995059e1d43a69520901c228289df2521a52ea" + integrity sha512-BtiHdl7pDw6tadQAn3Vi1s0wgp0BGQ3ndTQRBtxuwmyCzlGfyuvMBq+ynkuGWwknvOpU2eTNEO84U/b7wqLB7w== + dependencies: + "@solana/codecs-core" "8.3.0" + "@solana/codecs-data-structures" "8.3.0" + "@solana/codecs-numbers" "8.3.0" + "@solana/codecs-strings" "8.3.0" + "@solana/fixed-points" "8.3.0" + "@solana/options" "8.3.0" + "@solana/errors@2.0.0-rc.1": version "2.0.0-rc.1" resolved "https://registry.yarnpkg.com/@solana/errors/-/errors-2.0.0-rc.1.tgz#3882120886eab98a37a595b85f81558861b29d62" @@ -1285,13 +1337,123 @@ chalk "^5.3.0" commander "^12.1.0" -"@solana/errors@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@solana/errors/-/errors-2.3.0.tgz#4ac9380343dbeffb9dffbcb77c28d0e457c5fa31" - integrity sha512-66RI9MAbwYV0UtP7kGcTBVLxJgUxoZGm8Fbc0ah+lGiAw17Gugco6+9GrJCV83VyF2mDWyYnYM9qdI3yjgpnaQ== +"@solana/errors@5.5.1": + version "5.5.1" + resolved "https://registry.yarnpkg.com/@solana/errors/-/errors-5.5.1.tgz#1c17bc822264fd5a6305d8bfb9d597858e4ce17b" + integrity sha512-vFO3p+S7HoyyrcAectnXbdsMfwUzY2zYFUc2DEe5BwpiE9J1IAxPBGjOWO6hL1bbYdBrlmjNx8DXCslqS+Kcmg== + dependencies: + chalk "5.6.2" + commander "14.0.2" + +"@solana/errors@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/errors/-/errors-8.3.0.tgz#0a3804c4d03c47a1afb5335f3a97929791116f82" + integrity sha512-XsoQ5ThBOwfMz1KS7I2zZoduLxUYFe+NHuRAm/gt+uk44nnXqwzNJHo/9GEMqJqxafViqvfRZ35GF1fDkwW32Q== + dependencies: + chalk "5.6.2" + commander "15.0.0" + +"@solana/fast-stable-stringify@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/fast-stable-stringify/-/fast-stable-stringify-8.3.0.tgz#479489d983cdf200ebb656885b3c5b668665279b" + integrity sha512-QVVSFQPLJaFeUFekWHe04TUr5rL2QbgPCEK0HcmlOLgCWTvduwj1D9e73jjYzL5HU1QRyUfzkw+GnSw95nvjLg== + +"@solana/fixed-points@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/fixed-points/-/fixed-points-8.3.0.tgz#53213b0d6fe79a466d48d96a52b607ed615c1e4b" + integrity sha512-cah+OuTSXqSMRlTQdj3sQmf7RK1m2RG50RzSgLFWeAAl+WCsoR4pyGPFxhQMw9JdaniqOUkKKB3ppxTMgfoHEg== + dependencies: + "@solana/codecs-core" "8.3.0" + "@solana/errors" "8.3.0" + +"@solana/functional@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/functional/-/functional-8.3.0.tgz#e4ac97bf4ef63f3252b60a2aa8610041e0a0bcba" + integrity sha512-HBtC8tA8q73JQYHFaNROGiBLcwPcbQHldN7f1NqCgYY9x/iIt/zvWPeoxiRkncYCE9MwDLyWMq3LnetjqOifOA== + +"@solana/instruction-plans@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/instruction-plans/-/instruction-plans-8.3.0.tgz#8e5637afc23e2d860096d4c55d4833381d06ec07" + integrity sha512-ltuS+fTWsNQokFxK8StQzn/ZDkrR/P4Pao5EpQxYHPQQ+Z83g61kWFEnR+bB9WBDUZwu2CJptNXItKSgGOWwmg== dependencies: - chalk "^5.4.1" - commander "^14.0.0" + "@solana/errors" "8.3.0" + "@solana/instructions" "8.3.0" + "@solana/keys" "8.3.0" + "@solana/promises" "8.3.0" + "@solana/transaction-messages" "8.3.0" + "@solana/transactions" "8.3.0" + +"@solana/instructions@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/instructions/-/instructions-8.3.0.tgz#ecb3f9288837952a765961a25f6ce3d4bfcbc98f" + integrity sha512-piAAqqC5NEvN2Mf2FP6PWogl8qCVg/2cEt+LKyq89P0sNbaeMPK11wGcZR6e3LEBMBSnjAw4DbDerDWg6GC0eg== + dependencies: + "@solana/codecs-core" "8.3.0" + "@solana/errors" "8.3.0" + +"@solana/keys@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/keys/-/keys-8.3.0.tgz#11e982cdad01a534dedd7c821dff7afacdda8e47" + integrity sha512-Fs8rtmxliPlDu/6iJniU4FfvUfD63OSxIAbMv2CyNvK9fg7dmQ9fUEBuK3WpwAlpKwhEHCzaFSWNUaB2SmeviQ== + dependencies: + "@solana/assertions" "8.3.0" + "@solana/codecs-core" "8.3.0" + "@solana/codecs-strings" "8.3.0" + "@solana/errors" "8.3.0" + "@solana/nominal-types" "8.3.0" + "@solana/promises" "8.3.0" + +"@solana/kit@8.3.0", "@solana/kit@^8.0.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/kit/-/kit-8.3.0.tgz#d7ff2aba816abd17333db5b9e1118bae98b2cf8f" + integrity sha512-2T2QaO+0/CeZnPMsjv/bGhBSEiBCMY6V/Qi0xhFF/+8yCH8tkzM/kgE7fX5JlrR3gZpl9Bu+C62KTqnvk/bcjw== + dependencies: + "@solana/accounts" "8.3.0" + "@solana/addresses" "8.3.0" + "@solana/codecs" "8.3.0" + "@solana/errors" "8.3.0" + "@solana/functional" "8.3.0" + "@solana/instruction-plans" "8.3.0" + "@solana/instructions" "8.3.0" + "@solana/keys" "8.3.0" + "@solana/offchain-messages" "8.3.0" + "@solana/plugin-core" "8.3.0" + "@solana/plugin-interfaces" "8.3.0" + "@solana/program-client-core" "8.3.0" + "@solana/programs" "8.3.0" + "@solana/promises" "8.3.0" + "@solana/rpc" "8.3.0" + "@solana/rpc-api" "8.3.0" + "@solana/rpc-parsed-types" "8.3.0" + "@solana/rpc-spec-types" "8.3.0" + "@solana/rpc-subscriptions" "8.3.0" + "@solana/rpc-types" "8.3.0" + "@solana/signers" "8.3.0" + "@solana/subscribable" "8.3.0" + "@solana/sysvars" "8.3.0" + "@solana/transaction-confirmation" "8.3.0" + "@solana/transaction-introspection" "8.3.0" + "@solana/transaction-messages" "8.3.0" + "@solana/transactions" "8.3.0" + +"@solana/nominal-types@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/nominal-types/-/nominal-types-8.3.0.tgz#229cf290329b0d696eca437fcc8985b8818a4b6c" + integrity sha512-x2aCcMwe6C2tQNq4pAhx4bEd2zhrm3i7DjkdAJAPVCtPKd6ecO6iaV+53/RvE2ImZ0E9aVB41lPV8ZM0dMhRiw== + +"@solana/offchain-messages@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/offchain-messages/-/offchain-messages-8.3.0.tgz#2b5335aa8921856505356a97791aef18af370479" + integrity sha512-zpwwQRTX+aBF97fgZW+T+grZWqKbCMa6moDnYHsCkQg67nCeb9OrPtZxMbCT5bP+kDgMTq2URQwS1NcZOwut+Q== + dependencies: + "@solana/addresses" "8.3.0" + "@solana/codecs-core" "8.3.0" + "@solana/codecs-data-structures" "8.3.0" + "@solana/codecs-numbers" "8.3.0" + "@solana/codecs-strings" "8.3.0" + "@solana/errors" "8.3.0" + "@solana/keys" "8.3.0" + "@solana/nominal-types" "8.3.0" "@solana/options@2.0.0-rc.1": version "2.0.0-rc.1" @@ -1304,6 +1466,218 @@ "@solana/codecs-strings" "2.0.0-rc.1" "@solana/errors" "2.0.0-rc.1" +"@solana/options@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/options/-/options-8.3.0.tgz#eed66f4c7633430fe7f43599f485d259c5d08886" + integrity sha512-+mi+EvxdjlOxt3dv7wTfzGxVFw0j8flZ8gGSXCx969JrML9EZd3+wgsKuMNb3whbvGa/N5exPZXfzsG+wNlK8A== + dependencies: + "@solana/codecs-core" "8.3.0" + "@solana/codecs-data-structures" "8.3.0" + "@solana/codecs-numbers" "8.3.0" + "@solana/codecs-strings" "8.3.0" + "@solana/errors" "8.3.0" + +"@solana/plugin-core@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/plugin-core/-/plugin-core-8.3.0.tgz#3a1848be9b4943eaf4cb78d41c72398dc647fb0c" + integrity sha512-cU5S9QR7C1Xsn9DDRSLN7Vq8+kWy6Fw6g2lwa+9yZqdSqABhmdH5HBJG/Zl8HULz2Ady0y8qHcu8fEZsehuU0g== + +"@solana/plugin-interfaces@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/plugin-interfaces/-/plugin-interfaces-8.3.0.tgz#16ae4a039fbeccc5d187e249553c1eba72323775" + integrity sha512-EawuCQiW5A13qdArRODYbAsAvi9fRkORk1hq14kbRAR0A/7XwQLniAWrgKY4WZ1UXuECB/LxKc8uQwfH5u1JOw== + dependencies: + "@solana/accounts" "8.3.0" + "@solana/addresses" "8.3.0" + "@solana/instruction-plans" "8.3.0" + "@solana/keys" "8.3.0" + "@solana/rpc-spec" "8.3.0" + "@solana/rpc-subscriptions-spec" "8.3.0" + "@solana/rpc-types" "8.3.0" + "@solana/signers" "8.3.0" + "@solana/transactions" "8.3.0" + +"@solana/program-client-core@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/program-client-core/-/program-client-core-8.3.0.tgz#7367650dc7acf12d6fc4860115853fd8e4821ab0" + integrity sha512-GUFVAFaEgVvznI6mrfa69I0SVnO5mD5RpYKdSEHvGnIMzupgjZhTcmhSxMIU06hFA2ZLF+NbKsOKMQFVicOCjw== + dependencies: + "@solana/accounts" "8.3.0" + "@solana/addresses" "8.3.0" + "@solana/codecs-core" "8.3.0" + "@solana/errors" "8.3.0" + "@solana/instruction-plans" "8.3.0" + "@solana/instructions" "8.3.0" + "@solana/plugin-interfaces" "8.3.0" + "@solana/rpc-api" "8.3.0" + "@solana/signers" "8.3.0" + +"@solana/programs@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/programs/-/programs-8.3.0.tgz#d0b87ef1d8f5b6bd156a1753738f591f4cd60acc" + integrity sha512-XosDh9GNaDUCvzpFE2e3M7iQ6tounwrhR16+KInjYNcvQDLgA5yeCbNfByai7OSz9iqEi5nlXjQFIQCckLANVw== + dependencies: + "@solana/addresses" "8.3.0" + "@solana/errors" "8.3.0" + +"@solana/promises@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/promises/-/promises-8.3.0.tgz#29477997ffede9665462da8aa773ea15a3f8df4e" + integrity sha512-RekTh1UzvyD1EtF4hjenJDrnpGakJwTCE7cq6auQKtBxQUIJrKwDxmpyiJTJ00wvQYdMfMuyJEPQNuxgm6mxrg== + +"@solana/rpc-api@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/rpc-api/-/rpc-api-8.3.0.tgz#be1fd6dee97b118c1ba0b9097d1775d4582ce808" + integrity sha512-8wvVbQLbp8Mjd0Vcg2IZqkNreSGkgOPe4IhCrO2GqJQyTNAI8Ir6o/Qt3zIj02IQS9LDL9rZPvynL+1PFPSlOA== + dependencies: + "@solana/addresses" "8.3.0" + "@solana/codecs-core" "8.3.0" + "@solana/codecs-strings" "8.3.0" + "@solana/errors" "8.3.0" + "@solana/keys" "8.3.0" + "@solana/rpc-parsed-types" "8.3.0" + "@solana/rpc-spec" "8.3.0" + "@solana/rpc-transformers" "8.3.0" + "@solana/rpc-types" "8.3.0" + "@solana/transaction-messages" "8.3.0" + "@solana/transactions" "8.3.0" + +"@solana/rpc-parsed-types@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/rpc-parsed-types/-/rpc-parsed-types-8.3.0.tgz#e5552d2f37695ba4d7cad61b4263c1fa8b0b817a" + integrity sha512-cK0Yu7I8HADKYQdlyIuCFd2sq1sCrIm7q0H9nqeS7b5ILLYoH9T3AnCZ437N7Z4jZBekL2DGdpdE2M84F0fphQ== + +"@solana/rpc-spec-types@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/rpc-spec-types/-/rpc-spec-types-8.3.0.tgz#5ea116d3de36438123263026ae56e16baea33821" + integrity sha512-D757241XGKwmBRlQ1xSGknBqRaXq8ZO0BDl5UupG0UyHsfdk6iKDrJFccaNx1m2LKExzlu8iWZTEdnrueDDL7A== + dependencies: + "@solana/errors" "8.3.0" + +"@solana/rpc-spec@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/rpc-spec/-/rpc-spec-8.3.0.tgz#81dc2fdd9fe43d4c685fcddbcc3638d8b4c06cff" + integrity sha512-HWMQsAUsW8LOkojFopkkkTSIFAFeYDA6B4NiXtXZ8q5qKRKDB+qCVTC1un8RorKrnayLM7gF73Oi5gPD2ANL/w== + dependencies: + "@solana/errors" "8.3.0" + "@solana/rpc-spec-types" "8.3.0" + "@solana/subscribable" "8.3.0" + +"@solana/rpc-subscriptions-api@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/rpc-subscriptions-api/-/rpc-subscriptions-api-8.3.0.tgz#42fce31d9b5e81a4a4db428960c9d06318aeaf8e" + integrity sha512-NHjPuylayZHuBNXPkMT0sMHGUKAenck+P9Iep1ZzfH0py9SJcKOU8LHecSdGl7GjHk0SCs+iCBew+89JYrcTaA== + dependencies: + "@solana/addresses" "8.3.0" + "@solana/keys" "8.3.0" + "@solana/rpc-subscriptions-spec" "8.3.0" + "@solana/rpc-transformers" "8.3.0" + "@solana/rpc-types" "8.3.0" + "@solana/transaction-messages" "8.3.0" + "@solana/transactions" "8.3.0" + +"@solana/rpc-subscriptions-channel-websocket@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/rpc-subscriptions-channel-websocket/-/rpc-subscriptions-channel-websocket-8.3.0.tgz#f75c154b1b5397eb49893e4349c63aa81c4b9bfe" + integrity sha512-4Ix52idqRT3q0Ty5sr9lUj/S8Flf+/8q7NMuAxYNH827C71AO6vVpkpAY1YpU53MKnKy0Tox0mLLScocftgEJQ== + dependencies: + "@solana/errors" "8.3.0" + "@solana/functional" "8.3.0" + "@solana/rpc-subscriptions-spec" "8.3.0" + "@solana/subscribable" "8.3.0" + ws "^8.21.3" + +"@solana/rpc-subscriptions-spec@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/rpc-subscriptions-spec/-/rpc-subscriptions-spec-8.3.0.tgz#e7067f5236082ba9aa14323e7894ec03a632cd7e" + integrity sha512-iv6f4N7Pva3KGljkT4kEBsMDjWVHShtysuPOko8doLBSKuelOj+b+79iYpezeu6hpbZ0YxBvlmJkOtUyeIhRJA== + dependencies: + "@solana/errors" "8.3.0" + "@solana/promises" "8.3.0" + "@solana/rpc-spec-types" "8.3.0" + "@solana/subscribable" "8.3.0" + +"@solana/rpc-subscriptions@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/rpc-subscriptions/-/rpc-subscriptions-8.3.0.tgz#04f4a3e308210452114a4ded2bcf92071c53cfe2" + integrity sha512-/oI9aXKOTFnIoZ+wmvZeNfSu5h8Vl90a4W6U/K8OZE2AKjK1dbKI4bR1k7P/3SORY9Z0AN2S9UsohQ6Z6n9jKA== + dependencies: + "@solana/errors" "8.3.0" + "@solana/fast-stable-stringify" "8.3.0" + "@solana/functional" "8.3.0" + "@solana/promises" "8.3.0" + "@solana/rpc-spec-types" "8.3.0" + "@solana/rpc-subscriptions-api" "8.3.0" + "@solana/rpc-subscriptions-channel-websocket" "8.3.0" + "@solana/rpc-subscriptions-spec" "8.3.0" + "@solana/rpc-transformers" "8.3.0" + "@solana/rpc-types" "8.3.0" + "@solana/subscribable" "8.3.0" + +"@solana/rpc-transformers@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/rpc-transformers/-/rpc-transformers-8.3.0.tgz#82e25b310b1d8f2cc0b4d79c2f82c3ac8afd5f32" + integrity sha512-eDn1PwS+MbMAJN4ZSWzMYGt0jEwvyaZJwDeQdOdWYEkqKJKlLsO1AAxLmz3LW3R/iKyWa4KwjrJ5Ia9oAugS6g== + dependencies: + "@solana/errors" "8.3.0" + "@solana/functional" "8.3.0" + "@solana/nominal-types" "8.3.0" + "@solana/rpc-spec-types" "8.3.0" + "@solana/rpc-types" "8.3.0" + +"@solana/rpc-transport-http@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/rpc-transport-http/-/rpc-transport-http-8.3.0.tgz#4fd3e56b3135f7d6b996df6a3e22115cbc97429f" + integrity sha512-XD3Bo5KZekQhrReoF6UzFW66NUYqa4Rg1wBjFEIsC/sABhLJ+062O1GPS3HY9AcxZBW48rAmfNe1Qqkerxajzw== + dependencies: + "@solana/errors" "8.3.0" + "@solana/rpc-spec" "8.3.0" + "@solana/rpc-spec-types" "8.3.0" + undici-types "^8.10.2" + +"@solana/rpc-types@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/rpc-types/-/rpc-types-8.3.0.tgz#f279c277f5e44685847bc77409ea45dcd6ad44dd" + integrity sha512-T8DlDU5hu/pspKNWriwkJHXqzb7B6EQVVC6sgciZp78VB9R413+K6QhC7jZc96mNcoaATKRRg2tDDyiezKZVIg== + dependencies: + "@solana/addresses" "8.3.0" + "@solana/codecs-core" "8.3.0" + "@solana/codecs-numbers" "8.3.0" + "@solana/codecs-strings" "8.3.0" + "@solana/errors" "8.3.0" + "@solana/fixed-points" "8.3.0" + "@solana/nominal-types" "8.3.0" + +"@solana/rpc@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/rpc/-/rpc-8.3.0.tgz#6b74b729b285ca6cadfef9f9d0e8def27386abe2" + integrity sha512-giS/v09dby/VD77uDfNrhr5fLi5K5NIOp3jIFfKpdAnfPHgKLv050xdmL9ZltrWucrGuePinzUTLWkdkf4s/cw== + dependencies: + "@solana/errors" "8.3.0" + "@solana/fast-stable-stringify" "8.3.0" + "@solana/functional" "8.3.0" + "@solana/rpc-api" "8.3.0" + "@solana/rpc-spec" "8.3.0" + "@solana/rpc-spec-types" "8.3.0" + "@solana/rpc-transformers" "8.3.0" + "@solana/rpc-transport-http" "8.3.0" + "@solana/rpc-types" "8.3.0" + +"@solana/signers@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/signers/-/signers-8.3.0.tgz#49f842ce9eac9d4f2ce2e1c8c33af82fb0c06e8e" + integrity sha512-uNiJZV6npLBQ0jYsK5fmtemZ0igQ4HW9QR9t5qSxbxRa52yZjzX7zkSpFhQJsxvBCAUR2ppVmhanDeupPXf4Mw== + dependencies: + "@solana/addresses" "8.3.0" + "@solana/codecs-core" "8.3.0" + "@solana/errors" "8.3.0" + "@solana/instructions" "8.3.0" + "@solana/keys" "8.3.0" + "@solana/nominal-types" "8.3.0" + "@solana/offchain-messages" "8.3.0" + "@solana/transaction-messages" "8.3.0" + "@solana/transactions" "8.3.0" + "@solana/spl-memo@0.2.5": version "0.2.5" resolved "https://registry.yarnpkg.com/@solana/spl-memo/-/spl-memo-0.2.5.tgz#a7828cdd1e810ff77c7c015ac97dfa166d0651fe" @@ -1332,7 +1706,7 @@ dependencies: cross-fetch "3.0.6" -"@solana/spl-token@0.3.11", "@solana/spl-token@^0.3.6", "@solana/spl-token@^0.3.8": +"@solana/spl-token@0.3.11", "@solana/spl-token@^0.3.6": version "0.3.11" resolved "https://registry.yarnpkg.com/@solana/spl-token/-/spl-token-0.3.11.tgz#cdc10f9472b29b39c8983c92592cadd06627fb9a" integrity sha512-bvohO3rIMSVL24Pb+I4EYTJ6cL82eFpInEXD/I8K8upOGjpqHsKUoAempR/RnUlI1qSFNyFlWJfu6MNUgfbCQQ== @@ -1353,6 +1727,89 @@ "@solana/spl-token-metadata" "^0.1.6" buffer "^6.0.3" +"@solana/subscribable@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/subscribable/-/subscribable-8.3.0.tgz#3f26cbabe98679d49b02fa77d06828007a1950bf" + integrity sha512-tLoGNOt19oUTxIoOaBxQRNxKJET/IXBx1NZkGD1lh4X8iNc6V0lY3MMIWjNvRivFIpzeWtWYxX/tAb27xpmcXg== + dependencies: + "@solana/errors" "8.3.0" + "@solana/promises" "8.3.0" + +"@solana/sysvars@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/sysvars/-/sysvars-8.3.0.tgz#823588d73a37918a6daff2f17c08ab3d080a487b" + integrity sha512-SXnKqpV4pj3vLvcyBn8+jeVouu4Bbk0PTmHMknsig6edWcpmvAXkufcRdxgVy5t58pdSf1+GlJGEEhP5NR/0xA== + dependencies: + "@solana/accounts" "8.3.0" + "@solana/codecs-core" "8.3.0" + "@solana/codecs-data-structures" "8.3.0" + "@solana/codecs-numbers" "8.3.0" + "@solana/errors" "8.3.0" + "@solana/rpc-types" "8.3.0" + +"@solana/transaction-confirmation@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/transaction-confirmation/-/transaction-confirmation-8.3.0.tgz#e7ec5c2e5b47df1d43411e8fd1f70b3e36daf336" + integrity sha512-xx4sO4+0nP84SvxPPmHFKkUyBEQDFC2Vn8eqV8qEG3yo0ruHlZ45g0IeYhz9WS20WPgkXvGB5bVU8Y3yv/4vPw== + dependencies: + "@solana/addresses" "8.3.0" + "@solana/codecs-strings" "8.3.0" + "@solana/errors" "8.3.0" + "@solana/keys" "8.3.0" + "@solana/promises" "8.3.0" + "@solana/rpc" "8.3.0" + "@solana/rpc-subscriptions" "8.3.0" + "@solana/rpc-types" "8.3.0" + "@solana/transaction-messages" "8.3.0" + "@solana/transactions" "8.3.0" + +"@solana/transaction-introspection@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/transaction-introspection/-/transaction-introspection-8.3.0.tgz#64d2f56db9052f7768fcce47658e3ebacda537c8" + integrity sha512-uuPNYLhgueMG1ZxWH+SqPHiyz7KM0vFUDPCVRQUVTTWFryWDeu6GExfy+mFMPRR25cp+hWYmYhddub8BU2sPXQ== + dependencies: + "@solana/addresses" "8.3.0" + "@solana/codecs-core" "8.3.0" + "@solana/codecs-strings" "8.3.0" + "@solana/errors" "8.3.0" + "@solana/instructions" "8.3.0" + "@solana/rpc-types" "8.3.0" + "@solana/transaction-messages" "8.3.0" + "@solana/transactions" "8.3.0" + +"@solana/transaction-messages@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/transaction-messages/-/transaction-messages-8.3.0.tgz#7a7070c08bfd731545256013e4a4832931ed545b" + integrity sha512-AkgHRPOnwonB7n81rTwnZ9WFlagnhzDzXKGhETdffzC+A1GifXC2s/ou0/qNozuqlgPVDaBR02S/A3Vt1tYr/g== + dependencies: + "@solana/addresses" "8.3.0" + "@solana/codecs-core" "8.3.0" + "@solana/codecs-data-structures" "8.3.0" + "@solana/codecs-numbers" "8.3.0" + "@solana/errors" "8.3.0" + "@solana/functional" "8.3.0" + "@solana/instructions" "8.3.0" + "@solana/nominal-types" "8.3.0" + "@solana/rpc-types" "8.3.0" + +"@solana/transactions@8.3.0": + version "8.3.0" + resolved "https://registry.yarnpkg.com/@solana/transactions/-/transactions-8.3.0.tgz#dec35b03e3f0a26d7b1066c914c255ab1e9f4e2c" + integrity sha512-zNCHu2W3t6r4W3rsCA5vZ93bGqcZPNgfgYjTamRC6xTZPP2qn5JR+bSR9/WBMpi8GwLzWYuDk6YtNp3+pYGKuQ== + dependencies: + "@solana/addresses" "8.3.0" + "@solana/codecs-core" "8.3.0" + "@solana/codecs-data-structures" "8.3.0" + "@solana/codecs-numbers" "8.3.0" + "@solana/codecs-strings" "8.3.0" + "@solana/errors" "8.3.0" + "@solana/functional" "8.3.0" + "@solana/instructions" "8.3.0" + "@solana/keys" "8.3.0" + "@solana/nominal-types" "8.3.0" + "@solana/rpc-types" "8.3.0" + "@solana/transaction-messages" "8.3.0" + "@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" @@ -1371,44 +1828,23 @@ "@wallet-standard/base" "^1.1.0" "@wallet-standard/features" "^1.1.0" -"@solana/web3.js@1.76.0": - version "1.76.0" - resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.76.0.tgz#0f888e25d727d0dadf3dd8a01967347555200b2b" - integrity sha512-aJtF/nTs+9St+KtTK/wgVJ+SinfjYzn+3w1ygYIPw8ST6LH+qHBn8XkodgDTwlv/xzNkaVz1kkUDOZ8BPXyZWA== +"@solana/web3.js@1.99.0", "@solana/web3.js@^1.32.0", "@solana/web3.js@^1.36.0", "@solana/web3.js@^1.56.2", "@solana/web3.js@^1.69.0", "@solana/web3.js@^1.70.3", "@solana/web3.js@^1.95.3": + version "1.99.0" + resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.99.0.tgz#864ce3fefe03b258c430e31e6672b422426821f7" + integrity sha512-QZYQ2T1z6xWisoyALPq25i/QZTsRlM02BABtAsfaQ1p8wX4SdTfxrKTRue/ZZqrhNVh5oL7T/DUFiTS9DRgxow== dependencies: - "@babel/runtime" "^7.12.5" - "@noble/curves" "^1.0.0" - "@noble/hashes" "^1.3.0" - "@solana/buffer-layout" "^4.0.0" - agentkeepalive "^4.2.1" - bigint-buffer "^1.1.5" - bn.js "^5.0.0" - borsh "^0.7.0" - bs58 "^4.0.1" - buffer "6.0.3" - fast-stable-stringify "^1.0.0" - jayson "^3.4.4" - node-fetch "^2.6.7" - rpc-websockets "^7.5.1" - superstruct "^0.14.2" - -"@solana/web3.js@1.98.4", "@solana/web3.js@>1.92.0, <2.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.69.0", "@solana/web3.js@^1.70.3", "@solana/web3.js@^1.95.3", "@solana/web3.js@^1.98.4": - version "1.98.4" - resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.98.4.tgz#df51d78be9d865181ec5138b4e699d48e6895bbe" - integrity sha512-vv9lfnvjUsRiq//+j5pBdXig0IQdtzA0BRZ3bXEP4KaIyF1CcaydWqgyzQgfZMNIsWNWmG+AUHwPy4AHOD6gpw== - dependencies: - "@babel/runtime" "^7.25.0" - "@noble/curves" "^1.4.2" - "@noble/hashes" "^1.4.0" + "@babel/runtime" "^7.29.7" + "@noble/curves" "^1.9.7" + "@noble/hashes" "^1.8.0" "@solana/buffer-layout" "^4.0.1" - "@solana/codecs-numbers" "^2.1.0" - agentkeepalive "^4.5.0" - bn.js "^5.2.1" + "@solana/codecs-numbers" "^5.5.1" + agentkeepalive "^4.6.0" + bn.js "^5.2.5" borsh "^0.7.0" bs58 "^4.0.1" buffer "6.0.3" fast-stable-stringify "^1.0.0" - jayson "^4.1.1" + jayson "^4.3.0" node-fetch "^2.7.0" rpc-websockets "^9.0.2" superstruct "^2.0.2" @@ -1527,6 +1963,13 @@ dependencies: undici-types "~6.21.0" +"@types/node@25.0.3": + version "25.0.3" + resolved "https://registry.yarnpkg.com/@types/node/-/node-25.0.3.tgz#79b9ac8318f373fbfaaf6e2784893efa9701f269" + integrity sha512-W609buLVRVmeW693xKfzHeIV6nJGGz98uCPfeXI1ELMLXVeKYZ9m15fAMSaUPBHYLGFsVRcMmSCksQOrZV9BYA== + dependencies: + undici-types "~7.16.0" + "@types/node@^12.12.54": version "12.20.55" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240" @@ -1678,14 +2121,6 @@ dependencies: "@wallet-standard/base" "^1.1.0" -JSONStream@^1.3.5: - version "1.3.5" - resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" - integrity sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ== - dependencies: - jsonparse "^1.2.0" - through ">=2.2.7 <3" - acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" @@ -1708,7 +2143,7 @@ aes-js@3.0.0: resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" integrity sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw== -agentkeepalive@^4.2.1, agentkeepalive@^4.5.0: +agentkeepalive@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.6.0.tgz#35f73e94b3f40bf65f105219c623ad19c136ea6a" integrity sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ== @@ -1746,21 +2181,6 @@ algosdk@^1.13.1: tweetnacl "^1.0.3" vlq "^2.0.4" -anchor-bankrun@0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/anchor-bankrun/-/anchor-bankrun-0.3.0.tgz#3789fcecbc201a2334cff228b99cc0da8ef0167e" - integrity sha512-PYBW5fWX+iGicIS5MIM/omhk1tQPUc0ELAnI/IkLKQJ6d75De/CQRh8MF2bU/TgGyFi6zEel80wUe3uRol9RrQ== - -anchor-litesvm@0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/anchor-litesvm/-/anchor-litesvm-0.1.2.tgz#c2f59c5a019c8b5b6cf2ce4b32c85a29ec15c349" - integrity sha512-WW8PlPgbHhXdg4Blprw5leOm6hBRZv3fJDtbVs24s4iXSlMOYPy1ZWV8yfeumjyL6xHEHrAjogG89ogoTxseSQ== - dependencies: - "@coral-xyz/anchor" "^0.30.0" - "@iarna/toml" "^2.2.5" - "@solana/web3.js" ">1.92.0, <2.0" - litesvm ">=0.1.0, <0.4.0" - ansi-colors@4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" @@ -2042,10 +2462,10 @@ bn.js@^4.0.0, bn.js@^4.11.9: resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.2.tgz#3d8fed6796c24e177737f7cc5172ee04ef39ec99" integrity sha512-n4DSx829VRTRByMRGdjQ9iqsN0Bh4OolPsFnaZBLcbi8iXcB+kJ9s7EnRt4wILZNV3kPLHkRVfOc/HvhC3ovDw== -bn.js@^5.0.0: - version "5.2.4" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.4.tgz#1208fc250bb193fc5f8f0b5fa59e642e706f7103" - integrity sha512-QL7sb18rJ1PbdsKsqPA0guxL563vIMwRHgzNrW/uzQuRGN1Cjqd/wonUBAVqHox9KwzHA6vCbM0lXx3k4iQMow== +bn.js@^5.2.5: + version "5.2.5" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.5.tgz#e81ce41cf25e6f0cd1e05f20a9db8c18405e375f" + integrity sha512-Vq886eXykuP5E6HcKSSStP3bJgrE6In5WKxVUvJ8XGpWWYs2xZHWqUwzCtGgEtBcxyd57KBFDPFoUfNzdaHCNg== borsh@^0.6.0: version "0.6.0" @@ -2097,7 +2517,7 @@ browser-stdout@1.3.1: resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== -bs58@6.0.0, bs58@^6.0.0: +bs58@6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/bs58/-/bs58-6.0.0.tgz#a2cda0130558535dd281a2f8697df79caaf425d8" integrity sha512-PD0wEnEYg6ijszw/u8s+iI3H17cTymlrwkKhDhPZq+Sokl3AU4htyBFTjAeNAlCCmg0f53g6ih3jATyCKftTfw== @@ -2210,6 +2630,11 @@ chain@^0.4.0: resolved "https://registry.yarnpkg.com/chain/-/chain-0.4.2.tgz#f79588b10f9c3a795f012d4f5fd4f3cc01a9ea4e" integrity sha512-GtM+TlN398yBhtSp1D2dBLQomKM3Umbji3h2/NdCqAWSMKhWbjlz33j0e55rStsEZD+8OLRHuz7kWd0U3xKMDg== +chalk@5.6.2, chalk@^5.3.0: + version "5.6.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.6.2.tgz#b1238b6e23ea337af71c7f8a295db5af0c158aea" + integrity sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA== + chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.1: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" @@ -2218,11 +2643,6 @@ chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.1: ansi-styles "^4.1.0" supports-color "^7.1.0" -chalk@^5.3.0, chalk@^5.4.1: - version "5.6.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.6.2.tgz#b1238b6e23ea337af71c7f8a295db5af0c158aea" - integrity sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA== - chardet@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/chardet/-/chardet-2.1.0.tgz#1007f441a1ae9f9199a4a67f6e978fb0aa9aa3fe" @@ -2332,12 +2752,22 @@ colorette@^2.0.20: resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a" integrity sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w== +commander@14.0.2: + version "14.0.2" + resolved "https://registry.yarnpkg.com/commander/-/commander-14.0.2.tgz#b71fd37fe4069e4c3c7c13925252ada4eba14e8e" + integrity sha512-TywoWNNRbhoD0BXs1P3ZEScW8W5iKrnbithIl0YH+uCmBd0QpPOA8yc82DS3BIE5Ma6FnBVUsJ7wVUDz4dvOWQ== + +commander@15.0.0: + version "15.0.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-15.0.0.tgz#96f3961f12adac1799ef3fbd8bc61d40572d1b11" + integrity sha512-z67u4ZhzCL/Tydu1lJARtEZYWbWaN7oYLHbsuzocr6y4N6WZAagG3RQ4FW61V1/0+jImpj293XfrcYnd1qxtPg== + commander@^12.1.0: version "12.1.0" resolved "https://registry.yarnpkg.com/commander/-/commander-12.1.0.tgz#01423b36f501259fdaac4d0e4d60c96c991585d3" integrity sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA== -commander@^14.0.0, commander@^14.0.1: +commander@^14.0.1: version "14.0.1" resolved "https://registry.yarnpkg.com/commander/-/commander-14.0.1.tgz#2f9225c19e6ebd0dc4404dd45821b2caa17ea09b" integrity sha512-2JkV3gUZUVrbNA+1sjBOYLsMZ5cEEl8GTFP2a4AVz5hvasAMCQ1D2l2le/cX+pV4N6ZU17zjUahLpIXRrnWL8A== @@ -2413,11 +2843,6 @@ cross-spawn@^7.0.6: shebang-command "^2.0.0" which "^2.0.1" -crypto-hash@^1.3.0: - version "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" @@ -2551,14 +2976,6 @@ diff@^4.0.1: resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== -dot-case@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/dot-case/-/dot-case-3.0.4.tgz#9b2b670d00a431667a8a75ba29cd1b98809ce751" - integrity sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w== - dependencies: - no-case "^3.0.4" - tslib "^2.0.3" - dotenv@16.6.1: version "16.6.1" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.6.1.tgz#773f0e69527a8315c7285d5ee73c4459d20a8020" @@ -2886,11 +3303,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== -fastestsmallesttextencoderdecoder@^1.0.22: - version "1.0.22" - resolved "https://registry.yarnpkg.com/fastestsmallesttextencoderdecoder/-/fastestsmallesttextencoderdecoder-1.0.22.tgz#59b47e7b965f45258629cc6c127bf783281c5e93" - integrity sha512-Pb8d48e+oIuY4MaM64Cd7OW1gt4nxCHs7/ddPPZ/Ic3sg8yVGM7O9wDvZ7us6ScaUupzM+pfBolwtYhN1IxBIw== - fastq@^1.6.0: version "1.19.1" resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.19.1.tgz#d50eaba803c8846a883c16492821ebcd2cda55f5" @@ -3381,29 +3793,10 @@ isomorphic-ws@^4.0.1: resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz#55fd4cd6c5e6491e76dc125938dd863f5cd4f2dc" integrity sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w== -jayson@^3.4.4: - version "3.7.0" - resolved "https://registry.yarnpkg.com/jayson/-/jayson-3.7.0.tgz#b735b12d06d348639ae8230d7a1e2916cb078f25" - integrity sha512-tfy39KJMrrXJ+mFcMpxwBvFDetS8LAID93+rycFglIQM4kl3uNR3W4lBLE/FFhsoUCEox5Dt2adVpDm/XtebbQ== - dependencies: - "@types/connect" "^3.4.33" - "@types/node" "^12.12.54" - "@types/ws" "^7.4.4" - JSONStream "^1.3.5" - commander "^2.20.3" - delay "^5.0.0" - es6-promisify "^5.0.0" - eyes "^0.1.8" - isomorphic-ws "^4.0.1" - json-stringify-safe "^5.0.1" - lodash "^4.17.20" - uuid "^8.3.2" - ws "^7.4.5" - -jayson@^4.1.1: - version "4.2.0" - resolved "https://registry.yarnpkg.com/jayson/-/jayson-4.2.0.tgz#b71762393fa40bc9637eaf734ca6f40d3b8c0c93" - integrity sha512-VfJ9t1YLwacIubLhONk0KFeosUBwstRWQ0IRT1KDjEjnVnSOVHC3uwugyV7L0c7R9lpVyrUGT2XWiBA1UTtpyg== +jayson@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/jayson/-/jayson-4.3.0.tgz#22eb8f3dcf37a5e893830e5451f32bde6d1bde4d" + integrity sha512-AauzHcUcqs8OBnCHOkJY280VaTiCm57AbuO7lqzcw7JapGj50BisE3xhksye4zlTSR1+1tAz67wLTl8tEH1obQ== dependencies: "@types/connect" "^3.4.33" "@types/node" "^12.12.54" @@ -3484,11 +3877,6 @@ json5@^1.0.2: dependencies: minimist "^1.2.0" -jsonparse@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" - integrity sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg== - keccak@^3.0.2: version "3.0.4" resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.4.tgz#edc09b89e633c0549da444432ecf062ffadee86d" @@ -3538,84 +3926,51 @@ listr2@^9.0.4: rfdc "^1.4.1" wrap-ansi "^9.0.0" -litesvm-darwin-arm64@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/litesvm-darwin-arm64/-/litesvm-darwin-arm64-0.2.0.tgz#24d1a68ed717f193e6a53fa5c9fc4f292443ae39" - integrity sha512-fqGE7Z6iT+5Xob9o1xs0N7Tf3c1meJxDERf7Z6T7Loqm0seyUsfjM0gTOvMJHiWvvnOx+qIo/Cjhtp84Kb9v8w== - -litesvm-darwin-arm64@0.3.3: - version "0.3.3" - resolved "https://registry.yarnpkg.com/litesvm-darwin-arm64/-/litesvm-darwin-arm64-0.3.3.tgz#2ea4417f9de81c1b391918fee212a8bee194f22a" - integrity sha512-81YimsV3ezWjWLgoKixsXfVznaaecbURE3RtECgNb6Din6Za03pKGKGEN4gkyecHkv8uoPaEZv5cl6ARsgeN1Q== - -litesvm-darwin-universal@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/litesvm-darwin-universal/-/litesvm-darwin-universal-0.2.0.tgz#b4d51d11d48c85c3a777f94ca2f2ab15be70b0d3" - integrity sha512-CNgVrQ9tknv8JbtpmOO0SNXuOQj769A3ufWHrMFEBuFhCr9CJ6RQI9a/HxPWjMHTC7EzlcF8klMupPYpqM8KGA== - -litesvm-darwin-x64@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/litesvm-darwin-x64/-/litesvm-darwin-x64-0.2.0.tgz#fa12b30d363adad294906990eda6a23eecd6ca3b" - integrity sha512-blRxD4y0FIx3E27Iv7oX0uz9x3v9KPD+++HLatBx5K5bh57qrAStUINsgT6MchYrxxOE0T2xktJaiSQSEMxWSA== - -litesvm-darwin-x64@0.3.3: - version "0.3.3" - resolved "https://registry.yarnpkg.com/litesvm-darwin-x64/-/litesvm-darwin-x64-0.3.3.tgz#04a1de3f851c0168f0b14d995613056f7ebf8971" - integrity sha512-pYietuU165Bl+2eDnVp2Eidiedfjt+pljyyBAfJPbYriaFyG577mU364NiNcsfQ8ZZWbe+ygIEAVq4Ol247+1g== +litesvm-darwin-arm64@1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/litesvm-darwin-arm64/-/litesvm-darwin-arm64-1.4.1.tgz#7884cfac4f289f31cc55abc00ed8f13d9d0d03a9" + integrity sha512-6dofWLOxtknSL0W6N9W3f/kdnitsJ3xR0oE1W37CLcfd5kX4qCMVbaejZWJkLo4G2JzAk+hFZi965Z2OPyJACg== -litesvm-linux-arm64-musl@0.3.3: - version "0.3.3" - resolved "https://registry.yarnpkg.com/litesvm-linux-arm64-musl/-/litesvm-linux-arm64-musl-0.3.3.tgz#aae93eb033f8f119344f78c834739f8e818add7d" - integrity sha512-mkI15rWtNbaJxVFUfh+qnolqnDCZEqhwSZo/XZ48TZNsQ69vAqY00KhyFhTVJ+jeaYCAZTSNamuFIiRBxqVmNg== +litesvm-darwin-x64@1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/litesvm-darwin-x64/-/litesvm-darwin-x64-1.4.1.tgz#b92b41e207cb638b23f0d5b23a37de8173d72fd0" + integrity sha512-Rjyg6SfnSKAO5/vMpnZpIHTcBWEUzjFj/GshXwzdyiWorrpC0poQjK3OJ9RJneJW2YDd+oUsGZCfwAplTXPGfg== -litesvm-linux-x64-gnu@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/litesvm-linux-x64-gnu/-/litesvm-linux-x64-gnu-0.2.0.tgz#f559ae0291d28a24b2c66cfb23b678a50d1f8009" - integrity sha512-2PQcLvn5c8GLGPp/vLCFaladWe61wbtwwTlIMLEfPeU5f88jBPOaEryO85+0FHZS1awbT97caa55sFDpAO4CWw== +litesvm-linux-arm64-gnu@1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/litesvm-linux-arm64-gnu/-/litesvm-linux-arm64-gnu-1.4.1.tgz#b575312b50806d37bd27780f491b163e6d3a6888" + integrity sha512-hyL/tcuFisAwNEwVzDGjtDRuLYDc+8PoX9QZU/M46vsLrdU2WCBU3g4WdV5z0z1nPl16TzcHVboqydyBy3ImFQ== -litesvm-linux-x64-gnu@0.3.3: - version "0.3.3" - resolved "https://registry.yarnpkg.com/litesvm-linux-x64-gnu/-/litesvm-linux-x64-gnu-0.3.3.tgz#3fc8d9c1098343d26c0f2ee2858991b4b7f3270c" - integrity sha512-Qai2/E8Eq03w8VKnJDREyiWxwavjykW/H6onE179ayMnBjVVmkj5fN7XF50VV4z73kasx5bpDzBNK8fcaxMdzA== +litesvm-linux-arm64-musl@1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/litesvm-linux-arm64-musl/-/litesvm-linux-arm64-musl-1.4.1.tgz#d4f988c78f337aead60613646d5bbd28085c3218" + integrity sha512-Folc4nWAXwkWvwK5iqf3C74eNAPRERg8Yn2QGVW+6pMgCXtaQt77PuIB9m32mLo+W+LZxiU+t3et0ZiFEm4YgQ== -litesvm-linux-x64-musl@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/litesvm-linux-x64-musl/-/litesvm-linux-x64-musl-0.2.0.tgz#0e3bd7ba22595ec505ae7353ea6c0d1b66729244" - integrity sha512-9vAYFIicGjZIlwoCBii6yJmfIUVS4cdF0CxoAL+DGexTBLECk+Tr+WEFEXsvsYe4s81jxP04TTiUnasj/EaIcw== +litesvm-linux-x64-gnu@1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/litesvm-linux-x64-gnu/-/litesvm-linux-x64-gnu-1.4.1.tgz#c456528c75389843f654c58420f12b1ac93d85c0" + integrity sha512-sAKax22lAMS0DpWQcT6ICt8vs6phEjRJXT84LhhftnlNkcU03b0RJziFDr34LUTrkY5SMi/uqZEy0T86Xokg+w== -litesvm-linux-x64-musl@0.3.3: - version "0.3.3" - resolved "https://registry.yarnpkg.com/litesvm-linux-x64-musl/-/litesvm-linux-x64-musl-0.3.3.tgz#b8af27749f8df1f51a039fb33ed3f81cc66631a9" - integrity sha512-bpWZ2f506hbfu1y6bkmuZf+qqtnLDxggpOMTQbibjd+q6faEO3sETWwKGlIgHB99P8wyU+aXKwLSGQX2sJEw6Q== +litesvm-linux-x64-musl@1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/litesvm-linux-x64-musl/-/litesvm-linux-x64-musl-1.4.1.tgz#bffc6a5f4e3e0b11815fb46b2be237e334aacd3e" + integrity sha512-kKsOVhF7o8/sMiP6mgZCoIYr7zWEzwOBQdC0WrWp29JvOJpKOOgz3jioFdgWv/LnSYfkbJ+wZNWI8tMhAkmNOw== -litesvm@0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/litesvm/-/litesvm-0.2.0.tgz#539c83d8b377a725877a5813b5aa726774c8db9f" - integrity sha512-75+ZMkSFY5ynI3S+vCMnZv1wcILg5iNEj21B+XE/G3/P2dfTPj+rbdNM1q3eLFdlnXdewhiB4BLypKsBnQTSOw== +litesvm@1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/litesvm/-/litesvm-1.4.1.tgz#9ff223161e49230b8096e6b9ac1eb5c5d69c6c0c" + integrity sha512-SGMdN6c44m5Deo27nZX7GIn42e/OlfQ4jIv0JIVxR3F5vU8ZbbjsLRGUj3b/r5jCITyN22u14JnuP+mhDyNLlg== dependencies: - "@solana/web3.js" "^1.68.0" - bs58 "^4.0.1" - optionalDependencies: - litesvm-darwin-arm64 "0.2.0" - litesvm-darwin-universal "0.2.0" - litesvm-darwin-x64 "0.2.0" - litesvm-linux-x64-gnu "0.2.0" - litesvm-linux-x64-musl "0.2.0" - -"litesvm@>=0.1.0, <0.4.0": - version "0.3.3" - resolved "https://registry.yarnpkg.com/litesvm/-/litesvm-0.3.3.tgz#2dac5fab34327de9fc8c673fbc0736e7603a1b19" - integrity sha512-QHXjAIXzvG0uAMOza6aJcYl19yTKz3guwq/z0Zml4KnQxyQvPhjaBpUFc5sf2ey/NxMVdqFhoXmL02CXOOomjw== - dependencies: - "@solana/web3.js" "^1.98.4" - bs58 "^6.0.0" - fastestsmallesttextencoderdecoder "^1.0.22" + "@solana-program/system" "^0.14.0" + "@solana-program/token" "^0.16.0" + "@solana/kit" "^8.0.0" optionalDependencies: - litesvm-darwin-arm64 "0.3.3" - litesvm-darwin-x64 "0.3.3" - litesvm-linux-arm64-musl "0.3.3" - litesvm-linux-x64-gnu "0.3.3" - litesvm-linux-x64-musl "0.3.3" + litesvm-darwin-arm64 "1.4.1" + litesvm-darwin-x64 "1.4.1" + litesvm-linux-arm64-gnu "1.4.1" + litesvm-linux-arm64-musl "1.4.1" + litesvm-linux-x64-gnu "1.4.1" + litesvm-linux-x64-musl "1.4.1" locate-path@^6.0.0: version "6.0.0" @@ -3629,11 +3984,6 @@ lodash.merge@^4.6.2: resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== -lodash@^4.17.20: - version "4.18.1" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.18.1.tgz#ff2b66c1f6326d59513de2407bf881439812771c" - integrity sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q== - lodash@^4.17.21: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" @@ -3672,13 +4022,6 @@ loupe@^2.3.6: dependencies: get-func-name "^2.0.1" -lower-case@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-2.0.2.tgz#6fa237c63dbdc4a82ca0fd882e4722dc5e634e28" - integrity sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg== - dependencies: - tslib "^2.0.3" - make-error@^1.1.1: version "1.3.6" resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" @@ -3912,14 +4255,6 @@ near-seed-phrase@^0.2.0: 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" - integrity sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg== - dependencies: - lower-case "^2.0.2" - tslib "^2.0.3" - node-abi@^3.3.0: version "3.92.0" resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.92.0.tgz#18e2214677499b8dda81ffcd095afc763d5a9802" @@ -4305,18 +4640,6 @@ rpc-websockets@7.5.0: bufferutil "^4.0.1" utf-8-validate "^5.0.2" -rpc-websockets@^7.5.1: - version "7.11.2" - resolved "https://registry.yarnpkg.com/rpc-websockets/-/rpc-websockets-7.11.2.tgz#582910c425b9f2c860327481c1d1e0e431bf4a6d" - integrity sha512-pL9r5N6AVHlMN/vT98+fcO+5+/UcPLf/4tq+WUaid/PPUGS/ttJ3y8e9IqmaWKtShNAysMSjkczuEA49NuV7UQ== - dependencies: - eventemitter3 "^4.0.7" - uuid "^8.3.2" - ws "^8.5.0" - optionalDependencies: - bufferutil "^4.0.1" - utf-8-validate "^5.0.2" - rpc-websockets@^9.0.2: version "9.2.0" resolved "https://registry.yarnpkg.com/rpc-websockets/-/rpc-websockets-9.2.0.tgz#c95633929ca92c311ed6e169f4c986623f001505" @@ -4477,53 +4800,6 @@ slice-ansi@^7.1.0: ansi-styles "^6.2.1" is-fullwidth-code-point "^5.0.0" -snake-case@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/snake-case/-/snake-case-3.0.4.tgz#4f2bbd568e9935abdfd593f34c691dadb49c452c" - integrity sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg== - dependencies: - dot-case "^3.0.4" - tslib "^2.0.3" - -solana-bankrun-darwin-arm64@0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/solana-bankrun-darwin-arm64/-/solana-bankrun-darwin-arm64-0.3.1.tgz#65ab6cd2e74eef260c38251f4c53721cf5b9030f" - integrity sha512-9LWtH/3/WR9fs8Ve/srdo41mpSqVHmRqDoo69Dv1Cupi+o1zMU6HiEPUHEvH2Tn/6TDbPEDf18MYNfReLUqE6A== - -solana-bankrun-darwin-universal@0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/solana-bankrun-darwin-universal/-/solana-bankrun-darwin-universal-0.3.1.tgz#bf691457cf046e8739c021ca11e48de5b4fefd45" - integrity sha512-muGHpVYWT7xCd8ZxEjs/bmsbMp8XBqroYGbE4lQPMDUuLvsJEIrjGqs3MbxEFr71sa58VpyvgywWd5ifI7sGIg== - -solana-bankrun-darwin-x64@0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/solana-bankrun-darwin-x64/-/solana-bankrun-darwin-x64-0.3.1.tgz#c6f30c0a6bc3e1621ed90ce7562f26e93bf5303f" - integrity sha512-oCaxfHyt7RC3ZMldrh5AbKfy4EH3YRMl8h6fSlMZpxvjQx7nK7PxlRwMeflMnVdkKKp7U8WIDak1lilIPd3/lg== - -solana-bankrun-linux-x64-gnu@0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/solana-bankrun-linux-x64-gnu/-/solana-bankrun-linux-x64-gnu-0.3.1.tgz#78b522f1a581955a48f43a8fb560709c11301cfd" - integrity sha512-PfRFhr7igGFNt2Ecfdzh3li9eFPB3Xhmk0Eib17EFIB62YgNUg3ItRnQQFaf0spazFjjJLnglY1TRKTuYlgSVA== - -solana-bankrun-linux-x64-musl@0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/solana-bankrun-linux-x64-musl/-/solana-bankrun-linux-x64-musl-0.3.1.tgz#1a044a132138a0084e82406ec7bf4939f06bed68" - integrity sha512-6r8i0NuXg3CGURql8ISMIUqhE7Hx/O7MlIworK4oN08jYrP0CXdLeB/hywNn7Z8d1NXrox/NpYUgvRm2yIzAsQ== - -solana-bankrun@0.3.1, solana-bankrun@^0.3.0: - version "0.3.1" - resolved "https://registry.yarnpkg.com/solana-bankrun/-/solana-bankrun-0.3.1.tgz#13665ab7c1c15ec2b3354aae56980d0ded514998" - integrity sha512-inRwON7fBU5lPC36HdEqPeDg15FXJYcf77+o0iz9amvkUMJepcwnRwEfTNyMVpVYdgjTOBW5vg+596/3fi1kGA== - dependencies: - "@solana/web3.js" "^1.68.0" - bs58 "^4.0.1" - optionalDependencies: - solana-bankrun-darwin-arm64 "0.3.1" - solana-bankrun-darwin-universal "0.3.1" - solana-bankrun-darwin-x64 "0.3.1" - solana-bankrun-linux-x64-gnu "0.3.1" - solana-bankrun-linux-x64-musl "0.3.1" - source-map-support@^0.5.6: version "0.5.21" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" @@ -4537,14 +4813,6 @@ source-map@^0.6.0: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -spl-token-bankrun@0.2.6: - version "0.2.6" - resolved "https://registry.yarnpkg.com/spl-token-bankrun/-/spl-token-bankrun-0.2.6.tgz#c820c2f8777d64966b58eb37556f0add4eeeb16d" - integrity sha512-tD4qpg7s4bagnjlWiDKaY158TcYq9odecM2rwqlKFjKzeVyjYnyoQq54BxwofghWD9Q+gOR/0BbWYK2KW2VbJQ== - dependencies: - "@solana/spl-token" "^0.3.8" - solana-bankrun "^0.3.0" - "statuses@>= 1.5.0 < 2": version "1.5.0" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" @@ -4641,11 +4909,6 @@ strip-json-comments@~2.0.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ== -superstruct@^0.14.2: - version "0.14.2" - resolved "https://registry.yarnpkg.com/superstruct/-/superstruct-0.14.2.tgz#0dbcdf3d83676588828f1cf5ed35cda02f59025b" - integrity sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ== - superstruct@^0.15.4: version "0.15.5" resolved "https://registry.yarnpkg.com/superstruct/-/superstruct-0.15.5.tgz#0f0a8d3ce31313f0d84c6096cd4fa1bfdedc9dab" @@ -4696,7 +4959,7 @@ 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.2.7 <3", through@^2.3.6: +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== @@ -4801,7 +5064,7 @@ 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.1.0, 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== @@ -4874,6 +5137,11 @@ u3@^0.1.1: resolved "https://registry.yarnpkg.com/u3/-/u3-0.1.1.tgz#5f52044f42ee76cd8de33148829e14528494b73b" integrity sha512-+J5D5ir763y+Am/QY6hXNRlwljIeRMZMGs0cT6qqZVVzzT3X3nFPXVyPOFRMOR4kupB0T8JnCdpWdp6Q/iXn3w== +undici-types@^8.10.2: + version "8.11.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-8.11.0.tgz#737069f0c7aa89f2b900bdb16735776ffc08dfdd" + integrity sha512-Ophcodxps+mlNdcccUrHXy+Pp8X7Q0ycBk3QelSNl+jBAPMh6cEB/5xs9xDL3PJVnVs2Cp//nnsJySuD9D2WFA== + undici-types@~6.21.0: version "6.21.0" resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.21.0.tgz#691d00af3909be93a7faa13be61b3a5b50ef12cb" @@ -5025,16 +5293,16 @@ ws@8.18.0: resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== -ws@^7.4.5: - version "7.5.11" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.11.tgz#9460daf1812bb81a423c5b9eac746941a86310fa" - integrity sha512-zS54Oen9bITtp7kp2XM3AydrCIq1D+HwJOuH+c+e4LfpL/lotP5osijd+UoMnxwAam1GN8R4KtLAyIrIcBNpiA== - ws@^7.5.10: version "7.5.10" resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.10.tgz#58b5c20dc281633f6c19113f39b349bd8bd558d9" integrity sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ== +ws@^8.21.3: + version "8.21.3" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.21.3.tgz#660b4faddb6a3e575c86e078126919961f4de4fc" + integrity sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw== + ws@^8.5.0: version "8.18.3" resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.3.tgz#b56b88abffde62791c639170400c93dcb0c95472"