博文

Base公会测试网NFT合约验证 | Base Learn Newcomer | Acolyte | Consul | Perfect | Supreme

 Base Learn Newcomer NFT 1: Own a(n) Basic Contracts Pin NFT https://sepolia.basescan.org/token/0x075eb9dc52177aa3492e1d26f0fde3d729625d2f Base Learn Acolyte NFT 2: Own a(n) Control Structures Pin NFT https://sepolia.basescan.org/token/0xf4d953a3976f392aa5509612deff395983f22a84 NFT 3: Own a(n) Arrays Pin NFT https://sepolia.basescan.org/token/0x5b0f80ca6f5bd60cc3b64f0377f336b2b2a56cdf NFT 4: Own a(n) Storage Pin NFT https://sepolia.basescan.org/token/0x567452c6638c0d2d9778c20a3d59749fdcaa7ab3 Base Learn Consul NFT 5: Own a(n) Mappings Pin NFT https://sepolia.basescan.org/token/0xd32e3ace3272e2037003ca54ca7e5676f9b8d06c NFT 6: Own a(n) Inheritance NFT https://sepolia.basescan.org/token/0xf90da05e77a33fe6d64bc2df84e7dd0069a2111c NFT 7: Own a(n) Structs Pin NFT https://sepolia.basescan.org/token/0x9eb1fa4cd9bd29ca2c8e72217a642811c1f6176d Base Learn Perfect NFT 8: Own a(n) Error Triage Pin NFT https://sepolia.basescan.org/token/0xc1bd0d9a8863f2318001bc5024c7f5f58a2236f7 NFT 9: Own a(n)...

Baseed Developers 主网合约代码

Based Developers 需要完成5次base主网上面的合约部署,部署Token合约。才能完成角色 标准合代码 Token.sol 复制代码 // 0.5.1-c8a2 // Enable optimization pragma solidity ^0.5.0; interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender`...

Base Learn Supreme-5——SCD ERC721 、Minimal Token、ERC20

感谢X用户@isnotberlin提供的代码 以下是,Base Learn Supreme的3个NFT代码,SCD ERC721 、Minimal Token、ERC20 1. Own a(n) SCD ERC721 Pin NFT Solidity 接口 复制代码 // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // Importing OpenZeppelin ERC721 contract import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol"; // Interface for interacting with a submission contract interface ISubmission { // Struct representing a haiku struct Haiku { address author; // Address of the haiku author string line1; // First line of the haiku string line2; // Second line of the haiku string line3; // Third line of the haiku } // Function to mint a new haiku function mintHaiku( string memory _line1, string memory _line2, string memory _line3 ) external; // Function to get the total number of haikus function counter() ...

Base Learn Prefect-4——Own a(n) Imports Pin NFT

感谢X用户@isnotberlin提供的代码 以下是,Base Learn Prefect-代码 Own a(n) Imports Pin NFT 1. Own a(n) Imports Pin NFT由两段代码组成SillyStringUtils.sol和imports.sol SillyStringUtils.sol SillyStringUtils.sol 复制代码 // SPDX-License-Identifier: MIT pragma solidity ^0.8.17; library SillyStringUtils { struct Haiku { string line1; string line2; string line3; } function shruggie(string memory _input) internal pure returns (string memory) { return string.concat(_input, unicode" 🤷"); } } 这段代码被imports.sol引用 imports.sol imports.sol 复制代码 // SPDX-License-Identifier: MIT // Importing the SillyStringUtils library import "./SillyStringUtils.sol"; pragma solidity 0.8.17; contract ImportsExercise { // Using the SillyStringUtils library for string manipulation using SillyStringUtils for string; // Declaring a...

Base Learn Prefect-4——Own a(n) Error Triage Pin NFT

复制代码 // SPDX-License-Identifier: MIT pragma solidity ^0.8.17; contract ErrorTriageExercise { /** * @dev Finds the difference between each uint with its neighbor (a to b, b to c, etc.) * and returns a uint array with the absolute integer difference of each pairing. * * @param _a The first unsigned integer. * @param _b The second unsigned integer. * @param _c The third unsigned integer. * @param _d The fourth unsigned integer. * * @return results An array containing the absolute differences between each pair of integers. */ function diffWithNeighbor( uint _a, uint _b, uint _c, uint _d ) public pure returns (uint[] memory) { // Initialize an array to store the differences uint[] memory results = new uint[](3); // Calculate the absolute difference between each pair of integers and store it in the results array results[0] = _a > _b ? _a - _b : _b - _a; ...

Base Learn Prefect-4-——Own a(n) New Keyword Pin NFT

感谢X用户@isnotberlin提供的代码 以下是,Base Learn Prefect-代码 Own a(n) New Keyword Pin NFT 1. Own a(n) Error Triage Pin NFT由两段代码组成AddressBook.sol和other contract.sol AddressBook.sol AddressBook.sol 复制代码 // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.8; import "@openzeppelin/contracts/access/Ownable.sol"; contract AddressBook is Ownable { // Define a private salt value for internal use string private salt = "value"; // Define a struct to represent a contact struct Contact { uint id; // Unique identifier for the contact string firstName; // First name of the contact string lastName; // Last name of the contact uint[] phoneNumbers; // Array to store multiple phone numbers for the contact } // Array to store all contacts Contact[] private contacts; // Mapping to store the index of each contact in the contacts array using its ID mapping...

Base Learn Consul-3 含代码Mappings、Inheritance、Structs

感谢X用户@timurwp1提供的代码 以下是,Base Learn Consul的3个NFT代码,Mappings 、Inheritance、Structs 1. Own a(n) Mappings Pin NFT ——Contract要选择Submission Solidity 接口 复制代码 // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.23; interface ISubmission { function getApprovedRecords() external view returns (string[] memory); function addRecord(string memory _albumName) external; function getUserFavorites( address _address ) external view returns (string[] memory); function resetUserFavorites() external; } contract Submission is ISubmission { mapping(address => string[]) public userFavorites; function getApprovedRecords() external pure override returns (string[] memory) { string[] memory approved = new string[](9); approved[0] = "Thriller"; approved[1] = "Back in Black"; approved[2] = "The Bodyguard"; ...