@curvefi/api 2.0.0 → 2.2.1
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/README.md +30 -7
- 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 +33 -0
- package/lib/constants/pools/avalanche.d.ts +4 -0
- package/lib/constants/pools/avalanche.js +113 -0
- package/lib/constants/pools/ethereum.js +0 -1
- 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 +27 -11
- 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/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/interfaces.d.ts +37 -27
- package/lib/pools/PoolTemplate.d.ts +3 -0
- package/lib/pools/PoolTemplate.js +106 -24
- package/lib/pools/poolConstructor.js +3 -3
- package/lib/router.d.ts +1 -0
- package/lib/router.js +69 -42
- package/lib/utils.d.ts +2 -0
- package/lib/utils.js +32 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -126,6 +126,13 @@ const WalletProvider: FunctionComponent = ({ children }) => {
|
|
|
126
126
|
...
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
+
## Notes
|
|
130
|
+
- 1 Amounts can be passed in args either as numbers or strings.
|
|
131
|
+
- 2 depositOrWithdraw**Bonus** and swap**PriceImpact** methods return %, e. g. 0 < bonus/priceImpact <= 100
|
|
132
|
+
- 3 Slippage arg should be passed as %, e. g. 0 < slippage <= 100
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
129
136
|
## General methods
|
|
130
137
|
```ts
|
|
131
138
|
import curve from "@curvefi/api";
|
|
@@ -277,6 +284,8 @@ import curve from "@curvefi/api";
|
|
|
277
284
|
// 0xdc69d4cb5b86388fff0b51885677e258883534ae
|
|
278
285
|
pool.zap;
|
|
279
286
|
// 0xa79828df1850e8a3a3064576f380d90aecdd3359
|
|
287
|
+
pool.sRewardContract;
|
|
288
|
+
// null
|
|
280
289
|
pool.rewardContract;
|
|
281
290
|
// null
|
|
282
291
|
pool.isPlain;
|
|
@@ -814,6 +823,11 @@ import curve from "@curvefi/api";
|
|
|
814
823
|
// OR const underlyingExpected = await pool.swapExpected(0, 1, '10');
|
|
815
824
|
console.log(underlyingExpected);
|
|
816
825
|
// 9.984619933234026875
|
|
826
|
+
const underlyingPriceImpact = await pool.swapPriceImpact('MIM','DAI', 10);
|
|
827
|
+
// OR const underlyingPriceImpact = await pool.swapPriceImpact('0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3', '0x6B175474E89094C44Da98b954EedeAC495271d0F', '10');
|
|
828
|
+
// OR const underlyingPriceImpact = await pool.swapPriceImpact(0, 1, '10');
|
|
829
|
+
console.log(underlyingPriceImpact);
|
|
830
|
+
// 0.000026 (as %)
|
|
817
831
|
await pool.swapIsApproved('MIM', 10);
|
|
818
832
|
// true
|
|
819
833
|
await pool.swapApprove('MIM', 10);
|
|
@@ -846,6 +860,11 @@ import curve from "@curvefi/api";
|
|
|
846
860
|
// OR const wrappedExpected = await pool.swapWrappedExpected(1, 0, '10');
|
|
847
861
|
console.log(wrappedExpected);
|
|
848
862
|
// 10.217756467720521951
|
|
863
|
+
const wrappedPriceImpact = await pool.swapWrappedPriceImpact('3crv','MIM', 10);
|
|
864
|
+
// OR const wrappedPriceImpact = await pool.swapWrappedPriceImpact('0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490', '0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3', '10');
|
|
865
|
+
// OR const wrappedPriceImpact = await pool.swapWrappedPriceImpact(1, 0, '10');
|
|
866
|
+
console.log(wrappedPriceImpact);
|
|
867
|
+
// 0.000081 (as %)
|
|
849
868
|
await pool.swapWrappedIsApproved('3crv', 10);
|
|
850
869
|
// true
|
|
851
870
|
await pool.swapWrappedApprove('3crv', 10);
|
|
@@ -868,7 +887,7 @@ import curve from "@curvefi/api";
|
|
|
868
887
|
(async () => {
|
|
869
888
|
await curve.init('JsonRpc', {}, { gasPrice: 0, maxFeePerGas: 0, maxPriorityFeePerGas: 0 });
|
|
870
889
|
|
|
871
|
-
const pool =
|
|
890
|
+
const pool = curve.getPool('compound');
|
|
872
891
|
const amounts = [1000, 1000];
|
|
873
892
|
|
|
874
893
|
|
|
@@ -918,7 +937,7 @@ import curve from "@curvefi/api";
|
|
|
918
937
|
|
|
919
938
|
await pool.depositAndStakeWrappedExpected(amounts);
|
|
920
939
|
// 40.328408669183101673
|
|
921
|
-
await pool.
|
|
940
|
+
await pool.depositAndStakeWrappedBonus(amounts);
|
|
922
941
|
// 0.46040576921447873
|
|
923
942
|
await pool.depositAndStakeWrappedIsApproved(amounts);
|
|
924
943
|
// false
|
|
@@ -951,11 +970,13 @@ import curve from "@curvefi/api";
|
|
|
951
970
|
// [ '9900.0', '100049.744832225238317557' ]
|
|
952
971
|
|
|
953
972
|
const { route, output } = await curve.router.getBestRouteAndOutput('DAI', 'CRV', '1000');
|
|
954
|
-
// OR await curve.router.getBestPoolAndOutput('0x6B175474E89094C44Da98b954EedeAC495271d0F', '0xD533a949740bb3306d119CC777fa900bA034cd52', '
|
|
973
|
+
// OR await curve.router.getBestPoolAndOutput('0x6B175474E89094C44Da98b954EedeAC495271d0F', '0xD533a949740bb3306d119CC777fa900bA034cd52', '1000');
|
|
955
974
|
const expected = await curve.router.expected('DAI', 'CRV', '1000');
|
|
956
|
-
// OR await curve.router.expected('0x6B175474E89094C44Da98b954EedeAC495271d0F', '0xD533a949740bb3306d119CC777fa900bA034cd52', '
|
|
975
|
+
// OR await curve.router.expected('0x6B175474E89094C44Da98b954EedeAC495271d0F', '0xD533a949740bb3306d119CC777fa900bA034cd52', '1000');
|
|
976
|
+
const priceImpact = await curve.router.priceImpact('DAI', 'CRV', '1000');
|
|
977
|
+
// OR await curve.router.priceImpact('0x6B175474E89094C44Da98b954EedeAC495271d0F', '0xD533a949740bb3306d119CC777fa900bA034cd52', '1000');
|
|
957
978
|
|
|
958
|
-
route, output, expected;
|
|
979
|
+
console.log(route, output, expected, priceImpact);
|
|
959
980
|
// route = [
|
|
960
981
|
// {
|
|
961
982
|
// poolId: '3pool',
|
|
@@ -987,7 +1008,9 @@ import curve from "@curvefi/api";
|
|
|
987
1008
|
// ]
|
|
988
1009
|
//
|
|
989
1010
|
// output = expected = 378.881631202862354937
|
|
990
|
-
|
|
1011
|
+
//
|
|
1012
|
+
// priceImpact = 0.158012 %
|
|
1013
|
+
|
|
991
1014
|
await curve.router.isApproved('DAI', 1000);
|
|
992
1015
|
// false
|
|
993
1016
|
await curve.router.approve('DAI', 1000);
|
|
@@ -995,7 +1018,7 @@ import curve from "@curvefi/api";
|
|
|
995
1018
|
// '0xc111e471715ae6f5437e12d3b94868a5b6542cd7304efca18b5782d315760ae5'
|
|
996
1019
|
// ]
|
|
997
1020
|
const swapTx = await curve.router.swap('DAI', 'CRV', '1000');
|
|
998
|
-
// OR const swapTx = await curve.router.swap('0x6B175474E89094C44Da98b954EedeAC495271d0F', '0xD533a949740bb3306d119CC777fa900bA034cd52', '
|
|
1021
|
+
// OR const swapTx = await curve.router.swap('0x6B175474E89094C44Da98b954EedeAC495271d0F', '0xD533a949740bb3306d119CC777fa900bA034cd52', '1000');
|
|
999
1022
|
console.log(swapTx);
|
|
1000
1023
|
// 0xc7ba1d60871c0295ac5471bb602c37ec0f00a71543b3a041308ebd91833f26ba
|
|
1001
1024
|
|
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": "0x47536F17F4fF30e64A96a7555826b8f9e66ec468",
|
|
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,33 @@
|
|
|
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': '0x47536F17F4fF30e64A96a7555826b8f9e66ec468',
|
|
7
|
+
'crv.e': '0x249848BeCA43aC405b8102Ec90Dd5F22CA513c06',
|
|
8
|
+
// --- USD ---
|
|
9
|
+
'dai.e': '0xd586E7F844cEa2F87f50152665BCbc2C279D8d70',
|
|
10
|
+
'usdc.e': '0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664',
|
|
11
|
+
'usdt.e': '0xc7198437980c041c805A1EDcbA50c1Ce5db95118',
|
|
12
|
+
'avdai': '0x47AFa96Cdc9fAb46904A55a6ad4bf6660B53c38a',
|
|
13
|
+
'avusdc': '0x46A51127C3ce23fb7AB1DE06226147F446e4a857',
|
|
14
|
+
'avusdt': '0x532E6537FEA298397212F09A61e03311686f548e',
|
|
15
|
+
'av3crv': '0x1337bedc9d22ecbe766df105c9623922a27963ec',
|
|
16
|
+
// --- BTC ---
|
|
17
|
+
'wbtc.e': '0x50b7545627a5162F82A992c33b87aDc75187B218',
|
|
18
|
+
'renbtc': '0xDBf31dF14B66535aF65AaC99C32e9eA844e14501',
|
|
19
|
+
'avwbtc': '0x686bEF2417b6Dc32C50a3cBfbCC3bb60E1e9a15D',
|
|
20
|
+
// --- ETH ---
|
|
21
|
+
'weth.e': '0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB',
|
|
22
|
+
'avweth': '0x53f7c5869a859F0AeC3D334ee8B4Cf01E3492f21',
|
|
23
|
+
});
|
|
24
|
+
exports.cTokensAvalanche = []; //.map((a) => a.toLowerCase());
|
|
25
|
+
exports.yTokensAvalanche = []; //.map((a) => a.toLowerCase());
|
|
26
|
+
exports.ycTokensAvalanche = []; //.map((a) => a.toLowerCase());
|
|
27
|
+
exports.aTokensAvalanche = [
|
|
28
|
+
'0x47AFa96Cdc9fAb46904A55a6ad4bf6660B53c38a',
|
|
29
|
+
'0x46A51127C3ce23fb7AB1DE06226147F446e4a857',
|
|
30
|
+
'0x532E6537FEA298397212F09A61e03311686f548e',
|
|
31
|
+
'0x686bEF2417b6Dc32C50a3cBfbCC3bb60E1e9a15D',
|
|
32
|
+
'0x53f7c5869a859F0AeC3D334ee8B4Cf01E3492f21', // avWETH
|
|
33
|
+
].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
|
+
reward_contract: '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: ["0x47536F17F4fF30e64A96a7555826b8f9e66ec468"],
|
|
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
|
+
reward_contract: '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: ["0x47536F17F4fF30e64A96a7555826b8f9e66ec468"],
|
|
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
|
+
reward_contract: '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: ["0x47536F17F4fF30e64A96a7555826b8f9e66ec468"],
|
|
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
|
+
});
|
|
@@ -1190,7 +1190,6 @@ exports.POOLS_DATA_ETHEREUM = (0, utils_1.lowerCasePoolDataAddresses)({
|
|
|
1190
1190
|
token_address: '0x5a6A4D54456819380173272A5E8E9B9904BdF41B',
|
|
1191
1191
|
gauge_address: '0xd8b712d29381748dB89c36BCa0138d7c75866ddF',
|
|
1192
1192
|
deposit_address: '0xA79828DF1850E8a3A3064576f380D90aECDD3359',
|
|
1193
|
-
sCurveRewards_address: '0xb76256d1091e93976c61449d6e500d9f46d827d4',
|
|
1194
1193
|
is_meta: true,
|
|
1195
1194
|
base_pool: '3pool',
|
|
1196
1195
|
underlying_coins: ['MIM', 'DAI', 'USDC', 'USDT'],
|
|
@@ -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();
|
|
@@ -420,7 +436,7 @@ var Curve = /** @class */ (function () {
|
|
|
420
436
|
_e.label = 4;
|
|
421
437
|
case 4:
|
|
422
438
|
this.constants.DECIMALS = __assign(__assign({}, this.constants.DECIMALS), (0, utils_1.extractDecimals)(this.constants.FACTORY_POOLS_DATA));
|
|
423
|
-
this.constants.GAUGES =
|
|
439
|
+
this.constants.GAUGES = __spreadArray(__spreadArray([], this.constants.GAUGES, true), (0, utils_1.extractGauges)(this.constants.FACTORY_POOLS_DATA), true);
|
|
424
440
|
return [2 /*return*/];
|
|
425
441
|
}
|
|
426
442
|
});
|
|
@@ -451,7 +467,7 @@ var Curve = /** @class */ (function () {
|
|
|
451
467
|
_e.label = 4;
|
|
452
468
|
case 4:
|
|
453
469
|
this.constants.DECIMALS = __assign(__assign({}, this.constants.DECIMALS), (0, utils_1.extractDecimals)(this.constants.CRYPTO_FACTORY_POOLS_DATA));
|
|
454
|
-
this.constants.GAUGES =
|
|
470
|
+
this.constants.GAUGES = __spreadArray(__spreadArray([], this.constants.GAUGES, true), (0, utils_1.extractGauges)(this.constants.CRYPTO_FACTORY_POOLS_DATA), true);
|
|
455
471
|
return [2 /*return*/];
|
|
456
472
|
}
|
|
457
473
|
});
|
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
|
+
};
|