Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "packages/contracts/lib/ERC1155-puppet"]
path = packages/contracts/lib/ERC1155-puppet
url = https://github.com/MrDeadCe11/ERC1155-puppet
1 change: 1 addition & 0 deletions packages/contracts/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ node_modules/
bindings/
artifacts/
broadcast/
lib/*

# Ignore MUD deploy artifacts
deploys/**/*.json
Expand Down
3 changes: 3 additions & 0 deletions packages/contracts/.gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "lib/ERC1155-puppet"]
path = lib/ERC1155-puppet
url = https://github.com/MrDeadCe11/ERC1155-puppet
1 change: 1 addition & 0 deletions packages/contracts/constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity >=0.8.24;

bytes14 constant GOLD_NAMESPACE = "Gold";
bytes14 constant CHARACTERS_NAMESPACE = "Characters";
bytes14 constant ITEMS_NAMESPACE = "Items";
bytes14 constant WORLD_NAMESPACE = "UD";

string constant ERC721_NAME = "UDCharacters";
Expand Down
1 change: 1 addition & 0 deletions packages/contracts/lib/ERC1155-puppet
Submodule ERC1155-puppet added at 3988bc
18 changes: 18 additions & 0 deletions packages/contracts/mud.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default defineWorld({
"Mage", // 2
],
RngRequestType: ["CharacterStats", "Combat", "WorldGeneration"],
ItemType: ["Weapon", "Armor", "Potion", "Scroll", "Material"],
},
tables: {
/**
Expand Down Expand Up @@ -48,6 +49,22 @@ export default defineWorld({
},
key: ["contractAddress"],
},
Items: {
schema: {
itemId: "uint256",
itemType: "ItemType",
stats: "bytes",
},
key: ["itemId"],
},
StarterItems: {
key: ["class"],
schema: {
class: "Classes",
itemIds: "uint256[]",
amounts: "uint256[]",
},
},
/**
* Stores players chosen names.
*/
Expand Down Expand Up @@ -84,6 +101,7 @@ export default defineWorld({
characterToken: "address",
entropy: "address",
pythProvider: "address",
items: "address",
},
},
},
Expand Down
156 changes: 156 additions & 0 deletions packages/contracts/out/IWorld.sol/IWorld.abi.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,38 @@
[
{
"type": "function",
"name": "UD__createItem",
"inputs": [
{
"name": "itemType",
"type": "uint8",
"internalType": "enum ItemType"
},
{
"name": "supply",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "itemMetadataURI",
"type": "string",
"internalType": "string"
},
{
"name": "stats",
"type": "bytes",
"internalType": "bytes"
}
],
"outputs": [
{
"name": "",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "UD__enterGame",
Expand Down Expand Up @@ -135,6 +169,19 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "UD__getItemsContract",
"inputs": [],
"outputs": [
{
"name": "_erc1155",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "UD__getName",
Expand Down Expand Up @@ -186,6 +233,74 @@
],
"stateMutability": "view"
},
{
"type": "function",
"name": "UD__getTotalSupply",
"inputs": [
{
"name": "tokenId",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "_supply",
"type": "uint256",
"internalType": "uint256"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "UD__getWeaponStats",
"inputs": [
{
"name": "itemId",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [
{
"name": "_weaponStats",
"type": "tuple",
"internalType": "struct WeaponStats",
"components": [
{
"name": "damage",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "speed",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "classRestrictions",
"type": "uint8[]",
"internalType": "uint8[]"
}
]
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "UD__issueStarterItems",
"inputs": [
{
"name": "characterId",
"type": "uint256",
"internalType": "uint256"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "UD__mintCharacter",
Expand Down Expand Up @@ -238,6 +353,47 @@
"outputs": [],
"stateMutability": "payable"
},
{
"type": "function",
"name": "UD__setStarterItems",
"inputs": [
{
"name": "class",
"type": "uint8",
"internalType": "enum Classes"
},
{
"name": "itemIds",
"type": "uint256[]",
"internalType": "uint256[]"
},
{
"name": "amounts",
"type": "uint256[]",
"internalType": "uint256[]"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "UD__setTokenUri",
"inputs": [
{
"name": "tokenId",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "tokenUri",
"type": "string",
"internalType": "string"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "batchCall",
Expand Down
Loading