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

WIP: Taiko #265

Merged
merged 15 commits into from
Dec 12, 2024
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Master list of UniV3 forks:
21. SupSwapV3
22. Kim (Algebra-like)
23. SwapMode
24. Swapsicle (Algebra-like)
25. Panko

---

Expand Down Expand Up @@ -51,6 +53,10 @@ Master list of UniV3 forks:
* Add `DODOV1` action to Mantle
* Add `DODOV1` action to Polygon
* Add `DODOV1` action to Scroll
* Deploy Settler to Taiko network
* Add UniswapV3 UniV3 fork to Taiko
* Add Swapsicle UniV3 (Algebra style) fork to Taiko
* Add Panko UniV3 fork to Taiko

## 2024-10-08

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ your integration.
hardfork (Ethereum Mainnet, Ethereum Sepolia, Polygon, Base, Optimism,
Arbitrum, Blast, Bnb, Mode)
* `0x0000000000005E88410CcDFaDe4a5EfaE4b49562` on chains supporting the Shanghai
hardfork (Avalanche, Scroll, Mantle)
hardfork (Avalanche, Scroll, Mantle, Taiko)
* `0x000000000000175a8b9bC6d539B3708EEd92EA6c` on chains supporting the London
hardfork (Linea)

Expand Down
12 changes: 4 additions & 8 deletions api_secrets.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
"etherscanKey": "",
"rpcUrl": ""
},
"base_sepolia": {
"etherscanKey": "",
"rpcUrl": ""
},
"optimism": {
"etherscanKey": "",
"rpcUrl": ""
Expand All @@ -27,10 +23,6 @@
"etherscanKey": "",
"rpcUrl": ""
},
"arbitrum_sepolia": {
"etherscanKey": "",
"rpcUrl": ""
},
"bnb": {
"etherscanKey": "",
"rpcUrl": ""
Expand All @@ -56,5 +48,9 @@
},
"mode": {
"rpcUrl": ""
},
"taiko": {
"etherscanKey": "",
"rpcUrl": ""
}
}
32 changes: 29 additions & 3 deletions chain_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
"factory": "0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC",
"fallback": "0x017062a1dE2FE6b99BE3d9d37841FeD19F573804",
"multiCall": "0xA1dabEF33b3B82c7814B6D82A79e50F4AC44102B",
"apiUrl": "NOT SUPPORTED"
"apiUrl": "https://safe-transaction-blast.safe.global/api"
},
"governance": {
"upgradeSafe": "0xf36b9f50E59870A24F42F9Ba43b2aD0A4b8f2F51",
Expand All @@ -246,7 +246,7 @@
"factory": "0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC",
"fallback": "0x017062a1dE2FE6b99BE3d9d37841FeD19F573804",
"multiCall": "0xA1dabEF33b3B82c7814B6D82A79e50F4AC44102B",
"apiUrl": "NOT SUPPORTED"
"apiUrl": "https://safe-transaction-linea.safe.global/api"
},
"governance": {
"upgradeSafe": "0xf36b9f50E59870A24F42F9Ba43b2aD0A4b8f2F51",
Expand Down Expand Up @@ -298,7 +298,7 @@
"factory": "0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC",
"fallback": "0x017062a1dE2FE6b99BE3d9d37841FeD19F573804",
"multiCall": "0xA1dabEF33b3B82c7814B6D82A79e50F4AC44102B",
"apiUrl": "NOT SUPPORTED"
"apiUrl": "https://safe-transaction-mantle.safe.global/api"
},
"governance": {
"upgradeSafe": "0xf36b9f50E59870A24F42F9Ba43b2aD0A4b8f2F51",
Expand Down Expand Up @@ -336,5 +336,31 @@
"deployer": "0x00000000000004533Fe15556B1E086BB1A72cEae"
},
"blockscoutApi": "https://explorer.mode.network/api"
},
"taiko": {
"chainId": 167000,
"displayName": "Taiko",
"isShanghai": true,
"isCancun": false,
"extraFlags": "",
"gasMultiplierPercent": 200,
"minGasPriceGwei": 1,
"safe": {
"singleton": "0xfb1bffC9d739B8D520DaF37dF666da4C687191EA",
"factory": "0xC22834581EbC8527d974F8a1c97E1bEA4EF910BC",
"fallback": "0x017062a1dE2FE6b99BE3d9d37841FeD19F573804",
"multiCall": "0xA1dabEF33b3B82c7814B6D82A79e50F4AC44102B",
"apiUrl": "NOT SUPPORTED"
},
"governance": {
"upgradeSafe": "0xf36b9f50E59870A24F42F9Ba43b2aD0A4b8f2F51",
"deploymentSafe": "0x8E5DE7118a596E99B0563D3022039c11927f4827",
"pause": "0x1CeC01DC0fFEE5eB5aF47DbEc1809F2A7c601C30"
},
"deployment": {
"deployer": "0x00000000000004533Fe15556B1E086BB1A72cEae",
"allowanceHolder": "0x0000000000005E88410CcDFaDe4a5EfaE4b49562"
},
"etherscanApi": "https://api.taikoscan.io/api"
}
}
8 changes: 2 additions & 6 deletions script/SafeConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ library SafeConfig {
function _isTestnet() internal view returns (bool) {
if (
block.chainid == 11155111 // sepolia
|| block.chainid == 84532 // base sepolia
|| block.chainid == 421614 // arbitrum sepolia
|| block.chainid == 11155420 // optimism sepolia
) {
return true;
}
Expand All @@ -25,6 +22,7 @@ library SafeConfig {
|| block.chainid == 43114 // avalanche
|| block.chainid == 59144 // linea
|| block.chainid == 81457 // blast
|| block.chainid == 167000 // taiko
|| block.chainid == 534352 // scroll
) {
return false;
Expand All @@ -47,11 +45,9 @@ library SafeConfig {
|| block.chainid == 43114 // avalanche
|| block.chainid == 59144 // linea
|| block.chainid == 81457 // blast
|| block.chainid == 84532 // base sepolia
|| block.chainid == 421614 // arbitrum sepolia
|| block.chainid == 167000 // taiko
|| block.chainid == 534352 // scroll
|| block.chainid == 11155111 // sepolia
|| block.chainid == 11155420 // optimism sepolia
) {
return false;
}
Expand Down
12 changes: 0 additions & 12 deletions sh/checkout_settler_commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,6 @@ cd "$project_root"

. "$project_root"/sh/common.sh

declare -i chainid
chainid="$(get_config chainId)"
declare -r -i chainid
declare rpc_url
rpc_url="$(get_api_secret rpcUrl)"
declare -r rpc_url

if [[ ${rpc_url:-unset} = 'unset' ]] ; then
echo '`rpcUrl` is unset in `api_secrets.json` for chain "'"$chain_name"'"' >&2
exit 1
fi

declare deployer_address
deployer_address="$(get_config deployment.deployer)"
declare -r deployer_address
Expand Down
31 changes: 31 additions & 0 deletions sh/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,34 @@ if [[ $(get_config isCancun) != [Tt]rue ]] ; then
echo 'You are on the wrong branch' >&2
exit 1
fi

declare -i chainid
chainid="$(get_config chainId)"
declare -r -i chainid

declare rpc_url
rpc_url="$(get_api_secret rpcUrl)"
declare -r rpc_url

if [[ ${rpc_url:-unset} = 'unset' ]] || [[ $rpc_url == 'null' ]] ; then
echo '`rpcUrl` is unset in `api_secrets.json` for chain "'"$chain_name"'"' >&2
exit 1
fi

function verify_contract {
declare -r _verify_constructor_args="$1"
shift
declare -r _verify_deployed_address="$1"
shift
declare -r _verify_source_path="$1"
shift

if (( chainid == 34443 )) ; then # Mode uses Blockscout, not Etherscan
forge verify-contract --watch --chain $chainid --verifier blockscout --verifier-url "$(get_config blockscoutApi)" --constructor-args "$_verify_constructor_args" "$_verify_deployed_address" "$_verify_source_path"
else
forge verify-contract --watch --chain $chainid --verifier etherscan --etherscan-api-key "$(get_api_secret etherscanKey)" --verifier-url "$(get_config etherscanApi)" --constructor-args "$_verify_constructor_args" "$_verify_deployed_address" "$_verify_source_path"
fi
if (( chainid != 81457 )) && (( chainid != 167000 )); then # Sourcify doesn't support Blast or Taiko
forge verify-contract --watch --chain $chainid --verifier sourcify --constructor-args "$_verify_constructor_args" "$_verify_deployed_address" "$_verify_source_path"
fi
}
16 changes: 0 additions & 16 deletions sh/common_safe.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
if [[ ${chainid:-unset} = 'unset' ]] ; then
declare -i chainid
chainid="$(get_config chainId)"
declare -r -i chainid
fi

if [[ ${rpc_url:-unset} = 'unset' ]] ; then
declare rpc_url
rpc_url="$(get_api_secret rpcUrl)"
declare -r rpc_url
fi
if [[ ${rpc_url:-unset} = 'unset' ]] ; then
echo '`rpcUrl` is unset in `api_secrets.json` for chain "'"$chain_name"'"' >&2
exit 1
fi

declare multicall_address
multicall_address="$(get_config safe.multiCall)"
declare -r multicall_address
Expand Down
22 changes: 1 addition & 21 deletions sh/deploy_allowanceholder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,6 @@ cd "$project_root"
. "$project_root"/sh/common.sh
. "$project_root"/sh/common_secrets.sh

declare rpc_url
rpc_url="$(get_api_secret rpcUrl)"
declare -r rpc_url
if [[ ${rpc_url:-unset} = 'unset' ]] ; then
echo '`rpcUrl` is unset in `api_secrets.json` for chain "'"$chain_name"'"' >&2
exit 1
fi

declare -i chainid
chainid="$(get_config chainId)"
declare -r -i chainid

# set minimum gas price to (mostly for Arbitrum and BNB)
declare -i min_gas_price
min_gas_price="$(get_config minGasPriceGwei)"
Expand Down Expand Up @@ -164,15 +152,7 @@ forge create --from "$(get_secret allowanceHolder deployer)" --private-key "$(ge

sleep 1m

if (( chainid == 34443 )) ; then # Mode uses Blockscout, not Etherscan
forge verify-contract --watch --chain $chainid --verifier blockscout --verifier-url "$(get_config blockscoutApi)" --constructor-args 0x "$(get_secret allowanceHolder address)" src/allowanceholder/AllowanceHolder.sol:AllowanceHolder
else
forge verify-contract --watch --chain $chainid --verifier etherscan --etherscan-api-key "$(get_api_secret etherscanKey)" --verifier-url "$(get_config etherscanApi)" --constructor-args 0x "$(get_secret allowanceHolder address)" src/allowanceholder/AllowanceHolder.sol:AllowanceHolder
fi

if (( chainid != 81457 )) && (( chainid != 59144 )) ; then # sourcify doesn't support Blast or Linea
forge verify-contract --watch --chain $chainid --verifier sourcify --constructor-args 0x "$(get_secret allowanceHolder address)" src/allowanceholder/AllowanceHolder.sol:AllowanceHolder
fi
verify_contract 0x "$(get_secret allowanceHolder address)" src/allowanceholder/AllowanceHolder.sol:AllowanceHolder

echo 'Deployment is complete' >&2
echo 'Add the following to your chain_config.json' >&2
Expand Down
27 changes: 2 additions & 25 deletions sh/deploy_new_chain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -158,19 +158,6 @@ metatransaction_description="$(jq -MRs < "$project_root"/sh/initial_description_
metatransaction_description="${metatransaction_description:1:$((${#metatransaction_description} - 2))}"
declare -r metatransaction_description

# not quite so secret-s
declare -i chainid
chainid="$(get_config chainId)"
declare -r -i chainid
declare rpc_url
rpc_url="$(get_api_secret rpcUrl)"
declare -r rpc_url

if [[ ${rpc_url:-unset} = 'unset' ]] ; then
echo '`rpcUrl` is unset in `api_secrets.json` for chain "'"$chain_name"'"' >&2
exit 1
fi

# safe constants
declare safe_factory
safe_factory="$(get_config safe.factory)"
Expand Down Expand Up @@ -307,21 +294,11 @@ if [[ ${BROADCAST-no} = [Yy]es ]] ; then

echo 'Verifying pause Safe module' >&2

if (( chainid == 34443 )) ; then # Mode uses Blockscout, not Etherscan
forge verify-contract --watch --chain $chainid --verifier blockscout --verifier-url "$(get_config blockscoutApi)" --constructor-args "$(cast abi-encode 'constructor(address)' "$deployment_safe")" "$ice_cold_coffee" src/deployer/SafeModule.sol:ZeroExSettlerDeployerSafeModule
else
forge verify-contract --watch --chain $chainid --verifier etherscan --etherscan-api-key "$(get_api_secret etherscanKey)" --verifier-url "$(get_config etherscanApi)" --constructor-args "$(cast abi-encode 'constructor(address)' "$deployment_safe")" "$ice_cold_coffee" src/deployer/SafeModule.sol:ZeroExSettlerDeployerSafeModule
fi
forge verify-contract --watch --chain $chainid --verifier sourcify --constructor-args "$(cast abi-encode 'constructor(address)' "$deployment_safe")" "$ice_cold_coffee" src/deployer/SafeModule.sol:ZeroExSettlerDeployerSafeModule
verify_contract "$(cast abi-encode 'constructor(address)' "$deployment_safe")" "$ice_cold_coffee" src/deployer/SafeModule.sol:ZeroExSettlerDeployerSafeModule

echo 'Verified Safe module -- now verifying Deployer implementation' >&2

if (( chainid == 34443 )) ; then # Mode uses Blockscout, not Etherscan
forge verify-contract --watch --chain $chainid --verifier blockscout --verifier-url "$(get_config blockscoutApi)" "$deployer_impl" --constructor-args "$(cast abi-encode 'constructor(uint256)' 1)" src/deployer/Deployer.sol:Deployer
else
forge verify-contract --watch --chain $chainid --verifier etherscan --etherscan-api-key "$(get_api_secret etherscanKey)" --verifier-url "$(get_config etherscanApi)" "$deployer_impl" --constructor-args "$(cast abi-encode 'constructor(uint256)' 1)" src/deployer/Deployer.sol:Deployer
fi
forge verify-contract --watch --chain $chainid --verifier sourcify "$deployer_impl" src/deployer/Deployer.sol:Deployer
verify_contract "$(cast abi-encode 'constructor(uint256)' 1)" "$deployer_impl" src/deployer/Deployer.sol:Deployer

echo 'Run ./sh/verify_settler.sh to verify newly-deployed Settlers' >&2
fi
Expand Down
13 changes: 0 additions & 13 deletions sh/deploy_safe_infra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,6 @@ declare -r factory_hash='0x337d7f54be11b6ed55fef7b667ea5488db53db8320a05d1146aa4
declare -r fallback_hash='0x03e69f7ce809e81687c69b19a7d7cca45b6d551ffdec73d9bb87178476de1abf'
declare -r multicall_hash='0xa9865ac2d9c7a1591619b188c4d88167b50df6cc0c5327fcbd1c8c75f7c066ad'

declare rpc_url
rpc_url="$(get_api_secret rpcUrl)"
declare -r rpc_url

if [[ ${rpc_url:-unset} = 'unset' ]] ; then
echo '`rpcUrl` is unset in `api_secrets.json` for chain "'"$chain_name"'"' >&2
exit 1
fi

declare -i chainid
chainid="$(get_config chainId)"
declare -r -i chainid

declare singleton
singleton="$(get_config safe.singleton)"
declare -r singleton
Expand Down
5 changes: 1 addition & 4 deletions sh/upgrade_deployer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,7 @@ if [[ ${1:-unset} = 'deploy' ]] ; then
echo 'Waiting for 1 minute for Etherscan to pick up the deployment' >&2
sleep 60

forge verify-contract --watch --chain $chainid --etherscan-api-key "$(get_api_secret etherscanKey)" --verifier-url "$(get_config etherscanApi)" --constructor-args "$constructor_args" "$deployed_address" src/deployer/Deployer.sol:Deployer
if (( chainid != 81457 )) && (( chainid != 59144 )); then # sourcify doesn't support Blast or Linea
forge verify-contract --watch --chain $chainid --verifier sourcify --constructor-args "$constructor_args" "$deployed_address" src/deployer/Deployer.sol:Deployer
fi
verify_contract "$constructor_args" "$deployed_address" src/deployer/Deployer.sol:Deployer
fi

if [[ ${1:-unset} = 'confirm' ]] ; then
Expand Down
32 changes: 4 additions & 28 deletions sh/verify_settler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,6 @@ cd "$project_root"

. "$project_root"/sh/common.sh

declare -i chainid
chainid="$(get_config chainId)"
declare -r -i chainid

declare rpc_url
rpc_url="$(get_api_secret rpcUrl)"
declare -r rpc_url
if [[ ${rpc_url:-unset} = 'unset' ]] ; then
echo '`rpcUrl` is unset in `api_secrets.json` for chain "'"$chain_name"'"' >&2
exit 1
fi

declare deployer_address
deployer_address="$(get_config deployment.deployer)"
declare -r deployer_address
Expand All @@ -153,27 +141,15 @@ echo 'Verifying taker-submitted settler...' >&2
declare taker_settler
taker_settler="$(cast call --rpc-url "$rpc_url" "$deployer_address" "$erc721_ownerof_sig" 2)"
declare -r taker_settler
if (( chainid == 34443 )) ; then # Mode uses Blockscout, not Etherscan
forge verify-contract --watch --chain $chainid --verifier blockscout --verifier-url "$(get_config blockscoutApi)" --constructor-args "$constructor_args" "$taker_settler" src/flat/"$chain_display_name"Flat.sol:"$chain_display_name"Settler
else
forge verify-contract --watch --chain $chainid --verifier etherscan--etherscan-api-key "$(get_api_secret etherscanKey)" --verifier-url "$(get_config etherscanApi)" --constructor-args "$constructor_args" "$taker_settler" src/flat/"$chain_display_name"Flat.sol:"$chain_display_name"Settler
fi
if (( chainid != 81457 )) && (( chainid != 59144 )); then # sourcify doesn't support Blast or Linea
forge verify-contract --watch --chain $chainid --verifier sourcify --constructor-args "$constructor_args" "$taker_settler" src/flat/"$chain_display_name"Flat.sol:"$chain_display_name"Settler
fi

verify_contract "$constructor_args" "$taker_settler" src/flat/"$chain_display_name"Flat.sol:"$chain_display_name"Settler

echo 'Verified taker-submitted Settler... verifying metatx Settler...' >&2

declare metatx_settler
metatx_settler="$(cast call --rpc-url "$rpc_url" "$deployer_address" "$erc721_ownerof_sig" 3)"
declare -r metatx_settler
if (( chainid == 34443 )) ; then # Mode uses Blockscout, not Etherscan
forge verify-contract --watch --chain $chainid --verifier blockscout --verifier-url "$(get_config blockscoutApi)" --constructor-args "$constructor_args" "$metatx_settler" src/flat/"$chain_display_name"Flat.sol:"$chain_display_name"SettlerMetaTxn
else
forge verify-contract --watch --chain $chainid --verifier etherscan --etherscan-api-key "$(get_api_secret etherscanKey)" --verifier-url "$(get_config etherscanApi)" --constructor-args "$constructor_args" "$metatx_settler" src/flat/"$chain_display_name"Flat.sol:"$chain_display_name"SettlerMetaTxn
fi
if (( chainid != 81457 )) && (( chainid != 59144 )) ; then # sourcify doesn't support Blast or Linea
forge verify-contract --watch --chain $chainid --verifier sourcify --constructor-args "$constructor_args" "$metatx_settler" src/flat/"$chain_display_name"Flat.sol:"$chain_display_name"SettlerMetaTxn
fi

verify_contract "$constructor_args" "$metatx_settler" src/flat/"$chain_display_name"Flat.sol:"$chain_display_name"SettlerMetaTxn

echo 'Verified metatx Settler. All done!' >&2
Loading