Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dependencies": {
"@coral-xyz/anchor": "0.29.0",
"@inquirer/prompts": "^7.3.3",
"@metadaoproject/futarchy": "0.4.0-alpha.75",
"@metadaoproject/futarchy": "0.5.0-alpha.1",
"@metaplex-foundation/mpl-token-metadata": "^3.2.0",
"@metaplex-foundation/umi": "^0.9.1",
"@metaplex-foundation/umi-bundle-defaults": "^0.9.1",
Expand Down Expand Up @@ -46,5 +46,6 @@
"tsx": "^4.7.1",
"typescript": "^4.3.5"
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
"version": "0.5.0-alpha.1"
}
8 changes: 4 additions & 4 deletions sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metadaoproject/futarchy",
"version": "0.4.0-alpha.75",
"version": "0.5.0-alpha.1",
"type": "module",
"main": "dist/index.js",
"module": "dist/index.js",
Expand All @@ -12,20 +12,20 @@
"exports": {
".": "./dist/index.js",
"./v0.3": "./dist/v0.3/index.js",
"./v0.4": "./dist/v0.4/index.js"
"./v0.4": "./dist/v0.4/index.js",
"./v0.5": "./dist/v0.5/index.js"
},
"scripts": {
"lint:fix": "prettier */*.js \"*/**/*{.js,.ts}\" -w",
"lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check",
"build": "rm -rf ./dist && cp ../target/types/* ./src/v0.4/types && yarn lint:fix && yarn tsc"
"build": "rm -rf ./dist && cp ../target/types/* ./src/v0.5/types && yarn lint:fix && yarn tsc"
},
"dependencies": {
"@coral-xyz/anchor": "^0.29.0",
"@metaplex-foundation/umi": "^0.9.2",
"@metaplex-foundation/umi-bundle-defaults": "^0.9.2",
"@metaplex-foundation/umi-uploader-bundlr": "^0.9.2",
"@noble/hashes": "^1.4.0",
"@solana/spl-memo": "^0.2.5",
"@solana/spl-token": "^0.3.7",
"@solana/web3.js": "^1.74.0",
"bn.js": "^5.2.1",
Expand Down
34 changes: 29 additions & 5 deletions sdk/src/v0.4/AutocratClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ export class AutocratClient {
proposer: PublicKey = this.provider.publicKey
) {
let [proposal] = getProposalAddr(this.autocrat.programId, proposer, nonce);
const [daoTreasury] = getDaoTreasuryAddr(this.autocrat.programId, dao);
const { baseVault, quoteVault, passAmm, failAmm } = this.getProposalPdas(
proposal,
baseMint,
Expand All @@ -592,12 +593,12 @@ export class AutocratClient {

const passLpVaultAccount = getAssociatedTokenAddressSync(
passLp,
proposal,
daoTreasury,
true
);
const failLpVaultAccount = getAssociatedTokenAddressSync(
failLp,
proposal,
daoTreasury,
true
);

Expand Down Expand Up @@ -632,7 +633,21 @@ export class AutocratClient {
passLpVaultAccount,
failLpVaultAccount,
proposer,
});
})
.preInstructions([
createAssociatedTokenAccountIdempotentInstruction(
proposer,
passLpVaultAccount,
daoTreasury,
passLp
),
createAssociatedTokenAccountIdempotentInstruction(
proposer,
failLpVaultAccount,
daoTreasury,
failLp
),
]);
}

