@curvefi/api 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/constants/aliases.d.ts +1 -0
- package/lib/constants/aliases.js +13 -1
- package/lib/constants/coins/avalanche.d.ts +7 -0
- package/lib/constants/coins/avalanche.js +32 -0
- package/lib/constants/pools/avalanche.d.ts +4 -0
- package/lib/constants/pools/avalanche.js +113 -0
- package/lib/constants/pools/index.d.ts +2 -1
- package/lib/constants/pools/index.js +3 -1
- package/lib/curve.d.ts +5 -1
- package/lib/curve.js +25 -9
- package/lib/external-api.d.ts +3 -3
- package/lib/factory/common.d.ts +2 -0
- package/lib/factory/common.js +45 -0
- package/lib/factory/constants.d.ts +11 -11
- package/lib/factory/constants.js +60 -58
- package/lib/factory/factory-api.js +20 -39
- package/lib/factory/factory-crypto.js +7 -4
- package/lib/factory/factory.js +31 -163
- package/lib/interfaces.d.ts +37 -27
- package/lib/pools/PoolTemplate.js +8 -8
- package/lib/pools/poolConstructor.js +3 -3
- package/lib/router.js +10 -10
- package/lib/utils.d.ts +1 -0
- package/lib/utils.js +23 -13
- package/package.json +1 -1
package/lib/constants/aliases.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ALIASES_POLYGON = exports.ALIASES_ETHEREUM = void 0;
|
|
3
|
+
exports.ALIASES_AVALANCHE = exports.ALIASES_POLYGON = exports.ALIASES_ETHEREUM = void 0;
|
|
4
4
|
var utils_1 = require("./utils");
|
|
5
5
|
exports.ALIASES_ETHEREUM = (0, utils_1.lowerCaseValues)({
|
|
6
6
|
"crv": "0xD533a949740bb3306d119CC777fa900bA034cd52",
|
|
@@ -26,3 +26,15 @@ exports.ALIASES_POLYGON = (0, utils_1.lowerCaseValues)({
|
|
|
26
26
|
"crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99',
|
|
27
27
|
"registry_exchange": "",
|
|
28
28
|
});
|
|
29
|
+
exports.ALIASES_AVALANCHE = (0, utils_1.lowerCaseValues)({
|
|
30
|
+
"crv": "0x249848BeCA43aC405b8102Ec90Dd5F22CA513c06",
|
|
31
|
+
"minter": "0xd061D61a4d941c39E5453435B6345Dc261C2fcE0",
|
|
32
|
+
"voting_escrow": "0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2",
|
|
33
|
+
"gauge_controller": "0x2F50D538606Fa9EDD2B11E2446BEb18C9D5846bB",
|
|
34
|
+
"address_provider": "0x0000000022d53366457f9d5e68ec105046fc4383",
|
|
35
|
+
"router": "0xfA9a30350048B2BF66865ee20363067c66f67e58",
|
|
36
|
+
"deposit_and_stake": "0xB7De33440B7171159a9718CBE748086cecDd9685",
|
|
37
|
+
"factory": '0xb17b674D9c5CB2e441F8e196a2f048A81355d031',
|
|
38
|
+
"crypto_factory": '0xF18056Bbd320E96A48e3Fbf8bC061322531aac99',
|
|
39
|
+
"registry_exchange": "",
|
|
40
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const COINS_AVALANCHE: {
|
|
2
|
+
[index: string]: string;
|
|
3
|
+
};
|
|
4
|
+
export declare const cTokensAvalanche: never[];
|
|
5
|
+
export declare const yTokensAvalanche: never[];
|
|
6
|
+
export declare const ycTokensAvalanche: never[];
|
|
7
|
+
export declare const aTokensAvalanche: string[];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.aTokensAvalanche = exports.ycTokensAvalanche = exports.yTokensAvalanche = exports.cTokensAvalanche = exports.COINS_AVALANCHE = void 0;
|
|
4
|
+
var utils_1 = require("../utils");
|
|
5
|
+
exports.COINS_AVALANCHE = (0, utils_1.lowerCaseValues)({
|
|
6
|
+
'crv.e': '0x249848BeCA43aC405b8102Ec90Dd5F22CA513c06',
|
|
7
|
+
// --- USD ---
|
|
8
|
+
'dai.e': '0xd586E7F844cEa2F87f50152665BCbc2C279D8d70',
|
|
9
|
+
'usdc.e': '0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664',
|
|
10
|
+
'usdt.e': '0xc7198437980c041c805A1EDcbA50c1Ce5db95118',
|
|
11
|
+
'avdai': '0x47AFa96Cdc9fAb46904A55a6ad4bf6660B53c38a',
|
|
12
|
+
'avusdc': '0x46A51127C3ce23fb7AB1DE06226147F446e4a857',
|
|
13
|
+
'avusdt': '0x532E6537FEA298397212F09A61e03311686f548e',
|
|
14
|
+
'av3crv': '0x1337bedc9d22ecbe766df105c9623922a27963ec',
|
|
15
|
+
// --- BTC ---
|
|
16
|
+
'wbtc.e': '0x50b7545627a5162F82A992c33b87aDc75187B218',
|
|
17
|
+
'renbtc': '0xDBf31dF14B66535aF65AaC99C32e9eA844e14501',
|
|
18
|
+
'avwbtc': '0x686bEF2417b6Dc32C50a3cBfbCC3bb60E1e9a15D',
|
|
19
|
+
// --- ETH ---
|
|
20
|
+
'weth.e': '0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB',
|
|
21
|
+
'avweth': '0x53f7c5869a859F0AeC3D334ee8B4Cf01E3492f21',
|
|
22
|
+
});
|
|
23
|
+
exports.cTokensAvalanche = []; //.map((a) => a.toLowerCase());
|
|
24
|
+
exports.yTokensAvalanche = []; //.map((a) => a.toLowerCase());
|
|
25
|
+
exports.ycTokensAvalanche = []; //.map((a) => a.toLowerCase());
|
|
26
|
+
exports.aTokensAvalanche = [
|
|
27
|
+
'0x47AFa96Cdc9fAb46904A55a6ad4bf6660B53c38a',
|
|
28
|
+
'0x46A51127C3ce23fb7AB1DE06226147F446e4a857',
|
|
29
|
+
'0x532E6537FEA298397212F09A61e03311686f548e',
|
|
30
|
+
'0x686bEF2417b6Dc32C50a3cBfbCC3bb60E1e9a15D',
|
|
31
|
+
'0x53f7c5869a859F0AeC3D334ee8B4Cf01E3492f21', // avWETH
|
|
32
|
+
].map(function (a) { return a.toLowerCase(); });
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.POOLS_DATA_AVALANCHE = void 0;
|
|
7
|
+
var utils_1 = require("../utils");
|
|
8
|
+
var swap_json_1 = __importDefault(require("../abis/aave/swap.json"));
|
|
9
|
+
var rewards_json_1 = __importDefault(require("../abis/paave/rewards.json"));
|
|
10
|
+
var swap_json_2 = __importDefault(require("../abis/ren-polygon/swap.json"));
|
|
11
|
+
var swap_json_3 = __importDefault(require("../abis/atricrypto3/swap.json"));
|
|
12
|
+
var zap_json_1 = __importDefault(require("../abis/atricrypto3/zap.json"));
|
|
13
|
+
var gauge_rewards_only_json_1 = __importDefault(require("../abis/gauge_rewards_only.json"));
|
|
14
|
+
exports.POOLS_DATA_AVALANCHE = (0, utils_1.lowerCasePoolDataAddresses)({
|
|
15
|
+
aave: {
|
|
16
|
+
name: "aave",
|
|
17
|
+
full_name: "aave",
|
|
18
|
+
symbol: "aave",
|
|
19
|
+
reference_asset: 'USD',
|
|
20
|
+
swap_address: '0x7f90122BF0700F9E7e1F688fe926940E8839F353',
|
|
21
|
+
token_address: '0x1337BedC9D22ecbe766dF105c9623922A27963EC',
|
|
22
|
+
gauge_address: '0x5B5CFE992AdAC0C9D48E05854B2d91C73a003858',
|
|
23
|
+
sCurveRewards_address: '0xB504b6EB06760019801a91B451d3f7BD9f027fC9',
|
|
24
|
+
is_lending: true,
|
|
25
|
+
underlying_coins: ['DAI.e', 'USDC.e', 'USDT.e'],
|
|
26
|
+
wrapped_coins: ['avDAI', 'avUSDC', 'avUSDT'],
|
|
27
|
+
underlying_coin_addresses: [
|
|
28
|
+
'0xd586E7F844cEa2F87f50152665BCbc2C279D8d70',
|
|
29
|
+
'0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664',
|
|
30
|
+
'0xc7198437980c041c805A1EDcbA50c1Ce5db95118',
|
|
31
|
+
],
|
|
32
|
+
wrapped_coin_addresses: [
|
|
33
|
+
'0x47AFa96Cdc9fAb46904A55a6ad4bf6660B53c38a',
|
|
34
|
+
'0x46A51127C3ce23fb7AB1DE06226147F446e4a857',
|
|
35
|
+
'0x532E6537FEA298397212F09A61e03311686f548e',
|
|
36
|
+
],
|
|
37
|
+
underlying_decimals: [18, 6, 6],
|
|
38
|
+
wrapped_decimals: [18, 6, 6],
|
|
39
|
+
use_lending: [true, true, true],
|
|
40
|
+
reward_tokens: ["0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"],
|
|
41
|
+
reward_decimals: [18],
|
|
42
|
+
swap_abi: swap_json_1.default,
|
|
43
|
+
gauge_abi: gauge_rewards_only_json_1.default,
|
|
44
|
+
sCurveRewards_abi: rewards_json_1.default,
|
|
45
|
+
},
|
|
46
|
+
ren: {
|
|
47
|
+
name: "ren",
|
|
48
|
+
full_name: "ren",
|
|
49
|
+
symbol: "ren",
|
|
50
|
+
reference_asset: 'BTC',
|
|
51
|
+
swap_address: '0x16a7DA911A4DD1d83F3fF066fE28F3C792C50d90',
|
|
52
|
+
token_address: '0xC2b1DF84112619D190193E48148000e3990Bf627',
|
|
53
|
+
gauge_address: '0x0f9cb53Ebe405d49A0bbdBD291A65Ff571bC83e1',
|
|
54
|
+
sCurveRewards_address: '0x75D05190f35567e79012c2F0a02330D3Ed8a1F74',
|
|
55
|
+
is_lending: true,
|
|
56
|
+
underlying_coins: ['WBTC.e', 'renBTC'],
|
|
57
|
+
wrapped_coins: ['avWBTC', 'renBTC'],
|
|
58
|
+
underlying_coin_addresses: [
|
|
59
|
+
'0x50b7545627a5162F82A992c33b87aDc75187B218',
|
|
60
|
+
'0xDBf31dF14B66535aF65AaC99C32e9eA844e14501',
|
|
61
|
+
],
|
|
62
|
+
wrapped_coin_addresses: [
|
|
63
|
+
'0x686bEF2417b6Dc32C50a3cBfbCC3bb60E1e9a15D',
|
|
64
|
+
'0xDBf31dF14B66535aF65AaC99C32e9eA844e14501',
|
|
65
|
+
],
|
|
66
|
+
underlying_decimals: [8, 8],
|
|
67
|
+
wrapped_decimals: [8, 8],
|
|
68
|
+
use_lending: [true, false],
|
|
69
|
+
reward_tokens: ["0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"],
|
|
70
|
+
reward_decimals: [18],
|
|
71
|
+
swap_abi: swap_json_2.default,
|
|
72
|
+
gauge_abi: gauge_rewards_only_json_1.default,
|
|
73
|
+
sCurveRewards_abi: rewards_json_1.default,
|
|
74
|
+
},
|
|
75
|
+
atricrypto: {
|
|
76
|
+
name: "atricrypto",
|
|
77
|
+
full_name: "atricrypto",
|
|
78
|
+
symbol: "atricrypto",
|
|
79
|
+
reference_asset: 'CRYPTO',
|
|
80
|
+
swap_address: '0xB755B949C126C04e0348DD881a5cF55d424742B2',
|
|
81
|
+
token_address: '0x1daB6560494B04473A0BE3E7D83CF3Fdf3a51828',
|
|
82
|
+
gauge_address: '0x445FE580eF8d70FF569aB36e80c647af338db351',
|
|
83
|
+
deposit_address: '0x58e57cA18B7A47112b877E31929798Cd3D703b0f',
|
|
84
|
+
sCurveRewards_address: '0xa05E565cA0a103FcD999c7A7b8de7Bd15D5f6505',
|
|
85
|
+
is_meta: true,
|
|
86
|
+
is_crypto: true,
|
|
87
|
+
is_fake: true,
|
|
88
|
+
base_pool: 'aave',
|
|
89
|
+
underlying_coins: ['DAI.e', 'USDC.e', 'USDT.e', 'WBTC.e', 'WETH.e'],
|
|
90
|
+
wrapped_coins: ['av3CRV', 'avWBTC', 'avWETH'],
|
|
91
|
+
underlying_coin_addresses: [
|
|
92
|
+
'0xd586E7F844cEa2F87f50152665BCbc2C279D8d70',
|
|
93
|
+
'0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664',
|
|
94
|
+
'0xc7198437980c041c805A1EDcbA50c1Ce5db95118',
|
|
95
|
+
'0x50b7545627a5162F82A992c33b87aDc75187B218',
|
|
96
|
+
'0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB', // WETH.e
|
|
97
|
+
],
|
|
98
|
+
wrapped_coin_addresses: [
|
|
99
|
+
'0x1337BedC9D22ecbe766dF105c9623922A27963EC',
|
|
100
|
+
'0x686bEF2417b6Dc32C50a3cBfbCC3bb60E1e9a15D',
|
|
101
|
+
'0x53f7c5869a859F0AeC3D334ee8B4Cf01E3492f21', // avWETH
|
|
102
|
+
],
|
|
103
|
+
underlying_decimals: [18, 6, 6, 8, 18],
|
|
104
|
+
wrapped_decimals: [18, 8, 18],
|
|
105
|
+
use_lending: [false, false, false, false, false],
|
|
106
|
+
reward_tokens: ["0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"],
|
|
107
|
+
reward_decimals: [18],
|
|
108
|
+
swap_abi: swap_json_3.default,
|
|
109
|
+
gauge_abi: gauge_rewards_only_json_1.default,
|
|
110
|
+
deposit_abi: zap_json_1.default,
|
|
111
|
+
sCurveRewards_abi: rewards_json_1.default,
|
|
112
|
+
},
|
|
113
|
+
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { POOLS_DATA_ETHEREUM } from "./ethereum";
|
|
2
2
|
import { POOLS_DATA_POLYGON } from "./polygon";
|
|
3
|
-
|
|
3
|
+
import { POOLS_DATA_AVALANCHE } from "./avalanche";
|
|
4
|
+
export { POOLS_DATA_ETHEREUM, POOLS_DATA_POLYGON, POOLS_DATA_AVALANCHE, };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.POOLS_DATA_POLYGON = exports.POOLS_DATA_ETHEREUM = void 0;
|
|
3
|
+
exports.POOLS_DATA_AVALANCHE = exports.POOLS_DATA_POLYGON = exports.POOLS_DATA_ETHEREUM = void 0;
|
|
4
4
|
var ethereum_1 = require("./ethereum");
|
|
5
5
|
Object.defineProperty(exports, "POOLS_DATA_ETHEREUM", { enumerable: true, get: function () { return ethereum_1.POOLS_DATA_ETHEREUM; } });
|
|
6
6
|
var polygon_1 = require("./polygon");
|
|
7
7
|
Object.defineProperty(exports, "POOLS_DATA_POLYGON", { enumerable: true, get: function () { return polygon_1.POOLS_DATA_POLYGON; } });
|
|
8
|
+
var avalanche_1 = require("./avalanche");
|
|
9
|
+
Object.defineProperty(exports, "POOLS_DATA_AVALANCHE", { enumerable: true, get: function () { return avalanche_1.POOLS_DATA_AVALANCHE; } });
|
package/lib/curve.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { ethers, Contract } from "ethers";
|
|
2
2
|
import { Networkish } from "@ethersproject/networks";
|
|
3
3
|
import { Provider as MulticallProvider, Contract as MulticallContract } from 'ethcall';
|
|
4
|
-
import { IPoolData, IDict, ICurve } from "./interfaces";
|
|
4
|
+
import { IPoolData, IDict, ICurve, INetworkName } from "./interfaces";
|
|
5
|
+
export declare const NETWORK_CONSTANTS: {
|
|
6
|
+
[index: number]: any;
|
|
7
|
+
};
|
|
5
8
|
declare class Curve implements ICurve {
|
|
6
9
|
provider: ethers.providers.Web3Provider | ethers.providers.JsonRpcProvider;
|
|
7
10
|
multicallProvider: MulticallProvider;
|
|
@@ -28,6 +31,7 @@ declare class Curve implements ICurve {
|
|
|
28
31
|
maxPriorityFeePerGas?: number | ethers.BigNumber;
|
|
29
32
|
};
|
|
30
33
|
constants: {
|
|
34
|
+
NETWORK_NAME: INetworkName;
|
|
31
35
|
ALIASES: IDict<string>;
|
|
32
36
|
POOLS_DATA: IDict<IPoolData>;
|
|
33
37
|
FACTORY_POOLS_DATA: IDict<IPoolData>;
|
package/lib/curve.js
CHANGED
|
@@ -59,7 +59,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
59
59
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
60
60
|
};
|
|
61
61
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
-
exports.curve = void 0;
|
|
62
|
+
exports.curve = exports.NETWORK_CONSTANTS = void 0;
|
|
63
63
|
var ethers_1 = require("ethers");
|
|
64
64
|
var ethcall_1 = require("ethcall");
|
|
65
65
|
var factory_1 = require("./factory/factory");
|
|
@@ -81,10 +81,12 @@ var factory_crypto_json_1 = __importDefault(require("./constants/abis/factory-cr
|
|
|
81
81
|
var pools_1 = require("./constants/pools");
|
|
82
82
|
var ethereum_1 = require("./constants/coins/ethereum");
|
|
83
83
|
var polygon_1 = require("./constants/coins/polygon");
|
|
84
|
+
var avalanche_1 = require("./constants/coins/avalanche");
|
|
84
85
|
var aliases_1 = require("./constants/aliases");
|
|
85
86
|
var utils_1 = require("./constants/utils");
|
|
86
|
-
|
|
87
|
+
exports.NETWORK_CONSTANTS = {
|
|
87
88
|
1: {
|
|
89
|
+
NAME: 'ethereum',
|
|
88
90
|
ALIASES: aliases_1.ALIASES_ETHEREUM,
|
|
89
91
|
POOLS_DATA: pools_1.POOLS_DATA_ETHEREUM,
|
|
90
92
|
COINS: ethereum_1.COINS_ETHEREUM,
|
|
@@ -94,6 +96,7 @@ var CONSTANTS = {
|
|
|
94
96
|
aTokens: ethereum_1.aTokensEthereum,
|
|
95
97
|
},
|
|
96
98
|
137: {
|
|
99
|
+
NAME: 'polygon',
|
|
97
100
|
ALIASES: aliases_1.ALIASES_POLYGON,
|
|
98
101
|
POOLS_DATA: pools_1.POOLS_DATA_POLYGON,
|
|
99
102
|
COINS: polygon_1.COINS_POLYGON,
|
|
@@ -102,6 +105,16 @@ var CONSTANTS = {
|
|
|
102
105
|
ycTokens: polygon_1.ycTokensPolygon,
|
|
103
106
|
aTokens: polygon_1.aTokensPolygon,
|
|
104
107
|
},
|
|
108
|
+
43114: {
|
|
109
|
+
NAME: 'avalanche',
|
|
110
|
+
ALIASES: aliases_1.ALIASES_AVALANCHE,
|
|
111
|
+
POOLS_DATA: pools_1.POOLS_DATA_AVALANCHE,
|
|
112
|
+
COINS: avalanche_1.COINS_AVALANCHE,
|
|
113
|
+
cTokens: avalanche_1.cTokensAvalanche,
|
|
114
|
+
yTokens: avalanche_1.yTokensAvalanche,
|
|
115
|
+
ycTokens: avalanche_1.ycTokensAvalanche,
|
|
116
|
+
aTokens: avalanche_1.aTokensAvalanche,
|
|
117
|
+
},
|
|
105
118
|
};
|
|
106
119
|
var Curve = /** @class */ (function () {
|
|
107
120
|
function Curve() {
|
|
@@ -118,6 +131,7 @@ var Curve = /** @class */ (function () {
|
|
|
118
131
|
this.constantOptions = { gasLimit: 12000000 };
|
|
119
132
|
this.options = {};
|
|
120
133
|
this.constants = {
|
|
134
|
+
NETWORK_NAME: 'ethereum',
|
|
121
135
|
ALIASES: {},
|
|
122
136
|
POOLS_DATA: {},
|
|
123
137
|
FACTORY_POOLS_DATA: {},
|
|
@@ -148,6 +162,7 @@ var Curve = /** @class */ (function () {
|
|
|
148
162
|
this.constantOptions = { gasLimit: 12000000 };
|
|
149
163
|
this.options = {};
|
|
150
164
|
this.constants = {
|
|
165
|
+
NETWORK_NAME: 'ethereum',
|
|
151
166
|
ALIASES: {},
|
|
152
167
|
POOLS_DATA: {},
|
|
153
168
|
FACTORY_POOLS_DATA: {},
|
|
@@ -203,16 +218,17 @@ var Curve = /** @class */ (function () {
|
|
|
203
218
|
network = _a;
|
|
204
219
|
console.log("CURVE-JS IS CONNECTED TO NETWORK:", network);
|
|
205
220
|
this.chainId = network.chainId === 1337 ? 1 : network.chainId;
|
|
206
|
-
this.constants.
|
|
207
|
-
this.constants.
|
|
208
|
-
this.constants.
|
|
221
|
+
this.constants.NETWORK_NAME = exports.NETWORK_CONSTANTS[this.chainId].NAME;
|
|
222
|
+
this.constants.ALIASES = exports.NETWORK_CONSTANTS[this.chainId].ALIASES;
|
|
223
|
+
this.constants.POOLS_DATA = exports.NETWORK_CONSTANTS[this.chainId].POOLS_DATA;
|
|
224
|
+
this.constants.COINS = exports.NETWORK_CONSTANTS[this.chainId].COINS;
|
|
209
225
|
this.constants.DECIMALS = (0, utils_1.extractDecimals)(this.constants.POOLS_DATA);
|
|
210
226
|
this.constants.GAUGES = (0, utils_1.extractGauges)(this.constants.POOLS_DATA);
|
|
211
227
|
_b = [
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
228
|
+
exports.NETWORK_CONSTANTS[this.chainId].cTokens,
|
|
229
|
+
exports.NETWORK_CONSTANTS[this.chainId].yTokens,
|
|
230
|
+
exports.NETWORK_CONSTANTS[this.chainId].ycTokens,
|
|
231
|
+
exports.NETWORK_CONSTANTS[this.chainId].aTokens,
|
|
216
232
|
], cTokens = _b[0], yTokens = _b[1], ycTokens = _b[2], aTokens = _b[3];
|
|
217
233
|
customAbiTokens = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], cTokens, true), yTokens, true), ycTokens, true), aTokens, true);
|
|
218
234
|
this.multicallProvider = new ethcall_1.Provider();
|
package/lib/external-api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IExtendedPoolDataFromApi, ISubgraphPoolData, IReward, IDict } from "./interfaces";
|
|
1
|
+
import { IExtendedPoolDataFromApi, ISubgraphPoolData, IReward, IDict, INetworkName } from "./interfaces";
|
|
2
2
|
import memoize from "memoizee";
|
|
3
|
-
export declare const _getPoolsFromApi: ((network:
|
|
4
|
-
export declare const _getSubgraphData: ((network:
|
|
3
|
+
export declare const _getPoolsFromApi: ((network: INetworkName, poolType: "main" | "crypto" | "factory" | "factory-crypto") => Promise<IExtendedPoolDataFromApi>) & memoize.Memoized<(network: INetworkName, poolType: "main" | "crypto" | "factory" | "factory-crypto") => Promise<IExtendedPoolDataFromApi>>;
|
|
4
|
+
export declare const _getSubgraphData: ((network: INetworkName) => Promise<ISubgraphPoolData[]>) & memoize.Memoized<(network: INetworkName) => Promise<ISubgraphPoolData[]>>;
|
|
5
5
|
export declare const _getMainPoolsGaugeRewards: (() => Promise<IDict<IReward[]>>) & memoize.Memoized<() => Promise<IDict<IReward[]>>>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.setFactoryZapContracts = void 0;
|
|
7
|
+
var ethers_1 = require("ethers");
|
|
8
|
+
var ethcall_1 = require("ethcall");
|
|
9
|
+
var deposit_json_1 = __importDefault(require("../constants/abis/factoryPools/deposit.json"));
|
|
10
|
+
var DepositZapMetaUsdPolygon_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapMetaUsdPolygon.json"));
|
|
11
|
+
var DepositZapMetaBtcPolygon_json_1 = __importDefault(require("../constants/abis/factory-v2/DepositZapMetaBtcPolygon.json"));
|
|
12
|
+
function setFactoryZapContracts() {
|
|
13
|
+
if (this.chainId === 1) {
|
|
14
|
+
var metaSBtcZapAddress = "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase();
|
|
15
|
+
this.contracts[metaSBtcZapAddress] = {
|
|
16
|
+
contract: new ethers_1.Contract(metaSBtcZapAddress, deposit_json_1.default, this.signer || this.provider),
|
|
17
|
+
multicallContract: new ethcall_1.Contract(metaSBtcZapAddress, deposit_json_1.default),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
else if (this.chainId === 137) {
|
|
21
|
+
var metaUsdZapAddress = "0x5ab5C56B9db92Ba45a0B46a207286cD83C15C939".toLowerCase();
|
|
22
|
+
this.contracts[metaUsdZapAddress] = {
|
|
23
|
+
contract: new ethers_1.Contract(metaUsdZapAddress, DepositZapMetaUsdPolygon_json_1.default, this.signer || this.provider),
|
|
24
|
+
multicallContract: new ethcall_1.Contract(metaUsdZapAddress, DepositZapMetaUsdPolygon_json_1.default),
|
|
25
|
+
};
|
|
26
|
+
var metaBtcZapAddress = "0xE2e6DC1708337A6e59f227921db08F21e3394723".toLowerCase();
|
|
27
|
+
this.contracts[metaBtcZapAddress] = {
|
|
28
|
+
contract: new ethers_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default, this.signer || this.provider),
|
|
29
|
+
multicallContract: new ethcall_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
else if (this.chainId === 43114) {
|
|
33
|
+
var metaUsdZapAddress = "0x001E3BA199B4FF4B5B6e97aCD96daFC0E2e4156e".toLowerCase();
|
|
34
|
+
this.contracts[metaUsdZapAddress] = {
|
|
35
|
+
contract: new ethers_1.Contract(metaUsdZapAddress, DepositZapMetaUsdPolygon_json_1.default, this.signer || this.provider),
|
|
36
|
+
multicallContract: new ethcall_1.Contract(metaUsdZapAddress, DepositZapMetaUsdPolygon_json_1.default),
|
|
37
|
+
};
|
|
38
|
+
var metaBtcZapAddress = "0xEeB3DDBcc4174e0b3fd1C13aD462b95D11Ef42C3".toLowerCase();
|
|
39
|
+
this.contracts[metaBtcZapAddress] = {
|
|
40
|
+
contract: new ethers_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default, this.signer || this.provider),
|
|
41
|
+
multicallContract: new ethcall_1.Contract(metaBtcZapAddress, DepositZapMetaBtcPolygon_json_1.default),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.setFactoryZapContracts = setFactoryZapContracts;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { IDict } from "../interfaces";
|
|
2
2
|
export declare const implementationABIDictEthereum: IDict<any>;
|
|
3
3
|
export declare const implementationABIDictPolygon: IDict<any>;
|
|
4
|
+
export declare const implementationABIDictAvalanche: IDict<any>;
|
|
4
5
|
export declare const implementationBasePoolAddressDictEthereum: IDict<any>;
|
|
5
6
|
export declare const implementationBasePoolAddressDictPolygon: IDict<any>;
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const basePoolAddressDecimalsDictPolygon: IDict<number[]>;
|
|
14
|
-
export declare const basePoolAddressZapDictEthereum: IDict<string>;
|
|
15
|
-
export declare const basePoolAddressZapDictPolygon: IDict<string>;
|
|
16
|
-
export declare const blackListPolygon: string[];
|
|
7
|
+
export declare const implementationBasePoolAddressDictAvalanche: IDict<any>;
|
|
8
|
+
export declare const basePoolAddressIdDictEthereum: IDict<string>;
|
|
9
|
+
export declare const basePoolAddressIdDictPolygon: IDict<string>;
|
|
10
|
+
export declare const basePoolAddressIdDictAvalanche: IDict<string>;
|
|
11
|
+
export declare const basePoolIdZapDictEthereum: IDict<string>;
|
|
12
|
+
export declare const basePoolIdZapDictPolygon: IDict<string>;
|
|
13
|
+
export declare const basePoolIdZapDictAvalanche: IDict<string>;
|
|
17
14
|
export declare const WETH_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
|
|
18
15
|
export declare const ETH_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
16
|
+
export declare const FACTORY_CONSTANTS: {
|
|
17
|
+
[index: number]: any;
|
|
18
|
+
};
|
package/lib/factory/constants.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.FACTORY_CONSTANTS = exports.ETH_ADDRESS = exports.WETH_ADDRESS = exports.basePoolIdZapDictAvalanche = exports.basePoolIdZapDictPolygon = exports.basePoolIdZapDictEthereum = exports.basePoolAddressIdDictAvalanche = exports.basePoolAddressIdDictPolygon = exports.basePoolAddressIdDictEthereum = exports.implementationBasePoolAddressDictAvalanche = exports.implementationBasePoolAddressDictPolygon = exports.implementationBasePoolAddressDictEthereum = exports.implementationABIDictAvalanche = exports.implementationABIDictPolygon = exports.implementationABIDictEthereum = void 0;
|
|
7
7
|
var swap_json_1 = __importDefault(require("../constants/abis/factoryPools/swap.json"));
|
|
8
8
|
var MetaUSD_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaUSD.json"));
|
|
9
9
|
var MetaUSDBalances_json_1 = __importDefault(require("../constants/abis/factory-v2/MetaUSDBalances.json"));
|
|
@@ -62,6 +62,24 @@ exports.implementationABIDictPolygon = {
|
|
|
62
62
|
"0xf31bcdf0B9a5eCD7AB463eB905551fBc32e51856": Plain4ETH_json_1.default,
|
|
63
63
|
"0xAc273d5b4FC06625d8b1abA3BE8De15bDFb8E39f": Plain4Optimized_json_1.default,
|
|
64
64
|
};
|
|
65
|
+
exports.implementationABIDictAvalanche = {
|
|
66
|
+
"0xA237034249290De2B07988Ac64b96f22c0E76fE0": MetaUSD_json_1.default,
|
|
67
|
+
"0xc50C05Ca1f8C2346664bd0d4a1eb6aC1Da38414f": MetaUSDBalances_json_1.default,
|
|
68
|
+
"0xa27f39E9C21b3376F43266E13Ad5A5d6E9BdB320": MetaBTCRen_json_1.default,
|
|
69
|
+
"0x505C34ED8dBE96d2D5C7D83158aA844887770970": MetaBTCBalancesRen_json_1.default,
|
|
70
|
+
"0x697434ca761d4F86b553784B69F4f37F5eDf54dF": Plain2Basic_json_1.default,
|
|
71
|
+
"0xBdFF0C27dd073C119ebcb1299a68A6A92aE607F0": Plain2Balances_json_1.default,
|
|
72
|
+
"0x64448B78561690B70E17CBE8029a3e5c1bB7136e": Plain2ETH_json_1.default,
|
|
73
|
+
"0x09672362833d8f703D5395ef3252D4Bfa51c15ca": Plain2Optimized_json_1.default,
|
|
74
|
+
"0x1de7f0866e2c4adAC7b457c58Cc25c8688CDa1f2": Plain3Basic_json_1.default,
|
|
75
|
+
"0x094d12e5b541784701FD8d65F11fc0598FBC6332": Plain3Balances_json_1.default,
|
|
76
|
+
"0xF1f85a74AD6c64315F85af52d3d46bF715236ADc": Plain3ETH_json_1.default,
|
|
77
|
+
"0xaa82ca713D94bBA7A89CEAB55314F9EfFEdDc78c": Plain3Optimized_json_1.default,
|
|
78
|
+
"0x7544Fe3d184b6B55D6B36c3FCA1157eE0Ba30287": Plain4Basic_json_1.default,
|
|
79
|
+
"0x7D86446dDb609eD0F5f8684AcF30380a356b2B4c": Plain4Balances_json_1.default,
|
|
80
|
+
"0x0eb0F1FaF5F509Ac53fA224477509EAD167cf410": Plain4ETH_json_1.default,
|
|
81
|
+
"0xCE94D3E5b0D80565D7B713A687b39a3Dc81780BA": Plain4Optimized_json_1.default,
|
|
82
|
+
};
|
|
65
83
|
exports.implementationBasePoolAddressDictEthereum = {
|
|
66
84
|
"0x5F890841f657d90E081bAbdB532A05996Af79Fe6": "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7",
|
|
67
85
|
"0x213be373FDff327658139C7df330817DAD2d5bBE": "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7",
|
|
@@ -77,73 +95,57 @@ exports.implementationBasePoolAddressDictPolygon = {
|
|
|
77
95
|
"0xC05EB760A135d3D0c839f1141423002681157a17": "0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67",
|
|
78
96
|
"0xD8336532f6ED7b94282fAF724fe41d6145E07Cfc": "0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67", // ren
|
|
79
97
|
};
|
|
80
|
-
exports.
|
|
98
|
+
exports.implementationBasePoolAddressDictAvalanche = {
|
|
99
|
+
"0xA237034249290De2B07988Ac64b96f22c0E76fE0": "0x7f90122BF0700F9E7e1F688fe926940E8839F353",
|
|
100
|
+
"0xc50C05Ca1f8C2346664bd0d4a1eb6aC1Da38414f": "0x7f90122BF0700F9E7e1F688fe926940E8839F353",
|
|
101
|
+
"0xa27f39E9C21b3376F43266E13Ad5A5d6E9BdB320": "0x16a7DA911A4DD1d83F3fF066fE28F3C792C50d90",
|
|
102
|
+
"0x505C34ED8dBE96d2D5C7D83158aA844887770970": "0x16a7DA911A4DD1d83F3fF066fE28F3C792C50d90", // ren
|
|
103
|
+
};
|
|
104
|
+
exports.basePoolAddressIdDictEthereum = {
|
|
81
105
|
"0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7": "3pool",
|
|
82
106
|
"0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714": "sbtc",
|
|
83
107
|
"0x93054188d876f558f4a66B2EF1d97d16eDf0895B": "ren",
|
|
84
108
|
};
|
|
85
|
-
exports.
|
|
109
|
+
exports.basePoolAddressIdDictPolygon = {
|
|
86
110
|
"0x445FE580eF8d70FF569aB36e80c647af338db351": "aave",
|
|
87
111
|
"0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67": "ren",
|
|
88
112
|
};
|
|
89
|
-
exports.
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"0x93054188d876f558f4a66B2EF1d97d16eDf0895B": ['renBTC', 'WBTC'], // ren
|
|
93
|
-
};
|
|
94
|
-
exports.basePoolAddressCoinsDictPolygon = {
|
|
95
|
-
"0x445FE580eF8d70FF569aB36e80c647af338db351": ['DAI', 'USDC', 'USDT'],
|
|
96
|
-
"0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67": ['WBTC', 'renBTC'], // ren
|
|
97
|
-
};
|
|
98
|
-
exports.basePoolAddressCoinAddressesDictEthereum = {
|
|
99
|
-
"0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7": [
|
|
100
|
-
'0x6B175474E89094C44Da98b954EedeAC495271d0F',
|
|
101
|
-
'0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
102
|
-
'0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
|
103
|
-
].map(function (addr) { return addr.toLowerCase(); }),
|
|
104
|
-
"0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714": [
|
|
105
|
-
'0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D',
|
|
106
|
-
'0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
|
|
107
|
-
'0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6',
|
|
108
|
-
].map(function (addr) { return addr.toLowerCase(); }),
|
|
109
|
-
"0x93054188d876f558f4a66B2EF1d97d16eDf0895B": [
|
|
110
|
-
'0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D',
|
|
111
|
-
'0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
|
|
112
|
-
].map(function (addr) { return addr.toLowerCase(); }),
|
|
113
|
+
exports.basePoolAddressIdDictAvalanche = {
|
|
114
|
+
"0x7f90122BF0700F9E7e1F688fe926940E8839F353": "aave",
|
|
115
|
+
"0x16a7DA911A4DD1d83F3fF066fE28F3C792C50d90": "ren",
|
|
113
116
|
};
|
|
114
|
-
exports.
|
|
115
|
-
"
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
'0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
|
|
119
|
-
].map(function (addr) { return addr.toLowerCase(); }),
|
|
120
|
-
"0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67": [
|
|
121
|
-
'0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6',
|
|
122
|
-
'0xDBf31dF14B66535aF65AaC99C32e9eA844e14501',
|
|
123
|
-
].map(function (addr) { return addr.toLowerCase(); }),
|
|
117
|
+
exports.basePoolIdZapDictEthereum = {
|
|
118
|
+
'3pool': "0xA79828DF1850E8a3A3064576f380D90aECDD3359".toLowerCase(),
|
|
119
|
+
sbtc: "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase(),
|
|
120
|
+
ren: "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase(), // TODO CHECK!!!
|
|
124
121
|
};
|
|
125
|
-
exports.
|
|
126
|
-
"
|
|
127
|
-
"
|
|
128
|
-
"0x93054188d876f558f4a66B2EF1d97d16eDf0895B": [8, 8], // ren
|
|
122
|
+
exports.basePoolIdZapDictPolygon = {
|
|
123
|
+
aave: "0x5ab5C56B9db92Ba45a0B46a207286cD83C15C939".toLowerCase(),
|
|
124
|
+
ren: "0xE2e6DC1708337A6e59f227921db08F21e3394723".toLowerCase(),
|
|
129
125
|
};
|
|
130
|
-
exports.
|
|
131
|
-
"
|
|
132
|
-
"
|
|
126
|
+
exports.basePoolIdZapDictAvalanche = {
|
|
127
|
+
aave: "0x001E3BA199B4FF4B5B6e97aCD96daFC0E2e4156e".toLowerCase(),
|
|
128
|
+
ren: "0xEeB3DDBcc4174e0b3fd1C13aD462b95D11Ef42C3".toLowerCase(),
|
|
133
129
|
};
|
|
134
|
-
exports.basePoolAddressZapDictEthereum = {
|
|
135
|
-
"0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7": "0xA79828DF1850E8a3A3064576f380D90aECDD3359".toLowerCase(),
|
|
136
|
-
"0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714": "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase(),
|
|
137
|
-
"0x93054188d876f558f4a66B2EF1d97d16eDf0895B": "0x7abdbaf29929e7f8621b757d2a7c04d78d633834".toLowerCase(), // ren TODO CHECK!!!
|
|
138
|
-
};
|
|
139
|
-
exports.basePoolAddressZapDictPolygon = {
|
|
140
|
-
"0x445FE580eF8d70FF569aB36e80c647af338db351": "0x5ab5C56B9db92Ba45a0B46a207286cD83C15C939".toLowerCase(),
|
|
141
|
-
"0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67": "0xE2e6DC1708337A6e59f227921db08F21e3394723".toLowerCase(), // ren
|
|
142
|
-
};
|
|
143
|
-
exports.blackListPolygon = [
|
|
144
|
-
"0x666dc3b4babfd063faf965bd020024af0dc51b64",
|
|
145
|
-
"0xe4199bc5c5c1f63dba47b56b6db7144c51cf0bf8",
|
|
146
|
-
"0x88c4d6534165510b2e2caf0a130d4f70aa4b6d71",
|
|
147
|
-
];
|
|
148
130
|
exports.WETH_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
|
|
149
131
|
exports.ETH_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
132
|
+
exports.FACTORY_CONSTANTS = {
|
|
133
|
+
1: {
|
|
134
|
+
implementationABIDict: exports.implementationABIDictEthereum,
|
|
135
|
+
implementationBasePoolAddressDict: exports.implementationBasePoolAddressDictEthereum,
|
|
136
|
+
basePoolAddressIdDict: exports.basePoolAddressIdDictEthereum,
|
|
137
|
+
basePoolIdZapDict: exports.basePoolIdZapDictEthereum,
|
|
138
|
+
},
|
|
139
|
+
137: {
|
|
140
|
+
implementationABIDict: exports.implementationABIDictPolygon,
|
|
141
|
+
implementationBasePoolAddressDict: exports.implementationBasePoolAddressDictPolygon,
|
|
142
|
+
basePoolAddressIdDict: exports.basePoolAddressIdDictPolygon,
|
|
143
|
+
basePoolIdZapDict: exports.basePoolIdZapDictPolygon,
|
|
144
|
+
},
|
|
145
|
+
43114: {
|
|
146
|
+
implementationABIDict: exports.implementationABIDictAvalanche,
|
|
147
|
+
implementationBasePoolAddressDict: exports.implementationBasePoolAddressDictAvalanche,
|
|
148
|
+
basePoolAddressIdDict: exports.basePoolAddressIdDictAvalanche,
|
|
149
|
+
basePoolIdZapDict: exports.basePoolIdZapDictAvalanche,
|
|
150
|
+
},
|
|
151
|
+
};
|