pontem-network / harvest Goto Github PK
View Code? Open in Web Editor NEWLiquidswap Harvest v1 contracts
License: Other
Liquidswap Harvest v1 contracts
License: Other
In unstake
function we have few invokes of functions where arithmetic error can occur:
let total_reward = to_u128(pool.reward_per_sec) * to_u128(seconds_passed) * SIX_DECIMALS;
pool.accum_reward = pool.accum_reward + total_reward / to_u128(total_stake);
let earned = (accum_reward * (to_u128(user_stake.amount)) / SIX_DECIMALS) - user_stake.unobtainable_reward;
user_stake.earned_reward = user_stake.earned_reward + to_u64(earned);
user_stake.unobtainable_reward = user_stake.unobtainable_reward + earned;
user_stake.unobtainable_reward = (pool.accum_reward * to_u128(user_stake.amount)) / SIX_DECIMALS;
It is necessary to check the correctness of the calculations with boundary values. These calculations are also associated with issue #13.
For now we use six decimals in reward calculations:
const SIX_DECIMALS: u128 = 1000000;
Like in this case, user_stake.amount
is stake coin amount with six decimals and result earned
- amount for reward coin with six decimals:
let earned = (pool.accum_reward * (to_u128(user_stake.amount)) / SIX_DECIMALS) - user_stake.unobtainable_reward;
We need to come up with restrictions on decimals, adapt the calculations to their different values.
I need to update AptosFramework
and related, include Liquidswap, to mainnet contains branches.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.