Skip to content

Commit 8c84798

Browse files
authored
Merge pull request #133 from axieinfinity/release/v0.2.0
Release/v0.2.0
2 parents cf6be21 + 0c79a76 commit 8c84798

23 files changed

+276
-82
lines changed

.github/workflows/create-PR-implement.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
toBranch: ${{ env.FEATURE_BRANCH }}
4242
4343
- name: Create Pull Request
44-
uses: peter-evans/create-pull-request@v5
44+
uses: peter-evans/create-pull-request@v6.0.1
4545
with:
4646
branch: ${{ env.HEAD_BRANCH }}
4747
base: ${{env.FEATURE_BRANCH}}

.github/workflows/create-PR-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
toBranch: ${{matrix.branch_name}}
7676
7777
- name: Create Pull Request
78-
uses: peter-evans/create-pull-request@v5
78+
uses: peter-evans/create-pull-request@v6.0.1
7979
with:
8080
labels: automated PR
8181
delete-branch: true

.gitmodules

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
[submodule "lib/forge-std"]
22
path = lib/forge-std
33
url = https://github.com/foundry-rs/forge-std
4+
shallow = true
45
[submodule "lib/openzeppelin-contracts"]
56
path = lib/openzeppelin-contracts
67
url = https://github.com/OpenZeppelin/openzeppelin-contracts
8+
shallow = true
79
[submodule "lib/solady"]
810
path = lib/solady
9-
url = https://github.com/Vectorized/solady
11+
url = https://github.com/vectorized/solady
12+
shallow = true
1013
[submodule "lib/contract-libs"]
1114
path = lib/contract-libs
1215
url = https://github.com/axieinfinity/contract-libs
16+
shallow = true

broadcast.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ else
55
echo "Error: .broadcast.env file not found."
66
fi
77

8-
verify_arg=""
98
extra_argument=""
109

1110
for arg in "$@"; do
@@ -20,6 +19,15 @@ done
2019
# Remove the @ character from the end of extra_argument
2120
extra_argument="${extra_argument%%@}"
2221

22+
op_command=""
23+
## Check if the private key is stored in the .env file
24+
if [[ ! $extra_argument == *"sender"* ]] && [[ ! $extra_argument == *"trezor"* ]]; then
25+
source .env
26+
if [[ $MAINNET_PK == op* ]] || [[ $TESTNET_PK == op* ]] || [[ $LOCAL_PK == op* ]]; then
27+
op_command="op run --env-file="./.env" --"
28+
fi
29+
fi
30+
2331
echo Broadcast Tx...
2432
echo From: ${FROM}
2533
echo To: ${TO}
@@ -28,4 +36,4 @@ echo GasAmount: ${GAS}
2836
echo Calldata:
2937
cast pretty-calldata ${CALLDATA}
3038
calldata=$(cast calldata 'broadcast(address,address,uint256,uint256,bytes)' ${FROM} ${TO} ${GAS} ${VALUE} ${CALLDATA})
31-
forge script ${verify_arg} ${@} -g 200 OnchainExecutor --sig 'run(bytes,string)' ${calldata} "${extra_argument}"
39+
${op_command} forge script ${verify_arg} ${@} -g 200 OnchainExecutor --sig 'run(bytes,string)' ${calldata} "${extra_argument}"

debug.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ else
55
echo "Error: .debug.env file not found."
66
fi
77

8-
verify_arg=""
98
extra_argument=""
109

1110
for arg in "$@"; do

run.sh

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,17 @@ for arg in "$@"; do
66
--trezor)
77
extra_argument+=trezor@
88
;;
9-
--log)
10-
set -- "${@/#--log/}"
11-
extra_argument+=log@
9+
--no-postcheck)
10+
set -- "${@/#--no-postcheck/}"
11+
extra_argument+=no-postcheck@
12+
;;
13+
--generate-artifacts)
14+
set -- "${@/#--generate-artifacts/}"
15+
extra_argument+=generate-artifact@
16+
;;
17+
-atf)
18+
set -- "${@/#-atf/}"
19+
extra_argument+=generate-artifact@
1220
;;
1321
*) ;;
1422
esac
@@ -17,5 +25,14 @@ done
1725
# Remove the @ character from the end of extra_argument
1826
extra_argument="${extra_argument%%@}"
1927

28+
op_command=""
29+
## Check if the private key is stored in the .env file
30+
if [[ ! $extra_argument == *"sender"* ]] && [[ ! $extra_argument == *"trezor"* ]]; then
31+
source .env
32+
if [[ $MAINNET_PK == op* ]] || [[ $TESTNET_PK == op* ]] || [[ $LOCAL_PK == op* ]]; then
33+
op_command="op run --env-file="./.env" --"
34+
fi
35+
fi
36+
2037
calldata=$(cast calldata 'run()')
21-
forge script ${verify_arg} ${@} -g 200 --sig 'run(bytes,string)' ${calldata} "${extra_argument}"
38+
${op_command} forge script ${verify_arg} ${@} -g 200 --sig 'run(bytes,string)' ${calldata} "${extra_argument}"

