Doki Doki
Search…
Solidity Interfaces and ABIs

IGachapon

Interface

IGachapon.sol
1
pragma solidity ^0.8.6;
2
3
/// @title Interface implemented by all gachapons created by the GachaponControlTower
4
/// @author KirienzoEth for DokiDoki
5
interface IGachapon {
6
/// @dev Undefined = Round doesn't exist, Pending = waiting for oracle response, Unclaimed = oracle answered, Completed = Prizes were withdrawn
7
enum RoundStatus { Undefined, Pending, Unclaimed, Completed, Cancelled }
8
9
struct Round {
10
bytes32 id; // request id
11
address player; // address of player
12
RoundStatus status; // status of the round
13
uint8 times; // how many times of this round
14
uint256[10] prizes; // Prizes obtained in this round
15
}
16
17
struct Nft {
18
address collection; // adress of the contract of the collection
19
uint256 id; // token ID of the nft
20
uint256 amount; // winnable amount left in the gachapon
21
}
22
23
/// @notice Get the state of a round
24
function getRound(bytes32 _roundId) external returns (Round memory);
25
/// @notice Get the token address of the currency used by this gachapon
26
function currency() external returns (address);
27
/// @notice Return the number of prizes that are still available
28
function getRemaningPrizesAmount() external returns(uint256);
29
/// @notice Get the nft at index `_index`
30
function getNft(uint256 _index) external returns(Nft memory);
31
/// @notice The number of different nfts in the gachapon
32
/// @dev Use this to query `getNft` without going out of bounds, latest index is `nftsAmount() - 1`
33
function nftsAmount() external view returns(uint256);
34
35
/// @notice Play the gachapon `_times` times
36
function play(uint8 _times) external;
37
/// @notice Claim the prizes won in a round
38
function claimPrizes(bytes32 _roundId) external;
39
/// @notice Transferring ownership also change the artist's address
40
function transferOwnership(address _newOwner) external;
41
42
/// @dev Player paid and oracle was contacted, refer to getRound(_requestId) to check if the prizes were distributed or not
43
event RoundStarted(bytes32 indexed _requestId, address indexed _player, uint8 _times);
44
/// @dev Oracle answered and the drawn prizes were stored, numbers in _prizes are indexes of the variable 'nfts'
45
event RoundCompleted(bytes32 indexed _requestId, address indexed _player, uint8 _times, uint256[10] _prizes);
46
/// @dev Oracle didn't answer and an operator re-created a round for this player
47
event RoundCancelled(bytes32 _requestId);
48
/// @dev Stored prizes were sent to the user
49
event PrizesClaimed(bytes32 indexed _requestId);
50
}
Copied!

ABI

