Skip to content

Commit

Permalink
Merge pull request #11 from axieinfinity/implement-feature/migration-…
Browse files Browse the repository at this point in the history
…script/refactor-migration-script

feat(migration-script): implement `refactor-migration-script`
  • Loading branch information
TuDo1403 authored Dec 15, 2023
2 parents 6df1977 + 15e7e67 commit 427b29f
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 80 deletions.
4 changes: 2 additions & 2 deletions debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fi

verify_arg=""
extra_argument=""
op_command=""
op_command="op run --env-file="./.env" --"

for arg in "$@"; do
case $arg in
Expand Down Expand Up @@ -36,4 +36,4 @@ echo Value: ${VALUE}
echo Calldata:
cast pretty-calldata ${CALLDATA}
calldata=$(cast calldata 'trace(uint256,address,address,uint256,bytes)' ${BLOCK} ${FROM} ${TO} ${VALUE} ${CALLDATA})
${op_command} forge script ${verify_arg} --legacy ${@} script/OnchainDebugger.s.sol --sig 'run(bytes,string)' ${calldata} "${extra_argument}"
${op_command} forge script ${verify_arg} --legacy ${@} OnchainDebugger --sig 'run(bytes,string)' ${calldata} "${extra_argument}"
1 change: 1 addition & 0 deletions script/BaseMigration.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { LibString } from "../lib/solady/src/utils/LibString.sol";
import { console, LibSharedAddress, StdStyle, IScriptExtended, ScriptExtended } from "./extensions/ScriptExtended.s.sol";
import { IArtifactFactory, ArtifactFactory } from "./ArtifactFactory.sol";
import { OnchainDebugger } from "./OnchainDebugger.s.sol"; // cheat to load artifact to parent `out` directory
import { IMigrationScript } from "./interfaces/IMigrationScript.sol";
import { LibProxy } from "./libraries/LibProxy.sol";
import { DefaultContract } from "./utils/DefaultContract.sol";
Expand Down
5 changes: 4 additions & 1 deletion script/extensions/ScriptExtended.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ abstract contract ScriptExtended is Script, StdAssertions, IScriptExtended {
console.log("> ", StdStyle.blue(fnName), "...");
_;
}

modifier onlyOn(TNetwork networkType) {
require(network() == networkType, string.concat("ScriptExtended: Only allowed on ", CONFIG.getAlias(networkType)));
_;
Expand All @@ -33,10 +33,13 @@ abstract contract ScriptExtended is Script, StdAssertions, IScriptExtended {

function _configByteCode() internal virtual returns (bytes memory);

function _postCheck() internal virtual { }

function run(bytes calldata callData, string calldata command) public virtual {
CONFIG.resolveCommand(command);
(bool success, bytes memory data) = address(this).delegatecall(callData);
success.handleRevert(msg.sig, data);
_postCheck();
}

function network() public view virtual returns (TNetwork) {
Expand Down
2 changes: 1 addition & 1 deletion src/WNT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.17;

import { ERC20 } from "../lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol";
import { IWNT } from "./interfaces/IWNT.sol";
import { LibNativeTransfer } from "./libraries/LibNativeTransfer.sol";
import { LibNativeTransfer } from "contract-libs/transfers/LibNativeTransfer.sol";

/// @notice Minimalist and modern Wrapped Ether implementation.
/// @author Solmate
Expand Down
40 changes: 0 additions & 40 deletions src/libraries/LibErrorHandler.sol

This file was deleted.

36 changes: 0 additions & 36 deletions src/libraries/LibNativeTransfer.sol

This file was deleted.

0 comments on commit 427b29f

Please sign in to comment.