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

BREAKING_CHANGE: adapt soldeer, enhance script runtime, extra features #145

Open
wants to merge 105 commits into
base: release/v0.3.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
c670305
chore: update forge-std
TuDo1403 May 16, 2024
c8c6e97
chore: update solady
TuDo1403 May 16, 2024
50cbb70
chore: append package version
TuDo1403 May 16, 2024
4193366
chore: rename remappings
TuDo1403 May 16, 2024
e178dfb
chore: fix typo
TuDo1403 May 16, 2024
922f64f
script: use console instead of console2
TuDo1403 May 16, 2024
c243492
Merge pull request #137 from axieinfinity/implement-feature/rework/bu…
TuDo1403 May 16, 2024
257306e
script: support --verify flag and rework migration config, network co…
TuDo1403 May 16, 2024
73144e8
script: minor bug fix
TuDo1403 May 16, 2024
1965eb2
chore: remove echo command
TuDo1403 May 16, 2024
441240f
script: refactor network config
TuDo1403 May 16, 2024
ce22e6e
Merge pull request #138 from axieinfinity/implement-feature/rework/sc…
TuDo1403 May 16, 2024
76d4ffd
feat(BaseGeneralConfig): add UserDefinedConfig
TuDo1403 May 16, 2024
787ff64
Merge pull request #140 from axieinfinity/implement-feature/rework/us…
TuDo1403 May 17, 2024
8585a2c
script: refactor base migration
TuDo1403 May 16, 2024
80509aa
feat(BaseMigration): rework BaseMigration, add LibDeploy
TuDo1403 May 18, 2024
e1141ab
script: optmize load artifact
TuDo1403 May 18, 2024
0a904b0
script: fix upgrade callback interface
TuDo1403 May 18, 2024
72d9a60
script: minor bug fix
TuDo1403 May 19, 2024
91e2078
script: combine export_address.sh to run.sh
TuDo1403 May 19, 2024
5e049a2
script: add sender config
TuDo1403 May 19, 2024
39a0065
script: minor fix
TuDo1403 May 19, 2024
5ff9e5a
test: fix test
TuDo1403 May 19, 2024
5871b9e
script: update usage
TuDo1403 May 19, 2024
47c04bf
script: ensure correct artifact generation
TuDo1403 May 19, 2024
3a516fe
script: update usage
TuDo1403 May 19, 2024
00427f3
fix:(TransparentProxyV2): fix relative import path
TuDo1403 May 20, 2024
ef452ce
script: preserve constant for backward compatibility
TuDo1403 May 20, 2024
2ecd9f1
script: fix prank or broadcast in LibDeploy
TuDo1403 May 20, 2024
1a09ba2
fix(ContractConfig): fix wrong contract name if contains many Proxy
TuDo1403 May 20, 2024
ba45c85
script: fix run.sh
TuDo1403 May 20, 2024
9a4f471
fix(TransparentProxy): add payable in constructor
TuDo1403 May 20, 2024
048baed
fix(run.sh): not load op when verify contract
TuDo1403 May 20, 2024
dab1142
script: update sample
TuDo1403 May 20, 2024
cf642d3
script: fix local network
TuDo1403 May 20, 2024
fc68128
fix: label trezor
TuDo1403 May 20, 2024
a39bb6f
script(NetworkConfig): support time manipulation
TuDo1403 May 20, 2024
dd39186
script(ContractConfig): skip artifact folder if no .chainId is found
TuDo1403 May 20, 2024
e378976
script(ScriptExtended): only setup in constructor if in test context
TuDo1403 May 20, 2024
fe61468
fix(ScriptExtended): use rollUpTo
TuDo1403 May 20, 2024
383ddf6
fix(DefaultNework): change blocktime from 1 -> 3
TuDo1403 May 20, 2024
0522298
script: add IUserDefinedConfig to IGeneralConfig
TuDo1403 May 21, 2024
c3f9f1c
Merge pull request #139 from axieinfinity/implement-feature/rework/ba…
TuDo1403 Jun 10, 2024
a53b5c8
script: allow solc version from 0.6, adapt soldeer
TuDo1403 Jun 12, 2024
1fd3987
feat(BaseGeneralConfig): add setUpDefaultContracts function
TuDo1403 Jun 13, 2024
9f8ed38
feat(ScriptExtended): add precheck fn
TuDo1403 Jun 13, 2024
5b1361a
fix(NetworkConfig): fix rollUpTo and warpUpTo
TuDo1403 Jun 13, 2024
0a53a43
script: use network as primary key
TuDo1403 Jun 16, 2024
549200b
script: only verify deployed contracts
TuDo1403 Jun 16, 2024
6b2b09d
chore: add comment
TuDo1403 Jun 16, 2024
c3406a8
chore: ignore broadcast folder
TuDo1403 Jun 16, 2024
db28939
Merge pull request #144 from axieinfinity/implement-feature/rework/ad…
TuDo1403 Jun 16, 2024
2a5d5e9
chore: add default contract addresses
TuDo1403 Jun 16, 2024
51168c5
script: only use op prefix if match network label
TuDo1403 Jun 16, 2024
bf69cec
chore: update ci
TuDo1403 Jun 16, 2024
973f22c
chore: fix ci push
TuDo1403 Jun 16, 2024
e66f486
chore: remove --size tag
TuDo1403 Jun 16, 2024
b3dff81
Merge pull request #148 from axieinfinity/implement-feature/rework/up…
TuDo1403 Jun 16, 2024
52167eb
feat: remove contract-libs and add install.sh
TuDo1403 Jun 16, 2024
1521acf
Merge pull request #149 from axieinfinity/implement-feature/rework/re…
TuDo1403 Jun 16, 2024
3e2986b
fix: fix minor bugs for local setup
TuDo1403 Jun 16, 2024
f0498e0
fix: fix write deploy log when skipped by simulation
TuDo1403 Jun 16, 2024
261b62d
fix: use TransparentProxyV2
TuDo1403 Jun 16, 2024
2c141ee
Merge pull request #150 from axieinfinity/implement-feature/rework/fi…
TuDo1403 Jun 16, 2024
46822c4
fix: use bytes32 for encoding network
TuDo1403 Jun 17, 2024
ff4e5f1
fix(NetworkConfig): add chain id
TuDo1403 Jul 26, 2024
e3b4c1b
script: fix switchBack fn
TuDo1403 Jul 29, 2024
40befeb
chore: pump dep version + remove hardhat to replace with forge verifi…
TuDo1403 Jul 29, 2024
a77e54b
chore: remove unused remappings
TuDo1403 Jul 29, 2024
d06f76e
feat: change visibility of callback to internal
huyhuynh3103 Jul 31, 2024
ab9eed2
Merge pull request #154 from axieinfinity/feature/fix-callback-visibi…
TuDo1403 Jul 31, 2024
bb5463c
feat(LibInitializeGuard): add guard for safely upgrade contract with …
Aug 13, 2024
17310d9
Update script/libraries/LibInitializeGuard.sol
TuDo1403 Aug 13, 2024
a0fa1b4
Update script/libraries/LibInitializeGuard.sol
TuDo1403 Aug 13, 2024
99ec3ea
feat(LibInitializeGuard): allow migration without initialization
TuDo1403 Aug 20, 2024
92e0d7d
fix: fix typo
TuDo1403 Aug 20, 2024
b2408a4
doc(LibInitializeGuard): add doc
TuDo1403 Aug 20, 2024
a2e04cc
Update script/libraries/LibInitializeGuard.sol
TuDo1403 Aug 24, 2024
8f9e942
script: use absolute path instead of contract name
TuDo1403 Aug 26, 2024
324ed7f
chore: fix incorrect contract name when using another artifact
tringuyenskymavis Aug 26, 2024
1850606
test(LibInitializeGuard): test cases for LibInitializeGuard
tringuyenskymavis Aug 26, 2024
d613a81
chore: fix ci
tringuyenskymavis Aug 26, 2024
18588fc
chore: update foundry version
tringuyenskymavis Aug 27, 2024
5be0bba
chore: fix ci
tringuyenskymavis Aug 27, 2024
f54a072
chore: fix ci
tringuyenskymavis Aug 27, 2024
ff158a0
chore: remove remapping path
tringuyenskymavis Aug 27, 2024
ab06fa7
chore: fix ci
tringuyenskymavis Aug 27, 2024
e17b0cd
chore: refactor code
tringuyenskymavis Aug 27, 2024
dd5c9c2
chore: refactor code
tringuyenskymavis Aug 27, 2024
bf9ceaa
Merge pull request #156 from axieinfinity/implement-feature/rework/ad…
TuDo1403 Aug 27, 2024
1785b77
Merge pull request #146 from axieinfinity/implement-feature/rework/ad…
TuDo1403 Aug 29, 2024
77b0752
chore: remove unused gitsubmodule
TuDo1403 Sep 12, 2024
39fdaaf
fix: return error code if script ran failed
TuDo1403 Sep 12, 2024
2a720f4
chore: add config for soldeer
TuDo1403 Sep 12, 2024
67b273f
feat(RoninTransparentProxy): add standard for transparent proxy
TuDo1403 Oct 4, 2024
f3f5311
feat: apply fmt, use shell to generate artifact, silent log via vm.pa…
TuDo1403 Oct 5, 2024
1328dee
feat: add dpos profile contract
TuDo1403 Oct 7, 2024
7f1f948
Merge pull request #160 from axieinfinity/implement-feature/rework/ad…
TuDo1403 Oct 7, 2024
6847109
fix(LibArtifact): path to generate-artifact.sh
huyhuynh3103 Oct 9, 2024
0f3f935
Merge pull request #161 from axieinfinity/implement-feature/rework/pa…
TuDo1403 Oct 9, 2024
485dcc1
chore: restore the transparent proxy v4.9.5
huyhuynh3103 Oct 10, 2024
4ee513f
chore: add RoninTransparentUpgradeabl
huyhuynh3103 Oct 10, 2024
824adfe
fix: unit test
huyhuynh3103 Oct 10, 2024
ac0327d
fix: LibInitializeGuard
huyhuynh3103 Oct 10, 2024
b426132
Merge pull request #162 from axieinfinity/implement-feature/rework/re…
huyhuynh3103 Oct 10, 2024
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
13 changes: 8 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: test
on:
push:
branches:
- mainnet
- testnet
- 'feature/*'
- 'features/*'
- 'implement-feature/**'
- 'implement-feature/**/**'
pull_request:
branches:
- mainnet
Expand All @@ -30,14 +30,17 @@ jobs:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
version: nightly-2b1f8d6dd90f9790faf0528e05e60e573a7569ce

