Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Commit

Permalink
Add reward distributor check before setup
Browse files Browse the repository at this point in the history
  • Loading branch information
antisaa committed Jul 23, 2024
1 parent d22d2bc commit 11d6d36
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tasks/flywheel/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,10 @@ task("flywheel:add-to-pool", "Create pool if does not exist")
}

const comptroller = await viem.getContractAt("Comptroller", poolAddress);
const addTx = await comptroller.write._addRewardsDistributor([flywheelAddress]);

const rewardsDistributors = (await comptroller.read.getRewardsDistributors()) as Address[];
if (!rewardsDistributors.map((s) => s.toLowerCase()).includes(flywheelAddress.toLowerCase())) {
const addTx = await comptroller.write._addRewardsDistributor([flywheelAddress]);
}
await publicClient.waitForTransactionReceipt({ hash: addTx });
console.log({ addTx });
});
Expand Down

0 comments on commit 11d6d36

Please sign in to comment.