1
[
2
{
3
"anonymous": false,
4
"inputs": [
5
{
6
"indexed": true,
7
"internalType": "bytes32",
8
"name": "_requestId",
9
"type": "bytes32"
10
}
11
],
12
"name": "PrizesClaimed",
13
"type": "event"
14
},
15
{
16
"anonymous": false,
17
"inputs": [
18
{
19
"indexed": false,
20
"internalType": "bytes32",
21
"name": "_requestId",
22
"type": "bytes32"
23
}
24
],
25
"name": "RoundCancelled",
26
"type": "event"
27
},
28
{
29
"anonymous": false,
30
"inputs": [
31
{
32
"indexed": true,
33
"internalType": "bytes32",
34
"name": "_requestId",
35
"type": "bytes32"
36
},
37
{
38
"indexed": true,
39
"internalType": "address",
40
"name": "_player",
41
"type": "address"
42
},
43
{
44
"indexed": false,
45
"internalType": "uint8",
46
"name": "_times",
47
"type": "uint8"
48
},
49
{
50
"indexed": false,
51
"internalType": "uint256[10]",
52
"name": "_prizes",
53
"type": "uint256[10]"
54
}
55
],
56
"name": "RoundCompleted",
57
"type": "event"
58
},
59
{
60
"anonymous": false,
61
"inputs": [
62
{
63
"indexed": true,
64
"internalType": "bytes32",
65
"name": "_requestId",
66
"type": "bytes32"
67
},
68
{
69
"indexed": true,
70
"internalType": "address",
71
"name": "_player",
72
"type": "address"
73
},
74
{
75
"indexed": false,
76
"internalType": "uint8",
77
"name": "_times",
78
"type": "uint8"
79
}
80
],
81
"name": "RoundStarted",
82
"type": "event"
83
},
84
{
85
"inputs": [
86
{
87
"internalType": "bytes32",
88
"name": "_roundId",
89
"type": "bytes32"
90
}
91
],
92
"name": "getRound",
93
"outputs": [
94
{
95
"components": [
96
{
97
"internalType": "bytes32",
98
"name": "id",
99
"type": "bytes32"
100
},
101
{
102
"internalType": "address",
103
"name": "player",
104
"type": "address"
105
},
106
{
107
"internalType": "enum IGachapon.RoundStatus",
108
"name": "status",
109
"type": "uint8"
110
},
111
{
112
"internalType": "uint8",
113
"name": "times",
114
"type": "uint8"
115
},
116
{
117
"internalType": "uint256[10]",
118
"name": "prizes",
119
"type": "uint256[10]"
120
}
121
],
122
"internalType": "struct IGachapon.Round",
123
"name": "",
124
"type": "tuple"
125
}
126
],
127
"stateMutability": "nonpayable",
128
"type": "function"
129
},
130
{
131
"inputs": [],
132
"name": "currency",
133
"outputs": [
134
{
135
"internalType": "address",
136
"name": "",
137
"type": "address"
138
}
139
],
140
"stateMutability": "nonpayable",
141
"type": "function"
142
},
143
{
144
"inputs": [
145
{
146
"internalType": "uint8",
147
"name": "_times",
148
"type": "uint8"
149
}
150
],
151
"name": "play",
152
"outputs": [],
153
"stateMutability": "nonpayable",
154
"type": "function"
155
},
156
{
157
"inputs": [
158
{
159
"internalType": "bytes32",
160
"name": "_roundId",
161
"type": "bytes32"
162
}
163
],
164
"name": "claimPrizes",
165
"outputs": [],
166
"stateMutability": "nonpayable",
167
"type": "function"
168
},
169
{
170
"inputs": [
171
{
172
"internalType": "address",
173
"name": "_newOwner",
174
"type": "address"
175
}
176
],
177
"name": "transferOwnership",
178
"outputs": [],
179
"stateMutability": "nonpayable",
180
"type": "function"
181
},
182
{
183
"inputs": [
184
{
185
"internalType": "uint256",
186
"name": "_index",
187
"type": "uint256"
188
}
189
],
190
"name": "getNft",
191
"outputs": [
192
{
193
"components": [
194
{
195
"internalType": "address",
196
"name": "collection",
197
"type": "address"
198
},
199
{
200
"internalType": "uint256",
201
"name": "id",
202
"type": "uint256"
203
},
204
{
205
"internalType": "uint256",
206
"name": "amount",
207
"type": "uint256"
208
}
209
],
210
"internalType": "struct IGachapon.Nft",
211
"name": "",
212
"type": "tuple"
213
}
214
],
215
"stateMutability": "nonpayable",
216
"type": "function"
217
},
218
{
219
"inputs": [],
220
"name": "getRemaningPrizesAmount",
221
"outputs": [
222
{
223
"internalType": "uint256",
224
"name": "",
225
"type": "uint256"
226
}
227
],
228
"stateMutability": "nonpayable",
229
"type": "function"
230
},
231
{
232
"inputs": [],
233
"name": "nftsAmount",
234
"outputs": [
235
{
236
"internalType": "uint256",
237
"name": "",
238
"type": "uint256"
239
}
240
],
241
"stateMutability": "view",
242
"type": "function"
243
},
244
]
Copied!

Last modified 3mo ago
Copy link