智能合约:它们是存储在区块链上的计算机程序,在满足预定条件时运行,智能合约是用Solidity语言编写的。
去中心化存储技术是一种新型存储技术,它改变了传统的集中式存储技术,将数据从单一位置移到多个位置,这样就消除了存储数据的中心机构或服务器的责任,增加了安全性和数据的有效存储,确保用户的数据安全性。
web3.js是一个JavaScript API库。要让DApp在以太坊上运行,我们可以使用web3.js库提供的web3对象。web3.js通过RPC调用与本地节点通信,它可以与任何公开RPC层的以太坊节点一起使用。web3包含eth对象-web3.eth(用于与以太坊区块链交互)和shh对象-web3.shh(用于与Whisper交互)
//SPDX-License-Identifier:BUSL-1.1
pragma solidity=0.7.6;
import'./interfaces/IUniswapV3PoolDeployer.sol';
import'./UniswapV3Pool.sol';
contract UniswapV3PoolDeployer is IUniswapV3PoolDeployer{
struct Parameters{
address factory;
address token0;
address token1;
uint24 fee;
int24 tickSpacing;
}
///inheritdoc IUniswapV3PoolDeployer
Parameters public override parameters;
///dev Deploys a pool with the given parameters by transiently setting the parameters storage slot and then
///clearing it after deploying the pool.
///param factory The contract address of the Uniswap V3 factory
///param token0 The first token of the pool by address sort order
///param token1 The second token of the pool by address sort order
///param fee The fee collected upon every swap in the pool,denominated in hundredths of a bip
///param tickSpacing The spacing between usable ticks
function deploy(
address factory,
address token0,
address token1,
uint24 fee,
int24 tickSpacing
)internal returns(address pool){
parameters=Parameters({factory:factory,token0:token0,token1:token1,fee:fee,tickSpacing:tickSpacing});
pool=address(new UniswapV3Pool{salt:keccak256(abi.encode(token0,token1,fee))}());
delete parameters;
}
}