摘要: Libraries are similar to contracts, but you can't declare any state variable and you can't send ether. A library is embedded into the contract if all 阅读全文
posted @ 2022-08-01 00:29 ZaleSwfit 阅读(24) 评论(0) 推荐(0)
摘要: abi.encode encodes data into bytes. abi.decode decodes bytes back into data. // SPDX-License-Identifier: MIT pragma solidity ^0.8.13; contract AbiDeco 阅读全文
posted @ 2022-08-01 00:28 ZaleSwfit 阅读(104) 评论(0) 推荐(0)
摘要: keccak256 computes the Keccak-256 hash of the input. Some use cases are: Creating a deterministic unique ID from a input Commit-Reveal scheme Compact 阅读全文
posted @ 2022-08-01 00:28 ZaleSwfit 阅读(41) 评论(0) 推荐(0)
摘要: Gas Saving TechniquesSome gas saving techniques. Replacing memory with calldataLoading state variable to memoryReplace for loop i++ with ++iCaching ar 阅读全文
posted @ 2022-08-01 00:27 ZaleSwfit 阅读(19) 评论(0) 推荐(0)
摘要: Messages can be signed off chain and then verified on chain using a smart contract. Example using ethers.js // SPDX-License-Identifier: MIT pragma sol 阅读全文
posted @ 2022-08-01 00:27 ZaleSwfit 阅读(34) 评论(0) 推荐(0)
摘要: Modifiers are code that can be run before and / or after a function call. Modifiers can be used to: Restrict access Validate inputs Guard against reen 阅读全文
posted @ 2022-08-01 00:26 ZaleSwfit 阅读(38) 评论(0) 推荐(0)
摘要: Ether WalletAn example of a basic wallet. Anyone can send ETH.Only the owner can withdraw. // SPDX-License-Identifier: MITpragma solidity ^0.8.13; con 阅读全文
posted @ 2022-08-01 00:26 ZaleSwfit 阅读(31) 评论(0) 推荐(0)