Skip to content

Commit

Permalink
Merge branch 'master' into eslint-monorepo-no-relative-import
Browse files Browse the repository at this point in the history
  • Loading branch information
MantisClone authored Oct 15, 2023
2 parents bbe7ae6 + cc56640 commit 260cb79
Show file tree
Hide file tree
Showing 7 changed files with 253 additions and 65 deletions.
84 changes: 84 additions & 0 deletions packages/currency/src/aggregators/arbitrum-one.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"0x0ee88324f875d378f9a06643830934cadff6b1e5": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": {
"0x0ee88324f875d378f9a06643830934cadff6b1e5": 1,
"0x17b4158805772ced11225e77339f90beb5aae968": 1,
"0xda10009cbd5d07dd0cecc66161fc93d7c9000da1": 1,
"0xff970a61a04b1ca14834a43f5de4533ebddb5cc8": 1,
"0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9": 1,
"0x4f99f266506be1475e943b2f097827011bfa4e93": 1,
"0xfa6faefc053e6c8e393a73dcc12b09fcde019d25": 1,
"0xfac26e3fd40adcdc6652f705d983b4830c00716c": 1,
"0x013f29832cd6525c4c6df81c2aae8032a1ff2db2": 1,
"0xf68fb12aa78e5c2b3eebd71441a990cd5757055c": 1,
"0xe4dddfe67e7164b0fe14e218d80dc4c08edc01cb": 1,
"0x0bbb60891a1688271573e5ea4cba84f18cbc0f2d": 1,
"0x539bde0d7dbd336b79148aa742883198bbf60342": 1,
"0x2e9a6df78e42a30712c10a9dc4b1c8656f8f2879": 1,
"0xce80759e72fe1d3c07be79ffecc76a7a9b46c641": 1,
"0xd4d42f0b6def4ce0383636770ef773390d85c61a": 1,
"0xaf88d065e77c8cc2239327c5edb3a432268e5831": 1,
"0x912ce59144191c1204e64559fe8253a0e49e6548": 1,
"0xb50731ca2fd80afe3910a4800225d4845cad266f": 1,
"0xb7a41bb9ad3cdc5db0e35c12e78106fa3f21693d": 1
},
"0x17b4158805772ced11225e77339f90beb5aae968": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0xda10009cbd5d07dd0cecc66161fc93d7c9000da1": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0xff970a61a04b1ca14834a43f5de4533ebddb5cc8": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0x4f99f266506be1475e943b2f097827011bfa4e93": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0xfa6faefc053e6c8e393a73dcc12b09fcde019d25": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0xfac26e3fd40adcdc6652f705d983b4830c00716c": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0x013f29832cd6525c4c6df81c2aae8032a1ff2db2": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0xf68fb12aa78e5c2b3eebd71441a990cd5757055c": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0xe4dddfe67e7164b0fe14e218d80dc4c08edc01cb": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0x0bbb60891a1688271573e5ea4cba84f18cbc0f2d": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0x539bde0d7dbd336b79148aa742883198bbf60342": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0x2e9a6df78e42a30712c10a9dc4b1c8656f8f2879": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0xce80759e72fe1d3c07be79ffecc76a7a9b46c641": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0xd4d42f0b6def4ce0383636770ef773390d85c61a": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0xaf88d065e77c8cc2239327c5edb3a432268e5831": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0x912ce59144191c1204e64559fe8253a0e49e6548": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0xb50731ca2fd80afe3910a4800225d4845cad266f": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0xb7a41bb9ad3cdc5db0e35c12e78106fa3f21693d": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
}
}
126 changes: 124 additions & 2 deletions packages/currency/src/aggregators/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,28 @@
"0x8ab7404063ec4dbcfd4598215992dc3f8ec853d7": 1,
"0xdefa4e8a7bcba345f687a2f1456f5edd9ce97202": 1,
"0x8f8221afbb33998d8584a2b05749ba73c37a938a": 1,
"0xe6c09adc89ff4467cea20bc7760e3e59e7c0671d": 1
"0xe6c09adc89ff4467cea20bc7760e3e59e7c0671d": 1,
"0x0d8775f648430679a709e98d2b0cb6250d2887ef": 1,
"0x956f47f50a910163d8bf957cf5846d573e7f87ca": 1,
"0xf68fb12aa78e5c2b3eebd71441a990cd5757055c": 1,
"0x0bbb60891a1688271573e5ea4cba84f18cbc0f2d": 1,
"0xb50731ca2fd80afe3910a4800225d4845cad266f": 1,
"0xab6ce0b86d905929340c640e8bcba8751feea10e": 1,
"0xbc396689893d065f41bc2c6ecbee5e0085233447": 1,
"0x6b3595068778dd592e39a122f4f5a5cf09c90fe2": 1,
"0xb7a41bb9ad3cdc5db0e35c12e78106fa3f21693d": 1,
"0x00a8b738e453ffd858a7edf03bccfe20412f0eb0": 1,
"0x1a4b46696b2bb4794eb3d4c26f1c55f9170fa4c5": 1,
"0xd46ba6d942050d489dbd938a2c909a5d5039a161": 1,
"0x77fba179c79de5b7653f68b5039af940ada60ce0": 1,
"0x4fabb145d64652a948d72533023f6e7a623c7c53": 1,
"0x853d955acef822db058eb8505911ed77f175b99e": 1,
"0x056fd409e1d7a124bd7017459dfea2f387b6d5cd": 1,
"0xe28b3b32b6c345a34ff64674606124dd5aceca30": 1,
"0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0": 1,
"0x0000000000085d4780b73119b644ae5ecd22b376": 1,
"0x8e870d67f660d95d5be530380d0ec0bd388289e1": 1,
"0x6ea6803339cfeadd84b5b62820c548f53ff7d8e9": 1
},
"0xfa6faefc053e6c8e393a73dcc12b09fcde019d25": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
Expand All @@ -38,7 +59,20 @@
"0xc944e90c64b2c07662a292be6244bdf05cda44a7": 1,
"0x967da4048cd07ab37855c090aaf366e4ce1b9f48": 1,
"0x0f5d2fb29fb7d3cfee444a200298f468908cc942": 1,
"0xdefa4e8a7bcba345f687a2f1456f5edd9ce97202": 1
"0xdefa4e8a7bcba345f687a2f1456f5edd9ce97202": 1,
"0x8f693ca8d21b157107184d29d398a8d082b38b76": 1,
"0xbb0e17ef65f82ab018d8edd776e8dd940327b28b": 1,
"0xde30da39c46104798bb5aa3fe8b9e0e1f348163f": 1,
"0x0d8775f648430679a709e98d2b0cb6250d2887ef": 1,
"0xb8c77482e45f1f44de1745f52c74426c631bdd52": 1,
"0x6810e776880c02933d47db1b9fc05908e5386b96": 1,
"0xbc396689893d065f41bc2c6ecbee5e0085233447": 1,
"0x607f4c5bb672230e8672085532f7e901544a7375": 1,
"0x6b3595068778dd592e39a122f4f5a5cf09c90fe2": 1,
"0x4fabb145d64652a948d72533023f6e7a623c7c53": 1,
"0x853d955acef822db058eb8505911ed77f175b99e": 1,
"0x056fd409e1d7a124bd7017459dfea2f387b6d5cd": 1,
"0x0000000000085d4780b73119b644ae5ecd22b376": 1
},
"0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1,
Expand Down Expand Up @@ -108,5 +142,93 @@
},
"0xe6c09adc89ff4467cea20bc7760e3e59e7c0671d": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0x8f693ca8d21b157107184d29d398a8d082b38b76": {
"0xf5af88e117747e87fc5929f2ff87221b1447652e": 1
},
"0xbb0e17ef65f82ab018d8edd776e8dd940327b28b": {
"0xf5af88e117747e87fc5929f2ff87221b1447652e": 1
},
"0xde30da39c46104798bb5aa3fe8b9e0e1f348163f": {
"0xf5af88e117747e87fc5929f2ff87221b1447652e": 1
},
"0x0d8775f648430679a709e98d2b0cb6250d2887ef": {
"0xf5af88e117747e87fc5929f2ff87221b1447652e": 1,
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0x956f47f50a910163d8bf957cf5846d573e7f87ca": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0xf68fb12aa78e5c2b3eebd71441a990cd5757055c": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0x0bbb60891a1688271573e5ea4cba84f18cbc0f2d": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0xb8c77482e45f1f44de1745f52c74426c631bdd52": {
"0xf5af88e117747e87fc5929f2ff87221b1447652e": 1
},
"0xb50731ca2fd80afe3910a4800225d4845cad266f": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0x6810e776880c02933d47db1b9fc05908e5386b96": {
"0xf5af88e117747e87fc5929f2ff87221b1447652e": 1
},
"0xab6ce0b86d905929340c640e8bcba8751feea10e": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0xbc396689893d065f41bc2c6ecbee5e0085233447": {
"0xf5af88e117747e87fc5929f2ff87221b1447652e": 1,
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0x607f4c5bb672230e8672085532f7e901544a7375": {
"0xf5af88e117747e87fc5929f2ff87221b1447652e": 1
},
"0x6b3595068778dd592e39a122f4f5a5cf09c90fe2": {
"0xf5af88e117747e87fc5929f2ff87221b1447652e": 1,
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0xb7a41bb9ad3cdc5db0e35c12e78106fa3f21693d": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0x00a8b738e453ffd858a7edf03bccfe20412f0eb0": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0x1a4b46696b2bb4794eb3d4c26f1c55f9170fa4c5": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0xd46ba6d942050d489dbd938a2c909a5d5039a161": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0x77fba179c79de5b7653f68b5039af940ada60ce0": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0x4fabb145d64652a948d72533023f6e7a623c7c53": {
"0xf5af88e117747e87fc5929f2ff87221b1447652e": 1,
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0x853d955acef822db058eb8505911ed77f175b99e": {
"0xf5af88e117747e87fc5929f2ff87221b1447652e": 1,
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0x056fd409e1d7a124bd7017459dfea2f387b6d5cd": {
"0xf5af88e117747e87fc5929f2ff87221b1447652e": 1,
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0xe28b3b32b6c345a34ff64674606124dd5aceca30": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0x0000000000085d4780b73119b644ae5ecd22b376": {
"0xf5af88e117747e87fc5929f2ff87221b1447652e": 1,
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0x8e870d67f660d95d5be530380d0ec0bd388289e1": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
},
"0x6ea6803339cfeadd84b5b62820c548f53ff7d8e9": {
"0x775eb53d00dd0acd3ec1696472105d579b9b386b": 1
}
}
1 change: 0 additions & 1 deletion packages/toolbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"@requestnetwork/types": "0.37.0",
"@requestnetwork/utils": "0.37.0",
"axios": "0.27.2",
"bluebird": "3.7.2",
"ethers": "5.5.1",
"inquirer": "8.2.0",
"lodash": "4.17.21",
Expand Down
42 changes: 19 additions & 23 deletions packages/toolbox/src/chainlinkConversionPathTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import {
ChainlinkConversionPath__factory,
} from '@requestnetwork/smart-contracts/types';
import { CurrencyManager, EvmChains, UnsupportedCurrencyError } from '@requestnetwork/currency';
import Bluebird from 'bluebird';
import chunk from 'lodash/chunk';
import { retry } from '@requestnetwork/utils';
import { CurrencyTypes } from '@requestnetwork/types';

Expand All @@ -32,7 +30,7 @@ class ChainlinkConversionPathTools {
public chainLinkConversionPath: ChainlinkConversionPath;
public creationBlockNumber: number;
public provider: ethers.providers.Provider;
private maxRange?: number;
private maxRange: number;

/**
* @param network The Ethereum network to use
Expand All @@ -56,37 +54,35 @@ class ChainlinkConversionPathTools {

this.creationBlockNumber = chainlinkConversionPath.getCreationBlockNumber(this.network);

this.maxRange = options?.maxRange || 5000;
this.maxRange = options?.maxRange || 1000000;
}

/**
* Retrieves all the aggregators
*/
public async getAggregators(): Promise<Record<string, Record<string, string>>> {
const lastBlock = await this.provider.getBlockNumber();
const chunks = chunk(
Array(lastBlock - this.creationBlockNumber)
.fill(0)
.map((_, i) => this.creationBlockNumber + i),
this.maxRange,
);
let currentBlock = this.creationBlockNumber;

// Get the fee proxy contract event logs
const logs = await Bluebird.map(
chunks,
(blocks) => {
console.error(`Fetching logs from ${blocks[0]} to ${blocks[blocks.length - 1]}`);
return retry(this.chainLinkConversionPath.queryFilter.bind(this.chainLinkConversionPath), {
const logs = [];
while (currentBlock <= lastBlock) {
const nextBlock = currentBlock + this.maxRange;
console.error(
`Fetching logs from ${currentBlock} to ${nextBlock} (progress: ${Math.round(
(currentBlock * 100) / lastBlock,
)}%)`,
);
const chunkLogs = await retry(
this.chainLinkConversionPath.queryFilter.bind(this.chainLinkConversionPath),
{
maxRetries: 3,
retryDelay: 2000,
})(
this.chainLinkConversionPath.filters.AggregatorUpdated(),
blocks[0],
blocks[blocks.length - 1],
);
},
{ concurrency: 20 },
).then((r) => r.flat());
},
)(this.chainLinkConversionPath.filters.AggregatorUpdated(), currentBlock, nextBlock);
logs.push(...chunkLogs);
currentBlock = nextBlock;
}

// Parses, filters and creates the events from the logs with the payment reference
const aggregatorsMaps = logs.reduce(
Expand Down
4 changes: 2 additions & 2 deletions packages/toolbox/src/commands/chainlink/addAggregator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ export const handler = async (args: Options): Promise<void> => {
}
if (!aggregator.startsWith('0x')) {
const aggregators = await getAllAggregators(network);
const newAggregator = aggregators.find((x) => x.pair === aggregator);
const newAggregator = aggregators.find((x) => x.name === aggregator);
assert(newAggregator, `aggregator ${aggregator} not found`);
aggregator = newAggregator.proxy;
aggregator = newAggregator?.proxyAddress;
}
assert(aggregator);
await runUpdate('updateAggregator', [input, output, aggregator], args);
Expand Down
Loading

0 comments on commit 260cb79

Please sign in to comment.