From d5e54ea60584aeaaa3b67ad03401fc301ca82098 Mon Sep 17 00:00:00 2001 From: Gavin <495054021@qq.com> Date: Thu, 18 Jul 2024 15:27:35 +0800 Subject: [PATCH] Update foundry.mdx[Fix Foundry script] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The original deploy and verify scripts will prompt `custom error: EIP-1559 not activated` and `ETHERSCAN_API_KEY must be set` errors when executed, because the contract needs to be deployed on the Telos EVM chain, not Ethereum, so it is necessary to specify the Telos EVM corresponding validator `sourcify` instead of the default `etherscan`; In addition, perhaps Telos EVM does not yet support the `EIP-1559` protocol, so it is necessary to specify the `—legacy` parameter to specify the transaction format before the London hard fork. Otherwise, it will prompt the `EIP-1559 not activated` error; The updated script passed the test, for example, this transaction is an example of a successful test: https://testnet.teloscan.io/tx/0x57e32321fb4e259dcc6b62b1b6c9788803f5e6a070b6e473cc4edec974fe75c9 --- docs/build/toolchains/foundry.mdx | 40 ++++++++++++++++++------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/docs/build/toolchains/foundry.mdx b/docs/build/toolchains/foundry.mdx index 22c0651..f37989f 100644 --- a/docs/build/toolchains/foundry.mdx +++ b/docs/build/toolchains/foundry.mdx @@ -24,7 +24,12 @@ Just provide the Telos RPC URL and Chain ID when deploying and verifying your co ``` bash -forge create --rpc-url "https://mainnet.telos.net/evm" --private-key --verify src/MyContract.sol:MyContract +forge create --rpc-url https://mainnet.telos.net/evm \ + --private-key \ + src/MyContract.sol:MyContract \ + --legacy \ + --verify \ + --verifier sourcify ``` @@ -32,18 +37,17 @@ forge create --rpc-url "https://mainnet.telos.net/evm" --private-key \ - src/MyToken.sol:MyToken +forge verify-contract \ + src/MyContract.sol:MyContract \ + --chain-id 40 \ + --verifier sourcify ``` :::note ---num-of-optimizations will default to 0 if not set on verification, while it defaults to 200 if not set on deployment, so make sure you pass --num-of-optimizations 200 if you left the default compilation settings. +- Since it needs to be deployed on the Telos EVM instead of Ethereum, you need to specify the Telos corresponding validator `sourcify` instead of the default `etherscan`; +- You need to wait a few minutes to see the verification result. ::: @@ -53,7 +57,12 @@ forge verify-contract \ ``` bash -forge create --rpc-url "https://testnet.telos.net/evm" --private-key --verify src/MyContract.sol:MyContract +forge create --rpc-url https://testnet.telos.net/evm \ + --private-key \ + src/MyContract.sol:MyContract \ + --legacy \ + --verify \ + --verifier sourcify ``` @@ -61,16 +70,15 @@ forge create --rpc-url "https://testnet.telos.net/evm" --private-key \ - src/MyToken.sol:MyToken +forge verify-contract \ + src/MyContract.sol:MyContract \ + --chain-id 41 \ + --verifier sourcify ``` :::note ---num-of-optimizations will default to 0 if not set on verification, while it defaults to 200 if not set on deployment, so make sure you pass --num-of-optimizations 200 if you left the default compilation settings. +- Since it needs to be deployed on the Telos EVM instead of Ethereum, you need to specify the Telos corresponding validator `sourcify` instead of the default `etherscan`; +- You need to wait a few minutes to see the verification result. :::