- name: Install soldeer
run: forge soldeer install

- name: Run Forge build
run: |
forge --version
forge build --sizes
forge build
id: build

- name: Run Forge tests
Expand Down
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ docs/
*.env
.vscode

node_modules/
yarn-error.log
.yarn
.yarnrc.yml
deployments/**/exported_address
dependencies
deployments
logs/deployed-contracts
broadcast
16 changes: 0 additions & 16 deletions .gitmodules

This file was deleted.

39 changes: 35 additions & 4 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,55 @@
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
libs = ["dependencies"]
test = "test"
ffi = true
# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options

solc = '0.8.23'
extra_output = ["devdoc", "userdoc", "storagelayout"]
evm_version = 'istanbul'
evm_version = 'london'
use_literal_content = true
fs_permissions = [{ access = "read-write", path = "./" }]

[fmt]
line_length = 120
tab_width = 2
bracket_spacing = true
multiline_func_header = 'params_first'
single_line_statement_blocks = 'single'
sort_imports = true
number_underscore = "thousands"
wrap_comments = true

[rpc_endpoints]
ethereum = "https://eth.llamarpc.com"
goerli = "https://ethereum-goerli.publicnode.com"
ronin-mainnet = "https://api-partner.roninchain.com/rpc"
ronin-testnet = "https://saigon-archive.roninchain.com/rpc"
localhost = "http://localhost:8545"
localhost = "http://localhost:8545"

