Boss updates
This commit is contained in:
parent
3aa429fdd7
commit
76fc15faab
@ -1,26 +1,92 @@
|
|||||||
[
|
[
|
||||||
{ "type": "constructor", "inputs": [], "stateMutability": "nonpayable" },
|
{
|
||||||
|
"type": "constructor",
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"name": "_daoToken",
|
||||||
|
"type": "address",
|
||||||
|
"internalType": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "_pool",
|
||||||
|
"type": "address",
|
||||||
|
"internalType": "address"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "nonpayable"
|
||||||
|
},
|
||||||
{ "type": "fallback", "stateMutability": "payable" },
|
{ "type": "fallback", "stateMutability": "payable" },
|
||||||
{ "type": "receive", "stateMutability": "payable" },
|
{ "type": "receive", "stateMutability": "payable" },
|
||||||
{
|
{
|
||||||
"type": "function",
|
"type": "function",
|
||||||
"name": "BUY_IN_AMOUNT",
|
"name": "BUY_IN_AMOUNT",
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
|
"outputs": [
|
||||||
|
{ "name": "", "type": "uint256", "internalType": "uint256" }
|
||||||
|
],
|
||||||
|
"stateMutability": "view"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "function",
|
||||||
|
"name": "BUY_IN_DAO_TOKEN_AMOUNT",
|
||||||
|
"inputs": [],
|
||||||
|
"outputs": [
|
||||||
|
{ "name": "", "type": "uint256", "internalType": "uint256" }
|
||||||
|
],
|
||||||
|
"stateMutability": "view"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "function",
|
||||||
|
"name": "DAO_TOKEN",
|
||||||
|
"inputs": [],
|
||||||
|
"outputs": [
|
||||||
|
{ "name": "", "type": "address", "internalType": "address" }
|
||||||
|
],
|
||||||
"stateMutability": "view"
|
"stateMutability": "view"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "function",
|
"type": "function",
|
||||||
"name": "INITIAL_GELD",
|
"name": "INITIAL_GELD",
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
|
"outputs": [
|
||||||
|
{ "name": "", "type": "uint256", "internalType": "uint256" }
|
||||||
|
],
|
||||||
"stateMutability": "view"
|
"stateMutability": "view"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "function",
|
"type": "function",
|
||||||
"name": "MANTISSA",
|
"name": "MANTISSA",
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
|
"outputs": [
|
||||||
|
{ "name": "", "type": "uint256", "internalType": "uint256" }
|
||||||
|
],
|
||||||
|
"stateMutability": "view"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "function",
|
||||||
|
"name": "POOL",
|
||||||
|
"inputs": [],
|
||||||
|
"outputs": [
|
||||||
|
{ "name": "", "type": "address", "internalType": "address" }
|
||||||
|
],
|
||||||
|
"stateMutability": "view"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "function",
|
||||||
|
"name": "SWAP_ROUTER",
|
||||||
|
"inputs": [],
|
||||||
|
"outputs": [
|
||||||
|
{ "name": "", "type": "address", "internalType": "address" }
|
||||||
|
],
|
||||||
|
"stateMutability": "view"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "function",
|
||||||
|
"name": "WETH",
|
||||||
|
"inputs": [],
|
||||||
|
"outputs": [
|
||||||
|
{ "name": "", "type": "address", "internalType": "address" }
|
||||||
|
],
|
||||||
"stateMutability": "view"
|
"stateMutability": "view"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -28,7 +94,11 @@
|
|||||||
"name": "addUnit",
|
"name": "addUnit",
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{ "name": "unit", "type": "uint8", "internalType": "uint8" },
|
{ "name": "unit", "type": "uint8", "internalType": "uint8" },
|
||||||
{ "name": "n_units", "type": "uint16", "internalType": "uint16" }
|
{
|
||||||
|
"name": "n_units",
|
||||||
|
"type": "uint16",
|
||||||
|
"internalType": "uint16"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"stateMutability": "nonpayable"
|
"stateMutability": "nonpayable"
|
||||||
@ -37,18 +107,36 @@
|
|||||||
"type": "function",
|
"type": "function",
|
||||||
"name": "allowance",
|
"name": "allowance",
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{ "name": "owner", "type": "address", "internalType": "address" },
|
{
|
||||||
{ "name": "spender", "type": "address", "internalType": "address" }
|
"name": "owner",
|
||||||
|
"type": "address",
|
||||||
|
"internalType": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "spender",
|
||||||
|
"type": "address",
|
||||||
|
"internalType": "address"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{ "name": "", "type": "uint256", "internalType": "uint256" }
|
||||||
],
|
],
|
||||||
"outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
|
|
||||||
"stateMutability": "view"
|
"stateMutability": "view"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "function",
|
"type": "function",
|
||||||
"name": "approve",
|
"name": "approve",
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{ "name": "spender", "type": "address", "internalType": "address" },
|
{
|
||||||
{ "name": "value", "type": "uint256", "internalType": "uint256" }
|
"name": "spender",
|
||||||
|
"type": "address",
|
||||||
|
"internalType": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "value",
|
||||||
|
"type": "uint256",
|
||||||
|
"internalType": "uint256"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"outputs": [{ "name": "", "type": "bool", "internalType": "bool" }],
|
"outputs": [{ "name": "", "type": "bool", "internalType": "bool" }],
|
||||||
"stateMutability": "nonpayable"
|
"stateMutability": "nonpayable"
|
||||||
@ -57,9 +145,41 @@
|
|||||||
"type": "function",
|
"type": "function",
|
||||||
"name": "balanceOf",
|
"name": "balanceOf",
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{ "name": "account", "type": "address", "internalType": "address" }
|
{
|
||||||
|
"name": "account",
|
||||||
|
"type": "address",
|
||||||
|
"internalType": "address"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{ "name": "", "type": "uint256", "internalType": "uint256" }
|
||||||
|
],
|
||||||
|
"stateMutability": "view"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "function",
|
||||||
|
"name": "battle_with_boss",
|
||||||
|
"inputs": [],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "hasWonOrAscended",
|
||||||
|
"type": "bool[2]",
|
||||||
|
"internalType": "bool[2]"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "nonpayable"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "function",
|
||||||
|
"name": "daoToken",
|
||||||
|
"inputs": [],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"type": "address",
|
||||||
|
"internalType": "contract ERC20"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
|
|
||||||
"stateMutability": "view"
|
"stateMutability": "view"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -86,7 +206,11 @@
|
|||||||
"type": "tuple",
|
"type": "tuple",
|
||||||
"internalType": "struct Raider",
|
"internalType": "struct Raider",
|
||||||
"components": [
|
"components": [
|
||||||
{ "name": "level", "type": "uint16", "internalType": "uint16" }
|
{
|
||||||
|
"name": "level",
|
||||||
|
"type": "uint16",
|
||||||
|
"internalType": "uint16"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -94,7 +218,11 @@
|
|||||||
"type": "tuple",
|
"type": "tuple",
|
||||||
"internalType": "struct Raider",
|
"internalType": "struct Raider",
|
||||||
"components": [
|
"components": [
|
||||||
{ "name": "level", "type": "uint16", "internalType": "uint16" }
|
{
|
||||||
|
"name": "level",
|
||||||
|
"type": "uint16",
|
||||||
|
"internalType": "uint16"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -102,7 +230,11 @@
|
|||||||
"type": "tuple",
|
"type": "tuple",
|
||||||
"internalType": "struct Raider",
|
"internalType": "struct Raider",
|
||||||
"components": [
|
"components": [
|
||||||
{ "name": "level", "type": "uint16", "internalType": "uint16" }
|
{
|
||||||
|
"name": "level",
|
||||||
|
"type": "uint16",
|
||||||
|
"internalType": "uint16"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -110,7 +242,11 @@
|
|||||||
"type": "tuple",
|
"type": "tuple",
|
||||||
"internalType": "struct Raider",
|
"internalType": "struct Raider",
|
||||||
"components": [
|
"components": [
|
||||||
{ "name": "level", "type": "uint16", "internalType": "uint16" }
|
{
|
||||||
|
"name": "level",
|
||||||
|
"type": "uint16",
|
||||||
|
"internalType": "uint16"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -123,6 +259,33 @@
|
|||||||
],
|
],
|
||||||
"stateMutability": "view"
|
"stateMutability": "view"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "function",
|
||||||
|
"name": "getBoss",
|
||||||
|
"inputs": [
|
||||||
|
{ "name": "addr", "type": "address", "internalType": "address" }
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"type": "tuple",
|
||||||
|
"internalType": "struct Boss",
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"name": "level",
|
||||||
|
"type": "uint8",
|
||||||
|
"internalType": "uint8"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "variants",
|
||||||
|
"type": "uint8[7]",
|
||||||
|
"internalType": "uint8[7]"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "function",
|
"type": "function",
|
||||||
"name": "getPlayer",
|
"name": "getPlayer",
|
||||||
@ -149,6 +312,31 @@
|
|||||||
"name": "last_raided_at",
|
"name": "last_raided_at",
|
||||||
"type": "uint256",
|
"type": "uint256",
|
||||||
"internalType": "uint256"
|
"internalType": "uint256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "total_rewards",
|
||||||
|
"type": "uint256",
|
||||||
|
"internalType": "uint256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "n_runs",
|
||||||
|
"type": "uint32",
|
||||||
|
"internalType": "uint32"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "prestige_level",
|
||||||
|
"type": "uint32",
|
||||||
|
"internalType": "uint32"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "is_registered",
|
||||||
|
"type": "bool",
|
||||||
|
"internalType": "bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "has_active_session",
|
||||||
|
"type": "bool",
|
||||||
|
"internalType": "bool"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -175,7 +363,18 @@
|
|||||||
"type": "function",
|
"type": "function",
|
||||||
"name": "owner",
|
"name": "owner",
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"outputs": [{ "name": "", "type": "address", "internalType": "address" }],
|
"outputs": [
|
||||||
|
{ "name": "", "type": "address", "internalType": "address" }
|
||||||
|
],
|
||||||
|
"stateMutability": "view"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "function",
|
||||||
|
"name": "pool",
|
||||||
|
"inputs": [],
|
||||||
|
"outputs": [
|
||||||
|
{ "name": "", "type": "address", "internalType": "address" }
|
||||||
|
],
|
||||||
"stateMutability": "view"
|
"stateMutability": "view"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -187,7 +386,14 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "function",
|
"type": "function",
|
||||||
"name": "register",
|
"name": "register_dao",
|
||||||
|
"inputs": [],
|
||||||
|
"outputs": [],
|
||||||
|
"stateMutability": "payable"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "function",
|
||||||
|
"name": "register_eth",
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"stateMutability": "payable"
|
"stateMutability": "payable"
|
||||||
@ -199,6 +405,19 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"stateMutability": "nonpayable"
|
"stateMutability": "nonpayable"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "function",
|
||||||
|
"name": "setDaoTokenBuyInAmount",
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"name": "newAmount",
|
||||||
|
"type": "uint256",
|
||||||
|
"internalType": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [],
|
||||||
|
"stateMutability": "nonpayable"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "function",
|
"type": "function",
|
||||||
"name": "symbol",
|
"name": "symbol",
|
||||||
@ -210,7 +429,9 @@
|
|||||||
"type": "function",
|
"type": "function",
|
||||||
"name": "totalSupply",
|
"name": "totalSupply",
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"outputs": [{ "name": "", "type": "uint256", "internalType": "uint256" }],
|
"outputs": [
|
||||||
|
{ "name": "", "type": "uint256", "internalType": "uint256" }
|
||||||
|
],
|
||||||
"stateMutability": "view"
|
"stateMutability": "view"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -218,7 +439,11 @@
|
|||||||
"name": "transfer",
|
"name": "transfer",
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{ "name": "to", "type": "address", "internalType": "address" },
|
{ "name": "to", "type": "address", "internalType": "address" },
|
||||||
{ "name": "value", "type": "uint256", "internalType": "uint256" }
|
{
|
||||||
|
"name": "value",
|
||||||
|
"type": "uint256",
|
||||||
|
"internalType": "uint256"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"outputs": [{ "name": "", "type": "bool", "internalType": "bool" }],
|
"outputs": [{ "name": "", "type": "bool", "internalType": "bool" }],
|
||||||
"stateMutability": "nonpayable"
|
"stateMutability": "nonpayable"
|
||||||
@ -227,9 +452,17 @@
|
|||||||
"type": "function",
|
"type": "function",
|
||||||
"name": "transferFrom",
|
"name": "transferFrom",
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{ "name": "from", "type": "address", "internalType": "address" },
|
{
|
||||||
|
"name": "from",
|
||||||
|
"type": "address",
|
||||||
|
"internalType": "address"
|
||||||
|
},
|
||||||
{ "name": "to", "type": "address", "internalType": "address" },
|
{ "name": "to", "type": "address", "internalType": "address" },
|
||||||
{ "name": "value", "type": "uint256", "internalType": "uint256" }
|
{
|
||||||
|
"name": "value",
|
||||||
|
"type": "uint256",
|
||||||
|
"internalType": "uint256"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"outputs": [{ "name": "", "type": "bool", "internalType": "bool" }],
|
"outputs": [{ "name": "", "type": "bool", "internalType": "bool" }],
|
||||||
"stateMutability": "nonpayable"
|
"stateMutability": "nonpayable"
|
||||||
@ -238,17 +471,27 @@
|
|||||||
"type": "function",
|
"type": "function",
|
||||||
"name": "transferOwnership",
|
"name": "transferOwnership",
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{ "name": "newOwner", "type": "address", "internalType": "address" }
|
{
|
||||||
|
"name": "newOwner",
|
||||||
|
"type": "address",
|
||||||
|
"internalType": "address"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"stateMutability": "nonpayable"
|
"stateMutability": "nonpayable"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "function",
|
"type": "function",
|
||||||
"name": "withdraw",
|
"name": "weth",
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
"stateMutability": "nonpayable"
|
{
|
||||||
|
"name": "",
|
||||||
|
"type": "address",
|
||||||
|
"internalType": "contract IWETH"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"stateMutability": "view"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "event",
|
"type": "event",
|
||||||
@ -275,6 +518,56 @@
|
|||||||
],
|
],
|
||||||
"anonymous": false
|
"anonymous": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "event",
|
||||||
|
"name": "BossDefeated",
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"name": "player",
|
||||||
|
"type": "address",
|
||||||
|
"indexed": true,
|
||||||
|
"internalType": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "bossLevel",
|
||||||
|
"type": "uint8",
|
||||||
|
"indexed": false,
|
||||||
|
"internalType": "uint8"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "earnings",
|
||||||
|
"type": "uint256",
|
||||||
|
"indexed": false,
|
||||||
|
"internalType": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"anonymous": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "event",
|
||||||
|
"name": "DaoTokenBuyInAmountSet",
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"name": "owner",
|
||||||
|
"type": "address",
|
||||||
|
"indexed": true,
|
||||||
|
"internalType": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "oldAmount",
|
||||||
|
"type": "uint256",
|
||||||
|
"indexed": false,
|
||||||
|
"internalType": "uint256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "newAmount",
|
||||||
|
"type": "uint256",
|
||||||
|
"indexed": false,
|
||||||
|
"internalType": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"anonymous": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "event",
|
"type": "event",
|
||||||
"name": "OwnershipTransferred",
|
"name": "OwnershipTransferred",
|
||||||
@ -313,6 +606,50 @@
|
|||||||
],
|
],
|
||||||
"anonymous": false
|
"anonymous": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "event",
|
||||||
|
"name": "PlayerStrikesAgain",
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"name": "player",
|
||||||
|
"type": "address",
|
||||||
|
"indexed": true,
|
||||||
|
"internalType": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "totalRewards",
|
||||||
|
"type": "uint256",
|
||||||
|
"indexed": false,
|
||||||
|
"internalType": "uint256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "initialGeld",
|
||||||
|
"type": "uint256",
|
||||||
|
"indexed": false,
|
||||||
|
"internalType": "uint256"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"anonymous": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "event",
|
||||||
|
"name": "PrestigeGained",
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"name": "player",
|
||||||
|
"type": "address",
|
||||||
|
"indexed": true,
|
||||||
|
"internalType": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "prestigeLevel",
|
||||||
|
"type": "uint32",
|
||||||
|
"indexed": false,
|
||||||
|
"internalType": "uint32"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"anonymous": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "event",
|
"type": "event",
|
||||||
"name": "RaidPerformed",
|
"name": "RaidPerformed",
|
||||||
@ -428,60 +765,108 @@
|
|||||||
"type": "error",
|
"type": "error",
|
||||||
"name": "ERC20InsufficientAllowance",
|
"name": "ERC20InsufficientAllowance",
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{ "name": "spender", "type": "address", "internalType": "address" },
|
{
|
||||||
{ "name": "allowance", "type": "uint256", "internalType": "uint256" },
|
"name": "spender",
|
||||||
{ "name": "needed", "type": "uint256", "internalType": "uint256" }
|
"type": "address",
|
||||||
|
"internalType": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "allowance",
|
||||||
|
"type": "uint256",
|
||||||
|
"internalType": "uint256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "needed",
|
||||||
|
"type": "uint256",
|
||||||
|
"internalType": "uint256"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "error",
|
"type": "error",
|
||||||
"name": "ERC20InsufficientBalance",
|
"name": "ERC20InsufficientBalance",
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{ "name": "sender", "type": "address", "internalType": "address" },
|
{
|
||||||
{ "name": "balance", "type": "uint256", "internalType": "uint256" },
|
"name": "sender",
|
||||||
{ "name": "needed", "type": "uint256", "internalType": "uint256" }
|
"type": "address",
|
||||||
|
"internalType": "address"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "balance",
|
||||||
|
"type": "uint256",
|
||||||
|
"internalType": "uint256"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "needed",
|
||||||
|
"type": "uint256",
|
||||||
|
"internalType": "uint256"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "error",
|
"type": "error",
|
||||||
"name": "ERC20InvalidApprover",
|
"name": "ERC20InvalidApprover",
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{ "name": "approver", "type": "address", "internalType": "address" }
|
{
|
||||||
|
"name": "approver",
|
||||||
|
"type": "address",
|
||||||
|
"internalType": "address"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "error",
|
"type": "error",
|
||||||
"name": "ERC20InvalidReceiver",
|
"name": "ERC20InvalidReceiver",
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{ "name": "receiver", "type": "address", "internalType": "address" }
|
{
|
||||||
|
"name": "receiver",
|
||||||
|
"type": "address",
|
||||||
|
"internalType": "address"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "error",
|
"type": "error",
|
||||||
"name": "ERC20InvalidSender",
|
"name": "ERC20InvalidSender",
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{ "name": "sender", "type": "address", "internalType": "address" }
|
{
|
||||||
|
"name": "sender",
|
||||||
|
"type": "address",
|
||||||
|
"internalType": "address"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "error",
|
"type": "error",
|
||||||
"name": "ERC20InvalidSpender",
|
"name": "ERC20InvalidSpender",
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{ "name": "spender", "type": "address", "internalType": "address" }
|
{
|
||||||
|
"name": "spender",
|
||||||
|
"type": "address",
|
||||||
|
"internalType": "address"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "error",
|
"type": "error",
|
||||||
"name": "OwnableInvalidOwner",
|
"name": "OwnableInvalidOwner",
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{ "name": "owner", "type": "address", "internalType": "address" }
|
{
|
||||||
|
"name": "owner",
|
||||||
|
"type": "address",
|
||||||
|
"internalType": "address"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "error",
|
"type": "error",
|
||||||
"name": "OwnableUnauthorizedAccount",
|
"name": "OwnableUnauthorizedAccount",
|
||||||
"inputs": [
|
"inputs": [
|
||||||
{ "name": "account", "type": "address", "internalType": "address" }
|
{
|
||||||
|
"name": "account",
|
||||||
|
"type": "address",
|
||||||
|
"internalType": "address"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -8,6 +8,11 @@ type Player @entity {
|
|||||||
army: Army! @derivedFrom(field: "player")
|
army: Army! @derivedFrom(field: "player")
|
||||||
armyStrength: BigInt! # Calculated field for total army power
|
armyStrength: BigInt! # Calculated field for total army power
|
||||||
rank: Int # Position in leaderboard, can be updated periodically
|
rank: Int # Position in leaderboard, can be updated periodically
|
||||||
|
prestigeLevel: BigInt!
|
||||||
|
totalRuns: Int! # Track number of times player has started a new run
|
||||||
|
bossesDefeated: Int!
|
||||||
|
totalRewards: BigInt! # Track total DAO tokens earned from boss battles
|
||||||
|
isActiveSession: Boolean! # Track if player has an active session
|
||||||
}
|
}
|
||||||
|
|
||||||
type Army @entity {
|
type Army @entity {
|
||||||
@ -21,6 +26,7 @@ type Army @entity {
|
|||||||
projectedDailyEarnings: BigInt! # Derived from profitPerSecond
|
projectedDailyEarnings: BigInt! # Derived from profitPerSecond
|
||||||
totalUnitsPurchased: Int!
|
totalUnitsPurchased: Int!
|
||||||
lastUnitPurchaseTime: BigInt
|
lastUnitPurchaseTime: BigInt
|
||||||
|
currentBossLevel: Int! # Track current boss level
|
||||||
}
|
}
|
||||||
|
|
||||||
type GlobalStat @entity {
|
type GlobalStat @entity {
|
||||||
@ -30,4 +36,15 @@ type GlobalStat @entity {
|
|||||||
totalArmyUnits: Int!
|
totalArmyUnits: Int!
|
||||||
lastUpdateTime: BigInt!
|
lastUpdateTime: BigInt!
|
||||||
topEarnerProfit: BigInt! # Track highest profit per second
|
topEarnerProfit: BigInt! # Track highest profit per second
|
||||||
|
totalPrestigeLevels: Int! # Sum of all player prestige levels
|
||||||
|
totalBossesDefeated: Int!
|
||||||
|
totalRuns: Int! # Track total number of runs across all players
|
||||||
|
}
|
||||||
|
|
||||||
|
type BossDefeat @entity {
|
||||||
|
id: ID! # player address + timestamp
|
||||||
|
player: Player!
|
||||||
|
bossLevel: Int!
|
||||||
|
earnings: BigInt!
|
||||||
|
timestamp: BigInt!
|
||||||
}
|
}
|
||||||
270
src/raid-geld.ts
270
src/raid-geld.ts
@ -1,26 +1,29 @@
|
|||||||
import {
|
import {
|
||||||
PlayerRegistered,
|
PlayerRegistered,
|
||||||
RaidPerformed,
|
RaidPerformed,
|
||||||
UnitAdded
|
UnitAdded,
|
||||||
} from "../generated/RaidGeld/RaidGeld"
|
PlayerStrikesAgain,
|
||||||
import { Player, Army, GlobalStat } from "../generated/schema"
|
BossDefeated,
|
||||||
import { BigInt } from "@graphprotocol/graph-ts"
|
PrestigeGained,
|
||||||
|
} from "../generated/RaidGeld/RaidGeld";
|
||||||
|
import { Player, Army, GlobalStat, BossDefeat } from "../generated/schema";
|
||||||
|
import { BigInt } from "@graphprotocol/graph-ts";
|
||||||
|
|
||||||
// Constants from RaidGeldUtils
|
// Constants from RaidGeldUtils
|
||||||
const PRECISION = BigInt.fromI32(10000)
|
const PRECISION = BigInt.fromI32(10000);
|
||||||
const PRICE_FACTOR = BigInt.fromI32(11500)
|
const PRICE_FACTOR = BigInt.fromI32(11500);
|
||||||
|
|
||||||
// Unit profits
|
// Unit profits
|
||||||
const MOLOCH_DENIER_PROFIT = BigInt.fromI32(2533)
|
const MOLOCH_DENIER_PROFIT = BigInt.fromI32(2533);
|
||||||
const APPRENTICE_PROFIT = BigInt.fromI32(27863)
|
const APPRENTICE_PROFIT = BigInt.fromI32(27863);
|
||||||
const ANOINTED_PROFIT = BigInt.fromI32(306493)
|
const ANOINTED_PROFIT = BigInt.fromI32(306493);
|
||||||
const CHAMPION_PROFIT = BigInt.fromI32(3371423)
|
const CHAMPION_PROFIT = BigInt.fromI32(3371423);
|
||||||
|
|
||||||
// Base costs (not used in profit calculation but useful for reference)
|
// Base costs (not used in profit calculation but useful for reference)
|
||||||
const MOLOCH_DENIER_BASE_COST = BigInt.fromI32(380000)
|
const MOLOCH_DENIER_BASE_COST = BigInt.fromI32(380000);
|
||||||
const APPRENTICE_BASE_COST = BigInt.fromI32(3420000)
|
const APPRENTICE_BASE_COST = BigInt.fromI32(3420000);
|
||||||
const ANOINTED_BASE_COST = BigInt.fromI32(30096000)
|
const ANOINTED_BASE_COST = BigInt.fromI32(30096000);
|
||||||
const CHAMPION_BASE_COST = BigInt.fromI32(255816000)
|
const CHAMPION_BASE_COST = BigInt.fromI32(255816000);
|
||||||
|
|
||||||
function calculateProfitPerSecond(
|
function calculateProfitPerSecond(
|
||||||
molochLevel: i32,
|
molochLevel: i32,
|
||||||
@ -29,28 +32,32 @@ function calculateProfitPerSecond(
|
|||||||
championLevel: i32
|
championLevel: i32
|
||||||
): BigInt {
|
): BigInt {
|
||||||
// Exactly matching the RaidGeldUtils calculation
|
// Exactly matching the RaidGeldUtils calculation
|
||||||
let molochDenierProfit = MOLOCH_DENIER_PROFIT.times(BigInt.fromI32(molochLevel))
|
let molochDenierProfit = MOLOCH_DENIER_PROFIT.times(
|
||||||
let apprenticeProfit = APPRENTICE_PROFIT.times(BigInt.fromI32(apprenticeLevel))
|
BigInt.fromI32(molochLevel)
|
||||||
let anointedProfit = ANOINTED_PROFIT.times(BigInt.fromI32(anointedLevel))
|
);
|
||||||
let championProfit = CHAMPION_PROFIT.times(BigInt.fromI32(championLevel))
|
let apprenticeProfit = APPRENTICE_PROFIT.times(
|
||||||
|
BigInt.fromI32(apprenticeLevel)
|
||||||
|
);
|
||||||
|
let anointedProfit = ANOINTED_PROFIT.times(BigInt.fromI32(anointedLevel));
|
||||||
|
let championProfit = CHAMPION_PROFIT.times(BigInt.fromI32(championLevel));
|
||||||
|
|
||||||
return molochDenierProfit
|
return molochDenierProfit
|
||||||
.plus(apprenticeProfit)
|
.plus(apprenticeProfit)
|
||||||
.plus(anointedProfit)
|
.plus(anointedProfit)
|
||||||
.plus(championProfit)
|
.plus(championProfit);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOrCreateGlobalStats(): GlobalStat {
|
function getOrCreateGlobalStats(): GlobalStat {
|
||||||
let stats = GlobalStat.load("1")
|
let stats = GlobalStat.load("1");
|
||||||
if (!stats) {
|
if (!stats) {
|
||||||
stats = new GlobalStat("1")
|
stats = new GlobalStat("1");
|
||||||
stats.totalPlayers = 0
|
stats.totalPlayers = 0;
|
||||||
stats.totalGeldMinted = BigInt.fromI32(0)
|
stats.totalGeldMinted = BigInt.fromI32(0);
|
||||||
stats.totalArmyUnits = 0
|
stats.totalArmyUnits = 0;
|
||||||
stats.lastUpdateTime = BigInt.fromI32(0)
|
stats.lastUpdateTime = BigInt.fromI32(0);
|
||||||
stats.topEarnerProfit = BigInt.fromI32(0)
|
stats.topEarnerProfit = BigInt.fromI32(0);
|
||||||
}
|
}
|
||||||
return stats
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
function calculateArmyStrength(army: Army): BigInt {
|
function calculateArmyStrength(army: Army): BigInt {
|
||||||
@ -60,75 +67,161 @@ function calculateArmyStrength(army: Army): BigInt {
|
|||||||
army.apprenticeLevel,
|
army.apprenticeLevel,
|
||||||
army.anointedLevel,
|
army.anointedLevel,
|
||||||
army.championLevel
|
army.championLevel
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function calculateProjectedDailyEarnings(profitPerSecond: BigInt): BigInt {
|
function calculateProjectedDailyEarnings(profitPerSecond: BigInt): BigInt {
|
||||||
return profitPerSecond.times(BigInt.fromI32(86400)) // 86400 seconds in a day
|
return profitPerSecond.times(BigInt.fromI32(86400)); // 86400 seconds in a day
|
||||||
}
|
}
|
||||||
|
|
||||||
export function handlePlayerRegistered(event: PlayerRegistered): void {
|
export function handlePlayerRegistered(event: PlayerRegistered): void {
|
||||||
let player = new Player(event.params.player.toHexString())
|
let player = new Player(event.params.player.toHexString());
|
||||||
player.createdAt = event.block.timestamp
|
player.createdAt = event.block.timestamp;
|
||||||
player.lastRaidedAt = event.block.timestamp
|
player.lastRaidedAt = event.block.timestamp;
|
||||||
player.totalMinted = event.params.initialGeld
|
player.totalMinted = event.params.initialGeld;
|
||||||
player.currentBalance = event.params.initialGeld
|
player.currentBalance = event.params.initialGeld;
|
||||||
player.numberOfRaids = 0
|
player.numberOfRaids = 0;
|
||||||
player.armyStrength = BigInt.fromI32(0)
|
player.armyStrength = BigInt.fromI32(0);
|
||||||
player.rank = 0
|
player.rank = 0;
|
||||||
player.save()
|
// Initialize new fields
|
||||||
|
player.prestigeLevel = BigInt.fromI32(0);
|
||||||
|
player.totalRuns = 1;
|
||||||
|
player.bossesDefeated = 0;
|
||||||
|
player.totalRewards = BigInt.fromI32(0);
|
||||||
|
player.isActiveSession = true;
|
||||||
|
player.save();
|
||||||
|
|
||||||
let army = new Army(event.params.player.toHexString())
|
let army = new Army(event.params.player.toHexString());
|
||||||
army.player = player.id
|
army.player = player.id;
|
||||||
army.molochDenierLevel = 0
|
army.molochDenierLevel = 0;
|
||||||
army.apprenticeLevel = 0
|
army.apprenticeLevel = 0;
|
||||||
army.anointedLevel = 0
|
army.anointedLevel = 0;
|
||||||
army.championLevel = 0
|
army.championLevel = 0;
|
||||||
army.profitPerSecond = BigInt.fromI32(0)
|
army.profitPerSecond = BigInt.fromI32(0);
|
||||||
army.projectedDailyEarnings = BigInt.fromI32(0)
|
army.projectedDailyEarnings = BigInt.fromI32(0);
|
||||||
army.totalUnitsPurchased = 0
|
army.totalUnitsPurchased = 0;
|
||||||
army.lastUnitPurchaseTime = event.block.timestamp
|
army.lastUnitPurchaseTime = event.block.timestamp;
|
||||||
army.save()
|
army.currentBossLevel = 0;
|
||||||
|
army.save();
|
||||||
|
|
||||||
let stats = getOrCreateGlobalStats()
|
let stats = getOrCreateGlobalStats();
|
||||||
stats.totalPlayers += 1
|
stats.totalPlayers += 1;
|
||||||
stats.totalGeldMinted = stats.totalGeldMinted.plus(event.params.initialGeld)
|
stats.totalGeldMinted = stats.totalGeldMinted.plus(
|
||||||
stats.lastUpdateTime = event.block.timestamp
|
event.params.initialGeld
|
||||||
stats.save()
|
);
|
||||||
|
stats.totalRuns += 1;
|
||||||
|
stats.lastUpdateTime = event.block.timestamp;
|
||||||
|
stats.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function handlePlayerStrikesAgain(event: PlayerStrikesAgain): void {
|
||||||
|
let player = Player.load(event.params.player.toHexString());
|
||||||
|
if (!player) return;
|
||||||
|
|
||||||
|
player.totalRuns += 1;
|
||||||
|
player.currentBalance = event.params.initialGeld;
|
||||||
|
player.totalMinted = event.params.initialGeld;
|
||||||
|
player.lastRaidedAt = event.block.timestamp;
|
||||||
|
player.isActiveSession = true;
|
||||||
|
player.save();
|
||||||
|
|
||||||
|
// Reset army for new run
|
||||||
|
let army = Army.load(event.params.player.toHexString());
|
||||||
|
if (!army) return;
|
||||||
|
|
||||||
|
army.molochDenierLevel = 0;
|
||||||
|
army.apprenticeLevel = 0;
|
||||||
|
army.anointedLevel = 0;
|
||||||
|
army.championLevel = 0;
|
||||||
|
army.profitPerSecond = BigInt.fromI32(0);
|
||||||
|
army.projectedDailyEarnings = BigInt.fromI32(0);
|
||||||
|
army.currentBossLevel = 0;
|
||||||
|
army.save();
|
||||||
|
|
||||||
|
let stats = getOrCreateGlobalStats();
|
||||||
|
stats.totalRuns += 1;
|
||||||
|
stats.lastUpdateTime = event.block.timestamp;
|
||||||
|
stats.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function handleBossDefeated(event: BossDefeated): void {
|
||||||
|
let player = Player.load(event.params.player.toHexString());
|
||||||
|
if (!player) return;
|
||||||
|
|
||||||
|
player.bossesDefeated += 1;
|
||||||
|
player.totalRewards = player.totalRewards.plus(event.params.earnings);
|
||||||
|
player.save();
|
||||||
|
|
||||||
|
let army = Army.load(event.params.player.toHexString());
|
||||||
|
if (!army) return;
|
||||||
|
|
||||||
|
army.currentBossLevel += 1;
|
||||||
|
army.save();
|
||||||
|
|
||||||
|
// Create boss defeat record
|
||||||
|
let bossDefeat = new BossDefeat(
|
||||||
|
event.params.player.toHexString() +
|
||||||
|
"-" +
|
||||||
|
event.block.timestamp.toString()
|
||||||
|
);
|
||||||
|
bossDefeat.player = player.id;
|
||||||
|
bossDefeat.bossLevel = event.params.bossLevel;
|
||||||
|
bossDefeat.earnings = event.params.earnings;
|
||||||
|
bossDefeat.timestamp = event.block.timestamp;
|
||||||
|
bossDefeat.save();
|
||||||
|
|
||||||
|
let stats = getOrCreateGlobalStats();
|
||||||
|
stats.totalBossesDefeated += 1;
|
||||||
|
stats.lastUpdateTime = event.block.timestamp;
|
||||||
|
stats.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function handlePrestigeGained(event: PrestigeGained): void {
|
||||||
|
let player = Player.load(event.params.player.toHexString());
|
||||||
|
if (!player) return;
|
||||||
|
|
||||||
|
player.prestigeLevel = event.params.prestigeLevel;
|
||||||
|
player.isActiveSession = false;
|
||||||
|
player.save();
|
||||||
|
|
||||||
|
let stats = getOrCreateGlobalStats();
|
||||||
|
stats.totalPrestigeLevels += 1;
|
||||||
|
stats.lastUpdateTime = event.block.timestamp;
|
||||||
|
stats.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function handleRaidPerformed(event: RaidPerformed): void {
|
export function handleRaidPerformed(event: RaidPerformed): void {
|
||||||
let player = Player.load(event.params.player.toHexString())
|
let player = Player.load(event.params.player.toHexString());
|
||||||
if (!player) return
|
if (!player) return;
|
||||||
|
|
||||||
// Calculate new GELD minted in this raid
|
// Calculate new GELD minted in this raid
|
||||||
let newGeldMinted = event.params.totalMinted.minus(player.totalMinted)
|
let newGeldMinted = event.params.totalMinted.minus(player.totalMinted);
|
||||||
|
|
||||||
player.totalMinted = event.params.totalMinted
|
player.totalMinted = event.params.totalMinted;
|
||||||
player.currentBalance = event.params.geldBalance
|
player.currentBalance = event.params.geldBalance;
|
||||||
player.lastRaidedAt = event.block.timestamp
|
player.lastRaidedAt = event.block.timestamp;
|
||||||
player.numberOfRaids += 1
|
player.numberOfRaids += 1;
|
||||||
player.save()
|
player.save();
|
||||||
|
|
||||||
let stats = getOrCreateGlobalStats()
|
let stats = getOrCreateGlobalStats();
|
||||||
stats.totalGeldMinted = stats.totalGeldMinted.plus(newGeldMinted)
|
stats.totalGeldMinted = stats.totalGeldMinted.plus(newGeldMinted);
|
||||||
stats.lastUpdateTime = event.block.timestamp
|
stats.lastUpdateTime = event.block.timestamp;
|
||||||
stats.save()
|
stats.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function handleUnitAdded(event: UnitAdded): void {
|
export function handleUnitAdded(event: UnitAdded): void {
|
||||||
let army = Army.load(event.params.player.toHexString())
|
let army = Army.load(event.params.player.toHexString());
|
||||||
if (!army) return
|
if (!army) return;
|
||||||
|
|
||||||
// Update army levels based on the event
|
// Update army levels based on the event
|
||||||
if (event.params.unitType == 0) {
|
if (event.params.unitType == 0) {
|
||||||
army.molochDenierLevel = event.params.molochDenierLevel
|
army.molochDenierLevel = event.params.molochDenierLevel;
|
||||||
} else if (event.params.unitType == 1) {
|
} else if (event.params.unitType == 1) {
|
||||||
army.apprenticeLevel = event.params.apprenticeLevel
|
army.apprenticeLevel = event.params.apprenticeLevel;
|
||||||
} else if (event.params.unitType == 2) {
|
} else if (event.params.unitType == 2) {
|
||||||
army.anointedLevel = event.params.anointedLevel
|
army.anointedLevel = event.params.anointedLevel;
|
||||||
} else if (event.params.unitType == 3) {
|
} else if (event.params.unitType == 3) {
|
||||||
army.championLevel = event.params.championLevel
|
army.championLevel = event.params.championLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate new profit per second using exact RaidGeldUtils values
|
// Calculate new profit per second using exact RaidGeldUtils values
|
||||||
@ -137,28 +230,29 @@ export function handleUnitAdded(event: UnitAdded): void {
|
|||||||
army.apprenticeLevel,
|
army.apprenticeLevel,
|
||||||
army.anointedLevel,
|
army.anointedLevel,
|
||||||
army.championLevel
|
army.championLevel
|
||||||
)
|
);
|
||||||
|
|
||||||
army.profitPerSecond = profitPerSecond
|
army.profitPerSecond = profitPerSecond;
|
||||||
army.projectedDailyEarnings = calculateProjectedDailyEarnings(profitPerSecond)
|
army.projectedDailyEarnings =
|
||||||
army.totalUnitsPurchased += event.params.nUnits
|
calculateProjectedDailyEarnings(profitPerSecond);
|
||||||
army.lastUnitPurchaseTime = event.block.timestamp
|
army.totalUnitsPurchased += event.params.nUnits;
|
||||||
army.save()
|
army.lastUnitPurchaseTime = event.block.timestamp;
|
||||||
|
army.save();
|
||||||
|
|
||||||
// Update player's army strength and balance
|
// Update player's army strength and balance
|
||||||
let player = Player.load(event.params.player.toHexString())
|
let player = Player.load(event.params.player.toHexString());
|
||||||
if (!player) return
|
if (!player) return;
|
||||||
|
|
||||||
player.currentBalance = event.params.geldBalance
|
player.currentBalance = event.params.geldBalance;
|
||||||
player.armyStrength = calculateArmyStrength(army)
|
player.armyStrength = calculateArmyStrength(army);
|
||||||
player.save()
|
player.save();
|
||||||
|
|
||||||
// Update global stats
|
// Update global stats
|
||||||
let stats = getOrCreateGlobalStats()
|
let stats = getOrCreateGlobalStats();
|
||||||
stats.totalArmyUnits += event.params.nUnits
|
stats.totalArmyUnits += event.params.nUnits;
|
||||||
if (profitPerSecond > stats.topEarnerProfit) {
|
if (profitPerSecond > stats.topEarnerProfit) {
|
||||||
stats.topEarnerProfit = profitPerSecond
|
stats.topEarnerProfit = profitPerSecond;
|
||||||
}
|
}
|
||||||
stats.lastUpdateTime = event.block.timestamp
|
stats.lastUpdateTime = event.block.timestamp;
|
||||||
stats.save()
|
stats.save();
|
||||||
}
|
}
|
||||||
@ -19,17 +19,26 @@ dataSources:
|
|||||||
- Approval
|
- Approval
|
||||||
- OwnershipTransferred
|
- OwnershipTransferred
|
||||||
- PlayerRegistered
|
- PlayerRegistered
|
||||||
|
- PlayerStrikesAgain
|
||||||
- RaidPerformed
|
- RaidPerformed
|
||||||
- Transfer
|
- Transfer
|
||||||
- UnitAdded
|
- UnitAdded
|
||||||
|
- BossDefeated
|
||||||
|
- PrestigeGained
|
||||||
abis:
|
abis:
|
||||||
- name: RaidGeld
|
- name: RaidGeld
|
||||||
file: ./abis/RaidGeld.json
|
file: ./abis/RaidGeld.json
|
||||||
eventHandlers:
|
eventHandlers:
|
||||||
- event: PlayerRegistered(indexed address,uint256)
|
- event: PlayerRegistered(indexed address,uint256)
|
||||||
handler: handlePlayerRegistered
|
handler: handlePlayerRegistered
|
||||||
|
- event: PlayerStrikesAgain(indexed address,uint256,uint256)
|
||||||
|
handler: handlePlayerStrikesAgain
|
||||||
- event: RaidPerformed(indexed address,uint256,uint256)
|
- event: RaidPerformed(indexed address,uint256,uint256)
|
||||||
handler: handleRaidPerformed
|
handler: handleRaidPerformed
|
||||||
- event: UnitAdded(indexed address,uint8,uint16,uint256,uint256,uint16,uint16,uint16,uint16)
|
- event: UnitAdded(indexed address,uint8,uint16,uint256,uint256,uint16,uint16,uint16,uint16)
|
||||||
handler: handleUnitAdded
|
handler: handleUnitAdded
|
||||||
|
- event: BossDefeated(indexed address,uint8,uint256)
|
||||||
|
handler: handleBossDefeated
|
||||||
|
- event: PrestigeGained(indexed address,uint32)
|
||||||
|
handler: handlePrestigeGained
|
||||||
file: ./src/raid-geld.ts
|
file: ./src/raid-geld.ts
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user