HelheimLabs / autochessia

Fully on-chain auto chess, built with MUD
https://dev.autochessia.xyz
GNU Affero General Public License v3.0
21 stars 14 forks source link

Deterministic key for hero when place to board #153

Closed noyyyy closed 1 year ago

noyyyy commented 1 year ago

Now, we use getUniqueEntity to generate key when place a hero to board. It's unpredictable and not deterministic. So we can not use optimistic rendering.

I suggest use the following pattern to generate hero key

keccak256(abi.encode(userAddress, gameId, orderOfHeroOnboard))

Accordingly, we need to delete data in table Hero when place piece back to inventory.

noyyyy commented 1 year ago

Will use abi.encodePacked(userAddress, orderOfHeroOnboard) instead