@cryptoalgebra/alm-sdk
Version:
Algebra ALM SDK
2,531 lines (2,523 loc) • 259 kB
JavaScript
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var graphqlRequest = require('graphql-request');
var address = require('@ethersproject/address');
var ethers = require('ethers');
var NodeCache = _interopDefault(require('node-cache'));
var bignumber_js = require('bignumber.js');
var units = require('@ethersproject/units');
var bignumber = require('@ethersproject/bignumber');
var contracts = require('@ethersproject/contracts');
var abi = require('@ethersproject/abi');
var constants = require('@ethersproject/constants');
function _arrayLikeToArray(r, a) {
(null == a || a > r.length) && (a = r.length);
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
return n;
}
function asyncGeneratorStep(n, t, e, r, o, a, c) {
try {
var i = n[a](c),
u = i.value;
} catch (n) {
return void e(n);
}
i.done ? t(u) : Promise.resolve(u).then(r, o);
}
function _asyncToGenerator(n) {
return function () {
var t = this,
e = arguments;
return new Promise(function (r, o) {
var a = n.apply(t, e);
function _next(n) {
asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
}
function _throw(n) {
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
}
_next(void 0);
});
};
}
function _createForOfIteratorHelperLoose(r, e) {
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (t) return (t = t.call(r)).next.bind(t);
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
t && (r = t);
var o = 0;
return function () {
return o >= r.length ? {
done: !0
} : {
done: !1,
value: r[o++]
};
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _extends() {
return _extends = Object.assign ? Object.assign.bind() : function (n) {
for (var e = 1; e < arguments.length; e++) {
var t = arguments[e];
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
}
return n;
}, _extends.apply(null, arguments);
}
function _regenerator() {
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
var e,
t,
r = "function" == typeof Symbol ? Symbol : {},
n = r.iterator || "@@iterator",
o = r.toStringTag || "@@toStringTag";
function i(r, n, o, i) {
var c = n && n.prototype instanceof Generator ? n : Generator,
u = Object.create(c.prototype);
return _regeneratorDefine(u, "_invoke", function (r, n, o) {
var i,
c,
u,
f = 0,
p = o || [],
y = !1,
G = {
p: 0,
n: 0,
v: e,
a: d,
f: d.bind(e, 4),
d: function (t, r) {
return i = t, c = 0, u = e, G.n = r, a;
}
};
function d(r, n) {
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
var o,
i = p[t],
d = G.p,
l = i[2];
r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
}
if (o || r > 1) return a;
throw y = !0, n;
}
return function (o, p, l) {
if (f > 1) throw TypeError("Generator is already running");
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
try {
if (f = 2, i) {
if (c || (o = "next"), t = i[o]) {
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
if (!t.done) return t;
u = t.value, c < 2 && (c = 0);
} else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
i = e;
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
} catch (t) {
i = e, c = 1, u = t;
} finally {
f = 1;
}
}
return {
value: t,
done: y
};
};
}(r, o, i), !0), u;
}
var a = {};
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
t = Object.getPrototypeOf;
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
return this;
}), t),
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
function f(e) {
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
}
return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
return this;
}), _regeneratorDefine(u, "toString", function () {
return "[object Generator]";
}), (_regenerator = function () {
return {
w: i,
m: f
};
})();
}
function _regeneratorDefine(e, r, n, t) {
var i = Object.defineProperty;
try {
i({}, "", {});
} catch (e) {
i = 0;
}
_regeneratorDefine = function (e, r, n, t) {
function o(r, n) {
_regeneratorDefine(e, r, function (e) {
return this._invoke(r, n, e);
});
}
r ? i ? i(e, r, {
value: n,
enumerable: !t,
configurable: !t,
writable: !t
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
}, _regeneratorDefine(e, r, n, t);
}
function _taggedTemplateLiteralLoose(e, t) {
return t || (t = e.slice(0)), e.raw = t, e;
}
function _unsupportedIterableToArray(r, a) {
if (r) {
if ("string" == typeof r) return _arrayLikeToArray(r, a);
var t = {}.toString.call(r).slice(8, -1);
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
}
}
(function (SupportedChainId) {
SupportedChainId[SupportedChainId["Base"] = 8453] = "Base";
SupportedChainId[SupportedChainId["BaseSepolia"] = 84532] = "BaseSepolia";
})(exports.SupportedChainId || (exports.SupportedChainId = {}));
var algebraVaultDecimals = 18;
/* Autogenerated file. Do not edit manually. */
var _abi = [{
inputs: [],
name: "AddressZero",
type: "error"
}, {
inputs: [],
name: "alreadyInitialized",
type: "error"
}, {
inputs: [],
name: "arithmeticError",
type: "error"
}, {
inputs: [],
name: "bottomTickLowerThanMIN",
type: "error"
}, {
inputs: [],
name: "dynamicFeeActive",
type: "error"
}, {
inputs: [],
name: "dynamicFeeDisabled",
type: "error"
}, {
inputs: [],
name: "flashInsufficientPaid0",
type: "error"
}, {
inputs: [],
name: "flashInsufficientPaid1",
type: "error"
}, {
inputs: [],
name: "insufficientInputAmount",
type: "error"
}, {
inputs: [],
name: "invalidAmountRequired",
type: "error"
}, {
inputs: [{
internalType: "bytes4",
name: "expectedSelector",
type: "bytes4"
}],
name: "invalidHookResponse",
type: "error"
}, {
inputs: [],
name: "invalidLimitSqrtPrice",
type: "error"
}, {
inputs: [],
name: "invalidNewCommunityFee",
type: "error"
}, {
inputs: [],
name: "invalidNewTickSpacing",
type: "error"
}, {
inputs: [],
name: "liquidityAdd",
type: "error"
}, {
inputs: [],
name: "liquidityOverflow",
type: "error"
}, {
inputs: [],
name: "liquiditySub",
type: "error"
}, {
inputs: [],
name: "locked",
type: "error"
}, {
inputs: [],
name: "notAllowed",
type: "error"
}, {
inputs: [],
name: "notInitialized",
type: "error"
}, {
inputs: [],
name: "pluginIsNotConnected",
type: "error"
}, {
inputs: [],
name: "priceOutOfRange",
type: "error"
}, {
inputs: [],
name: "tickInvalidLinks",
type: "error"
}, {
inputs: [],
name: "tickIsNotInitialized",
type: "error"
}, {
inputs: [],
name: "tickIsNotSpaced",
type: "error"
}, {
inputs: [],
name: "tickOutOfRange",
type: "error"
}, {
inputs: [],
name: "topTickAboveMAX",
type: "error"
}, {
inputs: [],
name: "topTickLowerOrEqBottomTick",
type: "error"
}, {
inputs: [],
name: "transferFailed",
type: "error"
}, {
inputs: [],
name: "zeroAmountRequired",
type: "error"
}, {
inputs: [],
name: "zeroLiquidityActual",
type: "error"
}, {
inputs: [],
name: "zeroLiquidityDesired",
type: "error"
}, {
anonymous: false,
inputs: [{
indexed: true,
internalType: "address",
name: "owner",
type: "address"
}, {
indexed: true,
internalType: "int24",
name: "bottomTick",
type: "int24"
}, {
indexed: true,
internalType: "int24",
name: "topTick",
type: "int24"
}, {
indexed: false,
internalType: "uint128",
name: "liquidityAmount",
type: "uint128"
}, {
indexed: false,
internalType: "uint256",
name: "amount0",
type: "uint256"
}, {
indexed: false,
internalType: "uint256",
name: "amount1",
type: "uint256"
}],
name: "Burn",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: true,
internalType: "address",
name: "owner",
type: "address"
}, {
indexed: false,
internalType: "address",
name: "recipient",
type: "address"
}, {
indexed: true,
internalType: "int24",
name: "bottomTick",
type: "int24"
}, {
indexed: true,
internalType: "int24",
name: "topTick",
type: "int24"
}, {
indexed: false,
internalType: "uint128",
name: "amount0",
type: "uint128"
}, {
indexed: false,
internalType: "uint128",
name: "amount1",
type: "uint128"
}],
name: "Collect",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: false,
internalType: "uint16",
name: "communityFeeNew",
type: "uint16"
}],
name: "CommunityFee",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: false,
internalType: "address",
name: "newCommunityVault",
type: "address"
}],
name: "CommunityVault",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: false,
internalType: "uint16",
name: "fee",
type: "uint16"
}],
name: "Fee",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: true,
internalType: "address",
name: "sender",
type: "address"
}, {
indexed: true,
internalType: "address",
name: "recipient",
type: "address"
}, {
indexed: false,
internalType: "uint256",
name: "amount0",
type: "uint256"
}, {
indexed: false,
internalType: "uint256",
name: "amount1",
type: "uint256"
}, {
indexed: false,
internalType: "uint256",
name: "paid0",
type: "uint256"
}, {
indexed: false,
internalType: "uint256",
name: "paid1",
type: "uint256"
}],
name: "Flash",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: false,
internalType: "uint160",
name: "price",
type: "uint160"
}, {
indexed: false,
internalType: "int24",
name: "tick",
type: "int24"
}],
name: "Initialize",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: false,
internalType: "address",
name: "sender",
type: "address"
}, {
indexed: true,
internalType: "address",
name: "owner",
type: "address"
}, {
indexed: true,
internalType: "int24",
name: "bottomTick",
type: "int24"
}, {
indexed: true,
internalType: "int24",
name: "topTick",
type: "int24"
}, {
indexed: false,
internalType: "uint128",
name: "liquidityAmount",
type: "uint128"
}, {
indexed: false,
internalType: "uint256",
name: "amount0",
type: "uint256"
}, {
indexed: false,
internalType: "uint256",
name: "amount1",
type: "uint256"
}],
name: "Mint",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: false,
internalType: "address",
name: "newPluginAddress",
type: "address"
}],
name: "Plugin",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: false,
internalType: "uint8",
name: "newPluginConfig",
type: "uint8"
}],
name: "PluginConfig",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: true,
internalType: "address",
name: "sender",
type: "address"
}, {
indexed: true,
internalType: "address",
name: "recipient",
type: "address"
}, {
indexed: false,
internalType: "int256",
name: "amount0",
type: "int256"
}, {
indexed: false,
internalType: "int256",
name: "amount1",
type: "int256"
}, {
indexed: false,
internalType: "uint160",
name: "price",
type: "uint160"
}, {
indexed: false,
internalType: "uint128",
name: "liquidity",
type: "uint128"
}, {
indexed: false,
internalType: "int24",
name: "tick",
type: "int24"
}],
name: "Swap",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: false,
internalType: "int24",
name: "newTickSpacing",
type: "int24"
}],
name: "TickSpacing",
type: "event"
}, {
inputs: [{
internalType: "int24",
name: "bottomTick",
type: "int24"
}, {
internalType: "int24",
name: "topTick",
type: "int24"
}, {
internalType: "uint128",
name: "amount",
type: "uint128"
}, {
internalType: "bytes",
name: "data",
type: "bytes"
}],
name: "burn",
outputs: [{
internalType: "uint256",
name: "amount0",
type: "uint256"
}, {
internalType: "uint256",
name: "amount1",
type: "uint256"
}],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "erc20Rebasing_",
type: "address"
}, {
internalType: "address",
name: "recipient_",
type: "address"
}, {
internalType: "uint256",
name: "amount_",
type: "uint256"
}],
name: "claim",
outputs: [{
internalType: "uint256",
name: "",
type: "uint256"
}],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "recipient",
type: "address"
}, {
internalType: "int24",
name: "bottomTick",
type: "int24"
}, {
internalType: "int24",
name: "topTick",
type: "int24"
}, {
internalType: "uint128",
name: "amount0Requested",
type: "uint128"
}, {
internalType: "uint128",
name: "amount1Requested",
type: "uint128"
}],
name: "collect",
outputs: [{
internalType: "uint128",
name: "amount0",
type: "uint128"
}, {
internalType: "uint128",
name: "amount1",
type: "uint128"
}],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [],
name: "communityFeeLastTimestamp",
outputs: [{
internalType: "uint32",
name: "",
type: "uint32"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "communityVault",
outputs: [{
internalType: "address",
name: "",
type: "address"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "erc20Rebasing_",
type: "address"
}, {
internalType: "enum YieldMode",
name: "mode_",
type: "uint8"
}],
name: "configure",
outputs: [{
internalType: "uint256",
name: "",
type: "uint256"
}],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [],
name: "factory",
outputs: [{
internalType: "address",
name: "",
type: "address"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "fee",
outputs: [{
internalType: "uint16",
name: "currentFee",
type: "uint16"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "recipient",
type: "address"
}, {
internalType: "uint256",
name: "amount0",
type: "uint256"
}, {
internalType: "uint256",
name: "amount1",
type: "uint256"
}, {
internalType: "bytes",
name: "data",
type: "bytes"
}],
name: "flash",
outputs: [],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [],
name: "getCommunityFeePending",
outputs: [{
internalType: "uint128",
name: "",
type: "uint128"
}, {
internalType: "uint128",
name: "",
type: "uint128"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "getReserves",
outputs: [{
internalType: "uint128",
name: "",
type: "uint128"
}, {
internalType: "uint128",
name: "",
type: "uint128"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "globalState",
outputs: [{
internalType: "uint160",
name: "price",
type: "uint160"
}, {
internalType: "int24",
name: "tick",
type: "int24"
}, {
internalType: "uint16",
name: "lastFee",
type: "uint16"
}, {
internalType: "uint8",
name: "pluginConfig",
type: "uint8"
}, {
internalType: "uint16",
name: "communityFee",
type: "uint16"
}, {
internalType: "bool",
name: "unlocked",
type: "bool"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [{
internalType: "uint160",
name: "initialPrice",
type: "uint160"
}],
name: "initialize",
outputs: [],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [],
name: "isUnlocked",
outputs: [{
internalType: "bool",
name: "unlocked",
type: "bool"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "liquidity",
outputs: [{
internalType: "uint128",
name: "",
type: "uint128"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "maxLiquidityPerTick",
outputs: [{
internalType: "uint128",
name: "",
type: "uint128"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "leftoversRecipient",
type: "address"
}, {
internalType: "address",
name: "recipient",
type: "address"
}, {
internalType: "int24",
name: "bottomTick",
type: "int24"
}, {
internalType: "int24",
name: "topTick",
type: "int24"
}, {
internalType: "uint128",
name: "liquidityDesired",
type: "uint128"
}, {
internalType: "bytes",
name: "data",
type: "bytes"
}],
name: "mint",
outputs: [{
internalType: "uint256",
name: "amount0",
type: "uint256"
}, {
internalType: "uint256",
name: "amount1",
type: "uint256"
}, {
internalType: "uint128",
name: "liquidityActual",
type: "uint128"
}],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [],
name: "nextTickGlobal",
outputs: [{
internalType: "int24",
name: "",
type: "int24"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "plugin",
outputs: [{
internalType: "address",
name: "",
type: "address"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [{
internalType: "bytes32",
name: "",
type: "bytes32"
}],
name: "positions",
outputs: [{
internalType: "uint256",
name: "liquidity",
type: "uint256"
}, {
internalType: "uint256",
name: "innerFeeGrowth0Token",
type: "uint256"
}, {
internalType: "uint256",
name: "innerFeeGrowth1Token",
type: "uint256"
}, {
internalType: "uint128",
name: "fees0",
type: "uint128"
}, {
internalType: "uint128",
name: "fees1",
type: "uint128"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "prevTickGlobal",
outputs: [{
internalType: "int24",
name: "",
type: "int24"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "safelyGetStateOfAMM",
outputs: [{
internalType: "uint160",
name: "sqrtPrice",
type: "uint160"
}, {
internalType: "int24",
name: "tick",
type: "int24"
}, {
internalType: "uint16",
name: "lastFee",
type: "uint16"
}, {
internalType: "uint8",
name: "pluginConfig",
type: "uint8"
}, {
internalType: "uint128",
name: "activeLiquidity",
type: "uint128"
}, {
internalType: "int24",
name: "nextTick",
type: "int24"
}, {
internalType: "int24",
name: "previousTick",
type: "int24"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [{
internalType: "uint16",
name: "newCommunityFee",
type: "uint16"
}],
name: "setCommunityFee",
outputs: [],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "newCommunityVault",
type: "address"
}],
name: "setCommunityVault",
outputs: [],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [{
internalType: "uint16",
name: "newFee",
type: "uint16"
}],
name: "setFee",
outputs: [],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "newPluginAddress",
type: "address"
}],
name: "setPlugin",
outputs: [],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [{
internalType: "uint8",
name: "newConfig",
type: "uint8"
}],
name: "setPluginConfig",
outputs: [],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [{
internalType: "int24",
name: "newTickSpacing",
type: "int24"
}],
name: "setTickSpacing",
outputs: [],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "recipient",
type: "address"
}, {
internalType: "bool",
name: "zeroToOne",
type: "bool"
}, {
internalType: "int256",
name: "amountRequired",
type: "int256"
}, {
internalType: "uint160",
name: "limitSqrtPrice",
type: "uint160"
}, {
internalType: "bytes",
name: "data",
type: "bytes"
}],
name: "swap",
outputs: [{
internalType: "int256",
name: "amount0",
type: "int256"
}, {
internalType: "int256",
name: "amount1",
type: "int256"
}],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "leftoversRecipient",
type: "address"
}, {
internalType: "address",
name: "recipient",
type: "address"
}, {
internalType: "bool",
name: "zeroToOne",
type: "bool"
}, {
internalType: "int256",
name: "amountToSell",
type: "int256"
}, {
internalType: "uint160",
name: "limitSqrtPrice",
type: "uint160"
}, {
internalType: "bytes",
name: "data",
type: "bytes"
}],
name: "swapWithPaymentInAdvance",
outputs: [{
internalType: "int256",
name: "amount0",
type: "int256"
}, {
internalType: "int256",
name: "amount1",
type: "int256"
}],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [],
name: "tickSpacing",
outputs: [{
internalType: "int24",
name: "",
type: "int24"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [{
internalType: "int16",
name: "",
type: "int16"
}],
name: "tickTable",
outputs: [{
internalType: "uint256",
name: "",
type: "uint256"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "tickTreeRoot",
outputs: [{
internalType: "uint32",
name: "",
type: "uint32"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [{
internalType: "int16",
name: "",
type: "int16"
}],
name: "tickTreeSecondLayer",
outputs: [{
internalType: "uint256",
name: "",
type: "uint256"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [{
internalType: "int24",
name: "",
type: "int24"
}],
name: "ticks",
outputs: [{
internalType: "uint256",
name: "liquidityTotal",
type: "uint256"
}, {
internalType: "int128",
name: "liquidityDelta",
type: "int128"
}, {
internalType: "int24",
name: "prevTick",
type: "int24"
}, {
internalType: "int24",
name: "nextTick",
type: "int24"
}, {
internalType: "uint256",
name: "outerFeeGrowth0Token",
type: "uint256"
}, {
internalType: "uint256",
name: "outerFeeGrowth1Token",
type: "uint256"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "token0",
outputs: [{
internalType: "address",
name: "",
type: "address"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "token1",
outputs: [{
internalType: "address",
name: "",
type: "address"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "totalFeeGrowth0Token",
outputs: [{
internalType: "uint256",
name: "",
type: "uint256"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "totalFeeGrowth1Token",
outputs: [{
internalType: "uint256",
name: "",
type: "uint256"
}],
stateMutability: "view",
type: "function"
}];
var AlgebraPool__factory = /*#__PURE__*/function () {
function AlgebraPool__factory() {}
AlgebraPool__factory.createInterface = function createInterface() {
return new ethers.utils.Interface(_abi);
};
AlgebraPool__factory.connect = function connect(address, signerOrProvider) {
return new ethers.Contract(address, _abi, signerOrProvider);
};
return AlgebraPool__factory;
}();
AlgebraPool__factory.abi = _abi;
/* Autogenerated file. Do not edit manually. */
var _abi$1 = [{
inputs: [{
internalType: "address",
name: "_pool",
type: "address"
}, {
internalType: "bool",
name: "_allowToken0",
type: "bool"
}, {
internalType: "bool",
name: "_allowToken1",
type: "bool"
}, {
internalType: "uint32",
name: "_twapPeriod",
type: "uint32"
}, {
internalType: "uint256",
name: "_vaultIndex",
type: "uint256"
}],
stateMutability: "nonpayable",
type: "constructor"
}, {
inputs: [],
name: "AlgebraDisconnectedPlugin",
type: "error"
}, {
inputs: [],
name: "EmptyVault",
type: "error"
}, {
inputs: [],
name: "IdenticalPositions",
type: "error"
}, {
inputs: [],
name: "InvalidDeposit",
type: "error"
}, {
inputs: [],
name: "InvalidPosition",
type: "error"
}, {
inputs: [],
name: "NotManager",
type: "error"
}, {
inputs: [],
name: "NotRebalancer",
type: "error"
}, {
inputs: [],
name: "TokensOwed",
type: "error"
}, {
inputs: [],
name: "ZeroAddress",
type: "error"
}, {
inputs: [],
name: "ZeroValue",
type: "error"
}, {
anonymous: false,
inputs: [{
indexed: true,
internalType: "address",
name: "sender",
type: "address"
}, {
indexed: false,
internalType: "address",
name: "affiliate",
type: "address"
}],
name: "Affiliate",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: true,
internalType: "address",
name: "sender",
type: "address"
}, {
indexed: false,
internalType: "address",
name: "ammFeeRecipient",
type: "address"
}],
name: "AmmFeeRecipient",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: true,
internalType: "address",
name: "owner",
type: "address"
}, {
indexed: true,
internalType: "address",
name: "spender",
type: "address"
}, {
indexed: false,
internalType: "uint256",
name: "value",
type: "uint256"
}],
name: "Approval",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: true,
internalType: "address",
name: "sender",
type: "address"
}, {
indexed: false,
internalType: "uint256",
name: "feeAmount0",
type: "uint256"
}, {
indexed: false,
internalType: "uint256",
name: "feeAmount1",
type: "uint256"
}],
name: "CollectFees",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: true,
internalType: "address",
name: "sender",
type: "address"
}, {
indexed: true,
internalType: "address",
name: "pool",
type: "address"
}, {
indexed: false,
internalType: "bool",
name: "allowToken0",
type: "bool"
}, {
indexed: false,
internalType: "bool",
name: "allowToken1",
type: "bool"
}, {
indexed: false,
internalType: "uint256",
name: "twapPeriod",
type: "uint256"
}],
name: "DeployAlgebraVault",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: true,
internalType: "address",
name: "sender",
type: "address"
}, {
indexed: true,
internalType: "address",
name: "to",
type: "address"
}, {
indexed: false,
internalType: "uint256",
name: "shares",
type: "uint256"
}, {
indexed: false,
internalType: "uint256",
name: "amount0",
type: "uint256"
}, {
indexed: false,
internalType: "uint256",
name: "amount1",
type: "uint256"
}],
name: "Deposit",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: true,
internalType: "address",
name: "sender",
type: "address"
}, {
indexed: false,
internalType: "uint256",
name: "deposit0Max",
type: "uint256"
}, {
indexed: false,
internalType: "uint256",
name: "deposit1Max",
type: "uint256"
}],
name: "DepositMax",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: true,
internalType: "address",
name: "sender",
type: "address"
}, {
indexed: false,
internalType: "address",
name: "farmingContract",
type: "address"
}],
name: "FarmingContract",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: true,
internalType: "address",
name: "sender",
type: "address"
}, {
indexed: false,
internalType: "uint256",
name: "hysteresis",
type: "uint256"
}],
name: "Hysteresis",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: false,
internalType: "int24",
name: "tick",
type: "int24"
}, {
indexed: false,
internalType: "uint256",
name: "totalAmount0",
type: "uint256"
}, {
indexed: false,
internalType: "uint256",
name: "totalAmount1",
type: "uint256"
}, {
indexed: false,
internalType: "uint256",
name: "feeAmount0",
type: "uint256"
}, {
indexed: false,
internalType: "uint256",
name: "feeAmount1",
type: "uint256"
}, {
indexed: false,
internalType: "uint256",
name: "totalSupply",
type: "uint256"
}],
name: "Rebalance",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: true,
internalType: "address",
name: "sender",
type: "address"
}, {
indexed: false,
internalType: "address",
name: "rebalanceManager",
type: "address"
}],
name: "RebalanceManager",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: false,
internalType: "uint256",
name: "reward",
type: "uint256"
}, {
indexed: false,
internalType: "uint256",
name: "bonusReward",
type: "uint256"
}],
name: "RewardsCollected",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: false,
internalType: "address",
name: "sender",
type: "address"
}, {
indexed: false,
internalType: "uint32",
name: "newAuxTwapPeriod",
type: "uint32"
}],
name: "SetAuxTwapPeriod",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: false,
internalType: "address",
name: "sender",
type: "address"
}, {
indexed: false,
internalType: "uint32",
name: "newTwapPeriod",
type: "uint32"
}],
name: "SetTwapPeriod",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: true,
internalType: "address",
name: "from",
type: "address"
}, {
indexed: true,
internalType: "address",
name: "to",
type: "address"
}, {
indexed: false,
internalType: "uint256",
name: "value",
type: "uint256"
}],
name: "Transfer",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: true,
internalType: "address",
name: "sender",
type: "address"
}, {
indexed: true,
internalType: "address",
name: "to",
type: "address"
}, {
indexed: false,
internalType: "uint256",
name: "shares",
type: "uint256"
}, {
indexed: false,
internalType: "uint256",
name: "amount0",
type: "uint256"
}, {
indexed: false,
internalType: "uint256",
name: "amount1",
type: "uint256"
}],
name: "Withdraw",
type: "event"
}, {
inputs: [],
name: "PRECISION",
outputs: [{
internalType: "uint256",
name: "",
type: "uint256"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "affiliate",
outputs: [{
internalType: "address",
name: "",
type: "address"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [{
internalType: "int256",
name: "amount0Delta",
type: "int256"
}, {
internalType: "int256",
name: "amount1Delta",
type: "int256"
}, {
internalType: "bytes",
name: "",
type: "bytes"
}],
name: "algebraSwapCallback",
outputs: [],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [],
name: "algebraVaultFactory",
outputs: [{
internalType: "address",
name: "",
type: "address"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "allowToken0",
outputs: [{
internalType: "bool",
name: "",
type: "bool"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "allowToken1",
outputs: [{
internalType: "bool",
name: "",
type: "bool"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "owner",
type: "address"
}, {
internalType: "address",
name: "spender",
type: "address"
}],
name: "allowance",
outputs: [{
internalType: "uint256",
name: "",
type: "uint256"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "ammFeeRecipient",
outputs: [{
internalType: "address",
name: "",
type: "address"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "spender",
type: "address"
}, {
internalType: "uint256",
name: "amount",
type: "uint256"
}],
name: "approve",
outputs: [{
internalType: "bool",
name: "",
type: "bool"
}],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [],
name: "auxTwapPeriod",
outputs: [{
internalType: "uint32",
name: "",
type: "uint32"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "account",
type: "address"
}],
name: "balanceOf",
outputs: [{
internalType: "uint256",
name: "",
type: "uint256"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "baseLower",
outputs: [{
internalType: "int24",
name: "",
type: "int24"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "basePositionId",
outputs: [{
internalType: "uint256",
name: "",
type: "uint256"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "baseUpper",
outputs: [{
internalType: "int24",
name: "",
type: "int24"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "collectFees",
outputs: [{
internalType: "uint256",
name: "fees0",
type: "uint256"
}, {
internalType: "uint256",
name: "fees1",
type: "uint256"
}],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [],
name: "collectRewards",
outputs: [],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [],
name: "currentTick",
outputs: [{
internalType: "int24",
name: "tick",
type: "int24"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "decimals",
outputs: [{
internalType: "uint8",
name: "",
type: "uint8"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "spender",
type: "address"
}, {
internalType: "uint256",
name: "subtractedValue",
type: "uint256"
}],
name: "decreaseAllowance",
outputs: [{
internalType: "bool",
name: "",
type: "bool"
}],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [{
internalType: "uint256",
name: "deposit0",
type: "uint256"
}, {
internalType: "uint256",
name: "deposit1",
type: "uint256"
}, {
internalType: "address",
name: "to",
type: "address"
}],
name: "deposit",
outputs: [{
internalType: "uint256",
name: "shares",
type: "uint256"
}],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [],
name: "deposit0Max",
outputs: [{
internalType: "uint256",
name: "",
type: "uint256"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "deposit1Max",
outputs: [{
internalType: "uint256",
name: "",
type: "uint256"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "farmingRewardsDistributor",
outputs: [{
internalType: "address",
name: "",
type: "address"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "fee",
outputs: [{
internalType: "uint24",
name: "fee_",
type: "uint24"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "getBasePosition",
outputs: [{
internalType: "uint128",
name: "liquidity",
type: "uint128"
}, {
internalType: "uint256",
name: "amount0",
type: "uint256"
}, {
internalType: "uint256",
name: "amount1",
type: "uint256"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "getLimitPosition",
outputs: [{
internalType: "uint128",
name: "liquidity",
type: "uint128"
}, {
internalType: "uint256",
name: "amount0",
type: "uint256"
}, {
internalType: "uint256",
name: "amount1",
type: "uint256"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "getTotalAmounts",
outputs: [{
internalType: "uint256",
name: "total0",
type: "uint256"
}, {
internalType: "uint256",
name: "total1",
type: "uint256"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "hysteresis",
outputs: [{
internalType: "uint256",
name: "",
type: "uint256"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "spender",
type: "address"
}, {
internalType: "uint256",
name: "addedValue",
type: "uint256"
}],
name: "increaseAllowance",
outputs: [{
internalType: "bool",
name: "",
type: "bool"
}],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [],
name: "limitLower",
outputs: [{
internalType: "int24",
name: "",
type: "int24"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "limitPositionId",
outputs: [{
internalType: "uint256",
name: "",
type: "uint256"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "limitUpper",
outputs: [{
internalType: "int24",
name: "",
type: "int24"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "name",
outputs: [{
internalType: "string",
name: "",
type: "string"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "pool",
outputs: [{
internalType: "address",
name: "",
type: "address"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [{
internalType: "int24",
name: "_baseLower",
type: "int24"
}, {
internalType: "int24",
name: "_baseUpper",
type: "int24"
}, {
internalType: "int24",
name: "_limitLower",
type: "int24"
}, {
internalType: "int24",
name: "_limitUpper",
type: "int24"
}, {
internalType: "int256",
name: "swapQuantity",
type: "int256"
}],
name: "rebalance",
outputs: [],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [],
name: "rebalanceManager",
outputs: [{
internalType: "address",
name: "",
type: "address"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "_affiliate",
type: "address"
}],
name: "setAffiliate",
outputs: [],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "_ammFeeRecipient",
type: "address"
}],
name: "setAmmFeeRecipient",
outputs: [],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [{
internalType: "uint32",
name: "newAuxTwapPeriod",
type: "uint32"
}],
name: "setAuxTwapPeriod",
outputs: [],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [{
internalType: "uint256",
name: "_deposit0Max",
type: "uint256"
}, {
internalType: "uint256",
name: "_deposit1Max",
type: "uint256"
}],
name: "setDepositMax",
outputs: [],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "_farmingRewardsDistributor",
type: "address"
}],
name: "setFarmingRewardsDistributor",
outputs: [],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [{
internalType: "uint256",
name: "_hysteresis",
type: "uint256"
}],
name: "setHysteresis",
outputs: [],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "_rebalanceManager",
type: "address"
}],
name: "setRebalanceManager",
outputs: [],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [{
internalType: "uint32",
name: "newTwapPeriod",
type: "uint32"
}],
name: "setTwapPeriod",
outputs: [],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [],
name: "symbol",
outputs: [{
internalType: "string",
name: "",
type: "string"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "tickSpacing",
outputs: [{
internalType: "int24",
name: "",
type: "int24"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "token0",
outputs: [{
internalType: "address",
name: "",
type: "address"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "token1",
outputs: [{
internalType: "address",
name: "",
type: "address"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "totalSupply",
outputs: [{
internalType: "uint256",
name: "",
type: "uint256"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "to",
type: "address"
}, {
internalType: "uint256",
name: "amount",
type: "uint256"
}],
name: "transfer",
outputs: [{
internalType: "bool",
name: "",
type: "bool"
}],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "from",
type: "address"
}, {
internalType: "address",
name: "to",
type: "address"
}, {
internalType: "uint256",
name: "amount",
type: "uint256"
}],
name: "transferFrom",
outputs: [{
internalType: "bool",
name: "",
type: "bool"
}],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [],
name: "twapPeriod",
outputs: [{
internalType: "uint32",
name: "",
type: "uint32"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [{
internalType: "uint256",
name: "shares",
type: "uint256"
}, {
internalType: "address",
name: "to",
type: "address"
}],
name: "withdraw",
outputs: [{
internalType: "uint256",
name: "amount0",
type: "uint256"
}, {
internalType: "uint256",
name: "amount1",
type: "uint256"
}],
stateMutability: "nonpayable",
type: "function"
}];
var AlgebraVault__factory = /*#__PURE__*/function () {
function AlgebraVault__factory() {}
AlgebraVault__factory.createInterface = function createInterface() {
return new ethers.utils.Interface(_abi$1);
};
AlgebraVault__factory.connect = function connect(address, signerOrProvider) {
return new ethers.Contract(address, _abi$1, signerOrProvider);
};
return AlgebraVault__factory;
}();
AlgebraVault__factory.abi = _abi$1;
/* Autogenerated file. Do not edit manually. */
var _abi$2 = [{
inputs: [{
internalType: "address",
name: "_AlgebraVaultFactory",
type: "address"
}, {
internalType: "address",
name: "_WRAPPED_NATIVE",
type: "address"
}],
stateMutability: "nonpayable",
type: "constructor"
}, {
anonymous: false,
inputs: [{
indexed: false,
internalType: "address",
name: "_AlgebraVaultFactory",
type: "address"
}, {
indexed: false,
internalType: "address",
name: "_WETH",
type: "address"
}],
name: "Deployed",
type: "event"
}, {
anonymous: false,
inputs: [{
indexed: true,
internalType: "address",
name: "sender",
type: "address"
}, {
indexed: true,
internalType: "address",
name: "vault",
type: "address"
}, {
indexed: true,
internalType: "address",
name: "token",
type: "address"
}, {
indexed: false,
internalType: "uint256",
name: "amount",
type: "uint256"
}, {
indexed: false,
internalType: "uint256",
name: "shares",
type: "uint256"
}, {
indexed: false,
internalType: "address",
name: "to",
type: "address"
}],
name: "DepositForwarded",
type: "event"
}, {
inputs: [],
name: "AlgebraVaultFactory",
outputs: [{
internalType: "address",
name: "",
type: "address"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [],
name: "WRAPPED_NATIVE",
outputs: [{
internalType: "address",
name: "",
type: "address"
}],
stateMutability: "view",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "vault",
type: "address"
}, {
internalType: "address",
name: "vaultDeployer",
type: "address"
}, {
internalType: "address",
name: "token",
type: "address"
}, {
internalType: "uint256",
name: "amount",
type: "uint256"
}, {
internalType: "uint256",
name: "minimumProceeds",
type: "uint256"
}, {
internalType: "address",
name: "to",
type: "address"
}],
name: "forwardDepositToAlgebraVault",
outputs: [{
internalType: "uint256",
name: "vaultTokens",
type: "uint256"
}],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "vault",
type: "address"
}, {
internalType: "address",
name: "vaultDeployer",
type: "address"
}, {
internalType: "uint256",
name: "minimumProceeds",
type: "uint256"
}, {
internalType: "address",
name: "to",
type: "address"
}],
name: "forwardNativeDepositToAlgebraVault",
outputs: [{
internalType: "uint256",
name: "vaultTokens",
type: "uint256"
}],
stateMutability: "payable",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "vault",
type: "address"
}, {
internalType: "address",
name: "vaultDeployer",
type: "address"
}, {
internalType: "uint256",
name: "shares",
type: "uint256"
}, {
internalType: "address",
name: "to",
type: "address"
}, {
internalType: "uint256",
name: "minAmount0",
type: "uint256"
}, {
internalType: "uint256",
name: "minAmount1",
type: "uint256"
}],
name: "forwardNativeWithdrawFromAlgebraVault",
outputs: [{
internalType: "uint256",
name: "amount0",
type: "uint256"
}, {
internalType: "uint256",
name: "amount1",
type: "uint256"
}],
stateMutability: "nonpayable",
type: "function"
}, {
inputs: [{
internalType: "address",
name: "vault",
type: "address"
}, {
internalType: "address",
name: "vaultDeployer",
type: "address"
}, {
internalType: "uint256",
name: "shares",
type: "uint256"
}, {
internalType: "address",
name: "to",
type: "address"
}, {
internalType: "uint256",
name: "minAmount0",
type: "uint256"
}, {
internalType: "uint256",
name: "minAmount1",
type: "uint256"
}],
name: "forwardWithdrawFromAlgebraVault",
outputs: [{
internalType: "uint256",
name: "amount0",
type: "