JoinSEEDS / seeds-smart-contracts

Smart contracts for SEEDS - A Regenerative Civilization Building Game.
https://docs.google.com/document/d/1C4w9Ol8VGabCIcQDVPDrwcTRoJXBqhrb7VjslwQbUGU/edit#heading=h.6f4sxygso816
MIT License
20 stars 6 forks source link

Fix vote delegation #414

Closed n13 closed 2 years ago

n13 commented 2 years ago

Fix for: https://github.com/JoinSEEDS/seeds-smart-contracts/issues/413

HC (Human cause): Setting parameters on mainnet could cause the rep value we add for delegators to be 0. addrep fails with an error when trying to addrep with 0. Unit tests modified the values and did not test the mainnet values, so unit tests did not cover this.

Fix: round the value, which with the current production settings means that delegators will get 1 rep point for entering into the table Also, check for 0 - in case the settings change such that added rep would be 0, we don't call addrep.