rbtree
rbtree
const leaves = ['a', 'b', 'c'].map(x => SHA256(x)) const tree = new MerkleTree(leaves, SHA256) const root = tree.getRoot().toString('hex') const proofIndices = [0, 2] const proofLeaves = proofIndices.map(i => leaves[i]) const...
教程里面的描述 ` try externalContract.f() returns(returnType){ // call成功的情况下 运行一些代码 } catch Error(string memory reason) { // 捕获失败的 revert() 和 require() } catch (bytes memory reason) { // 捕获失败的 assert() } `...
第24讲里面说“uniswap使用的是create2创建合约,限制构造函数不能有参数”。 这种说法是错误的,create2并没有这样的限制。例如我把代码改成如下形式,不会有编译或运行上的问题。 只是此时,在计算pair合约地址的时候,需要在creationCode的后面补上tokenA和tokenB。对uniswap来说,这样就会产生一个问题,(tokenA,tokenB)和(tokenB,tokenA)的地址会不一样,uniswap不把tokenA和tokenB放在构造函数里是为了避免token顺序影响合约地址。 ` // SPDX-License-Identifier: GPL-3.0 pragma solidity ^0.8.0; contract Pair{ address public factory; // 工厂合约地址 address public token0; // 代币1 address public token1; // 代币2 constructor(address _token0, address...
https://github.com/AmazingAng/WTF-Solidity/issues/281