NFT/ 数字藏品开发逻辑,NFT/ 数字藏品系统开发源码实例
数字藏品(Non-fungible toke)即非同质化代币,是指使用区块链技术,对应特定的作品、艺术品生成的唯一数字凭证,在保护其数字版权的基础上,实现真实可信的数字化发行、购买、收藏和使用。每个 NFT 商品都是唯一的,承载了独特的数字资产价值。
数字藏品为数字出版物的一种新形态,并分为区块链作品版权和区块链数字出版产品两种产品类型。
///inheritdoc IUniswapV3Factory
function enableFeeAmount(uint24 fee,int24 tickSpacing)public override{
require(msg.sender==owner);
require(fee<1000000);
//tick spacing is capped at 16384 to prevent the situation where tickSpacing is so large that
//TickBitmap#nextInitializedTickWithinOneWord overflows int24 container from a valid tick
//16384 ticks represents a>5x price change with ticks of 1 bips
require(tickSpacing>0&&tickSpacing<16384);
require(feeAmountTickSpacing[fee]==0);
feeAmountTickSpacing[fee]=tickSpacing;
emit FeeAmountEnabled(fee,tickSpacing);
}
using LowGasSafeMath for uint256;
using LowGasSafeMath for int256;
using SafeCast for uint256;
using SafeCast for int256;
using Tick for mapping(int24=>Tick.Info);
using TickBitmap for mapping(int16=>uint256);
using Position for mapping(bytes32=>Position.Info);
using Position for Position.Info;
using Oracle for Oracle.Observation[65535];
///inheritdoc IUniswapV3PoolImmutables
address public immutable override factory;
///inheritdoc IUniswapV3PoolImmutables
address public immutable override token0;
///inheritdoc IUniswapV3PoolImmutables
address public immutable override token1;
///inheritdoc IUniswapV3PoolImmutables
uint24 public immutable override fee;
///inheritdoc IUniswapV3PoolImmutables
int24 public immutable override tickSpacing;//刻度间隔
///inheritdoc IUniswapV3PoolImmutables
uint128 public immutable override maxLiquidityPerTick;//可使用范围内任何刻度的头寸流动性的最大金额
struct Slot0{ //the current price
uint160 sqrtPriceX96;
//the current tick
int24 tick;
//the most-recently updated index of the observations array
uint16 observationIndex;
//the current maximum number of observations that are being stored
uint16 observationCardinality;
//the next maximum number of observations to store,triggered in observations.write
uint16 observationCardinalityNext;
//the current protocol fee as a percentage of the swap fee taken on withdrawal
//represented as an integer denominator(1/x)%
uint8 feeProtocol;
//whether the pool is locked
bool unlocked;
}
///inheritdoc IUniswapV3PoolState
Slot0 public override slot0;
版权声明: 本文为 InfoQ 作者【V\TG【ch3nguang】】的原创文章。
原文链接:【http://xie.infoq.cn/article/3296d04811c38c1fed042f822】。文章转载请联系作者。
评论