将应用程序分布在不同节点上,通过共识机制和区块链平台来完成任务的应用程序,它本身就是去中心化,不依赖于任何中心化服务器,促使用户交易更加安全。
数据作为新型生产要素, 能为实体经济带来放大、叠加和倍增作用,是做强做优做大数字经济的关键。
建立数据可信流通体系,增强数据的可用、可信、可流通、可追溯水平,是激活数据要素潜能、赋能实体经济的重要途径。区块链技术具有去中心化、共识机制、不可篡改、可以追溯、规则透明等特点。
/SPDX-License-Identifier:GPL-3.0
pragma solidity>=0.6.2;
//helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper{
function safeApprove(address token,address to,uint value)internal{
//bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success,bytes memory data)=token.call(abi.encodeWithSelector(0x095ea7b3,to,value));
require(success&&(data.length==0||abi.decode(data,(bool))),'TransferHelper:APPROVE_FAILED');
}
function safeTransfer(address token,address to,uint value)internal{
//bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success,bytes memory data)=token.call(abi.encodeWithSelector(0xa9059cbb,to,value));
require(success&&(data.length==0||abi.decode(data,(bool))),'TransferHelper:TRANSFER_FAILED');
}
function safeTransferFrom(address token,address from,address to,uint value)internal{
//bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success,bytes memory data)=token.call(abi.encodeWithSelector(0x23b872dd,from,to,value));
require(success&&(data.length==0||abi.decode(data,(bool))),'TransferHelper:TRANSFER_FROM_FAILED');
}
function safeTransferETH(address to,uint value)internal{
(bool success,)=to.call{value:value}(new bytes(0));
require(success,'TransferHelper:ETH_TRANSFER_FAILED');
}
}
interface IUniswapV2Pair{
event Approval(address indexed owner,address indexed spender,uint value);
event Transfer(address indexed from,address indexed to,uint value);
function name()external pure returns(string memory);
function symbol()external pure returns(string memory);
function decimals()external pure returns(uint8);
function totalSupply()external view returns(uint);
function balanceOf(address owner)external view returns(uint);
function allowance(address owner,address spender)external view returns(uint);
function approve(address spender,uint value)external returns(bool);
function transfer(address to,uint value)external returns(bool);
function transferFrom(address from,address to,uint value)external returns(bool);
function DOMAIN_SEPARATOR()external view returns(bytes32);
function PERMIT_TYPEHASH()external pure returns(bytes32);
function nonces(address owner)external view returns(uint);
function permit(address owner,address spender,uint value,uint deadline,uint8 v,bytes32 r,bytes32 s)external;
event Mint(address indexed sender,uint amount0,uint amount1);
event Burn(address indexed sender,uint amount0,uint amount1,address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);