649 lines
13 KiB
JSON
649 lines
13 KiB
JSON
{
|
|
"address": "9ALsnxXNzDBv3mokngCHbruRTWUZiWR7pf7vswS1fCpf",
|
|
"metadata": {
|
|
"name": "smart_updown",
|
|
"version": "0.1.0",
|
|
"spec": "0.1.0",
|
|
"description": "Created with Anchor"
|
|
},
|
|
"instructions": [
|
|
{
|
|
"name": "close_bet",
|
|
"discriminator": [
|
|
185,
|
|
206,
|
|
13,
|
|
184,
|
|
176,
|
|
108,
|
|
140,
|
|
107
|
|
],
|
|
"accounts": [
|
|
{
|
|
"name": "relayer",
|
|
"signer": true
|
|
},
|
|
{
|
|
"name": "bet",
|
|
"writable": true,
|
|
"pda": {
|
|
"seeds": [
|
|
{
|
|
"kind": "const",
|
|
"value": [
|
|
98,
|
|
101,
|
|
116
|
|
]
|
|
},
|
|
{
|
|
"kind": "arg",
|
|
"path": "id"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "global",
|
|
"writable": true,
|
|
"pda": {
|
|
"seeds": [
|
|
{
|
|
"kind": "const",
|
|
"value": [
|
|
103,
|
|
108,
|
|
111,
|
|
98,
|
|
97,
|
|
108
|
|
]
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "bettor"
|
|
},
|
|
{
|
|
"name": "clock",
|
|
"address": "SysvarC1ock11111111111111111111111111111111"
|
|
},
|
|
{
|
|
"name": "vault_token",
|
|
"docs": [
|
|
"Token vault ATA (owner = PDA([GLOBAL_SEED, VAULT_SEED])); payouts are paid out from here."
|
|
],
|
|
"writable": true
|
|
},
|
|
{
|
|
"name": "bettor_token",
|
|
"docs": [
|
|
"Bettor's SPL-token account; the payout is sent here."
|
|
],
|
|
"writable": true
|
|
},
|
|
{
|
|
"name": "vault_authority",
|
|
"docs": [
|
|
"It only serves as the CPI signing authority for the vault ATA payout, so no owner/type check is needed."
|
|
],
|
|
"pda": {
|
|
"seeds": [
|
|
{
|
|
"kind": "const",
|
|
"value": [
|
|
103,
|
|
108,
|
|
111,
|
|
98,
|
|
97,
|
|
108
|
|
]
|
|
},
|
|
{
|
|
"kind": "const",
|
|
"value": [
|
|
118,
|
|
97,
|
|
117,
|
|
108,
|
|
116
|
|
]
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "token_program",
|
|
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
}
|
|
],
|
|
"args": [
|
|
{
|
|
"name": "id",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "exit_price",
|
|
"type": "u64"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "create_bet",
|
|
"discriminator": [
|
|
197,
|
|
42,
|
|
153,
|
|
2,
|
|
59,
|
|
63,
|
|
143,
|
|
246
|
|
],
|
|
"accounts": [
|
|
{
|
|
"name": "bettor",
|
|
"writable": true,
|
|
"signer": true
|
|
},
|
|
{
|
|
"name": "global",
|
|
"writable": true,
|
|
"pda": {
|
|
"seeds": [
|
|
{
|
|
"kind": "const",
|
|
"value": [
|
|
103,
|
|
108,
|
|
111,
|
|
98,
|
|
97,
|
|
108
|
|
]
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "bet",
|
|
"writable": true,
|
|
"pda": {
|
|
"seeds": [
|
|
{
|
|
"kind": "const",
|
|
"value": [
|
|
98,
|
|
101,
|
|
116
|
|
]
|
|
},
|
|
{
|
|
"kind": "arg",
|
|
"path": "id"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "clock",
|
|
"address": "SysvarC1ock11111111111111111111111111111111"
|
|
},
|
|
{
|
|
"name": "system_program",
|
|
"address": "11111111111111111111111111111111"
|
|
},
|
|
{
|
|
"name": "bettor_token",
|
|
"docs": [
|
|
"Bettor's SPL-token account (our \"fanti\" mint); bet amount is pulled from here."
|
|
],
|
|
"writable": true
|
|
},
|
|
{
|
|
"name": "vault_token",
|
|
"docs": [
|
|
"Token vault ATA (owner = PDA([GLOBAL_SEED, VAULT_SEED])); bet amounts are escrowed here."
|
|
],
|
|
"writable": true
|
|
},
|
|
{
|
|
"name": "token_program",
|
|
"address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
|
|
}
|
|
],
|
|
"args": [
|
|
{
|
|
"name": "id",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "side",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "amount",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "entry_price",
|
|
"type": "u64"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "initialize",
|
|
"discriminator": [
|
|
175,
|
|
175,
|
|
109,
|
|
31,
|
|
13,
|
|
152,
|
|
155,
|
|
237
|
|
],
|
|
"accounts": [
|
|
{
|
|
"name": "admin",
|
|
"writable": true,
|
|
"signer": true
|
|
},
|
|
{
|
|
"name": "global",
|
|
"writable": true,
|
|
"pda": {
|
|
"seeds": [
|
|
{
|
|
"kind": "const",
|
|
"value": [
|
|
103,
|
|
108,
|
|
111,
|
|
98,
|
|
97,
|
|
108
|
|
]
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "system_program",
|
|
"address": "11111111111111111111111111111111"
|
|
}
|
|
],
|
|
"args": [
|
|
{
|
|
"name": "min_amount",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "max_amount",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "multiplier_bps",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "expiry_seconds",
|
|
"type": "i64"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "update",
|
|
"discriminator": [
|
|
219,
|
|
200,
|
|
88,
|
|
176,
|
|
158,
|
|
63,
|
|
253,
|
|
127
|
|
],
|
|
"accounts": [
|
|
{
|
|
"name": "admin",
|
|
"signer": true
|
|
},
|
|
{
|
|
"name": "global",
|
|
"writable": true,
|
|
"pda": {
|
|
"seeds": [
|
|
{
|
|
"kind": "const",
|
|
"value": [
|
|
103,
|
|
108,
|
|
111,
|
|
98,
|
|
97,
|
|
108
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"args": [
|
|
{
|
|
"name": "new_relayer",
|
|
"type": "pubkey"
|
|
},
|
|
{
|
|
"name": "min_amount",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "max_amount",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "multiplier_bps",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "paused",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "expiry_seconds",
|
|
"type": "i64"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"accounts": [
|
|
{
|
|
"name": "Bet",
|
|
"discriminator": [
|
|
147,
|
|
23,
|
|
35,
|
|
59,
|
|
15,
|
|
75,
|
|
155,
|
|
32
|
|
]
|
|
},
|
|
{
|
|
"name": "Global",
|
|
"discriminator": [
|
|
167,
|
|
232,
|
|
232,
|
|
177,
|
|
200,
|
|
108,
|
|
114,
|
|
127
|
|
]
|
|
}
|
|
],
|
|
"events": [
|
|
{
|
|
"name": "BetClosed",
|
|
"discriminator": [
|
|
122,
|
|
20,
|
|
157,
|
|
254,
|
|
221,
|
|
0,
|
|
39,
|
|
129
|
|
]
|
|
},
|
|
{
|
|
"name": "BetCreated",
|
|
"discriminator": [
|
|
32,
|
|
153,
|
|
105,
|
|
71,
|
|
188,
|
|
72,
|
|
107,
|
|
114
|
|
]
|
|
}
|
|
],
|
|
"errors": [
|
|
{
|
|
"code": 6000,
|
|
"name": "Paused",
|
|
"msg": "Operation is paused"
|
|
},
|
|
{
|
|
"code": 6001,
|
|
"name": "NotAdmin",
|
|
"msg": "Only the admin can perform this action"
|
|
},
|
|
{
|
|
"code": 6002,
|
|
"name": "NotRelayer",
|
|
"msg": "Only the relayer is allowed to close bets"
|
|
},
|
|
{
|
|
"code": 6003,
|
|
"name": "AmountBelowMin",
|
|
"msg": "Amount below the allowed minimum"
|
|
},
|
|
{
|
|
"code": 6004,
|
|
"name": "AmountAboveMax",
|
|
"msg": "Amount above the allowed maximum"
|
|
},
|
|
{
|
|
"code": 6005,
|
|
"name": "InvalidSide",
|
|
"msg": "Invalid side value"
|
|
},
|
|
{
|
|
"code": 6006,
|
|
"name": "BetAlreadyFinalized",
|
|
"msg": "Bet is already finalized"
|
|
},
|
|
{
|
|
"code": 6007,
|
|
"name": "NotExpired",
|
|
"msg": "Bet cannot be closed before expiry"
|
|
},
|
|
{
|
|
"code": 6008,
|
|
"name": "BetIdMismatch",
|
|
"msg": "Bet id mismatch"
|
|
},
|
|
{
|
|
"code": 6009,
|
|
"name": "InsufficientVault",
|
|
"msg": "Payout exceeds vault solvency"
|
|
}
|
|
],
|
|
"types": [
|
|
{
|
|
"name": "Bet",
|
|
"docs": [
|
|
"Open bet. `amount` is in token base units (decimals = 6), not lamports."
|
|
],
|
|
"type": {
|
|
"kind": "struct",
|
|
"fields": [
|
|
{
|
|
"name": "amount",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "bet_time",
|
|
"type": "i64"
|
|
},
|
|
{
|
|
"name": "expire_time",
|
|
"type": "i64"
|
|
},
|
|
{
|
|
"name": "entry_price",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "exit_price",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "side",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "status",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "bettor",
|
|
"type": "pubkey"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "BetClosed",
|
|
"type": {
|
|
"kind": "struct",
|
|
"fields": [
|
|
{
|
|
"name": "bet",
|
|
"type": "pubkey"
|
|
},
|
|
{
|
|
"name": "exit_price",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "user_won",
|
|
"type": "bool"
|
|
},
|
|
{
|
|
"name": "payout",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "status",
|
|
"type": "u64"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "BetCreated",
|
|
"type": {
|
|
"kind": "struct",
|
|
"fields": [
|
|
{
|
|
"name": "bet",
|
|
"type": "pubkey"
|
|
},
|
|
{
|
|
"name": "bettor",
|
|
"type": "pubkey"
|
|
},
|
|
{
|
|
"name": "side",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "amount",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "bet_time",
|
|
"type": "i64"
|
|
},
|
|
{
|
|
"name": "expire_time",
|
|
"type": "i64"
|
|
},
|
|
{
|
|
"name": "entry_price",
|
|
"type": "u64"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"name": "Global",
|
|
"docs": [
|
|
"Global game state.",
|
|
"",
|
|
"All money-related fields are denominated in **SPL-token base units**",
|
|
"(our \"fanti\" token, decimals = 6), not in lamports:",
|
|
"`min_amount`/`max_amount` bound a bet amount in token units."
|
|
],
|
|
"type": {
|
|
"kind": "struct",
|
|
"fields": [
|
|
{
|
|
"name": "counter",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "min_amount",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "max_amount",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "multiplier_bps",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "expiry_seconds",
|
|
"type": "i64"
|
|
},
|
|
{
|
|
"name": "paused",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "admin",
|
|
"type": "pubkey"
|
|
},
|
|
{
|
|
"name": "relayer",
|
|
"type": "pubkey"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"constants": [
|
|
{
|
|
"name": "BET_SEED",
|
|
"type": "bytes",
|
|
"value": "[98, 101, 116]"
|
|
},
|
|
{
|
|
"name": "GLOBAL_SEED",
|
|
"type": "bytes",
|
|
"value": "[103, 108, 111, 98, 97, 108]"
|
|
},
|
|
{
|
|
"name": "VAULT_SEED",
|
|
"docs": [
|
|
"Vault PDA seed: the token vault lives at PDA([GLOBAL_SEED, VAULT_SEED]).",
|
|
"It cannot reuse GLOBAL_SEED alone — that PDA address is the `global` state account itself."
|
|
],
|
|
"type": "bytes",
|
|
"value": "[118, 97, 117, 108, 116]"
|
|
}
|
|
]
|
|
}
|