546 lines
10 KiB
JSON
546 lines
10 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": [
|
|
2
|
|
],
|
|
"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",
|
|
"docs": [
|
|
"CHECK: recipient must be the bet's bettor and is validated in the handler."
|
|
],
|
|
"writable": true
|
|
},
|
|
{
|
|
"name": "clock",
|
|
"address": "SysvarC1ock11111111111111111111111111111111"
|
|
}
|
|
],
|
|
"args": [
|
|
{
|
|
"name": "id",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "exit_price",
|
|
"type": "u64"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "create_bet",
|
|
"discriminator": [
|
|
1
|
|
],
|
|
"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"
|
|
}
|
|
],
|
|
"args": [
|
|
{
|
|
"name": "id",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "side",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "amount",
|
|
"type": "u64"
|
|
},
|
|
{
|
|
"name": "entry_price",
|
|
"type": "u64"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "initialize",
|
|
"discriminator": [
|
|
0
|
|
],
|
|
"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": [
|
|
3
|
|
],
|
|
"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",
|
|
"serialization": "bytemuck",
|
|
"repr": {
|
|
"kind": "c"
|
|
},
|
|
"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",
|
|
"serialization": "bytemuck",
|
|
"repr": {
|
|
"kind": "c"
|
|
},
|
|
"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]"
|
|
}
|
|
]
|
|
} |