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
39 changes: 31 additions & 8 deletions packages/contracts/.solhint.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,40 @@
{
"extends": ["solhint:recommended", "mud"],
"plugins": ["mud"],
"extends": [
"solhint:recommended",
"mud"
],
"plugins": [
"mud"
],
"rules": {
"compiler-version": ["off"],
"compiler-version": [
"off"
],
"constructor-syntax": "warn",
"quotes": ["error", "single"],
"func-visibility": ["warn", { "ignoreConstructors": true }],
"quotes": [
"error",
"double"
],
"func-visibility": [
"warn",
{
"ignoreConstructors": true
}
],
"not-rely-on-time": "off",
"no-inline-assembly": "off",
"no-empty-blocks": "off",
"private-vars-leading-underscore": ["warn", { "strict": false }],
"private-vars-leading-underscore": [
"warn",
{
"strict": false
}
],
"ordering": "warn",
"avoid-low-level-calls": "off",
"max-line-length": ["warn", 120]
"max-line-length": [
"warn",
120
]
}
}
}
1 change: 1 addition & 0 deletions packages/contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ verbosity = 2
src = "src"
test = "test"
out = "out"
target_evm = "cancun"
allow_paths = [
# pnpm symlinks to the project root's node_modules
"../../node_modules",
Expand Down
91 changes: 54 additions & 37 deletions packages/contracts/mud.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ export default defineWorld({
Counters: {
schema: {
contractAddress: "address",
mobId: "uint256",
counterId: "uint256",
counter: "uint256",
},
key: ["contractAddress", "mobId"],
key: ["contractAddress", "counterId"],
},
Items: {
schema: {
Expand Down Expand Up @@ -186,41 +186,7 @@ export default defineWorld({
},
key: ["encounterId"],
},
ActionOutcome: {
schema: {
encounterId: "bytes32",
currentTurn: "uint256",
actionNumber: "uint256",
actionId: "bytes32",
weaponId: "uint256",
attackerId: "bytes32",
defenderId: "bytes32",
hit: "bool",
miss: "bool",
crit: "bool",
attackerDamageDelt: "int256",
defenderDamageDelt: "int256",
attackerDied: "bool",
defenderDied: "bool",
blockNumber: "uint256",
timestamp: "uint256",
},
key: ["encounterId", "currentTurn", "actionNumber"],
type: "offchainTable",
},
CombatOutcome: {
schema: {
encounterId: "bytes32",
endTime: "uint256",
expDropped: "uint256",
goldDropped: "uint256",
itemsDropped: "uint256[]",
deadAttackers: "bytes32[]",
deadDefenders: "bytes32[]",
},
key: ["encounterId"],
type: "offchainTable",
},

// when an entity starts combat it creates a "match entity" for that encounter.
//when combat ends, the encounterId is set to zero, and the damage taken subtracted from the entities hp.
MatchEntity: {
Expand Down Expand Up @@ -283,6 +249,57 @@ export default defineWorld({
items: "address",
},
},
///////////////////////// OFFCHAIN TABLES//////////////////
RngLogs: {
key: ["requestId"],
schema: {
requestId: "uint256",
sequenceNumber: "uint64",
provider: "address",
entropy: "address",
fee: "uint256",
requestType: "RngRequestType",
randomNumber: "uint256",
userRandomNumber: "bytes32",
data: "bytes",
},
type: "offchainTable",
},
ActionOutcome: {
schema: {
encounterId: "bytes32",
currentTurn: "uint256",
actionNumber: "uint256",
actionId: "bytes32",
weaponId: "uint256",
attackerId: "bytes32",
defenderId: "bytes32",
hit: "bool",
miss: "bool",
crit: "bool",
attackerDamageDelt: "int256",
defenderDamageDelt: "int256",
attackerDied: "bool",
defenderDied: "bool",
blockNumber: "uint256",
timestamp: "uint256",
},
key: ["encounterId", "currentTurn", "actionNumber"],
type: "offchainTable",
},
CombatOutcome: {
schema: {
encounterId: "bytes32",
endTime: "uint256",
expDropped: "uint256",
goldDropped: "uint256",
itemsDropped: "uint256[]",
deadAttackers: "bytes32[]",
deadDefenders: "bytes32[]",
},
key: ["encounterId"],
type: "offchainTable",
},
},
excludeSystems: ["RngSystem"],
});

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/contracts/out/CombatSystem.sol/CombatSystem.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/contracts/out/IWorld.sol/IWorld.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/contracts/out/MapSystem.sol/MapSystem.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/contracts/remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ ds-test/=node_modules/ds-test/src/
forge-std/=node_modules/forge-std/src/
@latticexyz/=node_modules/@latticexyz/
@pythnetwork/=node_modules/@pythnetwork/entropy-sdk-solidity/
@chainlink/=lib/founcry-chainlink-toolkit/
@test/=test/
@systems/=src/systems/
@interfaces/=src/interfaces/
Expand Down
5 changes: 3 additions & 2 deletions packages/contracts/src/codegen/index.sol

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 23 additions & 23 deletions packages/contracts/src/codegen/tables/Counters.sol

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading