UNPKG

@swaptoshi/dex-module

Version:

Klayr decentralized exchange (dex) on-chain module

21 lines 548 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.addDelta = addDelta; const int_1 = require("../int"); function addDelta(_x, _y) { const x = int_1.Uint128.from(_x); const y = int_1.Int128.from(_y); if (y.lt(0)) { const z = x.sub(y.abs()); if (z.gte(x)) { throw new Error('LS'); } return z.toString(); } const z = x.add(y); if (z.lt(x)) { throw new Error('LA'); } return z.toString(); } //# sourceMappingURL=liquidity_math.js.map