async finalizeProposal(proposal: PublicKey) {
Expand Down Expand Up @@ -688,9 +703,18 @@ export class AutocratClient {
// quoteVault,
passLpUserAccount: getAssociatedTokenAddressSync(passLp, proposer, true),
failLpUserAccount: getAssociatedTokenAddressSync(failLp, proposer, true),
passLpVaultAccount: getAssociatedTokenAddressSync(passLp, proposal, true),
failLpVaultAccount: getAssociatedTokenAddressSync(failLp, proposal, true),
passLpVaultAccount: getAssociatedTokenAddressSync(
passLp,
daoTreasury,
true
),
failLpVaultAccount: getAssociatedTokenAddressSync(
failLp,
daoTreasury,
true
),
vaultProgram: this.vaultClient.vaultProgram.programId,
treasury: daoTreasury,
vaultEventAuthority,
});
}
Expand Down
10 changes: 4 additions & 6 deletions sdk/src/v0.4/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ export const AMM_PROGRAM_ID = new PublicKey(
export const CONDITIONAL_VAULT_PROGRAM_ID = new PublicKey(
"VLTX1ishMBbcX3rdBWGssxawAo1Q2X2qxYFYqiGodVg"
);
export const LAUNCHPAD_PROGRAM_ID = new PublicKey(
"AfJJJ5UqxhBKoE3grkKAZZsoXDE9kncbMKvqSHGsCNrE"
);
export const SHARED_LIQUIDITY_MANAGER_PROGRAM_ID = new PublicKey(
"EoJc1PYxZbnCjszampLcwJGYcB5Md47jM4oSQacRtD4d"
);

export const MPL_TOKEN_METADATA_PROGRAM_ID = new PublicKey(
"metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
Expand Down Expand Up @@ -45,6 +39,10 @@ export const USDC_DECIMALS = 6;

export const AUTOCRAT_LUTS: PublicKey[] = [];

export const LAUNCHPAD_PROGRAM_ID = new PublicKey(
"AfJJJ5UqxhBKoE3grkKAZZsoXDE9kncbMKvqSHGsCNrE"
);

export const RAYDIUM_AUTHORITY = PublicKey.findProgramAddressSync(
[anchor.utils.bytes.utf8.encode("vault_and_lp_mint_auth_seed")],
RAYDIUM_CP_SWAP_PROGRAM_ID
Expand Down
1 change: 0 additions & 1 deletion sdk/src/v0.4/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ export * from "./AmmClient.js";
export * from "./AutocratClient.js";
export * from "./ConditionalVaultClient.js";
export * from "./LaunchpadClient.js";
export * from "./SharedLiquidityManagerClient.js";
16 changes: 0 additions & 16 deletions sdk/src/v0.4/types/amm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,14 +342,6 @@ export type Amm = {
{
name: "seqNum";
type: "u64";
},
{
name: "vaultAtaBase";
type: "publicKey";
},
{
name: "vaultAtaQuote";
type: "publicKey";
}
];
};
Expand Down Expand Up @@ -1175,14 +1167,6 @@ export const IDL: Amm = {
name: "seqNum",
type: "u64",
},
{
name: "vaultAtaBase",
type: "publicKey",
},
{
name: "vaultAtaQuote",
type: "publicKey",
},
],
},
},
Expand Down
50 changes: 10 additions & 40 deletions sdk/src/v0.4/types/autocrat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,6 @@ export type Autocrat = {
isMut: true;
isSigner: true;
},
{
name: "payer";
isMut: true;
isSigner: true;
},
{
name: "tokenProgram";
isMut: false;
Expand All @@ -138,11 +133,6 @@ export type Autocrat = {
isMut: false;
isSigner: false;
},
{
name: "associatedTokenProgram";
isMut: false;
isSigner: false;
},
{
name: "eventAuthority";
isMut: false;
Expand Down Expand Up @@ -191,6 +181,11 @@ export type Autocrat = {
isMut: true;
isSigner: false;
},
{
name: "treasury";
isMut: false;
isSigner: false;
},
{
name: "passLpUserAccount";
isMut: true;
Expand Down Expand Up @@ -1006,16 +1001,6 @@ export type Autocrat = {
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";
}
];
};
Expand Down Expand Up @@ -1145,11 +1130,6 @@ export const IDL: Autocrat = {
isMut: true,
isSigner: true,
},
{
name: "payer",
isMut: true,
isSigner: true,
},
{
name: "tokenProgram",
isMut: false,
Expand All @@ -1160,11 +1140,6 @@ export const IDL: Autocrat = {
isMut: false,
isSigner: false,
},
{
name: "associatedTokenProgram",
isMut: false,
isSigner: false,
},
{
name: "eventAuthority",
isMut: false,
Expand Down Expand Up @@ -1213,6 +1188,11 @@ export const IDL: Autocrat = {
isMut: true,
isSigner: false,
},
{
name: "treasury",
isMut: false,
isSigner: false,
},
{
name: "passLpUserAccount",
isMut: true,
Expand Down Expand Up @@ -2029,15 +2009,5 @@ export const IDL: Autocrat = {
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",
},
],
};
10 changes: 0 additions & 10 deletions sdk/src/v0.4/types/conditional_vault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -914,11 +914,6 @@ export type ConditionalVault = {
code: 6015;
name: "ConditionalTokenMetadataAlreadySet";
msg: "Conditional token metadata already set";
},
{
code: 6016;
name: "UnauthorizedConditionalTokenAccount";
msg: "Conditional token account is not owned by the authority";
}
];
};
Expand Down Expand Up @@ -1840,10 +1835,5 @@ export const IDL: ConditionalVault = {
name: "ConditionalTokenMetadataAlreadySet",
msg: "Conditional token metadata already set",
},
{
code: 6016,
name: "UnauthorizedConditionalTokenAccount",
msg: "Conditional token account is not owned by the authority",
},
],
};
10 changes: 0 additions & 10 deletions sdk/src/v0.4/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ import {
} from "./conditional_vault.js";
export { ConditionalVaultProgram, ConditionalVaultIDL };

import {
SharedLiquidityManager as SharedLiquidityManagerProgram,
IDL as SharedLiquidityManagerIDL,
} from "./shared_liquidity_manager.js";
export { SharedLiquidityManagerProgram, SharedLiquidityManagerIDL };

export { LowercaseKeys } from "./utils.js";

import type { IdlAccounts, IdlTypes, IdlEvents } from "@coral-xyz/anchor";
Expand All @@ -42,10 +36,6 @@ export type Proposal = IdlAccounts<AutocratProgram>["proposal"];
export type Amm = IdlAccounts<AmmProgram>["amm"];
export type Launch = IdlAccounts<LaunchpadProgram>["launch"];
export type FundingRecord = IdlAccounts<LaunchpadProgram>["fundingRecord"];
export type SharedLiquidityPool =
IdlAccounts<SharedLiquidityManagerProgram>["sharedLiquidityPool"];
export type SharedLiquidityPoolPosition =
IdlAccounts<SharedLiquidityManagerProgram>["liquidityPosition"];

export type SwapEvent = IdlEvents<AmmProgram>["SwapEvent"];
export type AddLiquidityEvent = IdlEvents<AmmProgram>["AddLiquidityEvent"];
Expand Down
Loading
Loading