存储内存类型的概念是区块链所特有的,因为在智能合约中工作时,通过区块链的加密封存属性,存储的数据是无法篡改的。在其他编程环境中,如果我们想要长期存储变量,通常会将这项工作转移到文件系统或数据库中。但在区块链上,智能合约的代码和数据都长期保留在区块链上。
智能合约是在区块链上运行的计算机程序。程序包括函数和数据(也称为变量或参数),这些函数操作数据。函数使用的数据需要存储在计算机的内存中。在这种情况下,计算机是EVM。
constructor(){
owner=msg.sender;
emit OwnerChanged(address(0),msg.sender);
feeAmountTickSpacing[500]=10;
emit FeeAmountEnabled(500,10);
feeAmountTickSpacing[3000]=60;
emit FeeAmountEnabled(3000,60);
feeAmountTickSpacing[10000]=200;
emit FeeAmountEnabled(10000,200);
}/// inheritdoc IUniswapV3Factory
function createPool(
address tokenA,
address tokenB,
uint24 fee
)external override noDelegateCall returns(address pool){
require(tokenA!=tokenB);
(address token0,address token1)=tokenA<tokenB?(tokenA,tokenB):(tokenB,tokenA);
require(token0!=address(0));
int24 tickSpacing=feeAmountTickSpacing[fee];
require(tickSpacing!=0);
require(getPool[token0][token1][fee]==address(0));
pool=deploy(address(this),token0,token1,fee,tickSpacing);
getPool[token0][token1][fee]=pool;
//populate mapping in the reverse direction,deliberate choice to avoid the cost of comparing addresses
getPool[token1][token0][fee]=pool;
emit PoolCreated(token0,token1,fee,tickSpacing,pool);
}