Closed 3esmit closed 8 months ago
For now, my analysis favors #66 to be approved over #67.
OpenZeppelin mulDiv function uses a smart trick to perform these operations with reduced gas cost, and seems a more safe approch overall.
I'll try to dig more into these solutions to see if I can break one or other in certain scenarios, or if I can improve #67 formulas.
Duplicate of #24
I think going with #66 is a good decision here. It's a battle-tested solution to the problem, this also makes it potentially easier to audit.
We ended up using OpenZeppelin Math library (#66).
Advantages:
Disadvantage:
In StakeManager, there are some divisions, but solidity does not support any type of real numbers, so we are using integers where division always rounds down.
For the MP logic, this would break the minting, as it usually would get something like .1, .01, and try to multiply that by the balance to find how much to increase. This will always return zero in current code.
Possible solutions:
Read more: