tokenlon-contracts icon indicating copy to clipboard operation
tokenlon-contracts copied to clipboard

Add `setMaxLockDuration` function to `add-veLON-impplementation`

Open zeqing-guo opened this issue 3 years ago • 2 comments

Add setMaxLockDuration function to add-veLON-impplementation branch.

Given the correctness and fairness, the code guarantees that if old_power_A > old_power_B, then after updating the maxLockDuration we have new_power_A >= new_power_B.

Code details are as follows:

  • if NFT's lock.end > maxEndTime, we set the lock.end = maxEndTime. Then we update NFT's slope and bias
  • if NFT's lock.end <= maxEndTime, we update NFT's slope and bias directly

After updating every NFT's end, slope, and bias, we will update the global slope and bias.

zeqing-guo avatar Jul 29 '22 06:07 zeqing-guo

No particular issue at the first glance. However this function may consume lots of gas and perhaps exceed block limit? Need some test for gas consumption.

charlesjhongc avatar Jul 29 '22 08:07 charlesjhongc

This one can be closed since we decided to use fixed maxDuration instead.

charlesjhongc avatar Sep 02 '22 06:09 charlesjhongc