Timestamp based exchange SCs#1032
Conversation
Coverage SummaryTotals
FilesExpand
|
|
Contract comparison - from 7576adb to 75dd4cb
|
| } | ||
|
|
||
| fn get_amount_apr_bounded(&self, amount: &BigUint) -> BigUint { | ||
| fn get_amount_apr_bounded(&self, amount: &BigUint, division_safety: &BigUint) -> BigUint { |
There was a problem hiding this comment.
Doesn't adding div_safety here mess up all the calculations?
There was a problem hiding this comment.
Indeed, it affects the computations in the unit tests, but it doesn't mean it isn't correct. Furthermore, it is even more accurate to use the division safety constant, so that's why we chose this approach and updated the unit tests.
…tion-logic-update Farm Staking supernova migration logic update
| let per_block_reward_amount: BigUint<Self::Api> = per_block_reward_amount_mapper.take(); | ||
| let last_reward_nonce = last_reward_block_nonce_mapper.take(); | ||
|
|
||
| require!( |
There was a problem hiding this comment.
This should not be a require. For farms that would not produce rewards anymore the upgrade would fail. It should check for the produce rewards flag just to aggregate remaining rewards per block. Otherwise it should do nothing but still do the upgrade
dex/farm/src/lib.rs
Outdated
| let per_block_reward_amount: BigUint<Self::Api> = per_block_reward_amount_mapper.take(); | ||
| let last_reward_nonce = last_reward_block_nonce_mapper.take(); | ||
|
|
||
| require!( |
There was a problem hiding this comment.
This should not be a require. For farms that would not produce rewards anymore the upgrade would fail. It should check for the produce rewards flag just to aggregate remaining rewards per block. Otherwise it should do nothing but still do the upgrade
farm-staking/farm-staking/src/lib.rs
Outdated
| let current_epoch = self.blockchain().get_block_epoch(); | ||
| self.first_week_start_epoch().set_if_empty(current_epoch); | ||
|
|
||
| // Initialize last_reward_timestamp |
There was a problem hiding this comment.
This should be initialized only when the rewards start
farm-staking/farm-staking/src/lib.rs
Outdated
| let last_reward_nonce = last_reward_block_nonce_mapper.take(); | ||
| let per_block_reward = per_block_reward_amount_mapper.take(); | ||
|
|
||
| require!( |
There was a problem hiding this comment.
This should not be a require. For farms that would not produce rewards anymore the upgrade would fail. It should check for the produce rewards flag just to aggregate remaining rewards per block. Otherwise it should do nothing but still do the upgrade
The PR will be open towards an rc branch when all pending feat branches will be merged into main.