Skip to content

Commit

Permalink
fix: Remove variable shadowing and lint deploy script (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-alchemy authored Dec 12, 2023
1 parent 2273cc9 commit b14e001
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ contract Deploy is Script {
// Deploy MultiOwnerMSCAFactory, and add stake with EP
{
if (ownerFactoryAddr == address(0)) {
ownerFactory =
new MultiOwnerMSCAFactory(owner, multiOwnerPlugin, mscaImpl, multiOwnerPluginManifestHash, entryPoint);
ownerFactory = new MultiOwnerMSCAFactory(
owner, multiOwnerPlugin, mscaImpl, multiOwnerPluginManifestHash, entryPoint
);

ownerFactoryAddr = address(ownerFactory);
console.log("New MultiOwnerMSCAFactory: ", ownerFactoryAddr);
Expand All @@ -96,8 +97,15 @@ contract Deploy is Script {

// Deploy MultiOwnerTokenReceiverMSCAFactory, and add stake with EP
if (ownerAndTokenReceiverFactoryAddr == address(0)) {
ownerAndTokenReceiverFactory =
new MultiOwnerTokenReceiverMSCAFactory(owner, multiOwnerPlugin, tokenReceiverPlugin, mscaImpl, multiOwnerPluginManifestHash, tokenReceiverPluginManifestHash, entryPoint);
ownerAndTokenReceiverFactory = new MultiOwnerTokenReceiverMSCAFactory(
owner,
multiOwnerPlugin,
tokenReceiverPlugin,
mscaImpl,
multiOwnerPluginManifestHash,
tokenReceiverPluginManifestHash,
entryPoint
);

ownerAndTokenReceiverFactoryAddr = address(ownerAndTokenReceiverFactory);
console.log("New MultiOwnerTokenReceiverMSCAFactory: ", ownerAndTokenReceiverFactoryAddr);
Expand Down Expand Up @@ -128,19 +136,19 @@ contract Deploy is Script {
vm.stopBroadcast();
}

function _addStakeForFactory(address factoryAddr, IMSCAEntryPoint entryPoint) internal {
function _addStakeForFactory(address factoryAddr, IMSCAEntryPoint anEntryPoint) internal {
uint32 unstakeDelaySec = uint32(vm.envOr("UNSTAKE_DELAY_SEC", uint32(60)));
uint256 requiredStakeAmount = vm.envUint("REQUIRED_STAKE_AMOUNT") * 1 ether;
uint256 currentStakedAmount = IEntryPoint(address(entryPoint)).getDepositInfo(factoryAddr).stake;
uint256 currentStakedAmount = IEntryPoint(address(anEntryPoint)).getDepositInfo(factoryAddr).stake;
uint256 stakeAmount = requiredStakeAmount - currentStakedAmount;
// since all factory share the same addStake method, it does not matter which contract we use to cast the
// address
MultiOwnerMSCAFactory(payable(factoryAddr)).addStake{value: stakeAmount}(unstakeDelaySec, stakeAmount);
console.log("******** Add Stake Verify *********");
console.log("Staked factory: ", factoryAddr);
console.log("Stake amount: ", IEntryPoint(address(entryPoint)).getDepositInfo(factoryAddr).stake);
console.log("Stake amount: ", IEntryPoint(address(anEntryPoint)).getDepositInfo(factoryAddr).stake);
console.log(
"Unstake delay: ", IEntryPoint(address(entryPoint)).getDepositInfo(factoryAddr).unstakeDelaySec
"Unstake delay: ", IEntryPoint(address(anEntryPoint)).getDepositInfo(factoryAddr).unstakeDelaySec
);
console.log("******** Stake Verify Done *********");
}
Expand Down

0 comments on commit b14e001

Please sign in to comment.