Skip to content

Commit

Permalink
fix: add correct amount of stake
Browse files Browse the repository at this point in the history
  • Loading branch information
adamegyed committed Aug 2, 2024
1 parent 46d0d60 commit 6ddbf5b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion script/Deploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ contract DeployScript is Script {

if (stakeToAdd > 0) {
console.log("Adding stake: ", stakeToAdd);
AccountFactory(factory).addStake{value: stakeAmount}(unstakeDelay);
AccountFactory(factory).addStake{value: stakeToAdd}(unstakeDelay);
console.log("Staked factory: ", address(factory));
console.log("Total stake amount: ", entryPoint.getDepositInfo(address(factory)).stake);
console.log("Unstake delay: ", entryPoint.getDepositInfo(address(factory)).unstakeDelaySec);
Expand Down
16 changes: 16 additions & 0 deletions test/script/Deploy.s.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,20 @@ contract DeployTest is Test {
assertEq(depositInfo.stake, 0.1 ether, "Unexpected factory stake amount");
assertEq(depositInfo.unstakeDelaySec, 1 days, "Unexpected factory unstake delay");
}

function test_deployScript_addStake() public {
test_deployScript_run();

vm.setEnv("STAKE_AMOUNT", vm.toString(uint256(0.3 ether)));

// Refresh script's env vars

_deployScript = new DeployScript();

_deployScript.run();

IStakeManager.DepositInfo memory depositInfo = _entryPoint.getDepositInfo(_factory);

assertEq(depositInfo.stake, 0.3 ether, "Unexpected factory stake amount");
}
}

0 comments on commit 6ddbf5b

Please sign in to comment.