[dependencies]
"forge-std" = { version = "1.9.3", url = "https://github.com/foundry-rs/forge-std/archive/refs/tags/v1.9.3.zip" }
"solady" = { version = "0.0.228", url = "https://github.com/Vectorized/solady/archive/refs/tags/v0.0.228.zip" }
"openzeppelin" = { version = "5.0.2", url = "https://github.com/OpenZeppelin/openzeppelin-contracts/archive/refs/tags/v5.0.2.zip" }
"openzeppelin-v4" = { version = "4.9.5", url = "https://github.com/OpenZeppelin/openzeppelin-contracts/archive/refs/tags/v4.9.5.zip" }

[soldeer]
# whether soldeer manages remappings
remappings_generate = false

# whether soldeer re-generates all remappings when installing, updating or uninstalling deps
remappings_regenerate = false

# whether to suffix the remapping with the version: `name-a.b.c`
remappings_version = true

# a prefix to add to the remappings ("@" would give `@name`)
remappings_prefix = ""

# where to store the remappings ("txt" for `remappings.txt` or "config" for `foundry.toml`)
# ignored when `soldeer.toml` is used as config (uses `remappings.txt`)
remappings_location = "txt"

# whether to install sub-dependencies or not. If true this wil install the dependencies of dependencies 1 level down.
recursive_deps = true
120 changes: 120 additions & 0 deletions generate-artifact.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#!/bin/bash

