maia-core-sdk
Version:
⚒️ An SDK for building applications on top of Maia DAO Ecosytem
1,479 lines • 83.7 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 JSBI = _interopDefault(require('jsbi'));
var invariant = _interopDefault(require('tiny-invariant'));
var address = require('@ethersproject/address');
var _Big = _interopDefault(require('big.js'));
var toFormat = _interopDefault(require('toformat'));
var _Decimal = _interopDefault(require('decimal.js-light'));
var _LZ_CHAIN_ID_FROM_EVM, _EVM_CHAIN_ID_FROM_LZ;
(function (SupportedChainId) {
// Mainnet chainIds
SupportedChainId[SupportedChainId["ARBITRUM_ONE"] = 42161] = "ARBITRUM_ONE";
SupportedChainId[SupportedChainId["MAINNET"] = 1] = "MAINNET";
SupportedChainId[SupportedChainId["OPTIMISM"] = 10] = "OPTIMISM";
SupportedChainId[SupportedChainId["BASE"] = 8453] = "BASE";
SupportedChainId[SupportedChainId["BSC"] = 56] = "BSC";
SupportedChainId[SupportedChainId["POLYGON"] = 137] = "POLYGON";
SupportedChainId[SupportedChainId["AVAX"] = 43114] = "AVAX";
SupportedChainId[SupportedChainId["METIS"] = 1088] = "METIS";
SupportedChainId[SupportedChainId["SONIC"] = 146] = "SONIC";
SupportedChainId[SupportedChainId["BERA"] = 80094] = "BERA";
SupportedChainId[SupportedChainId["FRAXTAL"] = 252] = "FRAXTAL";
SupportedChainId[SupportedChainId["SWELL"] = 1923] = "SWELL";
// Not shown in UI. But has contracts deployed
// FANTOM = 250,
// SCROLL = 534352,
// MANTLE = 5000,
// FRAXTAL = 252,
// GNOSIS = 100,
// Testnet chainIds
SupportedChainId[SupportedChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
SupportedChainId[SupportedChainId["ARBITRUM_SEPOLIA"] = 421614] = "ARBITRUM_SEPOLIA";
SupportedChainId[SupportedChainId["OPTIMISM_SEPOLIA"] = 11155420] = "OPTIMISM_SEPOLIA";
SupportedChainId[SupportedChainId["BASE_SEPOLIA"] = 84532] = "BASE_SEPOLIA";
// Not shown in UI. But has contracts deployed
SupportedChainId[SupportedChainId["POLYGON_AMOY"] = 80002] = "POLYGON_AMOY";
// // Not deployed and shown in UI for now
// AVAX_FUJI = 43113,
// BSC_TESTNET = 97,
// FANTOM_TESTNET = 4002,
})(exports.SupportedChainId || (exports.SupportedChainId = {}));
(function (SupportedLayerzeroChainId) {
// Mainnet chainIds
SupportedLayerzeroChainId[SupportedLayerzeroChainId["ARBITRUM_ONE"] = 110] = "ARBITRUM_ONE";
SupportedLayerzeroChainId[SupportedLayerzeroChainId["MAINNET"] = 101] = "MAINNET";
SupportedLayerzeroChainId[SupportedLayerzeroChainId["OPTIMISM"] = 111] = "OPTIMISM";
SupportedLayerzeroChainId[SupportedLayerzeroChainId["BASE"] = 184] = "BASE";
SupportedLayerzeroChainId[SupportedLayerzeroChainId["POLYGON"] = 109] = "POLYGON";
SupportedLayerzeroChainId[SupportedLayerzeroChainId["BSC"] = 102] = "BSC";
SupportedLayerzeroChainId[SupportedLayerzeroChainId["AVAX"] = 106] = "AVAX";
SupportedLayerzeroChainId[SupportedLayerzeroChainId["METIS"] = 151] = "METIS";
SupportedLayerzeroChainId[SupportedLayerzeroChainId["SONIC"] = 332] = "SONIC";
SupportedLayerzeroChainId[SupportedLayerzeroChainId["BERA"] = 362] = "BERA";
SupportedLayerzeroChainId[SupportedLayerzeroChainId["FRAXTAL"] = 255] = "FRAXTAL";
SupportedLayerzeroChainId[SupportedLayerzeroChainId["SWELL"] = 335] = "SWELL";
// Not shown in UI. But has contracts deployed
// FANTOM = 112,
// SCROLL = 214,
// MANTLE = 181,
// FRAXTAL = 255,
// GNOSIS = 145,
// Testnet chainIds
SupportedLayerzeroChainId[SupportedLayerzeroChainId["SEPOLIA"] = 10161] = "SEPOLIA";
SupportedLayerzeroChainId[SupportedLayerzeroChainId["ARBITRUM_SEPOLIA"] = 10231] = "ARBITRUM_SEPOLIA";
SupportedLayerzeroChainId[SupportedLayerzeroChainId["OPTIMISM_SEPOLIA"] = 10232] = "OPTIMISM_SEPOLIA";
SupportedLayerzeroChainId[SupportedLayerzeroChainId["BASE_SEPOLIA"] = 10245] = "BASE_SEPOLIA";
SupportedLayerzeroChainId[SupportedLayerzeroChainId["POLYGON_AMOY"] = 10267] = "POLYGON_AMOY";
// Not deployed and shown in UI for now
// BSC_TESTNET = 10102,
// AVAX_FUJI = 10106,
// FANTOM_TESTNET = 4002,
})(exports.SupportedLayerzeroChainId || (exports.SupportedLayerzeroChainId = {}));
/**
* Holds the root chain id
*/
var ROOT_CHAIN_ID = exports.SupportedChainId.ARBITRUM_ONE;
/**
* Holds the chain ids to layerzero chain ids for the supported chains
*/
var LZ_CHAIN_ID_FROM_EVM_CHAIN_ID = (_LZ_CHAIN_ID_FROM_EVM = {}, _LZ_CHAIN_ID_FROM_EVM[exports.SupportedChainId.MAINNET] = exports.SupportedLayerzeroChainId.MAINNET, _LZ_CHAIN_ID_FROM_EVM[exports.SupportedChainId.ARBITRUM_ONE] = exports.SupportedLayerzeroChainId.ARBITRUM_ONE, _LZ_CHAIN_ID_FROM_EVM[exports.SupportedChainId.OPTIMISM] = exports.SupportedLayerzeroChainId.OPTIMISM, _LZ_CHAIN_ID_FROM_EVM[exports.SupportedChainId.POLYGON] = exports.SupportedLayerzeroChainId.POLYGON, _LZ_CHAIN_ID_FROM_EVM[exports.SupportedChainId.BSC] = exports.SupportedLayerzeroChainId.BSC, _LZ_CHAIN_ID_FROM_EVM[exports.SupportedChainId.AVAX] = exports.SupportedLayerzeroChainId.AVAX, _LZ_CHAIN_ID_FROM_EVM[exports.SupportedChainId.METIS] = exports.SupportedLayerzeroChainId.METIS, _LZ_CHAIN_ID_FROM_EVM[exports.SupportedChainId.BASE] = exports.SupportedLayerzeroChainId.BASE, _LZ_CHAIN_ID_FROM_EVM[exports.SupportedChainId.SONIC] = exports.SupportedLayerzeroChainId.SONIC, _LZ_CHAIN_ID_FROM_EVM[exports.SupportedChainId.BERA] = exports.SupportedLayerzeroChainId.BERA, _LZ_CHAIN_ID_FROM_EVM[exports.SupportedChainId.FRAXTAL] = exports.SupportedLayerzeroChainId.FRAXTAL, _LZ_CHAIN_ID_FROM_EVM[exports.SupportedChainId.SWELL] = exports.SupportedLayerzeroChainId.SWELL, _LZ_CHAIN_ID_FROM_EVM[exports.SupportedChainId.SEPOLIA] = exports.SupportedLayerzeroChainId.SEPOLIA, _LZ_CHAIN_ID_FROM_EVM[exports.SupportedChainId.ARBITRUM_SEPOLIA] = exports.SupportedLayerzeroChainId.ARBITRUM_SEPOLIA, _LZ_CHAIN_ID_FROM_EVM[exports.SupportedChainId.OPTIMISM_SEPOLIA] = exports.SupportedLayerzeroChainId.OPTIMISM_SEPOLIA, _LZ_CHAIN_ID_FROM_EVM[exports.SupportedChainId.BASE_SEPOLIA] = exports.SupportedLayerzeroChainId.BASE_SEPOLIA, _LZ_CHAIN_ID_FROM_EVM[exports.SupportedChainId.POLYGON_AMOY] = exports.SupportedLayerzeroChainId.POLYGON_AMOY, _LZ_CHAIN_ID_FROM_EVM);
/**
* Holds the layerzero chain ids to chain ids for the supported chains
*/
var EVM_CHAIN_ID_FROM_LZ_CHAIN_ID = (_EVM_CHAIN_ID_FROM_LZ = {}, _EVM_CHAIN_ID_FROM_LZ[exports.SupportedLayerzeroChainId.MAINNET] = exports.SupportedChainId.MAINNET, _EVM_CHAIN_ID_FROM_LZ[exports.SupportedLayerzeroChainId.ARBITRUM_ONE] = exports.SupportedChainId.ARBITRUM_ONE, _EVM_CHAIN_ID_FROM_LZ[exports.SupportedLayerzeroChainId.OPTIMISM] = exports.SupportedChainId.OPTIMISM, _EVM_CHAIN_ID_FROM_LZ[exports.SupportedLayerzeroChainId.POLYGON] = exports.SupportedChainId.POLYGON, _EVM_CHAIN_ID_FROM_LZ[exports.SupportedLayerzeroChainId.BSC] = exports.SupportedChainId.BSC, _EVM_CHAIN_ID_FROM_LZ[exports.SupportedLayerzeroChainId.AVAX] = exports.SupportedChainId.AVAX, _EVM_CHAIN_ID_FROM_LZ[exports.SupportedLayerzeroChainId.METIS] = exports.SupportedChainId.METIS, _EVM_CHAIN_ID_FROM_LZ[exports.SupportedLayerzeroChainId.BASE] = exports.SupportedChainId.BASE, _EVM_CHAIN_ID_FROM_LZ[exports.SupportedLayerzeroChainId.SONIC] = exports.SupportedChainId.SONIC, _EVM_CHAIN_ID_FROM_LZ[exports.SupportedLayerzeroChainId.BERA] = exports.SupportedChainId.BERA, _EVM_CHAIN_ID_FROM_LZ[exports.SupportedLayerzeroChainId.FRAXTAL] = exports.SupportedChainId.FRAXTAL, _EVM_CHAIN_ID_FROM_LZ[exports.SupportedLayerzeroChainId.SWELL] = exports.SupportedChainId.SWELL, _EVM_CHAIN_ID_FROM_LZ[exports.SupportedLayerzeroChainId.SEPOLIA] = exports.SupportedChainId.SEPOLIA, _EVM_CHAIN_ID_FROM_LZ[exports.SupportedLayerzeroChainId.ARBITRUM_SEPOLIA] = exports.SupportedChainId.ARBITRUM_SEPOLIA, _EVM_CHAIN_ID_FROM_LZ[exports.SupportedLayerzeroChainId.OPTIMISM_SEPOLIA] = exports.SupportedChainId.OPTIMISM_SEPOLIA, _EVM_CHAIN_ID_FROM_LZ[exports.SupportedLayerzeroChainId.POLYGON_AMOY] = exports.SupportedChainId.POLYGON_AMOY, _EVM_CHAIN_ID_FROM_LZ);
var _LAYER_ZERO_ENDPOINT_, _ULTRA_LIGHT_NODE_V2_, _SEND_ULTRA_LIGHT_NOD;
// Zero address
var ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
// Address that all chains, except arbitrum, will use for the to param in a transaction
var LAYER_ZERO_ENDPOINT_ADDRESS = (_LAYER_ZERO_ENDPOINT_ = {}, _LAYER_ZERO_ENDPOINT_[exports.SupportedChainId.ARBITRUM_ONE] = '0x3c2269811836af69497E5F486A85D7316753cf62', _LAYER_ZERO_ENDPOINT_[exports.SupportedChainId.MAINNET] = '0x66A71Dcef29A0fFBDBE3c6a460a3B5BC225Cd675', _LAYER_ZERO_ENDPOINT_[exports.SupportedChainId.OPTIMISM] = '0x3c2269811836af69497E5F486A85D7316753cf62', _LAYER_ZERO_ENDPOINT_[exports.SupportedChainId.BASE] = '0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7', _LAYER_ZERO_ENDPOINT_[exports.SupportedChainId.POLYGON] = '0x3c2269811836af69497E5F486A85D7316753cf62', _LAYER_ZERO_ENDPOINT_[exports.SupportedChainId.BSC] = '0x3c2269811836af69497E5F486A85D7316753cf62', _LAYER_ZERO_ENDPOINT_[exports.SupportedChainId.AVAX] = '0x3c2269811836af69497E5F486A85D7316753cf62', _LAYER_ZERO_ENDPOINT_[exports.SupportedChainId.METIS] = '0x9740FF91F1985D8d2B71494aE1A2f723bb3Ed9E4', _LAYER_ZERO_ENDPOINT_[exports.SupportedChainId.SONIC] = '0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7', _LAYER_ZERO_ENDPOINT_[exports.SupportedChainId.BERA] = '0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7', _LAYER_ZERO_ENDPOINT_[exports.SupportedChainId.FRAXTAL] = '0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7', _LAYER_ZERO_ENDPOINT_[exports.SupportedChainId.SWELL] = '0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7', _LAYER_ZERO_ENDPOINT_[exports.SupportedChainId.SEPOLIA] = '0xae92d5aD7583AD66E49A0c67BAd18F6ba52dDDc1', _LAYER_ZERO_ENDPOINT_[exports.SupportedChainId.ARBITRUM_SEPOLIA] = '0x6098e96a28E02f27B1e6BD381f870F1C8Bd169d3', _LAYER_ZERO_ENDPOINT_[exports.SupportedChainId.OPTIMISM_SEPOLIA] = '0x55370E0fBB5f5b8dAeD978BA1c075a499eB107B8', _LAYER_ZERO_ENDPOINT_[exports.SupportedChainId.BASE_SEPOLIA] = '0x55370E0fBB5f5b8dAeD978BA1c075a499eB107B8', _LAYER_ZERO_ENDPOINT_[exports.SupportedChainId.POLYGON_AMOY] = '0x55370E0fBB5f5b8dAeD978BA1c075a499eB107B8', _LAYER_ZERO_ENDPOINT_);
// Address that all chains, except arbitrum, will use for the to param in a transaction
var ULTRA_LIGHT_NODE_V2_ADDRESS = (_ULTRA_LIGHT_NODE_V2_ = {}, _ULTRA_LIGHT_NODE_V2_[exports.SupportedChainId.ARBITRUM_ONE] = '0x4D73AdB72bC3DD368966edD0f0b2148401A178E2', _ULTRA_LIGHT_NODE_V2_[exports.SupportedChainId.MAINNET] = '0x4D73AdB72bC3DD368966edD0f0b2148401A178E2', _ULTRA_LIGHT_NODE_V2_[exports.SupportedChainId.OPTIMISM] = '0x4D73AdB72bC3DD368966edD0f0b2148401A178E2', _ULTRA_LIGHT_NODE_V2_[exports.SupportedChainId.BASE] = '0x38dE71124f7a447a01D67945a51eDcE9FF491251', _ULTRA_LIGHT_NODE_V2_[exports.SupportedChainId.POLYGON] = '0x4D73AdB72bC3DD368966edD0f0b2148401A178E2', _ULTRA_LIGHT_NODE_V2_[exports.SupportedChainId.BSC] = '0x4D73AdB72bC3DD368966edD0f0b2148401A178E2', _ULTRA_LIGHT_NODE_V2_[exports.SupportedChainId.AVAX] = '0x4D73AdB72bC3DD368966edD0f0b2148401A178E2', _ULTRA_LIGHT_NODE_V2_[exports.SupportedChainId.METIS] = '0x38dE71124f7a447a01D67945a51eDcE9FF491251', _ULTRA_LIGHT_NODE_V2_[exports.SupportedChainId.SONIC] = '0x38dE71124f7a447a01D67945a51eDcE9FF491251', _ULTRA_LIGHT_NODE_V2_[exports.SupportedChainId.BERA] = '0x38dE71124f7a447a01D67945a51eDcE9FF491251', _ULTRA_LIGHT_NODE_V2_[exports.SupportedChainId.FRAXTAL] = '0x38dE71124f7a447a01D67945a51eDcE9FF491251', _ULTRA_LIGHT_NODE_V2_[exports.SupportedChainId.SWELL] = '0x980205D352F198748B626f6f7C38A8a5663Ec981', _ULTRA_LIGHT_NODE_V2_[exports.SupportedChainId.SEPOLIA] = '0x3aCAAf60502791D199a5a5F0B173D78229eBFe32', _ULTRA_LIGHT_NODE_V2_[exports.SupportedChainId.ARBITRUM_SEPOLIA] = '0x88866E5A296FffA511EF8011CB1BBd4d01Cd094F', _ULTRA_LIGHT_NODE_V2_[exports.SupportedChainId.OPTIMISM_SEPOLIA] = '0x35AdD9321507A87471a11EBd4aE4f592d531e620', _ULTRA_LIGHT_NODE_V2_[exports.SupportedChainId.BASE_SEPOLIA] = '0x35AdD9321507A87471a11EBd4aE4f592d531e620', _ULTRA_LIGHT_NODE_V2_[exports.SupportedChainId.POLYGON_AMOY] = '0x35AdD9321507A87471a11EBd4aE4f592d531e620', _ULTRA_LIGHT_NODE_V2_);
// Address that all chains, except arbitrum, will use for the to param in a transaction
var SEND_ULTRA_LIGHT_NODE_V2_ADDRESS = (_SEND_ULTRA_LIGHT_NOD = {}, _SEND_ULTRA_LIGHT_NOD[exports.SupportedChainId.ARBITRUM_ONE] = '0x975bcD720be66659e3EB3C0e4F1866a3020E493A', _SEND_ULTRA_LIGHT_NOD[exports.SupportedChainId.MAINNET] = '0xbB2Ea70C9E858123480642Cf96acbcCE1372dCe1', _SEND_ULTRA_LIGHT_NOD[exports.SupportedChainId.OPTIMISM] = '0x1322871e4ab09Bc7f5717189434f97bBD9546e95', _SEND_ULTRA_LIGHT_NOD[exports.SupportedChainId.BASE] = '0xB5320B0B3a13cC860893E2Bd79FCd7e13484Dda2', _SEND_ULTRA_LIGHT_NOD[exports.SupportedChainId.POLYGON] = '0x6c26c61a97006888ea9E4FA36584c7df57Cd9dA3', _SEND_ULTRA_LIGHT_NOD[exports.SupportedChainId.BSC] = '0x9F8C645f2D0b2159767Bd6E0839DE4BE49e823DE', _SEND_ULTRA_LIGHT_NOD[exports.SupportedChainId.AVAX] = '0x197D1333DEA5Fe0D6600E9b396c7f1B1cFCc558a', _SEND_ULTRA_LIGHT_NOD[exports.SupportedChainId.METIS] = '0x63e39ccB510926d05a0ae7817c8f1CC61C5BdD6c', _SEND_ULTRA_LIGHT_NOD[exports.SupportedChainId.SONIC] = '0xC39161c743D0307EB9BCc9FEF03eeb9Dc4802de7', _SEND_ULTRA_LIGHT_NOD[exports.SupportedChainId.BERA] = '0xC39161c743D0307EB9BCc9FEF03eeb9Dc4802de7', _SEND_ULTRA_LIGHT_NOD[exports.SupportedChainId.FRAXTAL] = '0x377530cdA84DFb2673bF4d145DCF0C4D7fdcB5b6', _SEND_ULTRA_LIGHT_NOD[exports.SupportedChainId.SWELL] = '0xc1B621b18187F74c8F6D52a6F709Dd2780C09821', _SEND_ULTRA_LIGHT_NOD[exports.SupportedChainId.SEPOLIA] = '0xcc1ae8Cf5D3904Cef3360A9532B477529b177cCE', _SEND_ULTRA_LIGHT_NOD[exports.SupportedChainId.ARBITRUM_SEPOLIA] = '0x4f7cd4DA19ABB31b0eC98b9066B9e857B1bf9C0E', _SEND_ULTRA_LIGHT_NOD[exports.SupportedChainId.OPTIMISM_SEPOLIA] = '0xB31D2cb502E25B30C651842C7C3293c51Fe6d16f', _SEND_ULTRA_LIGHT_NOD[exports.SupportedChainId.BASE_SEPOLIA] = '0xC1868e054425D378095A003EcbA3823a5D0135C9', _SEND_ULTRA_LIGHT_NOD[exports.SupportedChainId.POLYGON_AMOY] = '0x1d186C560281B8F1AF831957ED5047fD3AB902F9', _SEND_ULTRA_LIGHT_NOD);
//Max Uint256
var MaxUint256 = /*#__PURE__*/JSBI.BigInt('0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff');
// constants used internally but not expected to be used externally
var NEGATIVE_ONE = /*#__PURE__*/JSBI.BigInt(-1);
var ZERO = /*#__PURE__*/JSBI.BigInt(0);
var ONE = /*#__PURE__*/JSBI.BigInt(1);
var ONE_18 = /*#__PURE__*/JSBI.BigInt('1000000000000000000'); // 18 decimal places
var FIVE = /*#__PURE__*/JSBI.BigInt(5);
var _997 = /*#__PURE__*/JSBI.BigInt(997);
var _1000 = /*#__PURE__*/JSBI.BigInt(1000);
var _GOVERNANCE_BRAVO_ADD, _GOVERNANCE_BRAVO_SEV, _GOVERNANCE_BRAVO_SEV2, _GOVERNANCE_BRAVO_SEV3, _GOVERNANCE_BRAVO_SEV4, _GOVERNANCE_BRAVO_SEV5, _TIMELOCK_ADDRESS, _TIMELOCK_SEVERITY_1_, _TIMELOCK_SEVERITY_2_, _TIMELOCK_SEVERITY_3_, _TIMELOCK_SEVERITY_4_, _TIMELOCK_SEVERITY_5_;
/**
* The latest Maia governor bravo
*/
var GOVERNANCE_BRAVO_ADDRESSES = (_GOVERNANCE_BRAVO_ADD = {}, _GOVERNANCE_BRAVO_ADD[exports.SupportedChainId.ARBITRUM_ONE] = '0xaA8D7127fFb6a9786529F15977003A2D469B2d95', _GOVERNANCE_BRAVO_ADD[exports.SupportedChainId.SEPOLIA] = '0x61B046e0812CF9c170fa09b9834708F73421B59b', _GOVERNANCE_BRAVO_ADD);
/**
* The latest hermes governor bravo for severity 1 governance proposals
*/
var GOVERNANCE_BRAVO_SEVERITY_1_ADDRESSES = (_GOVERNANCE_BRAVO_SEV = {}, _GOVERNANCE_BRAVO_SEV[exports.SupportedChainId.ARBITRUM_ONE] = '0xEdf6aD5f569485090ECa00359E3e3813Be985809', _GOVERNANCE_BRAVO_SEV[exports.SupportedChainId.SEPOLIA] = '0x28a9ffd6Fe4497f0788606F64Ab7095fDeCe4Ebb', _GOVERNANCE_BRAVO_SEV);
/**
* The latest hermes governor bravo for severity 2 governance proposals
*/
var GOVERNANCE_BRAVO_SEVERITY_2_ADDRESSES = (_GOVERNANCE_BRAVO_SEV2 = {}, _GOVERNANCE_BRAVO_SEV2[exports.SupportedChainId.ARBITRUM_ONE] = '0xF2831E87088f2E113050c4EE5EB138978eAEBb49', _GOVERNANCE_BRAVO_SEV2[exports.SupportedChainId.SEPOLIA] = '0x38bAd91B4c7016f8a9C71aab1071769Ec0FBe241', _GOVERNANCE_BRAVO_SEV2);
/**
* The latest hermes governor bravo for severity 3 governance proposals
*/
var GOVERNANCE_BRAVO_SEVERITY_3_ADDRESSES = (_GOVERNANCE_BRAVO_SEV3 = {}, _GOVERNANCE_BRAVO_SEV3[exports.SupportedChainId.ARBITRUM_ONE] = '0x428f076301026c7665F7F70EEBbB391506aEc2a1', _GOVERNANCE_BRAVO_SEV3[exports.SupportedChainId.SEPOLIA] = '0x8d2c9aA2e899B18e03931ccFcf088be0b3a23BdE', _GOVERNANCE_BRAVO_SEV3);
/**
* The latest hermes governor bravo for severity 4 governance proposals
*/
var GOVERNANCE_BRAVO_SEVERITY_4_ADDRESSES = (_GOVERNANCE_BRAVO_SEV4 = {}, _GOVERNANCE_BRAVO_SEV4[exports.SupportedChainId.ARBITRUM_ONE] = '0x45E8089C4C033cb28bb652a153dDE49182Bae49a', _GOVERNANCE_BRAVO_SEV4[exports.SupportedChainId.SEPOLIA] = '0xB9618958c953D67E15Bf7eFe78478Dd1e8b23CeC', _GOVERNANCE_BRAVO_SEV4);
/**
* The latest hermes governor bravo for severity 5 governance proposals
*/
var GOVERNANCE_BRAVO_SEVERITY_5_ADDRESSES = (_GOVERNANCE_BRAVO_SEV5 = {}, _GOVERNANCE_BRAVO_SEV5[exports.SupportedChainId.ARBITRUM_ONE] = '0xb23c7BE6c14a145a7ca33083Fb6e8B3fC9c820aC', _GOVERNANCE_BRAVO_SEV5[exports.SupportedChainId.SEPOLIA] = '0xBFFc42560a51832daa466955f39D81915402Fd50', _GOVERNANCE_BRAVO_SEV5);
/**
* The latest maia governor bravo for governance proposals
*/
var TIMELOCK_ADDRESS = (_TIMELOCK_ADDRESS = {}, _TIMELOCK_ADDRESS[exports.SupportedChainId.ARBITRUM_ONE] = '0x744f3EC772AAA9f0d40398b90F9E856EF88D118A', _TIMELOCK_ADDRESS[exports.SupportedChainId.SEPOLIA] = '0x86712f780F8883482e7EBf6f395CEe374CC59787', _TIMELOCK_ADDRESS);
/**
* The latest hermes governor bravo for severity 1 governance proposals
*/
var TIMELOCK_SEVERITY_1_ADDRESSES = (_TIMELOCK_SEVERITY_1_ = {}, _TIMELOCK_SEVERITY_1_[exports.SupportedChainId.ARBITRUM_ONE] = '0x07D87055E82EAf4851Dfa251a5d79A7E99Bd789A', _TIMELOCK_SEVERITY_1_[exports.SupportedChainId.SEPOLIA] = '0x16DfceFF2e21c54Cd4B262edDCc1baEB734a112A', _TIMELOCK_SEVERITY_1_);
/**
* The latest hermes governor bravo for severity 2 governance proposals
*/
var TIMELOCK_SEVERITY_2_ADDRESSES = (_TIMELOCK_SEVERITY_2_ = {}, _TIMELOCK_SEVERITY_2_[exports.SupportedChainId.ARBITRUM_ONE] = '0xb97c3D79Af827c915E5F6B492e6bd99D653F8cC7', _TIMELOCK_SEVERITY_2_[exports.SupportedChainId.SEPOLIA] = '0x0d5783E0e19bf09A923A742E5feB0653c2Eed638', _TIMELOCK_SEVERITY_2_);
/**
* The latest hermes governor bravo for severity 3 governance proposals
*/
var TIMELOCK_SEVERITY_3_ADDRESSES = (_TIMELOCK_SEVERITY_3_ = {}, _TIMELOCK_SEVERITY_3_[exports.SupportedChainId.ARBITRUM_ONE] = '0xaCE7B2BbD13acE4E23F622209c46C9F2885edd49', _TIMELOCK_SEVERITY_3_[exports.SupportedChainId.SEPOLIA] = '0x69ff16440052DE228a158517d91E92D803e072D7', _TIMELOCK_SEVERITY_3_);
/**
* The latest hermes governor bravo for severity 4 governance proposals
*/
var TIMELOCK_SEVERITY_4_ADDRESSES = (_TIMELOCK_SEVERITY_4_ = {}, _TIMELOCK_SEVERITY_4_[exports.SupportedChainId.ARBITRUM_ONE] = '0x716147a2169246c09f47D9880Bf85D49093A92C4', _TIMELOCK_SEVERITY_4_[exports.SupportedChainId.SEPOLIA] = '0x8e0881066dA3B81041105B58303a975bD507091C', _TIMELOCK_SEVERITY_4_);
/**
* The latest hermes governor bravo for severity 5 governance proposals
*/
var TIMELOCK_SEVERITY_5_ADDRESSES = (_TIMELOCK_SEVERITY_5_ = {}, _TIMELOCK_SEVERITY_5_[exports.SupportedChainId.ARBITRUM_ONE] = '0xB4523B4541Ab27337AB8389188a545BF3d07d5E3', _TIMELOCK_SEVERITY_5_[exports.SupportedChainId.SEPOLIA] = '0x9de0F9B4a94a2119789F03A21Da42576114A0554', _TIMELOCK_SEVERITY_5_);
var _BalancerAddresses;
/**
* These addresses are on Arbitrum
*/
var ArbitrumBalancerAddresses = {
ComposableStablePoolWrapperFactory: '0x0FeC6De5Cf270000460000008f0033B910004797',
ComposableStablePoolWrapperInitCodeHash: '0x486597d0dac9e727fb360962435de36b40a335916fd13eb350993c76512b55c0'
};
/**
* These addresses are on Sepolia
*/
var SepoliaBalancerAddresses = {
ComposableStablePoolWrapperFactory: '0x996AAA029f3A8826C22CcCf6127A16A0e52FC3Da',
ComposableStablePoolWrapperInitCodeHash: '0x2f29c1929bc70aae113b1671d9250cc3e2ab673d22188542ebf28ded1ac9e1a4'
};
var BalancerAddresses = (_BalancerAddresses = {}, _BalancerAddresses[exports.SupportedChainId.ARBITRUM_ONE] = ArbitrumBalancerAddresses, _BalancerAddresses[exports.SupportedChainId.SEPOLIA] = SepoliaBalancerAddresses, _BalancerAddresses);
var _HermesAddresses;
/**
* These addresses are on arbitrum
*/
var ArbitrumHermesAddresses = {
Hermes: '0x45940000009600102A1c002F0097C4A500fa00AB',
bHermes: '0x3A0000000000E1007cEb00351F65a1806eCd937C',
bHermesVotes: '0x5B99ACF131463bFc62FE000b8Bb962097B6734d9',
bHermesGauges: '0xe6D0aeA7cEf79B08B906e0C455C25042b57b23Ed',
bHermesBoost: '0x73A899D7e71393dDf2B1cD8336f820969c709E70',
UniswapV3GaugeFactory: '0xE64278005e0F00cd6199d000386b018d7C000000',
UniswapV3Staker: '0x54De3b7b5D1993Db4B2a93C897b5272FBd60e99E',
BribesFactory: '0x863011414b400340178Ec329647a2aa55f724D70',
FlywheelBooster: '0x006f48258FC9562F00003b9700009231008b0600',
BaseV2Minter: '0x000000B473F20DEA03618d00315900eC5900dc59',
BaseV2GaugeManager: '0x0000070059ed0005981800C8d66017bC00500632',
PartnerManagerFactory: '0x8c272715be844488Ff7AAf201d51D8FA50149387',
FlywheelGaugeRewards: '0x000000b53E67c90000e1C22e1530c70020657Ff7',
RewardsInfoHelper: '0x3219f8cf74ABb16D7C0923dE58a48Edde997D9Db',
ERC20BoostHelper: '0x127991cC764B05fe6C9257A0EC3Be9E4f48Ad744',
RestakeHelper: '0xCc06B09F822eeC7aD6c30C59c060647C3Aab2D06',
FlywheelHelper: '0xf3f35E27AE1B3ab928327F72391B29f1bFd8DAF6'
};
/**
* These are the tesnet addresses on Sepolia
*/
var SepoliaHermesAddresses = {
Hermes: '0x34CA145f38aBff21679B958fA067DBF3c021a60D',
bHermes: '0x12bcE9DBFfD8F20b1B7F74c9A5678f770FCb36b8',
bHermesVotes: '0x4A6D202cd15dD26ca28693Ed8256f5F57fCAf367',
bHermesGauges: '0xd6154D2C9f5C1e682786aA06c092e9f466f5E068',
bHermesBoost: '0xE2eaCd92208E81c88E629682aeab5646E4f8ed69',
UniswapV3GaugeFactory: '0x068cA042b76589A59435C3bd6B5e45D4223453cf',
UniswapV3Staker: '0x2907fA8B81AD03F07A6545901957e7a9D1dD252B',
BribesFactory: '0x0A87e91500B1cdC75759ee923054d48dE3df8C0D',
FlywheelBooster: '0xCff715821ECF15466fC73ee10591D0CcEe2b7f38',
BaseV2Minter: '0x006a82828debcC1b369B3E41a88F018Ca72dA809',
BaseV2GaugeManager: '0x996486eA713aCBcD93e0DeD1722F7CF18FeDC0Be',
PartnerManagerFactory: '0x7049E4743F148d0817Ba82455eC2065E5B97f146',
FlywheelGaugeRewards: '0xa8C563BA4Eff705f30B631b4cd4A4C4395540d07',
RewardsInfoHelper: '0x38Ca8f2db851575632B532Ca7EcB3dfffB0E82b0',
ERC20BoostHelper: '0x07B0ED72AdF6f0912Ce176081b6c7Be93DaA92Eb',
RestakeHelper: '0x3491CF277310fFbd84fFb3C274C907E78EC6df3B',
FlywheelHelper: '0xeCC521C10806D02f313443624f0eF66f2eA91A31'
};
var HermesAddresses = (_HermesAddresses = {}, _HermesAddresses[exports.SupportedChainId.ARBITRUM_ONE] = ArbitrumHermesAddresses, _HermesAddresses[exports.SupportedChainId.SEPOLIA] = SepoliaHermesAddresses, _HermesAddresses);
var _MaiaAddresses;
var MaiaAddresses = (_MaiaAddresses = {}, _MaiaAddresses[exports.SupportedChainId.ARBITRUM_ONE] = {
Maia: '0x00000000ea00F3F4000e7Ed5Ed91965b19f1009B',
vMaia: '0x000000f0C01c6200354f240000b7003668B4D080',
vMaiaVotes: '0x54b6e28A869a56f4e34d1187ae0a35b7dD3be111',
vMaiaTest: ZERO_ADDRESS,
vMaiaVotesTest: ZERO_ADDRESS
}, _MaiaAddresses[exports.SupportedChainId.SEPOLIA] = {
Maia: '0x8dFe092C40F6AE7081bb6f920E899BD640812c15',
vMaia: '0x3e822a168A667AbA3e6C6e7B64B562ecbD20C45b',
vMaiaVotes: '0xA3276039F58C3b6FDA367c96d3EfeE6d84487547',
vMaiaTest: '0xF9Af8CF1EfA09946634E6a1Cf3dCF616e3D23642',
vMaiaVotesTest: '0x1e6a18b3d17b4d4f149DeDCDd0A89D8803048649'
}, _MaiaAddresses);
var _TalosAddresses;
/**
* TalosAddresses is a mapping of supported chain IDs to their respective Talos addresses.
*
* This object uses the SupportedChainId enum to map each supported chain to its corresponding
* Talos addresses. It implements the TalosAddressesType type, ensuring it has the required structure.
*
* @type {TalosAddressesType}
* @property {object} [SupportedChainId.ARBITRUM_ONE] - Addresses for the Arbitrum network
* @property {string} [SupportedChainId.ARBITRUM_ONE].TalosStrategyStakedFactory - Address of the TalosStrategyStakedFactory contract on Arbitrum
* @property {string} [SupportedChainId.ARBITRUM_ONE].OptimizerFactory - Address of the OptimizerFactory contract on Arbitrum
* @property {string} [SupportedChainId.ARBITRUM_ONE].BoostAggregatorFactory - Address of the BoostAggregatorFactory contract on Arbitrum
* @property {string} [SupportedChainId.ARBITRUM_ONE].TalosManagerFactory - Address of the TalosManagerFactory contract on Arbitrum
* @property {string} [SupportedChainId.ARBITRUM_ONE].FlywheelCoreInstant - Address of the FlywheelCoreInstant contract on Arbitrum
* @property {string} [SupportedChainId.ARBITRUM_ONE].TransferAll - Address of the TransferAll contract on Arbitrum
* @property {object} [SupportedChainId.SEPOLIA] - Addresses for the Sepolia network
* @property {string} [SupportedChainId.SEPOLIA].TalosStrategyStakedFactory - Address of the TalosStrategyStakedFactory contract on Sepolia
* @property {string} [SupportedChainId.SEPOLIA].OptimizerFactory - Address of the OptimizerFactory contract on Sepolia
* @property {string} [SupportedChainId.SEPOLIA].BoostAggregatorFactory - Address of the BoostAggregatorFactory contract on Sepolia
* @property {string} [SupportedChainId.SEPOLIA].TalosManagerFactory - Address of the TalosManagerFactory contract on Sepolia
* @property {string} [SupportedChainId.SEPOLIA].FlywheelCoreInstant - Address of the FlywheelCoreInstant contract on Sepolia
* @property {string} [SupportedChainId.SEPOLIA].TransferAll - Address of the TransferAll contract on Sepolia
*
* @example
* ```ts
* import { TalosAddresses } from './TalosAddresses'
* import { SupportedChainId } from '../chainIds'
*
* // Accessing the Talos addresses for the Arbitrum network
* const arbitrumAddresses = TalosAddresses[SupportedChainId.ARBITRUM_ONE]
* console.log(arbitrumAddresses.TalosStrategyStakedFactory) // Outputs: '0x17B4f847f9B071298f3eF0DAd5FCB20453bd537D'
*
* // Accessing the Talos addresses for the Sepolia network
* const sepoliaAddresses = TalosAddresses[SupportedChainId.SEPOLIA]
* console.log(sepoliaAddresses.TalosStrategyStakedFactory) // Outputs: '0xA483A5FB7974Dcdc4480a976fECD4e5d21312E20'
* ```
*/
var TalosAddresses = (_TalosAddresses = {}, _TalosAddresses[exports.SupportedChainId.ARBITRUM_ONE] = {
TalosStrategyStakedFactory: '0x17B4f847f9B071298f3eF0DAd5FCB20453bd537D',
OptimizerFactory: '0x000000005De908d83F4b6072D388e3e9Fc543557',
BoostAggregatorFactory: '0x223F3862F28848784432dc48346d133aBA94fbD4',
TalosManagerFactory: '0xcE827EDa08C1f1A6BdDb4582B0759eF02c7FC3Ff',
FlywheelCoreInstant: '0xfA7d81256a4fe221A2FD4abb090F2a33a2F956C5',
TransferAll: '0x000067EADd040000D8ee00c1b9Ca41eF920c005C'
}, _TalosAddresses[exports.SupportedChainId.SEPOLIA] = {
TalosStrategyStakedFactory: '0xA483A5FB7974Dcdc4480a976fECD4e5d21312E20',
OptimizerFactory: '0xE5534Af145B1F539a89F0a8c210c1213539Aa0Bc',
BoostAggregatorFactory: '0xA6605f5Ade7eA775535a7e0B54833b7EE6eE98C6',
TalosManagerFactory: '0x09e2877026cC748c992612b999c4b8A10bfE8Eea',
FlywheelCoreInstant: '0x090BB8B6a6f8daa1cD1e3153F030F2E7609D4321',
TransferAll: '0x000bE6db68E716106dAb57190c6A1bF6D3F4cBAf'
}, _TalosAddresses);
function _defineProperties(e, r) {
for (var t = 0; t < r.length; t++) {
var o = r[t];
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
}
}
function _createClass(e, r, t) {
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
writable: !1
}), e;
}
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 _inheritsLoose(t, o) {
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
}
function _setPrototypeOf(t, e) {
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
return t.__proto__ = e, t;
}, _setPrototypeOf(t, e);
}
function _toPrimitive(t, r) {
if ("object" != typeof t || !t) return t;
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != typeof i) return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
function _toPropertyKey(t) {
var i = _toPrimitive(t, "string");
return "symbol" == typeof i ? i : i + "";
}
var _Ulysses;
// MAINNET - Ulysses Omnichain Address Definitions per Chain
var UlyssesArbitrumBranch = {
BranchPort: '0x79f4b04FFCa54BC946aa0ef8E33eE723467f0192',
BranchBridgeAgentFactory: '0x3A516edf6158D5BF1dD0B51337053c4aCDf644d9',
CoreBranchRouter: '0x38DeFD1a1a1E7d6af860eC1Eda6F4c75741d9E7e',
CoreBranchBridgeAgent: '0x93114b1748B9D4D21f32fa0c1a21040D18Cc8d66',
ERC20hTokenBranchFactory: '',
MulticallBranchRouter: '0xE16776FCe6B983e9aB52e9506bD3E14D22bdBDa0',
MulticallBranchBridgeAgent: '0x62b1C5e4A013A42926cc26510180C4050Dc02779',
MulticallBranchRouterLibZip: '0x213128EF80B0fDDdB96F09780E8f3DC8477D2869',
MulticallBranchBridgeAgentLibZip: '0x6CdE6F2a2eFE7A12d62949956889f97A5715f1cd',
NativeToken: ''
};
var UlyssesArbitrum = /*#__PURE__*/_extends({}, UlyssesArbitrumBranch, {
RootPort: '0xd3E3599517F2036fA314e468d62135714FC03C56',
RootBridgeAgentFactory: '0xe0ff9aDA7ff73180beca8d6F69fc8D2505F9539E',
CoreRootRouter: '0x31E2a6BbC2aF8AEB78DD1FA1FceFE0F672c3E8fe',
CoreRootBridgeAgent: '0xB8fec761db744E59dCC3141FEB18e8A63646233c',
ERC20hTokenRootFactory: '0xB9833D1ee7D6B5478104f618436E5dF4EAEB55c7',
MulticallRootRouter: '0xEbdcaAb09ec0491E2a632e3e8F2b39f081d878DD',
MulticallRootBridgeAgent: '0x4EE41d129955EEd4a10CBA785773BEEA6DC13126',
MulticallRootRouterLibZip: '0x3Ad10d46ABedE5E56925aE97BFc131054F834333',
MulticallRootBridgeAgentLibZip: '0x4D7f23c920696beC43F0f76D20BC4C431e72D91c'
});
var UlyssesEthereum = {
BranchPort: '0x0000151d008235A6cC00004F00FA2bDF9dF95400',
BranchBridgeAgentFactory: '0x4e1E0DFF602Bc7B195ecB57e5b8F9cb03b440D27',
CoreBranchRouter: '0xd0f74CbB2a5f67F48E10F7B5e293e0f78B79B599',
CoreBranchBridgeAgent: '0x509fDD915c2020DA07E36aaF55F31B9648b81ba9',
ERC20hTokenBranchFactory: '0xaA96607691E801376c5cBcD2E8F088C9E1D1FeB4',
MulticallBranchRouter: '0xa465E96470f0919B2fb91b2f88D57DeAfB1D766a',
MulticallBranchBridgeAgent: '0xFe59E33F7c7466f5F459F66d40A97C6f778D5DE4',
MulticallBranchRouterLibZip: '0x5786EfFF72450E66e91De12D0e95dF71799b524F',
MulticallBranchBridgeAgentLibZip: '0xce0882FF10E1E68d54393234aD29b7e24d7a18E8',
NativeToken: '0xe2e5DF2786A89c06C36e66015F3F6fA235D5fb76'
};
var UlyssesPolygon = {
BranchPort: '0x0000151d008235A6cC00004F00FA2bDF9dF95400',
BranchBridgeAgentFactory: '0x4Ad2437b9dEe82D9A22F96894e8d483E1b2d9b7d',
CoreBranchRouter: '0xd0f74CbB2a5f67F48E10F7B5e293e0f78B79B599',
CoreBranchBridgeAgent: '0xBb42804e272e430B8e2fb3D384AB16e0d201Afa2',
ERC20hTokenBranchFactory: '0xd7D8458823934233376d9fFb370A3293C4231860',
MulticallBranchRouter: '0xa465E96470f0919B2fb91b2f88D57DeAfB1D766a',
MulticallBranchBridgeAgent: '0xE6F57FF398B26aD6278b51E4A894fd70Db2E5d4E',
MulticallBranchRouterLibZip: '0x5786EfFF72450E66e91De12D0e95dF71799b524F',
MulticallBranchBridgeAgentLibZip: '0xf8aae47a6A12552Bc714e47F8d98446d537634aA',
NativeToken: '0x5b4f8ca696BAfAe2943547144F2066199598CfCb'
};
var UlyssesAvax = {
BranchPort: '0x0000151d008235A6cC00004F00FA2bDF9dF95400',
BranchBridgeAgentFactory: '0x1E8FdD836a2d460bdD62FbDB80CFa2984B1B3D2A',
CoreBranchRouter: '0xd0f74CbB2a5f67F48E10F7B5e293e0f78B79B599',
CoreBranchBridgeAgent: '0x9Da6E4D3faf214A708CD14c2016bCCCa1507e11A',
ERC20hTokenBranchFactory: '0xfF6927f1722C2500f9CB68e5D3768ddAD5031Bf2',
MulticallBranchRouter: '0xa465E96470f0919B2fb91b2f88D57DeAfB1D766a',
MulticallBranchBridgeAgent: '0x90e611E922720540804bbe3A05D4A8Ee0b9c5fBb',
MulticallBranchRouterLibZip: '0x5786EfFF72450E66e91De12D0e95dF71799b524F',
MulticallBranchBridgeAgentLibZip: '0x41916Ad45cD2303ab42110659c0376c4E3Dd0554',
NativeToken: '0xfD92eE19f206f313F8D267026B337a62F77b1E4c'
};
var UlyssesOptimism = {
BranchPort: '0x0000151d008235A6cC00004F00FA2bDF9dF95400',
BranchBridgeAgentFactory: '0xd971e3230A6ebBDd66341D7C5ECF7ad0a0224DA2',
CoreBranchRouter: '0xd0f74CbB2a5f67F48E10F7B5e293e0f78B79B599',
CoreBranchBridgeAgent: '0xbCa8AC32b6bc35b1F876D6aB598b93a35a33fD04',
ERC20hTokenBranchFactory: '0x940A58c1623f8eE80398668a7598D787A4Fa88eE',
MulticallBranchRouter: '0xa465E96470f0919B2fb91b2f88D57DeAfB1D766a',
MulticallBranchBridgeAgent: '0xd207aD94c4A5Fb1c32dFe0714B024525A1774B20',
MulticallBranchRouterLibZip: '0x5786EfFF72450E66e91De12D0e95dF71799b524F',
MulticallBranchBridgeAgentLibZip: '0x419e450B899CB40A00d5e804870D57Ab3F92351F',
NativeToken: '0x0F1651C8f1e22097b80A61d1CcffC54A51aaC725'
};
var UlyssesBase = {
BranchPort: '0x0000151d008235A6cC00004F00FA2bDF9dF95400',
BranchBridgeAgentFactory: '0xa0DE1545E6B0E793e5dEd724736045E991EFAe4d',
CoreBranchRouter: '0xd0f74CbB2a5f67F48E10F7B5e293e0f78B79B599',
CoreBranchBridgeAgent: '0xd4d0F211Cd400440c6605751c1f56530a996c7ff',
ERC20hTokenBranchFactory: '0x094AB8e4CC215ac04DAB8b6260D53c4504cec060',
MulticallBranchRouter: '0xa465E96470f0919B2fb91b2f88D57DeAfB1D766a',
MulticallBranchBridgeAgent: '0x5b710604f8b969704c619F78993aE610075CDe8c',
MulticallBranchRouterLibZip: '0x5786EfFF72450E66e91De12D0e95dF71799b524F',
MulticallBranchBridgeAgentLibZip: '0x9C87185F3962e131A561bb4a2CfD47712BF104a4',
NativeToken: '0x10A45947C278D6F49049D120F6b8Cf527D023f53'
};
var UlyssesBSC = {
BranchPort: '0x0000151d008235A6cC00004F00FA2bDF9dF95400',
BranchBridgeAgentFactory: '0xfD0d9035ec29b614dE6b5673A16cC6eC78cA44F1',
CoreBranchRouter: '0xd0f74CbB2a5f67F48E10F7B5e293e0f78B79B599',
CoreBranchBridgeAgent: '0xb327582d73498EAb059005846E64dcb3618fff49',
ERC20hTokenBranchFactory: '0xF04dE46e174e63F0c9781508cCE78b96E99052B1',
MulticallBranchRouter: '0xa465E96470f0919B2fb91b2f88D57DeAfB1D766a',
MulticallBranchBridgeAgent: '0x39BEC4399C49450f98F6f32fb29f86720e0a6621',
MulticallBranchRouterLibZip: '0x5786EfFF72450E66e91De12D0e95dF71799b524F',
MulticallBranchBridgeAgentLibZip: '0xa9A21A9Bb20FC365AB7b36B2A31dCa3a4648bF1f',
NativeToken: '0x7eb5C81d21BCFa970fb280e5A8FB08652448Ed2b'
};
var UlyssesMetis = {
BranchPort: '0x0000151d008235A6cC00004F00FA2bDF9dF95400',
BranchBridgeAgentFactory: '0x6160d53fCbf457Bd728Def380d3C442EEa775087',
CoreBranchRouter: '0xd0f74CbB2a5f67F48E10F7B5e293e0f78B79B599',
CoreBranchBridgeAgent: '0x4B232390F5F533973775BC516E3A4cb2062BF33E',
ERC20hTokenBranchFactory: '0xc71956bDA00E1225857421b6809FEbdd09900938',
MulticallBranchRouter: '0xa465E96470f0919B2fb91b2f88D57DeAfB1D766a',
MulticallBranchBridgeAgent: '0xa0026577F8A68137A402E4eC1c3f69c5092B124F',
MulticallBranchRouterLibZip: '0x5786EfFF72450E66e91De12D0e95dF71799b524F',
MulticallBranchBridgeAgentLibZip: '0xB06Fc506f82B6DcEEf0643d9132d12e59fD79c24',
NativeToken: '0x1ce28C4f77991b604868bA48f9154408313C65b6'
};
var UlyssesSonic = {
BranchPort: '0x0000151d008235A6cC00004F00FA2bDF9dF95400',
BranchBridgeAgentFactory: '0x5DFb3dbA421891e616B232466BD97Df94ab26E4C',
CoreBranchRouter: '0xd0f74CbB2a5f67F48E10F7B5e293e0f78B79B599',
CoreBranchBridgeAgent: '0x93A2a67010BCCc39e8A0B3E51bcB3D8aDF1DB83a',
ERC20hTokenBranchFactory: '0x92DC9DB1751f6668A504e4650A275D547c586a38',
MulticallBranchRouter: '0xa465E96470f0919B2fb91b2f88D57DeAfB1D766a',
MulticallBranchBridgeAgent: '0x43F9bA5CCc690F1073E06765Bea8B24458565B66',
MulticallBranchRouterLibZip: '0x5786EfFF72450E66e91De12D0e95dF71799b524F',
MulticallBranchBridgeAgentLibZip: '0xec6A60547A772F76718dC8990238dB9A415A4509',
NativeToken: '0x5b05C18c3D30b23763891D4Bc27311999b2b8194'
};
var UlyssesBera = {
BranchPort: '0x0000151d008235A6cC00004F00FA2bDF9dF95400',
BranchBridgeAgentFactory: '0x294470A65cC1Fc67931c3351076F4C1b5d09d786',
CoreBranchRouter: '0xd0f74CbB2a5f67F48E10F7B5e293e0f78B79B599',
CoreBranchBridgeAgent: '0x2132B6d41De5c767e507F017D310778441b50E94',
ERC20hTokenBranchFactory: '0x7E157ce374A8533Dc38B539D28E3C5B401cF8105',
MulticallBranchRouter: '0xa465E96470f0919B2fb91b2f88D57DeAfB1D766a',
MulticallBranchBridgeAgent: '0xF40Ae0899Bf756f198b51db0a9E2C59Cc12147A0',
MulticallBranchRouterLibZip: '0x5786EfFF72450E66e91De12D0e95dF71799b524F',
MulticallBranchBridgeAgentLibZip: '0x98DA688f695f4d6Bd3D26fA9BF85A0Fe9EC50C6b',
NativeToken: '0x6d4c20f6E27F5399888E25260b7a0e77e8f4d80d'
};
var UlyssesFraxtal = {
BranchPort: '0x6BeEF9B5a6E4Dd9D74122d62f5ef52eE48281819',
BranchBridgeAgentFactory: '0x1E4D716c85b68B51dF0b5cBF2AA1c89f70BF32c5',
CoreBranchRouter: '0x836326728773EAF5969F9BdE81A9b688c6b4F756',
CoreBranchBridgeAgent: '0x1DE6c6b20dEe3F67daE4Ef9213a435185EA8Fc78',
ERC20hTokenBranchFactory: '0x637ee501F397fe85f2E51be3e23f4082e1e127eE',
MulticallBranchRouter: '0xaB4A1e4da3544C9749a5873E0Bd1650969b5F648',
MulticallBranchBridgeAgent: '0x25478f42EF97E5664aA6E201Ba94EC5467d94746',
MulticallBranchRouterLibZip: '0x9c89478815488A261b4d72C58E8776B450a24f16',
MulticallBranchBridgeAgentLibZip: '0x1E73b77F3BdD676C7B0892eEB5ac33BCDf0f0826',
NativeToken: '0x5AA82E672e31bb936abdaa527fb643B0BEcf1A13'
};
var UlyssesSwell = {
BranchPort: '0x0000151d008235A6cC00004F00FA2bDF9dF95400',
BranchBridgeAgentFactory: '0x7eA5c2F737c54D9E6Eb6fE71F13Ca834fF407079',
CoreBranchRouter: '0xd0f74CbB2a5f67F48E10F7B5e293e0f78B79B599',
CoreBranchBridgeAgent: '0x04abb38a64B932F0C5316BF70b639a9AfF14a8E5',
ERC20hTokenBranchFactory: '0xA0320af5c9a8e3CC2A7205e833b38c05872B7098',
MulticallBranchRouter: '0xa465E96470f0919B2fb91b2f88D57DeAfB1D766a',
MulticallBranchBridgeAgent: '0x39cd99411CA6f2a01bceDA964F27D043025230d3',
MulticallBranchRouterLibZip: '0x5786EfFF72450E66e91De12D0e95dF71799b524F',
MulticallBranchBridgeAgentLibZip: '0x7E424dd1f354Cfd5cba2f213f842E2290A58F7AA',
NativeToken: '0xCc74BDF637fAAA6717270E2491b274B158bC5ea9'
};
// TESTNET - Ulysses Omnichain Address Definitions per Chain
var UlyssesSepoliaBranch = {
BranchPort: '0xE2B6Dc3e16873aC460d01307898eba5e3ef72165',
BranchBridgeAgentFactory: '0xbDf7Df30b8575a112cA8B74486f616f97548573C',
CoreBranchRouter: '0xE9E180453f1318c9518166f53BF5b55Cfb5302Cf',
CoreBranchBridgeAgent: ZERO_ADDRESS,
ERC20hTokenBranchFactory: ZERO_ADDRESS,
MulticallBranchRouter: '0x9FF07935Aa66aCCEc439a7bc830645B77198E2CF',
MulticallBranchBridgeAgent: '0x141282d0442addA1274b9EB7ca368e24b2E06639',
MulticallBranchRouterLibZip: '0xb48a73F3dC5F8065B3c9F9EDdcCd33979b518841',
MulticallBranchBridgeAgentLibZip: ZERO_ADDRESS,
NativeToken: '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14'
};
var UlyssesSepolia = /*#__PURE__*/_extends({}, UlyssesSepoliaBranch, {
RootPort: '0x800De4d33015FeB4e344951aCe8eA2f4F33aE529',
RootBridgeAgentFactory: '0x4c94fF45284159a1a336197e8F0ee194B0D527F8',
CoreRootRouter: '0x7a29e9eb2e32075F35fCC5448e930f24d2fB1b62',
CoreRootBridgeAgent: '0x664Df2DAdc5Fd3E5D5b42D83CFcf162F48051409',
ERC20hTokenRootFactory: '0xbA564A4bbc30472D8CF8ba61c24627189290E6b6',
MulticallRootRouter: '0xC7F66dCA3B782983de45e445BdE403Ce36aAB885',
MulticallRootBridgeAgent: '0xe8074Acb12bD4b5ACaB083718CcE8f998D6a8fa1',
MulticallRootRouterLibZip: '0x0887db9b1df886bA926EA7853f012B26Cf589e47',
MulticallRootBridgeAgentLibZip: '0x27e5d2fDE8F24f74A232363785013dd3187CDD01'
});
var UlyssesArbitrumSepolia = {
BranchPort: '0x95ab3c1f34Ba0637Bd7533b4Fc74B6A30D16cAf8',
BranchBridgeAgentFactory: '0x3746841410B8ff846D05Bce56D161Ff71667049F',
CoreBranchRouter: '0xb03303b6c7c34C34e4B2d5e9F48F3D664779C4f9',
CoreBranchBridgeAgent: '0xf7F0A5fc625a3f5A92b525AC858B8E257239cE9f',
ERC20hTokenBranchFactory: '0xe15f57ed19c9ac02B5f95f96Ce50482E4a6714A8',
MulticallBranchRouter: '0x6bA0FA9D5B866ddc80C0421F1E2229577e9e0dDF',
MulticallBranchBridgeAgent: '0xfDD0F0e43BEEd971b867E4Db9AdD70C49Ae89225',
MulticallBranchRouterLibZip: '0xD52C99FDf1A860EdA2C33d160ca318dBD6600aBb',
MulticallBranchBridgeAgentLibZip: '0x316EEB1515332bD2533173133545B8800ce0D6c0',
NativeToken: '0x3413055aA47545C9551dE8109fe6948f5376Af39'
};
var UlyssesOptimismSepolia = {
BranchPort: '0x507f3CeEA7f2bb4eb3C13A7359ABa0c560172Af9',
BranchBridgeAgentFactory: '0x2F7Dd1137D158588016b1B0F8d7040dF2923a11E',
CoreBranchRouter: '0x1690088Af42f1d77f5ed2998d097cbDd4aB6b935',
CoreBranchBridgeAgent: '0x817BD8e30F5b0A89a73c2c9d4A433f5b783C5902',
ERC20hTokenBranchFactory: '0x1aE0aE181981BfD675BaB403c7F8A9Ba7843149C',
MulticallBranchRouter: '0xE9965fE9637E5b53a31b07c107565C6263347fd0',
MulticallBranchBridgeAgent: '0xcaED1f3A6f47E65c7004Ab020480763cb262585A',
MulticallBranchRouterLibZip: '0x7bB3d0B4168F062c41EFa71A0d74457Cde0b91c5',
MulticallBranchBridgeAgentLibZip: '0x205506CB8BE7f5fC537cB0240ffB4273027CF11D',
NativeToken: '0xAd6A7addf807D846A590E76C5830B609F831Ba2E'
};
var UlyssesBaseSepolia = {
BranchPort: '0x184f1c3c450702C02bB99137403B125243cB5e66',
BranchBridgeAgentFactory: '0x1fc37a909cB3997f96cE395B3Ee9ac268C9bCcdb',
CoreBranchRouter: '0x9f88DbcD0d2Db9a2433Ce0f4eF1C5d533F032702',
CoreBranchBridgeAgent: '0xcf76904D24c5b99411B3D481049F466F83490bB7',
ERC20hTokenBranchFactory: '0x471e76A7CD76A0DbD021F5A3136d1F0828cbD270',
MulticallBranchRouter: '0x7ddEecA94ce57264410d51E9F73a0f8983b2eAA7',
MulticallBranchBridgeAgent: '0x55D69928F08695a724E8eD65EaaDBA41809a3eFc',
MulticallBranchRouterLibZip: '0xAfB0F351A9a92220eFC54a92EA5cAE21AcB3D6Da',
MulticallBranchBridgeAgentLibZip: '0x188f596da34015cb2FD8D90770c024c8a271e513',
NativeToken: '0x4200000000000000000000000000000000000006'
};
var UlyssesPolygonAmoy = {
BranchPort: '0x471e76A7CD76A0DbD021F5A3136d1F0828cbD270',
BranchBridgeAgentFactory: '0x1fc37a909cB3997f96cE395B3Ee9ac268C9bCcdb',
CoreBranchRouter: '0x68868e60Bb70f9eA3A153334440e0D6aF96bE77A',
CoreBranchBridgeAgent: '0xE1cEf05Ea3Da03EfE18b01fbd7b11DF059A7aF3F',
ERC20hTokenBranchFactory: '0x7ddEecA94ce57264410d51E9F73a0f8983b2eAA7',
MulticallBranchRouter: '0xAfB0F351A9a92220eFC54a92EA5cAE21AcB3D6Da',
MulticallBranchBridgeAgent: '0x201a51Fe6688AEE94E97c71DAdfa727769fE1AB5',
MulticallBranchRouterLibZip: '0x9f88DbcD0d2Db9a2433Ce0f4eF1C5d533F032702',
MulticallBranchBridgeAgentLibZip: '0xf64597697246F09aA71Eb859F69512c4AabD4dE5',
NativeToken: '0x833bF555AD7201Dba33D4A5AeA88c179468Ca424'
};
var Ulysses = (_Ulysses = {}, _Ulysses[exports.SupportedChainId.ARBITRUM_ONE] = UlyssesArbitrum, _Ulysses[exports.SupportedChainId.MAINNET] = UlyssesEthereum, _Ulysses[exports.SupportedChainId.OPTIMISM] = UlyssesOptimism, _Ulysses[exports.SupportedChainId.BASE] = UlyssesBase, _Ulysses[exports.SupportedChainId.POLYGON] = UlyssesPolygon, _Ulysses[exports.SupportedChainId.AVAX] = UlyssesAvax, _Ulysses[exports.SupportedChainId.BSC] = UlyssesBSC, _Ulysses[exports.SupportedChainId.METIS] = UlyssesMetis, _Ulysses[exports.SupportedChainId.SONIC] = UlyssesSonic, _Ulysses[exports.SupportedChainId.BERA] = UlyssesBera, _Ulysses[exports.SupportedChainId.FRAXTAL] = UlyssesFraxtal, _Ulysses[exports.SupportedChainId.SWELL] = UlyssesSwell, _Ulysses[exports.SupportedChainId.SEPOLIA] = UlyssesSepolia, _Ulysses[exports.SupportedChainId.ARBITRUM_SEPOLIA] = UlyssesArbitrumSepolia, _Ulysses[exports.SupportedChainId.OPTIMISM_SEPOLIA] = UlyssesOptimismSepolia, _Ulysses[exports.SupportedChainId.BASE_SEPOLIA] = UlyssesBaseSepolia, _Ulysses[exports.SupportedChainId.POLYGON_AMOY] = UlyssesPolygonAmoy, _Ulysses);
/**
* Exports all the addresses for the different protocols
*/
var EcosystemProtocols = {
Hermes: HermesAddresses,
Maia: MaiaAddresses,
Talos: TalosAddresses,
Balancer: BalancerAddresses,
Ulysses: Ulysses
};
var _CHAIN_TO_ADDRESSES_M, _ARGENT_WALLET_DETECT;
(function (ChainId) {
ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
ChainId[ChainId["MAINNET"] = 1] = "MAINNET";
ChainId[ChainId["ARBITRUM_ONE"] = 42161] = "ARBITRUM_ONE";
ChainId[ChainId["OPTIMISM"] = 10] = "OPTIMISM";
})(exports.ChainId || (exports.ChainId = {}));
var SUPPORTED_CHAINS = [exports.ChainId.MAINNET, exports.ChainId.SEPOLIA, exports.ChainId.ARBITRUM_ONE, exports.ChainId.OPTIMISM];
(function (NativeCurrencyName) {
// Strings match input for CLI
NativeCurrencyName["ETHER"] = "ETH";
NativeCurrencyName["MATIC"] = "MATIC";
NativeCurrencyName["CELO"] = "CELO";
NativeCurrencyName["GNOSIS"] = "XDAI";
NativeCurrencyName["MOONBEAM"] = "GLMR";
NativeCurrencyName["BNB"] = "BNB";
NativeCurrencyName["AVAX"] = "AVAX";
})(exports.NativeCurrencyName || (exports.NativeCurrencyName = {}));
var DEFAULT_NETWORKS = [exports.ChainId.ARBITRUM_ONE, exports.ChainId.SEPOLIA];
function constructSameAddressMap(address, additionalNetworks) {
if (additionalNetworks === void 0) {
additionalNetworks = [];
}
return DEFAULT_NETWORKS.concat(additionalNetworks).reduce(function (memo, chainId) {
memo[chainId] = address;
return memo;
}, {});
}
// Networks that share most of the same addresses i.e. Mainnet, Goerli, Optimism, Arbitrum, Polygon
var DEFAULT_ADDRESSES = {
v3CoreFactoryAddress: '0x1F98431c8aD98523631AE4a59f267346ea31F984',
multicallAddress: '0x1F98415757620B543A52E61c46B32eB19261F984',
quoterAddress: '0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6',
v3MigratorAddress: '0xA5644E29708357803b5A882D272c41cC0dF92B34',
nonfungiblePositionManagerAddress: '0xC36442b4a4522E871399CD717aBDD847Ab11FE88'
};
var MAINNET_ADDRESSES = /*#__PURE__*/_extends({}, DEFAULT_ADDRESSES, {
v1MixedRouteQuoterAddress: '0x84E44095eeBfEC7793Cd7d5b57B7e401D7f1cA2E'
});
var OPTIMISM_ADDRESSES = DEFAULT_ADDRESSES;
var ARBITRUM_ONE_ADDRESSES = /*#__PURE__*/_extends({}, DEFAULT_ADDRESSES, {
multicallAddress: '0xadF885960B47eA2CD9B55E6DAc6B42b7Cb2806dB',
tickLensAddress: '0xbfd8137f7d1516D3ea5cA83523914859ec47F573'
});
// sepolia v3 addresses
var SEPOLIA_ADDRESSES = {
v3CoreFactoryAddress: '0x0227628f3F023bb0B980b67D528571c95c6DaC1c',
multicallAddress: '0xD7F33bCdb21b359c8ee6F0251d30E94832baAd07',
quoterAddress: '0xEd1f6473345F45b75F8179591dd5bA1888cf2FB3',
v3MigratorAddress: '0x729004182cF005CEC8Bd85df140094b6aCbe8b15',
nonfungiblePositionManagerAddress: '0x1238536071E1c677A632429e3655c799b22cDA52',
tickLensAddress: '0x0b343475d44EC2b4b8243EBF81dc888BF0A14b36'
};
var CHAIN_TO_ADDRESSES_MAP = (_CHAIN_TO_ADDRESSES_M = {}, _CHAIN_TO_ADDRESSES_M[exports.ChainId.MAINNET] = MAINNET_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.OPTIMISM] = OPTIMISM_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.ARBITRUM_ONE] = ARBITRUM_ONE_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports.ChainId.SEPOLIA] = SEPOLIA_ADDRESSES, _CHAIN_TO_ADDRESSES_M);
/* V3 Contract Addresses */
var V3_CORE_FACTORY_ADDRESSES = /*#__PURE__*/_extends({}, /*#__PURE__*/SUPPORTED_CHAINS.reduce(function (memo, chainId) {
memo[chainId] = CHAIN_TO_ADDRESSES_MAP[chainId].v3CoreFactoryAddress;
return memo;
}, {}));
var V3_MIGRATOR_ADDRESSES = /*#__PURE__*/_extends({}, /*#__PURE__*/SUPPORTED_CHAINS.reduce(function (memo, chainId) {
var v3MigratorAddress = CHAIN_TO_ADDRESSES_MAP[chainId].v3MigratorAddress;
if (v3MigratorAddress) {
memo[chainId] = v3MigratorAddress;
}
return memo;
}, {}));
var MULTICALL_ADDRESSES = /*#__PURE__*/_extends({}, /*#__PURE__*/SUPPORTED_CHAINS.reduce(function (memo, chainId) {
memo[chainId] = CHAIN_TO_ADDRESSES_MAP[chainId].multicallAddress;
return memo;
}, {}));
var ARGENT_WALLET_DETECTOR_ADDRESS = (_ARGENT_WALLET_DETECT = {}, _ARGENT_WALLET_DETECT[exports.ChainId.MAINNET] = '0xeca4B0bDBf7c55E9b7925919d03CbF8Dc82537E8', _ARGENT_WALLET_DETECT);
var QUOTER_ADDRESSES = /*#__PURE__*/_extends({}, /*#__PURE__*/SUPPORTED_CHAINS.reduce(function (memo, chainId) {
memo[chainId] = CHAIN_TO_ADDRESSES_MAP[chainId].quoterAddress;
return memo;
}, {}));
var NONFUNGIBLE_POSITION_MANAGER_ADDRESSES = /*#__PURE__*/_extends({}, /*#__PURE__*/SUPPORTED_CHAINS.reduce(function (memo, chainId) {
var nonfungiblePositionManagerAddress = CHAIN_TO_ADDRESSES_MAP[chainId].nonfungiblePositionManagerAddress;
if (nonfungiblePositionManagerAddress) {
memo[chainId] = nonfungiblePositionManagerAddress;
}
return memo;
}, {}));
var ENS_REGISTRAR_ADDRESSES = /*#__PURE__*/_extends({}, /*#__PURE__*/constructSameAddressMap('0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e'));
var TICK_LENS_ADDRESSES = /*#__PURE__*/_extends({}, /*#__PURE__*/SUPPORTED_CHAINS.reduce(function (memo, chainId) {
var tickLensAddress = CHAIN_TO_ADDRESSES_MAP[chainId].tickLensAddress;
if (tickLensAddress) {
memo[chainId] = tickLensAddress;
}
return memo;
}, {}));
var SWAP_ROUTER_02_ADDRESSES = function SWAP_ROUTER_02_ADDRESSES(chainId) {
if (SUPPORTED_CHAINS.includes(chainId)) {
var _CHAIN_TO_ADDRESSES_M2;
var id = chainId;
return (_CHAIN_TO_ADDRESSES_M2 = CHAIN_TO_ADDRESSES_MAP[id].swapRouter02Address) != null ? _CHAIN_TO_ADDRESSES_M2 : '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45';
}
return '';
};
(function (Rounding) {
Rounding[Rounding["ROUND_DOWN"] = 0] = "ROUND_DOWN";
Rounding[Rounding["ROUND_HALF_UP"] = 1] = "ROUND_HALF_UP";
Rounding[Rounding["ROUND_UP"] = 2] = "ROUND_UP";
})(exports.Rounding || (exports.Rounding = {}));
/**
* A currency is any fungible financial instrument, including Ether, all ERC20 tokens, and other chain-native currencies
*/
var BaseCurrency = /*#__PURE__*/function () {
/**
* Constructs an instance of the base class `BaseCurrency`.
* @param chainId the chain ID on which this currency resides
* @param decimals decimals of the currency
* @param symbol symbol of the currency
* @param name of the currency
* @param extensions token extensions containing bridging info, pricing, and other metadata
*/
function BaseCurrency(chainId, decimals, symbol, name, extensions) {
!Number.isSafeInteger(chainId) ? invariant(false, 'CHAIN_ID') : void 0;
!(decimals >= 0 && decimals < 255 && Number.isInteger(decimals)) ? invariant(false, 'DECIMALS') : void 0;
this.chainId = chainId;
this.decimals = decimals;
this.symbol = symbol;
this.name = name;
this.extensions = extensions;
}
// =============================================================================
// Extension Getters
// =============================================================================
/**
* True if there is no liquidity for that token on this chain
*/
var _proto = BaseCurrency.prototype;
/**
* Get OFT Info for a specific adapter address
* @param adapterAddress the adapter address used for LayerZero messaging
*/
_proto.getOftInfo = function getOftInfo(adapterAddress) {
var _this$extensions;
return (_this$extensions = this.extensions) == null || (_this$extensions = _this$extensions.oftInfo) == null ? void 0 : _this$extensions.find(function (oft) {
var _oft$adapter;
return ((_oft$adapter = oft.adapter) == null ? void 0 : _oft$adapter.toLowerCase()) === (adapterAddress == null ? void 0 : adapterAddress.toLowerCase());
});
}
/**
* Get OFT Info with least fee for a specific target chain
* @param chainId the target chain ID
*/;
_proto.getBestOftInfoForChain = function getBestOftInfoForChain(chainId) {
var _this$extensions2;
var bestOft;
var lowestFee;
(_this$extensions2 = this.extensions) == null || (_this$extensions2 = _this$extensions2.oftInfo) == null || _this$extensions2.forEach(function (oft) {
var peer = oft.peers[chainId];
if (peer) {
var _peer$fee;
var fee = (_peer$fee = peer.fee) != null ? _peer$fee : 0;
if (lowestFee === undefined || fee < lowestFee) {
lowestFee = fee;
bestOft = oft;
}
}
});
return bestOft;
}
/**
* Get OFT peer info for a specific chain
* @param chainId the target chain ID
* @param adapterAddress the adapter address used for LayerZero messaging
*/;
_proto.getOftPeerInfo = function getOftPeerInfo(chainId, adapterAddress) {
var _this$extensions3;
return (_this$extensions3 = this.extensions) == null || (_this$extensions3 = _this$extensions3.oftInfo) == null || (_this$extensions3 = _this$extensions3.find(function (oft) {
var _oft$adapter2;
return ((_oft$adapter2 = oft.adapter) == null ? void 0 : _oft$adapter2.toLowerCase()) === (adapterAddress == null ? void 0 : adapterAddress.toLowerCase());
})) == null ? void 0 : _this$extensions3.peers[chainId];
}
/**
* Get the adapter address for a specific OFT peer
* @param peer the peer info object
* @returns the adapter address or the peer address if no adapter is specified
*/;
_proto.getOftPeerAdapter = function getOftPeerAdapter(peer) {
var _peer$adapter;
return (_peer$adapter = peer.adapter) != null ? _peer$adapter : peer.address;
}
/**
* Get all chain IDs that have OFT peers for this token
*/;
_proto.getAllOftPeerChainIds = function getAllOftPeerChainIds() {
var _this$extensions$oftI, _this$extensions4;
return Array.from(new Set((_this$extensions$oftI = (_this$extensions4 = this.extensions) == null || (_this$extensions4 = _this$extensions4.oftInfo) == null ? void 0 : _this$extensions4.flatMap(function (oft) {
return Object.keys(oft.peers).map(Number);
})) != null ? _this$extensions$oftI : []));
}
/**
* Get all chain IDs that have OFT peers for this token
* @param adapterAddress the adapter address used for LayerZero messaging
*/;
_proto.getOftPeerChainIds = function getOftPeerChainIds(adapterAddress) {
var _Array$from, _this$extensions$oftI2, _this$extensions5;
return (_Array$from = Array.from(new Set(Object.keys((_this$extensions$oftI2 = (_this$extensions5 = this.extensions) == null || (_this$extensions5 = _this$extensions5.oftInfo) == null || (_this$extensions5 = _this$extensions5.find(function (oft) {
var _oft$adapter3;
return ((_oft$adapter3 = oft.adapter) == null ? void 0 : _oft$adapter3.toLowerCase()) === (adapterAddress == null ? void 0 : adapterAddress.toLowerCase());
})) == null ? void 0 : _this$extensions5.peers) != null ? _this$extensions$oftI2 : {}).map(Number)))) != null ? _Array$from : [];
}
/**
* True if token has Stargate bridge configurations
*/;
/**
* Get Stargate route info for a specific destination chain
* @param chainId the destination chain ID
*/
_proto.getStargateRoute = function getStargateRoute(chainId) {
var _this$extensions6;
return (_this$extensions6 = this.extensions) == null || (_this$extensions6 = _this$extensions6.stargateInfo) == null ? void 0 : _this$extensions6.routes[chainId];
}
/**
* Get all chain IDs that have Stargate routes for this token
*/;
_proto.getStargateRouteChainIds = function getStargateRouteChainIds() {
var _this$extensions7;
var routes = (_this$extensions7 = this.extensions) == null || (_this$extensions7 = _this$extensions7.stargateInfo) == null ? void 0 : _this$extensions7.routes;
return routes ? Object.keys(routes).map(Number) : [];
}
/**
* True if token has Ulysses bridging info
*/;
/**
* Get Ulysses local address for a specific chain
* @param chainId the target chain ID
*/
_proto.getUlyssesLocalAddress = function getUlyssesLocalAddress(chainId) {
var _this$extensions8;
return (_this$extensions8 = this.extensions) == null || (_this$extensions8 = _this$extensions8.ulyssesInfo) == null ? void 0 : _this$extensions8.localAddresses[chainId];
}
/**
* Get all chain IDs that have Ulysses local addresses
*/;
_proto.getUlyssesChainIds = function getUlyssesChainIds() {
var _this$extensions9;
var localAddresses = (_this$extensions9 = this.extensions) == null || (_this$extensions9 = _this$extensions9.ulyssesInfo) == null ? void 0 : _this$extensions9.localAddresses;
return localAddresses ? Object.keys(localAddresses).map(Number) : [];
};
_createClass(BaseCurrency, [{
key: "noLiquidityOnChain",
get: function get() {
var _this$extensions$noLi, _this$extensions10;
return (_this$extensions$noLi = (_this$extensions10 = this.extensions) == null ? void 0 : _this$extensions10.noLiquidityOnChain) != null ? _this$extensions$noLi : false;
}
/**
* The price source for the token, if applicable
*/
}, {
key: "priceSource",
get: function get() {
var _this$extensions11;
return (_this$extensions11 = this.extensions) == null ? void 0 : _this$extensions11.priceSource;
}
/**
* True if token has OFT (Omnichain Fungible Token) configurations
*/
}, {
key: "isOFT",
get: function get() {
var _this$extensions12;
return !!((_this$extensions12 = this.extensions) != null && _this$extensions12.oftInfo) && this.extensions.oftInfo.length > 0;
}
/**
* Get all OFT configurations for this token
*/
}, {
key: "oftInfo",
get: function get() {
var _this$extensions13;
return (_this$extensions13 = this.extensions) == null ? void 0 : _this$extensions13.oftInfo;
}
}, {
key: "isStargate",
get: function get() {
var _this$extensions14;
return !!((_this$extensions14 = this.extensions) != null && _this$extensions14.stargateInfo);
}
/**
* Get all Stargate configurations for this token
*/
}, {
key: "stargateInfo",
get: function get() {
var _this$extensions15;
return (_this$extensions15 = this.extensions) == null ? void 0 : _this$extensions15.stargateInfo;
}
}, {
key: "isUlysses",
get: function get() {
var _this$extensions16;
return !!((_this$extensions16 = this.extensions) != null && _this$extensions16.ulyssesInfo);
}
/**
* Get Ulysses bridging info
*/
}, {
key: "ulyssesInfo",
get: function get() {
var _this$extensions17;
return (_this$extensions17 = this.extensions) == null ? void 0 : _this$extensions17.ulyssesInfo;
}
}]);
return BaseCurrency;
}();
/**
* Represents the native currency of the chain on which it resides, e.g. eth on Mainnet.
*/
var NativeCurrency = /*#__PURE__*/function (_BaseCurrency) {
_inheritsLoose(NativeCurrency, _BaseCurrency);
function NativeCurrency() {
var _this;
_this = _BaseCurrency.apply(this, arguments) || this;
_this.isNative = true;
_this.isToken = false;
_this.isGlobal = false;
return _this;
}
return NativeCurrency;
}(BaseCurrency);
/**
* Validates an address and returns the parsed (checksummed) version of that address
* @param address the unchecksummed hex address
*/
function validateAndParseAddress(address$1) {
try {
return address.getAddress(address$1);
} catch (error) {
throw new Error(address$1 + " is not a valid address.");
}
}
// Checks a string starts with 0x, is 42 characters long and contains only hex characters after 0x
var startsWith0xLen42HexRegex = /^0x[0-9a-fA-F]{40}$/;
/**
* Checks if an address is valid by checking 0x prefix, length === 42 and hex encoding.
* @param address the unchecksummed hex address
*/
function checkValidAddress(address) {
if (startsWith0xLen42HexRegex.test(address)) {
return address;
}
throw new Error(address + " is not a valid address.");
}
/**
* Represents an ERC20 token with a unique address and some metadata native to a given chain.
*/
var NativeToken = /*#__PURE__*/function (_BaseCurrency) {
_inheritsLoose(NativeToken, _BaseCurrency);
/**
*
* @param chainId {@link BaseCurrency#chainId}
* @param address The contract address on the chain on which this token lives.
* @param decimals {@link BaseCurrency#decimals}
* @param symbol {@link BaseCurrency#symbol}
* @param name {@link BaseCurrency#name}
* @param bypassChecksum If true it only checks for length === 42, startsWith 0x and contains only hex characters.
* @param extensions Token extensions containing bridging info, pricing, and other metadata
*/
function NativeToken(chainId, address, decimals, symbol, name, bypassChecksum, extensions) {
var _this;
_this = _BaseCurrency.call(this, chainId, decimals, symbol, name, extensions) || this;
_this.isNative = false;
_this.isToken = true;
_this.isGlobal = false;
if (bypassChecksum) {
_this.address = checkValidAddress(address);
} else {
_this.address = validateAndParseAddress(address);
}
_this.extensions = extensions;
return _this;
}
// =============================================================================
// Token-Specific Extension Getters
// =============================================================================
/**
* True if token is supported by Across bridge
*/
var _proto = NativeToken.prototype;
/**
* Get Across info for a specific chain
* @param chainId the target chain ID
*/
_proto.getAcrossChainInfo = function getAcrossChainInfo(chainId) {
var _this$extensions;
return (_this$extensions = this.extensions) == null || (_this$extensions = _this$extensions.acrossInfo) == null ? void 0 : _this$extensions[chainId];
}
/**
* Get all chain IDs that have Across bridge support for this token
*/;
_proto.getAcrossChainIds = function getAcrossChainIds() {
var _this$extensions2;
var acrossInfo = (_this$extensions2 = this.extensions) == null ? void 0 : _this$extensions2.acrossInfo;
return acrossInfo ? Object.keys(acrossInfo).map(Number) : [];
}
/**
* Returns true if the two tokens are equivalent, i.e. have the same chainId and address.
* @param other other token to compare
*/;
_proto.equals = function equals(other) {
return other.isToken && this.chainId === other.chainId && this.address.toLowerCase() === other.address.toLowerCase();
}
/**
* Returns true if the address of this token sorts before the address of the other token
* @param other other token to compare
* @throws if the tokens have the same address
* @throws if the tokens are on different chains
*/;
_proto.sortsBefore = function sortsBefore(other) {
!(this.chainId === other.chainId) ? invariant(false, 'CHAIN_IDS') : void 0;
!(this.address.toLowerCase() !== other.address.toLowerCase()) ? invariant(false, 'ADDRESSES') : void 0;
return this.address.toLowerCase() < other.address.toLowerCase();
}
/**
* Return this token, which does not need to be wrapped
*/;
_createClass(NativeToken, [{
key: "isAcross",
get: function get() {
var _this$extensions3;
return !!((_this$extensions3 = this.extensions) != null && _this$extensions3.acrossInfo) && Object.keys(this.extensions.acrossInfo).length > 0;
}
/**
* Get Across bridge info
*/
}, {
key: "acrossInfo",
get: function get() {
var _this$extensions4;
return (_this$extensions4 = this.extensions) == null ? void 0 : _this$extensions4.acrossInfo;
}
}, {
key: "wrapped",
get: function get() {
return this;
}
}]);
return NativeToken;
}(BaseCurrency);
var _WETH;
/**
* Known WETH9 implementation addresses, used in our implementation of Ether#wrapped
*/
var WETH9 = (_WETH = {}, _WETH[1] = /*#__PURE__*/new NativeToken(1, '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', 18, 'WETH', 'Wrapped Ether'), _WETH[3] = /*#__PURE__*/new NativeToken(3, '0xc778417E063141139Fce010982780140Aa0cD5Ab', 18, 'WETH', 'Wrapped Ether'), _WETH[4] = /*#__PURE__*/new NativeToken(4, '0xc778417E063141139Fce010982780140Aa0cD5Ab', 18, 'WETH', 'Wrapped Ether'), _WETH[5] = /*#__PURE__*/new NativeToken(5, '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6', 18, 'WETH', 'Wrapped Ether'), _WETH[42] = /*#__PURE__*/new NativeToken(42, '0xd0A1E359811322d97991E03f863a0C30C2cF029C', 18, 'WETH', 'Wrapped Ether'), _WETH[10] = /*#__PURE__*/new NativeToken(10, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'), _WETH[69] = /*#__PURE__*/new NativeToken(69, '0x4200000000000000000000000000000000000006', 18, 'WETH', 'Wrapped Ether'), _WETH[42161] = /*#__PURE__*/new NativeToken(42161, '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', 18, 'WETH', 'Wrapped Ether'), _WETH[421611] = /*#__PURE__*/new NativeToken(421611, '0xB47e6A5f8b33b3F17603C83a0535A9dcD7E32681', 18, 'WETH', 'Wrapped Ether'), _WETH);
/**
* Ether is the main usage of a 'native' currency, i.e. for Ethereum mainnet and all testnets
*/
var Ether = /*#__PURE__*/function (_NativeCurrency) {
_inheritsLoose(Ether, _NativeCurrency);
function Ether(chainId, extensions) {
return _NativeCurrency.call(this, chainId, 18, 'ETH', 'Ether', extensions) || this;
}
Ether.onChain = function onChain(chainId, extensions) {
var _this$_etherCache$cha;
return (_this$_etherCache$cha = this._etherCache[chainId]) != null ? _this$_etherCache$cha : this._etherCache[chainId] = new Ether(chainId, extensions);
};
var _proto = Ether.prototype;
_proto.equals = function equals(other) {
return other.isNative && other.chainId === this.chainId;
};
_createClass(Ether, [{
key: "wrapped",
get: function get() {
var weth9 = WETH9[this.chainId];
!!!weth9 ? invariant(false, 'WRAPPED') : void 0;
return weth9;
}
}]);
return Ether;
}(NativeCurrency);
Ether._etherCache = {};
/**
* Converts a big int to a hex string
* @param bigintIsh
* @returns The hex encoded calldata
*/
function toHex(bigintIsh) {
var bigInt = JSBI.BigInt(bigintIsh);
var hex = bigInt.toString(16);
if (hex.length % 2 !== 0) {
hex = "0" + hex;
}
return "0x" + hex;
}
var _toSignificantRoundin, _toFixedRounding;
var Decimal = /*#__PURE__*/toFormat(_Decimal);
var Big = /*#__PURE__*/toFormat(_Big);
var toSignificantRounding = (_toSignificantRoundin = {}, _toSignificantRoundin[exports.Rounding.ROUND_DOWN] = Decimal.ROUND_DOWN, _toSignificantRoundin[exports.Rounding.ROUND_HALF_UP] = Decimal.ROUND_HALF_UP, _toSignificantRoundin[exports.Rounding.ROUND_UP] = Decimal.ROUND_UP, _toSignificantRoundin);
//@dev this
// const toFixedRounding = {
// [Rounding.ROUND_DOWN]: RoundingMode.RoundDown,
// [Rounding.ROUND_HALF_UP]: RoundingMode.RoundHalfUp,
// [Rounding.ROUND_UP]: RoundingMode.RoundUp,
// }
var toFixedRounding = (_toFixedRounding = {}, _toFixedRounding[exports.Rounding.ROUND_DOWN] = 0, _toFixedRounding[exports.Rounding.ROUND_HALF_UP] = 1, _toFixedRounding[exports.Rounding.ROUND_UP] = 3, _toFixedRounding);
var Fraction = /*#__PURE__*/function () {
function Fraction(numerator, denominator) {
if (denominator === void 0) {
denominator = JSBI.BigInt(1);
}
this.numerator = JSBI.BigInt(numerator);
this.denominator = JSBI.BigInt(denominator);
}
Fraction.tryParseFraction = function tryParseFraction(fractionish) {
if (fractionish instanceof JSBI || typeof fractionish === 'number' || typeof fractionish === 'string') return new Fraction(fractionish);
if ('numerator' in fractionish && 'denominator' in fractionish) return fractionish;
throw new Error('Could not parse fraction');
}
// performs floor division
;
var _proto = Fraction.prototype;
_proto.invert = function invert() {
return new Fraction(this.denominator, this.numerator);
};
_proto.add = function add(other) {
var otherParsed = Fraction.tryParseFraction(other);
if (JSBI.equal(this.denominator, otherParsed.denominator)) {
return new Fraction(JSBI.add(this.numerator, otherParsed.numerator), this.denominator);
}
return new Fraction(JSBI.add(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator)), JSBI.multiply(this.denominator, otherParsed.denominator));
};
_proto.subtract = function subtract(other) {
var otherParsed = Fraction.tryParseFraction(other);
if (JSBI.equal(this.denominator, otherParsed.denominator)) {
return new Fraction(JSBI.subtract(this.numerator, otherParsed.numerator), this.denominator);
}
return new Fraction(JSBI.subtract(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator)), JSBI.multiply(this.denominator, otherParsed.denominator));
};
_proto.lessThan = function lessThan(other) {
var otherParsed = Fraction.tryParseFraction(other);
return JSBI.lessThan(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator));
};
_proto.equalTo = function equalTo(other) {
var otherParsed = Fraction.tryParseFraction(other);
return JSBI.equal(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator));
};
_proto.greaterThan = function greaterThan(other) {
var otherParsed = Fraction.tryParseFraction(other);
return JSBI.greaterThan(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(otherParsed.numerator, this.denominator));
};
_proto.multiply = function multiply(other) {
var otherParsed = Fraction.tryParseFraction(other);
return new Fraction(JSBI.multiply(this.numerator, otherParsed.numerator), JSBI.multiply(this.denominator, otherParsed.denominator));
};
_proto.divide = function divide(other) {
var otherParsed = Fraction.tryParseFraction(other);
return new Fraction(JSBI.multiply(this.numerator, otherParsed.denominator), JSBI.multiply(this.denominator, otherParsed.numerator));
};
_proto.toSignificant = function toSignificant(significantDigits, format, rounding) {
if (format === void 0) {
format = {
groupSeparator: ''
};
}
if (rounding === void 0) {
rounding = exports.Rounding.ROUND_HALF_UP;
}
!Number.isInteger(significantDigits) ? invariant(false, significantDigits + " is not an integer.") : void 0;
!(significantDigits > 0) ? invariant(false, significantDigits + " is not positive.") : void 0;
Decimal.set({
precision: significantDigits + 1,
rounding: toSignificantRounding[rounding]
});
var quotient = new Decimal(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(significantDigits);
return quotient.toFormat(quotient.decimalPlaces(), format);
};
_proto.toFixed = function toFixed(decimalPlaces, format, rounding) {
if (format === void 0) {
format = {
groupSeparator: ''
};
}
if (rounding === void 0) {
rounding = exports.Rounding.ROUND_HALF_UP;
}
!Number.isInteger(decimalPlaces) ? invariant(false, decimalPlaces + " is not an integer.") : void 0;
!(decimalPlaces >= 0) ? invariant(false, decimalPlaces + " is negative.") : void 0;
Big.DP = decimalPlaces;
Big.RM = toFixedRounding[rounding];
return new Big(this.numerator.toString()).div(this.denominator.toString()).toFormat(decimalPlaces, format);
}
/**
* Helper method for converting any super class back to a fraction
*/;
_createClass(Fraction, [{
key: "quotient",
get: function get() {
return JSBI.divide(this.numerator, this.denominator);
}
// remainder after floor division
}, {
key: "remainder",
get: function get() {
return new Fraction(JSBI.remainder(this.numerator, this.denominator), this.denominator);
}
}, {
key: "asFraction",
get: function get() {
return new Fraction(this.numerator, this.denominator);
}
}]);
return Fraction;
}();
var Big$1 = /*#__PURE__*/toFormat(_Big);
var CurrencyAmount = /*#__PURE__*/function (_Fraction) {
_inheritsLoose(CurrencyAmount, _Fraction);
function CurrencyAmount(currency, numerator, denominator) {
var _this;
_this = _Fraction.call(this, numerator, denominator) || this;
!JSBI.lessThanOrEqual(_this.quotient, MaxUint256) ? invariant(false, 'AMOUNT') : void 0;
_this.currency = currency;
_this.decimalScale = JSBI.exponentiate(JSBI.BigInt(10), JSBI.BigInt(currency.decimals));
return _this;
}
/**
* Returns a new currency amount instance from the unitless amount of token, i.e. the raw amount
* @param currency the currency in the amount
* @param rawAmount the raw token or ether amount
*/
CurrencyAmount.fromRawAmount = function fromRawAmount(currency, rawAmount) {
return new CurrencyAmount(currency, rawAmount);
}
/**
* Construct a currency amount with a denominator that is not equal to 1
* @param currency the currency
* @param numerator the numerator of the fractional token amount
* @param denominator the denominator of the fractional token amount
*/;
CurrencyAmount.fromFractionalAmount = function fromFractionalAmount(currency, numerator, denominator) {
return new CurrencyAmount(currency, numerator, denominator);
};
var _proto = CurrencyAmount.prototype;
_proto.add = function add(other) {
!this.currency.equals(other.currency) ? invariant(false, 'CURRENCY') : void 0;
var added = _Fraction.prototype.add.call(this, other);
return CurrencyAmount.fromFractionalAmount(this.currency, added.numerator, added.denominator);
};
_proto.subtract = function subtract(other) {
!this.currency.equals(other.currency) ? invariant(false, 'CURRENCY') : void 0;
var subtracted = _Fraction.prototype.subtract.call(this, other);
return CurrencyAmount.fromFractionalAmount(this.currency, subtracted.numerator, subtracted.denominator);
};
_proto.multiply = function multiply(other) {
var multiplied = _Fraction.prototype.multiply.call(this, other);
return CurrencyAmount.fromFractionalAmount(this.currency, multiplied.numerator, multiplied.denominator);
};
_proto.divide = function divide(other) {
var divided = _Fraction.prototype.divide.call(this, other);
return CurrencyAmount.fromFractionalAmount(this.currency, divided.numerator, divided.denominator);
};
_proto.toSignificant = function toSignificant(significantDigits, format, rounding) {
if (significantDigits === void 0) {
significantDigits = 6;
}
if (rounding === void 0) {
rounding = exports.Rounding.ROUND_DOWN;
}
return _Fraction.prototype.divide.call(this, this.decimalScale).toSignificant(significantDigits, format, rounding);
};
_proto.toFixed = function toFixed(decimalPlaces, format, rounding) {
if (decimalPlaces === void 0) {
decimalPlaces = this.currency.decimals;
}
if (rounding === void 0) {
rounding = exports.Rounding.ROUND_DOWN;
}
!(decimalPlaces <= this.currency.decimals) ? invariant(false, 'DECIMALS') : void 0;
return _Fraction.prototype.divide.call(this, this.decimalScale).toFixed(decimalPlaces, format, rounding);
};
_proto.toExact = function toExact(format) {
if (format === void 0) {
format = {
groupSeparator: ''
};
}
Big$1.DP = this.currency.decimals;
return new Big$1(this.quotient.toString()).div(this.decimalScale.toString()).toFormat(format);
};
_createClass(CurrencyAmount, [{
key: "wrapped",
get: function get() {
if (this.currency.isToken) return this;
return CurrencyAmount.fromFractionalAmount(this.currency.wrapped, this.numerator, this.denominator);
}
}]);
return CurrencyAmount;
}(Fraction);
var ONE_HUNDRED = /*#__PURE__*/new Fraction( /*#__PURE__*/JSBI.BigInt(100));
/**
* Converts a fraction to a percent
* @param fraction the fraction to convert
*/
function toPercent(fraction) {
return new Percent(fraction.numerator, fraction.denominator);
}
var Percent = /*#__PURE__*/function (_Fraction) {
_inheritsLoose(Percent, _Fraction);
function Percent() {
var _this;
_this = _Fraction.apply(this, arguments) || this;
/**
* This boolean prevents a fraction from being interpreted as a Percent
*/
_this.isPercent = true;
return _this;
}
var _proto = Percent.prototype;
_proto.add = function add(other) {
return toPercent(_Fraction.prototype.add.call(this, other));
};
_proto.subtract = function subtract(other) {
return toPercent(_Fraction.prototype.subtract.call(this, other));
};
_proto.multiply = function multiply(other) {
return toPercent(_Fraction.prototype.multiply.call(this, other));
};
_proto.divide = function divide(other) {
return toPercent(_Fraction.prototype.divide.call(this, other));
};
_proto.toSignificant = function toSignificant(significantDigits, format, rounding) {
if (significantDigits === void 0) {
significantDigits = 5;
}
return _Fraction.prototype.multiply.call(this, ONE_HUNDRED).toSignificant(significantDigits, format, rounding);
};
_proto.toFixed = function toFixed(decimalPlaces, format, rounding) {
if (decimalPlaces === void 0) {
decimalPlaces = 2;
}
return _Fraction.prototype.multiply.call(this, ONE_HUNDRED).toFixed(decimalPlaces, format, rounding);
};
return Percent;
}(Fraction);
var Price = /*#__PURE__*/function (_Fraction) {
_inheritsLoose(Price, _Fraction);
/**
* Construct a price, either with the base and quote currency amount, or the
* @param args
*/
function Price() {
var _this;
var baseCurrency, quoteCurrency, denominator, numerator;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (args.length === 4) {
baseCurrency = args[0];
quoteCurrency = args[1];
denominator = args[2];
numerator = args[3];
} else {
var result = args[0].quoteAmount.divide(args[0].baseAmount);
var _ref = [args[0].baseAmount.currency, args[0].quoteAmount.currency, result.denominator, result.numerator];
baseCurrency = _ref[0];
quoteCurrency = _ref[1];
denominator = _ref[2];
numerator = _ref[3];
}
_this = _Fraction.call(this, numerator, denominator) || this;
_this.baseCurrency = baseCurrency;
_this.quoteCurrency = quoteCurrency;
_this.scalar = new Fraction(JSBI.exponentiate(JSBI.BigInt(10), JSBI.BigInt(baseCurrency.decimals)), JSBI.exponentiate(JSBI.BigInt(10), JSBI.BigInt(quoteCurrency.decimals)));
return _this;
}
/**
* Flip the price, switching the base and quote currency
*/
var _proto = Price.prototype;
_proto.invert = function invert() {
return new Price(this.quoteCurrency, this.baseCurrency, this.numerator, this.denominator);
}
/**
* Multiply the price by another price, returning a new price. The other price must have the same base currency as this price's quote currency
* @param other the other price
*/;
_proto.multiply = function multiply(other) {
!this.quoteCurrency.equals(other.baseCurrency) ? invariant(false, 'TOKEN') : void 0;
var fraction = _Fraction.prototype.multiply.call(this, other);
return new Price(this.baseCurrency, other.quoteCurrency, fraction.denominator, fraction.numerator);
}
/**
* Return the amount of quote currency corresponding to a given amount of the base currency
* @param currencyAmount the amount of base currency to quote against the price
*/;
_proto.quote = function quote(currencyAmount) {
!currencyAmount.currency.equals(this.baseCurrency) ? invariant(false, 'TOKEN') : void 0;
var result = _Fraction.prototype.multiply.call(this, currencyAmount);
return CurrencyAmount.fromFractionalAmount(this.quoteCurrency, result.numerator, result.denominator);
}
/**
* Get the value scaled by decimals for formatting
* @private
*/;
_proto.toSignificant = function toSignificant(significantDigits, format, rounding) {
if (significantDigits === void 0) {
significantDigits = 6;
}
return this.adjustedForDecimals.toSignificant(significantDigits, format, rounding);
};
_proto.toFixed = function toFixed(decimalPlaces, format, rounding) {
if (decimalPlaces === void 0) {
decimalPlaces = 4;
}
return this.adjustedForDecimals.toFixed(decimalPlaces, format, rounding);
};
_createClass(Price, [{
key: "adjustedForDecimals",
get: function get() {
return _Fraction.prototype.multiply.call(this, this.scalar);
}
}]);
return Price;
}(Fraction);
function mulDivUp(x, y, div) {
var mul = x * y;
if (mul % div === BigInt(0)) {
return mul / div;
} else {
return mul / div + BigInt(1);
}
}
exports.ARGENT_WALLET_DETECTOR_ADDRESS = ARGENT_WALLET_DETECTOR_ADDRESS;
exports.ArbitrumBalancerAddresses = ArbitrumBalancerAddresses;
exports.ArbitrumHermesAddresses = ArbitrumHermesAddresses;
exports.BalancerAddresses = BalancerAddresses;
exports.BaseCurrency = BaseCurrency;
exports.CHAIN_TO_ADDRESSES_MAP = CHAIN_TO_ADDRESSES_MAP;
exports.CurrencyAmount = CurrencyAmount;
exports.ENS_REGISTRAR_ADDRESSES = ENS_REGISTRAR_ADDRESSES;
exports.EVM_CHAIN_ID_FROM_LZ_CHAIN_ID = EVM_CHAIN_ID_FROM_LZ_CHAIN_ID;
exports.EcosystemProtocols = EcosystemProtocols;
exports.Ether = Ether;
exports.FIVE = FIVE;
exports.Fraction = Fraction;
exports.GOVERNANCE_BRAVO_ADDRESSES = GOVERNANCE_BRAVO_ADDRESSES;
exports.GOVERNANCE_BRAVO_SEVERITY_1_ADDRESSES = GOVERNANCE_BRAVO_SEVERITY_1_ADDRESSES;
exports.GOVERNANCE_BRAVO_SEVERITY_2_ADDRESSES = GOVERNANCE_BRAVO_SEVERITY_2_ADDRESSES;
exports.GOVERNANCE_BRAVO_SEVERITY_3_ADDRESSES = GOVERNANCE_BRAVO_SEVERITY_3_ADDRESSES;
exports.GOVERNANCE_BRAVO_SEVERITY_4_ADDRESSES = GOVERNANCE_BRAVO_SEVERITY_4_ADDRESSES;
exports.GOVERNANCE_BRAVO_SEVERITY_5_ADDRESSES = GOVERNANCE_BRAVO_SEVERITY_5_ADDRESSES;
exports.HermesAddresses = HermesAddresses;
exports.LAYER_ZERO_ENDPOINT_ADDRESS = LAYER_ZERO_ENDPOINT_ADDRESS;
exports.LZ_CHAIN_ID_FROM_EVM_CHAIN_ID = LZ_CHAIN_ID_FROM_EVM_CHAIN_ID;
exports.MULTICALL_ADDRESSES = MULTICALL_ADDRESSES;
exports.MaiaAddresses = MaiaAddresses;
exports.MaxUint256 = MaxUint256;
exports.NEGATIVE_ONE = NEGATIVE_ONE;
exports.NONFUNGIBLE_POSITION_MANAGER_ADDRESSES = NONFUNGIBLE_POSITION_MANAGER_ADDRESSES;
exports.NativeCurrency = NativeCurrency;
exports.NativeToken = NativeToken;
exports.ONE = ONE;
exports.ONE_18 = ONE_18;
exports.Percent = Percent;
exports.Price = Price;
exports.QUOTER_ADDRESSES = QUOTER_ADDRESSES;
exports.ROOT_CHAIN_ID = ROOT_CHAIN_ID;
exports.SEND_ULTRA_LIGHT_NODE_V2_ADDRESS = SEND_ULTRA_LIGHT_NODE_V2_ADDRESS;
exports.SUPPORTED_CHAINS = SUPPORTED_CHAINS;
exports.SWAP_ROUTER_02_ADDRESSES = SWAP_ROUTER_02_ADDRESSES;
exports.SepoliaBalancerAddresses = SepoliaBalancerAddresses;
exports.SepoliaHermesAddresses = SepoliaHermesAddresses;
exports.TICK_LENS_ADDRESSES = TICK_LENS_ADDRESSES;
exports.TIMELOCK_ADDRESS = TIMELOCK_ADDRESS;
exports.TIMELOCK_SEVERITY_1_ADDRESSES = TIMELOCK_SEVERITY_1_ADDRESSES;
exports.TIMELOCK_SEVERITY_2_ADDRESSES = TIMELOCK_SEVERITY_2_ADDRESSES;
exports.TIMELOCK_SEVERITY_3_ADDRESSES = TIMELOCK_SEVERITY_3_ADDRESSES;
exports.TIMELOCK_SEVERITY_4_ADDRESSES = TIMELOCK_SEVERITY_4_ADDRESSES;
exports.TIMELOCK_SEVERITY_5_ADDRESSES = TIMELOCK_SEVERITY_5_ADDRESSES;
exports.TalosAddresses = TalosAddresses;
exports.ULTRA_LIGHT_NODE_V2_ADDRESS = ULTRA_LIGHT_NODE_V2_ADDRESS;
exports.Ulysses = Ulysses;
exports.V3_CORE_FACTORY_ADDRESSES = V3_CORE_FACTORY_ADDRESSES;
exports.V3_MIGRATOR_ADDRESSES = V3_MIGRATOR_ADDRESSES;
exports.WETH9 = WETH9;
exports.ZERO = ZERO;
exports.ZERO_ADDRESS = ZERO_ADDRESS;
exports._1000 = _1000;
exports._997 = _997;
exports.checkValidAddress = checkValidAddress;
exports.mulDivUp = mulDivUp;
exports.toHex = toHex;
exports.validateAndParseAddress = validateAndParseAddress;
//# sourceMappingURL=maia-core-sdk.cjs.development.js.map