Skip to content

Commit

Permalink
feat: add set-timelock-strategy
Browse files Browse the repository at this point in the history
Signed-off-by: GopherJ <[email protected]>
  • Loading branch information
GopherJ committed Nov 28, 2023
1 parent 958a5b7 commit 72b6bcf
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,10 @@ set-interest-rate-strategy:
set-auction-strategy:
make TASK_NAME=set-auction-strategy run-task

.PHONY: set-timelock-strategy
set-timelock-strategy:
make TASK_NAME=set-timelock-strategy run-task

.PHONY: set-supply-cap
set-supply-cap:
make TASK_NAME=set-supply-cap run-task
Expand Down
40 changes: 40 additions & 0 deletions tasks/dev/reserveConfigurator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,46 @@ task("set-auction-strategy", "Set auction strategy")
}
});

task("set-timelock-strategy", "Set timelock strategy")
.addPositionalParam("assets", "assets")
.addPositionalParam("timeLockStrategyAddress", "time lock strategy address")
.setAction(async ({assets, timeLockStrategyAddress}, DRE) => {
await DRE.run("set-DRE");
const {dryRunEncodedData} = await import("../../helpers/contracts-helpers");
const {
getPoolConfiguratorProxy,
getPoolAddressesProvider,
getUiPoolDataProvider,
} = await import("../../helpers/contracts-getters");
const ui = await getUiPoolDataProvider();
const provider = await getPoolAddressesProvider();
const configurator = await getPoolConfiguratorProxy();
const [reservesData] = await ui.getReservesData(provider.address);

for (const asset of assets.split(",")) {
const reserveData = reservesData.find(
(x) => x.underlyingAsset === utils.getAddress(asset)
);
if (!reserveData) {
continue;
}
const encodedData = configurator.interface.encodeFunctionData(
"setReserveTimeLockStrategyAddress",
[reserveData.underlyingAsset, timeLockStrategyAddress]
);
if (DRY_RUN) {
await dryRunEncodedData(configurator.address, encodedData);
} else {
await waitForTx(
await configurator.setReserveTimeLockStrategyAddress(
reserveData.underlyingAsset,
timeLockStrategyAddress
)
);
}
}
});

task("set-supply-cap", "Set supply cap")
.addPositionalParam("asset", "asset")
.addPositionalParam("supplyCap", "new supply cap")
Expand Down

0 comments on commit 72b6bcf

Please sign in to comment.