Skip to content

Instantly share code, notes, and snippets.

@vivekascoder
Created April 29, 2025 21:17
Show Gist options
  • Save vivekascoder/e4f2631aadff5d47a4f43ff3079efd74 to your computer and use it in GitHub Desktop.
Save vivekascoder/e4f2631aadff5d47a4f43ff3079efd74 to your computer and use it in GitHub Desktop.
{
"address": "BhRc1GTpQPtuSVPJG2tzE74jF3afb7NRrLK7JTvBbree",
"metadata": {
"name": "fpmm",
"version": "0.1.0",
"spec": "0.1.0",
"description": "Created with Anchor"
},
"instructions": [
{
"name": "buy",
"discriminator": [102, 6, 61, 18, 1, 218, 235, 234],
"accounts": [
{ "name": "signer", "writable": true, "signer": true },
{
"name": "bet",
"writable": true,
"pda": {
"seeds": [
{ "kind": "const", "value": [98, 101, 116] },
{ "kind": "arg", "path": "bet_id" },
{ "kind": "account", "path": "bet.creator", "account": "Bet" }
]
}
},
{ "name": "usdc", "writable": true },
{ "name": "sender_token_account", "writable": true },
{ "name": "recipient_token_account", "writable": true },
{
"name": "mint_yes",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [109, 105, 110, 116, 95, 121, 101, 115]
},
{ "kind": "account", "path": "bet.bet_id", "account": "Bet" },
{ "kind": "account", "path": "bet.creator", "account": "Bet" }
]
}
},
{
"name": "mint_no",
"writable": true,
"pda": {
"seeds": [
{ "kind": "const", "value": [109, 105, 110, 116, 95, 110, 111] },
{ "kind": "account", "path": "bet.bet_id", "account": "Bet" },
{ "kind": "account", "path": "bet.creator", "account": "Bet" }
]
}
},
{
"name": "destination_yes",
"writable": true,
"pda": {
"seeds": [
{ "kind": "account", "path": "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": "mint_yes" }
],
"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": "destination_no",
"writable": true,
"pda": {
"seeds": [
{ "kind": "account", "path": "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": "mint_no" }
],
"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" },
{
"name": "system_program",
"address": "11111111111111111111111111111111"
},
{
"name": "associated_token_program",
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
}
],
"args": [
{ "name": "bet_id", "type": "u64" },
{ "name": "outcome", "type": "u8" },
{ "name": "amt", "type": "u128" }
]
},
{
"name": "create_bet",
"discriminator": [197, 42, 153, 2, 59, 63, 143, 246],
"accounts": [
{ "name": "signer", "writable": true, "signer": true },
{
"name": "bet",
"writable": true,
"pda": {
"seeds": [
{ "kind": "const", "value": [98, 101, 116] },
{ "kind": "arg", "path": "bet_id" },
{ "kind": "account", "path": "signer" }
]
}
},
{
"name": "mint_yes",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [109, 105, 110, 116, 95, 121, 101, 115]
},
{ "kind": "arg", "path": "bet_id" },
{ "kind": "account", "path": "signer" }
]
}
},
{
"name": "mint_no",
"writable": true,
"pda": {
"seeds": [
{ "kind": "const", "value": [109, 105, 110, 116, 95, 110, 111] },
{ "kind": "arg", "path": "bet_id" },
{ "kind": "account", "path": "signer" }
]
}
},
{ "name": "metadata_yes", "writable": true },
{ "name": "metadata_no", "writable": true },
{
"name": "system_program",
"address": "11111111111111111111111111111111"
},
{ "name": "token_program" },
{
"name": "associated_token_program",
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
},
{
"name": "rent",
"address": "SysvarRent111111111111111111111111111111111"
},
{
"name": "token_metadata_program",
"address": "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
}
],
"args": [
{ "name": "bet_id", "type": "u64" },
{ "name": "initial_liq", "type": "u128" },
{ "name": "bet_prompt", "type": "string" },
{ "name": "expiration_at", "type": "i64" },
{ "name": "yes_symbol", "type": "string" },
{ "name": "yes_uri", "type": "string" },
{ "name": "no_symbol", "type": "string" },
{ "name": "no_uri", "type": "string" }
]
},
{
"name": "get_price",
"discriminator": [238, 38, 193, 106, 228, 32, 210, 33],
"accounts": [{ "name": "bet" }],
"args": [{ "name": "side", "type": "u8" }],
"returns": "u64"
},
{
"name": "init_admin",
"discriminator": [97, 65, 97, 27, 200, 206, 72, 219],
"accounts": [
{
"name": "admin_state",
"writable": true,
"pda": {
"seeds": [{ "kind": "const", "value": [97, 100, 109, 105, 110] }]
}
},
{ "name": "signer", "writable": true, "signer": true },
{
"name": "system_program",
"address": "11111111111111111111111111111111"
}
],
"args": []
},
{
"name": "init_bet",
"discriminator": [15, 172, 254, 252, 114, 198, 174, 255],
"accounts": [
{ "name": "signer", "writable": true, "signer": true },
{
"name": "bet",
"writable": true,
"pda": {
"seeds": [
{ "kind": "const", "value": [98, 101, 116] },
{ "kind": "arg", "path": "bet_id" },
{ "kind": "account", "path": "signer" }
]
}
},
{ "name": "usdc", "writable": true },
{ "name": "sender_token_account", "writable": true },
{
"name": "recipient_token_account",
"writable": true,
"pda": {
"seeds": [
{ "kind": "account", "path": "bet" },
{ "kind": "account", "path": "token_program" },
{ "kind": "account", "path": "usdc" }
],
"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": "mint_yes",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [109, 105, 110, 116, 95, 121, 101, 115]
},
{ "kind": "account", "path": "bet.bet_id", "account": "Bet" },
{ "kind": "account", "path": "signer" }
]
}
},
{
"name": "mint_no",
"writable": true,
"pda": {
"seeds": [
{ "kind": "const", "value": [109, 105, 110, 116, 95, 110, 111] },
{ "kind": "account", "path": "bet.bet_id", "account": "Bet" },
{ "kind": "account", "path": "signer" }
]
}
},
{
"name": "destination_yes",
"writable": true,
"pda": {
"seeds": [
{ "kind": "account", "path": "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": "mint_yes" }
],
"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": "destination_no",
"writable": true,
"pda": {
"seeds": [
{ "kind": "account", "path": "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": "mint_no" }
],
"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" },
{
"name": "system_program",
"address": "11111111111111111111111111111111"
},
{
"name": "associated_token_program",
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
}
],
"args": [{ "name": "bet_id", "type": "u64" }]
},
{
"name": "sell",
"discriminator": [51, 230, 133, 164, 1, 127, 131, 173],
"accounts": [
{ "name": "signer", "writable": true, "signer": true },
{
"name": "bet",
"writable": true,
"pda": {
"seeds": [
{ "kind": "const", "value": [98, 101, 116] },
{ "kind": "arg", "path": "bet_id" },
{ "kind": "account", "path": "bet.creator", "account": "Bet" }
]
}
},
{ "name": "usdc", "writable": true },
{
"name": "sender_token_account",
"writable": true,
"pda": {
"seeds": [
{ "kind": "account", "path": "signer" },
{ "kind": "account", "path": "token_program" },
{ "kind": "account", "path": "usdc" }
],
"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_token_account", "writable": true },
{
"name": "mint_yes",
"writable": true,
"pda": {
"seeds": [
{
"kind": "const",
"value": [109, 105, 110, 116, 95, 121, 101, 115]
},
{ "kind": "account", "path": "bet.bet_id", "account": "Bet" },
{ "kind": "account", "path": "bet.creator", "account": "Bet" }
]
}
},
{
"name": "mint_no",
"writable": true,
"pda": {
"seeds": [
{ "kind": "const", "value": [109, 105, 110, 116, 95, 110, 111] },
{ "kind": "account", "path": "bet.bet_id", "account": "Bet" },
{ "kind": "account", "path": "bet.creator", "account": "Bet" }
]
}
},
{
"name": "destination_yes",
"writable": true,
"pda": {
"seeds": [
{ "kind": "account", "path": "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": "mint_yes" }
],
"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": "destination_no",
"writable": true,
"pda": {
"seeds": [
{ "kind": "account", "path": "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": "mint_no" }
],
"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" },
{
"name": "system_program",
"address": "11111111111111111111111111111111"
},
{
"name": "associated_token_program",
"address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
}
],
"args": [
{ "name": "bet_id", "type": "u64" },
{ "name": "outcome", "type": "u8" },
{ "name": "shares", "type": "u128" }
],
"returns": "u128"
}
],
"accounts": [
{ "name": "Admin", "discriminator": [244, 158, 220, 65, 8, 73, 4, 65] },
{ "name": "Bet", "discriminator": [147, 23, 35, 59, 15, 75, 155, 32] }
],
"events": [
{
"name": "AdminStateInitialized",
"discriminator": [211, 115, 86, 90, 176, 197, 254, 121]
},
{
"name": "BetCreated",
"discriminator": [32, 153, 105, 71, 188, 72, 107, 114]
},
{
"name": "BetInitialized",
"discriminator": [142, 64, 3, 194, 91, 21, 169, 14]
},
{
"name": "BuyShares",
"discriminator": [185, 83, 58, 214, 72, 111, 22, 18]
},
{
"name": "SellShares",
"discriminator": [243, 88, 212, 204, 73, 107, 10, 109]
}
],
"errors": [
{
"code": 6000,
"name": "CanOnlyBeInitializedByOwner",
"msg": "Can only be initialized by owner"
},
{
"code": 6001,
"name": "OutComeCanOnlyBe01",
"msg": "outcome can only be 0 for yes or 1 for no"
},
{
"code": 6002,
"name": "InvalidInitialLiq",
"msg": "initial liq must be greater than 3 USDC"
},
{
"code": 6003,
"name": "QuantityMustBeGreaterThanZero",
"msg": "quantity must be greater than zero"
},
{
"code": 6004,
"name": "SignerDoesntHaveEnoughTokens",
"msg": "Signer doesn't have enough tokens"
},
{
"code": 6005,
"name": "NotEnoughLamports",
"msg": "Bet account doesn't have enough lamports"
},
{
"code": 6006,
"name": "NotEnoughSharesToReduce",
"msg": "Bet account doesn't have enough shares"
},
{
"code": 6007,
"name": "UserDoesntHaveEnoughShares",
"msg": "User doesn't have enough shares"
},
{
"code": 6008,
"name": "AdminStateAlreadyInitialized",
"msg": "Admin state already initialized"
},
{
"code": 6009,
"name": "SignerIsNotSettlePubKey",
"msg": "Signer is not the settle pub key"
},
{ "code": 6010, "name": "BetAlreadySettled", "msg": "Bet already settled" },
{ "code": 6011, "name": "BetNotSettled", "msg": "Bet not settled" },
{ "code": 6012, "name": "BetNotExpired", "msg": "Bet not expired" },
{ "code": 6013, "name": "AmountTooSmall", "msg": "Amount too small" },
{ "code": 6014, "name": "MathError", "msg": "Overflow or Underflow" }
],
"types": [
{
"name": "Admin",
"type": {
"kind": "struct",
"fields": [
{ "name": "admin", "type": "pubkey" },
{ "name": "is_initialised", "type": "bool" },
{ "name": "bet_count", "type": "u64" }
]
}
},
{
"name": "AdminStateInitialized",
"type": {
"kind": "struct",
"fields": [
{ "name": "admin", "type": "pubkey" },
{ "name": "is_initialised", "type": "bool" }
]
}
},
{
"name": "Bet",
"type": {
"kind": "struct",
"fields": [
{ "name": "bet_id", "type": "u64" },
{ "name": "total_liq", "type": "u128" },
{ "name": "constant", "type": "u128" },
{ "name": "no_shares", "type": "u128" },
{ "name": "yes_shares", "type": "u128" },
{ "name": "bet_prompt", "type": "string" },
{ "name": "is_initialised", "type": "bool" },
{ "name": "side_won", "type": { "option": "u8" } },
{ "name": "expiration_at", "type": "i64" },
{ "name": "created_at", "type": "i64" },
{ "name": "creator", "type": "pubkey" }
]
}
},
{
"name": "BetCreated",
"type": {
"kind": "struct",
"fields": [
{ "name": "bet_id", "type": "u64" },
{ "name": "creator", "type": "pubkey" },
{ "name": "bet_prompt", "type": "string" },
{ "name": "expiration_at", "type": "i64" },
{ "name": "initial_liq", "type": "u128" },
{ "name": "yes_symbol", "type": "string" },
{ "name": "yes_uri", "type": "string" },
{ "name": "no_symbol", "type": "string" },
{ "name": "no_uri", "type": "string" }
]
}
},
{
"name": "BetInitialized",
"type": {
"kind": "struct",
"fields": [
{ "name": "bet_id", "type": "u64" },
{ "name": "creator", "type": "pubkey" },
{ "name": "expiration_at", "type": "i64" }
]
}
},
{
"name": "BuyShares",
"type": {
"kind": "struct",
"fields": [
{ "name": "bet_id", "type": "u64" },
{ "name": "buyer", "type": "pubkey" },
{ "name": "outcome", "type": "u8" },
{ "name": "amount", "type": "u128" },
{ "name": "shares", "type": "u128" }
]
}
},
{
"name": "SellShares",
"type": {
"kind": "struct",
"fields": [
{ "name": "bet_id", "type": "u64" },
{ "name": "seller", "type": "pubkey" },
{ "name": "outcome", "type": "u8" },
{ "name": "shares", "type": "u128" },
{ "name": "amount_withdraw", "type": "u128" }
]
}
}
],
"constants": [
{ "name": "PRECISION", "type": "u128", "value": "1000000" },
{ "name": "SEED", "type": "string", "value": "\"anchor\"" }
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment