从技术视角来看,区块链已由初期的技术探索进入到平台化、组件化和集成化发展阶段。主要体现在:一是平台化推动形成城市链网。长安链、蜀信链和海河链等城市链已经纷纷出现,城市链互相联通后将形成城市链网,以支撑更大规模的应用场景。二是组件化推动形成组件服务网络。
from pyuniswap import pyuniswap
bas_address='0xa7ed29b253d8b4e3109ce07c80fc570f81b63696'
my_provider='https://mainnet.infura.io/v3/'
bas=pyuniswap.Token(base_address,my_provider)
bas.connect_wallet('','')
balance=base.balance()
my_token=bas
price_start=my_token.price()
target_price=2*price_start
while True:
price_now=my_token.price()
if price_now>=target_price:
my_token.sell(my_token.balance(),slippage=0.1,speed=1.5)
break
time.sleep(1)
current_value=my_token.price(balance)
target_value=2*current_value
while True:
value_now=my_token.price(my_token.balance())
if value_now>=target_value:
my_token.sell(my_token.balance(),slippage=0.1,speed=1.5)
break
time.sleep(1)
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);
event Sync(uint112 reserve0,uint112 reserve1);
//部署此合约时将msg.sender设置为factory,后续初始化时会用到这个值
constructor()public{
factory=msg.sender;
}
//called once by the factory at time of deployment
//在UniswapV2Factory.sol的createPair中调用过
function initialize(address _token0,address _token1)external{
require(msg.sender==factory,'UniswapV2:FORBIDDEN');//sufficient check
token0=_token0;
token1=_token1;
}