Skip to content

Commit

Permalink
Merge pull request #86 from smart-transaction/fix/self-checkout-deplo…
Browse files Browse the repository at this point in the history
…y-script

Reorder token address in self checkout deploy
  • Loading branch information
TokenTitan authored Oct 25, 2024
2 parents 28420d5 + 6b66a75 commit 02a8b8d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions script/examples/SelfCheckout.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ import {MyErc20} from "test/examples/MyErc20.sol";
import {console2} from "forge-std/console2.sol";

contract DeploySelfCheckout is Script, BaseDeployer {
address private _tokenA;
address private _tokenB;
address private _dai;
address private _weth;
address private _callBreaker;

/// @dev Compute the CREATE2 addresses for contracts (proxy, counter).
/// @param salt The salt for the SelfCheckout contract.
modifier computeCreate2(bytes32 salt) {
_tokenA = address(new MyErc20("TokenA", "A"));
_tokenB = address(new MyErc20("TokenB", "B"));
_dai = vm.envAddress("DAI_ADDRESS");
_weth = vm.envAddress("WETH_ADDRESS");
_callBreaker = vm.envAddress("CALL_BREAKER_ADDRESS");

_create2addr = computeCreate2Address(
salt,
hashInitCode(type(SelfCheckout).creationCode, abi.encode(_ownerAddress, _tokenA, _tokenB, _callBreaker))
hashInitCode(type(SelfCheckout).creationCode, abi.encode(_ownerAddress, _dai, _weth, _callBreaker))
);

_;
Expand Down Expand Up @@ -57,7 +57,7 @@ contract DeploySelfCheckout is Script, BaseDeployer {

/// @dev Function to perform actual deployment.
function chainDeploySelfCheckout() private broadcast(_deployerPrivateKey) {
address selfCheckout = address(new SelfCheckout{salt: _salt}(_ownerAddress, _tokenA, _tokenB, _callBreaker));
address selfCheckout = address(new SelfCheckout{salt: _salt}(_ownerAddress, _dai, _weth, _callBreaker));

require(_create2addr == selfCheckout, "Address mismatch SelfCheckout");

Expand Down

0 comments on commit 02a8b8d

Please sign in to comment.