Doki Doki
Search…
Solidity Interfaces and ABIs

IGachapon

Interface

IGachapon.sol
pragma solidity ^0.8.6;
/// @title Interface implemented by all gachapons created by the GachaponControlTower
/// @author KirienzoEth for DokiDoki
interface IGachapon {
/// @dev Undefined = Round doesn't exist, Pending = waiting for oracle response, Unclaimed = oracle answered, Completed = Prizes were withdrawn
enum RoundStatus { Undefined, Pending, Unclaimed, Completed, Cancelled }
struct Round {
bytes32 id; // request id
address player; // address of player
RoundStatus status; // status of the round
uint8 times; // how many times of this round
uint256[10] prizes; // Prizes obtained in this round
}
struct Nft {
address collection; // adress of the contract of the collection
uint256 id; // token ID of the nft
uint256 amount; // winnable amount left in the gachapon
}
/// @notice Get the state of a round
function getRound(bytes32 _roundId) external returns (Round memory);
/// @notice Get the token address of the currency used by this gachapon
function currency() external returns (address);
/// @notice Return the number of prizes that are still available
function getRemaningPrizesAmount() external returns(uint256);
/// @notice Get the nft at index `_index`
function getNft(uint256 _index) external returns(Nft memory);
/// @notice The number of different nfts in the gachapon
/// @dev Use this to query `getNft` without going out of bounds, latest index is `nftsAmount() - 1`
function nftsAmount() external view returns(uint256);
/// @notice Play the gachapon `_times` times
function play(uint8 _times) external;
/// @notice Claim the prizes won in a round
function claimPrizes(bytes32 _roundId) external;
/// @notice Transferring ownership also change the artist's address
function transferOwnership(address _newOwner) external;
/// @dev Player paid and oracle was contacted, refer to getRound(_requestId) to check if the prizes were distributed or not
event RoundStarted(bytes32 indexed _requestId, address indexed _player, uint8 _times);
/// @dev Oracle answered and the drawn prizes were stored, numbers in _prizes are indexes of the variable 'nfts'
event RoundCompleted(bytes32 indexed _requestId, address indexed _player, uint8 _times, uint256[10] _prizes);
/// @dev Oracle didn't answer and an operator re-created a round for this player
event RoundCancelled(bytes32 _requestId);
/// @dev Stored prizes were sent to the user
event PrizesClaimed(bytes32 indexed _requestId);
}

ABI

[
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "_requestId",
"type": "bytes32"
}
],
"name": "PrizesClaimed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "bytes32",
"name": "_requestId",
"type": "bytes32"
}
],
"name": "RoundCancelled",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "_requestId",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "_player",
"type": "address"
},
{
"indexed": false,
"internalType": "uint8",
"name": "_times",
"type": "uint8"
},
{
"indexed": false,
"internalType": "uint256[10]",
"name": "_prizes",
"type": "uint256[10]"
}
],
"name": "RoundCompleted",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "_requestId",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "_player",
"type": "address"
},
{
"indexed": false,
"internalType": "uint8",
"name": "_times",
"type": "uint8"
}
],
"name": "RoundStarted",
"type": "event"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "_roundId",
"type": "bytes32"
}
],
"name": "getRound",
"outputs": [
{
"components": [
{
"internalType": "bytes32",
"name": "id",
"type": "bytes32"
},
{
"internalType": "address",
"name": "player",
"type": "address"
},
{
"internalType": "enum IGachapon.RoundStatus",
"name": "status",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "times",
"type": "uint8"
},
{
"internalType": "uint256[10]",
"name": "prizes",
"type": "uint256[10]"
}
],
"internalType": "struct IGachapon.Round",
"name": "",
"type": "tuple"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "currency",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint8",
"name": "_times",
"type": "uint8"
}
],
"name": "play",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "_roundId",
"type": "bytes32"
}
],
"name": "claimPrizes",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_index",
"type": "uint256"
}
],
"name": "getNft",
"outputs": [
{
"components": [
{
"internalType": "address",
"name": "collection",
"type": "address"
},
{
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"internalType": "struct IGachapon.Nft",
"name": "",
"type": "tuple"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "getRemaningPrizesAmount",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "nftsAmount",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
]

Copy link