Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(migration-script): implement refactor-migration-script #11

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading