随笔分类 - Solidity
摘要:// 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,
阅读全文
摘要:// 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
阅读全文
摘要:// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.7; contract ArrayShift { uint[] public arr; function example() public { arr = [1,2,3]; delete
阅读全文
摘要:// SPDX-License-Identifier: GPL-3.0 //array -dynamic or fixed size //Initialization // Insert(push),get, update, delete,pop, length // createing array
阅读全文
摘要:// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.7; contract FunctionOutputs { function returnMany() public pure returns (uint, bool) { return
阅读全文
摘要:// SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.7; contract Ownable { address public owner; constructor() { owner = msg.sender; } modifier on
阅读全文
摘要:bytes32 public constant INIT_CODE_PAIR_HASH = keccak256(abi.encodePacked(type(UniswapV2Pair).creationCode));
阅读全文
摘要:一、新的特性 安全数学:老版本是没有的,会出现数学溢出的。之前的uint无符号正整数有数学溢出,在使用的时候都要引用安全数学的方法,0-1得到的是uint256最大值并不会得-1,因为uint是无符号整数,不会出现-1。 // SPDX-License-Identifier: MIT pragma
阅读全文
摘要:僵尸游戏是国外大神开发的solidity学习网站游戏,类似现在的少儿编程闯关制度 如何让 _generateRandomDna 函数返回一个全(半) 随机的 uint? Ethereum 内部有一个散列函数keccak256,它用了SHA3版本。一个散列函数基本上就是把一个字符串转换为一个256位的
阅读全文

浙公网安备 33010602011771号