Skip to content

Commit

Permalink
Fixing settle for ethers (#1509)
Browse files Browse the repository at this point in the history
  • Loading branch information
jj authored Sep 27, 2021
1 parent 98e46fa commit 9e26043
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions publish/src/commands/settle.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,11 @@ const settle = async ({
return [];
}
console.log(gray('-> Fetching page of results from target', yellow(target.address)));
const pageOfResults = await target.getPastEvents('SynthExchange', {
fromBlock: startingBlock,
toBlock: startingBlock + pageSize - 1,
});
const pageOfResults = await target.queryFilter(
'SynthExchange',
startingBlock,
startingBlock + pageSize - 1
);
startingBlock += pageSize;
return [].concat(pageOfResults).concat(await innerFnc());
};
Expand Down Expand Up @@ -175,7 +176,7 @@ const settle = async ({

for (const {
blockNumber,
returnValues: { account, toCurrencyKey },
args: [account, , , toCurrencyKey],
} of exchanges) {
if (cache[account + toCurrencyKey]) continue;
cache[account + toCurrencyKey] = true;
Expand Down Expand Up @@ -273,11 +274,7 @@ const settle = async ({
if (reclaimAmount > 0) {
const synth = await Synthetix.synths(toCurrencyKey);

const Synth = new ethers.eth.Contract(
synth,
getSource({ contract: 'Synth' }).abi,
provider
);
const Synth = new ethers.Contract(synth, getSource({ contract: 'Synth' }).abi, provider);

const balance = await Synth.balanceOf(account);

Expand Down

0 comments on commit 9e26043

Please sign in to comment.