Created
March 1, 2019 12:25
-
-
Save kolya-t/2c5d50761020464f7fb97ba66d886c7b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getPrice(heirsCount, tokensCount, checkInterval, activeTo) { | |
const gasPrice = 40000000000; | |
const constructGas = 1660000; | |
const constructGasPerHeir = 40000; | |
const checkGas = 25000; | |
const triggerGas = 32000; | |
const triggerGasPerHeir = 42000; | |
const triggerGasPerToken = 18000; | |
const constructPrice = gasPrice * (constructGas + heirsCount * constructGasPerHeir); | |
const checkCount = Math.max(Math.abs((new Date().getTime() / 1000 - activeTo) / checkInterval), 1); | |
const checkPrice = checkGas * gasPrice * checkCount; | |
const triggerPrice = gasPrice * (triggerGas + triggerGasPerHeir * heirsCount + triggerGasPerToken * tokensCount * 2); | |
return constructPrice + checkPrice + triggerPrice; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment