diff --git a/config/kovan-config.js b/config/kovan-config.js index d334618..d5ce9cd 100644 --- a/config/kovan-config.js +++ b/config/kovan-config.js @@ -77,7 +77,7 @@ module.exports = { //================= MysteryBox ================= - MysteryBoxV1: "0x45136c2455Dd2631E31ab884cf167eC618CCf39a", + MysteryBoxV1: "0x97DD3a2bB801028D6b65F62b4cce9D07e4907EC2", RandomGenerator: "0x53F54E4760FA5f839e5624782D032495613DF218", RandomPool: [ "0xa2e0ef85618732d80e5ef362773da1c92e8b1c57", diff --git a/contracts/DODOMysteryBox/MysteryBoxV1.sol b/contracts/DODOMysteryBox/MysteryBoxV1.sol index ee80226..cb588f6 100644 --- a/contracts/DODOMysteryBox/MysteryBoxV1.sol +++ b/contracts/DODOMysteryBox/MysteryBoxV1.sol @@ -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 =================== diff --git a/contracts/lib/RandomGenerator.sol b/contracts/lib/RandomGenerator.sol index e162b28..f134248 100644 --- a/contracts/lib/RandomGenerator.sol +++ b/contracts/lib/RandomGenerator.sol @@ -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(); diff --git a/deploy-nft.txt b/deploy-nft.txt index 5d5e5e3..f19166f 100644 --- a/deploy-nft.txt +++ b/deploy-nft.txt @@ -204,3 +204,9 @@ Deploy time: 2021/4/16 下午1:41:43 Deploy type: MysteryBoxV1 MysteryBoxV1Address: 0x45136c2455Dd2631E31ab884cf167eC618CCf39a Init MysteryBoxV1 Tx: 0xa8c1a3700aa806f234566ee4948f9e8c5ce31ded4d35dbb33821b14dda0d9379 +==================================================== +network type: kovan +Deploy time: 2021/4/20 下午9:05:43 +Deploy type: MysteryBoxV1 +MysteryBoxV1Address: 0x97DD3a2bB801028D6b65F62b4cce9D07e4907EC2 +Init MysteryBoxV1 Tx: 0x0a8525b2215fab6cd63c6f74e50ad0eb8d293894ab3db49f2be027b0a4ee9dad