Settings

Blockchain
Network
Unit
Language
Theme
Sound New Block

Transaction

5ef080b36329f3c8bccf435eb1e78ee947bf1f5833bebdd6bacae621aa6dc009
Timestamp (utc)
2021-04-23 17:32:03
Fee Paid
0.00004032 BSV
(
0.00977117 BSV
-
0.00973085 BSV
)
Fee Rate
519 sat/KB
Version
1
Confirmations
303,684
Size Stats
7,768 B

3 Outputs

Total Output:
0.00973085 BSV
  • jrun cryptofightsMS{"in":0,"ref":["17c5568411726e2b246dcfd42f5344bfbe47e54adfe201352dcdb22d6a79d4b1_o1","aa790338170676a03c6ad8a65a57f8cf503b60283ed45bd31d0e12c4bb73dec0_o1","50e4d3fe49df28d4bec82a7245d5b5dcb80050869f135d2468db30711f7fa016_o1","1e7dc1b5184c61c27d91ab737e40191c8d4497ba2025751abce9fe8cb7eca58d_o1","80a737b3b2e17c73ff26c1331d1e57c161d60c82f508b56e854acf0e32b49569_o1","db9c442bcba25902be4cc0aed845c809a30a32936cd20fc9f53b9c8062b29b93_o1","7275d3318b72314da1121a54b8da7085ce29c031665a1b73c6d947bde510f3d0_o1","3b6465c9b6862ed7ee301055fda27949b1bfbd2c32d1cdbabedc428a34d7d438_o1","f8b8339075606e0a7337f9a89ac61227f6700784f394a95d680a2a6ab29e430b_o1","f97d4ac2a3d6f5ed09fad4a4f341619dc5a3773d9844ff95c99c5d4f8388de2f_o1","f952c3198b28145be2bb61a0d164151cd6067026df8e3554c3e4e9e945f63c28_o1"],"out":["e8eb7dca0da8ae46994be0353a3bde0b446ba0a0dad24bf24f2a35b265fbcc39"],"del":[],"cre":["n2Bd4cWhEQK1aVjb1R7EBGV9mrw3etvSdC"],"exec":[{"op":"DEPLOY","data":["class Battle extends FyxJig {\n init(validator, rules, players, id, timestamp) {\n this.id = this.random = id;\n this.timestamp = timestamp;\n this.validator = validator;\n this.rules = rules;\n\n this.battlePlayers = players.map(player => this.joinBattle(player));\n this.battlegroundTier = rules.tier;\n this.dice = new Dice(id);\n this.state = BattleUtils.buildBattleState(this.battlePlayers, this.dice);\n\n this.turnCount = 0;\n\n this.satoshis = rules.reward;\n\n this.stateHash = Sha256.hashToHex(JSON.stringify(this.state));\n this.status = Constants.Status.Open;\n this.stateHistory = [];\n this.actor = players[this.state.playerToAct].userId;\n this.stage = 'created';\n }\n\n joinBattle(player) {\n const { userId, pubkey, owner, items, fighter, skills, tags } = player;\n \n if(this.rules.fee) {\n if (fighter.satoshis < this.rules.fee) throw new Error('Insufficient Fighter Satoshis');\n fighter.setSatoshis(fighter.satoshis - this.rules.fee);\n } else {\n fighter.auth();\n }\n \n items.forEach(item => item && item.auth());\n const [mainhand, offhand, armor, hat] = items.map(i => i && i.item && FyxClass.deepClone(i.item));\n\n return {\n userId,\n pubkey,\n owner,\n fighter,\n mainhand,\n offhand,\n armor,\n hat,\n skills,\n tags: tags || []\n };\n }\n\n begin(timeout) {\n if (this.stage !== 'created') throw new Error('Invalid Stage');\n this.timeout = timeout;\n delete this.stage;\n }\n\n resolve(random, timestamp, timeout, actionIndex, clientTimestamp, sig) {\n // console.log('Resolve', this.location);\n if (this.status !== Constants.Status.Open) throw new Error('Invalid Status');\n if (!BattleUtils.validateRandom(random, this.random)) throw new Error('Invalid Random');\n this.random = random;\n \n this.stateHistory[this.turnCount] = this.getState();\n const state = FyxClass.deepClone(this.state);\n state.actionLogs = [];\n this.dice = new Dice(random);\n if (timestamp < this.timeout) {\n if (actionIndex === -1) {\n this.state = BattleUtils.skipTurn(this, state, this.dice, timestamp);\n } else {\n const attacker = this.battlePlayers[this.state.playerToAct];\n const skill = attacker.skills[actionIndex];\n if (!skill) throw new Error(`${attacker.fighter.displayName} used an invalid Skill ID: ${actionIndex}`);\n this.state = skill.run(this, state, this.dice, timestamp);\n }\n } else {\n this.state = BattleUtils.skipTurn(this, state, this.dice, timestamp);\n }\n\n this.status = this.state.status;\n this.timestamp = timestamp;\n this.timeout = timeout;\n this._endTurn();\n }\n\n forfeit(message, timestamp) {\n if (this.status !== Constants.Status.Open) throw new Error('Invalid Status');\n this.stateHistory[this.turnCount] = this.getState();\n const playerIndex = this.battlePlayers.findIndex(p => p.userId === message.from);\n const player = this.battlePlayers[playerIndex];\n const victorIndex = this.battlePlayers.findIndex(p => p.userId !== message.from);\n const victor = this.battlePlayers[victorIndex];\n \n const state = FyxClass.deepClone(this.state);\n state.victor = {\n pubkey: victor.pubkey,\n owner: victor.owner,\n fighter: victor.fighter,\n userId: victor.userId\n };\n state.actionLogs = [{\n playerIndex: playerIndex,\n actionLogMessage: `<gradient=!player${playerIndex}-color><b>${player.fighter.metadata.name.toUpperCase()}</b> <gradient=!log-color> Forfeited`\n }];\n state.playerToAct = victorIndex;\n state.status = Constants.Status.Forfeit;\n this.state = state;\n\n this.status = this.state.status;\n this.timestamp = timestamp;\n this._endTurn();\n }\n\n _endTurn() {\n if (this.status !== Constants.Status.Open) {\n this.victor = {...this.battlePlayers[this.state.playerToAct]};\n }\n this.turnCount++;\n this.stateHash = Sha256.hashToHex(JSON.stringify(this.state));\n this.actor = this.battlePlayers[this.state.playerToAct].userId;\n }\n\n finalize() {\n console.log('Finalizing Battle');\n this.stateHistory[this.turnCount] = this.getState();\n if(![Constants.Status.Complete, Constants.Status.Forfeit].includes(this.status)) throw new Error('Invalid Status');\n const victor = this.victor;\n const loser = this.battlePlayers.find(p => p.userId !== victor.userId);\n this.xp = Battle.LevelXPReward[loser.fighter.level];\n \n if (!victor.tags.includes('bot')) {\n const items = issueRewards(this.dice, this.battlegroundTier);\n this.rewards = items.map(i => new FyxItem(victor.fighter.owner, {name: i.displayName}, i, i.satoshis));\n }\n \n this.battlePlayers.forEach(player => new BattleToken(player.fighter.owner));\n this.owner = victor.fighter.owner;\n this.status = Constants.Status.Finalized;\n }\n \n getState() {\n const state = {\n ...this.state,\n location: this.origin,\n origin: this.origin,\n actor: this.actor,\n battleId: this.id,\n random: this.random,\n stateHash: this.stateHash,\n timestamp: this.timestamp,\n turnCount: this.turnCount,\n timeout: this.timeout,\n battleStatus: this.status\n };\n return state;\n }\n}",{"LevelXPReward":[0,100,200,300,600,1200,2400,0,435,556,713,913,1170,1498,1919,2458,3148,4032,5164,6614,8472],"MaxRounds":100,"deps":{"BattleToken":{"$jig":0},"BattleUtils":{"$jig":1},"Config":{"$jig":2},"Constants":{"$jig":3},"Dice":{"$jig":4},"FyxClass":{"$jig":5},"FyxItem":{"$jig":6},"FyxJig":{"$jig":7},"Sha256":{"$jig":8},"expect":{"$jig":9},"issueRewards":{"$jig":10}},"hash":"fd2a1682666d4b2b619cc9598a23a239b9bb855775705ff6b1d1dd6a9617a039","metadata":{"app":"Cryptofights","emoji":"⚔","name":"Battle","publisher":"FYX"}}]}]}
    https://whatsonchain.com/tx/5ef080b36329f3c8bccf435eb1e78ee947bf1f5833bebdd6bacae621aa6dc009