update mysteryboxV1
This commit is contained in:
@@ -55,7 +55,9 @@ contract MysteryBoxV1 is ERC721URIStorage, InitializableOwnable {
|
||||
string memory baseUri,
|
||||
address owner,
|
||||
address randomGenerator
|
||||
) public {
|
||||
) external {
|
||||
require(owner != address(0));
|
||||
|
||||
_name = name;
|
||||
_symbol = symbol;
|
||||
_baseUri = baseUri;
|
||||
@@ -84,11 +86,11 @@ contract MysteryBoxV1 is ERC721URIStorage, InitializableOwnable {
|
||||
require(_REDEEM_ALLOWED_, "REDEEM_CLOSED");
|
||||
require(!address(msg.sender).isContract(), "ONLY_ALLOW_EOA");
|
||||
require(ticketNum >= 1 && ticketNum <= _USER_TICKETS_[msg.sender], "TICKET_NUM_INVALID");
|
||||
_USER_TICKETS_[msg.sender] = _USER_TICKETS_[msg.sender].sub(ticketNum);
|
||||
_TOTAL_TICKETS_ = _TOTAL_TICKETS_.sub(ticketNum);
|
||||
for (uint256 i = 0; i < ticketNum; i++) {
|
||||
_redeemSinglePrize(msg.sender);
|
||||
}
|
||||
_USER_TICKETS_[msg.sender] = _USER_TICKETS_[msg.sender].sub(ticketNum);
|
||||
_TOTAL_TICKETS_ = _TOTAL_TICKETS_.sub(ticketNum);
|
||||
}
|
||||
|
||||
// ================= View ===================
|
||||
|
||||
@@ -15,7 +15,7 @@ interface IDODOMidPrice {
|
||||
function getMidPrice() external view returns (uint256 midPrice);
|
||||
}
|
||||
|
||||
contract RandomGenerator {
|
||||
contract RandomGenerator is IRandomGenerator{
|
||||
address[] public pools;
|
||||
|
||||
constructor(address[] memory _pools) public {
|
||||
@@ -24,7 +24,7 @@ contract RandomGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
function random(uint256 seed) external view returns (uint256) {
|
||||
function random(uint256 seed) external override view returns (uint256) {
|
||||
uint256 priceSum;
|
||||
for (uint256 i = 0; i < pools.length; i++) {
|
||||
priceSum += IDODOMidPrice(pools[i]).getMidPrice();
|
||||
|
||||
Reference in New Issue
Block a user