Skip to content

Commit

Permalink
Merge branch 'feat-mvp' of github.com:Mississippi-Labs/mississippi in…
Browse files Browse the repository at this point in the history
…to feat-mvp
  • Loading branch information
TiyoSheng committed Oct 31, 2023
2 parents b791c23 + b46c32e commit a23b7b5
Showing 11 changed files with 3,241 additions and 3,374 deletions.
50 changes: 25 additions & 25 deletions packages/contracts/out/IWorld.sol/IWorld.json
Original file line number Diff line number Diff line change
@@ -3888,16 +3888,16 @@
116709,
116675,
71348,
127746,
127655,
127639,
127642,
127694,
171404,
127684,
127673,
127739,
127648,
127632,
127635,
127687,
171397,
127677,
127666,
64435,
124912,
124905,
64393,
64426,
64399,
@@ -3908,22 +3908,22 @@
"nameLocation": "735:6:166",
"scope": 116931,
"usedErrors": [
124877,
124883,
124885,
124887,
124893,
124899,
124905,
124911,
171373,
171377,
171383,
171387,
171391,
171395,
171399,
171403
124870,
124876,
124878,
124880,
124886,
124892,
124898,
124904,
171366,
171370,
171376,
171380,
171384,
171388,
171392,
171396
]
}
],
8 changes: 7 additions & 1 deletion packages/contracts/out/Loot.sol/MLoot.abi.json
Original file line number Diff line number Diff line change
@@ -395,7 +395,13 @@
"type": "function"
},
{
"inputs": [],
"inputs": [
{
"internalType": "address",
"name": "_addr",
"type": "address"
}
],
"name": "mint",
"outputs": [],
"stateMutability": "nonpayable",
2,570 changes: 1,224 additions & 1,346 deletions packages/contracts/out/Loot.sol/MLoot.json

Large diffs are not rendered by default.

556 changes: 328 additions & 228 deletions packages/contracts/out/Plugin.sol/MPlugin.json

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion packages/contracts/out/User.sol/MUser.abi.json
Original file line number Diff line number Diff line change
@@ -262,7 +262,13 @@
"type": "function"
},
{
"inputs": [],
"inputs": [
{
"internalType": "address",
"name": "_addr",
"type": "address"
}
],
"name": "mint",
"outputs": [],
"stateMutability": "nonpayable",
3,394 changes: 1,636 additions & 1,758 deletions packages/contracts/out/User.sol/MUser.json

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions packages/contracts/src/other/Loot.sol
Original file line number Diff line number Diff line change
@@ -197,7 +197,6 @@ contract MLoot is Suit, ERC721,MRandom {

function revealNFT(uint256 _tokenId) external {
Loot storage loot = lootList[_tokenId];
require(loot.owner == msg.sender, "only owner can reveal the box");
uint8[] memory random_numbers = getRandom(loot.randomId, 8,waitBlockCount);
loot.Weapon = luck(random_numbers[0], weapons);
loot.Chest = luck(random_numbers[1], chestArmor);
@@ -210,14 +209,14 @@ contract MLoot is Suit, ERC721,MRandom {
loot.state = RandomState.Confirmed;
}

function mint() external {
function mint(address _addr) external {
// init loot box
Loot storage loot = lootList[tokenId];
loot.owner = msg.sender;
loot.owner = _addr;
loot.state = RandomState.Pending;
loot.randomId = randomId;
requestRandom(randomId);
_mint(msg.sender, tokenId);
_mint(_addr, tokenId);
tokenId++;
randomId++;
}
7 changes: 4 additions & 3 deletions packages/contracts/src/other/Plugin.sol
Original file line number Diff line number Diff line change
@@ -16,8 +16,9 @@ contract MPlugin {
function multMint() external {
User user = User(userAddress);
Loot loot = Loot(lootAddress);
user.mint();
loot.mint();
address _user = msg.sender;
user.mint(_user);
loot.mint(_user);
}

function multRevealNFT(uint256 _lootTokenId,uint256 _userTokenId) external {
@@ -26,5 +27,5 @@ contract MPlugin {
loot.revealNFT(_lootTokenId);
user.revealNFT(_userTokenId);
}

}
7 changes: 3 additions & 4 deletions packages/contracts/src/other/User.sol
Original file line number Diff line number Diff line change
@@ -40,21 +40,20 @@ contract MUser is ERC721, MRandom {

mapping(uint256 => User) public userList;

function mint() external {
function mint(address _addr) external {
// init loot box
User storage user = userList[tokenId];
user.owner = msg.sender;
user.owner = _addr;
user.state = RandomState.Pending;
user.randomId = randomId;
requestRandom(randomId);
_mint(msg.sender, tokenId);
_mint(_addr, tokenId);
tokenId++;
randomId++;
}

function revealNFT(uint256 _tokenId) external {
User storage user = userList[_tokenId];
require(user.owner == msg.sender, "only owner can reveal the box");
uint8[] memory random_numbers = getRandom(
user.randomId,
8,
4 changes: 2 additions & 2 deletions packages/contracts/src/systems/library/Interface.sol
Original file line number Diff line number Diff line change
@@ -6,15 +6,15 @@ interface User {
function getStructInfo(uint256 tokenId) external view returns (uint256,uint256,uint256,uint256,uint256,uint256);
function ownerOf(uint256 tokenId) external view returns (address);
function getUserTokenIdList() external view returns (uint256[] memory);
function mint() external;
function mint(address _addr) external;
function revealNFT(uint256 _tokenId) external;
}

// Loot
interface Loot {
function ownerOf(uint256 tokenId) external view returns (address);
function getStructInfo(uint256 tokenId) external view returns (string memory,string memory,string memory,string memory,string memory,string memory,string memory,string memory);
function mint() external;
function mint(address _addr) external;
function revealNFT(uint256 _tokenId) external;
}

4 changes: 2 additions & 2 deletions packages/contracts/worlds.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"4242": {
"address": "0x7dB56159893190211E4dCAb38f37b4d117E89FC6",
"blockNumber": 29064962
"address": "0x01451FC65Ae8ECcEEbd468b264156ef0EC726f2d",
"blockNumber": 29069437
},
"31337": {
"address": "0x3de00f44ce68FC56DB0e0E33aD4015C6e78eCB39"

0 comments on commit a23b7b5

Please sign in to comment.