ditto-lab / ditto

NFT Future protocol
MIT License
60 stars 3 forks source link

Can remove `0` check in `cbrt` function? #71

Closed calvbore closed 1 year ago

calvbore commented 1 year ago

https://github.com/ditto-lab/ditto/blob/6d04912f15957206d33bb39e8d9f8a2c02bee4a5/src/TimeCurve.sol#L15 If 0 is never passed to the cube root function we can remove this line of code.

0xbok commented 1 year ago

agree

calvbore commented 1 year ago

@0xbok We may also be able to create a cube root function that is much less ugly by using log2 from abdk's solidity library 2**(log_2(x) / 3) But I'm not sure how that will play out with gas costs.

0xbok commented 1 year ago

can benchmark both versions?

0xbok commented 1 year ago

https://github.com/ditto-lab/ditto/pull/79