mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-25 23:27:41 +03:00
update getAmountByORN formula
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.20.10-rc27",
|
||||
"version": "0.20.10-rc28",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.20.10-rc27",
|
||||
"version": "0.20.10-rc28",
|
||||
"hasInstallScript": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.20.10-rc27",
|
||||
"version": "0.20.10-rc28",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/index.cjs",
|
||||
"module": "./lib/index.js",
|
||||
|
||||
@@ -125,15 +125,18 @@ class IndexerService {
|
||||
};
|
||||
|
||||
readonly getAmountByORN = (amountToken: number, timeLock: number) => {
|
||||
const alpha = 730 / (30 - Math.sqrt(730 / 7)) ** (1 / 3);
|
||||
const timestamp = Date.now() / 1000;
|
||||
|
||||
const deltaDaysBN = BigNumber(timeLock).minus(timestamp).dividedBy(DAY);
|
||||
|
||||
if (deltaDaysBN.lte(0)) return 0;
|
||||
|
||||
const multSQRT = deltaDaysBN.dividedBy(WEEK_DAYS).sqrt();
|
||||
const multCUBE = deltaDaysBN.dividedBy(alpha).pow(3);
|
||||
|
||||
return BigNumber(amountToken)
|
||||
.multipliedBy(deltaDaysBN.sqrt())
|
||||
.dividedBy(BigNumber(WEEK_DAYS).sqrt());
|
||||
.multipliedBy(multSQRT.plus(multCUBE));
|
||||
};
|
||||
|
||||
readonly getVotingInfo = (userAddress?: string) => {
|
||||
|
||||
Reference in New Issue
Block a user