High score board #73
Fixes #73
This code allows a user to set an alias, and uses that alias on a new scoreboard page. Users can set their alias using the cli. The score of each level is difficulty * 100. Some highlights below.
Local example:
Ropsten without Alias set example:
contracts/Alias.sol This contract stores a player and their alias. function getPlayerAlias() public view returns(PlayerAlias[]): I left this function in the contract for future use if we ever need to extract the array from the contract. I tested this method using web3 version 1.0.0.36 and found that there was no performance benefit to reading the array from the contract vs reading the logs (at least in the truffle environment with limited records).
function overrideAlias(bytes32 alias) public onlyOwner: Allow the owner to override offensive alias. This will orphan the alias so it can not be used again.
function aliasFilter(string alias) internal pure returns(bytes32): Only allow valid characters in an alias.
src/middlewares/collectScores.js Read game completed logs and alias logs. Create scoreboard data from the logs and sort it. Similar to Stats, speed is an issue and will continue to get worse as more and more records are added to the contracts.
src/utils/aliasutil.js Utility to interact with the alias contract. Match the name filter in js to ensure we don't send data that we know will fail.
test/AliasTests.js Test alias contract and alias utility functionality.
This is my first time using react so be extra critical.
Thanks!
@TravisGDev this looks very interesting! Thank you.
We are currently planning a lot of changes to Ethernaut in Zeppelin, so please be patient regarding this feature and your PR. Reviewing it and implementing the feature will definitely go into the planning. I'll ping you when we're ready to wrap it up.
Hi @ajsantander,
No rush! Let me know if any parts need to be reworked to fit the new changes.
Thank you, Travis