update mysteryboxV1
This commit is contained in:
@@ -77,7 +77,7 @@ module.exports = {
|
|||||||
|
|
||||||
|
|
||||||
//================= MysteryBox =================
|
//================= MysteryBox =================
|
||||||
MysteryBoxV1: "0x45136c2455Dd2631E31ab884cf167eC618CCf39a",
|
MysteryBoxV1: "0x97DD3a2bB801028D6b65F62b4cce9D07e4907EC2",
|
||||||
RandomGenerator: "0x53F54E4760FA5f839e5624782D032495613DF218",
|
RandomGenerator: "0x53F54E4760FA5f839e5624782D032495613DF218",
|
||||||
RandomPool: [
|
RandomPool: [
|
||||||
"0xa2e0ef85618732d80e5ef362773da1c92e8b1c57",
|
"0xa2e0ef85618732d80e5ef362773da1c92e8b1c57",
|
||||||
|
|||||||
@@ -55,7 +55,9 @@ contract MysteryBoxV1 is ERC721URIStorage, InitializableOwnable {
|
|||||||
string memory baseUri,
|
string memory baseUri,
|
||||||
address owner,
|
address owner,
|
||||||
address randomGenerator
|
address randomGenerator
|
||||||
) public {
|
) external {
|
||||||
|
require(owner != address(0));
|
||||||
|
|
||||||
_name = name;
|
_name = name;
|
||||||
_symbol = symbol;
|
_symbol = symbol;
|
||||||
_baseUri = baseUri;
|
_baseUri = baseUri;
|
||||||
@@ -84,11 +86,11 @@ contract MysteryBoxV1 is ERC721URIStorage, InitializableOwnable {
|
|||||||
require(_REDEEM_ALLOWED_, "REDEEM_CLOSED");
|
require(_REDEEM_ALLOWED_, "REDEEM_CLOSED");
|
||||||
require(!address(msg.sender).isContract(), "ONLY_ALLOW_EOA");
|
require(!address(msg.sender).isContract(), "ONLY_ALLOW_EOA");
|
||||||
require(ticketNum >= 1 && ticketNum <= _USER_TICKETS_[msg.sender], "TICKET_NUM_INVALID");
|
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++) {
|
for (uint256 i = 0; i < ticketNum; i++) {
|
||||||
_redeemSinglePrize(msg.sender);
|
_redeemSinglePrize(msg.sender);
|
||||||
}
|
}
|
||||||
_USER_TICKETS_[msg.sender] = _USER_TICKETS_[msg.sender].sub(ticketNum);
|
|
||||||
_TOTAL_TICKETS_ = _TOTAL_TICKETS_.sub(ticketNum);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ================= View ===================
|
// ================= View ===================
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ interface IDODOMidPrice {
|
|||||||
function getMidPrice() external view returns (uint256 midPrice);
|
function getMidPrice() external view returns (uint256 midPrice);
|
||||||
}
|
}
|
||||||
|
|
||||||
contract RandomGenerator {
|
contract RandomGenerator is IRandomGenerator{
|
||||||
address[] public pools;
|
address[] public pools;
|
||||||
|
|
||||||
constructor(address[] memory _pools) public {
|
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;
|
uint256 priceSum;
|
||||||
for (uint256 i = 0; i < pools.length; i++) {
|
for (uint256 i = 0; i < pools.length; i++) {
|
||||||
priceSum += IDODOMidPrice(pools[i]).getMidPrice();
|
priceSum += IDODOMidPrice(pools[i]).getMidPrice();
|
||||||
|
|||||||
@@ -204,3 +204,9 @@ Deploy time: 2021/4/16 下午1:41:43
|
|||||||
Deploy type: MysteryBoxV1
|
Deploy type: MysteryBoxV1
|
||||||
MysteryBoxV1Address: 0x45136c2455Dd2631E31ab884cf167eC618CCf39a
|
MysteryBoxV1Address: 0x45136c2455Dd2631E31ab884cf167eC618CCf39a
|
||||||
Init MysteryBoxV1 Tx: 0xa8c1a3700aa806f234566ee4948f9e8c5ce31ded4d35dbb33821b14dda0d9379
|
Init MysteryBoxV1 Tx: 0xa8c1a3700aa806f234566ee4948f9e8c5ce31ded4d35dbb33821b14dda0d9379
|
||||||
|
====================================================
|
||||||
|
network type: kovan
|
||||||
|
Deploy time: 2021/4/20 下午9:05:43
|
||||||
|
Deploy type: MysteryBoxV1
|
||||||
|
MysteryBoxV1Address: 0x97DD3a2bB801028D6b65F62b4cce9D07e4907EC2
|
||||||
|
Init MysteryBoxV1 Tx: 0x0a8525b2215fab6cd63c6f74e50ad0eb8d293894ab3db49f2be027b0a4ee9dad
|
||||||
|
|||||||
Reference in New Issue
Block a user