├── .all-contributorsrc ├── .github └── workflows │ ├── deploy.yml │ ├── project.yml │ └── test.yml ├── .gitignore ├── .gitmodules ├── CONTRIBUTING.md ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── README_cn.md ├── book.toml ├── projects ├── README.md ├── cheatcodes │ ├── foundry.toml │ └── test │ │ ├── BlastMock.t.sol │ │ ├── EmitContract.t.sol │ │ └── OwnerUpOnly.t.sol ├── fuzz_testing │ ├── foundry.toml │ └── test │ │ ├── Safe.t.sol │ │ ├── Safe.t.sol.1 │ │ ├── Safe.t.sol.2 │ │ └── Safe.t.sol.3 ├── test_filters │ ├── foundry.toml │ └── test │ │ ├── ComplicatedContract.t.sol │ │ └── ContractB.t.sol └── writing_tests │ ├── foundry.toml │ └── test │ ├── Basic.t.sol │ └── Basic2.t.sol ├── scripts ├── common ├── gen_output.sh └── gen_output │ ├── cast.sh │ ├── chisel.sh │ ├── forge.sh │ ├── help.rs │ └── help.sh ├── src ├── README.md ├── SUMMARY.md ├── anvil │ ├── README.md │ └── anvil.png ├── cast │ └── README.md ├── cheatcodes │ ├── README.md │ ├── accesses.md │ ├── active-fork.md │ ├── addr.md │ ├── allow-cheatcodes.md │ ├── assertions.md │ ├── assume-no-revert.md │ ├── assume.md │ ├── breakpoint.md │ ├── broadcast.md │ ├── chain-id.md │ ├── clear-mocked-calls.md │ ├── coinbase.md │ ├── copy-storage.md │ ├── create-fork.md │ ├── create-select-fork.md │ ├── create-wallet.md │ ├── deal.md │ ├── derive-key.md │ ├── difficulty.md │ ├── env-address.md │ ├── env-bool.md │ ├── env-bytes.md │ ├── env-bytes32.md │ ├── env-int.md │ ├── env-or.md │ ├── env-string.md │ ├── env-uint.md │ ├── environment.md │ ├── etch.md │ ├── expect-call.md │ ├── expect-emit.md │ ├── expect-revert.md │ ├── external.md │ ├── fee.md │ ├── ffi.md │ ├── forking.md │ ├── fs.md │ ├── fuzzer.md │ ├── gas-snapshots.md │ ├── get-block-number.md │ ├── get-block-timestamp.md │ ├── get-code.md │ ├── get-deployed-code.md │ ├── get-label.md │ ├── get-nonce.md │ ├── get-recorded-logs.md │ ├── is-persistent.md │ ├── key-exists-json.md │ ├── key-exists-toml.md │ ├── key-exists.md │ ├── label.md │ ├── load.md │ ├── make-persistent.md │ ├── mock-call-revert.md │ ├── mock-call.md │ ├── mock-function.md │ ├── parse-address.md │ ├── parse-bool.md │ ├── parse-bytes.md │ ├── parse-bytes32.md │ ├── parse-int.md │ ├── parse-json-keys.md │ ├── parse-json.md │ ├── parse-toml-keys.md │ ├── parse-toml.md │ ├── parse-uint.md │ ├── pause-gas-metering.md │ ├── prank.md │ ├── prevrandao.md │ ├── project-root.md │ ├── prompt.md │ ├── read-callers.md │ ├── record-logs.md │ ├── record.md │ ├── remember-key.md │ ├── reset-gas-metering.md │ ├── resume-gas-metering.md │ ├── revoke-persistent.md │ ├── roll-fork.md │ ├── roll.md │ ├── rpc.md │ ├── select-fork.md │ ├── serialize-json.md │ ├── set-arbitrary-storage.md │ ├── set-env.md │ ├── set-nonce.md │ ├── sign.md │ ├── skip.md │ ├── sleep.md │ ├── start-broadcast.md │ ├── start-prank.md │ ├── start-state-diff-recording.md │ ├── state-snapshots.md │ ├── stop-and-return-state-diff.md │ ├── stop-broadcast.md │ ├── stop-prank.md │ ├── store.md │ ├── to-string.md │ ├── transact.md │ ├── tx-gas-price.md │ ├── unix-time.md │ ├── utilities.md │ ├── warp.md │ ├── write-json.md │ └── write-toml.md ├── chisel │ └── README.md ├── ci-cd │ └── github-actions.md ├── config │ ├── README.md │ ├── continuous-integration.md │ ├── hardhat.md │ ├── shell-autocompletion.md │ ├── static-analyzers.md │ ├── vscode.md │ └── vyper.md ├── contributing.md ├── faq.md ├── forge │ ├── README.md │ ├── advanced-testing.md │ ├── cheatcodes.md │ ├── debugger.md │ ├── deploying.md │ ├── differential-ffi-testing.md │ ├── forge-std.md │ ├── fork-testing.md │ ├── fuzz-testing.md │ ├── gas-function-snapshots.md │ ├── gas-reports.md │ ├── gas-section-snapshots.md │ ├── gas-tracking.md │ ├── invariant-testing.md │ ├── replay-testing.md │ ├── tests.md │ ├── traces.md │ └── writing-tests.md ├── getting-started │ ├── first-steps.md │ └── installation.md ├── images │ ├── breakpoint.png │ ├── debugger.png │ ├── foundry-banner.png │ ├── fuzzer.png │ ├── nft-tutorial │ │ ├── gas-report-oz-nft.png │ │ ├── gas-report-solmate-nft.png │ │ └── nft-tutorial-project-structure.png │ └── solidity-scripting │ │ ├── compile-successful.png │ │ ├── contract-verified.png │ │ └── set-up-commands.png ├── misc │ ├── README.md │ └── struct-encoding.md ├── output │ ├── README.md │ ├── cast │ │ ├── cast-4byte-decode │ │ └── cast-call │ ├── cheatcodes │ │ ├── forge-test-cheatcodes │ │ ├── forge-test-cheatcodes-expectrevert │ │ ├── forge-test-cheatcodes-tracing │ │ └── forge-test-simple │ ├── chisel │ │ └── help │ ├── clone_contract │ │ ├── clone-meta │ │ └── forge-clone │ ├── deps │ │ ├── forge-install │ │ ├── forge-remappings │ │ └── tree │ ├── forge_tree │ │ ├── forge-tree │ │ └── forge-tree-no-dedupe │ ├── foundry-template │ │ ├── forge-build │ │ ├── forge-install │ │ └── forge-test │ ├── fuzz_testing │ │ ├── forge-test-fail-fuzz │ │ ├── forge-test-no-fuzz │ │ └── forge-test-success-fuzz │ ├── hello_foundry │ │ ├── forge-build │ │ ├── forge-init │ │ ├── forge-test │ │ ├── tree │ │ └── tree-with-files │ ├── nft_tutorial │ │ └── forge-test │ └── test_filters │ │ ├── forge-test-match-contract-and-test │ │ └── forge-test-match-path ├── projects │ ├── clone-a-verified-contract.md │ ├── creating-a-new-project.md │ ├── dependencies.md │ ├── project-layout.md │ ├── soldeer.md │ └── working-on-an-existing-project.md ├── reference │ ├── README.md │ ├── anvil │ │ └── README.md │ ├── cast │ │ ├── README.md │ │ ├── abi-commands.md │ │ ├── account-commands.md │ │ ├── block-commands.md │ │ ├── cast-4byte-decode.md │ │ ├── cast-4byte-event.md │ │ ├── cast-4byte.md │ │ ├── cast-abi-decode.md │ │ ├── cast-abi-encode.md │ │ ├── cast-access-list.md │ │ ├── cast-address-zero.md │ │ ├── cast-age.md │ │ ├── cast-balance.md │ │ ├── cast-basefee.md │ │ ├── cast-block-number.md │ │ ├── cast-block.md │ │ ├── cast-call.md │ │ ├── cast-calldata-decode.md │ │ ├── cast-calldata.md │ │ ├── cast-chain-id.md │ │ ├── cast-chain.md │ │ ├── cast-client.md │ │ ├── cast-code.md │ │ ├── cast-codesize.md │ │ ├── cast-completions.md │ │ ├── cast-compute-address.md │ │ ├── cast-concat-hex.md │ │ ├── cast-create2.md │ │ ├── cast-estimate.md │ │ ├── cast-etherscan-source.md │ │ ├── cast-find-block.md │ │ ├── cast-format-bytes32-string.md │ │ ├── cast-from-bin.md │ │ ├── cast-from-fixed-point.md │ │ ├── cast-from-rlp.md │ │ ├── cast-from-utf8.md │ │ ├── cast-from-wei.md │ │ ├── cast-gas-price.md │ │ ├── cast-help.md │ │ ├── cast-index.md │ │ ├── cast-interface.md │ │ ├── cast-keccak.md │ │ ├── cast-logs.md │ │ ├── cast-lookup-address.md │ │ ├── cast-max-int.md │ │ ├── cast-max-uint.md │ │ ├── cast-min-int.md │ │ ├── cast-mktx.md │ │ ├── cast-namehash.md │ │ ├── cast-nonce.md │ │ ├── cast-parse-bytes32-address.md │ │ ├── cast-parse-bytes32-string.md │ │ ├── cast-pretty-calldata.md │ │ ├── cast-proof.md │ │ ├── cast-publish.md │ │ ├── cast-receipt.md │ │ ├── cast-resolve-name.md │ │ ├── cast-rpc.md │ │ ├── cast-run.md │ │ ├── cast-selectors.md │ │ ├── cast-send.md │ │ ├── cast-shl.md │ │ ├── cast-shr.md │ │ ├── cast-sig-event.md │ │ ├── cast-sig.md │ │ ├── cast-storage.md │ │ ├── cast-to-ascii.md │ │ ├── cast-to-base.md │ │ ├── cast-to-bytes32.md │ │ ├── cast-to-check-sum-address.md │ │ ├── cast-to-dec.md │ │ ├── cast-to-fixed-point.md │ │ ├── cast-to-hex.md │ │ ├── cast-to-hexdata.md │ │ ├── cast-to-int256.md │ │ ├── cast-to-rlp.md │ │ ├── cast-to-uint256.md │ │ ├── cast-to-unit.md │ │ ├── cast-to-wei.md │ │ ├── cast-tx.md │ │ ├── cast-upload-signature.md │ │ ├── cast-wallet-address.md │ │ ├── cast-wallet-import.md │ │ ├── cast-wallet-list.md │ │ ├── cast-wallet-new-mnemonic.md │ │ ├── cast-wallet-new.md │ │ ├── cast-wallet-sign.md │ │ ├── cast-wallet-vanity.md │ │ ├── cast-wallet-verify.md │ │ ├── cast-wallet.md │ │ ├── cast.md │ │ ├── chain-commands.md │ │ ├── common-options.md │ │ ├── conversion-commands.md │ │ ├── ens-commands.md │ │ ├── etherscan-commands.md │ │ ├── general-commands.md │ │ ├── sig-description.md │ │ ├── transaction-commands.md │ │ ├── utility-commands.md │ │ └── wallet-commands.md │ ├── chisel │ │ └── README.md │ ├── cli │ │ ├── README.md │ │ ├── SUMMARY.md │ │ ├── anvil.md │ │ ├── anvil │ │ │ ├── completions.md │ │ │ └── generate-fig-spec.md │ │ ├── cast.md │ │ ├── cast │ │ │ ├── 4byte-decode.md │ │ │ ├── 4byte-event.md │ │ │ ├── 4byte.md │ │ │ ├── abi-decode.md │ │ │ ├── abi-encode.md │ │ │ ├── access-list.md │ │ │ ├── address-zero.md │ │ │ ├── admin.md │ │ │ ├── age.md │ │ │ ├── balance.md │ │ │ ├── base-fee.md │ │ │ ├── bind.md │ │ │ ├── block-number.md │ │ │ ├── block.md │ │ │ ├── call.md │ │ │ ├── call │ │ │ │ └── --create.md │ │ │ ├── calldata-decode.md │ │ │ ├── calldata.md │ │ │ ├── chain-id.md │ │ │ ├── chain.md │ │ │ ├── client.md │ │ │ ├── code.md │ │ │ ├── codehash.md │ │ │ ├── codesize.md │ │ │ ├── completions.md │ │ │ ├── compute-address.md │ │ │ ├── concat-hex.md │ │ │ ├── create2.md │ │ │ ├── decode-eof.md │ │ │ ├── decode-transaction.md │ │ │ ├── disassemble.md │ │ │ ├── estimate.md │ │ │ ├── estimate │ │ │ │ └── --create.md │ │ │ ├── etherscan-source.md │ │ │ ├── find-block.md │ │ │ ├── format-bytes32-string.md │ │ │ ├── from-bin.md │ │ │ ├── from-fixed-point.md │ │ │ ├── from-rlp.md │ │ │ ├── from-utf8.md │ │ │ ├── from-wei.md │ │ │ ├── gas-price.md │ │ │ ├── generate-fig-spec.md │ │ │ ├── hash-message.md │ │ │ ├── hash-zero.md │ │ │ ├── implementation.md │ │ │ ├── index-erc7201.md │ │ │ ├── index.md │ │ │ ├── interface.md │ │ │ ├── keccak.md │ │ │ ├── logs.md │ │ │ ├── lookup-address.md │ │ │ ├── max-int.md │ │ │ ├── max-uint.md │ │ │ ├── min-int.md │ │ │ ├── mktx.md │ │ │ ├── mktx │ │ │ │ └── --create.md │ │ │ ├── namehash.md │ │ │ ├── nonce.md │ │ │ ├── parse-bytes32-address.md │ │ │ ├── parse-bytes32-string.md │ │ │ ├── pretty-calldata.md │ │ │ ├── proof.md │ │ │ ├── publish.md │ │ │ ├── receipt.md │ │ │ ├── resolve-name.md │ │ │ ├── rpc.md │ │ │ ├── run.md │ │ │ ├── selectors.md │ │ │ ├── send.md │ │ │ ├── send │ │ │ │ └── --create.md │ │ │ ├── shl.md │ │ │ ├── shr.md │ │ │ ├── sig-event.md │ │ │ ├── sig.md │ │ │ ├── storage-root.md │ │ │ ├── storage.md │ │ │ ├── to-ascii.md │ │ │ ├── to-base.md │ │ │ ├── to-bytes32.md │ │ │ ├── to-check-sum-address.md │ │ │ ├── to-dec.md │ │ │ ├── to-fixed-point.md │ │ │ ├── to-hex.md │ │ │ ├── to-hexdata.md │ │ │ ├── to-int256.md │ │ │ ├── to-rlp.md │ │ │ ├── to-uint256.md │ │ │ ├── to-unit.md │ │ │ ├── to-utf8.md │ │ │ ├── to-wei.md │ │ │ ├── tx.md │ │ │ ├── upload-signature.md │ │ │ ├── wallet.md │ │ │ └── wallet │ │ │ │ ├── address.md │ │ │ │ ├── decrypt-keystore.md │ │ │ │ ├── derive-private-key.md │ │ │ │ ├── import.md │ │ │ │ ├── list.md │ │ │ │ ├── new-mnemonic.md │ │ │ │ ├── new.md │ │ │ │ ├── private-key.md │ │ │ │ ├── sign-auth.md │ │ │ │ ├── sign.md │ │ │ │ ├── vanity.md │ │ │ │ └── verify.md │ │ ├── chisel.md │ │ ├── chisel │ │ │ ├── clear-cache.md │ │ │ ├── eval.md │ │ │ ├── list.md │ │ │ ├── load.md │ │ │ └── view.md │ │ ├── forge.md │ │ └── forge │ │ │ ├── bind-json.md │ │ │ ├── bind.md │ │ │ ├── build.md │ │ │ ├── cache.md │ │ │ ├── clean.md │ │ │ ├── clone.md │ │ │ ├── compiler.md │ │ │ ├── compiler │ │ │ └── resolve.md │ │ │ ├── completions.md │ │ │ ├── config.md │ │ │ ├── coverage.md │ │ │ ├── create.md │ │ │ ├── debug.md │ │ │ ├── doc.md │ │ │ ├── eip712.md │ │ │ ├── flatten.md │ │ │ ├── fmt.md │ │ │ ├── forge.md │ │ │ ├── geiger.md │ │ │ ├── generate-fig-spec.md │ │ │ ├── generate.md │ │ │ ├── generate │ │ │ └── test.md │ │ │ ├── init.md │ │ │ ├── inspect.md │ │ │ ├── install.md │ │ │ ├── remappings.md │ │ │ ├── remove.md │ │ │ ├── script.md │ │ │ ├── selectors.md │ │ │ ├── selectors │ │ │ ├── collision.md │ │ │ ├── find.md │ │ │ ├── list.md │ │ │ └── upload.md │ │ │ ├── snapshot.md │ │ │ ├── soldeer.md │ │ │ ├── soldeer │ │ │ ├── init.md │ │ │ ├── install.md │ │ │ ├── login.md │ │ │ ├── push.md │ │ │ ├── uninstall.md │ │ │ ├── update.md │ │ │ ├── version-dry-run.md │ │ │ └── version.md │ │ │ ├── test.md │ │ │ ├── tree.md │ │ │ ├── update.md │ │ │ ├── verify-bytecode.md │ │ │ ├── verify-check.md │ │ │ └── verify-contract.md │ ├── common │ │ ├── base-options.md │ │ ├── display-options.md │ │ ├── etherscan-options.md │ │ ├── multi-wallet-options-hardware.md │ │ ├── multi-wallet-options-keystore.md │ │ ├── multi-wallet-options-raw.md │ │ ├── multi-wallet-options-remote.md │ │ ├── multi-wallet-options.md │ │ ├── retry-options.md │ │ ├── rpc-options.md │ │ ├── rpc-url-option.md │ │ ├── transaction-options.md │ │ ├── tx-value-option.md │ │ ├── verifier-options.md │ │ ├── wallet-options-hardware.md │ │ ├── wallet-options-keystore.md │ │ ├── wallet-options-raw.md │ │ ├── wallet-options-remote.md │ │ └── wallet-options.md │ ├── config │ │ ├── README.md │ │ ├── doc-generator.md │ │ ├── etherscan.md │ │ ├── formatter.md │ │ ├── inline-test-config.md │ │ ├── overview.md │ │ ├── project.md │ │ ├── solidity-compiler.md │ │ └── testing.md │ ├── ds-test.md │ ├── forge-std │ │ ├── README.md │ │ ├── abs.md │ │ ├── arithmeticError.md │ │ ├── assertApproxEqAbs.md │ │ ├── assertApproxEqAbsDecimal.md │ │ ├── assertApproxEqRel.md │ │ ├── assertApproxEqRelDecimal.md │ │ ├── assertEq.md │ │ ├── assertEqDecimal.md │ │ ├── assertFalse.md │ │ ├── assertGe.md │ │ ├── assertGeDecimal.md │ │ ├── assertGt.md │ │ ├── assertGtDecimal.md │ │ ├── assertLe.md │ │ ├── assertLeDecimal.md │ │ ├── assertLt.md │ │ ├── assertLtDecimal.md │ │ ├── assertNotEq.md │ │ ├── assertNotEqDecimal.md │ │ ├── assertTrue.md │ │ ├── assertionError.md │ │ ├── assume-no-precompiles.md │ │ ├── assume-payable.md │ │ ├── bound.md │ │ ├── change-prank.md │ │ ├── checked_write.md │ │ ├── compute-create-address.md │ │ ├── console-log.md │ │ ├── deal.md │ │ ├── delta.md │ │ ├── deployCode.md │ │ ├── deployCodeTo.md │ │ ├── depth.md │ │ ├── derive-remember-key.md │ │ ├── divisionError.md │ │ ├── encodeStorageError.md │ │ ├── enumConversionError.md │ │ ├── fail.md │ │ ├── find.md │ │ ├── hoax.md │ │ ├── indexOOBError.md │ │ ├── make-addr-and-key.md │ │ ├── make-addr.md │ │ ├── memOverflowError.md │ │ ├── noGasMetering.md │ │ ├── percentDelta.md │ │ ├── popError.md │ │ ├── read.md │ │ ├── rewind.md │ │ ├── script-utils.md │ │ ├── sig.md │ │ ├── skip.md │ │ ├── startHoax.md │ │ ├── std-assertions.md │ │ ├── std-cheats.md │ │ ├── std-errors.md │ │ ├── std-logs.md │ │ ├── std-math.md │ │ ├── std-storage.md │ │ ├── target.md │ │ ├── with_key.md │ │ └── zeroVarError.md │ └── forge │ │ ├── README.md │ │ ├── build-commands.md │ │ ├── common-options.md │ │ ├── compiler-options.md │ │ ├── core-build-options.md │ │ ├── deploy-commands.md │ │ ├── evm-options.md │ │ ├── executor-options.md │ │ ├── forge-bind.md │ │ ├── forge-build.md │ │ ├── forge-cache-clean.md │ │ ├── forge-cache-ls.md │ │ ├── forge-cache.md │ │ ├── forge-clean.md │ │ ├── forge-clone.md │ │ ├── forge-completions.md │ │ ├── forge-config.md │ │ ├── forge-coverage.md │ │ ├── forge-create.md │ │ ├── forge-debug.md │ │ ├── forge-doc.md │ │ ├── forge-flatten.md │ │ ├── forge-geiger.md │ │ ├── forge-help.md │ │ ├── forge-init.md │ │ ├── forge-inspect.md │ │ ├── forge-install.md │ │ ├── forge-remappings.md │ │ ├── forge-remove.md │ │ ├── forge-script.md │ │ ├── forge-snapshot.md │ │ ├── forge-test.md │ │ ├── forge-tree.md │ │ ├── forge-update.md │ │ ├── forge-upload-selectors.md │ │ ├── forge-verify-check.md │ │ ├── forge-verify-contract.md │ │ ├── forge.md │ │ ├── general-commands.md │ │ ├── project-commands.md │ │ ├── project-options.md │ │ ├── test-commands.md │ │ ├── test-options.md │ │ ├── utility-commands.md │ │ └── watch-options.md ├── static │ ├── config.default.toml │ ├── custom.css │ └── solidity.min.js └── tutorials │ ├── best-practices.md │ ├── create2-tutorial.md │ ├── forking-mainnet-with-cast-anvil.md │ ├── foundry-docker.md │ ├── invariant-testing-bonding-curve.md │ ├── learn-foundry.md │ ├── solidity-scripting.md │ ├── solmate-nft.md │ └── testing-eip712.md ├── theme ├── card.png ├── favicon.png └── head.hbs └── translations ├── projects ├── README.md ├── cheatcodes │ ├── foundry.toml │ └── test │ │ ├── BlastMock.t.sol │ │ ├── EmitContract.t.sol │ │ └── OwnerUpOnly.t.sol ├── fuzz_testing │ ├── foundry.toml │ └── test │ │ ├── Safe.t.sol │ │ ├── Safe.t.sol.1 │ │ ├── Safe.t.sol.2 │ │ └── Safe.t.sol.3 ├── test_filters │ ├── foundry.toml │ └── test │ │ ├── ComplicatedContract.t.sol │ │ └── ContractB.t.sol └── writing_tests │ ├── foundry.toml │ └── test │ ├── Basic.t.sol │ └── Basic2.t.sol └── zh ├── README.md ├── SUMMARY.md ├── anvil ├── README.md └── anvil.png ├── cast └── README.md ├── cheatcodes ├── README.md ├── accesses.md ├── active-fork.md ├── addr.md ├── allow-cheatcodes.md ├── assertions.md ├── assume-no-revert.md ├── assume.md ├── breakpoint.md ├── broadcast.md ├── chain-id.md ├── clear-mocked-calls.md ├── coinbase.md ├── copy-storage.md ├── create-fork.md ├── create-select-fork.md ├── create-wallet.md ├── deal.md ├── derive-key.md ├── difficulty.md ├── env-address.md ├── env-bool.md ├── env-bytes.md ├── env-bytes32.md ├── env-int.md ├── env-or.md ├── env-string.md ├── env-uint.md ├── environment.md ├── etch.md ├── expect-call.md ├── expect-emit.md ├── expect-revert.md ├── external.md ├── fee.md ├── ffi.md ├── forking.md ├── fs.md ├── fuzzer.md ├── gas-snapshots.md ├── get-block-number.md ├── get-block-timestamp.md ├── get-code.md ├── get-deployed-code.md ├── get-label.md ├── get-nonce.md ├── get-recorded-logs.md ├── is-persistent.md ├── key-exists-json.md ├── key-exists-toml.md ├── key-exists.md ├── label.md ├── load.md ├── make-persistent.md ├── mock-call-revert.md ├── mock-call.md ├── mock-function.md ├── parse-address.md ├── parse-bool.md ├── parse-bytes.md ├── parse-bytes32.md ├── parse-int.md ├── parse-json-keys.md ├── parse-json.md ├── parse-toml-keys.md ├── parse-toml.md ├── parse-uint.md ├── pause-gas-metering.md ├── prank.md ├── prevrandao.md ├── project-root.md ├── prompt.md ├── read-callers.md ├── record-logs.md ├── record.md ├── remember-key.md ├── reset-gas-metering.md ├── resume-gas-metering.md ├── revoke-persistent.md ├── roll-fork.md ├── roll.md ├── rpc.md ├── select-fork.md ├── serialize-json.md ├── set-arbitrary-storage.md ├── set-env.md ├── set-nonce.md ├── sign.md ├── skip.md ├── sleep.md ├── start-broadcast.md ├── start-prank.md ├── start-state-diff-recording.md ├── state-snapshots.md ├── stop-and-return-state-diff.md ├── stop-broadcast.md ├── stop-prank.md ├── store.md ├── to-string.md ├── transact.md ├── tx-gas-price.md ├── unix-time.md ├── utilities.md ├── warp.md ├── write-json.md └── write-toml.md ├── chisel └── README.md ├── ci-cd └── github-actions.md ├── config ├── README.md ├── continous-integration.md ├── hardhat.md ├── shell-autocompletion.md ├── static-analyzers.md ├── vscode.md └── vyper.md ├── contributing.md ├── faq.md ├── forge ├── README.md ├── advanced-testing.md ├── cheatcodes.md ├── debugger.md ├── deploying.md ├── differential-ffi-testing.md ├── forge-std.md ├── fork-testing.md ├── fuzz-testing.md ├── gas-function-snapshots.md ├── gas-reports.md ├── gas-section-snapshots.md ├── gas-tracking.md ├── invariant-testing.md ├── replay-testing.md ├── tests.md ├── traces.md └── writing-tests.md ├── getting-started ├── first-steps.md └── installation.md ├── images ├── breakpoint.png ├── debugger.png ├── foundry-banner.png ├── fuzzer.png ├── nft-tutorial │ ├── gas-report-oz-nft.png │ ├── gas-report-solmate-nft.png │ └── nft-tutorial-project-structure.png └── solidity-scripting │ ├── compile-successful.png │ ├── contract-verified.png │ └── set-up-commands.png ├── misc ├── README.md └── struct-encoding.md ├── output ├── README.md ├── cast │ ├── cast-4byte-decode │ └── cast-call ├── cheatcodes │ ├── forge-test-cheatcodes │ ├── forge-test-cheatcodes-expectrevert │ ├── forge-test-cheatcodes-tracing │ └── forge-test-simple ├── chisel │ └── help ├── clone_contract │ ├── clone-meta │ └── forge-clone ├── deps │ ├── forge-install │ ├── forge-remappings │ └── tree ├── forge_tree │ ├── forge-tree │ └── forge-tree-no-dedupe ├── foundry-template │ ├── forge-build │ ├── forge-install │ └── forge-test ├── fuzz_testing │ ├── forge-test-fail-fuzz │ ├── forge-test-no-fuzz │ └── forge-test-success-fuzz ├── hello_foundry │ ├── forge-build │ ├── forge-init │ ├── forge-test │ ├── tree │ └── tree-with-files ├── nft_tutorial │ └── forge-test └── test_filters │ ├── forge-test-match-contract-and-test │ └── forge-test-match-path ├── projects ├── clone-a-verified-contract.md ├── creating-a-new-project.md ├── dependencies.md ├── project-layout.md ├── soldeer.md └── working-on-an-existing-project.md ├── reference ├── README.md ├── anvil │ └── README.md ├── cast │ ├── README.md │ ├── abi-commands.md │ ├── account-commands.md │ ├── block-commands.md │ ├── cast-4byte-decode.md │ ├── cast-4byte-event.md │ ├── cast-4byte.md │ ├── cast-abi-decode.md │ ├── cast-abi-encode.md │ ├── cast-access-list.md │ ├── cast-address-zero.md │ ├── cast-age.md │ ├── cast-balance.md │ ├── cast-basefee.md │ ├── cast-block-number.md │ ├── cast-block.md │ ├── cast-call.md │ ├── cast-calldata-decode.md │ ├── cast-calldata.md │ ├── cast-chain-id.md │ ├── cast-chain.md │ ├── cast-client.md │ ├── cast-code.md │ ├── cast-codesize.md │ ├── cast-completions.md │ ├── cast-compute-address.md │ ├── cast-concat-hex.md │ ├── cast-create2.md │ ├── cast-estimate.md │ ├── cast-etherscan-source.md │ ├── cast-find-block.md │ ├── cast-format-bytes32-string.md │ ├── cast-from-bin.md │ ├── cast-from-fixed-point.md │ ├── cast-from-rlp.md │ ├── cast-from-utf8.md │ ├── cast-from-wei.md │ ├── cast-gas-price.md │ ├── cast-help.md │ ├── cast-index.md │ ├── cast-interface.md │ ├── cast-keccak.md │ ├── cast-logs.md │ ├── cast-lookup-address.md │ ├── cast-max-int.md │ ├── cast-max-uint.md │ ├── cast-min-int.md │ ├── cast-mktx.md │ ├── cast-namehash.md │ ├── cast-nonce.md │ ├── cast-parse-bytes32-address.md │ ├── cast-parse-bytes32-string.md │ ├── cast-pretty-calldata.md │ ├── cast-proof.md │ ├── cast-publish.md │ ├── cast-receipt.md │ ├── cast-resolve-name.md │ ├── cast-rpc.md │ ├── cast-run.md │ ├── cast-selectors.md │ ├── cast-send.md │ ├── cast-shl.md │ ├── cast-shr.md │ ├── cast-sig-event.md │ ├── cast-sig.md │ ├── cast-storage.md │ ├── cast-to-ascii.md │ ├── cast-to-base.md │ ├── cast-to-bytes32.md │ ├── cast-to-check-sum-address.md │ ├── cast-to-dec.md │ ├── cast-to-fixed-point.md │ ├── cast-to-hex.md │ ├── cast-to-hexdata.md │ ├── cast-to-int256.md │ ├── cast-to-rlp.md │ ├── cast-to-uint256.md │ ├── cast-to-unit.md │ ├── cast-to-wei.md │ ├── cast-tx.md │ ├── cast-upload-signature.md │ ├── cast-wallet-address.md │ ├── cast-wallet-import.md │ ├── cast-wallet-list.md │ ├── cast-wallet-new-mnemonic.md │ ├── cast-wallet-new.md │ ├── cast-wallet-sign.md │ ├── cast-wallet-vanity.md │ ├── cast-wallet-verify.md │ ├── cast-wallet.md │ ├── cast.md │ ├── chain-commands.md │ ├── common-options.md │ ├── conversion-commands.md │ ├── ens-commands.md │ ├── etherscan-commands.md │ ├── general-commands.md │ ├── sig-description.md │ ├── transaction-commands.md │ ├── utility-commands.md │ └── wallet-commands.md ├── chisel │ └── README.md ├── cli │ ├── README.md │ ├── SUMMARY.md │ ├── anvil.md │ ├── anvil │ │ ├── completions.md │ │ └── generate-fig-spec.md │ ├── cast.md │ ├── cast │ │ ├── 4byte-decode.md │ │ ├── 4byte-event.md │ │ ├── 4byte.md │ │ ├── abi-decode.md │ │ ├── abi-encode.md │ │ ├── access-list.md │ │ ├── address-zero.md │ │ ├── admin.md │ │ ├── age.md │ │ ├── balance.md │ │ ├── base-fee.md │ │ ├── bind.md │ │ ├── block-number.md │ │ ├── block.md │ │ ├── call.md │ │ ├── call │ │ │ └── --create.md │ │ ├── calldata-decode.md │ │ ├── calldata.md │ │ ├── chain-id.md │ │ ├── chain.md │ │ ├── client.md │ │ ├── code.md │ │ ├── codehash.md │ │ ├── codesize.md │ │ ├── completions.md │ │ ├── compute-address.md │ │ ├── concat-hex.md │ │ ├── create2.md │ │ ├── decode-eof.md │ │ ├── decode-transaction.md │ │ ├── disassemble.md │ │ ├── estimate.md │ │ ├── estimate │ │ │ └── --create.md │ │ ├── etherscan-source.md │ │ ├── find-block.md │ │ ├── format-bytes32-string.md │ │ ├── from-bin.md │ │ ├── from-fixed-point.md │ │ ├── from-rlp.md │ │ ├── from-utf8.md │ │ ├── from-wei.md │ │ ├── gas-price.md │ │ ├── generate-fig-spec.md │ │ ├── hash-message.md │ │ ├── hash-zero.md │ │ ├── implementation.md │ │ ├── index-erc7201.md │ │ ├── index.md │ │ ├── interface.md │ │ ├── keccak.md │ │ ├── logs.md │ │ ├── lookup-address.md │ │ ├── max-int.md │ │ ├── max-uint.md │ │ ├── min-int.md │ │ ├── mktx.md │ │ ├── mktx │ │ │ └── --create.md │ │ ├── namehash.md │ │ ├── nonce.md │ │ ├── parse-bytes32-address.md │ │ ├── parse-bytes32-string.md │ │ ├── pretty-calldata.md │ │ ├── proof.md │ │ ├── publish.md │ │ ├── receipt.md │ │ ├── resolve-name.md │ │ ├── rpc.md │ │ ├── run.md │ │ ├── selectors.md │ │ ├── send.md │ │ ├── send │ │ │ └── --create.md │ │ ├── shl.md │ │ ├── shr.md │ │ ├── sig-event.md │ │ ├── sig.md │ │ ├── storage-root.md │ │ ├── storage.md │ │ ├── to-ascii.md │ │ ├── to-base.md │ │ ├── to-bytes32.md │ │ ├── to-check-sum-address.md │ │ ├── to-dec.md │ │ ├── to-fixed-point.md │ │ ├── to-hex.md │ │ ├── to-hexdata.md │ │ ├── to-int256.md │ │ ├── to-rlp.md │ │ ├── to-uint256.md │ │ ├── to-unit.md │ │ ├── to-utf8.md │ │ ├── to-wei.md │ │ ├── tx.md │ │ ├── upload-signature.md │ │ ├── wallet.md │ │ └── wallet │ │ │ ├── address.md │ │ │ ├── decrypt-keystore.md │ │ │ ├── derive-private-key.md │ │ │ ├── import.md │ │ │ ├── list.md │ │ │ ├── new-mnemonic.md │ │ │ ├── new.md │ │ │ ├── private-key.md │ │ │ ├── sign-auth.md │ │ │ ├── sign.md │ │ │ ├── vanity.md │ │ │ └── verify.md │ ├── chisel.md │ ├── chisel │ │ ├── clear-cache.md │ │ ├── eval.md │ │ ├── list.md │ │ ├── load.md │ │ └── view.md │ ├── forge.md │ └── forge │ │ ├── bind-json.md │ │ ├── bind.md │ │ ├── build.md │ │ ├── cache.md │ │ ├── clean.md │ │ ├── clone.md │ │ ├── compiler.md │ │ ├── compiler │ │ └── resolve.md │ │ ├── completions.md │ │ ├── config.md │ │ ├── coverage.md │ │ ├── create.md │ │ ├── debug.md │ │ ├── doc.md │ │ ├── eip712.md │ │ ├── flatten.md │ │ ├── fmt.md │ │ ├── forge.md │ │ ├── geiger.md │ │ ├── generate-fig-spec.md │ │ ├── generate.md │ │ ├── generate │ │ └── test.md │ │ ├── init.md │ │ ├── inspect.md │ │ ├── install.md │ │ ├── remappings.md │ │ ├── remove.md │ │ ├── script.md │ │ ├── selectors.md │ │ ├── selectors │ │ ├── collision.md │ │ ├── find.md │ │ ├── list.md │ │ └── upload.md │ │ ├── snapshot.md │ │ ├── soldeer.md │ │ ├── soldeer │ │ ├── init.md │ │ ├── install.md │ │ ├── login.md │ │ ├── push.md │ │ ├── uninstall.md │ │ ├── update.md │ │ ├── version-dry-run.md │ │ └── version.md │ │ ├── test.md │ │ ├── tree.md │ │ ├── update.md │ │ ├── verify-bytecode.md │ │ ├── verify-check.md │ │ └── verify-contract.md ├── common │ ├── base-options.md │ ├── display-options.md │ ├── etherscan-options.md │ ├── multi-wallet-options-hardware.md │ ├── multi-wallet-options-keystore.md │ ├── multi-wallet-options-raw.md │ ├── multi-wallet-options-remote.md │ ├── multi-wallet-options.md │ ├── retry-options.md │ ├── rpc-options.md │ ├── rpc-url-option.md │ ├── transaction-options.md │ ├── tx-value-option.md │ ├── verifier-options.md │ ├── wallet-options-hardware.md │ ├── wallet-options-keystore.md │ ├── wallet-options-raw.md │ ├── wallet-options-remote.md │ └── wallet-options.md ├── config │ ├── README.md │ ├── doc-generator.md │ ├── etherscan.md │ ├── formatter.md │ ├── inline-test-config.md │ ├── overview.md │ ├── project.md │ ├── solidity-compiler.md │ └── testing.md ├── ds-test.md ├── forge-std │ ├── README.md │ ├── abs.md │ ├── arithmeticError.md │ ├── assertApproxEqAbs.md │ ├── assertApproxEqAbsDecimal.md │ ├── assertApproxEqRel.md │ ├── assertApproxEqRelDecimal.md │ ├── assertEq.md │ ├── assertEqDecimal.md │ ├── assertFalse.md │ ├── assertGe.md │ ├── assertGeDecimal.md │ ├── assertGt.md │ ├── assertGtDecimal.md │ ├── assertLe.md │ ├── assertLeDecimal.md │ ├── assertLt.md │ ├── assertLtDecimal.md │ ├── assertNotEq.md │ ├── assertNotEqDecimal.md │ ├── assertTrue.md │ ├── assertionError.md │ ├── assume-no-precompiles.md │ ├── assume-payable.md │ ├── bound.md │ ├── change-prank.md │ ├── checked_write.md │ ├── compute-create-address.md │ ├── console-log.md │ ├── deal.md │ ├── delta.md │ ├── deployCode.md │ ├── deployCodeTo.md │ ├── depth.md │ ├── derive-remember-key.md │ ├── divisionError.md │ ├── encodeStorageError.md │ ├── enumConversionError.md │ ├── fail.md │ ├── find.md │ ├── hoax.md │ ├── indexOOBError.md │ ├── make-addr-and-key.md │ ├── make-addr.md │ ├── memOverflowError.md │ ├── noGasMetering.md │ ├── percentDelta.md │ ├── popError.md │ ├── read.md │ ├── rewind.md │ ├── script-utils.md │ ├── sig.md │ ├── skip.md │ ├── startHoax.md │ ├── std-assertions.md │ ├── std-cheats.md │ ├── std-errors.md │ ├── std-logs.md │ ├── std-math.md │ ├── std-storage.md │ ├── target.md │ ├── with_key.md │ └── zeroVarError.md └── forge │ ├── README.md │ ├── build-commands.md │ ├── common-options.md │ ├── compiler-options.md │ ├── core-build-options.md │ ├── deploy-commands.md │ ├── evm-options.md │ ├── executor-options.md │ ├── forge-bind.md │ ├── forge-build.md │ ├── forge-cache-clean.md │ ├── forge-cache-ls.md │ ├── forge-cache.md │ ├── forge-clean.md │ ├── forge-clone.md │ ├── forge-completions.md │ ├── forge-config.md │ ├── forge-coverage.md │ ├── forge-create.md │ ├── forge-debug.md │ ├── forge-doc.md │ ├── forge-flatten.md │ ├── forge-geiger.md │ ├── forge-help.md │ ├── forge-init.md │ ├── forge-inspect.md │ ├── forge-install.md │ ├── forge-remappings.md │ ├── forge-remove.md │ ├── forge-script.md │ ├── forge-snapshot.md │ ├── forge-test.md │ ├── forge-tree.md │ ├── forge-update.md │ ├── forge-upload-selectors.md │ ├── forge-verify-check.md │ ├── forge-verify-contract.md │ ├── forge.md │ ├── general-commands.md │ ├── project-commands.md │ ├── project-options.md │ ├── test-commands.md │ ├── test-options.md │ ├── utility-commands.md │ └── watch-options.md ├── static ├── config.default.toml ├── custom.css └── solidity.min.js └── tutorials ├── best-practices.md ├── create2-tutorial.md ├── forking-mainnet-with-cast-anvil.md ├── foundry-docker.md ├── invariant-testing-bonding-curve.md ├── learn-foundry.md ├── solidity-scripting.md ├── solmate-nft.md └── testing-eip712.md /.github/workflows/project.yml: -------------------------------------------------------------------------------- 1 | name: project 2 | on: 3 | issues: 4 | types: [opened, transferred] 5 | 6 | jobs: 7 | add-to-project: 8 | name: add issue 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/add-to-project@main 12 | with: 13 | project-url: https://github.com/orgs/foundry-rs/projects/1 14 | github-token: ${{ secrets.GH_PROJECTS_TOKEN }} 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | book 2 | out 3 | cache 4 | .idea -------------------------------------------------------------------------------- /projects/README.md: -------------------------------------------------------------------------------- 1 | ## Projects 2 | 3 | These projects are used to auto-generate CLI output, and for source snippets, throughout the book. 4 | -------------------------------------------------------------------------------- /projects/cheatcodes/foundry.toml: -------------------------------------------------------------------------------- 1 | [profile.default] 2 | src = 'src' 3 | out = 'out' 4 | libs = ['lib'] 5 | 6 | # See more config options https://github.com/gakonst/foundry/tree/master/config -------------------------------------------------------------------------------- /projects/fuzz_testing/foundry.toml: -------------------------------------------------------------------------------- 1 | [profile.default] 2 | src = 'src' 3 | out = 'out' 4 | libs = ['lib'] 5 | 6 | # See more config options https://github.com/gakonst/foundry/tree/master/config -------------------------------------------------------------------------------- /projects/test_filters/foundry.toml: -------------------------------------------------------------------------------- 1 | [profile.default] 2 | src = 'src' 3 | out = 'out' 4 | libs = ['lib'] 5 | 6 | # See more config options https://github.com/gakonst/foundry/tree/master/config -------------------------------------------------------------------------------- /projects/test_filters/test/ComplicatedContract.t.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: UNLICENSED 2 | pragma solidity 0.8.10; 3 | 4 | import {Test} from "forge-std/Test.sol"; 5 | 6 | contract ComplicatedContractTest is Test { 7 | function test_DepositERC20() public pure { 8 | // waste some gas for display purposes 9 | for (uint256 i = 1000; i > 0; i--) {} 10 | } 11 | 12 | function test_DepositETH() public pure { 13 | // waste some gas for display purposes 14 | for (uint256 i = 600; i > 0; i--) {} 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /projects/test_filters/test/ContractB.t.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: UNLICENSED 2 | pragma solidity 0.8.10; 3 | 4 | import {Test} from "forge-std/Test.sol"; 5 | 6 | contract ContractBTest is Test { 7 | function testExample() public { 8 | assertTrue(true); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /projects/writing_tests/foundry.toml: -------------------------------------------------------------------------------- 1 | [profile.default] 2 | src = 'src' 3 | out = 'out' 4 | libs = ['lib'] 5 | 6 | # See more config options https://github.com/gakonst/foundry/tree/master/config -------------------------------------------------------------------------------- /scripts/gen_output.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eo pipefail 3 | 4 | source "$(dirname "$0")/common" 5 | 6 | source "$SCRIPTS/gen_output/cast.sh" 7 | source "$SCRIPTS/gen_output/chisel.sh" 8 | source "$SCRIPTS/gen_output/forge.sh" 9 | source "$SCRIPTS/gen_output/help.sh" 10 | 11 | need_cmd git 12 | need_cmd mktemp 13 | need_cmd sed 14 | 15 | need_cmd forge 16 | need_cmd cast 17 | need_cmd anvil 18 | need_cmd chisel 19 | 20 | gen_help 21 | gen_cast 22 | gen_chisel 23 | gen_forge 24 | -------------------------------------------------------------------------------- /scripts/gen_output/chisel.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eo pipefail 3 | 4 | gen_chisel() { 5 | need_cmd chisel 6 | 7 | echo "Generating output (chisel)..." 8 | 9 | print_anchored \ 10 | "echo '!help' | chisel" \ 11 | "$(echo '!help' | chisel | escape_colors)" \ 12 | > "$OUTPUT_DIR/chisel/help" 13 | 14 | echo OK. 15 | } 16 | -------------------------------------------------------------------------------- /scripts/gen_output/help.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eo pipefail 3 | 4 | gen_help() { 5 | bins=(forge cast anvil chisel) 6 | for bin in "${bins[@]}"; do 7 | need_cmd "$bin" 8 | echo "Generating help output ($bin)..." 9 | done 10 | 11 | cmd=( 12 | "$SCRIPTS/gen_output/help.rs" 13 | --root-dir "$ROOT/src/" 14 | --root-summary 15 | --root-indentation 4 16 | --readme 17 | --verbose 18 | --out-dir "$ROOT/src/reference/cli/" 19 | "${bins[@]}" 20 | ) 21 | echo "Running: $" "${cmd[*]}" 22 | "${cmd[@]}" 23 | } 24 | -------------------------------------------------------------------------------- /src/anvil/anvil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/src/anvil/anvil.png -------------------------------------------------------------------------------- /src/cheatcodes/addr.md: -------------------------------------------------------------------------------- 1 | ## `addr` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function addr(uint256 privateKey) external returns (address); 7 | ``` 8 | 9 | ### Description 10 | 11 | Computes the address for a given private key. 12 | 13 | ### Examples 14 | 15 | ```solidity 16 | address alice = vm.addr(1); 17 | emit log_address(alice); // 0x7e5f4552091a69125d5dfcb7b8c2659029395bdf 18 | ``` 19 | -------------------------------------------------------------------------------- /src/cheatcodes/assertions.md: -------------------------------------------------------------------------------- 1 | ## Assertions 2 | 3 | - [`expectRevert`](./expect-revert.md) 4 | - [`expectEmit`](./expect-emit.md) 5 | - [`expectCall`](./expect-call.md) 6 | -------------------------------------------------------------------------------- /src/cheatcodes/chain-id.md: -------------------------------------------------------------------------------- 1 | ## `chainId` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function chainId(uint256) external; 7 | ``` 8 | 9 | ### Description 10 | 11 | Sets `block.chainid`. 12 | 13 | ### Examples 14 | 15 | ```solidity 16 | vm.chainId(31337); 17 | emit log_uint(block.chainid); // 31337 18 | ``` 19 | -------------------------------------------------------------------------------- /src/cheatcodes/clear-mocked-calls.md: -------------------------------------------------------------------------------- 1 | ## `clearMockedCalls` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function clearMockedCalls() external; 7 | ``` 8 | 9 | ### Description 10 | 11 | Clears all [mocked calls](./mock-call.md). 12 | -------------------------------------------------------------------------------- /src/cheatcodes/coinbase.md: -------------------------------------------------------------------------------- 1 | ## `coinbase` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function coinbase(address) external; 7 | ``` 8 | 9 | ### Description 10 | 11 | Sets `block.coinbase`. 12 | 13 | ### Examples 14 | 15 | ```solidity 16 | emit log_address(block.coinbase); // 0x0000000000000000000000000000000000000000 17 | vm.coinbase(0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8); 18 | emit log_address(block.coinbase); // 0xea674fdde714fd979de3edf0f56aa9716b898ec8 19 | ``` -------------------------------------------------------------------------------- /src/cheatcodes/difficulty.md: -------------------------------------------------------------------------------- 1 | ## `difficulty` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function difficulty(uint256) external; 7 | ``` 8 | 9 | ### Description 10 | 11 | Sets `block.difficulty`. 12 | 13 | If used with a post-merge EVM version (Paris and onwards), it will revert. In that case, use [`vm.prevrandao`][prevrandao] instead. 14 | 15 | ### Examples 16 | 17 | ```solidity 18 | vm.difficulty(25); 19 | emit log_uint(block.difficulty); // 25 20 | ``` 21 | 22 | 23 | [prevrandao]: ./prevrandao.md -------------------------------------------------------------------------------- /src/cheatcodes/fee.md: -------------------------------------------------------------------------------- 1 | ## `fee` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function fee(uint256) external; 7 | ``` 8 | 9 | ### Description 10 | 11 | Sets `block.basefee`. 12 | 13 | ### Examples 14 | 15 | ```solidity 16 | vm.fee(25 gwei); 17 | emit log_uint(block.basefee); // 25000000000 18 | ``` 19 | -------------------------------------------------------------------------------- /src/cheatcodes/forking.md: -------------------------------------------------------------------------------- 1 | ## Forking 2 | 3 | - [`createFork`](./create-fork.md) 4 | - [`selectFork`](./select-fork.md) 5 | - [`createSelectFork`](./create-select-fork.md) 6 | - [`activeFork`](./active-fork.md) 7 | - [`rollFork`](./roll-fork.md) 8 | - [`makePersistent`](./make-persistent.md) 9 | - [`revokePersistent`](./revoke-persistent.md) 10 | - [`isPersistent`](./is-persistent.md) 11 | - [`allowCheatcodes`](./allow-cheatcodes.md) 12 | - [`transact`](./transact.md) 13 | -------------------------------------------------------------------------------- /src/cheatcodes/fuzzer.md: -------------------------------------------------------------------------------- 1 | ## Fuzzer 2 | 3 | - [`assume`](./assume.md) 4 | - [`assumeNoRevert`](./assume-no-revert.md) 5 | -------------------------------------------------------------------------------- /src/cheatcodes/get-label.md: -------------------------------------------------------------------------------- 1 | ## `getLabel` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function getLabel(address) external returns (string memory); 7 | ``` 8 | 9 | ### Description 10 | 11 | Retrieves the label for an address if it was previously labeled. If not, it returns the address prefixed with `unlabeled:`. 12 | -------------------------------------------------------------------------------- /src/cheatcodes/key-exists-json.md: -------------------------------------------------------------------------------- 1 | ## `keyExistsJson` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | // Check if a key exists in a JSON string. 7 | vm.keyExistsJson(string memory json, string memory key) returns (bool) 8 | ``` 9 | 10 | ### Description 11 | 12 | Checks if a key exists in a JSON string. 13 | 14 | ### Examples 15 | 16 | ```solidity 17 | string memory path = "./path/to/jsonfile.json"; 18 | string memory json = vm.readFile(path); 19 | bool exists = vm.keyExistsJson(json, ".key"); 20 | assertTrue(exists); 21 | ``` 22 | -------------------------------------------------------------------------------- /src/cheatcodes/key-exists-toml.md: -------------------------------------------------------------------------------- 1 | ## `keyExistsToml` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | // Check if a key exists in a TOML table. 7 | vm.keyExistsToml(string memory toml, string memory key) returns (bool) 8 | ``` 9 | 10 | ### Description 11 | 12 | Checks if a key exists in a TOML table. 13 | 14 | ### Examples 15 | 16 | ```solidity 17 | string memory path = "./path/to/tomlfile.toml"; 18 | string memory toml = vm.readFile(path); 19 | bool exists = vm.keyExistsToml(toml, ".key"); 20 | assertTrue(exists); 21 | ``` 22 | -------------------------------------------------------------------------------- /src/cheatcodes/label.md: -------------------------------------------------------------------------------- 1 | ## `label` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function label(address addr, string calldata label) external; 7 | ``` 8 | 9 | ### Description 10 | 11 | Sets a label `label` for `addr` in test traces. 12 | 13 | If an address is labelled, the label will show up in test traces instead of the address. 14 | -------------------------------------------------------------------------------- /src/cheatcodes/parse-address.md: -------------------------------------------------------------------------------- 1 | ## `parseAddress` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function parseAddress(string calldata stringifiedValue) external pure returns (address parsedValue); 7 | ``` 8 | 9 | ### Description 10 | 11 | Parses the value of `string` into `address` 12 | 13 | ### Examples 14 | 15 | ```solidity 16 | string memory addressAsString = "0x0000000000000000000000000000000000000000"; 17 | address stringToAddress = vm.parseAddress(addressAsString); // 0x0000000000000000000000000000000000000000 18 | ``` 19 | -------------------------------------------------------------------------------- /src/cheatcodes/parse-bool.md: -------------------------------------------------------------------------------- 1 | ## `parseBool` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function parseBool(string calldata stringifiedValue) external pure returns (bool parsedValue); 7 | ``` 8 | 9 | ### Description 10 | 11 | Parses the value of `string` into `bool` 12 | 13 | ### Examples 14 | 15 | ```solidity 16 | string memory boolAsString = "false"; 17 | bool stringToBool = vm.parseBool(boolAsString); // false 18 | ``` 19 | -------------------------------------------------------------------------------- /src/cheatcodes/parse-bytes.md: -------------------------------------------------------------------------------- 1 | ## `parseBytes` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function parseBytes(string calldata stringifiedValue) external pure returns (bytes memory parsedValue); 7 | ``` 8 | 9 | ### Description 10 | 11 | Parses the value of `string` into `bytes` 12 | 13 | ### Examples 14 | 15 | ```solidity 16 | string memory bytesAsString = "0x00000000000000000000000000000000"; 17 | bytes memory stringToBytes = vm.parseBytes(bytesAsString); // 0x00000000000000000000000000000000 18 | 19 | ``` 20 | 21 | -------------------------------------------------------------------------------- /src/cheatcodes/parse-int.md: -------------------------------------------------------------------------------- 1 | ## `parseInt` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function parseInt(string calldata stringifiedValue) external pure returns (int256 parsedValue); 7 | ``` 8 | 9 | ### Description 10 | 11 | Parses the value of `string` into `int256` 12 | 13 | ### Examples 14 | 15 | ```solidity 16 | string memory intAsString = "-12345"; 17 | int256 stringToInt = vm.parseInt(intAsString); // -12345 18 | ``` 19 | -------------------------------------------------------------------------------- /src/cheatcodes/parse-uint.md: -------------------------------------------------------------------------------- 1 | ## `parseUint` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function parseUint(string calldata stringifiedValue) external pure returns (uint256 parsedValue); 7 | ``` 8 | 9 | ### Description 10 | 11 | Parses the value of `string` into `uint256` 12 | 13 | ### Examples 14 | 15 | ```solidity 16 | string memory uintAsString = "12345"; 17 | uint256 stringToUint = vm.parseUint(uintAsString); // 12345 18 | ``` 19 | -------------------------------------------------------------------------------- /src/cheatcodes/prevrandao.md: -------------------------------------------------------------------------------- 1 | ## `prevrandao` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function prevrandao(bytes32) external; 7 | ``` 8 | 9 | ### Description 10 | 11 | Sets `block.prevrandao`. 12 | 13 | If used with an EVM version previous to the Paris hard fork, it will revert. In that case, use [`vm.difficulty`][prevrandao] instead. 14 | 15 | ### Examples 16 | 17 | ```solidity 18 | vm.prevrandao(bytes32(uint256(42))); 19 | emit log_uint(block.prevrandao); // 42 20 | ``` 21 | 22 | 23 | [prevrandao]: ./difficulty.md -------------------------------------------------------------------------------- /src/cheatcodes/project-root.md: -------------------------------------------------------------------------------- 1 | ## `projectRoot` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function projectRoot() external returns (string memory); 7 | ``` 8 | 9 | ### Description 10 | 11 | Returns the root directory of the current Foundry project. 12 | -------------------------------------------------------------------------------- /src/cheatcodes/reset-gas-metering.md: -------------------------------------------------------------------------------- 1 | ## `resetGasMetering` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function resetGasMetering() external; 7 | ``` 8 | 9 | ### Description 10 | 11 | Resets gas metering to the gas limit of current execution frame (i.e. `gasleft()` will be restored to initial value). 12 | -------------------------------------------------------------------------------- /src/cheatcodes/resume-gas-metering.md: -------------------------------------------------------------------------------- 1 | ## `resumeGasMetering` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function resumeGasMetering() external; 7 | ``` 8 | 9 | ### Description 10 | 11 | Resumes gas metering (i.e. `gasleft()` will decrease as operations are executed). Gas usage will resume at the same amount at which it was paused. -------------------------------------------------------------------------------- /src/cheatcodes/roll.md: -------------------------------------------------------------------------------- 1 | ## `roll` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function roll(uint256) external; 7 | ``` 8 | 9 | ### Description 10 | 11 | Sets `block.number`. 12 | 13 | ### Examples 14 | 15 | ```solidity 16 | vm.roll(100); 17 | emit log_uint(block.number); // 100 18 | ``` 19 | 20 | ### SEE ALSO 21 | 22 | - [rollFork](./roll-fork.md) 23 | -------------------------------------------------------------------------------- /src/cheatcodes/set-nonce.md: -------------------------------------------------------------------------------- 1 | ## `setNonce` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function setNonce(address account, uint64 nonce) external; 7 | ``` 8 | 9 | ### Description 10 | 11 | Sets the nonce of the given account. 12 | 13 | The new nonce must be higher than the current nonce of the account. 14 | 15 | ### Examples 16 | 17 | ```solidity 18 | vm.setNonce(address(100), 1234); 19 | ``` 20 | -------------------------------------------------------------------------------- /src/cheatcodes/sleep.md: -------------------------------------------------------------------------------- 1 | ## `sleep` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function sleep(uint256 milliseconds) external; 7 | ``` 8 | 9 | ### Description 10 | 11 | Sleeps for a given amount of milliseconds. 12 | 13 | ### Examples 14 | 15 | ```solidity 16 | vm.sleep(10_000); // Halts execution for 10 seconds 17 | ``` 18 | 19 | -------------------------------------------------------------------------------- /src/cheatcodes/start-state-diff-recording.md: -------------------------------------------------------------------------------- 1 | ## `startStateDiffRecording` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function startStateDiffRecording() 7 | ``` 8 | 9 | ### Description 10 | 11 | Records all state changes as part of CREATE, CALL or SELFDESTRUCT opcodes in order, 12 | along with the context of the calls. 13 | Refer to [`stopAndReturnStateDiff`](./stop-and-return-state-diff.md) for more details on how to access and interpret the recorded state changes. -------------------------------------------------------------------------------- /src/cheatcodes/stop-prank.md: -------------------------------------------------------------------------------- 1 | ## `stopPrank` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function stopPrank() external; 7 | ``` 8 | 9 | ### Description 10 | 11 | Stops an active prank started by [`startPrank`](./start-prank.md), resetting `msg.sender` and `tx.origin` to the values before `startPrank` was called. 12 | -------------------------------------------------------------------------------- /src/cheatcodes/unix-time.md: -------------------------------------------------------------------------------- 1 | ## `unixTime` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function unixTime() external returns (uint milliseconds); 7 | ``` 8 | 9 | ### Description 10 | 11 | Returns the time since unix epoch in milliseconds. 12 | 13 | ### Examples 14 | 15 | ```solidity 16 | uint start = vm.unixTime(); 17 | vm.sleep(10_000); // Halts execution for 10 seconds 18 | uint end = vm.unixTime(); 19 | assertEq(end - start, 10_000); 20 | ``` 21 | 22 | -------------------------------------------------------------------------------- /src/cheatcodes/utilities.md: -------------------------------------------------------------------------------- 1 | ## Utilities 2 | 3 | - [`addr`](./addr.md) 4 | - [`sign`](./sign.md) 5 | - [`label`](./label.md) 6 | - [`getLabel`](./get-label.md) 7 | - [`deriveKey`](./derive-key.md) 8 | - [`rememberKey`](./remember-key.md) 9 | - [`toString`](./to-string.md) 10 | - [`breakpoint`](./breakpoint.md) 11 | - [`createWallet`](./create-wallet.md) 12 | - [`copyStorage`](./copy-storage.md) 13 | - [`setArbitraryStorage`](./set-arbitrary-storage.md) 14 | -------------------------------------------------------------------------------- /src/cheatcodes/warp.md: -------------------------------------------------------------------------------- 1 | ## `warp` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function warp(uint256) external; 7 | ``` 8 | 9 | ### Description 10 | 11 | Sets `block.timestamp`. 12 | 13 | ### Examples 14 | 15 | ```solidity 16 | vm.warp(1641070800); 17 | emit log_uint(block.timestamp); // 1641070800 18 | ``` 19 | 20 | ### SEE ALSO 21 | 22 | Forge Standard Library 23 | 24 | [`skip`](../reference/forge-std/skip.md), [`rewind`](../reference/forge-std/rewind.md) -------------------------------------------------------------------------------- /src/forge/README.md: -------------------------------------------------------------------------------- 1 | ## Overview of Forge 2 | 3 | Forge is a command-line tool that ships with Foundry. Forge tests, builds, and deploys your smart contracts. 4 | -------------------------------------------------------------------------------- /src/forge/advanced-testing.md: -------------------------------------------------------------------------------- 1 | ## Advanced Testing 2 | 3 | Forge comes with a number of advanced testing methods: 4 | 5 | - [Fuzz Testing](./fuzz-testing.md) 6 | - [Invariant Testing](./invariant-testing.md) 7 | - [Differential Testing](./differential-ffi-testing.md) 8 | 9 | In the future, Forge will also support these: 10 | 11 | - [Symbolic Execution](#) 12 | - [Mutation Testing](#) 13 | 14 | Each chapter dives into what problem the testing methods solve, and how to apply them to your own project. 15 | -------------------------------------------------------------------------------- /src/forge/gas-section-snapshots.md: -------------------------------------------------------------------------------- 1 | # Gas Section Snapshots 2 | 3 | Forge can capture gas snapshots over arbitrary sections inside of your test functions. This can be useful to get a granular measurement of how much gas your logic is consuming as both external calls and internal gas usage are measured. 4 | 5 | Instead of running a command like `forge snapshot` or `forge test --gas-report`, you use the `snapshotGas` [cheatcodes](./cheatcodes.md) in your tests to capture gas usage as follows: 6 | 7 | {{#include ../cheatcodes/gas-snapshots.md}} -------------------------------------------------------------------------------- /src/images/breakpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/src/images/breakpoint.png -------------------------------------------------------------------------------- /src/images/debugger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/src/images/debugger.png -------------------------------------------------------------------------------- /src/images/foundry-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/src/images/foundry-banner.png -------------------------------------------------------------------------------- /src/images/fuzzer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/src/images/fuzzer.png -------------------------------------------------------------------------------- /src/images/nft-tutorial/gas-report-oz-nft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/src/images/nft-tutorial/gas-report-oz-nft.png -------------------------------------------------------------------------------- /src/images/nft-tutorial/gas-report-solmate-nft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/src/images/nft-tutorial/gas-report-solmate-nft.png -------------------------------------------------------------------------------- /src/images/nft-tutorial/nft-tutorial-project-structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/src/images/nft-tutorial/nft-tutorial-project-structure.png -------------------------------------------------------------------------------- /src/images/solidity-scripting/compile-successful.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/src/images/solidity-scripting/compile-successful.png -------------------------------------------------------------------------------- /src/images/solidity-scripting/contract-verified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/src/images/solidity-scripting/contract-verified.png -------------------------------------------------------------------------------- /src/images/solidity-scripting/set-up-commands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/src/images/solidity-scripting/set-up-commands.png -------------------------------------------------------------------------------- /src/misc/README.md: -------------------------------------------------------------------------------- 1 | ## Miscellaneous 2 | 3 | - [Struct encoding](./struct-encoding.md) 4 | -------------------------------------------------------------------------------- /src/output/cast/cast-4byte-decode: -------------------------------------------------------------------------------- 1 | // ANCHOR: all 2 | // ANCHOR: command 3 | $ cast 4byte-decode 0x1F1F897F676d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003e7 4 | // ANCHOR_END: command 5 | // ANCHOR: output 6 | 1) "fulfillRandomness(bytes32,uint256)" 7 | 0x676d000000000000000000000000000000000000000000000000000000000000 8 | 999 9 | // ANCHOR_END: output 10 | // ANCHOR_END: all 11 | -------------------------------------------------------------------------------- /src/output/cast/cast-call: -------------------------------------------------------------------------------- 1 | // ANCHOR: all 2 | // ANCHOR: command 3 | $ cast call 0x6b175474e89094c44da98b954eedeac495271d0f "totalSupply()(uint256)" --rpc-url https://eth-mainnet.alchemyapi.io/v2/Lc7oIGYeL_QvInzI0Wiu_pOZZDEKBrdf 4 | // ANCHOR_END: command 5 | // ANCHOR: output 6 | 3369748004762949875806510626 [3.369e27] 7 | // ANCHOR_END: output 8 | // ANCHOR_END: all 9 | -------------------------------------------------------------------------------- /src/output/deps/forge-install: -------------------------------------------------------------------------------- 1 | // ANCHOR: all 2 | // ANCHOR: command 3 | $ forge install transmissions11/solmate 4 | // ANCHOR_END: command 5 | // ANCHOR: output 6 | Installing solmate in /tmp/tmp.M8AZj8msD3/deps/lib/solmate (url: Some("https://github.com/transmissions11/solmate"), tag: None) 7 | Installed solmate 8 | // ANCHOR_END: output 9 | // ANCHOR_END: all 10 | -------------------------------------------------------------------------------- /src/output/deps/forge-remappings: -------------------------------------------------------------------------------- 1 | // ANCHOR: all 2 | // ANCHOR: command 3 | $ forge remappings 4 | // ANCHOR_END: command 5 | // ANCHOR: output 6 | ds-test/=lib/solmate/lib/ds-test/src/ 7 | forge-std/=lib/forge-std/src/ 8 | solmate/=lib/solmate/src/ 9 | weird-erc20/=lib/weird-erc20/src/ 10 | // ANCHOR_END: output 11 | // ANCHOR_END: all 12 | -------------------------------------------------------------------------------- /src/output/deps/tree: -------------------------------------------------------------------------------- 1 | // ANCHOR: all 2 | // ANCHOR: command 3 | $ tree lib -L 1 4 | // ANCHOR_END: command 5 | // ANCHOR: output 6 | lib 7 | ├── forge-std 8 | ├── solmate 9 | └── weird-erc20 10 | 11 | 3 directories, 0 files 12 | // ANCHOR_END: output 13 | // ANCHOR_END: all 14 | -------------------------------------------------------------------------------- /src/output/foundry-template/forge-build: -------------------------------------------------------------------------------- 1 | // ANCHOR: all 2 | // ANCHOR: command 3 | $ forge build 4 | // ANCHOR_END: command 5 | // ANCHOR: output 6 | Compiling 28 files with Solc 0.8.25 7 | Solc 0.8.25 finished in 1.32s 8 | Compiler run successful! 9 | // ANCHOR_END: output 10 | // ANCHOR_END: all 11 | -------------------------------------------------------------------------------- /src/output/foundry-template/forge-install: -------------------------------------------------------------------------------- 1 | // ANCHOR: all 2 | // ANCHOR: command 3 | $ forge install 4 | // ANCHOR_END: command 5 | // ANCHOR: output 6 | 7 | // ANCHOR_END: output 8 | // ANCHOR_END: all 9 | -------------------------------------------------------------------------------- /src/output/hello_foundry/forge-build: -------------------------------------------------------------------------------- 1 | // ANCHOR: all 2 | // ANCHOR: command 3 | $ forge build 4 | // ANCHOR_END: command 5 | // ANCHOR: output 6 | Compiling 27 files with Solc 0.8.19 7 | Solc 0.8.19 finished in 1.08s 8 | Compiler run successful! 9 | // ANCHOR_END: output 10 | // ANCHOR_END: all 11 | -------------------------------------------------------------------------------- /src/output/hello_foundry/forge-init: -------------------------------------------------------------------------------- 1 | // ANCHOR: all 2 | // ANCHOR: command 3 | $ forge init hello_foundry 4 | // ANCHOR_END: command 5 | // ANCHOR: output 6 | Initializing /tmp/tmp.tFO8NOfTBW/hello_foundry... 7 | Installing forge-std in /tmp/tmp.tFO8NOfTBW/hello_foundry/lib/forge-std (url: Some("https://github.com/foundry-rs/forge-std"), tag: None) 8 | Installed forge-std v1.9.3 9 | Initialized forge project 10 | // ANCHOR_END: output 11 | // ANCHOR_END: all 12 | -------------------------------------------------------------------------------- /src/output/hello_foundry/tree: -------------------------------------------------------------------------------- 1 | // ANCHOR: all 2 | // ANCHOR: command 3 | $ tree . -d -L 1 4 | // ANCHOR_END: command 5 | // ANCHOR: output 6 | . 7 | ├── lib 8 | ├── script 9 | ├── src 10 | └── test 11 | 12 | 4 directories 13 | // ANCHOR_END: output 14 | // ANCHOR_END: all 15 | -------------------------------------------------------------------------------- /src/reference/README.md: -------------------------------------------------------------------------------- 1 | ## References 2 | 3 | - [CLI Reference](./cli/) 4 | - [forge Commands](./forge/) 5 | - [cast Commands](./cast/) 6 | - [anvil Reference](./anvil/) 7 | - [chisel Reference](./chisel/) 8 | - [Config Reference](./config/) 9 | - [Cheatcodes Reference](../cheatcodes/) 10 | - [Forge Standard Library Reference](./forge-std) 11 | - [ds-test Reference](./ds-test.md) 12 | -------------------------------------------------------------------------------- /src/reference/cast/README.md: -------------------------------------------------------------------------------- 1 | ## cast Commands 2 | 3 | - [General Commands](./general-commands.md) 4 | - [Chain Commands](./chain-commands.md) 5 | - [Transaction Commands](./transaction-commands.md) 6 | - [Block Commands](./block-commands.md) 7 | - [Account Commands](./account-commands.md) 8 | - [ENS Commands](./ens-commands.md) 9 | - [Etherscan Commands](./etherscan-commands.md) 10 | - [ABI Commands](./abi-commands.md) 11 | - [Conversion Commands](./conversion-commands.md) 12 | - [Utility Commands](./utility-commands.md) 13 | - [Wallet Commands](./wallet-commands.md) 14 | -------------------------------------------------------------------------------- /src/reference/cast/abi-commands.md: -------------------------------------------------------------------------------- 1 | ## ABI Commands 2 | 3 | - [cast abi-decode](./cast-abi-decode.md) 4 | - [cast abi-encode](./cast-abi-encode.md) 5 | - [cast 4byte](./cast-4byte.md) 6 | - [cast 4byte-decode](./cast-4byte-decode.md) 7 | - [cast 4byte-event](./cast-4byte-event.md) 8 | - [cast calldata](./cast-calldata.md) 9 | - [cast calldata-decode](./cast-calldata-decode.md) 10 | - [cast pretty-calldata](./cast-pretty-calldata.md) 11 | - [cast selectors](./cast-selectors.md) 12 | - [cast upload-signature](./cast-upload-signature.md) 13 | -------------------------------------------------------------------------------- /src/reference/cast/account-commands.md: -------------------------------------------------------------------------------- 1 | ## Account Commands 2 | 3 | - [cast balance](./cast-balance.md) 4 | - [cast storage](./cast-storage.md) 5 | - [cast proof](./cast-proof.md) 6 | - [cast nonce](./cast-nonce.md) 7 | - [cast code](./cast-code.md) 8 | - [cast codesize](./cast-codesize.md) 9 | -------------------------------------------------------------------------------- /src/reference/cast/block-commands.md: -------------------------------------------------------------------------------- 1 | ## Block Commands 2 | 3 | - [cast find-block](./cast-find-block.md) 4 | - [cast gas-price](./cast-gas-price.md) 5 | - [cast block-number](./cast-block-number.md) 6 | - [cast basefee](./cast-basefee.md) 7 | - [cast block](./cast-block.md) 8 | - [cast age](./cast-age.md) 9 | -------------------------------------------------------------------------------- /src/reference/cast/cast-address-zero.md: -------------------------------------------------------------------------------- 1 | ## cast address-zero 2 | 3 | ### NAME 4 | 5 | cast address-zero - Prints the zero address. 6 | 7 | ### SYNOPSIS 8 | 9 | ``cast address-zero`` 10 | 11 | ### DESCRIPTION 12 | 13 | Prints the zero address. 14 | 15 | ### OPTIONS 16 | 17 | {{#include common-options.md}} 18 | 19 | [cast](./cast.md) 20 | -------------------------------------------------------------------------------- /src/reference/cast/cast-client.md: -------------------------------------------------------------------------------- 1 | ## cast client 2 | 3 | ### NAME 4 | 5 | cast-client - Get the current client version. 6 | 7 | ### SYNOPSIS 8 | 9 | ``cast client`` [*options*] 10 | 11 | ### DESCRIPTION 12 | 13 | Get the current client version. 14 | 15 | ### OPTIONS 16 | 17 | #### RPC Options 18 | 19 | {{#include ../common/rpc-url-option.md}} 20 | 21 | {{#include common-options.md}} 22 | 23 | ### EXAMPLES 24 | 25 | 1. Get the current client version: 26 | ```sh 27 | cast client 28 | ``` 29 | ### SEE ALSO 30 | 31 | [cast](./cast.md) 32 | -------------------------------------------------------------------------------- /src/reference/cast/cast-concat-hex.md: -------------------------------------------------------------------------------- 1 | ## cast concat-hex 2 | 3 | ### NAME 4 | 5 | cast-concat-hex - Concatenate hex strings. 6 | 7 | ### SYNOPSIS 8 | 9 | ``cast concat-hex`` *data...* 10 | 11 | ### DESCRIPTION 12 | 13 | Concatenate hex strings. 14 | 15 | ### OPTIONS 16 | 17 | {{#include common-options.md}} 18 | 19 | ### EXAMPLES 20 | 21 | 1. Concatenate hex strings: 22 | ```sh 23 | cast concat-hex 0xa 0xb 0xc 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | [cast](./cast.md) 29 | -------------------------------------------------------------------------------- /src/reference/cast/cast-from-bin.md: -------------------------------------------------------------------------------- 1 | ## cast from-bin 2 | 3 | ### NAME 4 | 5 | cast-from-bin - Convert binary data into hex data. 6 | 7 | ### SYNOPSIS 8 | 9 | ``cast from-bin`` [*options*] 10 | 11 | ### DESCRIPTION 12 | 13 | Convert binary data into hex data. 14 | 15 | The input is taken from stdin. 16 | 17 | ### OPTIONS 18 | 19 | {{#include common-options.md}} 20 | 21 | ### SEE ALSO 22 | 23 | [cast](./cast.md) 24 | -------------------------------------------------------------------------------- /src/reference/cast/cast-from-rlp.md: -------------------------------------------------------------------------------- 1 | ## cast from-rlp 2 | 3 | ### NAME 4 | 5 | cast-from-rlp - Decodes RLP-encoded data. 6 | 7 | ### SYNOPSIS 8 | 9 | ``cast from-rlp`` *data* 10 | 11 | ### DESCRIPTION 12 | 13 | Decodes RLP-encoded data. 14 | 15 | The *data* is a hexadecimal string with optional 0x prefix. 16 | 17 | ### OPTIONS 18 | 19 | {{#include common-options.md}} 20 | 21 | ### EXAMPLES 22 | 23 | 1. Decode RLP data: 24 | ```sh 25 | cast from-rlp 0xc481f181f2 26 | 27 | cast from-rlp c481f181f2 28 | ``` 29 | -------------------------------------------------------------------------------- /src/reference/cast/cast-from-utf8.md: -------------------------------------------------------------------------------- 1 | ## cast from-utf8 2 | 3 | ### NAME 4 | 5 | cast-from-utf8 - Convert UTF8 text to hex. 6 | 7 | ### SYNOPSIS 8 | 9 | ``cast from-utf8`` [*options*] *text* 10 | 11 | ### DESCRIPTION 12 | 13 | Convert UTF8 text to hex. 14 | 15 | ### OPTIONS 16 | 17 | {{#include common-options.md}} 18 | 19 | ### EXAMPLES 20 | 21 | 1. Convert UTF8 text to hex: 22 | ```sh 23 | cast from-utf8 "hello" 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | [cast](./cast.md) 29 | -------------------------------------------------------------------------------- /src/reference/cast/cast-from-wei.md: -------------------------------------------------------------------------------- 1 | ## cast from-wei 2 | 3 | ### NAME 4 | 5 | cast-from-wei - Convert wei into an ETH amount. 6 | 7 | ### SYNOPSIS 8 | 9 | ``cast from-wei`` [*options*] *value* [*unit*] 10 | 11 | ### DESCRIPTION 12 | 13 | Convert wei into an ETH amount. 14 | 15 | Consider using [`cast to-unit`](./cast-to-unit.md). 16 | 17 | ### OPTIONS 18 | 19 | {{#include common-options.md}} 20 | 21 | ### SEE ALSO 22 | 23 | [cast](./cast.md), [cast calldata](./cast-to-unit.md) 24 | -------------------------------------------------------------------------------- /src/reference/cast/cast-help.md: -------------------------------------------------------------------------------- 1 | ## cast help 2 | 3 | ### NAME 4 | 5 | cast-help - Get help for a Cast command 6 | 7 | ### SYNOPSIS 8 | 9 | ``cast help`` [*subcommand*] 10 | 11 | ### DESCRIPTION 12 | 13 | Prints a help message for the given command. 14 | 15 | ### EXAMPLES 16 | 17 | 1. Get help for a command: 18 | ```sh 19 | cast help call 20 | ``` 21 | 22 | 2. Help is also available with the `--help` flag: 23 | ```sh 24 | cast call --help 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | [cast](./cast.md) 30 | -------------------------------------------------------------------------------- /src/reference/cast/cast-keccak.md: -------------------------------------------------------------------------------- 1 | ## cast keccak 2 | 3 | ### NAME 4 | 5 | cast-keccak - Hash arbitrary data using keccak-256. 6 | 7 | ### SYNOPSIS 8 | 9 | ``cast keccak`` [*options*] *data* 10 | 11 | ### DESCRIPTION 12 | 13 | Hash arbitrary data using keccak-256. 14 | 15 | ### OPTIONS 16 | 17 | {{#include common-options.md}} 18 | 19 | ### SEE ALSO 20 | 21 | [cast](./cast.md) 22 | -------------------------------------------------------------------------------- /src/reference/cast/cast-max-int.md: -------------------------------------------------------------------------------- 1 | ## cast max-int 2 | 3 | ### NAME 4 | 5 | cast-max-int - Get the maximum i256 value. 6 | 7 | ### SYNOPSIS 8 | 9 | ``cast max-int`` 10 | 11 | ### DESCRIPTION 12 | 13 | Get the maximum i256 value. 14 | 15 | ### OPTIONS 16 | 17 | {{#include common-options.md}} 18 | 19 | ### SEE ALSO 20 | 21 | [cast](./cast.md), [cast min-int](./cast-min-int.md), [cast max-uint](./cast-max-uint.md) 22 | -------------------------------------------------------------------------------- /src/reference/cast/cast-max-uint.md: -------------------------------------------------------------------------------- 1 | ## cast max-uint 2 | 3 | ### NAME 4 | 5 | cast-max-uint - Get the maximum uint256 value. 6 | 7 | ### SYNOPSIS 8 | 9 | ``cast max-uint`` 10 | 11 | ### DESCRIPTION 12 | 13 | Get the maximum uint256 value. 14 | 15 | ### OPTIONS 16 | 17 | {{#include common-options.md}} 18 | 19 | ### SEE ALSO 20 | 21 | [cast](./cast.md), [cast max-int](./cast-max-int.md) 22 | -------------------------------------------------------------------------------- /src/reference/cast/cast-min-int.md: -------------------------------------------------------------------------------- 1 | ## cast min-int 2 | 3 | ### NAME 4 | 5 | cast-min-int - Get the minimum i256 value. 6 | 7 | ### SYNOPSIS 8 | 9 | ``cast min-int`` 10 | 11 | ### DESCRIPTION 12 | 13 | Get the minimum i256 value. 14 | 15 | ### OPTIONS 16 | 17 | {{#include common-options.md}} 18 | 19 | ### SEE ALSO 20 | 21 | [cast](./cast.md), [cast max-int](./cast-max-int.md) 22 | -------------------------------------------------------------------------------- /src/reference/cast/cast-to-ascii.md: -------------------------------------------------------------------------------- 1 | ## cast to-ascii 2 | 3 | ### NAME 4 | 5 | cast-to-ascii - Convert hex data to an ASCII string. 6 | 7 | ### SYNOPSIS 8 | 9 | ``cast to-ascii`` [*options*] *text* 10 | 11 | ### DESCRIPTION 12 | 13 | Convert hex data to an ASCII string. 14 | 15 | ### OPTIONS 16 | 17 | {{#include common-options.md}} 18 | 19 | ### EXAMPLES 20 | 21 | 1. Convert hex data to an ASCII string: 22 | ```sh 23 | cast to-ascii "0x68656c6c6f" 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | [cast](./cast.md) 29 | -------------------------------------------------------------------------------- /src/reference/cast/cast-to-hex.md: -------------------------------------------------------------------------------- 1 | ## cast to-hex 2 | 3 | ### NAME 4 | 5 | cast-to-hex - Converts a number of one base to another 6 | 7 | ### SYNOPSIS 8 | 9 | ``cast to-hex`` [*options*] *value* 10 | 11 | ### DESCRIPTION 12 | 13 | Converts a number of one base to another 14 | 15 | ### OPTIONS 16 | 17 | `--base-in` *base_in* 18 |     The input base. 19 | 20 | {{#include common-options.md}} 21 | 22 | ### SEE ALSO 23 | 24 | [cast](./cast.md) -------------------------------------------------------------------------------- /src/reference/cast/cast-to-int256.md: -------------------------------------------------------------------------------- 1 | ## cast to-int256 2 | 3 | ### NAME 4 | 5 | cast-to-int256 - Convert a number to a hex-encoded int256. 6 | 7 | ### SYNOPSIS 8 | 9 | ``cast to-int256`` [*options*] *value* 10 | 11 | ### DESCRIPTION 12 | 13 | Convert a number to a hex-encoded int256. 14 | 15 | ### OPTIONS 16 | 17 | {{#include common-options.md}} 18 | 19 | ### SEE ALSO 20 | 21 | [cast](./cast.md) 22 | -------------------------------------------------------------------------------- /src/reference/cast/cast-to-rlp.md: -------------------------------------------------------------------------------- 1 | ## cast to-rlp 2 | 3 | ### NAME 4 | 5 | cast-to-rlp - Encodes hex data to RLP. 6 | 7 | ### SYNOPSIS 8 | 9 | ``cast to-rlp`` *array* 10 | 11 | ### DESCRIPTION 12 | 13 | RLP encodes a hex string or a JSON array of hex strings. 14 | 15 | ### OPTIONS 16 | 17 | {{#include common-options.md}} 18 | 19 | ### EXAMPLES 20 | 21 | 1. Encoding RLP data: 22 | ```sh 23 | cast to-rlp '["0xaa","0xbb","cc"]' 24 | 25 | cast to-rlp f0a9 26 | ``` 27 | -------------------------------------------------------------------------------- /src/reference/cast/cast-to-uint256.md: -------------------------------------------------------------------------------- 1 | ## cast to-uint256 2 | 3 | ### NAME 4 | 5 | cast-to-uint256 - Convert a number to a hex-encoded uint256. 6 | 7 | ### SYNOPSIS 8 | 9 | ``cast to-uint256`` [*options*] *value* 10 | 11 | ### DESCRIPTION 12 | 13 | Convert a number to a hex-encoded uint256. 14 | 15 | ### OPTIONS 16 | 17 | {{#include common-options.md}} 18 | 19 | ### SEE ALSO 20 | 21 | [cast](./cast.md) 22 | -------------------------------------------------------------------------------- /src/reference/cast/cast-to-wei.md: -------------------------------------------------------------------------------- 1 | ## cast to-wei 2 | 3 | ### NAME 4 | 5 | cast-to-wei - Convert an eth amount to wei. 6 | 7 | ### SYNOPSIS 8 | 9 | ``cast to-wei`` [*options*] *value* [*unit*] 10 | 11 | ### DESCRIPTION 12 | 13 | Convert an eth amount to wei. 14 | 15 | Consider using [`cast to-unit`](./cast-to-unit.md). 16 | 17 | ### OPTIONS 18 | 19 | {{#include common-options.md}} 20 | 21 | ### SEE ALSO 22 | 23 | [cast](./cast.md), [cast calldata](./cast-to-unit.md) 24 | -------------------------------------------------------------------------------- /src/reference/cast/cast-wallet-list.md: -------------------------------------------------------------------------------- 1 | ## cast wallet list 2 | 3 | ### NAME 4 | 5 | cast-wallet-list - List all the accounts in the keystore default directory. 6 | 7 | ### SYNOPSIS 8 | 9 | `cast wallet list` 10 | 11 | ### DESCRIPTION 12 | 13 | List all the accounts in the keystore default directory `~/.foundry/keystores`. 14 | 15 | ### OPTIONS 16 | 17 | {{#include common-options.md}} 18 | 19 | ### SEE ALSO 20 | 21 | [cast](./cast.md), [cast wallet](./cast-wallet.md) 22 | -------------------------------------------------------------------------------- /src/reference/cast/chain-commands.md: -------------------------------------------------------------------------------- 1 | ## Chain Commands 2 | 3 | - [cast chain-id](./cast-chain-id.md) 4 | - [cast chain](./cast-chain.md) 5 | - [cast client](./cast-client.md) 6 | -------------------------------------------------------------------------------- /src/reference/cast/common-options.md: -------------------------------------------------------------------------------- 1 | #### Common Options 2 | 3 | `-h` 4 | `--help` 5 |     Prints help information. 6 | -------------------------------------------------------------------------------- /src/reference/cast/ens-commands.md: -------------------------------------------------------------------------------- 1 | ## ENS Commands 2 | 3 | - [cast lookup-address](./cast-lookup-address.md) 4 | - [cast resolve-name](./cast-resolve-name.md) 5 | - [cast namehash](./cast-namehash.md) 6 | -------------------------------------------------------------------------------- /src/reference/cast/etherscan-commands.md: -------------------------------------------------------------------------------- 1 | ## Etherscan Commands 2 | 3 | - [cast etherscan-source](./cast-etherscan-source.md) 4 | -------------------------------------------------------------------------------- /src/reference/cast/general-commands.md: -------------------------------------------------------------------------------- 1 | ## General Commands 2 | 3 | - [cast](./cast.md) 4 | - [cast help](./cast-help.md) 5 | - [cast completions](./cast-completions.md) 6 | -------------------------------------------------------------------------------- /src/reference/cast/sig-description.md: -------------------------------------------------------------------------------- 1 | The signature (*sig*) can be: 2 | 3 | - A fragment: `someFunction(uint256,bytes32)` 4 | - A selector and encoded calldata: `0xcdba2fd40000000000000000000000000000000000000000000000000000000000007a69` 5 | - Only the function name: in this case Cast will try to fetch the function signature from Etherscan 6 | -------------------------------------------------------------------------------- /src/reference/cast/transaction-commands.md: -------------------------------------------------------------------------------- 1 | ## Transaction Commands 2 | 3 | - [cast publish](./cast-publish.md) 4 | - [cast receipt](./cast-receipt.md) 5 | - [cast send](./cast-send.md) 6 | - [cast mktx](./cast-mktx.md) 7 | - [cast call](./cast-call.md) 8 | - [cast rpc](./cast-rpc.md) 9 | - [cast tx](./cast-tx.md) 10 | - [cast run](./cast-run.md) 11 | - [cast estimate](./cast-estimate.md) 12 | - [cast access-list](./cast-access-list.md) 13 | - [cast logs](./cast-logs.md) 14 | -------------------------------------------------------------------------------- /src/reference/cast/wallet-commands.md: -------------------------------------------------------------------------------- 1 | ## Wallet Commands 2 | 3 | - [cast wallet](./cast-wallet.md) 4 | - [cast wallet address](./cast-wallet-address.md) 5 | - [cast wallet new](./cast-wallet-new.md) 6 | - [cast wallet sign](./cast-wallet-sign.md) 7 | - [cast wallet vanity](./cast-wallet-vanity.md) 8 | - [cast wallet verify](./cast-wallet-verify.md) 9 | - [cast wallet import](./cast-wallet-import.md) 10 | -------------------------------------------------------------------------------- /src/reference/cli/README.md: -------------------------------------------------------------------------------- 1 | # CLI Reference 2 | 3 | 4 | 5 | Automatically-generated CLI reference from `--help` output. 6 | 7 | {{#include ./SUMMARY.md}} 8 | -------------------------------------------------------------------------------- /src/reference/cli/anvil/completions.md: -------------------------------------------------------------------------------- 1 | # anvil completions 2 | 3 | Generate shell completions script 4 | 5 | ```bash 6 | $ anvil completions --help 7 | ``` 8 | 9 | ```txt 10 | Usage: anvil completions 11 | 12 | Arguments: 13 | [possible values: bash, elvish, fish, powershell, zsh] 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/anvil/generate-fig-spec.md: -------------------------------------------------------------------------------- 1 | # anvil generate-fig-spec 2 | 3 | Generate Fig autocompletion spec 4 | 5 | ```bash 6 | $ anvil generate-fig-spec --help 7 | ``` 8 | 9 | ```txt 10 | Usage: anvil generate-fig-spec 11 | 12 | Options: 13 | -h, --help Print help 14 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/4byte-decode.md: -------------------------------------------------------------------------------- 1 | # cast 4byte-decode 2 | 3 | Decode ABI-encoded calldata using https://openchain.xyz 4 | 5 | ```bash 6 | $ cast 4byte-decode --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast 4byte-decode [OPTIONS] [CALLDATA] 11 | 12 | Arguments: 13 | [CALLDATA] The ABI-encoded calldata 14 | 15 | Options: 16 | -h, --help Print help 17 | 18 | Display options: 19 | -j, --json Print the decoded calldata as JSON 20 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/4byte-event.md: -------------------------------------------------------------------------------- 1 | # cast 4byte-event 2 | 3 | Get the event signature for a given topic 0 from https://openchain.xyz 4 | 5 | ```bash 6 | $ cast 4byte-event --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast 4byte-event [TOPIC_0] 11 | 12 | Arguments: 13 | [TOPIC_0] Topic 0 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/4byte.md: -------------------------------------------------------------------------------- 1 | # cast 4byte 2 | 3 | Get the function signatures for the given selector from https://openchain.xyz 4 | 5 | ```bash 6 | $ cast 4byte --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast 4byte [SELECTOR] 11 | 12 | Arguments: 13 | [SELECTOR] The function selector 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/abi-encode.md: -------------------------------------------------------------------------------- 1 | # cast abi-encode 2 | 3 | ABI encode the given function argument, excluding the selector 4 | 5 | ```bash 6 | $ cast abi-encode --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast abi-encode [OPTIONS] [ARGS]... 11 | 12 | Arguments: 13 | The function signature 14 | [ARGS]... The arguments of the function 15 | 16 | Options: 17 | --packed Whether to use packed encoding 18 | -h, --help Print help 19 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/address-zero.md: -------------------------------------------------------------------------------- 1 | # cast address-zero 2 | 3 | Prints the zero address 4 | 5 | ```bash 6 | $ cast address-zero --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast address-zero 11 | 12 | Options: 13 | -h, --help Print help 14 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/calldata.md: -------------------------------------------------------------------------------- 1 | # cast calldata 2 | 3 | ABI-encode a function with arguments 4 | 5 | ```bash 6 | $ cast calldata --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast calldata [ARGS]... 11 | 12 | Arguments: 13 | The function signature in the format 14 | `()()` 15 | [ARGS]... The arguments to encode 16 | 17 | Options: 18 | -h, --help Print help 19 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/completions.md: -------------------------------------------------------------------------------- 1 | # cast completions 2 | 3 | Generate shell completions script 4 | 5 | ```bash 6 | $ cast completions --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast completions 11 | 12 | Arguments: 13 | [possible values: bash, elvish, fish, powershell, zsh] 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/concat-hex.md: -------------------------------------------------------------------------------- 1 | # cast concat-hex 2 | 3 | Concatenate hex strings 4 | 5 | ```bash 6 | $ cast concat-hex --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast concat-hex [DATA]... 11 | 12 | Arguments: 13 | [DATA]... The data to concatenate 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/decode-eof.md: -------------------------------------------------------------------------------- 1 | # cast decode-eof 2 | 3 | Decodes EOF container bytes 4 | 5 | ```bash 6 | $ cast decode-eof --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast decode-eof [EOF] 11 | 12 | Arguments: 13 | [EOF] 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/decode-transaction.md: -------------------------------------------------------------------------------- 1 | # cast decode-transaction 2 | 3 | Decodes a raw signed EIP 2718 typed transaction 4 | 5 | ```bash 6 | $ cast decode-transaction --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast decode-transaction [TX] 11 | 12 | Arguments: 13 | [TX] 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/disassemble.md: -------------------------------------------------------------------------------- 1 | # cast disassemble 2 | 3 | Disassembles hex encoded bytecode into individual / human readable opcodes 4 | 5 | ```bash 6 | $ cast disassemble --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast disassemble 11 | 12 | Arguments: 13 | The hex encoded bytecode 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/format-bytes32-string.md: -------------------------------------------------------------------------------- 1 | # cast format-bytes32-string 2 | 3 | Formats a string into bytes32 encoding 4 | 5 | ```bash 6 | $ cast format-bytes32-string --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast format-bytes32-string [STRING] 11 | 12 | Arguments: 13 | [STRING] The string to format 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/from-bin.md: -------------------------------------------------------------------------------- 1 | # cast from-bin 2 | 3 | Convert binary data into hex data 4 | 5 | ```bash 6 | $ cast from-bin --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast from-bin 11 | 12 | Options: 13 | -h, --help Print help 14 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/from-fixed-point.md: -------------------------------------------------------------------------------- 1 | # cast from-fixed-point 2 | 3 | Convert a fixed point number into an integer 4 | 5 | ```bash 6 | $ cast from-fixed-point --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast from-fixed-point [DECIMALS] [VALUE] 11 | 12 | Arguments: 13 | [DECIMALS] The number of decimals to use 14 | [VALUE] The value to convert 15 | 16 | Options: 17 | -h, --help Print help 18 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/from-rlp.md: -------------------------------------------------------------------------------- 1 | # cast from-rlp 2 | 3 | Decodes RLP hex-encoded data 4 | 5 | ```bash 6 | $ cast from-rlp --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast from-rlp [VALUE] 11 | 12 | Arguments: 13 | [VALUE] The RLP hex-encoded data 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/from-utf8.md: -------------------------------------------------------------------------------- 1 | # cast from-utf8 2 | 3 | Convert UTF8 text to hex 4 | 5 | ```bash 6 | $ cast from-utf8 --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast from-utf8 [TEXT] 11 | 12 | Arguments: 13 | [TEXT] The text to convert 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/from-wei.md: -------------------------------------------------------------------------------- 1 | # cast from-wei 2 | 3 | Convert wei into an ETH amount. 4 | 5 | ```bash 6 | $ cast from-wei --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast from-wei [VALUE] [UNIT] 11 | 12 | Arguments: 13 | [VALUE] 14 | The value to convert 15 | 16 | [UNIT] 17 | The unit to convert from (ether, gwei, wei) 18 | 19 | [default: eth] 20 | 21 | Options: 22 | -h, --help 23 | Print help (see a summary with '-h') 24 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/generate-fig-spec.md: -------------------------------------------------------------------------------- 1 | # cast generate-fig-spec 2 | 3 | Generate Fig autocompletion spec 4 | 5 | ```bash 6 | $ cast generate-fig-spec --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast generate-fig-spec 11 | 12 | Options: 13 | -h, --help Print help 14 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/hash-message.md: -------------------------------------------------------------------------------- 1 | # cast hash-message 2 | 3 | Hash a message according to EIP-191 4 | 5 | ```bash 6 | $ cast hash-message --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast hash-message [MESSAGE] 11 | 12 | Arguments: 13 | [MESSAGE] The message to hash 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/hash-zero.md: -------------------------------------------------------------------------------- 1 | # cast hash-zero 2 | 3 | Prints the zero hash 4 | 5 | ```bash 6 | $ cast hash-zero --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast hash-zero 11 | 12 | Options: 13 | -h, --help Print help 14 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/index-erc7201.md: -------------------------------------------------------------------------------- 1 | # cast index-erc7201 2 | 3 | Compute storage slots as specified by `ERC-7201: Namespaced Storage Layout` 4 | 5 | ```bash 6 | $ cast index-erc7201 --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast index-erc7201 [OPTIONS] [ID] 11 | 12 | Arguments: 13 | [ID] The arbitrary identifier 14 | 15 | Options: 16 | --formula-id 17 | The formula ID. Currently the only supported formula is `erc7201` 18 | [default: erc7201] 19 | -h, --help 20 | Print help 21 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/index.md: -------------------------------------------------------------------------------- 1 | # cast index 2 | 3 | Compute the storage slot for an entry in a mapping 4 | 5 | ```bash 6 | $ cast index --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast index 11 | 12 | Arguments: 13 | The mapping key type 14 | The mapping key 15 | The storage slot of the mapping 16 | 17 | Options: 18 | -h, --help Print help 19 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/keccak.md: -------------------------------------------------------------------------------- 1 | # cast keccak 2 | 3 | Hash arbitrary data using Keccak-256 4 | 5 | ```bash 6 | $ cast keccak --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast keccak [DATA] 11 | 12 | Arguments: 13 | [DATA] The data to hash 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/max-int.md: -------------------------------------------------------------------------------- 1 | # cast max-int 2 | 3 | Prints the maximum value of the given integer type 4 | 5 | ```bash 6 | $ cast max-int --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast max-int [TYPE] 11 | 12 | Arguments: 13 | [TYPE] The integer type to get the maximum value of [default: int256] 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/max-uint.md: -------------------------------------------------------------------------------- 1 | # cast max-uint 2 | 3 | Prints the maximum value of the given integer type 4 | 5 | ```bash 6 | $ cast max-uint --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast max-uint [TYPE] 11 | 12 | Arguments: 13 | [TYPE] The unsigned integer type to get the maximum value of [default: 14 | uint256] 15 | 16 | Options: 17 | -h, --help Print help 18 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/min-int.md: -------------------------------------------------------------------------------- 1 | # cast min-int 2 | 3 | Prints the minimum value of the given integer type 4 | 5 | ```bash 6 | $ cast min-int --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast min-int [TYPE] 11 | 12 | Arguments: 13 | [TYPE] The integer type to get the minimum value of [default: int256] 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/mktx/--create.md: -------------------------------------------------------------------------------- 1 | # cast mktx --create 2 | 3 | Use to deploy raw contract bytecode 4 | 5 | ```bash 6 | $ cast mktx --create --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast mktx --create [SIG] [ARGS]... 11 | 12 | Arguments: 13 | The initialization bytecode of the contract to deploy 14 | [SIG] The signature of the constructor 15 | [ARGS]... The constructor arguments 16 | 17 | Options: 18 | -h, --help Print help 19 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/namehash.md: -------------------------------------------------------------------------------- 1 | # cast namehash 2 | 3 | Calculate the ENS namehash of a name 4 | 5 | ```bash 6 | $ cast namehash --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast namehash [NAME] 11 | 12 | Arguments: 13 | [NAME] 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/parse-bytes32-address.md: -------------------------------------------------------------------------------- 1 | # cast parse-bytes32-address 2 | 3 | Parses a checksummed address from bytes32 encoding. 4 | 5 | ```bash 6 | $ cast parse-bytes32-address --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast parse-bytes32-address [BYTES] 11 | 12 | Arguments: 13 | [BYTES] 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/parse-bytes32-string.md: -------------------------------------------------------------------------------- 1 | # cast parse-bytes32-string 2 | 3 | Parses a string from bytes32 encoding 4 | 5 | ```bash 6 | $ cast parse-bytes32-string --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast parse-bytes32-string [BYTES] 11 | 12 | Arguments: 13 | [BYTES] The string to parse 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/pretty-calldata.md: -------------------------------------------------------------------------------- 1 | # cast pretty-calldata 2 | 3 | Pretty print calldata. 4 | 5 | ```bash 6 | $ cast pretty-calldata --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast pretty-calldata [OPTIONS] [CALLDATA] 11 | 12 | Arguments: 13 | [CALLDATA] 14 | The calldata 15 | 16 | Options: 17 | -o, --offline 18 | Skip the https://openchain.xyz lookup 19 | 20 | -h, --help 21 | Print help (see a summary with '-h') 22 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/selectors.md: -------------------------------------------------------------------------------- 1 | # cast selectors 2 | 3 | Extracts function selectors and arguments from bytecode 4 | 5 | ```bash 6 | $ cast selectors --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast selectors [OPTIONS] 11 | 12 | Arguments: 13 | The hex encoded bytecode 14 | 15 | Options: 16 | -r, --resolve Resolve the function signatures for the extracted selectors 17 | using https://openchain.xyz 18 | -h, --help Print help 19 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/send/--create.md: -------------------------------------------------------------------------------- 1 | # cast send --create 2 | 3 | Use to deploy raw contract bytecode 4 | 5 | ```bash 6 | $ cast send --create --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast send --create [SIG] [ARGS]... 11 | 12 | Arguments: 13 | The bytecode of the contract to deploy 14 | [SIG] The signature of the function to call 15 | [ARGS]... The arguments of the function to call 16 | 17 | Options: 18 | -h, --help Print help 19 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/shl.md: -------------------------------------------------------------------------------- 1 | # cast shl 2 | 3 | Perform a left shifting operation 4 | 5 | ```bash 6 | $ cast shl --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast shl [OPTIONS] 11 | 12 | Arguments: 13 | The value to shift 14 | The number of bits to shift 15 | 16 | Options: 17 | --base-in The input base 18 | --base-out The output base [default: 16] 19 | -h, --help Print help 20 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/shr.md: -------------------------------------------------------------------------------- 1 | # cast shr 2 | 3 | Perform a right shifting operation 4 | 5 | ```bash 6 | $ cast shr --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast shr [OPTIONS] 11 | 12 | Arguments: 13 | The value to shift 14 | The number of bits to shift 15 | 16 | Options: 17 | --base-in The input base, 18 | --base-out The output base, [default: 16] 19 | -h, --help Print help 20 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/sig-event.md: -------------------------------------------------------------------------------- 1 | # cast sig-event 2 | 3 | Generate event signatures from event string 4 | 5 | ```bash 6 | $ cast sig-event --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast sig-event [EVENT_STRING] 11 | 12 | Arguments: 13 | [EVENT_STRING] The event string 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/sig.md: -------------------------------------------------------------------------------- 1 | # cast sig 2 | 3 | Get the selector for a function 4 | 5 | ```bash 6 | $ cast sig --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast sig [SIG] [OPTIMIZE] 11 | 12 | Arguments: 13 | [SIG] The function signature, e.g. transfer(address,uint256) 14 | [OPTIMIZE] Optimize signature to contain provided amount of leading zeroes in 15 | selector 16 | 17 | Options: 18 | -h, --help Print help 19 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/to-ascii.md: -------------------------------------------------------------------------------- 1 | # cast to-ascii 2 | 3 | Convert hex data to an ASCII string 4 | 5 | ```bash 6 | $ cast to-ascii --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast to-ascii [HEXDATA] 11 | 12 | Arguments: 13 | [HEXDATA] The hex data to convert 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/to-base.md: -------------------------------------------------------------------------------- 1 | # cast to-base 2 | 3 | Converts a number of one base to another 4 | 5 | ```bash 6 | $ cast to-base --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast to-base [OPTIONS] [VALUE] [BASE] 11 | 12 | Arguments: 13 | [VALUE] The value to convert 14 | [BASE] The output base 15 | 16 | Options: 17 | -i, --base-in The input base 18 | -h, --help Print help 19 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/to-bytes32.md: -------------------------------------------------------------------------------- 1 | # cast to-bytes32 2 | 3 | Right-pads hex data to 32 bytes 4 | 5 | ```bash 6 | $ cast to-bytes32 --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast to-bytes32 [BYTES] 11 | 12 | Arguments: 13 | [BYTES] The hex data to convert 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/to-check-sum-address.md: -------------------------------------------------------------------------------- 1 | # cast to-check-sum-address 2 | 3 | Convert an address to a checksummed format (EIP-55) 4 | 5 | ```bash 6 | $ cast to-check-sum-address --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast to-check-sum-address [ADDRESS] 11 | 12 | Arguments: 13 | [ADDRESS] The address to convert 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/to-dec.md: -------------------------------------------------------------------------------- 1 | # cast to-dec 2 | 3 | Converts a number of one base to decimal 4 | 5 | ```bash 6 | $ cast to-dec --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast to-dec [OPTIONS] [VALUE] 11 | 12 | Arguments: 13 | [VALUE] The value to convert 14 | 15 | Options: 16 | -i, --base-in The input base 17 | -h, --help Print help 18 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/to-fixed-point.md: -------------------------------------------------------------------------------- 1 | # cast to-fixed-point 2 | 3 | Convert an integer into a fixed point number 4 | 5 | ```bash 6 | $ cast to-fixed-point --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast to-fixed-point [DECIMALS] [VALUE] 11 | 12 | Arguments: 13 | [DECIMALS] The number of decimals to use 14 | [VALUE] The value to convert 15 | 16 | Options: 17 | -h, --help Print help 18 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/to-hex.md: -------------------------------------------------------------------------------- 1 | # cast to-hex 2 | 3 | Converts a number of one base to another 4 | 5 | ```bash 6 | $ cast to-hex --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast to-hex [OPTIONS] [VALUE] 11 | 12 | Arguments: 13 | [VALUE] The value to convert 14 | 15 | Options: 16 | -i, --base-in The input base 17 | -h, --help Print help 18 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/to-hexdata.md: -------------------------------------------------------------------------------- 1 | # cast to-hexdata 2 | 3 | Normalize the input to lowercase, 0x-prefixed hex. 4 | 5 | ```bash 6 | $ cast to-hexdata --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast to-hexdata [INPUT] 11 | 12 | Arguments: 13 | [INPUT] 14 | The input to normalize 15 | 16 | Options: 17 | -h, --help 18 | Print help (see a summary with '-h') 19 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/to-int256.md: -------------------------------------------------------------------------------- 1 | # cast to-int256 2 | 3 | Convert a number to a hex-encoded int256 4 | 5 | ```bash 6 | $ cast to-int256 --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast to-int256 [VALUE] 11 | 12 | Arguments: 13 | [VALUE] The value to convert 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/to-rlp.md: -------------------------------------------------------------------------------- 1 | # cast to-rlp 2 | 3 | RLP encodes hex data, or an array of hex data. 4 | 5 | ```bash 6 | $ cast to-rlp --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast to-rlp [VALUE] 11 | 12 | Arguments: 13 | [VALUE] 14 | The value to convert. 15 | 16 | This is a hex-encoded string, or an array of hex-encoded strings. Can 17 | be arbitrarily recursive. 18 | 19 | Options: 20 | -h, --help 21 | Print help (see a summary with '-h') 22 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/to-uint256.md: -------------------------------------------------------------------------------- 1 | # cast to-uint256 2 | 3 | Convert a number to a hex-encoded uint256 4 | 5 | ```bash 6 | $ cast to-uint256 --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast to-uint256 [VALUE] 11 | 12 | Arguments: 13 | [VALUE] The value to convert 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/to-unit.md: -------------------------------------------------------------------------------- 1 | # cast to-unit 2 | 3 | Convert an ETH amount into another unit (ether, gwei or wei). 4 | 5 | ```bash 6 | $ cast to-unit --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast to-unit [VALUE] [UNIT] 11 | 12 | Arguments: 13 | [VALUE] 14 | The value to convert 15 | 16 | [UNIT] 17 | The unit to convert to (ether, gwei, wei) 18 | 19 | [default: wei] 20 | 21 | Options: 22 | -h, --help 23 | Print help (see a summary with '-h') 24 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/to-utf8.md: -------------------------------------------------------------------------------- 1 | # cast to-utf8 2 | 3 | Convert hex data to a utf-8 string 4 | 5 | ```bash 6 | $ cast to-utf8 --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast to-utf8 [HEXDATA] 11 | 12 | Arguments: 13 | [HEXDATA] The hex data to convert 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/to-wei.md: -------------------------------------------------------------------------------- 1 | # cast to-wei 2 | 3 | Convert an ETH amount to wei. 4 | 5 | ```bash 6 | $ cast to-wei --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast to-wei [VALUE] [UNIT] 11 | 12 | Arguments: 13 | [VALUE] 14 | The value to convert 15 | 16 | [UNIT] 17 | The unit to convert from (ether, gwei, wei) 18 | 19 | [default: eth] 20 | 21 | Options: 22 | -h, --help 23 | Print help (see a summary with '-h') 24 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/wallet/derive-private-key.md: -------------------------------------------------------------------------------- 1 | # cast wallet derive-private-key 2 | 3 | Derives private key from mnemonic 4 | 5 | ```bash 6 | $ cast wallet derive-private-key --help 7 | Usage: cast wallet derive-private-key [MNEMONIC_INDEX] 8 | 9 | Arguments: 10 | 11 | [MNEMONIC_INDEX] 12 | 13 | Options: 14 | -h, --help Print help 15 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/wallet/new-mnemonic.md: -------------------------------------------------------------------------------- 1 | # cast wallet new-mnemonic 2 | 3 | Generates a random BIP39 mnemonic phrase 4 | 5 | ```bash 6 | $ cast wallet new-mnemonic --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast wallet new-mnemonic [OPTIONS] 11 | 12 | Options: 13 | -w, --words Number of words for the mnemonic [default: 12] 14 | -a, --accounts Number of accounts to display [default: 1] 15 | -e, --entropy Entropy to use for the mnemonic 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/cast/wallet/verify.md: -------------------------------------------------------------------------------- 1 | # cast wallet verify 2 | 3 | Verify the signature of a message 4 | 5 | ```bash 6 | $ cast wallet verify --help 7 | ``` 8 | 9 | ```txt 10 | Usage: cast wallet verify --address
11 | 12 | Arguments: 13 | The original message 14 | The signature to verify 15 | 16 | Options: 17 | -a, --address
The address of the message signer 18 | -h, --help Print help 19 | ``` -------------------------------------------------------------------------------- /src/reference/cli/chisel/clear-cache.md: -------------------------------------------------------------------------------- 1 | # chisel clear-cache 2 | 3 | Clear all cached chisel sessions from the cache directory 4 | 5 | ```bash 6 | $ chisel clear-cache --help 7 | ``` 8 | 9 | ```txt 10 | Usage: chisel clear-cache 11 | 12 | Options: 13 | -h, --help Print help 14 | ``` -------------------------------------------------------------------------------- /src/reference/cli/chisel/eval.md: -------------------------------------------------------------------------------- 1 | # chisel eval 2 | 3 | Simple evaluation of a command without entering the REPL 4 | 5 | ```bash 6 | $ chisel eval --help 7 | ``` 8 | 9 | ```txt 10 | Usage: chisel eval 11 | 12 | Arguments: 13 | The command to be evaluated 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/chisel/list.md: -------------------------------------------------------------------------------- 1 | # chisel list 2 | 3 | List all cached sessions 4 | 5 | ```bash 6 | $ chisel list --help 7 | ``` 8 | 9 | ```txt 10 | Usage: chisel list 11 | 12 | Options: 13 | -h, --help Print help 14 | ``` -------------------------------------------------------------------------------- /src/reference/cli/chisel/load.md: -------------------------------------------------------------------------------- 1 | # chisel load 2 | 3 | Load a cached session 4 | 5 | ```bash 6 | $ chisel load --help 7 | ``` 8 | 9 | ```txt 10 | Usage: chisel load 11 | 12 | Arguments: 13 | The ID of the session to load 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/chisel/view.md: -------------------------------------------------------------------------------- 1 | # chisel view 2 | 3 | View the source of a cached session 4 | 5 | ```bash 6 | $ chisel view --help 7 | ``` 8 | 9 | ```txt 10 | Usage: chisel view 11 | 12 | Arguments: 13 | The ID of the session to load 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/forge/cache.md: -------------------------------------------------------------------------------- 1 | # forge cache 2 | 3 | Manage the Foundry cache 4 | 5 | ```bash 6 | $ forge cache --help 7 | ``` 8 | 9 | ```txt 10 | Usage: forge cache 11 | 12 | Commands: 13 | clean Cleans cached data from the global foundry directory 14 | ls Shows cached data from the global foundry directory 15 | help Print this message or the help of the given subcommand(s) 16 | 17 | Options: 18 | -h, --help Print help 19 | ``` -------------------------------------------------------------------------------- /src/reference/cli/forge/clean.md: -------------------------------------------------------------------------------- 1 | # forge clean 2 | 3 | Remove the build artifacts and cache directories 4 | 5 | ```bash 6 | $ forge clean --help 7 | ``` 8 | 9 | ```txt 10 | Usage: forge clean [OPTIONS] 11 | 12 | Options: 13 | --root 14 | The project's root path. 15 | 16 | By default root of the Git repository, if in one, or the current 17 | working directory. 18 | 19 | -h, --help 20 | Print help (see a summary with '-h') 21 | ``` -------------------------------------------------------------------------------- /src/reference/cli/forge/compiler.md: -------------------------------------------------------------------------------- 1 | # forge compiler 2 | 3 | Compiler utilities 4 | 5 | ```bash 6 | $ forge compiler --help 7 | ``` 8 | 9 | ```txt 10 | Usage: forge compiler 11 | 12 | Commands: 13 | resolve Retrieves the resolved version(s) of the compiler within the project 14 | [aliases: r] 15 | help Print this message or the help of the given subcommand(s) 16 | 17 | Options: 18 | -h, --help Print help 19 | ``` -------------------------------------------------------------------------------- /src/reference/cli/forge/completions.md: -------------------------------------------------------------------------------- 1 | # forge completions 2 | 3 | Generate shell completions script 4 | 5 | ```bash 6 | $ forge completions --help 7 | ``` 8 | 9 | ```txt 10 | Usage: forge completions 11 | 12 | Arguments: 13 | [possible values: bash, elvish, fish, powershell, zsh] 14 | 15 | Options: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /src/reference/cli/forge/generate-fig-spec.md: -------------------------------------------------------------------------------- 1 | # forge generate-fig-spec 2 | 3 | Generate Fig autocompletion spec 4 | 5 | ```bash 6 | $ forge generate-fig-spec --help 7 | ``` 8 | 9 | ```txt 10 | Usage: forge generate-fig-spec 11 | 12 | Options: 13 | -h, --help Print help 14 | ``` -------------------------------------------------------------------------------- /src/reference/cli/forge/generate.md: -------------------------------------------------------------------------------- 1 | # forge generate 2 | 3 | Generate scaffold files 4 | 5 | ```bash 6 | $ forge generate --help 7 | ``` 8 | 9 | ```txt 10 | Usage: forge generate 11 | 12 | Commands: 13 | test Scaffolds test file for given contract 14 | help Print this message or the help of the given subcommand(s) 15 | 16 | Options: 17 | -h, --help Print help 18 | ``` -------------------------------------------------------------------------------- /src/reference/cli/forge/generate/test.md: -------------------------------------------------------------------------------- 1 | # forge generate test 2 | 3 | Scaffolds test file for given contract 4 | 5 | ```bash 6 | $ forge generate test --help 7 | ``` 8 | 9 | ```txt 10 | Usage: forge generate test --contract-name 11 | 12 | Options: 13 | -c, --contract-name Contract name for test generation 14 | -h, --help Print help 15 | ``` -------------------------------------------------------------------------------- /src/reference/cli/forge/soldeer/init.md: -------------------------------------------------------------------------------- 1 | # forge soldeer init 2 | 3 | Convert a Foundry project to use Soldeer 4 | 5 | ```bash 6 | $ forge soldeer init --help 7 | ``` 8 | 9 | ```txt 10 | Usage: forge soldeer init [OPTIONS] 11 | 12 | Options: 13 | --clean Clean the Foundry project by removing .gitmodules and the lib 14 | directory 15 | -h, --help Print help 16 | 17 | For more information, read the README.md 18 | ``` -------------------------------------------------------------------------------- /src/reference/cli/forge/soldeer/login.md: -------------------------------------------------------------------------------- 1 | # forge soldeer login 2 | 3 | Log into the central repository to push packages 4 | 5 | ```bash 6 | $ forge soldeer login --help 7 | ``` 8 | 9 | ```txt 10 | Usage: forge soldeer login 11 | 12 | Options: 13 | -h, --help Print help 14 | 15 | For more information, read the README.md 16 | ``` -------------------------------------------------------------------------------- /src/reference/cli/forge/soldeer/uninstall.md: -------------------------------------------------------------------------------- 1 | # forge soldeer uninstall 2 | 3 | Uninstall a dependency 4 | 5 | ```bash 6 | $ forge soldeer uninstall --help 7 | ``` 8 | 9 | ```txt 10 | Usage: forge soldeer uninstall 11 | 12 | Arguments: 13 | The dependency name. Specifying a version is not necessary 14 | 15 | Options: 16 | -h, --help Print help 17 | 18 | For more information, read the README.md 19 | ``` -------------------------------------------------------------------------------- /src/reference/cli/forge/soldeer/version-dry-run.md: -------------------------------------------------------------------------------- 1 | # forge soldeer version-dry-run 2 | 3 | 4 | 5 | ```bash 6 | $ forge soldeer version-dry-run --help 7 | Usage: forge soldeer version-dry-run 8 | 9 | Options: 10 | -h, --help Print help 11 | ``` -------------------------------------------------------------------------------- /src/reference/cli/forge/soldeer/version.md: -------------------------------------------------------------------------------- 1 | # forge soldeer version 2 | 3 | Display the version of Soldeer 4 | 5 | ```bash 6 | $ forge soldeer version --help 7 | ``` 8 | 9 | ```txt 10 | Usage: forge soldeer version 11 | 12 | Options: 13 | -h, --help Print help 14 | ``` -------------------------------------------------------------------------------- /src/reference/common/display-options.md: -------------------------------------------------------------------------------- 1 | #### Display Options 2 | 3 | `-j` 4 | `--json` 5 |      Print the deployment information as JSON. 6 | -------------------------------------------------------------------------------- /src/reference/common/etherscan-options.md: -------------------------------------------------------------------------------- 1 | #### Etherscan Options 2 | 3 | `--chain` *chain_name* 4 |     The Etherscan chain. 5 | 6 | `--etherscan-api-key` *key* 7 |     Etherscan API key, or the key of an [Etherscan configuration table](../config/etherscan.md#etherscan). 8 |     Environment: `ETHERSCAN_API_KEY` 9 | 10 | -------------------------------------------------------------------------------- /src/reference/common/multi-wallet-options-hardware.md: -------------------------------------------------------------------------------- 1 | #### Wallet Options - Hardware Wallet 2 | 3 | `-t` 4 | `--trezor` 5 |     Use a Trezor hardware wallet. 6 | 7 | `-l` 8 | `--ledger` 9 |     Use a Ledger hardware wallet. 10 | 11 | `--hd-paths` *paths* 12 |     The derivation paths to use with hardware wallets. -------------------------------------------------------------------------------- /src/reference/common/multi-wallet-options-remote.md: -------------------------------------------------------------------------------- 1 | #### Wallet Options - Remote 2 | 3 | `-a` *addresses* 4 | `--froms` *addresses* 5 |     Sign the transaction with the specified accounts on the RPC. 6 |     Environment: `ETH_FROM` 7 | -------------------------------------------------------------------------------- /src/reference/common/multi-wallet-options.md: -------------------------------------------------------------------------------- 1 | {{#include multi-wallet-options-raw.md}} 2 | 3 | {{#include multi-wallet-options-keystore.md}} 4 | 5 | {{#include multi-wallet-options-hardware.md}} 6 | 7 | {{#include multi-wallet-options-remote.md}} -------------------------------------------------------------------------------- /src/reference/common/retry-options.md: -------------------------------------------------------------------------------- 1 | `--delay` *delay* 2 |     Optional timeout to apply in between attempts in seconds. Defaults to 3. 3 | 4 | `--retries` *retries* 5 |     Number of attempts for retrying. Defaults to 15. 6 | -------------------------------------------------------------------------------- /src/reference/common/rpc-options.md: -------------------------------------------------------------------------------- 1 | #### RPC Options 2 | 3 | {{#include rpc-url-option.md}} 4 | 5 | `--flashbots` 6 |     Use the Flashbots RPC URL (). 7 | -------------------------------------------------------------------------------- /src/reference/common/rpc-url-option.md: -------------------------------------------------------------------------------- 1 | `--rpc-url` *url* 2 |     The RPC endpoint. Accepts a URL or an existing alias in the [rpc_endpoints] table, like `mainnet`. 3 |     Environment: `ETH_RPC_URL` 4 | -------------------------------------------------------------------------------- /src/reference/common/tx-value-option.md: -------------------------------------------------------------------------------- 1 | `--value` *value* 2 |     Ether to send in the transaction. 3 | 4 |     Either specified as an integer (wei), or as a string with a unit, for example: 5 |     - `1ether` 6 |     - `10gwei` 7 |     - `0.01ether` 8 | -------------------------------------------------------------------------------- /src/reference/common/verifier-options.md: -------------------------------------------------------------------------------- 1 | `--verifier` *name* 2 |     The verification provider. Available options: `etherscan`, `sourcify` & `blockscout`. Default: `etherscan`. Note: make sure you add "/api\?" to the end of the Blockscout homepage explorer URL. 3 | 4 | `--verifier-url` *url* 5 |     The optional verifier url for submitting the verification request. 6 |     Environment: `VERIFIER_URL` 7 | -------------------------------------------------------------------------------- /src/reference/common/wallet-options-hardware.md: -------------------------------------------------------------------------------- 1 | #### Wallet Options - Hardware Wallet 2 | 3 | `-t` 4 | `--trezor` 5 |     Use a Trezor hardware wallet. 6 | 7 | `-l` 8 | `--ledger` 9 |     Use a Ledger hardware wallet. 10 | -------------------------------------------------------------------------------- /src/reference/common/wallet-options-remote.md: -------------------------------------------------------------------------------- 1 | #### Wallet Options - Remote 2 | 3 | `-f` *address* 4 | `--from` *address* 5 |     Sign the transaction with the specified account on the RPC. 6 |     Environment: `ETH_FROM` 7 | -------------------------------------------------------------------------------- /src/reference/common/wallet-options.md: -------------------------------------------------------------------------------- 1 | {{#include wallet-options-raw.md}} 2 | 3 | {{#include wallet-options-keystore.md}} 4 | 5 | {{#include wallet-options-hardware.md}} 6 | 7 | {{#include wallet-options-remote.md}} 8 | -------------------------------------------------------------------------------- /src/reference/config/README.md: -------------------------------------------------------------------------------- 1 | ## Config Reference 2 | 3 | - [Overview](./overview.md) 4 | - [Project](./project.md) 5 | - [Solidity Compiler](./solidity-compiler.md) 6 | - [Testing](./testing.md) 7 | - [In-line test configuration](./inline-test-config.md) 8 | - [Formatter](./formatter.md) 9 | - [Documentation Generator](./doc-generator.md) 10 | - [Etherscan](./etherscan.md) 11 | -------------------------------------------------------------------------------- /src/reference/forge-std/abs.md: -------------------------------------------------------------------------------- 1 | ## `abs` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function abs(int256 a) internal pure returns (uint256) 7 | ``` 8 | 9 | ### Description 10 | 11 | Returns the absolute value of a number. 12 | 13 | ### Example 14 | 15 | ```solidity 16 | uint256 ten = stdMath.abs(-10); 17 | ``` 18 | -------------------------------------------------------------------------------- /src/reference/forge-std/assertFalse.md: -------------------------------------------------------------------------------- 1 | ## `assertFalse` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function assertFalse(bool data) internal; 7 | ``` 8 | 9 | ```solidity 10 | function assertFalse(bool data, string memory err) internal; 11 | ``` 12 | 13 | ### Description 14 | 15 | Asserts `data` is false. 16 | 17 | Optionally includes an error message in the revert string. 18 | 19 | ### Examples 20 | 21 | ```solidity 22 | bool failure = contract.fun(); 23 | assertFalse(failure); 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | - [`assertTrue`](./assertTrue.md) -------------------------------------------------------------------------------- /src/reference/forge-std/assertTrue.md: -------------------------------------------------------------------------------- 1 | ## `assertTrue` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function assertTrue(bool data) internal; 7 | ``` 8 | 9 | ```solidity 10 | function assertTrue(bool data, string memory err) internal; 11 | ``` 12 | 13 | ### Description 14 | 15 | Asserts `data` is true. 16 | 17 | Optionally includes an error message in the revert string. 18 | 19 | ### Examples 20 | 21 | ```solidity 22 | bool success = contract.fun(); 23 | assertTrue(success); 24 | ``` 25 | 26 | ### SEE ALSO 27 | 28 | - [`assertFalse`](./assertFalse.md) -------------------------------------------------------------------------------- /src/reference/forge-std/assertionError.md: -------------------------------------------------------------------------------- 1 | ## `assertionError` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | stdError.assertionError 7 | ``` 8 | 9 | ### Description 10 | 11 | The internal Solidity error when an `assert` fails. -------------------------------------------------------------------------------- /src/reference/forge-std/assume-payable.md: -------------------------------------------------------------------------------- 1 | ## `assumePayable` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function assumePayable(address addr) public; 7 | ``` 8 | 9 | ### Description 10 | 11 | Uses [`assume`](../../cheatcodes/assume.md) to filter addresses that reject Ether transfers. 12 | 13 | This makes an external call to the specified `addr` with a no calldata and checks `assume` against the success of the call. 14 | -------------------------------------------------------------------------------- /src/reference/forge-std/change-prank.md: -------------------------------------------------------------------------------- 1 | ## `changePrank` 2 | 3 | ### Status 4 | 5 | `changePrank` is deprecated. 6 | 7 | ### Signature 8 | 9 | ```solidity 10 | function changePrank(address who) internal; 11 | ``` 12 | 13 | ### Description 14 | 15 | Stops the active prank with `stopPrank` and passes address to `startPrank`. 16 | 17 | Useful for starting a global prank in the `setUp` function and deactivating it in certain tests. -------------------------------------------------------------------------------- /src/reference/forge-std/delta.md: -------------------------------------------------------------------------------- 1 | ## `delta` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function delta(uint256 a, uint256 b) internal pure returns (uint256) 7 | ``` 8 | 9 | ```solidity 10 | function delta(int256 a, int256 b) internal pure returns (uint256) 11 | ``` 12 | 13 | ### Description 14 | 15 | Returns the difference between two numbers in absolute value. 16 | 17 | ### Example 18 | 19 | ```solidity 20 | uint256 four = stdMath.delta(-1, 3); 21 | ``` 22 | -------------------------------------------------------------------------------- /src/reference/forge-std/depth.md: -------------------------------------------------------------------------------- 1 | ## `depth` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function depth(StdStorage storage self, uint256 _depth) internal returns (StdStorage storage); 7 | ``` 8 | 9 | ### Description 10 | 11 | Sets the position of the value in the `tuple` (e.g. inside a `struct`). 12 | 13 | Default value: `uint256(0)` 14 | -------------------------------------------------------------------------------- /src/reference/forge-std/divisionError.md: -------------------------------------------------------------------------------- 1 | ## `divisionError` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | stdError.divisionError 7 | ``` 8 | 9 | ### Description 10 | 11 | The internal Solidity error when a division fails, e.g. division by zero. -------------------------------------------------------------------------------- /src/reference/forge-std/encodeStorageError.md: -------------------------------------------------------------------------------- 1 | ## `encodeStorageError` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | stdError.encodeStorageError 7 | ``` 8 | 9 | ### Description 10 | 11 | The internal Solidity error when trying to access data in storage that is corrupted. Data cannot be corrupted unless assembly had been used. -------------------------------------------------------------------------------- /src/reference/forge-std/enumConversionError.md: -------------------------------------------------------------------------------- 1 | ## `enumConversionError` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | stdError.enumConversionError 7 | ``` 8 | 9 | ### Description 10 | 11 | The internal Solidity error when trying to convert a number to a variant of an enum, if the number is larger than the number of variants in the enum (counting from 0). -------------------------------------------------------------------------------- /src/reference/forge-std/fail.md: -------------------------------------------------------------------------------- 1 | ## `fail` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function fail(string memory err) internal virtual; 7 | ``` 8 | 9 | ### Description 10 | 11 | Fail a test with a message if a certain branch or execution point is hit. 12 | 13 | ### Examples 14 | 15 | ```solidity 16 | function test() external { 17 | for(uint256 place; place < 10; ++i){ 18 | if(game.leaderboard(place) == address(this)) return; 19 | } 20 | fail("Not in the top 10."); 21 | } 22 | ``` -------------------------------------------------------------------------------- /src/reference/forge-std/find.md: -------------------------------------------------------------------------------- 1 | ## `find` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function find(StdStorage storage self) internal returns (uint256); 7 | ``` 8 | 9 | ### Description 10 | 11 | Finds an arbitrary storage slot given [`target`](../forge-std/target.md), [`sig`](../forge-std/sig.md), [`with_key`](../forge-std/with_key.md)(s), and [`depth`](../forge-std/depth.md). 12 | 13 | Reverts with a message if unsuccessful. 14 | -------------------------------------------------------------------------------- /src/reference/forge-std/indexOOBError.md: -------------------------------------------------------------------------------- 1 | ## `indexOOBError` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | stdError.indexOOBError 7 | ``` 8 | 9 | ### Description 10 | 11 | The internal Solidity error when trying to access an element of an array that is out of bounds. 12 | 13 | Will not work for empty arrays in external contracts. For those, use `expectRevert` without any arguments. -------------------------------------------------------------------------------- /src/reference/forge-std/make-addr.md: -------------------------------------------------------------------------------- 1 | ## `makeAddr` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function makeAddr(string memory name) internal returns(address addr); 7 | ``` 8 | 9 | ### Description 10 | 11 | Creates an address derived from the provided `name`. 12 | 13 | A [`label`](../../cheatcodes/label.md) is created for the derived address with the provided `name` used as the label value. 14 | 15 | ### Examples 16 | 17 | ```solidity 18 | address alice = makeAddr("alice"); 19 | emit log_address(alice); // 0x328809bc894f92807417d2dad6b7c998c1afdac6 20 | ``` 21 | -------------------------------------------------------------------------------- /src/reference/forge-std/memOverflowError.md: -------------------------------------------------------------------------------- 1 | ## `memOverflowError` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | stdError.memOverflowError 7 | ``` 8 | 9 | ### Description 10 | 11 | The internal Solidity error when trying to allocate a dynamic memory array with more than 2^64-1 items. -------------------------------------------------------------------------------- /src/reference/forge-std/popError.md: -------------------------------------------------------------------------------- 1 | ## `popError` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | stdError.popError 7 | ``` 8 | 9 | ### Description 10 | 11 | The internal Solidity error when trying to pop an element off of an empty array. -------------------------------------------------------------------------------- /src/reference/forge-std/rewind.md: -------------------------------------------------------------------------------- 1 | ## `rewind` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function rewind(uint256 time) public; 7 | ``` 8 | 9 | ### Description 10 | 11 | Rewinds `block.timestamp` by the specified number of seconds. 12 | 13 | ### Examples 14 | 15 | ```solidity 16 | assertEq(block.timestamp, 3600); 17 | rewind(3600); 18 | assertEq(block.timestamp, 0); 19 | ``` 20 | -------------------------------------------------------------------------------- /src/reference/forge-std/script-utils.md: -------------------------------------------------------------------------------- 1 | ## Script Utils 2 | 3 | - [`computeCreateAddress`](./compute-create-address.md) 4 | - [`deriveRememberKey`](./derive-remember-key.md) 5 | -------------------------------------------------------------------------------- /src/reference/forge-std/skip.md: -------------------------------------------------------------------------------- 1 | ## `skip` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function skip(uint256 time) public; 7 | ``` 8 | 9 | ### Description 10 | 11 | Skips forward `block.timestamp` by the specified number of seconds. 12 | 13 | ### Examples 14 | 15 | ```solidity 16 | assertEq(block.timestamp, 0); 17 | skip(3600); 18 | assertEq(block.timestamp, 3600); 19 | ``` 20 | -------------------------------------------------------------------------------- /src/reference/forge-std/std-cheats.md: -------------------------------------------------------------------------------- 1 | ## Std Cheats 2 | 3 | - [`skip`](./skip.md) 4 | - [`rewind`](./rewind.md) 5 | - [`hoax`](./hoax.md) 6 | - [`startHoax`](./startHoax.md) 7 | - [`deal`](./deal.md) 8 | - [`deployCode`](./deployCode.md) 9 | - [`deployCodeTo`](./deployCodeTo.md) 10 | - [`bound`](./bound.md) 11 | - [`changePrank`](./change-prank.md) 12 | - [`makeAddr`](./make-addr.md) 13 | - [`makeAddrAndKey`](./make-addr-and-key.md) 14 | - [`noGasMetering`](./noGasMetering.md) 15 | -------------------------------------------------------------------------------- /src/reference/forge-std/std-errors.md: -------------------------------------------------------------------------------- 1 | ## Std Errors 2 | 3 | - [`assertionError`](./assertionError.md) 4 | - [`arithmeticError`](./arithmeticError.md) 5 | - [`divisionError`](./divisionError.md) 6 | - [`enumConversionError`](./enumConversionError.md) 7 | - [`encodeStorageError`](./encodeStorageError.md) 8 | - [`popError`](./popError.md) 9 | - [`indexOOBError`](./indexOOBError.md) 10 | - [`memOverflowError`](./memOverflowError.md) 11 | - [`zeroVarError`](./zeroVarError.md) -------------------------------------------------------------------------------- /src/reference/forge-std/std-math.md: -------------------------------------------------------------------------------- 1 | ## Std Math 2 | 3 | - [`abs`](./abs.md) 4 | - [`delta`](./delta.md) 5 | - [`percentDelta`](./percentDelta.md) -------------------------------------------------------------------------------- /src/reference/forge-std/target.md: -------------------------------------------------------------------------------- 1 | ## `target` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | function target(StdStorage storage self, address _target) internal returns (StdStorage storage); 7 | ``` 8 | 9 | ### Description 10 | 11 | Sets the address of the contract. 12 | 13 | Default value: `address(0)` -------------------------------------------------------------------------------- /src/reference/forge-std/zeroVarError.md: -------------------------------------------------------------------------------- 1 | ## `zeroVarError` 2 | 3 | ### Signature 4 | 5 | ```solidity 6 | stdError.zeroVarError 7 | ``` 8 | 9 | ### Description 10 | 11 | The internal Solidity error when trying to call a function via a function pointer that has not been initialized. -------------------------------------------------------------------------------- /src/reference/forge/README.md: -------------------------------------------------------------------------------- 1 | ## forge Commands 2 | 3 | - [General Commands](./general-commands.md) 4 | - [Project Commands](./project-commands.md) 5 | - [Build Commands](./build-commands.md) 6 | - [Test Commands](./test-commands.md) 7 | - [Deploy Commands](./deploy-commands.md) 8 | - [Utility Commands](./utility-commands.md) 9 | -------------------------------------------------------------------------------- /src/reference/forge/build-commands.md: -------------------------------------------------------------------------------- 1 | ## Build Commands 2 | 3 | - [forge build](./forge-build.md) 4 | - [forge clean](./forge-clean.md) 5 | - [forge inspect](./forge-inspect.md) 6 | -------------------------------------------------------------------------------- /src/reference/forge/common-options.md: -------------------------------------------------------------------------------- 1 | #### Common Options 2 | 3 | `-h` 4 | `--help` 5 |     Prints help information. 6 | -------------------------------------------------------------------------------- /src/reference/forge/deploy-commands.md: -------------------------------------------------------------------------------- 1 | ## Deploy Commands 2 | 3 | - [forge create](./forge-create.md) 4 | - [forge verify-contract](./forge-verify-contract.md) 5 | - [forge verify-check](./forge-verify-check.md) 6 | - [forge flatten](./forge-flatten.md) 7 | -------------------------------------------------------------------------------- /src/reference/forge/forge-help.md: -------------------------------------------------------------------------------- 1 | ## forge help 2 | 3 | ### NAME 4 | 5 | forge-help - Get help for a Forge command 6 | 7 | ### SYNOPSIS 8 | 9 | ``forge help`` [*subcommand*] 10 | 11 | ### DESCRIPTION 12 | 13 | Prints a help message for the given command. 14 | 15 | ### EXAMPLES 16 | 17 | 1. Get help for a command: 18 | ```sh 19 | forge help build 20 | ``` 21 | 22 | 2. Help is also available with the `--help` flag: 23 | ```sh 24 | forge build --help 25 | ``` 26 | 27 | ### SEE ALSO 28 | 29 | [forge](./forge.md) 30 | -------------------------------------------------------------------------------- /src/reference/forge/general-commands.md: -------------------------------------------------------------------------------- 1 | ## General Commands 2 | 3 | - [forge](./forge.md) 4 | - [forge help](./forge-help.md) 5 | - [forge completions](./forge-completions.md) 6 | -------------------------------------------------------------------------------- /src/reference/forge/project-commands.md: -------------------------------------------------------------------------------- 1 | ## Project Commands 2 | 3 | - [forge init](./forge-init.md) 4 | - [forge clone](./forge-clone.md) 5 | - [forge install](./forge-install.md) 6 | - [forge update](./forge-update.md) 7 | - [forge remove](./forge-remove.md) 8 | - [forge config](./forge-config.md) 9 | - [forge remappings](./forge-remappings.md) 10 | - [forge tree](./forge-tree.md) 11 | - [forge geiger](./forge-geiger.md) 12 | -------------------------------------------------------------------------------- /src/reference/forge/test-commands.md: -------------------------------------------------------------------------------- 1 | ## Test Commands 2 | 3 | - [forge test](./forge-test.md) 4 | - [forge snapshot](./forge-snapshot.md) 5 | - [forge coverage](./forge-coverage.md) 6 | -------------------------------------------------------------------------------- /src/reference/forge/utility-commands.md: -------------------------------------------------------------------------------- 1 | ## Utility Commands 2 | 3 | - [forge debug](./forge-debug.md) 4 | - [forge bind](./forge-bind.md) 5 | - [forge cache](./forge-cache.md) 6 | - [forge cache clean](./forge-cache-clean.md) 7 | - [forge cache ls](./forge-cache-ls.md) 8 | - [forge script](./forge-script.md) 9 | - [forge upload-selectors](./forge-upload-selectors.md) 10 | - [forge doc](./forge-doc.md) 11 | -------------------------------------------------------------------------------- /theme/card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/theme/card.png -------------------------------------------------------------------------------- /theme/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/theme/favicon.png -------------------------------------------------------------------------------- /theme/head.hbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /translations/projects/README.md: -------------------------------------------------------------------------------- 1 | ## Projects 2 | 3 | These projects are used to auto-generate CLI output, and for source snippets, throughout the book. 4 | -------------------------------------------------------------------------------- /translations/projects/cheatcodes/foundry.toml: -------------------------------------------------------------------------------- 1 | [profile.default] 2 | src = 'src' 3 | out = 'out' 4 | libs = ['lib'] 5 | 6 | # See more config options https://github.com/gakonst/foundry/tree/master/config -------------------------------------------------------------------------------- /translations/projects/fuzz_testing/foundry.toml: -------------------------------------------------------------------------------- 1 | [profile.default] 2 | src = 'src' 3 | out = 'out' 4 | libs = ['lib'] 5 | 6 | # See more config options https://github.com/gakonst/foundry/tree/master/config -------------------------------------------------------------------------------- /translations/projects/test_filters/foundry.toml: -------------------------------------------------------------------------------- 1 | [profile.default] 2 | src = 'src' 3 | out = 'out' 4 | libs = ['lib'] 5 | 6 | # See more config options https://github.com/gakonst/foundry/tree/master/config -------------------------------------------------------------------------------- /translations/projects/test_filters/test/ComplicatedContract.t.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: UNLICENSED 2 | pragma solidity 0.8.10; 3 | 4 | import {Test} from "forge-std/Test.sol"; 5 | 6 | contract ComplicatedContractTest is Test { 7 | function test_DepositERC20() public pure { 8 | // waste some gas for display purposes 9 | for (uint256 i = 1000; i > 0; i--) {} 10 | } 11 | 12 | function test_DepositETH() public pure { 13 | // waste some gas for display purposes 14 | for (uint256 i = 600; i > 0; i--) {} 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /translations/projects/test_filters/test/ContractB.t.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: UNLICENSED 2 | pragma solidity 0.8.10; 3 | 4 | import {Test} from "forge-std/Test.sol"; 5 | 6 | contract ContractBTest is Test { 7 | function testExample() public { 8 | assertTrue(true); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /translations/projects/writing_tests/foundry.toml: -------------------------------------------------------------------------------- 1 | [profile.default] 2 | src = 'src' 3 | out = 'out' 4 | libs = ['lib'] 5 | 6 | # See more config options https://github.com/gakonst/foundry/tree/master/config -------------------------------------------------------------------------------- /translations/zh/anvil/anvil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/translations/zh/anvil/anvil.png -------------------------------------------------------------------------------- /translations/zh/cheatcodes/addr.md: -------------------------------------------------------------------------------- 1 | ## `addr` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function addr(uint256 privateKey) external returns (address); 7 | ``` 8 | 9 | ### 描述 10 | 11 | 计算给定私钥的地址。 12 | 13 | ### 例子 14 | 15 | ```solidity 16 | address alice = vm.addr(1); 17 | emit log_address(alice); // 0x7e5f4552091a69125d5dfcb7b8c2659029395bdf 18 | ``` -------------------------------------------------------------------------------- /translations/zh/cheatcodes/allow-cheatcodes.md: -------------------------------------------------------------------------------- 1 | ## `allowCheatcodes` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function allowCheatcodes(address) external; 7 | ``` 8 | 9 | ### 描述 10 | 11 | 在分叉模式下,显式授予给定地址作弊码访问权限。 12 | 13 | 默认情况下,测试合约及其部署者被允许访问作弊码。除此之外,如果合约是由已经具有作弊码访问权限的地址部署的,则会授予作弊码访问权限。 14 | 这将阻止已在分叉网络上部署的帐户访问作弊码。 15 | 16 | > ℹ️ **注意** 17 | > 18 | > 这仅对分叉模式下复杂的测试设置有用。 -------------------------------------------------------------------------------- /translations/zh/cheatcodes/assertions.md: -------------------------------------------------------------------------------- 1 | ## Assertions 2 | 3 | - [`expectRevert`](./expect-revert.md) 4 | - [`expectEmit`](./expect-emit.md) 5 | - [`expectCall`](./expect-call.md) 6 | -------------------------------------------------------------------------------- /translations/zh/cheatcodes/chain-id.md: -------------------------------------------------------------------------------- 1 | ## `chainId` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function chainId(uint256) external; 7 | ``` 8 | 9 | ### 描述 10 | 11 | 设置 `block.chainid`. 12 | 13 | ### 例子 14 | 15 | ```solidity 16 | vm.chainId(31337); 17 | emit log_uint(block.chainid); // 31337 18 | ``` 19 | -------------------------------------------------------------------------------- /translations/zh/cheatcodes/clear-mocked-calls.md: -------------------------------------------------------------------------------- 1 | ## `clearMockedCalls` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function clearMockedCalls() external; 7 | ``` 8 | 9 | ### 描述 10 | 11 | 清除所有 [mocked calls](./mock-call.md). 12 | -------------------------------------------------------------------------------- /translations/zh/cheatcodes/coinbase.md: -------------------------------------------------------------------------------- 1 | ## `coinbase` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function coinbase(address) external; 7 | ``` 8 | 9 | ### 描述 10 | 11 | 设置 `block.coinbase`. 12 | 13 | ### 例子 14 | 15 | ```solidity 16 | emit log_address(block.coinbase); // 0x0000000000000000000000000000000000000000 17 | vm.coinbase(0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8); 18 | emit log_address(block.coinbase); // 0xea674fdde714fd979de3edf0f56aa9716b898ec8 19 | ``` -------------------------------------------------------------------------------- /translations/zh/cheatcodes/difficulty.md: -------------------------------------------------------------------------------- 1 | ## `difficulty` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function difficulty(uint256) external; 7 | ``` 8 | 9 | ### 描述 10 | 11 | 设置 `block.difficulty`. 12 | 13 | 如果与后合并的 EVM 版本(从巴黎版本开始)一起使用,它将会回滚。在这种情况下,请改用[`vm.prevrandao`][prevrandao]。 14 | 15 | ### 例子 16 | 17 | ```solidity 18 | vm.difficulty(25); 19 | emit log_uint(block.difficulty); // 25 20 | ``` 21 | 22 | [prevrandao]: ./prevrandao.md -------------------------------------------------------------------------------- /translations/zh/cheatcodes/fee.md: -------------------------------------------------------------------------------- 1 | ## `fee` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function fee(uint256) external; 7 | ``` 8 | 9 | ### 描述 10 | 11 | 设置 `block.basefee`. 12 | 13 | ### 例子 14 | 15 | ```solidity 16 | vm.fee(25 gwei); 17 | emit log_uint(block.basefee); // 25000000000 18 | ``` 19 | -------------------------------------------------------------------------------- /translations/zh/cheatcodes/forking.md: -------------------------------------------------------------------------------- 1 | ## Forking 2 | 3 | - [`createFork`](./create-fork.md) 4 | - [`selectFork`](./select-fork.md) 5 | - [`createSelectFork`](./create-select-fork.md) 6 | - [`activeFork`](./active-fork.md) 7 | - [`rollFork`](./roll-fork.md) 8 | - [`makePersistent`](./make-persistent.md) 9 | - [`revokePersistent`](./revoke-persistent.md) 10 | - [`isPersistent`](./is-persistent.md) 11 | - [`allowCheatcodes`](./allow-cheatcodes.md) 12 | - [`transact`](./transact.md) 13 | -------------------------------------------------------------------------------- /translations/zh/cheatcodes/fuzzer.md: -------------------------------------------------------------------------------- 1 | ## Fuzzer 2 | 3 | - [`assume`](./assume.md) 4 | - [`assumeNoRevert`](./assume-no-revert.md) 5 | -------------------------------------------------------------------------------- /translations/zh/cheatcodes/get-label.md: -------------------------------------------------------------------------------- 1 | ## `getLabel` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function getLabel(address) external returns (string memory); 7 | ``` 8 | 9 | ### 描述 10 | 11 | 如果之前已经对地址进行了标记,则检索该地址的标签。如果没有,则返回带有 `unlabeled:` 前缀的地址。 12 | -------------------------------------------------------------------------------- /translations/zh/cheatcodes/key-exists-json.md: -------------------------------------------------------------------------------- 1 | ## `keyExistsJson` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | // Check if a key exists in a JSON string. 7 | vm.keyExistsJson(string memory json, string memory key) returns (bool) 8 | ``` 9 | 10 | ### 描述 11 | 12 | 检查一个键是否存在于 JSON 字符串中。 13 | 14 | ### 示例 15 | 16 | ```solidity 17 | string memory path = "./path/to/jsonfile.json"; 18 | string memory json = vm.readFile(path); 19 | bool exists = vm.keyExistsJson(json, ".key"); 20 | assertTrue(exists); 21 | ``` -------------------------------------------------------------------------------- /translations/zh/cheatcodes/key-exists-toml.md: -------------------------------------------------------------------------------- 1 | ## `keyExistsToml` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | // 检查 TOML 表格中是否存在某个键。 7 | vm.keyExistsToml(string memory toml, string memory key) returns (bool) 8 | ``` 9 | 10 | ### 描述 11 | 12 | 检查一个键是否存在于 TOML 表中。 13 | 14 | ### 示例 15 | 16 | ```solidity 17 | string memory path = "./path/to/tomlfile.toml"; 18 | string memory toml = vm.readFile(path); 19 | bool exists = vm.keyExistsToml(toml, ".key"); 20 | assertTrue(exists); 21 | ``` -------------------------------------------------------------------------------- /translations/zh/cheatcodes/key-exists.md: -------------------------------------------------------------------------------- 1 | ## `keyExists` 2 | 3 | ### Status 4 | 5 | `keyExists` 正在被弃用,建议使用 `keyExistsJson`。它将在未来的版本中被移除。 6 | 7 | ### 签名 8 | 9 | ```solidity 10 | // 检查 JSON 字符串中是否存在键。 11 | vm.keyExists(string memory json, string memory key) returns (bool) 12 | ``` 13 | 14 | ### 描述 15 | 16 | 检查 JSON 字符串中是否存在键。 17 | 18 | ### 例子 19 | 20 | ```solidity 21 | string memory path = "./path/to/jsonfile.json"; 22 | string memory json = vm.readFile(path); 23 | bool exists = vm.keyExists(json, ".key"); 24 | assertTrue(exists); 25 | ``` 26 | -------------------------------------------------------------------------------- /translations/zh/cheatcodes/label.md: -------------------------------------------------------------------------------- 1 | ## `label` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function label(address addr, string calldata label) external; 7 | ``` 8 | 9 | ### 描述 10 | 11 | 在测试跟踪中为 `addr` 设置标签 `label`。 12 | 13 | 如果一个地址被标记,标签将显示在测试跟踪中,而不是地址。 -------------------------------------------------------------------------------- /translations/zh/cheatcodes/parse-address.md: -------------------------------------------------------------------------------- 1 | ## `parseAddress` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function parseAddress(string calldata stringifiedValue) external pure returns (address parsedValue); 7 | ``` 8 | 9 | ### 描述 10 | 11 | 将`string`的值解析为`address` 12 | 13 | ### 例子 14 | 15 | ```solidity 16 | string memory addressAsString = "0x0000000000000000000000000000000000000000"; 17 | address stringToAddress = vm.parseAddress(addressAsString); // 0x0000000000000000000000000000000000000000 18 | ``` -------------------------------------------------------------------------------- /translations/zh/cheatcodes/parse-bool.md: -------------------------------------------------------------------------------- 1 | ## `parseBool` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function parseBool(string calldata stringifiedValue) external pure returns (bool parsedValue); 7 | ``` 8 | 9 | ### 描述 10 | 11 | 将 `string` 的值解析为 `bool` 12 | 13 | ### 例子 14 | 15 | ```solidity 16 | string memory boolAsString = "false"; 17 | bool stringToBool = vm.parseBool(boolAsString); // false 18 | ``` -------------------------------------------------------------------------------- /translations/zh/cheatcodes/parse-bytes.md: -------------------------------------------------------------------------------- 1 | ## `parseBytes` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function parseBytes(string calldata stringifiedValue) external pure returns (bytes memory parsedValue); 7 | ``` 8 | 9 | ### 描述 10 | 11 | 将 `string` 的值解析为 `bytes` 12 | 13 | ### 例子 14 | 15 | ```solidity 16 | string memory bytesAsString = "0x00000000000000000000000000000000"; 17 | bytes memory stringToBytes = vm.parseBytes(bytesAsString); // 0x00000000000000000000000000000000 18 | 19 | ``` 20 | -------------------------------------------------------------------------------- /translations/zh/cheatcodes/parse-bytes32.md: -------------------------------------------------------------------------------- 1 | ## `parseBytes32` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function parseBytes32(string calldata stringifiedValue) external pure returns (bytes32 parsedValue); 7 | ``` 8 | 9 | ### 描述 10 | 11 | 将 `string` 的值解析为 `bytes32` 12 | 13 | ### 例子 14 | 15 | ```solidity 16 | string memory bytes32AsString = "0x0000000000000000000000000000000000000000000000000000000000000000"; 17 | bytes32 stringToBytes32 = vm.parseBytes32(bytes32AsString); // 0x0000000000000000000000000000000000000000000000000000000000000000 18 | ``` -------------------------------------------------------------------------------- /translations/zh/cheatcodes/parse-int.md: -------------------------------------------------------------------------------- 1 | ## `parseInt` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function parseInt(string calldata stringifiedValue) external pure returns (int256 parsedValue); 7 | ``` 8 | 9 | ### 描述 10 | 11 | 将 `string` 的值解析为 `int256` 12 | 13 | ### 例子 14 | 15 | ```solidity 16 | string memory intAsString = "-12345"; 17 | int256 stringToInt = vm.parseInt(intAsString); // -12345 18 | ``` -------------------------------------------------------------------------------- /translations/zh/cheatcodes/parse-uint.md: -------------------------------------------------------------------------------- 1 | ## `parseUint` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function parseUint(string calldata stringifiedValue) external pure returns (uint256 parsedValue); 7 | ``` 8 | 9 | ### 描述 10 | 11 | 将 `string` 的值解析为 `uint256` 12 | 13 | ### 例子 14 | 15 | ```solidity 16 | string memory uintAsString = "12345"; 17 | uint256 stringToUint = vm.parseUint(uintAsString); // 12345 18 | ``` 19 | -------------------------------------------------------------------------------- /translations/zh/cheatcodes/pause-gas-metering.md: -------------------------------------------------------------------------------- 1 | ## `pauseGasMetering` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function pauseGasMetering() external; 7 | ``` 8 | 9 | ### 描述 10 | 11 | 暂停 gas 计量(即 `gasleft()` 在执行操作时不会减少)。 12 | 13 | 这对于更好地了解 gas 成本很有用,可以通过关闭不必要的代码的 gas 计量,以及长时间运行的脚本,否则会耗尽 gas。 14 | 15 | > ℹ️ **注意** 16 | > 17 | > `pauseGasMetering` *关闭了来自计量 gas 使用的 DoS 保护*。 18 | > 19 | > 暴露一个假设特定 EVM 实例将由于 gas 使用而完成的服务不再成立,这种情况下应该启用超时。 -------------------------------------------------------------------------------- /translations/zh/cheatcodes/prevrandao.md: -------------------------------------------------------------------------------- 1 | ## `prevrandao` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function prevrandao(bytes32) external; 7 | ``` 8 | 9 | ### 描述 10 | 11 | 设置 `block.prevrandao`。 12 | 13 | 如果与 Paris 硬分叉之前的 EVM 版本一起使用,它将 revert。在这种情况下,改用 [`vm.difficulty`][prevrandao]。 14 | 15 | ### 例子 16 | 17 | ```solidity 18 | vm.prevrandao(bytes32(uint256(42))); 19 | emit log_uint(block.prevrandao); // 42 20 | ``` 21 | 22 | [prevrandao]: ./difficulty.md {/try-react/} -------------------------------------------------------------------------------- /translations/zh/cheatcodes/project-root.md: -------------------------------------------------------------------------------- 1 | ## `projectRoot` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function projectRoot() external returns (string memory); 7 | ``` 8 | 9 | ### 描述 10 | 11 | 返回当前 Foundry 项目的根目录。 12 | -------------------------------------------------------------------------------- /translations/zh/cheatcodes/reset-gas-metering.md: -------------------------------------------------------------------------------- 1 | ## `resetGasMetering` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function resetGasMetering() external; 7 | ``` 8 | 9 | ### 描述 10 | 11 | 将 gas 计量重置为当前执行帧的 gas 限制(即 `gasleft()` 将恢复为初始值)。 -------------------------------------------------------------------------------- /translations/zh/cheatcodes/resume-gas-metering.md: -------------------------------------------------------------------------------- 1 | ## `resumeGasMetering` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function resumeGasMetering() external; 7 | ``` 8 | 9 | ### 描述 10 | 11 | 恢复 Gas 计量(即 `gasleft()` 会随着操作的执行而减少)。Gas 使用量将在暂停时的相同数量上恢复。 -------------------------------------------------------------------------------- /translations/zh/cheatcodes/roll.md: -------------------------------------------------------------------------------- 1 | ## `roll` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function roll(uint256) external; 7 | ``` 8 | 9 | ### 描述 10 | 11 | 设置Sets `block.number`. 12 | 13 | ### 例子 14 | 15 | ```solidity 16 | vm.roll(100); 17 | emit log_uint(block.number); // 100 18 | ``` 19 | 20 | ### 另请参阅 21 | 22 | - [rollFork](./roll-fork.md) 23 | -------------------------------------------------------------------------------- /translations/zh/cheatcodes/select-fork.md: -------------------------------------------------------------------------------- 1 | ## `selectFork` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function selectFork(uint256 forkId) external; 7 | ``` 8 | 9 | ### 描述 10 | 11 | 使用 `createFork` 创建的分叉标识符,并将相应的分叉状态设置为活动状态。 12 | 13 | ### 例子 14 | 15 | 选择先前创建的分叉: 16 | 17 | ```solidity 18 | uint256 forkId = vm.createFork(MAINNET_RPC_URL); 19 | 20 | vm.selectFork(forkId); 21 | 22 | assertEq(vm.activeFork(), forkId); 23 | ``` 24 | 25 | ### 另请参阅 26 | 27 | - [createFork](./create-fork.md) 28 | - [activeFork](./active-fork.md) 29 | -------------------------------------------------------------------------------- /translations/zh/cheatcodes/set-nonce.md: -------------------------------------------------------------------------------- 1 | ## `setNonce` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function setNonce(address account, uint64 nonce) external; 7 | ``` 8 | 9 | ### 描述 10 | 11 | 设置给定账户的 nonce。 12 | 13 | 新的 nonce 必须高于账户当前的 nonce。 14 | 15 | ### 例子 16 | 17 | ```solidity 18 | vm.setNonce(address(100), 1234); 19 | ``` 20 | -------------------------------------------------------------------------------- /translations/zh/cheatcodes/sleep.md: -------------------------------------------------------------------------------- 1 | ## `sleep` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function sleep(uint256 milliseconds) external; 7 | ``` 8 | 9 | ### 描述 10 | 11 | 休眠指定的毫秒数。 12 | 13 | ### 例子 14 | 15 | ```solidity 16 | vm.sleep(10_000); // 暂停执行 10 秒钟 17 | ``` 18 | 19 | -------------------------------------------------------------------------------- /translations/zh/cheatcodes/start-prank.md: -------------------------------------------------------------------------------- 1 | ## `startPrank` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function startPrank(address) external; 7 | ``` 8 | 9 | ```solidity 10 | function startPrank(address sender, address origin) external; 11 | ``` 12 | 13 | ### 描述 14 | 15 | 设置 `msg.sender` **用于所有后续调用**,直到调用 [`stopPrank`](./stop-prank.md) 为止。 16 | 17 | 如果使用了 `startPrank` 的另一种签名,则还会为所有后续调用设置 `tx.origin`。 18 | 19 | ### 另请参阅 20 | 21 | Forge 标准库 22 | 23 | [`startHoax`](../reference/forge-std/startHoax.md), [`changePrank`](../reference/forge-std/change-prank.md) 24 | -------------------------------------------------------------------------------- /translations/zh/cheatcodes/start-state-diff-recording.md: -------------------------------------------------------------------------------- 1 | ## `startStateDiffRecording` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function startStateDiffRecording() 7 | ``` 8 | 9 | ### 描述 10 | 11 | 记录所有状态更改作为 CREATE、CALL 或 SELFDESTRUCT 操作码的一部分,以及调用的上下文。 12 | 有关如何访问和解释记录的状态更改的更多详细信息,请参阅 [`stopAndReturnStateDiff`](./stop-and-return-state-diff.md)。 -------------------------------------------------------------------------------- /translations/zh/cheatcodes/stop-broadcast.md: -------------------------------------------------------------------------------- 1 | ## `stopBroadcast` 2 | 3 | ### 签名 4 | ```solidity 5 | function stopBroadcast() external; 6 | ``` 7 | 8 | ### 描述 9 | 10 | 停止收集交易以便稍后在链上广播。 11 | 12 | ### 例子 13 | 14 | ```solidity 15 | function deployNoArgs() public { 16 | // broadcast the next call 17 | cheats.broadcast(); 18 | Test test1 = new Test(); 19 | 20 | // broadcast all calls between this line and `stopBroadcast` 21 | cheats.startBroadcast(); 22 | Test test2 = new Test(); 23 | cheats.stopBroadcast(); 24 | } 25 | ``` -------------------------------------------------------------------------------- /translations/zh/cheatcodes/stop-prank.md: -------------------------------------------------------------------------------- 1 | ## `stopPrank` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function stopPrank() external; 7 | ``` 8 | 9 | ### 描述 10 | 11 | 停止由 [`startPrank`](./start-prank.md) 启动的活动 Prank,将 `msg.sender` 和 `tx.origin` 重置为调用 `startPrank` 之前的值。 -------------------------------------------------------------------------------- /translations/zh/cheatcodes/unix-time.md: -------------------------------------------------------------------------------- 1 | ## `unixTime` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function unixTime() external returns (uint milliseconds); 7 | ``` 8 | 9 | ### 描述 10 | 11 | 以毫秒为单位返回自 Unix 纪元以来的时间。 12 | 13 | ### 例子 14 | 15 | ```solidity 16 | uint start = vm.unixTime(); 17 | vm.sleep(10_000); // 暂停执行 10 秒钟 18 | uint end = vm.unixTime(); 19 | assertEq(end - start, 10_000); 20 | ``` 21 | 22 | -------------------------------------------------------------------------------- /translations/zh/cheatcodes/utilities.md: -------------------------------------------------------------------------------- 1 | ## Utilities 2 | 3 | - [`addr`](./addr.md) 4 | - [`sign`](./sign.md) 5 | - [`label`](./label.md) 6 | - [`getLabel`](./get-label.md) 7 | - [`deriveKey`](./derive-key.md) 8 | - [`rememberKey`](./remember-key.md) 9 | - [`toString`](./to-string.md) 10 | - [`breakpoint`](./breakpoint.md) 11 | - [`createWallet`](./create-wallet.md) 12 | - [`copyStorage`](./copy-storage.md) 13 | - [`setArbitraryStorage`](./set-arbitrary-storage.md) -------------------------------------------------------------------------------- /translations/zh/cheatcodes/warp.md: -------------------------------------------------------------------------------- 1 | ## `warp` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function warp(uint256) external; 7 | ``` 8 | 9 | ### 描述 10 | 11 | 设置 `block.timestamp`. 12 | 13 | ### 例子 14 | 15 | ```solidity 16 | vm.warp(1641070800); 17 | emit log_uint(block.timestamp); // 1641070800 18 | ``` 19 | 20 | ### 另请参阅 21 | 22 | Forge 标准库 23 | 24 | [`skip`](../reference/forge-std/skip.md), [`rewind`](../reference/forge-std/rewind.md) -------------------------------------------------------------------------------- /translations/zh/forge/README.md: -------------------------------------------------------------------------------- 1 | ## Forge 概述 2 | 3 | Forge 是 `Foundry` 附带的命令行工具。 Forge 可用来测试、构建和部署你的智能合约。 4 | -------------------------------------------------------------------------------- /translations/zh/forge/advanced-testing.md: -------------------------------------------------------------------------------- 1 | ## 高级测试 2 | 3 | Forge 带有许多高级测试方法: 4 | 5 | - [模糊测试(Fuzz Testing)](./fuzz-testing.md) 6 | - [不变量测试(Invariant Testing)](./invariant-testing.md) 7 | - [差异测试(Differential Testing)](./differential-ffi-testing.md) 8 | 9 | 未来,Forge 还将支持这些: 10 | 11 | - [Symbolic Execution](#) 12 | - [Mutation Testing](#) 13 | 14 | 每一章都深入探讨了测试方法解决了什么问题,以及如何将它们应用到你自己的项目中。 -------------------------------------------------------------------------------- /translations/zh/forge/gas-section-snapshots.md: -------------------------------------------------------------------------------- 1 | # Gas 部分快照 2 | 3 | Forge 可以在测试函数内部的任意部分捕获 gas 快照。这对于精确测量你的逻辑消耗了多少 gas 非常有用,因为外部调用和内部 gas 使用都会被测量。 4 | 5 | 你可以在测试中使用 `snapshotGas` [作弊代码](./cheatcodes.md) 来捕获 gas 使用,而不是运行像 `forge snapshot` 或 `forge test --gas-report` 这样的命令,如下所示: 6 | 7 | {{#include ../cheatcodes/gas-snapshots.md}} -------------------------------------------------------------------------------- /translations/zh/images/breakpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/translations/zh/images/breakpoint.png -------------------------------------------------------------------------------- /translations/zh/images/debugger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/translations/zh/images/debugger.png -------------------------------------------------------------------------------- /translations/zh/images/foundry-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/translations/zh/images/foundry-banner.png -------------------------------------------------------------------------------- /translations/zh/images/fuzzer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/translations/zh/images/fuzzer.png -------------------------------------------------------------------------------- /translations/zh/images/nft-tutorial/gas-report-oz-nft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/translations/zh/images/nft-tutorial/gas-report-oz-nft.png -------------------------------------------------------------------------------- /translations/zh/images/nft-tutorial/gas-report-solmate-nft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/translations/zh/images/nft-tutorial/gas-report-solmate-nft.png -------------------------------------------------------------------------------- /translations/zh/images/nft-tutorial/nft-tutorial-project-structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/translations/zh/images/nft-tutorial/nft-tutorial-project-structure.png -------------------------------------------------------------------------------- /translations/zh/images/solidity-scripting/compile-successful.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/translations/zh/images/solidity-scripting/compile-successful.png -------------------------------------------------------------------------------- /translations/zh/images/solidity-scripting/contract-verified.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/translations/zh/images/solidity-scripting/contract-verified.png -------------------------------------------------------------------------------- /translations/zh/images/solidity-scripting/set-up-commands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lbc-team/foundry-book-in-chinese/3bfb91aa6716de9d8ee6411753d46e7e98b7a66f/translations/zh/images/solidity-scripting/set-up-commands.png -------------------------------------------------------------------------------- /translations/zh/misc/README.md: -------------------------------------------------------------------------------- 1 | ## 其他 2 | 3 | - [结构编码](./struct-encoding.md) -------------------------------------------------------------------------------- /translations/zh/output/cast/cast-4byte-decode: -------------------------------------------------------------------------------- 1 | // ANCHOR: all 2 | // ANCHOR: command 3 | $ cast 4byte-decode 0x1F1F897F676d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003e7 4 | // ANCHOR_END: command 5 | // ANCHOR: output 6 | 1) "fulfillRandomness(bytes32,uint256)" 7 | 0x676d000000000000000000000000000000000000000000000000000000000000 8 | 999 9 | // ANCHOR_END: output 10 | // ANCHOR_END: all 11 | -------------------------------------------------------------------------------- /translations/zh/output/cast/cast-call: -------------------------------------------------------------------------------- 1 | // ANCHOR: all 2 | // ANCHOR: command 3 | $ cast call 0x6b175474e89094c44da98b954eedeac495271d0f "totalSupply()(uint256)" --rpc-url https://eth-mainnet.alchemyapi.io/v2/Lc7oIGYeL_QvInzI0Wiu_pOZZDEKBrdf 4 | // ANCHOR_END: command 5 | // ANCHOR: output 6 | 3369748004762949875806510626 [3.369e27] 7 | // ANCHOR_END: output 8 | // ANCHOR_END: all 9 | -------------------------------------------------------------------------------- /translations/zh/output/deps/forge-install: -------------------------------------------------------------------------------- 1 | // ANCHOR: all 2 | // ANCHOR: command 3 | $ forge install transmissions11/solmate 4 | // ANCHOR_END: command 5 | // ANCHOR: output 6 | Installing solmate in /tmp/tmp.M8AZj8msD3/deps/lib/solmate (url: Some("https://github.com/transmissions11/solmate"), tag: None) 7 | Installed solmate 8 | // ANCHOR_END: output 9 | // ANCHOR_END: all 10 | -------------------------------------------------------------------------------- /translations/zh/output/deps/forge-remappings: -------------------------------------------------------------------------------- 1 | // ANCHOR: all 2 | // ANCHOR: command 3 | $ forge remappings 4 | // ANCHOR_END: command 5 | // ANCHOR: output 6 | ds-test/=lib/solmate/lib/ds-test/src/ 7 | forge-std/=lib/forge-std/src/ 8 | solmate/=lib/solmate/src/ 9 | weird-erc20/=lib/weird-erc20/src/ 10 | // ANCHOR_END: output 11 | // ANCHOR_END: all 12 | -------------------------------------------------------------------------------- /translations/zh/output/deps/tree: -------------------------------------------------------------------------------- 1 | // ANCHOR: all 2 | // ANCHOR: command 3 | $ tree lib -L 1 4 | // ANCHOR_END: command 5 | // ANCHOR: output 6 | lib 7 | ├── forge-std 8 | ├── solmate 9 | └── weird-erc20 10 | 11 | 3 directories, 0 files 12 | // ANCHOR_END: output 13 | // ANCHOR_END: all 14 | -------------------------------------------------------------------------------- /translations/zh/output/foundry-template/forge-build: -------------------------------------------------------------------------------- 1 | // ANCHOR: all 2 | // ANCHOR: command 3 | $ forge build 4 | // ANCHOR_END: command 5 | // ANCHOR: output 6 | Compiling 28 files with Solc 0.8.25 7 | Solc 0.8.25 finished in 1.32s 8 | Compiler run successful! 9 | // ANCHOR_END: output 10 | // ANCHOR_END: all 11 | -------------------------------------------------------------------------------- /translations/zh/output/foundry-template/forge-install: -------------------------------------------------------------------------------- 1 | // ANCHOR: all 2 | // ANCHOR: command 3 | $ forge install 4 | // ANCHOR_END: command 5 | // ANCHOR: output 6 | 7 | // ANCHOR_END: output 8 | // ANCHOR_END: all 9 | -------------------------------------------------------------------------------- /translations/zh/output/hello_foundry/forge-build: -------------------------------------------------------------------------------- 1 | // ANCHOR: all 2 | // ANCHOR: command 3 | $ forge build 4 | // ANCHOR_END: command 5 | // ANCHOR: output 6 | Compiling 27 files with Solc 0.8.19 7 | Solc 0.8.19 finished in 1.08s 8 | Compiler run successful! 9 | // ANCHOR_END: output 10 | // ANCHOR_END: all 11 | -------------------------------------------------------------------------------- /translations/zh/output/hello_foundry/forge-init: -------------------------------------------------------------------------------- 1 | // ANCHOR: all 2 | // ANCHOR: command 3 | $ forge init hello_foundry 4 | // ANCHOR_END: command 5 | // ANCHOR: output 6 | Initializing /tmp/tmp.tFO8NOfTBW/hello_foundry... 7 | Installing forge-std in /tmp/tmp.tFO8NOfTBW/hello_foundry/lib/forge-std (url: Some("https://github.com/foundry-rs/forge-std"), tag: None) 8 | Installed forge-std v1.9.3 9 | Initialized forge project 10 | // ANCHOR_END: output 11 | // ANCHOR_END: all 12 | -------------------------------------------------------------------------------- /translations/zh/output/hello_foundry/tree: -------------------------------------------------------------------------------- 1 | // ANCHOR: all 2 | // ANCHOR: command 3 | $ tree . -d -L 1 4 | // ANCHOR_END: command 5 | // ANCHOR: output 6 | . 7 | ├── lib 8 | ├── script 9 | ├── src 10 | └── test 11 | 12 | 4 directories 13 | // ANCHOR_END: output 14 | // ANCHOR_END: all 15 | -------------------------------------------------------------------------------- /translations/zh/reference/README.md: -------------------------------------------------------------------------------- 1 | ## References 2 | 3 | - [CLI Reference](./cli/) 4 | - [forge Commands](./forge/) 5 | - [cast Commands](./cast/) 6 | - [anvil Reference](./anvil/) 7 | - [chisel Reference](./chisel/) 8 | - [Config Reference](./config/) 9 | - [Cheatcodes Reference](../cheatcodes/) 10 | - [Forge Standard Library Reference](./forge-std) 11 | - [ds-test Reference](./ds-test.md) 12 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/README.md: -------------------------------------------------------------------------------- 1 | ## cast 命令 2 | 3 | - [General 命令](./general-commands.md) 4 | - [Chain 命令](./chain-commands.md) 5 | - [Transaction 命令](./transaction-commands.md) 6 | - [Block 命令](./block-commands.md) 7 | - [Account 命令](./account-commands.md) 8 | - [ENS 命令](./ens-commands.md) 9 | - [Etherscan 命令](./etherscan-commands.md) 10 | - [ABI 命令](./abi-commands.md) 11 | - [Conversion 命令](./conversion-commands.md) 12 | - [Utility 命令](./utility-commands.md) 13 | - [Wallet 命令](./wallet-commands.md) 14 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/abi-commands.md: -------------------------------------------------------------------------------- 1 | ## ABI 命令 2 | 3 | - [cast abi-encode](./cast-abi-encode.md) 4 | - [cast 4byte](./cast-4byte.md) 5 | - [cast 4byte-decode](./cast-4byte-decode.md) 6 | - [cast 4byte-event](./cast-4byte-event.md) 7 | - [cast calldata](./cast-calldata.md) 8 | - [cast pretty-calldata](./cast-pretty-calldata.md) 9 | - [cast --abi-decode](./cast--abi-decode.md) 10 | - [cast --calldata-decode](./cast--calldata-decode.md) 11 | - [cast selectors](./cast-selectors.md) 12 | - [cast upload-signature](./cast-upload-signature.md) -------------------------------------------------------------------------------- /translations/zh/reference/cast/account-commands.md: -------------------------------------------------------------------------------- 1 | ## Account 命令 2 | 3 | - [cast balance](./cast-balance.md) 4 | - [cast storage](./cast-storage.md) 5 | - [cast proof](./cast-proof.md) 6 | - [cast nonce](./cast-nonce.md) 7 | - [cast code](./cast-code.md) 8 | - [cast codesize](./cast-codesize.md) -------------------------------------------------------------------------------- /translations/zh/reference/cast/block-commands.md: -------------------------------------------------------------------------------- 1 | ## Block 命令 2 | 3 | - [cast find-block](./cast-find-block.md) 4 | - [cast gas-price](./cast-gas-price.md) 5 | - [cast block-number](./cast-block-number.md) 6 | - [cast basefee](./cast-basefee.md) 7 | - [cast block](./cast-block.md) 8 | - [cast age](./cast-age.md) 9 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-address-zero.md: -------------------------------------------------------------------------------- 1 | ## cast address-zero 2 | 3 | ### 名称 4 | 5 | cast address-zero - 打印零地址。 6 | 7 | ### 概述 8 | 9 | ``cast address-zero`` 10 | 11 | ### 描述 12 | 13 | 打印零地址。 14 | 15 | ### 选项 16 | 17 | {{#include common-options.md}} 18 | 19 | [cast](./cast.md) -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-block-number.md: -------------------------------------------------------------------------------- 1 | ## cast block-number 2 | 3 | ### 名称 4 | 5 | cast-block-number - 获取最新的区块号。 6 | 7 | ### 简介 8 | 9 | ``cast block-number`` [*options*] 10 | 11 | ### 描述 12 | 13 | 获取最新的区块号。 14 | 15 | ### 可选 16 | 17 | #### RPC 选项 18 | 19 | {{#include ../common/rpc-url-option.md}} 20 | 21 | {{#include common-options.md}} 22 | 23 | ### 例子 24 | 25 | 1. 获取最新的区块号: 26 | ```sh 27 | cast block-number 28 | ``` 29 | 30 | ### 请参阅 31 | 32 | [cast](./cast.md), [cast block](./cast-block.md) 33 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-client.md: -------------------------------------------------------------------------------- 1 | ## cast client 2 | 3 | ### 名称 4 | 5 | cast-client - 获取当前客户端的版本。 6 | 7 | ### 简介 8 | 9 | ``cast client`` [*options*] 10 | 11 | ### 描述 12 | 13 | 获取当前客户端的版本。 14 | 15 | ### 可选 16 | 17 | #### RPC 选项 18 | 19 | {{#include ../common/rpc-url-option.md}} 20 | 21 | {{#include common-options.md}} 22 | 23 | ### 例子 24 | 25 | 1. 获取当前客户端的版本: 26 | ```sh 27 | cast client 28 | ``` 29 | ### 请参阅 30 | 31 | [cast](./cast.md) 32 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-concat-hex.md: -------------------------------------------------------------------------------- 1 | ## cast concat-hex 2 | 3 | ### 名称 4 | 5 | cast concat-hex - 连接十六进制字符串。 6 | 7 | ### 概要 8 | 9 | ``cast concat-hex`` *data...* 10 | 11 | ### 描述 12 | 13 | 连接十六进制字符串。 14 | 15 | ### 选项 16 | 17 | {{#include common-options.md}} 18 | 19 | ### 示例 20 | 21 | 1. 连接十六进制字符串: 22 | ```sh 23 | cast concat-hex 0xa 0xb 0xc 24 | ``` 25 | 26 | ### 另请参阅 27 | 28 | [cast](./cast.md) -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-find-block.md: -------------------------------------------------------------------------------- 1 | ## cast find-block 2 | 3 | ### 名称 4 | 5 | cast-find-block - 获取与提供的时间戳最接近的区块编号。 6 | 7 | ### 简介 8 | 9 | ``cast find-block`` [*options*] *timestamp* 10 | 11 | ### 描述 12 | 13 | 获取与提供的时间戳最接近的区块编号。 14 | 15 | ### 可选 16 | 17 | #### RPC 选项 18 | 19 | {{#include ../common/rpc-url-option.md}} 20 | 21 | {{#include common-options.md}} 22 | 23 | ### 例子 24 | 25 | 1. 获取最接近 2021 年新年的区块编号: 26 | ```sh 27 | cast find-block 1609459200 28 | ``` 29 | 30 | ### 请参阅 31 | 32 | [cast](./cast.md) 33 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-from-bin.md: -------------------------------------------------------------------------------- 1 | ## cast from-bin 2 | 3 | ### 名称 4 | 5 | 从二进制转换 - 将二进制数据转换为十六进制数据。 6 | 7 | ### 概要 8 | 9 | ``从二进制转换`` [*选项*] 10 | 11 | ### 描述 12 | 13 | 将二进制数据转换为十六进制数据。 14 | 15 | 输入来自标准输入。 16 | 17 | ### 选项 18 | 19 | {{#include common-options.md}} 20 | 21 | ### 参见 22 | 23 | [转换](./cast.md) 24 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-from-fixed-point.md: -------------------------------------------------------------------------------- 1 | ## cast from-fixed-point 2 | 3 | ### 名称 4 | 5 | 从固定点转换 - 将固定点数转换为整数。 6 | 7 | ### 概要 8 | 9 | ``cast from-fixed-point`` [*options*] *decimals* *value* 10 | 11 | ### 描述 12 | 13 | 将固定点数转换为整数。 14 | 15 | ### 选项 16 | 17 | {{#include common-options.md}} 18 | 19 | ### 示例 20 | 21 | 1. 将 10.55 转换为整数: 22 | ```sh 23 | cast from-fixed-point 2 10.55 24 | ``` 25 | 26 | ### 另请参阅 27 | 28 | [cast](./cast.md) -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-from-rlp.md: -------------------------------------------------------------------------------- 1 | ## cast from-rlp 2 | 3 | ### 名称 4 | 5 | cast-from-rlp- 解码 RLP 编码的数据。 6 | 7 | ### 概要 8 | 9 | ``cast from-rlp`` *data* 10 | 11 | ### 描述 12 | 13 | 解码 RLP 编码的数据。 14 | 15 | *data* 是一个十六进制字符串,可以选择性地包含 0x 前缀。 16 | 17 | ### 选项 18 | 19 | {{#include common-options.md}} 20 | 21 | ### 示例 22 | 23 | 1. 解码 RLP 数据: 24 | ```sh 25 | cast from-rlp 0xc481f181f2 26 | 27 | cast from-rlp c481f181f2 28 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-from-utf8.md: -------------------------------------------------------------------------------- 1 | ## cast from-utf8 2 | 3 | ### 名称 4 | 5 | 从 utf8 转换 - 将 UTF8 文本转换为十六进制。 6 | 7 | ### 概要 8 | 9 | ``cast from-utf8`` [*选项*] *文本* 10 | 11 | ### 描述 12 | 13 | 将 UTF8 文本转换为十六进制。 14 | 15 | ### 选项 16 | 17 | {{#include common-options.md}} 18 | 19 | ### 示例 20 | 21 | 1. 将 UTF8 文本转换为十六进制: 22 | ```sh 23 | cast from-utf8 "hello" 24 | ``` 25 | 26 | ### 参见 27 | 28 | [cast](./cast.md) 29 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-from-wei.md: -------------------------------------------------------------------------------- 1 | ## cast from-wei 2 | 3 | ### 名称 4 | 5 | 从 wei 转换 - 将 wei 转换为 ETH 数量。 6 | 7 | ### 概要 8 | 9 | ``cast from-wei`` [*选项*] *数值* [*单位*] 10 | 11 | ### 描述 12 | 13 | 将 wei 转换为 ETH 数量。 14 | 15 | 考虑使用 [`cast to-unit`](./cast-to-unit.md)。 16 | 17 | ### 选项 18 | 19 | {{#include common-options.md}} 20 | 21 | ### 参见 22 | 23 | [cast](./cast.md), [cast calldata](./cast-to-unit.md) 24 | 25 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-gas-price.md: -------------------------------------------------------------------------------- 1 | ## cast gas-price 2 | 3 | ### 名称 4 | 5 | cast-gas-price - 获取当前 Gas 价格。 6 | 7 | ### 简介 8 | 9 | ``cast gas-price`` [*options*] 10 | 11 | ### 描述 12 | 13 | 获取当前 Gas 价格。 14 | 15 | ### 可选 16 | 17 | #### RPC 选项 18 | 19 | {{#include ../common/rpc-url-option.md}} 20 | 21 | {{#include common-options.md}} 22 | 23 | ### 例子 24 | 25 | 1. 获取当前 Gas 价格: 26 | ```sh 27 | cast gas-price 28 | ``` 29 | 30 | ### 请参阅 31 | 32 | [cast](./cast.md), [cast basefee](./cast-basefee.md) 33 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-help.md: -------------------------------------------------------------------------------- 1 | ## cast help 2 | 3 | ### 名称 4 | 5 | cast-help - 获取 Cast 命令的帮助 6 | 7 | ### 简介 8 | 9 | ``cast help`` [*subcommand*] 10 | 11 | ### 描述 12 | 13 | 打印指定命令的帮助信息。 14 | 15 | ### 例子 16 | 17 | 1. 获取指定命令的帮助: 18 | ```sh 19 | cast help call 20 | ``` 21 | 22 | 2. 帮助也可以通过 `--help` 标志获得: 23 | ```sh 24 | cast call --help 25 | ``` 26 | 27 | ### 请参阅 28 | 29 | [cast](./cast.md) 30 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-keccak.md: -------------------------------------------------------------------------------- 1 | ## cast keccak 2 | 3 | ### 名称 4 | 5 | cast-keccak - 使用 keccak-256 对任意数据进行哈希。 6 | 7 | ### 简介 8 | 9 | ``cast keccak`` [*options*] *data* 10 | 11 | ### 描述 12 | 13 | 使用 keccak-256 对任意数据进行哈希。 14 | 15 | ### 可选 16 | 17 | {{#include common-options.md}} 18 | 19 | ### 请参阅 20 | 21 | [cast](./cast.md) 22 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-max-int.md: -------------------------------------------------------------------------------- 1 | ## cast max-int 2 | 3 | ### 名称 4 | 5 | cast-max-int - 获取最大的 i256 值。 6 | 7 | ### 概要 8 | 9 | ``cast max-int`` 10 | 11 | ### 描述 12 | 13 | 获取最大的 i256 值。 14 | 15 | ### 选项 16 | 17 | {{#include common-options.md}} 18 | 19 | ### 参见 20 | 21 | [cast](./cast.md), [cast min-int](./cast-min-int.md), [cast max-uint](./cast-max-uint.md) 22 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-max-uint.md: -------------------------------------------------------------------------------- 1 | ## cast max-uint 2 | 3 | ### 名称 4 | 5 | cast-max-uint - 获取最大的 uint256 值。 6 | 7 | ### 概要 8 | 9 | ``cast max-uint`` 10 | 11 | ### 描述 12 | 13 | 获取最大的 uint256 值。 14 | 15 | ### 选项 16 | 17 | {{#include common-options.md}} 18 | 19 | ### 另请参阅 20 | 21 | [cast](./cast.md), [cast max-int](./cast-max-int.md) 22 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-min-int.md: -------------------------------------------------------------------------------- 1 | ## cast min-int 2 | 3 | ### 名称 4 | 5 | cast-min-int - 获取最小的 i256 值。 6 | 7 | ### 概要 8 | 9 | ``cast min-int`` 10 | 11 | ### 描述 12 | 13 | 获取最小的 i256 值。 14 | 15 | ### 选项 16 | 17 | {{#include common-options.md}} 18 | 19 | ### 另请参阅 20 | 21 | [cast](./cast.md), [cast max-int](./cast-max-int.md) 22 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-namehash.md: -------------------------------------------------------------------------------- 1 | ## cast namehash 2 | 3 | ### 名称 4 | 5 | cast-namehash - 计算一个名字的 ENS namehash。 6 | 7 | ### 简介 8 | 9 | ``cast namehash`` [*options*] *name* 10 | 11 | ### 描述 12 | 13 | 计算一个名字的 ENS namehash。 14 | 15 | ### 可选 16 | 17 | {{#include common-options.md}} 18 | 19 | ### 例子 20 | 21 | 1. 计算一个名字的 ENS namehash。 22 | ```sh 23 | cast namehash vitalik.eth 24 | ``` 25 | 26 | ### 请参阅 27 | 28 | [cast](./cast.md), [cast lookup-address](./cast-lookup-address.md), [cast resolve-name](./cast-resolve-name.md) 29 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-shl.md: -------------------------------------------------------------------------------- 1 | ## cast shl 2 | 3 | ### 名称 4 | 5 | cast-shl - 进行左移操作。 6 | 7 | ### 简介 8 | 9 | ``cast shl`` [*options*] *value* *shift* 10 | 11 | ### 描述 12 | 13 | 进行左移操作。 14 | 15 | ### 可选 16 | 17 | {{#include ../common/base-options.md}} 18 | 19 | {{#include common-options.md}} 20 | 21 | ### 例子 22 | 23 | 1. 对数字61进行3位左移: 24 | ```sh 25 | cast shl --base-in 10 61 3 26 | ``` 27 | 28 | > 注意: --base-in 参数不强制,但如果输入的内容不明确,则需要使用。 29 | 30 | ### 请参阅 31 | 32 | [cast](./cast.md), [cast shr](./cast-shr.md) 33 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-shr.md: -------------------------------------------------------------------------------- 1 | ## cast shr 2 | 3 | ### 名称 4 | 5 | cast-shr - 进行右移操作。 6 | 7 | ### 简介 8 | 9 | ``cast shr`` [*options*] *value* *shift* 10 | 11 | ### 描述 12 | 13 | 进行右移操作。 14 | 15 | ### 可选 16 | 17 | {{#include ../common/base-options.md}} 18 | 19 | {{#include common-options.md}} 20 | 21 | ### 例子 22 | 23 | 1. 对 0x12 的单一右移: 24 | ```sh 25 | cast shr --base-in 16 0x12 1 26 | ``` 27 | 28 | > 注意: --base-in 参数不强制,但如果输入的内容不明确,则需要使用。 29 | 30 | ### 请参阅 31 | 32 | [cast](./cast.md), [cast shl](./cast-shl.md) 33 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-sig-event.md: -------------------------------------------------------------------------------- 1 | ## cast sig-event 2 | 3 | ### 名称 4 | 5 | cast-sig-event - 从事件字符串生成事件签名。 6 | 7 | ### 概要 8 | 9 | ``cast sig-event`` [*options*] *event_string* 10 | 11 | ### 描述 12 | 13 | 从事件字符串生成事件签名。 14 | 15 | ### 选项 16 | 17 | {{#include common-options.md}} 18 | 19 | ### 示例 20 | 21 | 1. 获取日志 `Transfer(address indexed from, address indexed to, uint256 amount)` 的哈希值: 22 | ```sh 23 | cast sig-event "Transfer(address indexed from, address indexed to, uint256 amount)" 24 | ``` 25 | 26 | ### 另请参阅 27 | 28 | [cast](./cast.md) -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-to-ascii.md: -------------------------------------------------------------------------------- 1 | ## cast to-ascii 2 | 3 | ### 名称 4 | 5 | 转换为 ASCII - 将十六进制数据转换为 ASCII 字符串。 6 | 7 | ### 概要 8 | 9 | ``cast to-ascii`` [*选项*] *文本* 10 | 11 | ### 描述 12 | 13 | 将十六进制数据转换为 ASCII 字符串。 14 | 15 | ### 选项 16 | 17 | {{#include common-options.md}} 18 | 19 | ### 示例 20 | 21 | 1. 将十六进制数据转换为 ASCII 字符串: 22 | ```sh 23 | cast to-ascii "0x68656c6c6f" 24 | ``` 25 | 26 | ### 另请参阅 27 | 28 | [cast](./cast.md) 29 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-to-bytes32.md: -------------------------------------------------------------------------------- 1 | ## cast to-bytes32 2 | 3 | ### 名称 4 | 5 | cast-to-bytes32 - 将十六进制数据右填充为 32 字节。 6 | 7 | ### 概要 8 | 9 | ``cast to-bytes32`` [*选项*] *bytes* 10 | 11 | ### 描述 12 | 13 | 将十六进制数据右填充为 32 字节。 14 | 15 | 请注意,此命令仅用于填充字节字符串。如果你要将 [Solidity 字符串文字](https://docs.soliditylang.org/en/v0.8.16/types.html#string-literals-and-types)格式化为`bytes32`,请改用 [format-bytes32-string](./cast-format-bytes32-string.md)。 16 | 17 | ### 选项 18 | 19 | {{#include common-options.md}} 20 | 21 | ### 参见 22 | 23 | [cast](./cast.md) 24 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-to-dec.md: -------------------------------------------------------------------------------- 1 | ## cast to-dec 2 | 3 | ### 名称 4 | 5 | cast-to-dec - 将一个底数的数字转换为十进制 6 | 7 | ### 概要 8 | 9 | ``cast to-dec`` [*options*] *value* 10 | 11 | ### 描述 12 | 13 | 将一个底数的数字转换为十进制 14 | 15 | ### 选项 16 | 17 | `--base-in` *base_in* 18 |     输入底数。 19 | 20 | {{#include common-options.md}} 21 | 22 | ### 示例 23 | 24 | 1. 将十六进制中的 ff 转换为十进制 25 | ```sh 26 | cast to-dec ff 27 | ``` 28 | 29 | ### 参见 30 | 31 | [cast](./cast.md) -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-to-fixed-point.md: -------------------------------------------------------------------------------- 1 | ## cast to-fixed-point 2 | 3 | ### 名称 4 | 5 | cast-to-fixed-point - 将整数转换为定点数。 6 | 7 | ### 概要 8 | 9 | ``cast to-fixed-point`` [*options*] *decimals* *value* 10 | 11 | ### 描述 12 | 13 | 将整数转换为定点数。 14 | 15 | ### 选项 16 | 17 | {{#include common-options.md}} 18 | 19 | ### 示例 20 | 21 | 1. 将 250 转换为带有 2 位小数的定点数: 22 | ```sh 23 | cast to-fixed-point 2 250 24 | ``` 25 | 26 | ### 另请参阅 27 | 28 | [cast](./cast.md) 29 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-to-hex.md: -------------------------------------------------------------------------------- 1 | ## cast to-hex 2 | 3 | ### 名称 4 | 5 | cast-to-hex - 将一个进制的数字转换为另一个进制 6 | 7 | ### 概要 8 | 9 | ``cast to-hex`` [*选项*] *值* 10 | 11 | ### 描述 12 | 13 | 将一个进制的数字转换为另一个进制 14 | 15 | ### 选项 16 | 17 | `--base-in` *base_in* 18 |     输入进制。 19 | 20 | {{#include common-options.md}} 21 | 22 | ### 参见 23 | 24 | [cast](./cast.md) -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-to-int256.md: -------------------------------------------------------------------------------- 1 | ## cast to-int256 2 | 3 | ### 名称 4 | 5 | cast-to-int256 - 将数字转换为十六进制编码的 int256。 6 | 7 | ### 概要 8 | 9 | ``cast to-int256`` [*options*] *value* 10 | 11 | ### 描述 12 | 13 | 将数字转换为十六进制编码的 int256。 14 | 15 | ### 选项 16 | 17 | {{#include common-options.md}} 18 | 19 | ### 参见 20 | 21 | [cast](./cast.md) 22 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-to-rlp.md: -------------------------------------------------------------------------------- 1 | ## cast to-rlp 2 | 3 | ### 名称 4 | 5 | cast-to-rlp - 将十六进制数据编码为 RLP。 6 | 7 | ### 概要 8 | 9 | ``cast to-rlp`` *array* 10 | 11 | ### 描述 12 | 13 | RLP 对十六进制字符串或十六进制字符串的 JSON 数组进行编码。 14 | 15 | ### 选项 16 | 17 | {{#include common-options.md}} 18 | 19 | ### 例子 20 | 21 | 1. 编码 RLP 数据: 22 | ```sh 23 | cast to-rlp '["0xaa","0xbb","cc"]' 24 | 25 | cast to-rlp f0a9 26 | ``` 27 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-to-uint256.md: -------------------------------------------------------------------------------- 1 | ## cast to-uint256 2 | 3 | ### 名称 4 | 5 | cast-to-uint256 - 将数字转换为十六进制编码的 uint256。 6 | 7 | ### 概要 8 | 9 | ``cast to-uint256`` [*options*] *value* 10 | 11 | ### 描述 12 | 13 | 将数字转换为十六进制编码的 uint256。 14 | 15 | ### 选项 16 | 17 | {{#include common-options.md}} 18 | 19 | ### 另请参阅 20 | 21 | [cast](./cast.md) 22 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-to-wei.md: -------------------------------------------------------------------------------- 1 | ## cast to-wei 2 | 3 | ### 名称 4 | 5 | cast-to-wei - 将以太金额转换为 wei。 6 | 7 | ### 概要 8 | 9 | ``cast to-wei`` [*options*] *value* [*unit*] 10 | 11 | ### 描述 12 | 13 | 将以太金额转换为 wei。 14 | 15 | 考虑使用 [`cast to-unit`](./cast-to-unit.md)。 16 | 17 | ### 选项 18 | 19 | {{#include common-options.md}} 20 | 21 | ### 另请参阅 22 | 23 | [cast](./cast.md), [cast calldata](./cast-to-unit.md) 24 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-upload-signature.md: -------------------------------------------------------------------------------- 1 | ## cast upload-signature 2 | 3 | ### 名称 4 | 5 | cast-upload-signature 6 | 7 | ### 简介 8 | 9 | `cast upload-signature` [*signatures...*] 10 | 11 | ### 描述 12 | 13 | 将指定的签名上传到 [https://sig.eth.samczsun.com](https://sig.eth.samczsun.com)。 14 | 15 | ### 可选 16 | 17 | {{#include common-options.md}} 18 | 19 | ### 例子 20 | 21 | 1. 上传签名 22 | ```sh 23 | cast upload-signature 'function approve(address,uint256)' \ 24 | 'transfer(uint256)' 'event Transfer(uint256,address)' 25 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-wallet-list.md: -------------------------------------------------------------------------------- 1 | ## cast wallet list 2 | 3 | ### 名称 4 | 5 | cast-wallet-list - 列出 keystore 默认目录中的所有账户。 6 | 7 | ### 概要 8 | 9 | `cast wallet list` 10 | 11 | ### 描述 12 | 13 | 列出 keystore 默认目录 `~/.foundry/keystores` 中的所有账户。 14 | 15 | ### 选项 16 | 17 | {{#include common-options.md}} 18 | 19 | ### 参见 20 | 21 | [cast](./cast.md), [cast wallet](./cast-wallet.md) -------------------------------------------------------------------------------- /translations/zh/reference/cast/cast-wallet-verify.md: -------------------------------------------------------------------------------- 1 | ## cast wallet verify 2 | 3 | ### 名称 4 | 5 | cast-wallet-verify - 验证一个信息的签名。 6 | 7 | ### 简介 8 | 9 | ``cast wallet verify`` [*options*] `--address` *address* *message* *signature* 10 | 11 | ### 描述 12 | 13 | 验证一个信息的签名。 14 | 15 | ### 可选 16 | 17 | #### Signature 选项 18 | 19 | `-a` *address* 20 | `--address` *address* 21 |     信息签署者的地址。 22 | 23 | {{#include common-options.md}} 24 | 25 | ### 请参阅 26 | 27 | [cast](./cast.md), [cast wallet](./cast-wallet.md) 28 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/chain-commands.md: -------------------------------------------------------------------------------- 1 | ## Chain 命令 2 | 3 | - [cast chain-id](./cast-chain-id.md) 4 | - [cast chain](./cast-chain.md) 5 | - [cast client](./cast-client.md) 6 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/common-options.md: -------------------------------------------------------------------------------- 1 | #### Common 选项 2 | 3 | `-h` 4 | `--help` 5 |     输出帮助信息。 6 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/ens-commands.md: -------------------------------------------------------------------------------- 1 | ## ENS 命令 2 | 3 | - [cast lookup-address](./cast-lookup-address.md) 4 | - [cast resolve-name](./cast-resolve-name.md) 5 | - [cast namehash](./cast-namehash.md) 6 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/etherscan-commands.md: -------------------------------------------------------------------------------- 1 | ## Etherscan 命令 2 | 3 | - [cast etherscan-source](./cast-etherscan-source.md) 4 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/general-commands.md: -------------------------------------------------------------------------------- 1 | ## General 命令 2 | 3 | - [cast](./cast.md) 4 | - [cast help](./cast-help.md) 5 | - [cast completions](./cast-completions.md) 6 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/sig-description.md: -------------------------------------------------------------------------------- 1 | 签名 (*sig*) 可以是: 2 | 3 | - 一个片段: `someFunction(uint256,bytes32)` 4 | - 一个选择器和编码的 calldata: `0xcdba2fd40000000000000000000000000000000000000000000000000000000000007a69` 5 | - 只有函数名:在这种情况下,Cast 将尝试从 Etherscan 中获取函数签名。 6 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/transaction-commands.md: -------------------------------------------------------------------------------- 1 | ## Transaction 命令 2 | 3 | - [cast publish](./cast-publish.md) 4 | - [cast receipt](./cast-receipt.md) 5 | - [cast send](./cast-send.md) 6 | - [cast mktx](./cast-mktx.md) 7 | - [cast call](./cast-call.md) 8 | - [cast rpc](./cast-rpc.md) 9 | - [cast tx](./cast-tx.md) 10 | - [cast run](./cast-run.md) 11 | - [cast estimate](./cast-estimate.md) 12 | - [cast access-list](./cast-access-list.md) 13 | - [cast logs](./cast-logs.md) 14 | -------------------------------------------------------------------------------- /translations/zh/reference/cast/wallet-commands.md: -------------------------------------------------------------------------------- 1 | ## Wallet Commands 2 | 3 | - [cast wallet](./cast-wallet.md) 4 | - [cast wallet address](./cast-wallet-address.md) 5 | - [cast wallet new](./cast-wallet-new.md) 6 | - [cast wallet sign](./cast-wallet-sign.md) 7 | - [cast wallet vanity](./cast-wallet-vanity.md) 8 | - [cast wallet verify](./cast-wallet-verify.md) 9 | - [cast wallet import](./cast-wallet-import.md) 10 | -------------------------------------------------------------------------------- /translations/zh/reference/cli/README.md: -------------------------------------------------------------------------------- 1 | # CLI Reference 2 | 3 | 4 | 5 | Automatically-generated CLI reference from `--help` output. 6 | 7 | {{#include ./SUMMARY.md}} 8 | -------------------------------------------------------------------------------- /translations/zh/reference/cli/anvil/completions.md: -------------------------------------------------------------------------------- 1 | # anvil completions 2 | 3 | 生成 shell 自动完成脚本 4 | 5 | ```bash 6 | $ anvil completions --help 7 | ``` 8 | 9 | ```txt 10 | 用法: anvil completions 11 | 参数: 12 | [possible values: bash, elvish, fish, powershell, zsh] 13 | 14 | 选项: 15 | -h, --help Print help 16 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/anvil/generate-fig-spec.md: -------------------------------------------------------------------------------- 1 | # anvil generate-fig-spec 2 | 3 | 生成 Fig 自动完成规范 4 | 5 | ```bash 6 | $ anvil generate-fig-spec --help 7 | ``` 8 | 9 | ```txt 10 | 用法: anvil generate-fig-spec 11 | 12 | 选项: 13 | -h, --help Print help 14 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/4byte-decode.md: -------------------------------------------------------------------------------- 1 | # cast 4byte-decode 2 | 3 | 使用 https://openchain.xyz 解码 ABI 编码的 calldata 4 | 5 | ```bash 6 | $ cast 4byte-decode --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast 4byte-decode [OPTIONS] [CALLDATA] 11 | 12 | 参数: 13 | [CALLDATA] The ABI-encoded calldata 14 | 15 | 选项: 16 | -h, --help Print help 17 | 18 | Display options: 19 | -j, --json Print the decoded calldata as JSON 20 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/4byte-event.md: -------------------------------------------------------------------------------- 1 | # cast 4byte-event 2 | 3 | 从 https://openchain.xyz 获取给定 topic 0 的事件签名 4 | 5 | ```bash 6 | $ cast 4byte-event --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast 4byte-event [TOPIC_0] 11 | 12 | 参数: 13 | [TOPIC_0] Topic 0 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/4byte.md: -------------------------------------------------------------------------------- 1 | # cast 4byte 2 | 3 | 从 https://openchain.xyz 获取给定选择器的函数签名 4 | 5 | ```bash 6 | $ cast 4byte --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast 4byte [SELECTOR] 11 | 12 | 参数: 13 | [SELECTOR] The function selector 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/abi-encode.md: -------------------------------------------------------------------------------- 1 | # cast abi-encode 2 | 3 | 对给定的函数参数进行 ABI 编码,不包括选择器 4 | 5 | ```bash 6 | $ cast abi-encode --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast abi-encode [OPTIONS] [ARGS]... 11 | 12 | 参数: 13 | The function signature 14 | [ARGS]... The arguments of the function 15 | 16 | 选项: 17 | --packed Whether to use packed encoding 18 | -h, --help Print help 19 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/address-zero.md: -------------------------------------------------------------------------------- 1 | # cast address-zero 2 | 3 | 打印零地址 4 | 5 | ```bash 6 | $ cast address-zero --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast address-zero 11 | 12 | 选项: 13 | -h, --help Print help 14 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/calldata.md: -------------------------------------------------------------------------------- 1 | # 编码调用数据 2 | 3 | 使用参数对函数进行 ABI 编码 4 | 5 | ```bash 6 | $ cast calldata --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast calldata [ARGS]... 11 | 12 | 参数: 13 | The function signature in the format 14 | `()()` 15 | [ARGS]... The arguments to encode 16 | 17 | 选项: 18 | -h, --help Print help 19 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/completions.md: -------------------------------------------------------------------------------- 1 | # 生成补全脚本 2 | 3 | 生成 shell 补全脚本 4 | 5 | ```bash 6 | $ cast completions --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast completions 11 | 12 | 参数: 13 | [possible values: bash, elvish, fish, powershell, zsh] 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/concat-hex.md: -------------------------------------------------------------------------------- 1 | # cast concat-hex 2 | 3 | 连接十六进制字符串 4 | 5 | ```bash 6 | $ cast concat-hex --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast concat-hex [DATA]... 11 | 12 | 参数: 13 | [DATA]... The data to concatenate 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/decode-eof.md: -------------------------------------------------------------------------------- 1 | # cast decode-eof 2 | 3 | 解码 EOF 容器字节 4 | 5 | ```bash 6 | $ cast decode-eof --help 7 | ``` 8 | 9 | ```txt 10 | 用法: cast decode-eof [EOF] 11 | 12 | 参数: 13 | [EOF] 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/decode-transaction.md: -------------------------------------------------------------------------------- 1 | # cast decode-transaction 2 | 3 | 解码原始签名的 EIP 2718 类型交易 4 | 5 | ```bash 6 | $ cast decode-transaction --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast decode-transaction [TX] 11 | 12 | 参数: 13 | [TX] 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/disassemble.md: -------------------------------------------------------------------------------- 1 | # cast disassemble 2 | 3 | 将十六进制编码的字节码反汇编为单独的/人类可读的操作码 4 | 5 | ```bash 6 | $ cast disassemble --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast disassemble 11 | 12 | 参数: 13 | The hex encoded bytecode 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/format-bytes32-string.md: -------------------------------------------------------------------------------- 1 | # cast format-bytes32-string 2 | 3 | 将字符串格式化为 bytes32 编码 4 | 5 | ```bash 6 | $ cast format-bytes32-string --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast format-bytes32-string [STRING] 11 | 12 | 参数: 13 | [STRING] The string to format 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/from-bin.md: -------------------------------------------------------------------------------- 1 | # 从二进制转换 2 | 3 | 将二进制数据转换为十六进制数据 4 | 5 | ```bash 6 | $ cast from-bin --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast from-bin 11 | 12 | 选项: 13 | -h, --help Print help 14 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/from-fixed-point.md: -------------------------------------------------------------------------------- 1 | # 从定点数转换 2 | 3 | 将定点数转换为整数 4 | 5 | ```bash 6 | $ cast from-fixed-point --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast from-fixed-point [DECIMALS] [VALUE] 11 | 12 | 参数: 13 | [DECIMALS] The number of decimals to use 14 | [VALUE] The value to convert 15 | 16 | 选项: 17 | -h, --help Print help 18 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/from-rlp.md: -------------------------------------------------------------------------------- 1 | # cast from-rlp 2 | 3 | 解码 RLP 十六进制编码数据 4 | 5 | ```bash 6 | $ cast from-rlp --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast from-rlp [VALUE] 11 | 12 | 参数: 13 | [VALUE] The RLP hex-encoded data 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/from-utf8.md: -------------------------------------------------------------------------------- 1 | # cast from-utf8 2 | 3 | 将 UTF8 文本转换为十六进制 4 | 5 | ```bash 6 | $ cast from-utf8 --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast from-utf8 [TEXT] 11 | 12 | 参数: 13 | [TEXT] The text to convert 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/from-wei.md: -------------------------------------------------------------------------------- 1 | # cast from-wei 2 | 3 | 将 wei 转换为 ETH 数量。 4 | 5 | ```bash 6 | $ cast from-wei --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast from-wei [VALUE] [UNIT] 11 | 12 | 参数: 13 | [VALUE] 14 | The value to convert 15 | 16 | [UNIT] 17 | The unit to convert from (ether, gwei, wei) 18 | 19 | [default: eth] 20 | 21 | 选项: 22 | -h, --help 23 | Print help (see a summary with '-h') 24 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/generate-fig-spec.md: -------------------------------------------------------------------------------- 1 | # cast generate-fig-spec 2 | 3 | 生成 Fig 自动补全规范 4 | 5 | ```bash 6 | $ cast generate-fig-spec --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast generate-fig-spec 11 | 12 | 选项: 13 | -h, --help Print help 14 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/hash-message.md: -------------------------------------------------------------------------------- 1 | # cast hash-message 2 | 3 | 根据 EIP-191 对消息进行哈希 4 | 5 | ```bash 6 | $ cast hash-message --help 7 | ``` 8 | 9 | ```txt 10 | 用法: cast hash-message [MESSAGE] 11 | 12 | 参数: 13 | [MESSAGE] The message to hash 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/hash-zero.md: -------------------------------------------------------------------------------- 1 | # 打印零哈希 2 | 3 | ```bash 4 | $ cast hash-zero --help 5 | ``` 6 | 7 | ```txt 8 | 用法:cast hash-zero 9 | 10 | 选项: 11 | -h, --help Print help 12 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/index-erc7201.md: -------------------------------------------------------------------------------- 1 | # cast index-erc7201 2 | 3 | 计算存储槽,如 `ERC-7201: Namespaced Storage Layout` 所指定 4 | 5 | ```bash 6 | $ cast index-erc7201 --help 7 | ``` 8 | 9 | ```txt 10 | 用法: cast index-erc7201 [OPTIONS] [ID] 11 | 12 | 参数: 13 | [ID] The arbitrary identifier 14 | 15 | 选项: 16 | --formula-id 17 | The formula ID. Currently the only supported formula is `erc7201` 18 | [default: erc7201] 19 | -h, --help 20 | Print help 21 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/index.md: -------------------------------------------------------------------------------- 1 | # 计算索引 2 | 3 | 计算映射中某个条目的存储槽 4 | 5 | ```bash 6 | $ cast index --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast index 11 | 12 | 参数: 13 | The mapping key type 14 | The mapping key 15 | The storage slot of the mapping 16 | 17 | 选项: 18 | -h, --help Print help 19 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/keccak.md: -------------------------------------------------------------------------------- 1 | # cast keccak 2 | 3 | 使用 Keccak-256 哈希任意数据 4 | 5 | ```bash 6 | $ cast keccak --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast keccak [DATA] 11 | 12 | 参数: 13 | [DATA] The data to hash 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/max-int.md: -------------------------------------------------------------------------------- 1 | # 转换最大整数 2 | 3 | 打印给定整数类型的最大值 4 | 5 | ```bash 6 | $ cast max-int --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast max-int [TYPE] 11 | 12 | 参数: 13 | [TYPE] The integer type to get the maximum value of [default: int256] 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/max-uint.md: -------------------------------------------------------------------------------- 1 | # cast max-uint 2 | 3 | 打印给定整数类型的最大值 4 | 5 | ```bash 6 | $ cast max-uint --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast max-uint [TYPE] 11 | 12 | 参数: 13 | [TYPE] The unsigned integer type to get the maximum value of [default: 14 | uint256] 15 | 16 | 选项: 17 | -h, --help Print help 18 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/min-int.md: -------------------------------------------------------------------------------- 1 | # 转换最小整数 2 | 3 | 打印给定整数类型的最小值 4 | 5 | ```bash 6 | $ cast min-int --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast min-int [TYPE] 11 | 12 | 参数: 13 | [TYPE] The integer type to get the minimum value of [default: int256] 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/mktx/--create.md: -------------------------------------------------------------------------------- 1 | # cast mktx --create 2 | 3 | 用于部署原始合约字节码 4 | 5 | ```bash 6 | $ cast mktx --create --help 7 | ``` 8 | 9 | ```txt 10 | 用法: cast mktx --create [SIG] [ARGS]... 11 | 12 | 参数: 13 | 要部署合约的初始化字节码 14 | [SIG] 构造函数的签名 15 | [ARGS]... 构造函数的参数 16 | 17 | 选项: 18 | -h, --help Print help 19 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/namehash.md: -------------------------------------------------------------------------------- 1 | # 计算 namehash 2 | 3 | 计算一个名称的 ENS namehash 4 | 5 | ```bash 6 | $ cast namehash --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast namehash [NAME] 11 | 12 | 参数: 13 | [NAME] 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/parse-bytes32-address.md: -------------------------------------------------------------------------------- 1 | # cast parse-bytes32-address 2 | 3 | 从 bytes32 编码中解析出一个校验和地址。 4 | 5 | ```bash 6 | $ cast parse-bytes32-address --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast parse-bytes32-address [BYTES] 11 | 12 | 参数: 13 | [BYTES] 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/parse-bytes32-string.md: -------------------------------------------------------------------------------- 1 | # cast parse-bytes32-string 2 | 3 | 从 bytes32 编码解析字符串 4 | 5 | ```bash 6 | $ cast parse-bytes32-string --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast parse-bytes32-string [BYTES] 11 | 12 | 参数: 13 | [BYTES] The string to parse 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/pretty-calldata.md: -------------------------------------------------------------------------------- 1 | # cast pretty-calldata 2 | 3 | 美化打印 calldata。 4 | 5 | ```bash 6 | $ cast pretty-calldata --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast pretty-calldata [OPTIONS] [CALLDATA] 11 | 12 | 参数: 13 | [CALLDATA] 14 | The calldata 15 | 16 | 选项: 17 | -o, --offline 18 | Skip the https://openchain.xyz lookup 19 | 20 | -h, --help 21 | Print help (see a summary with '-h') 22 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/selectors.md: -------------------------------------------------------------------------------- 1 | # cast selectors 2 | 3 | 从字节码中提取函数选择器和参数 4 | 5 | ```bash 6 | $ cast selectors --help 7 | ``` 8 | 9 | ```txt 10 | 用法: cast selectors [OPTIONS] 11 | 12 | 参数: 13 | The hex encoded bytecode 14 | 15 | 选项: 16 | -r, --resolve Resolve the function signatures for the extracted selectors 17 | using https://openchain.xyz 18 | -h, --help Print help 19 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/send/--create.md: -------------------------------------------------------------------------------- 1 | # cast send --create 2 | 3 | 用于部署原始合约字节码 4 | 5 | ```bash 6 | $ cast send --create --help 7 | ``` 8 | 9 | ```txt 10 | 用法: cast send --create [SIG] [ARGS]... 11 | 12 | 参数: 13 | The bytecode of the contract to deploy 14 | [SIG] The signature of the function to call 15 | [ARGS]... The arguments of the function to call 16 | 17 | 选项: 18 | -h, --help Print help 19 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/shl.md: -------------------------------------------------------------------------------- 1 | # cast shl 2 | 3 | 执行左移操作 4 | 5 | ```bash 6 | $ cast shl --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast shl [OPTIONS] 11 | 12 | 参数: 13 | The value to shift 14 | The number of bits to shift 15 | 16 | 选项: 17 | --base-in The input base 18 | --base-out The output base [default: 16] 19 | -h, --help Print help 20 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/shr.md: -------------------------------------------------------------------------------- 1 | # cast shr 2 | 3 | ```bash 4 | $ cast shr --help 5 | ``` 6 | 7 | ```txt 8 | 用法:cast shr [OPTIONS] 9 | 10 | 参数: 11 | The value to shift 12 | The number of bits to shift 13 | 14 | 选项: 15 | --base-in The input base, 16 | --base-out The output base, [default: 16] 17 | -h, --help Print help 18 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/sig-event.md: -------------------------------------------------------------------------------- 1 | # 生成事件签名 2 | 3 | 从事件字符串生成事件签名 4 | 5 | ```bash 6 | $ cast sig-event --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast sig-event [EVENT_STRING] 11 | 12 | 参数: 13 | [EVENT_STRING] The event string 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/sig.md: -------------------------------------------------------------------------------- 1 | # cast sig 2 | 3 | 获取函数的选择器 4 | 5 | ```bash 6 | $ cast sig --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast sig [SIG] [OPTIMIZE] 11 | 12 | 参数: 13 | [SIG] The function signature, e.g. transfer(address,uint256) 14 | [OPTIMIZE] Optimize signature to contain provided amount of leading zeroes in 15 | selector 16 | 17 | 选项: 18 | -h, --help Print help 19 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/to-ascii.md: -------------------------------------------------------------------------------- 1 | # 转换为 ASCII 2 | 3 | 将十六进制数据转换为 ASCII 字符串 4 | 5 | ```bash 6 | $ cast to-ascii --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast to-ascii [HEXDATA] 11 | 12 | 参数: 13 | [HEXDATA] The hex data to convert 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/to-base.md: -------------------------------------------------------------------------------- 1 | # 转换为基数 2 | 3 | 将一个基数的数字转换为另一个基数 4 | 5 | ```bash 6 | $ cast to-base --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast to-base [OPTIONS] [VALUE] [BASE] 11 | 12 | 参数: 13 | [VALUE] The value to convert 14 | [BASE] The output base 15 | 16 | 选项: 17 | -i, --base-in The input base 18 | -h, --help Print help 19 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/to-bytes32.md: -------------------------------------------------------------------------------- 1 | # 转换为-bytes32 2 | 3 | 将十六进制数据右填充至 32 字节 4 | 5 | ```bash 6 | $ cast to-bytes32 --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast to-bytes32 [BYTES] 11 | 12 | 参数: 13 | [BYTES] The hex data to convert 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/to-check-sum-address.md: -------------------------------------------------------------------------------- 1 | # 转换为校验和地址 2 | 3 | 将地址转换为校验和格式 (EIP-55) 4 | 5 | ```bash 6 | $ cast to-check-sum-address --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast to-check-sum-address [ADDRESS] 11 | 12 | 参数: 13 | [ADDRESS] The address to convert 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/to-dec.md: -------------------------------------------------------------------------------- 1 | # 转换为十进制 2 | 3 | 将一个基数的数字转换为十进制 4 | 5 | ```bash 6 | $ cast to-dec --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast to-dec [OPTIONS] [VALUE] 11 | 12 | 参数: 13 | [VALUE] The value to convert 14 | 15 | 选项: 16 | -i, --base-in The input base 17 | -h, --help Print help 18 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/to-fixed-point.md: -------------------------------------------------------------------------------- 1 | # 转换为定点数 2 | 3 | 将整数转换为定点数 4 | 5 | ```bash 6 | $ cast to-fixed-point --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast to-fixed-point [DECIMALS] [VALUE] 11 | 12 | 参数: 13 | [DECIMALS] The number of decimals to use 14 | [VALUE] The value to convert 15 | 16 | 选项: 17 | -h, --help Print help 18 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/to-hex.md: -------------------------------------------------------------------------------- 1 | # 转换为十六进制 2 | 3 | 将一个基数的数字转换为另一个基数 4 | 5 | ```bash 6 | $ cast to-hex --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast to-hex [OPTIONS] [VALUE] 11 | 12 | 参数: 13 | [VALUE] The value to convert 14 | 15 | 选项: 16 | -i, --base-in The input base 17 | -h, --help Print help 18 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/to-hexdata.md: -------------------------------------------------------------------------------- 1 | # 转换为十六进制数据 2 | 3 | 将输入标准化为小写、以 0x 为前缀的十六进制。 4 | 5 | ```bash 6 | $ cast to-hexdata --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast to-hexdata [INPUT] 11 | 12 | 参数: 13 | [INPUT] 14 | The input to normalize 15 | 16 | 选项: 17 | -h, --help 18 | Print help (see a summary with '-h') 19 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/to-int256.md: -------------------------------------------------------------------------------- 1 | # 转换为 int256 2 | 3 | 将一个数字转换为十六进制编码的 int256 4 | 5 | ```bash 6 | $ cast to-int256 --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast to-int256 [VALUE] 11 | 12 | 参数: 13 | [VALUE] The value to convert 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/to-rlp.md: -------------------------------------------------------------------------------- 1 | # cast to-rlp 2 | 3 | RLP 编码十六进制数据,或一个十六进制数据的数组。 4 | 5 | ```bash 6 | $ cast to-rlp --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast to-rlp [VALUE] 11 | 12 | 参数: 13 | [VALUE] 14 | The value to convert. 15 | 16 | This is a hex-encoded string, or an array of hex-encoded strings. Can 17 | be arbitrarily recursive. 18 | 19 | 选项: 20 | -h, --help 21 | Print help (see a summary with '-h') 22 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/to-uint256.md: -------------------------------------------------------------------------------- 1 | # 转换为-uint256 2 | 3 | 将一个数字转换为十六进制编码的 uint256 4 | 5 | ```bash 6 | $ cast to-uint256 --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast to-uint256 [VALUE] 11 | 12 | 参数: 13 | [VALUE] The value to convert 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/to-unit.md: -------------------------------------------------------------------------------- 1 | # 转换为单位 2 | 3 | 将 ETH 金额转换为另一种单位(ether、gwei 或 wei)。 4 | 5 | ```bash 6 | $ cast to-unit --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast to-unit [VALUE] [UNIT] 11 | 12 | 参数: 13 | [VALUE] 14 | The value to convert 15 | 16 | [UNIT] 17 | The unit to convert to (ether, gwei, wei) 18 | 19 | [default: wei] 20 | 21 | 选项: 22 | -h, --help 23 | Print help (see a summary with '-h') 24 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/to-utf8.md: -------------------------------------------------------------------------------- 1 | # cast to-utf8 2 | 3 | 将十六进制数据转换为 utf-8 字符串 4 | 5 | ```bash 6 | $ cast to-utf8 --help 7 | ``` 8 | 9 | ```txt 10 | 用法: cast to-utf8 [HEXDATA] 11 | 12 | 参数: 13 | [HEXDATA] The hex data to convert 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/to-wei.md: -------------------------------------------------------------------------------- 1 | # 转换为 wei 2 | 3 | 将 ETH 数量转换为 wei。 4 | 5 | ```bash 6 | $ cast to-wei --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast to-wei [VALUE] [UNIT] 11 | 12 | 参数: 13 | [VALUE] 14 | The value to convert 15 | 16 | [UNIT] 17 | The unit to convert from (ether, gwei, wei) 18 | 19 | [default: eth] 20 | 21 | 选项: 22 | -h, --help 23 | Print help (see a summary with '-h') 24 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/wallet/derive-private-key.md: -------------------------------------------------------------------------------- 1 | # cast wallet derive-private-key 2 | 3 | 从助记词派生私钥 4 | 5 | ```bash 6 | $ cast wallet derive-private-key --help 7 | 用法: cast wallet derive-private-key [MNEMONIC_INDEX] 8 | 9 | 参数: 10 | 11 | [MNEMONIC_INDEX] 12 | 13 | 选项: 14 | -h, --help Print help 15 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/wallet/new-mnemonic.md: -------------------------------------------------------------------------------- 1 | # cast wallet new-mnemonic 2 | 3 | 生成一个随机的 BIP39 助记词 4 | 5 | ```bash 6 | $ cast wallet new-mnemonic --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast wallet new-mnemonic [OPTIONS] 11 | 12 | 选项: 13 | -w, --words Number of words for the mnemonic [default: 12] 14 | -a, --accounts Number of accounts to display [default: 1] 15 | -e, --entropy Entropy to use for the mnemonic 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/cast/wallet/verify.md: -------------------------------------------------------------------------------- 1 | # cast wallet verify 2 | 3 | 验证消息的签名 4 | 5 | ```bash 6 | $ cast wallet verify --help 7 | ``` 8 | 9 | ```txt 10 | 用法:cast wallet verify --address
11 | 12 | 参数: 13 | The original message 14 | The signature to verify 15 | 16 | 选项: 17 | -a, --address
The address of the message signer 18 | -h, --help Print help 19 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/chisel/clear-cache.md: -------------------------------------------------------------------------------- 1 | # chisel clear-cache 2 | 3 | 清除缓存目录中所有缓存的 Chisel 会话 4 | 5 | ```bash 6 | $ chisel clear-cache --help 7 | ``` 8 | 9 | ```txt 10 | 用法: chisel clear-cache 11 | 12 | 选项: 13 | -h, --help Print help 14 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/chisel/eval.md: -------------------------------------------------------------------------------- 1 | # chisel eval 2 | 3 | 简单的命令评估,无需进入 REPL 4 | 5 | ```bash 6 | $ chisel eval --help 7 | ``` 8 | 9 | ```txt 10 | 用法: chisel eval 11 | 12 | 参数: 13 | The command to be evaluated 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/chisel/list.md: -------------------------------------------------------------------------------- 1 | # chisel list 2 | 3 | 列出所有缓存会话 4 | 5 | ```bash 6 | $ chisel list --help 7 | ``` 8 | 9 | ```txt 10 | 用法: chisel list 11 | 12 | 选项: 13 | -h, --help Print help 14 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/chisel/load.md: -------------------------------------------------------------------------------- 1 | # chisel load 2 | 3 | 加载缓存会话 4 | 5 | ```bash 6 | $ chisel load --help 7 | ``` 8 | 9 | ```txt 10 | 用法: chisel load 11 | 12 | 参数: 13 | The ID of the session to load 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/chisel/view.md: -------------------------------------------------------------------------------- 1 | # chisel view 2 | 3 | 查看缓存会话的源代码 4 | 5 | ```bash 6 | $ chisel view --help 7 | ``` 8 | 9 | ```txt 10 | 用法: chisel view 11 | 12 | 参数: 13 | The ID of the session to load 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/forge/cache.md: -------------------------------------------------------------------------------- 1 | # forge cache 2 | 3 | 管理 Foundry 缓存 4 | 5 | ```bash 6 | $ forge cache --help 7 | ``` 8 | 9 | ```txt 10 | 用法: forge cache 11 | 12 | Commands: 13 | clean Cleans cached data from the global foundry directory 14 | ls Shows cached data from the global foundry directory 15 | help Print this message or the help of the given subcommand(s) 16 | 17 | 选项: 18 | -h, --help Print help 19 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/forge/clean.md: -------------------------------------------------------------------------------- 1 | # forge clean 2 | 3 | 删除构建工件和缓存目录 4 | 5 | ```bash 6 | $ forge clean --help 7 | ``` 8 | 9 | ```txt 10 | 用法: forge clean [OPTIONS] 11 | 12 | 选项: 13 | --root 14 | The project's root path. 15 | 16 | By default root of the Git repository, if in one, or the current working directory. 17 | 18 | -h, --help 19 | Print help (see a summary with '-h') 20 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/forge/compiler.md: -------------------------------------------------------------------------------- 1 | # forge 编译器 2 | 3 | 编译器工具 4 | 5 | ```bash 6 | $ forge compiler --help 7 | ``` 8 | 9 | ```txt 10 | 用法: forge compiler 11 | 12 | Commands: 13 | resolve Retrieves the resolved version(s) of the compiler within the project 14 | [aliases: r] 15 | help Print this message or the help of the given subcommand(s) 16 | 17 | 选项: 18 | -h, --help Print help 19 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/forge/completions.md: -------------------------------------------------------------------------------- 1 | # forge completions 2 | 3 | 生成 shell 完成脚本 4 | 5 | ```bash 6 | $ forge completions --help 7 | ``` 8 | 9 | ```txt 10 | 用法: forge completions 11 | 12 | 参数: 13 | [possible values: bash, elvish, fish, powershell, zsh] 14 | 15 | 选项: 16 | -h, --help Print help 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/forge/generate-fig-spec.md: -------------------------------------------------------------------------------- 1 | # forge generate-fig-spec 2 | 3 | 生成 Fig 自动完成规范 4 | 5 | ```bash 6 | $ forge generate-fig-spec --help 7 | ``` 8 | 9 | ```txt 10 | 用法: forge generate-fig-spec 11 | 12 | 选项: 13 | -h, --help Print help 14 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/forge/generate.md: -------------------------------------------------------------------------------- 1 | # forge generate 2 | 3 | 生成脚手架文件 4 | 5 | ```bash 6 | $ forge generate --help 7 | ``` 8 | 9 | ```txt 10 | 用法: forge generate 11 | 12 | Commands: 13 | test Scaffolds test file for given contract 14 | help Print this message or the help of the given subcommand(s) 15 | 16 | 选项: 17 | -h, --help Print help 18 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/forge/generate/test.md: -------------------------------------------------------------------------------- 1 | # forge generate test 2 | 3 | 给定合约的脚手架测试文件 4 | 5 | ```bash 6 | $ forge generate test --help 7 | 用法: forge generate test --contract-name 8 | 9 | 选项: 10 | -c, --contract-name Contract name for test generation 11 | -h, --help Print help 12 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/forge/soldeer/init.md: -------------------------------------------------------------------------------- 1 | # forge soldeer init 2 | 3 | 将 Foundry 项目转换为使用 Soldeer 4 | 5 | ```bash 6 | $ forge soldeer init --help 7 | ``` 8 | 9 | ```txt 10 | 用法: forge soldeer init [OPTIONS] 11 | 12 | 选项: 13 | --clean 通过删除 .gitmodules 和 lib 目录来清理 Foundry 项目 14 | -h, --help 打印帮助信息 15 | 16 | 更多信息,请阅读 README.md 17 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/forge/soldeer/login.md: -------------------------------------------------------------------------------- 1 | # forge soldeer 登录 2 | 3 | 登录到中央仓库以推送包 4 | 5 | ```bash 6 | $ forge soldeer login --help 7 | ``` 8 | 9 | ```txt 10 | 用法: forge soldeer login 11 | 12 | 选项: 13 | -h, --help 打印帮助 14 | 15 | 欲了解更多信息,请阅读 README.md 16 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/forge/soldeer/uninstall.md: -------------------------------------------------------------------------------- 1 | # forge soldeer 卸载 2 | 3 | 卸载一个依赖项 4 | 5 | ```bash 6 | $ forge soldeer uninstall --help 7 | ``` 8 | 9 | ```txt 10 | 用法:forge soldeer uninstall 11 | 12 | 参数: 13 | 依赖项名称。无需指定版本 14 | 15 | 选项: 16 | -h, --help 打印帮助 17 | 18 | 有关更多信息,请阅读 README.md 19 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/forge/soldeer/update.md: -------------------------------------------------------------------------------- 1 | # forge soldeer update 2 | 3 | 通过读取配置文件更新依赖项 4 | 5 | ```bash 6 | $ forge soldeer update --help 7 | ``` 8 | 9 | ```txt 10 | 用法: forge soldeer update [选项] 11 | 12 | 选项: 13 | -g, --regenerate-remappings 如果设置,此命令将删除现有的重映射并重新创建它们 14 | -d, --recursive-deps 如果设置,此命令将递归安装依赖项(通过子模块或通过 15 | soldeer) 16 | -h, --help 打印帮助信息 17 | 18 | 欲了解更多信息,请阅读 README.md 19 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/forge/soldeer/version-dry-run.md: -------------------------------------------------------------------------------- 1 | # forge soldeer version-dry-run 2 | 3 | 4 | 5 | ```bash 6 | $ forge soldeer version-dry-run --help 7 | 用法: forge soldeer version-dry-run 8 | 9 | 选项: 10 | -h, --help Print help 11 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/cli/forge/soldeer/version.md: -------------------------------------------------------------------------------- 1 | # forge soldeer 版本 2 | 3 | 显示 Soldeer 的版本 4 | 5 | ```bash 6 | $ forge soldeer version --help 7 | ``` 8 | 9 | ```txt 10 | 用法: forge soldeer version 11 | 12 | 选项: 13 | -h, --help Print help 14 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/common/base-options.md: -------------------------------------------------------------------------------- 1 | #### Base Options 2 | 3 | `--base-in` *base* 4 |     输入数字的基数。可用的选项。 5 | 6 |     10, d, dec, decimal 7 | 8 |     16, h, hex, hexadecimal 9 | 10 | `--base-out` *base* 11 |     希望输出的基数。可用的选项。 12 | 13 |     2, b, bin, binary 14 | 15 |     8, o, oct, octal 16 | 17 |     10, d, dec, decimal 18 | 19 |     16, h, hex, hexadecimal 20 | -------------------------------------------------------------------------------- /translations/zh/reference/common/display-options.md: -------------------------------------------------------------------------------- 1 | #### Display Options 2 | 3 | `-j` 4 | `--json` 5 |      将部署信息打印成 JSON 格式。 6 | -------------------------------------------------------------------------------- /translations/zh/reference/common/etherscan-options.md: -------------------------------------------------------------------------------- 1 | #### Etherscan Options 2 | 3 | `--chain` *chain_name* 4 |     Etherscan 的链. 5 | 6 | `--etherscan-api-key` *key* 7 |     Etherscan API 密钥,或 [Etherscan 配置表](../config/etherscan.md#etherscan) 密钥。 8 |     环境变量:`ETHERSCAN_API_KEY` 9 | 10 | -------------------------------------------------------------------------------- /translations/zh/reference/common/multi-wallet-options-hardware.md: -------------------------------------------------------------------------------- 1 | #### Wallet Options - Hardware Wallet 2 | 3 | `-t` 4 | `--trezor` 5 |     使用 Trezor 硬件钱包。 6 | 7 | `-l` 8 | `--ledger` 9 |     使用 Ledger 硬件钱包。 10 | 11 | `--hd-paths` *paths* 12 |     与硬件钱包一起使用的派生路径。 -------------------------------------------------------------------------------- /translations/zh/reference/common/multi-wallet-options-keystore.md: -------------------------------------------------------------------------------- 1 | #### Wallet Options - Keystore 2 | 3 | `--keystores` *paths* 4 |     使用指定文件夹或文件中的密钥库。 5 |     环境变量:`ETH_KEYSTORE` 6 | 7 | `--account` _account-name_ 8 |     使用默认密钥库文件夹(~/.foundry/keystores)中的密钥库文件名。 9 |     环境变量:`ETH_KEYSTORE_ACCOUNT` 10 | 11 | `--password` *passwords* 12 |     密钥库的密码。与 `--keystore` 一起使用。 -------------------------------------------------------------------------------- /translations/zh/reference/common/multi-wallet-options-remote.md: -------------------------------------------------------------------------------- 1 | #### Wallet Options - Remote 2 | 3 | `-a` *addresses* 4 | `--froms` *addresses* 5 |     与 RPC 上的指定账户签署交易。 6 |     环境变量:`ETH_FROM` -------------------------------------------------------------------------------- /translations/zh/reference/common/multi-wallet-options.md: -------------------------------------------------------------------------------- 1 | {{#include multi-wallet-options-raw.md}} 2 | 3 | {{#include multi-wallet-options-keystore.md}} 4 | 5 | {{#include multi-wallet-options-hardware.md}} 6 | 7 | {{#include multi-wallet-options-remote.md}} -------------------------------------------------------------------------------- /translations/zh/reference/common/retry-options.md: -------------------------------------------------------------------------------- 1 | `--delay` *delay* 2 |     可选的超时,在两次尝试之间,以秒为单位。默认为 3。 3 | 4 | `--retries` *retries* 5 |     重试的尝试次数。默认为 15。 6 | -------------------------------------------------------------------------------- /translations/zh/reference/common/rpc-options.md: -------------------------------------------------------------------------------- 1 | #### RPC Options 2 | 3 | {{#include rpc-url-option.md}} 4 | 5 | `--flashbots` 6 |     使用 Flashbots 的 RPC URL (). 7 | -------------------------------------------------------------------------------- /translations/zh/reference/common/rpc-url-option.md: -------------------------------------------------------------------------------- 1 | `--rpc-url` *url* 2 |     RPC 端点。接受一个 URL 或[rpc_endpoints] 表中的现有别名,如 `mainnet`。 3 |     环境变量:`ETH_RPC_URL` 4 | -------------------------------------------------------------------------------- /translations/zh/reference/common/tx-value-option.md: -------------------------------------------------------------------------------- 1 | `--value` *value* 2 |     交易中要发送的以太币。 3 | 4 |     可以指定为整数(wei),也可以指定为带单位的字符串,例如: 5 |     - `1ether` 6 |     - `10gwei` 7 |     - `0.01ether` 8 | -------------------------------------------------------------------------------- /translations/zh/reference/common/verifier-options.md: -------------------------------------------------------------------------------- 1 | `--verifier` *name* 2 |     验证提供者。可用选项。`etherscan`, `sourcify` 和 `blockscout`。默认:`etherscan`。注意:确保在 Blockscout 主页资源管理器 URL 的末尾添加 "/api\?"。 3 | 4 | `--verifier-url` *url* 5 |     用于提交验证请求的可选验证网址。 6 |     环境变量:`VERIFIER_URL` 7 | -------------------------------------------------------------------------------- /translations/zh/reference/common/wallet-options-hardware.md: -------------------------------------------------------------------------------- 1 | #### Wallet Options - Hardware Wallet 2 | 3 | `-t` 4 | `--trezor` 5 |     使用 Trezor 硬件钱包。 6 | 7 | `-l` 8 | `--ledger` 9 |     使用 Ledger 硬件钱包。 10 | -------------------------------------------------------------------------------- /translations/zh/reference/common/wallet-options-keystore.md: -------------------------------------------------------------------------------- 1 | #### 钱包选项 - Keystore 2 | 3 | `--keystore` _path_ 4 |   ;   使用给定文件夹或文件中的 keystore。 5 |     环境变量:`ETH_KEYSTORE` 6 | 7 | `--account` _account-name_ 8 |     通过文件名在默认 keystores 文件夹(~/.foundry/keystores)中使用 keystore。 9 |     环境变量:`ETH_KEYSTORE_ACCOUNT` 10 | 11 | `--interactive` 12 | 13 | `--password` _password_ 14 |     keystore 密码。与 `--keystore` 一起使用。 15 |     环境变量:`ETH_PASSWORD` -------------------------------------------------------------------------------- /translations/zh/reference/common/wallet-options-remote.md: -------------------------------------------------------------------------------- 1 | #### Wallet Options - Remote 2 | 3 | `-f` *address* 4 | `--from` *address* 5 |     用 RPC 上的指定账户签署交易。 6 |     环境变量:`ETH_FROM` 7 | -------------------------------------------------------------------------------- /translations/zh/reference/common/wallet-options.md: -------------------------------------------------------------------------------- 1 | {{#include wallet-options-raw.md}} 2 | 3 | {{#include wallet-options-keystore.md}} 4 | 5 | {{#include wallet-options-hardware.md}} 6 | 7 | {{#include wallet-options-remote.md}} 8 | -------------------------------------------------------------------------------- /translations/zh/reference/config/README.md: -------------------------------------------------------------------------------- 1 | ## Config Reference 2 | 3 | - [Overview](./overview.md) 4 | - [Project](./project.md) 5 | - [Solidity Compiler](./solidity-compiler.md) 6 | - [Testing](./testing.md) 7 | - [In-line test configuration](./inline-test-config.md) 8 | - [Formatter](./formatter.md) 9 | - [Documentation Generator](./doc-generator.md) 10 | - [Etherscan](./etherscan.md) 11 | -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/abs.md: -------------------------------------------------------------------------------- 1 | ## `abs` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function abs(int256 a) internal pure returns (uint256) 7 | ``` 8 | 9 | ### 描述 10 | 11 | 返回一个数字的绝对值。 12 | 13 | ### 例子 14 | 15 | ```solidity 16 | uint256 ten = stdMath.abs(-10); 17 | ``` 18 | -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/assertFalse.md: -------------------------------------------------------------------------------- 1 | ## `assertFalse` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function assertFalse(bool data) internal; 7 | ``` 8 | 9 | ```solidity 10 | function assertFalse(bool data, string memory err) internal; 11 | ``` 12 | 13 | ### 描述 14 | 15 | 断言 `data` 为假。 16 | 17 | 可选地在回退字符串中包含错误消息。 18 | 19 | ### 例子 20 | 21 | ```solidity 22 | bool failure = contract.fun(); 23 | assertFalse(failure); 24 | ``` 25 | 26 | 27 | ### 参见 28 | 29 | - [`assertTrue`](./assertTrue.md) -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/assertTrue.md: -------------------------------------------------------------------------------- 1 | ## `assertTrue` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function assertTrue(bool data) internal; 7 | ``` 8 | 9 | ```solidity 10 | function assertTrue(bool data, string memory err) internal; 11 | ``` 12 | 13 | ### 描述 14 | 15 | 断言 `data` 为真。 16 | 17 | 可选地在回退字符串中包含错误消息。 18 | 19 | ### 示例 20 | 21 | ```solidity 22 | bool success = contract.fun(); 23 | assertTrue(success); 24 | ``` 25 | 26 | ### 参见 27 | 28 | - [`assertFalse`](./assertFalse.md) -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/assertionError.md: -------------------------------------------------------------------------------- 1 | ## `assertionError` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | stdError.assertionError 7 | ``` 8 | 9 | ### 描述 10 | 11 | 当 `断言` 失败时,Solidity 内部的错误。 -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/assume-payable.md: -------------------------------------------------------------------------------- 1 | ## `assumePayable` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function assumePayable(address addr) public; 7 | ``` 8 | 9 | ### 描述 10 | 11 | 使用 [`assume`](../../cheatcodes/assume.md) 来过滤拒绝以太币转账的地址。 12 | 13 | 这将对指定的 `addr` 进行外部调用,不带调用数据,并检查 `assume` 与调用成功的结果。 -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/change-prank.md: -------------------------------------------------------------------------------- 1 | ## `changePrank` 2 | 3 | ### 状态 4 | 5 | `changePrank` 已废弃. 6 | 7 | ### 签名 8 | 9 | ```solidity 10 | function changePrank(address who) internal; 11 | ``` 12 | 13 | ### 描述 14 | 15 | 用 `stopPrank` 停止正在进行的 prank,并将地址传给 `startPrank`。 16 | 17 | 对于在 `setUp` 函数中启动全局 prank 和在某些测试中停用它很有用。 -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/delta.md: -------------------------------------------------------------------------------- 1 | ## `delta` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function delta(uint256 a, uint256 b) internal pure returns (uint256) 7 | ``` 8 | 9 | ```solidity 10 | function delta(int256 a, int256 b) internal pure returns (uint256) 11 | ``` 12 | 13 | ### 描述 14 | 15 | 返回两个数字的绝对值之差。 16 | 17 | ### 例子 18 | 19 | ```solidity 20 | uint256 four = stdMath.delta(-1, 3); 21 | ``` 22 | -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/depth.md: -------------------------------------------------------------------------------- 1 | ## `depth` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function depth(StdStorage storage self, uint256 _depth) internal returns (StdStorage storage); 7 | ``` 8 | 9 | ### 描述 10 | 11 | 设置值在 `tuple` 中的位置(例如,在 `struct` 中)。 12 | 13 | 默认值:`uint256(0)` 14 | -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/divisionError.md: -------------------------------------------------------------------------------- 1 | ## `divisionError` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | stdError.divisionError 7 | ``` 8 | 9 | ### 描述 10 | 11 | 当除法失败时的 Solidity 内部错误,例如除以零。 -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/encodeStorageError.md: -------------------------------------------------------------------------------- 1 | ## `encodeStorageError` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | stdError.encodeStorageError 7 | ``` 8 | 9 | ### Description 10 | 11 | 当试图访问存储中被破坏的数据时的 Solidity 内部错误。除非使用了程序集,否则数据不会损坏。 -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/enumConversionError.md: -------------------------------------------------------------------------------- 1 | ## `enumConversionError` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | stdError.enumConversionError 7 | ``` 8 | 9 | ### 描述 10 | 11 | 当试图将一个数字转换为一个枚举的变体时,如果该数字大于该枚举的变体数量(从0开始计算),则 Solidity 内部会出现错误。 -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/fail.md: -------------------------------------------------------------------------------- 1 | ## `fail` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function fail(string memory err) internal virtual; 7 | ``` 8 | 9 | ### 描述 10 | 11 | 如果命中某个分支或执行点,则测试失败,并发出消息。 12 | 13 | ### 例子 14 | 15 | ```solidity 16 | function test() external { 17 | for(uint256 place; place < 10; ++i){ 18 | if(game.leaderboard(place) == address(this)) return; 19 | } 20 | fail("Not in the top 10."); 21 | } 22 | ``` -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/find.md: -------------------------------------------------------------------------------- 1 | ## `find` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function find(StdStorage storage self) internal returns (uint256); 7 | ``` 8 | 9 | ### 描述 10 | 11 | 在给定的 [`target`](.../forge-std/target.md)、[`sig`](.../forge-std/sig.md)、[`with_key`](.../forge-std/with_key.md)(s) 和 [`depth`](.../forge-std/depth.md) 中找到一个任意的储存槽。 12 | 13 | 如果不成功,则 Reverts,并提供一个信息。 14 | -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/hoax.md: -------------------------------------------------------------------------------- 1 | ## `hoax` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function hoax(address who) public; 7 | ``` 8 | 9 | ```solidity 10 | function hoax(address who, uint256 give) public; 11 | ``` 12 | 13 | ```solidity 14 | function hoax(address who, address origin) public; 15 | ``` 16 | 17 | ```solidity 18 | function hoax(address who, address origin, uint256 give) public; 19 | ``` 20 | 21 | ### 描述 22 | 23 | 从一个有一些 ether 的地址设置一个 [`prank`](.../.../cheatcodes/prank.md), 24 | 25 | 如果没有指定余额,它将被设置为 2^128 wei。 -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/indexOOBError.md: -------------------------------------------------------------------------------- 1 | ## `indexOOBError` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | stdError.indexOOBError 7 | ``` 8 | 9 | ### 描述 10 | 11 | 当试图访问一个超出边界的数组元素时,Solidity 内部的错误。 12 | 13 | 对于外部合约中的空数组将不起作用。对于这种情况,请使用不需要任何参数的 `expectRevert`。 -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/make-addr.md: -------------------------------------------------------------------------------- 1 | ## `makeAddr` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function makeAddr(string memory name) internal returns(address addr); 7 | ``` 8 | 9 | ### 描述 10 | 11 | 创建一个由所提供的 `name` 衍生的地址。 12 | 13 | 一个 [`label`](.../.../cheatcodes/label.md) 被创建为派生地址,所提供的 `name` 被作为标签值使用。 14 | 15 | ### 例子 16 | 17 | ```solidity 18 | address alice = makeAddr("alice"); 19 | emit log_address(alice); // 0x328809bc894f92807417d2dad6b7c998c1afdac6 20 | ``` 21 | -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/memOverflowError.md: -------------------------------------------------------------------------------- 1 | ## `memOverflowError` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | stdError.memOverflowError 7 | ``` 8 | 9 | ### 描述 10 | 11 | 当试图分配一个超过 2^64-1 项的动态内存数组,Solidity 内部出现的错误。 -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/popError.md: -------------------------------------------------------------------------------- 1 | ## `popError` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | stdError.popError 7 | ``` 8 | 9 | ### 描述 10 | 11 | 当试图从一个空数组上弹出一个元素时,Solidity 内部的错误。 -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/rewind.md: -------------------------------------------------------------------------------- 1 | ## `rewind` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function rewind(uint256 time) public; 7 | ``` 8 | 9 | ### 描述 10 | 11 | 将 `block.timestamp` `重新调整为指定的秒数。 12 | 13 | ### 例子 14 | 15 | ```solidity 16 | assertEq(block.timestamp, 3600); 17 | rewind(3600); 18 | assertEq(block.timestamp, 0); 19 | ``` 20 | -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/script-utils.md: -------------------------------------------------------------------------------- 1 | ## Script Utils 2 | 3 | - [`computeCreateAddress`](./compute-create-address.md) 4 | - [`deriveRememberKey`](./derive-remember-key.md) 5 | -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/skip.md: -------------------------------------------------------------------------------- 1 | ## `skip` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function skip(uint256 time) public; 7 | ``` 8 | 9 | ### 描述 10 | 11 | 将 `block.timestamp` 向前跳过指定的秒数。 12 | 13 | ### 例子 14 | 15 | ```solidity 16 | assertEq(block.timestamp, 0); 17 | skip(3600); 18 | assertEq(block.timestamp, 3600); 19 | ``` 20 | -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/startHoax.md: -------------------------------------------------------------------------------- 1 | ## `startHoax` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function startHoax(address who) public; 7 | ``` 8 | 9 | ```solidity 10 | function startHoax(address who, uint256 give) public; 11 | ``` 12 | 13 | ```solidity 14 | function startHoax(address who, address origin) public; 15 | ``` 16 | 17 | ```solidity 18 | function startHoax(address who, address origin, uint256 give) public; 19 | ``` 20 | 21 | ### 描述 22 | 23 | 从一个有一些 ether 的地址开始一个 [永久的 `prank`](../../cheatcodes/start-prank.md)。 24 | 25 | 如果没有指定余额,它将被设置为 2^128 wei。 -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/std-cheats.md: -------------------------------------------------------------------------------- 1 | ## Std Cheats 2 | 3 | - [`skip`](./skip.md) 4 | - [`rewind`](./rewind.md) 5 | - [`hoax`](./hoax.md) 6 | - [`startHoax`](./startHoax.md) 7 | - [`deal`](./deal.md) 8 | - [`deployCode`](./deployCode.md) 9 | - [`deployCodeTo`](./deployCodeTo.md) 10 | - [`bound`](./bound.md) 11 | - [`changePrank`](./change-prank.md) 12 | - [`makeAddr`](./make-addr.md) 13 | - [`makeAddrAndKey`](./make-addr-and-key.md) 14 | - [`noGasMetering`](./noGasMetering.md) 15 | -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/std-errors.md: -------------------------------------------------------------------------------- 1 | ## Std Errors 2 | 3 | - [`assertionError`](./assertionError.md) 4 | - [`arithmeticError`](./arithmeticError.md) 5 | - [`divisionError`](./divisionError.md) 6 | - [`enumConversionError`](./enumConversionError.md) 7 | - [`encodeStorageError`](./encodeStorageError.md) 8 | - [`popError`](./popError.md) 9 | - [`indexOOBError`](./indexOOBError.md) 10 | - [`memOverflowError`](./memOverflowError.md) 11 | - [`zeroVarError`](./zeroVarError.md) -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/std-math.md: -------------------------------------------------------------------------------- 1 | ## Std Math 2 | 3 | - [`abs`](./abs.md) 4 | - [`delta`](./delta.md) 5 | - [`percentDelta`](./percentDelta.md) -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/target.md: -------------------------------------------------------------------------------- 1 | ## `target` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | function target(StdStorage storage self, address _target) internal returns (StdStorage storage); 7 | ``` 8 | 9 | ### 描述 10 | 11 | 设置合约的地址。 12 | 13 | 默认值:`address(0)` -------------------------------------------------------------------------------- /translations/zh/reference/forge-std/zeroVarError.md: -------------------------------------------------------------------------------- 1 | ## `zeroVarError` 2 | 3 | ### 签名 4 | 5 | ```solidity 6 | stdError.zeroVarError 7 | ``` 8 | 9 | ### 描述 10 | 11 | 当试图通过一个尚未初始化的函数指针调用一个函数时,Solidity 的内部错误。 -------------------------------------------------------------------------------- /translations/zh/reference/forge/README.md: -------------------------------------------------------------------------------- 1 | ## forge Commands 2 | 3 | - [General Commands](./general-commands.md) 4 | - [Project Commands](./project-commands.md) 5 | - [Build Commands](./build-commands.md) 6 | - [Test Commands](./test-commands.md) 7 | - [Deploy Commands](./deploy-commands.md) 8 | - [Utility Commands](./utility-commands.md) 9 | -------------------------------------------------------------------------------- /translations/zh/reference/forge/build-commands.md: -------------------------------------------------------------------------------- 1 | ## 编译命令 2 | 3 | - [forge build](./forge-build.md) 4 | - [forge clean](./forge-clean.md) 5 | - [forge inspect](./forge-inspect.md) 6 | -------------------------------------------------------------------------------- /translations/zh/reference/forge/common-options.md: -------------------------------------------------------------------------------- 1 | #### 普通选项 2 | 3 | `-h` 4 | `--help` 5 |     打印帮助信息。 6 | -------------------------------------------------------------------------------- /translations/zh/reference/forge/deploy-commands.md: -------------------------------------------------------------------------------- 1 | ## Deploy 命令 2 | 3 | - [forge create](./forge-create.md) 4 | - [forge verify-contract](./forge-verify-contract.md) 5 | - [forge verify-check](./forge-verify-check.md) 6 | - [forge flatten](./forge-flatten.md) 7 | -------------------------------------------------------------------------------- /translations/zh/reference/forge/forge-clean.md: -------------------------------------------------------------------------------- 1 | ## forge clean 2 | 3 | ### 名称 4 | 5 | forge-clean - 删除构建 artifacts 和缓存目录。 6 | 7 | ### 简介 8 | 9 | ``forge clean`` [*options*] 10 | 11 | ### 描述 12 | 13 | 删除构建 artifacts 和缓存目录。 14 | 15 | ### 选项 16 | 17 | #### 清除选项 18 | 19 | `--root` *path* 20 |     项目的根路径。默认为当前工作目录。 21 | 22 | {{#include common-options.md}} 23 | 24 | ### 例子 25 | 26 | 1. 在一个项目中清理 artifacts 和缓存。 27 | ```sh 28 | forge clean 29 | ``` 30 | 31 | ### 另请参阅 32 | 33 | [forge](./forge.md) 34 | -------------------------------------------------------------------------------- /translations/zh/reference/forge/forge-help.md: -------------------------------------------------------------------------------- 1 | ## forge help 2 | 3 | ### 名称 4 | 5 | forge-help - 获取 Forge 命令的帮助 6 | 7 | ### 简介 8 | 9 | ``forge help`` [*subcommand*] 10 | 11 | ### 描述 12 | 13 | 打印给定命令的帮助信息。 14 | 15 | ### 例子 16 | 17 | 1. 为一个命令获得帮助: 18 | ```sh 19 | forge help build 20 | ``` 21 | 22 | 2. 帮助也可以通过 `--help` 标志获得。 23 | ```sh 24 | forge build --help 25 | ``` 26 | 27 | ### 另请参阅 28 | 29 | [forge](./forge.md) 30 | -------------------------------------------------------------------------------- /translations/zh/reference/forge/general-commands.md: -------------------------------------------------------------------------------- 1 | ## General Commands 2 | 3 | - [forge](./forge.md) 4 | - [forge help](./forge-help.md) 5 | - [forge completions](./forge-completions.md) 6 | -------------------------------------------------------------------------------- /translations/zh/reference/forge/project-commands.md: -------------------------------------------------------------------------------- 1 | ## Project Commands 2 | 3 | - [forge init](./forge-init.md) 4 | - [forge clone](./forge-clone.md) 5 | - [forge install](./forge-install.md) 6 | - [forge update](./forge-update.md) 7 | - [forge remove](./forge-remove.md) 8 | - [forge config](./forge-config.md) 9 | - [forge remappings](./forge-remappings.md) 10 | - [forge tree](./forge-tree.md) 11 | - [forge geiger](./forge-geiger.md) 12 | -------------------------------------------------------------------------------- /translations/zh/reference/forge/test-commands.md: -------------------------------------------------------------------------------- 1 | ## Test Commands 2 | 3 | - [forge test](./forge-test.md) 4 | - [forge snapshot](./forge-snapshot.md) 5 | - [forge coverage](./forge-coverage.md) 6 | -------------------------------------------------------------------------------- /translations/zh/reference/forge/utility-commands.md: -------------------------------------------------------------------------------- 1 | ## Utility Commands 2 | 3 | - [forge debug](./forge-debug.md) 4 | - [forge bind](./forge-bind.md) 5 | - [forge cache](./forge-cache.md) 6 | - [forge cache clean](./forge-cache-clean.md) 7 | - [forge cache ls](./forge-cache-ls.md) 8 | - [forge script](./forge-script.md) 9 | - [forge upload-selectors](./forge-upload-selectors.md) 10 | - [forge doc](./forge-doc.md) 11 | --------------------------------------------------------------------------------