solidity合约创建合约
参考uniswap的Factory合约创建交易对
pragma solidity ^0.8.1;
contract Pair{
address public factory;
address public token0;
address public token1;
constructor(address _token0, address _token1) payable{
token0 = _token0;
token1 = _token1;
factory = msg.sender;
}
}
contract Factory{
// 存储创建的子合约地址
Pair[] public allPairs;
// 创建pair
function createPair(address _token0,
solidity合约创建合约最先出现在Python成神之路。
共有 0 条评论