redefine fraction as uint16

This commit is contained in:
Tim Olson
2023-10-13 16:53:21 -04:00
parent e82a2ce920
commit b699d76073

View File

@@ -260,8 +260,9 @@ async function placeOrder() {
} else {
window = duration / n
}
const ceil = 10n ** 18n % BigInt(n) ? 1n : 0n
const amtPerTranche = 10n ** 18n / BigInt(n) + ceil
const oneHundredPercent = 65535n // by contract definition of uint16 fraction
const ceil = oneHundredPercent % BigInt(n) ? 1n : 0n
const amtPerTranche = oneHundredPercent / BigInt(n) + ceil
duration -= 15 // subtract 15 seconds so the last tranche completes before the deadline
for (let i = 0; i < n; i++) {
const start = Math.floor(i * (duration / n))