script/ArtifactFactory.sol

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ contract ArtifactFactory is IArtifactFactory {
2424
address deployer,
2525
address contractAddr,
2626
string memory contractAbsolutePath,
27-
string calldata fileName,
27+
string memory fileName,
2828
bytes calldata args,
2929
uint256 nonce
3030
) external {
@@ -38,11 +38,16 @@ contract ArtifactFactory is IArtifactFactory {
3838
).green(),
3939
string.concat("(nonce: ", nonce.toString(), ")")
4040
);
41-
if (!CONFIG.getRuntimeConfig().log) {
41+
if (!CONFIG.getRuntimeConfig().generateArtifact || CONFIG.isPostChecking()) {
4242
console.log("Skipping artifact generation for:", vm.getLabel(contractAddr), "\n");
4343
return;
4444
}
4545
string memory dirPath = CONFIG.getDeploymentDirectory(CONFIG.getCurrentNetwork());
46+
if (!vm.exists(dirPath)) {
47+
console.log("\n", string.concat(dirPath, " not existed, making one...").yellow());
48+
vm.createDir(dirPath, true);
49+
vm.writeFile(string.concat(dirPath, ".chainId"), vm.toString(block.chainid));
50+
}
4651
string memory filePath = string.concat(dirPath, fileName, ".json");
4752

4853
string memory json;
@@ -67,10 +72,14 @@ contract ArtifactFactory is IArtifactFactory {
6772
json.serialize("contractAbsolutePath", contractAbsolutePath);
6873
json.serialize("numDeployments", numDeployments);
6974

70-
string[] memory s = contractAbsolutePath.split(":");
71-
string memory artifactPath = s.length == 2
72-
? string.concat("./out/", s[0], "/", s[1], ".json")
73-
: string.concat("./out/", contractAbsolutePath, "/", contractAbsolutePath.replace(".sol", ".json"));
75+
string memory artifactPath = contractAbsolutePath;
76+
if (!artifactPath.endsWith(".json")) {
77+
string[] memory s = contractAbsolutePath.split(":");
78+
artifactPath = s.length == 2
79+
? string.concat("./out/", s[0], "/", s[1], ".json")
80+
: string.concat("./out/", contractAbsolutePath, "/", contractAbsolutePath.replace(".sol", ".json"));
81+
}
82+
7483
string memory artifact = vm.readFile(artifactPath);
7584
JSONParserLib.Item memory item = artifact.parse();
7685

script/BaseGeneralConfig.sol

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,19 @@ contract BaseGeneralConfig is RuntimeConfig, WalletConfig, ContractConfig, Netwo
7676

7777
function _setUpDefaultContracts() private {
7878
_contractNameMap[DefaultContract.ProxyAdmin.key()] = DefaultContract.ProxyAdmin.name();
79+
_contractNameMap[DefaultContract.Multicall3.key()] = DefaultContract.Multicall3.name();
7980
setAddress(
8081
DefaultNetwork.RoninTestnet.key(), DefaultContract.ProxyAdmin.key(), 0x505d91E8fd2091794b45b27f86C045529fa92CD7
8182
);
8283
setAddress(
8384
DefaultNetwork.RoninMainnet.key(), DefaultContract.ProxyAdmin.key(), 0xA3e7d085E65CB0B916f6717da876b7bE5cC92f03
8485
);
86+
setAddress(
87+
DefaultNetwork.RoninMainnet.key(), DefaultContract.Multicall3.key(), 0xcA11bde05977b3631167028862bE2a173976CA11
88+
);
89+
setAddress(
90+
DefaultNetwork.RoninTestnet.key(), DefaultContract.Multicall3.key(), 0xcA11bde05977b3631167028862bE2a173976CA11
91+
);
8592

8693
_setUpContracts();
8794
}
@@ -92,6 +99,7 @@ contract BaseGeneralConfig is RuntimeConfig, WalletConfig, ContractConfig, Netwo
9299

93100
function getSender() public view virtual override returns (address payable sender) {
94101
sender = _option.trezor ? payable(_trezorSender) : payable(_envSender);
102+
if (sender == address(0x0) && getCurrentNetwork() == DefaultNetwork.Local.key()) sender = payable(DEFAULT_SENDER);
95103
require(sender != address(0x0), "GeneralConfig: Sender is address(0x0)");
96104
}
97105

0 commit comments

Comments
 (0)