Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing settle for ethers #1509

Merged
merged 5 commits into from
Sep 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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