Skip to content

Commit

Permalink
Merge pull request #131 from axieinfinity/feature/misc
Browse files Browse the repository at this point in the history
Feature/misc
  • Loading branch information
TuDo1403 authored Mar 25, 2024
2 parents d363121 + 1e2d229 commit 0c79a76
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/create-PR-implement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
toBranch: ${{ env.FEATURE_BRANCH }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
uses: peter-evans/create-pull-request@v6.0.1
with:
branch: ${{ env.HEAD_BRANCH }}
base: ${{env.FEATURE_BRANCH}}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create-PR-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
toBranch: ${{matrix.branch_name}}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
uses: peter-evans/create-pull-request@v6.0.1
with:
labels: automated PR
delete-branch: true
Expand Down
6 changes: 5 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
shallow = true
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
shallow = true
[submodule "lib/solady"]
path = lib/solady
url = https://github.com/Vectorized/solady
url = https://github.com/vectorized/solady
shallow = true
[submodule "lib/contract-libs"]
path = lib/contract-libs
url = https://github.com/axieinfinity/contract-libs
shallow = true
20 changes: 14 additions & 6 deletions script/BaseMigration.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ abstract contract BaseMigration is ScriptExtended {
address proxyAdmin = _getProxyAdmin();
assertTrue(proxyAdmin != address(0x0), "BaseMigration: Null ProxyAdmin");

vm.broadcast(sender());
_prankOrBroadcast(sender());
deployed = payable(address(new Proxy(logic, proxyAdmin, args)));

// validate proxy admin
Expand Down Expand Up @@ -172,7 +172,7 @@ abstract contract BaseMigration is ScriptExtended {
returns (address payable deployed, uint256 nonce)
{
nonce = vm.getNonce(sender());
vm.broadcast(sender());
_prankOrBroadcast(sender());
deployed = payable(deployCode(filename, args));
}

Expand Down Expand Up @@ -265,7 +265,7 @@ abstract contract BaseMigration is ScriptExtended {

// if proxyAdmin is External Owned Wallet
if (proxyAdmin.code.length == 0) {
vm.broadcast(proxyAdmin);
_prankOrBroadcast(proxyAdmin);
if (args.length == 0) iProxy.upgradeTo(logic);
else iProxy.upgradeToAndCall(logic, args);
} else {
Expand All @@ -278,7 +278,7 @@ abstract contract BaseMigration is ScriptExtended {
if (owner.code.length != 0) {
_cheatUpgrade(owner, wProxyAdmin, iProxy, logic);
} else {
vm.broadcast(owner);
_prankOrBroadcast(owner);
wProxyAdmin.upgrade(iProxy, logic);
}
} else {
Expand All @@ -288,15 +288,15 @@ abstract contract BaseMigration is ScriptExtended {
if (owner.code.length != 0) {
_cheatUpgradeAndCall(owner, wProxyAdmin, iProxy, logic, args);
} else {
vm.broadcast(owner);
_prankOrBroadcast(owner);
wProxyAdmin.upgradeAndCall(iProxy, logic, args);
}
}
} else {
if (owner.code.length != 0) {
_cheatUpgradeAndCall(owner, wProxyAdmin, iProxy, logic, args);
} else {
vm.broadcast(owner);
_prankOrBroadcast(owner);
wProxyAdmin.upgradeAndCall(iProxy, logic, args);
}
}
Expand Down Expand Up @@ -402,6 +402,14 @@ abstract contract BaseMigration is ScriptExtended {
wProxyAdmin.upgradeAndCall(iProxy, logic, args);
}

function _prankOrBroadcast(address to) internal virtual {
if (CONFIG.isPostChecking()) {
vm.prank(to);
} else {
vm.broadcast(to);
}
}

function _setDependencyDeployScript(TContract contractType, IScriptExtended deployScript) internal virtual {
_deployScript[contractType] = IMigrationScript(address(deployScript));
}
Expand Down
1 change: 0 additions & 1 deletion script/extensions/ScriptExtended.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ abstract contract ScriptExtended is Script, StdAssertions, IScriptExtended {

bytes public constant EMPTY_ARGS = "";
IGeneralConfig public constant CONFIG = IGeneralConfig(LibSharedAddress.CONFIG);
bool internal _isPostChecking;

modifier logFn(string memory fnName) {
_logFn(fnName);
Expand Down

0 comments on commit 0c79a76

Please sign in to comment.