好的,我们的池合约已经完成了。现在,让我们看看如何将它部署到本地 Ethereum 网络,以便稍后可以从前端应用程序中使用它。 ## 选择本地区块链网络 智能合约开发需要运行一个本地网络,你可以在开发和测试期间将合约部...
### 0. 版本 [openzeppelin]:v4.8.3,[forge-std]:v1.5.6 #### 0.1 ERC1820Implementer.sol Github: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.3/contracts/utils/introspection/ERC1820Implementer.sol ERC1820Implementer合约是对IERC1820Implementer interface的实...
智能合约代码: ``` function mintWhitelist() external { uint256 totalMinted = totalSupply(); require(totalMinted < MAX, "All minted"); uint256 whitelistAmount = whitelistNumber[msg.sender]; require(whitelistAmount > 0, "Not in whitelist"); ... } ...
> 一旦你按照[这里](https://learnblockchain.cn/article/21770)所学,设置好你的本地 Foundry 环境,是时候深入了解以太坊交易的内部机制,看看当 EVM 执行你的代码时实际发生了什么。 > > 从 calldata 解码到存储写入的每一个操作,都可以使...
## 目录架构 我们先看看安装了foundry后各个目录的作用,下面是一张图片,我们挨个讲解  ### lib/forge-std 我们安装的库都会在这里...
> * 原文链接: https://patrickalphac.medium.com/fuzz-invariant-tests-the-new-bare-minimum-for-smart-contract-security-87ebe150e88c > * 译文出自:[登链翻译计划](https://github.com/lbc-team/Pioneer) > * 译者:[翻译小组](https://learnblockchain.cn/people/412) 校对:[Tiny ...
### 0. 版本 [forge-std]:v1.5.6 ### 1. 关于内联汇编staticcall 内联汇编中,Instruction `staticcall`的功能及使用方法与Instruction `call`类似。唯一不同的是在staticcall中不允许发生storage的修改。 staticcall的使用方法如下: ```solidity a...
### 0. 版本 [openzeppelin]:v4.8.3,[forge-std]:v1.5.6 #### 0.1 SignatureChecker.sol Github: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.3/contracts/utils/cryptography/SignatureChecker.sol SignatureChecker库是一个用于链上签名验证的helper库。该...
## 目录 1. [导入钱包私钥到 keystore](#1-导入钱包私钥到-keystore) 2. [编写合约和部署脚本](#2-编写合约和部署脚本) 3. [配置环境变量](#3-配置环境变量) 4. [编写 Bash 部署脚本](#4-编写-bash-部署脚本) 5. [运行部署脚本](#5-运行部...
## 概述 [Hyperliquid](https://hyperliquid.gitbook.io/hyperliquid-docs) 的双重架构结合了高性能的交易引擎 ( **[HyperCore](https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore)**) 和 EVM 兼容性 ( **[HyperEVM](https://hyperliquid.gitbook.io/hyperliquid-docs/hyperevm)**),为...
## 概述 [Hyperliquid](https://hyperliquid.gitbook.io/hyperliquid-docs) 的双重架构结合了高性能交易引擎(**[HyperCore](https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore)**)与 EVM 兼容性(**[HyperEVM](https://hyperliquid.gitbook.io/hyperliquid-docs/hyperevm)**),为...
### 0. 版本 [openzeppelin]:v4.8.3,[forge-std]:v1.5.6 #### 0.1 PullPayment.sol Github: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.3/contracts/security/PullPayment.sol PullPayment库是对Openzeppelin中Escrow库的一种封装。从安全角度看,PullPayme...
## 介绍 在本文中,我们将讨论不变性以及如何使用 foundry 测试套件对 Solidity 智能合约进行不变性测试。 不变性测试是一种类似于单元测试和模糊测试的测试方法,用于验证代码的正确性。如果你不熟悉单元测试,请参阅我...
以下是一个在 [Foundry](https://learnblockchain.cn/article/9780) 环境中使用 OpenZeppelin 安全创建和验证 ECDSA 签名的最小示例(可以直接复制粘贴)。 ## 合约:Verifier.sol ```solidity // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/...
### 0. 版本 [openzeppelin]:v4.8.3,[forge-std]:v1.5.6 #### 0.1 Strings.sol Github: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.8.3/contracts/utils/Strings.sol ### 1. 补充:关于memory的string的layout 在memory中创建一个数组,前32个字节存放...