I havent used solidity in the past so I’m stuck on function giveRightToVote . This can only take an address, I guess I would need to pass a list of addresses in order to have fewer transactions when wanting to pass multiple addresses using this function. Is this the right thing to do?
Dec 27, 2021, 8:28 AM
single address
anyone familiar with the masterchef contract?
there's a number 1e12 which I couldn't figure out.
https://etherscan.io/address/0xc2EdaD668740f1aA35E4D8f227fB8E17dcA888Cd#code
there's a number 1e12 which I couldn't figure out.
https://etherscan.io/address/0xc2EdaD668740f1aA35E4D8f227fB8E17dcA888Cd#code
where this 1e12 number is coming from?
Dec 27, 2021, 10:06 AM
Line 1423 uint256 accSushiPerShare; // Accumulated SUSHIs per share, times 1e12. See below.
Dec 27, 2021, 10:10 AM
Extrapolating the reward value to 12 decimals
So that non whales who deposit 0.000001 token will still get reward
Dec 27, 2021, 11:52 AM
I see but couldn't find the source for this 1e12.
Why not use 1e18/1e16 or any similar number?
Why not use 1e18/1e16 or any similar number?
Dec 27, 2021, 12:15 PM
It's up to the developer to pick the precision. As long as it's applied consistently and suits the use case you can pick anything.
Dec 27, 2021, 12:15 PM
So the developer couldve gone with 1e18 to be consistent with the token's decimal?
Dec 27, 2021, 12:18 PM
Yes but its not neccessarily related. Not just the token has decimals. Any value you work with can have a precision, doesnt have to 10^18 always
Dec 27, 2021, 12:21 PM
like with 1e12 the minimum value is
100000000000 (11 zero)
with 1e18 it is
100000000000000000 (17 zero)
is it correct?
100000000000 (11 zero)
with 1e18 it is
100000000000000000 (17 zero)
is it correct?
you mean 100000000000 (11 zero) value*10**18?
Dec 27, 2021, 12:28 PM
12 zero as its 1e12
shares are measured in uint, without considering decimals
Well Metamask uses infura, so I'd say yes :)
Dec 27, 2021, 12:33 PM
that's confusing.
so it's 1 with 12 zero, right?
so it's 1 with 12 zero, right?
Dec 27, 2021, 12:33 PM
Why dont you just try it by writing some basic test code? Its 100 times easier than chatting about it.
Dec 27, 2021, 12:33 PM
ok thanks i will go on
Dec 27, 2021, 12:33 PM
^
Dec 27, 2021, 12:34 PM
cause i need to understand some basics first to write the tests?
Dec 27, 2021, 12:34 PM
Or go through sushi git
I think they already have test case written
Dec 27, 2021, 12:34 PM
It is farily simple, lets say you have the number 34.12 and 12 decimals / 10^12 (or 1e12) precision:
Conversion to 12 decimals: 34.12 * 10^12 = 34120000000000
Conversion back: 34120000000000 / 10^12 = 34.12
Conversion to 12 decimals: 34.12 * 10^12 = 34120000000000
Conversion back: 34120000000000 / 10^12 = 34.12
If you are too lazy to code you can convert the notation with tools like this: https://www.calculatorsoup.com/calculators/math/scientific-notation-converter.php
Dec 27, 2021, 12:38 PM
Lets see
Dec 27, 2021, 12:41 PM
You can look into this commit (it says precision)
https://github.com/sushiswap/sushiswap/commit/8436504406c1f3437a51d9acc678cb597291a1e6#diff-b094db7ce2f99cbcbde7ec178a6754bac666e2192f076807acbd70d49ddd0559
https://github.com/sushiswap/sushiswap/commit/8436504406c1f3437a51d9acc678cb597291a1e6#diff-b094db7ce2f99cbcbde7ec178a6754bac666e2192f076807acbd70d49ddd0559
Dec 27, 2021, 1:03 PM