07 2022 档案

摘要:Solidity supports multiple inheritance. Contracts can inherit other contract by using the is keyword. Function that is going to be overridden by a chi 阅读全文 »
posted @ 2022-07-31 22:53 ZaleSwfit 阅读(19) 评论(0) 推荐(0) 编辑
摘要:Constants are variables that cannot be modified. Their value is hard coded and using constants can save gas cost. // SPDX-License-Identifier: MIT prag 阅读全文 »
posted @ 2022-07-31 22:52 ZaleSwfit 阅读(13) 评论(0) 推荐(0) 编辑
摘要:There are several ways to return outputs from a function. Public functions cannot accept certain data types as inputs or outputs // SPDX-License-Ident 阅读全文 »
posted @ 2022-07-31 22:35 ZaleSwfit 阅读(17) 评论(0) 推荐(0) 编辑
摘要:Getter functions can be declared view or pure. View function declares that no state will be changed. Pure function declares that no state variable wil 阅读全文 »
posted @ 2022-07-31 22:34 ZaleSwfit 阅读(15) 评论(0) 推荐(0) 编辑
摘要:A constructor is an optional function that is executed upon contract creation. Here are examples of how to pass arguments to constructors. // SPDX-Lic 阅读全文 »
posted @ 2022-07-31 22:33 ZaleSwfit 阅读(67) 评论(0) 推荐(0) 编辑
摘要:An error will undo all changes made to the state during a transaction. You can throw an error by calling require, revert or assert. require is used to 阅读全文 »
posted @ 2022-07-31 22:20 ZaleSwfit 阅读(38) 评论(0) 推荐(0) 编辑
摘要:Unlike functions, state variables cannot be overridden by re-declaring it in the child contract. Let's learn how to correctly override inherited state 阅读全文 »
posted @ 2022-07-31 22:19 ZaleSwfit 阅读(23) 评论(0) 推荐(0) 编辑
摘要:When a function is called, the first 4 bytes of calldata specifies which function to call. This 4 bytes is called a function selector. Take for exampl 阅读全文 »
posted @ 2022-07-31 22:17 ZaleSwfit 阅读(29) 评论(0) 推荐(0) 编辑
摘要:fallback is a function that does not take any arguments and does not return anything. It is executed either when a function that does not exist is cal 阅读全文 »
posted @ 2022-07-31 22:16 ZaleSwfit 阅读(9) 评论(0) 推荐(0) 编辑
摘要:You can interact with other contracts by declaring an Interface. Interface cannot have any functions implemented can inherit from other interfaces all 阅读全文 »
posted @ 2022-07-31 22:02 ZaleSwfit 阅读(43) 评论(0) 推荐(0) 编辑
摘要:Functions and addresses declared payable can receive ether into the contract. // SPDX-License-Identifier: MIT pragma solidity ^0.8.13; contract Payabl 阅读全文 »
posted @ 2022-07-31 22:02 ZaleSwfit 阅读(36) 评论(0) 推荐(0) 编辑
摘要:Functions and state variables have to declare whether they are accessible by other contracts. Functions can be declared as public - any contract and a 阅读全文 »
posted @ 2022-07-31 21:58 ZaleSwfit 阅读(20) 评论(0) 推荐(0) 编辑
摘要:Parent contracts can be called directly, or by using the keyword super. By using the keyword super, all of the immediate parent contracts will be call 阅读全文 »
posted @ 2022-07-31 21:57 ZaleSwfit 阅读(30) 评论(0) 推荐(0) 编辑
摘要:原文网址:https://solidity-by-example.org/new-contract/ Contracts can be created by other contracts using the new keyword. Since 0.8.0, new keyword support 阅读全文 »
posted @ 2022-07-31 21:56 ZaleSwfit 阅读(20) 评论(0) 推荐(0) 编辑
摘要:try / catch can only catch errors from external function calls and contract creation. // SPDX-License-Identifier: MIT pragma solidity ^0.8.13; // Exte 阅读全文 »
posted @ 2022-07-31 21:55 ZaleSwfit 阅读(75) 评论(0) 推荐(0) 编辑
摘要:You can import local and external files in Solidity. Local Here is our folder structure. ├── Import.sol └── Foo.sol Foo.sol // SPDX-License-Identifier 阅读全文 »
posted @ 2022-07-31 21:54 ZaleSwfit 阅读(17) 评论(0) 推荐(0) 编辑
摘要:Contract can call other contracts in 2 ways. The easiest way to is to just call it, like A.foo(x, y, z). Another way to call other contracts is to use 阅读全文 »
posted @ 2022-07-31 21:54 ZaleSwfit 阅读(23) 评论(0) 推荐(0) 编辑
摘要:// SPDX-License-Identifier: GPL-3.0//通过合约部署合约,通过代理合约去部署, pragma solidity ^0.8.3; contract TestContract1 { address public owner = msg.sender; function 阅读全文 »
posted @ 2022-07-29 18:39 ZaleSwfit 阅读(151) 评论(0) 推荐(0) 编辑
摘要:// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.3; contract Enum { enum Status {//枚举和结构体都是一种类型 None, Pending, Shipped, Completed, Rejected, C 阅读全文 »
posted @ 2022-07-29 17:26 ZaleSwfit 阅读(85) 评论(0) 推荐(0) 编辑
摘要:// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.3; contract Structs {//结构体是能够将多种变量格式打包一起的数据格式,以一种类型的形式存在 struct Car { string model;//默认值字符串 u 阅读全文 »
posted @ 2022-07-29 16:01 ZaleSwfit 阅读(116) 评论(0) 推荐(0) 编辑
摘要:// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.7; contract IterableMapping { mapping(address => uint) public balances;//地址对应余额映射 mapping(add 阅读全文 »
posted @ 2022-07-29 12:27 ZaleSwfit 阅读(50) 评论(0) 推荐(0) 编辑
摘要:// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.7; //remove array element by shifting elements to left //[1,2,3,4,5,6] -- remove(2) --> [1,2, 阅读全文 »
posted @ 2022-07-28 23:37 ZaleSwfit 阅读(211) 评论(0) 推荐(0) 编辑
摘要:// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.7; //mapping //how to declare a mapping (simple and nested) //Set, get ,delete //["alice", "b 阅读全文 »
posted @ 2022-07-28 23:37 ZaleSwfit 阅读(69) 评论(0) 推荐(0) 编辑
摘要:// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.7; contract ArrayShift { uint[] public arr; function example() public { arr = [1,2,3]; delete 阅读全文 »
posted @ 2022-07-27 12:38 ZaleSwfit 阅读(148) 评论(0) 推荐(0) 编辑
摘要:// SPDX-License-Identifier: GPL-3.0 //array -dynamic or fixed size //Initialization // Insert(push),get, update, delete,pop, length // createing array 阅读全文 »
posted @ 2022-07-26 22:31 ZaleSwfit 阅读(113) 评论(0) 推荐(0) 编辑
摘要:// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.7; contract FunctionOutputs { function returnMany() public pure returns (uint, bool) { return 阅读全文 »
posted @ 2022-07-26 15:33 ZaleSwfit 阅读(31) 评论(0) 推荐(0) 编辑
摘要:// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.7; contract Ownable { address public owner; constructor() { owner = msg.sender; } modifier on 阅读全文 »
posted @ 2022-07-26 11:41 ZaleSwfit 阅读(71) 评论(0) 推荐(0) 编辑
摘要:一些变量的固定值,这些变量的值不能在部署合约后被任何函数修改;管理员地址和特殊编码通常定义为常量。默认常量可以减少gas费消耗 阅读全文 »
posted @ 2022-07-25 00:43 ZaleSwfit 阅读(38) 评论(0) 推荐(0) 编辑
摘要:chrome谷歌商店搜索sui钱包安装 阅读全文 »
posted @ 2022-07-23 23:38 ZaleSwfit 阅读(639) 评论(0) 推荐(0) 编辑
摘要:bytes32 public constant INIT_CODE_PAIR_HASH = keccak256(abi.encodePacked(type(UniswapV2Pair).creationCode)); 阅读全文 »
posted @ 2022-07-22 23:30 ZaleSwfit 阅读(35) 评论(0) 推荐(0) 编辑
摘要:multical合约作用:在运行一个交易所/去中心化金融dapp的项目前端时,前端要向区块链读很多数据,也许一个页面就充满了数据,tlv ,币价,挖矿合约,锁仓量。这些数据需要一个个去链上读取一个个合约,一个个方法去读,但是这样会造成大量的对链请求。可以将大量的请求安装以太坊的规则进行封装,然后一次 阅读全文 »
posted @ 2022-07-20 00:11 ZaleSwfit 阅读(781) 评论(0) 推荐(0) 编辑
摘要:一、新的特性 安全数学:老版本是没有的,会出现数学溢出的。之前的uint无符号正整数有数学溢出,在使用的时候都要引用安全数学的方法,0-1得到的是uint256最大值并不会得-1,因为uint是无符号整数,不会出现-1。 // SPDX-License-Identifier: MIT pragma 阅读全文 »
posted @ 2022-07-18 22:56 ZaleSwfit 阅读(166) 评论(0) 推荐(0) 编辑
摘要:JavaScript 异步编程:https://www.runoob.com/js/js-async.html JavaScript Promise 对象:https://www.runoob.com/w3cnote/javascript-promise-object.html , https:// 阅读全文 »
posted @ 2022-07-11 10:14 ZaleSwfit 阅读(21) 评论(0) 推荐(0) 编辑
摘要:react中,ReactDOM.render{<Persion{...P}>} 此花括号是做一个分隔符再用,这里的...P JS原生中是用来浅拷贝 (Shallow-cloning,不包含 prototype) 和对象合并,https://developer.mozilla.org/zh-CN/do 阅读全文 »
posted @ 2022-07-04 18:33 ZaleSwfit 阅读(199) 评论(0) 推荐(0) 编辑
摘要:官方严格模式介绍:https://react.docschina.org/docs/strict-mode.html 查看严格模式网址,在F12控制台一般可以找到https://babeljs.io/repl JSX其实就是JS的语法糖 //2.渲染组件到页面 ReactDOM.render(<My 阅读全文 »
posted @ 2022-07-03 17:46 ZaleSwfit 阅读(41) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示