# Parse the command-line arguments
while [[ "$#" -gt 0 ]]; do
case $1 in
--name)
name="$2"
shift
;;
--args)
args="$2"
shift
;;
--value)
value="$2"
shift
;;
--nonce)
nonce="$2"
shift
;;
--address)
address="$2"
shift
;;
--deployer)
deployer="$2"
shift
;;
--chainid)
chainid="$2"
shift
;;
--block-number)
block_number="$2"
shift
;;
--timestamp)
timestamp="$2"
shift
;;
--absolute-path)
absolute_path="$2"
shift
;;
--path)
path="$2"
shift
;;
--artifact-name)
artifact_name="$2"
shift
;;
*)
echo "Unknown parameter passed: $1"
exit 1
;;
esac
shift
done

if [[ -z "$name" || -z "$args" || -z "$value" || -z "$nonce" || -z "$deployer" || -z "$chainid" || -z "$block-number" || -z "$timestamp" || -z "$absolute_path" || -z "$path" ]]; then
echo "Error: Missing required arguments."
echo "Usage: ./generate-artifact.sh --name <name> --value <value> --nonce <nonce> --address <address> --deployer <deployer> --chainid <chainid> --block-number <block_number> --timestamp <timestamp> --absolute-path <absolute_path> --args <args> --path <path> --artifact-name <artifact_name>"
exit 1
fi

# Generate the artifact
abi=$(forge inspect $name abi)
devdoc=$(forge inspect $name devdoc)
userdoc=$(forge inspect $name userdoc)
metadata=$(forge inspect $name metadata)
storage_layout=$(forge inspect $name storageLayout)
bytecode=$(forge inspect $name bytecode)
deployed_bytecode=$(forge inspect $name deployedBytecode)

# Create the JSON object
json_content=$(
jq -n \
--arg name "$name" \
--arg address "$address" \
--arg args "$args" \
--arg value "$value" \
--arg nonce "$nonce" \
--arg deployer "$deployer" \
--arg chainid "$chainid" \
--arg block_number "$block_number" \
--arg timestamp "$timestamp" \
--argjson abi "$abi" \
--argjson devdoc "$devdoc" \
--argjson userdoc "$userdoc" \
--argjson metadata "$metadata" \
--argjson storage_layout "$storage_layout" \
--arg bytecode "$bytecode" \
--arg deployed_bytecode "$deployed_bytecode" \
'{
name: $name,
address: $address,
args: $args,
value: $value,
nonce: $nonce,
deployer: $deployer,
chainid: $chainid,
block_number: $block_number,
timestamp: $timestamp,
abi: $abi,
devdoc: $devdoc,
userdoc: $userdoc,
metadata: $metadata,
storage_layout: $storage_layout,
bytecode: $bytecode,
deployed_bytecode: $deployed_bytecode
}'
)

# Write the JSON object to the specified path
echo "$json_content" >"$path/$artifact_name.json"

# Write the JSON object to the specified path
echo "$json_content" >"$path/$artifact_name.json"
28 changes: 28 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Check if foundry is installed
if ! command -v $HOME/.foundry/bin/forge &>/dev/null; then
# Install foundryup
curl -L https://foundry.paradigm.xyz | bash
# Install foundry
$HOME/.foundry/bin/foundryup -v nightly-de33b6af53005037b463318d2628b5cfcaf39916 # Stable version
fi

# Check if rustup is installed
if ! command -v rustup &>/dev/null; then
# Install rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
fi

# Update rustup
$HOME/.cargo/bin/rustup update stable
# Install soldeer
$HOME/.cargo/bin/cargo install soldeer
# Update dependencies with soldeer
$HOME/.cargo/bin/soldeer update
# Run forge build
$HOME/.foundry/bin/forge build

# Check if rustup is installed
if ! command -v jq &>/dev/null; then
# Install jq
brew install jq
fi
1 change: 0 additions & 1 deletion lib/contract-libs
Submodule contract-libs deleted from 238860
1 change: 0 additions & 1 deletion lib/forge-std
Submodule forge-std deleted from b6a506
1 change: 0 additions & 1 deletion lib/openzeppelin-contracts
Submodule openzeppelin-contracts deleted from fd81a9
1 change: 0 additions & 1 deletion lib/solady
Submodule solady deleted from d45783
23 changes: 0 additions & 23 deletions package.json

This file was deleted.

5 changes: 4 additions & 1 deletion remappings.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
foundry-deployment-kit/=script/
@fdk/=script/
forge-std=dependencies/forge-std-1.9.3/src/
@solady-0.0.228=dependencies/solady-0.0.228
@openzeppelin=dependencies/openzeppelin-5.0.2
Loading
Loading