@curvefi/api 2.63.3 → 2.63.5
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/abis/factory-tricrypto-mainnet.json +664 -0
- package/lib/constants/aliases.js +32 -19
- package/lib/curve.js +16 -9
- package/lib/factory/deploy.js +9 -4
- package/lib/factory/factory-api.js +1 -1
- package/lib/factory/factory-crypto.js +24 -16
- package/lib/factory/factory-tricrypto.js +32 -34
- package/lib/factory/factory-twocrypto.js +26 -28
- package/lib/factory/factory.js +27 -26
- package/lib/pools/PoolTemplate.js +4 -2
- package/package.json +1 -1
- package/lib/constants/abis/gauge_factory_mainnet.json +0 -1
- /package/lib/constants/abis/{factory-tricrypto.json → factory-tricrypto-sidechain.json} +0 -0
- /package/lib/constants/abis/{gauge_factory_sidechain.json → gauge_factory/child_gauge_factory.json} +0 -0
- /package/lib/constants/abis/{gauge_factory_mainnet_for_fraxtal.json → gauge_factory/root_gauge_factory.json} +0 -0
package/lib/factory/factory.js
CHANGED
|
@@ -108,9 +108,9 @@ function _handleCoinAddresses(coinAddresses) {
|
|
|
108
108
|
function getPoolsData(factorySwapAddresses, factoryAddress) {
|
|
109
109
|
return __awaiter(this, void 0, void 0, function* () {
|
|
110
110
|
const factoryMulticallContract = this.contracts[factoryAddress].multicallContract;
|
|
111
|
-
const
|
|
111
|
+
const isChildGaugeFactoryNull = curve.chainId !== 1 && this.constants.ALIASES.child_gauge_factory === curve.constants.ZERO_ADDRESS;
|
|
112
|
+
const isChildGaugeFactoryOldNull = !("child_gauge_factory_old" in this.constants.ALIASES);
|
|
112
113
|
const isStableNgFactory = factoryAddress === this.constants.ALIASES['stable_ng_factory'];
|
|
113
|
-
const factoryGaugeContract = this.contracts[this.constants.ALIASES.gauge_factory].multicallContract;
|
|
114
114
|
const calls = [];
|
|
115
115
|
for (const addr of factorySwapAddresses) {
|
|
116
116
|
const tempSwapContract = new MulticallContract(addr, ERC20ABI);
|
|
@@ -118,40 +118,41 @@ function getPoolsData(factorySwapAddresses, factoryAddress) {
|
|
|
118
118
|
if (this.chainId === 1) {
|
|
119
119
|
calls.push(factoryMulticallContract.get_gauge(addr));
|
|
120
120
|
}
|
|
121
|
-
else
|
|
122
|
-
|
|
121
|
+
else {
|
|
122
|
+
if (!isChildGaugeFactoryNull) {
|
|
123
|
+
calls.push(this.contracts[this.constants.ALIASES.child_gauge_factory].multicallContract.get_gauge_from_lp_token(addr));
|
|
124
|
+
}
|
|
125
|
+
if (!isChildGaugeFactoryOldNull) {
|
|
126
|
+
calls.push(this.contracts[this.constants.ALIASES.child_gauge_factory_old].multicallContract.get_gauge_from_lp_token(addr));
|
|
127
|
+
}
|
|
123
128
|
}
|
|
124
|
-
if (!isStableNgFactory)
|
|
129
|
+
if (!isStableNgFactory)
|
|
125
130
|
calls.push(factoryMulticallContract.get_pool_asset_type(addr));
|
|
126
|
-
}
|
|
127
131
|
calls.push(tempSwapContract.symbol());
|
|
128
132
|
calls.push(tempSwapContract.name());
|
|
129
133
|
calls.push(factoryMulticallContract.is_meta(addr));
|
|
130
134
|
calls.push(factoryMulticallContract.get_coins(addr));
|
|
131
135
|
}
|
|
132
136
|
const res = yield this.multicallProvider.all(calls);
|
|
133
|
-
if (
|
|
137
|
+
if (isChildGaugeFactoryNull || isChildGaugeFactoryOldNull || isStableNgFactory) {
|
|
134
138
|
for (let index = 0; index < res.length; index++) {
|
|
135
|
-
if (index %
|
|
136
|
-
res.splice(index, 0,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (isStableNgFactory) {
|
|
141
|
-
for (let index = 0; index < res.length; index++) {
|
|
142
|
-
if (index % 7 == 2) {
|
|
139
|
+
if (isChildGaugeFactoryNull && index % 8 == 1)
|
|
140
|
+
res.splice(index, 0, curve.constants.ZERO_ADDRESS);
|
|
141
|
+
if (isChildGaugeFactoryOldNull && index % 8 == 2)
|
|
142
|
+
res.splice(index, 0, curve.constants.ZERO_ADDRESS);
|
|
143
|
+
if (isStableNgFactory && index % 8 == 3)
|
|
143
144
|
res.splice(index, 0, -1);
|
|
144
|
-
}
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
|
-
const implememntationAddresses = res.filter((a, i) => i %
|
|
148
|
-
const gaugeAddresses = res.filter((a, i) => i %
|
|
149
|
-
const
|
|
150
|
-
const
|
|
151
|
-
const
|
|
152
|
-
const
|
|
153
|
-
const
|
|
154
|
-
|
|
147
|
+
const implememntationAddresses = res.filter((a, i) => i % 8 == 0).map((a) => a.toLowerCase());
|
|
148
|
+
const gaugeAddresses = res.filter((a, i) => i % 8 == 1).map((a) => a.toLowerCase());
|
|
149
|
+
const oldGaugeAddresses = res.filter((a, i) => i % 8 == 2).map((a) => a.toLowerCase());
|
|
150
|
+
const referenceAssets = _handleReferenceAssets(res.filter((a, i) => i % 8 == 3));
|
|
151
|
+
const symbols = res.filter((a, i) => i % 8 == 4);
|
|
152
|
+
const names = res.filter((a, i) => i % 8 == 5);
|
|
153
|
+
const isMeta = res.filter((a, i) => i % 8 == 6);
|
|
154
|
+
const coinAddresses = _handleCoinAddresses.call(this, res.filter((a, i) => i % 8 == 7));
|
|
155
|
+
return [implememntationAddresses, gaugeAddresses, oldGaugeAddresses, referenceAssets, symbols, names, isMeta, coinAddresses];
|
|
155
156
|
});
|
|
156
157
|
}
|
|
157
158
|
function setFactorySwapContracts(factorySwapAddresses, factorySwapABIs) {
|
|
@@ -226,7 +227,7 @@ export function getFactoryPoolData(fromIdx = 0, swapAddress, factoryAddress = cu
|
|
|
226
227
|
: yield getFactoryIdsAndSwapAddresses.call(this, fromIdx, factoryAddress);
|
|
227
228
|
if (rawPoolIds.length === 0)
|
|
228
229
|
return {};
|
|
229
|
-
const [rawImplementations, rawGauges, rawReferenceAssets, rawPoolSymbols, rawPoolNames, rawIsMeta, rawCoinAddresses] = yield getPoolsData.call(this, rawSwapAddresses, factoryAddress);
|
|
230
|
+
const [rawImplementations, rawGauges, rawOldGauges, rawReferenceAssets, rawPoolSymbols, rawPoolNames, rawIsMeta, rawCoinAddresses] = yield getPoolsData.call(this, rawSwapAddresses, factoryAddress);
|
|
230
231
|
const poolIds = [];
|
|
231
232
|
const swapAddresses = [];
|
|
232
233
|
const implementations = [];
|
|
@@ -242,7 +243,7 @@ export function getFactoryPoolData(fromIdx = 0, swapAddress, factoryAddress = cu
|
|
|
242
243
|
poolIds.push(rawPoolIds[i]);
|
|
243
244
|
swapAddresses.push(rawSwapAddresses[i]);
|
|
244
245
|
implementations.push(rawImplementations[i]);
|
|
245
|
-
gaugeAddresses.push(rawGauges[i]);
|
|
246
|
+
gaugeAddresses.push(rawGauges[i] !== curve.constants.ZERO_ADDRESS ? rawGauges[i] : rawOldGauges[i]);
|
|
246
247
|
referenceAssets.push(rawReferenceAssets[i]);
|
|
247
248
|
poolSymbols.push(rawPoolSymbols[i]);
|
|
248
249
|
poolNames.push(rawPoolNames[i]);
|
|
@@ -1198,7 +1198,7 @@ export class PoolTemplate {
|
|
|
1198
1198
|
return Number(yield curve.contracts[curve.constants.ALIASES.minter].contract.mint.estimateGas(this.gauge.address, curve.constantOptions));
|
|
1199
1199
|
}
|
|
1200
1200
|
else {
|
|
1201
|
-
return smartNumber(yield curve.contracts[curve.constants.ALIASES.
|
|
1201
|
+
return smartNumber(yield curve.contracts[curve.constants.ALIASES.child_gauge_factory].contract.mint.estimateGas(this.gauge.address, curve.constantOptions));
|
|
1202
1202
|
}
|
|
1203
1203
|
});
|
|
1204
1204
|
}
|
|
@@ -1206,7 +1206,9 @@ export class PoolTemplate {
|
|
|
1206
1206
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1207
1207
|
if (this.rewardsOnly())
|
|
1208
1208
|
throw Error(`${this.name} has Rewards-Only Gauge. Use claimRewards instead`);
|
|
1209
|
-
const contract = curve.chainId === 1 ?
|
|
1209
|
+
const contract = curve.chainId === 1 ?
|
|
1210
|
+
curve.contracts[curve.constants.ALIASES.minter].contract :
|
|
1211
|
+
curve.contracts[curve.constants.ALIASES.child_gauge_factory].contract;
|
|
1210
1212
|
yield curve.updateFeeData();
|
|
1211
1213
|
const gasLimit = mulBy1_3(DIGas(yield contract.mint.estimateGas(this.gauge.address, curve.constantOptions)));
|
|
1212
1214
|
return (yield contract.mint(this.gauge.address, Object.assign(Object.assign({}, curve.options), { gasLimit }))).hash;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[{ "name": "BridgerUpdated", "inputs": [{ "name": "_chain_id", "type": "uint256", "indexed": true }, { "name": "_old_bridger", "type": "address", "indexed": false }, { "name": "_new_bridger", "type": "address", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "DeployedGauge", "inputs": [{ "name": "_implementation", "type": "address", "indexed": true }, { "name": "_chain_id", "type": "uint256", "indexed": true }, { "name": "_deployer", "type": "address", "indexed": true }, { "name": "_salt", "type": "bytes32", "indexed": false }, { "name": "_gauge", "type": "address", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "TransferOwnership", "inputs": [{ "name": "_old_owner", "type": "address", "indexed": false }, { "name": "_new_owner", "type": "address", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "UpdateCallProxy", "inputs": [{ "name": "_old_call_proxy", "type": "address", "indexed": false }, { "name": "_new_call_proxy", "type": "address", "indexed": false }], "anonymous": false, "type": "event" }, { "name": "UpdateImplementation", "inputs": [{ "name": "_old_implementation", "type": "address", "indexed": false }, { "name": "_new_implementation", "type": "address", "indexed": false }], "anonymous": false, "type": "event" }, { "stateMutability": "nonpayable", "type": "constructor", "inputs": [{ "name": "_call_proxy", "type": "address" }, { "name": "_owner", "type": "address" }], "outputs": [] }, { "stateMutability": "nonpayable", "type": "function", "name": "transmit_emissions", "inputs": [{ "name": "_gauge", "type": "address" }], "outputs": [], "gas": 10132 }, { "stateMutability": "payable", "type": "function", "name": "deploy_gauge", "inputs": [{ "name": "_chain_id", "type": "uint256" }, { "name": "_salt", "type": "bytes32" }], "outputs": [{ "name": "", "type": "address" }], "gas": 165352 }, { "stateMutability": "nonpayable", "type": "function", "name": "deploy_child_gauge", "inputs": [{ "name": "_chain_id", "type": "uint256" }, { "name": "_lp_token", "type": "address" }, { "name": "_salt", "type": "bytes32" }], "outputs": [], "gas": 18165 }, { "stateMutability": "nonpayable", "type": "function", "name": "deploy_child_gauge", "inputs": [{ "name": "_chain_id", "type": "uint256" }, { "name": "_lp_token", "type": "address" }, { "name": "_salt", "type": "bytes32" }, { "name": "_manager", "type": "address" }], "outputs": [], "gas": 18165 }, { "stateMutability": "nonpayable", "type": "function", "name": "set_bridger", "inputs": [{ "name": "_chain_id", "type": "uint256" }, { "name": "_bridger", "type": "address" }], "outputs": [], "gas": 42889 }, { "stateMutability": "nonpayable", "type": "function", "name": "set_implementation", "inputs": [{ "name": "_implementation", "type": "address" }], "outputs": [], "gas": 41933 }, { "stateMutability": "nonpayable", "type": "function", "name": "set_call_proxy", "inputs": [{ "name": "_new_call_proxy", "type": "address" }], "outputs": [], "gas": 41963 }, { "stateMutability": "nonpayable", "type": "function", "name": "commit_transfer_ownership", "inputs": [{ "name": "_future_owner", "type": "address" }], "outputs": [], "gas": 37785 }, { "stateMutability": "nonpayable", "type": "function", "name": "accept_transfer_ownership", "inputs": [], "outputs": [], "gas": 41864 }, { "stateMutability": "view", "type": "function", "name": "call_proxy", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "gas": 2700 }, { "stateMutability": "view", "type": "function", "name": "get_bridger", "inputs": [{ "name": "arg0", "type": "uint256" }], "outputs": [{ "name": "", "type": "address" }], "gas": 2845 }, { "stateMutability": "view", "type": "function", "name": "get_implementation", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "gas": 2760 }, { "stateMutability": "view", "type": "function", "name": "get_gauge", "inputs": [{ "name": "arg0", "type": "uint256" }, { "name": "arg1", "type": "uint256" }], "outputs": [{ "name": "", "type": "address" }], "gas": 2950 }, { "stateMutability": "view", "type": "function", "name": "get_gauge_count", "inputs": [{ "name": "arg0", "type": "uint256" }], "outputs": [{ "name": "", "type": "uint256" }], "gas": 2935 }, { "stateMutability": "view", "type": "function", "name": "is_valid_gauge", "inputs": [{ "name": "arg0", "type": "address" }], "outputs": [{ "name": "", "type": "bool" }], "gas": 3116 }, { "stateMutability": "view", "type": "function", "name": "owner", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "gas": 2880 }, { "stateMutability": "view", "type": "function", "name": "future_owner", "inputs": [], "outputs": [{ "name": "", "type": "address" }], "gas": 2910 }]
|
|
File without changes
|
/package/lib/constants/abis/{gauge_factory_sidechain.json → gauge_factory/child_gauge_factory.json}
RENAMED
|
File without changes
|
|
File without changes
|