区块链、人工智能、数字孪生、人机交互、物联网等面向数据的新一代信息技术的演进并非偶然,而是从Web2.0向Web3.0演进的技术准备。
从技术上来看,元宇宙是基于Web3.0技术体系和运作机制支撑下的可信数字化价值交互网络,是以区块链为核心的Web3.0数字新生态。元宇宙是以区块链为核心的Web3.0技术体系支撑下的新场景、新产业和新生态,将会在数字环境下催生大量创新商业模式,形成数字空间新范式。
//line18,增加BSC
(function (ChainId) {
ChainId[ChainId["MAINNET"] = 1] = "MAINNET";
ChainId[ChainId["ROPSTEN"] = 3] = "ROPSTEN";
ChainId[ChainId["RINKEBY"] = 4] = "RINKEBY";
ChainId[ChainId["G\xD6RLI"] = 5] = "G\xD6RLI";
ChainId[ChainId["KOVAN"] = 42] = "KOVAN";
ChainId[ChainId["BSC"] = 97] = "BSC";
})(ChainId || (ChainId = {}));
//替换factory,initcode
var FACTORY_ADDRESS = '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f';
var INIT_CODE_HASH = '0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f';
//line442,增加对应的weth
var WETH = (_WETH = {}, _WETH[ChainId.MAINNET] = /#PURE/new Token(ChainId.MAINNET, '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', 18, 'WETH', 'Wrapped Ether'), _WETH[ChainId.ROPSTEN] = /#PURE/new Token(ChainId.ROPSTEN, '0xc778417E063141139Fce010982780140Aa0cD5Ab', 18, 'WETH', 'Wrapped Ether'), _WETH[ChainId.RINKEBY] = /#PURE/new Token(ChainId.RINKEBY, '0xc778417E063141139Fce010982780140Aa0cD5Ab', 18, 'WETH', 'Wrapped Ether'), _WETH[ChainId.GÖRLI] = /#PURE/new Token(ChainId.GÖRLI, '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6', 18, 'WETH', 'Wrapped Ether'), _WETH[ChainId.KOVAN] = /#PURE/new Token(ChainId.KOVAN, '0xd0A1E359811322d97991E03f863a0C30C2cF029C', 18, 'WETH', 'Wrapped Ether'), _WETH[ChainId.BSC] = /#PURE/new Token(ChainId.BSC, '0x替换成自己的WETH地址', 18, 'WETH', 'Wrapped Ether'), _WETH);
//方法1 需要获取精确的输出,输入不确定金额(也可以理解买,如购买100个UNI TOKEN,需要未知weth)
function swapTokensForExactTokens(
uint amountOut,//期望输出金额
uint amountInMax,//最大输入 (如果到你打包的交易时,如果实际需要输入的金额大于该金额,交易失败!)
address[] calldata path,
address to,
uint deadline
)
//方法2 通过输入金额,输出不确定金额 (也可以理解为卖, 如卖掉100个UNI TOKEN,可以获得未知WETH)
function swapExactTokensForTokens(
uint amountIn,//实际输入金额
uint amountOutMin,//最小输出 (如果到打包你的交易时,实际输出小于该金额,交易失败!)
address[] calldata path,
address to,
uint deadline
)
//方法3 通过输入金额,输出不确定金额
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
)