随笔分类 -  go学习

摘要:const { deployments, upgrades, ethers } = require("hardhat"); const fs = require("fs"); const path = require("path"); module.exports = async ({ getNam 阅读全文
posted @ 2025-08-26 23:50 Lucas_coming 阅读(9) 评论(0) 推荐(0)
摘要:// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity ^0.8; import "./NftAuction.sol"; contract NftAuctionV2 is NftAuction { function tes 阅读全文
posted @ 2025-08-26 23:48 Lucas_coming 阅读(13) 评论(0) 推荐(0)
摘要:// SPDX-License-Identifier: MIT pragma solidity ^0.8; import "./NftAuction.sol"; contract NftAuctionFactory { address[] public auctions; mapping (uint 阅读全文
posted @ 2025-08-26 23:47 Lucas_coming 阅读(8) 评论(0) 推荐(0)
摘要:// SPDX-License-Identifier: SEE LICENSE IN LICENSE pragma solidity ^0.8; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; i 阅读全文
posted @ 2025-08-26 23:46 Lucas_coming 阅读(16) 评论(0) 推荐(0)
摘要:实现简单的 ERC20 代币合约 现在我将创建一个完整的 ERC20 代币合约项目。首先创建合约文件: // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title MyToken * @dev 一个简单的 ERC20 代币 阅读全文
posted @ 2025-08-17 09:36 Lucas_coming 阅读(45) 评论(0) 推荐(0)
摘要:错误处理 1. require 语句 require 用于在执行函数之前检查条件是否满足。如果条件不满足,require 会抛出异常并回滚所有状态更改。它通常用于验证用户输入或外部调用的合法性。 语法 require(条件, "Error code"); 示例 function transfer(a 阅读全文
posted @ 2025-08-12 23:47 Lucas_coming 阅读(20) 评论(0) 推荐(0)
摘要:1. 地址类型 在 Solidity 中,address 类型用于存储以太坊地址。地址可以是外部账户(EOA)或合约账户。地址类型是 Solidity 中最基本的数据类型之一,常用于处理以太坊账户之间的交互。 1.1 地址类型的基本操作 // 声明一个地址变量 address public myAd 阅读全文
posted @ 2025-08-12 23:47 Lucas_coming 阅读(47) 评论(0) 推荐(0)