去中心化应用/去中心化应用。
App是一个互联网应用程序。与传统App最大的区别在于DApp运行在去中心化的网络上,即区块链网络。网络中没有可以完全控制DApp的中心化节点。而App,众所周知,是中心化的。需要请求服务器来获取数据、处理数据等。
Automation:It is the process of using a program to move bricks and query prices.When there is a price difference between two exchanges,it simultaneously executes buying at a low price exchange and selling at a high price exchange.The principle is exactly the same as human operation,but there is no need for human intervention.The difference is that the program can stay up and down×Monitor price differences and conduct transactions 24 hours a day.In order to facilitate trading,the exchange provides developers with APIs,allowing them to write programs through APIs and achieve automated trading.
与DApp相比,区块链是应用程序运行的底层环境。它可以简单地与运行在IOS和Andorid等移动操作系统上的各种应用程序进行比较。
truffle init rentable-nft
cd rentable-nft
truffle create contract RentablePets
truffle create contract IERC4907
truffle create contract ERC4907
truffle create test TestRentablePets
rentable-nft
├──contracts
│├──ERC4907.sol
│├──IERC4907.sol
│└──RentablePets.sol
├──migrations
│└──1_deploy_contracts.js
├──test
│└──test_rentable_pets.js
└──truffle-config.js
//SPDX-License-Identifier:MIT
pragma solidity>=0.4.22<0.9.0;
interface IERC4907{
//Logged when the user of a NFT is changed or expires is changed
///notice Emitted when theuser
of an NFT or theexpires
of theuser
is changed
///The zero address for user indicates that there is no user address
event UpdateUser(uint256 indexed tokenId,address indexed user,uint64 expires);
///notice set the user and expires of a NFT
///dev The zero address indicates there is no user
///Throws iftokenId
is not valid NFT
///param user The new user of the NFT
///param expires UNIX timestamp,The new user could use the NFT before expires
function setUser(uint256 tokenId,address user,uint64 expires)external;
///notice Get the user address of an NFT
///dev The zero address indicates that there is no user or the user is expired
///param tokenId The NFT to get the user address for
///return The user address for this NFT
function userOf(uint256 tokenId)external view returns(address);
///notice Get the user expires of an NFT
///dev The zero value indicates that there is no user
///param tokenId The NFT to get the user expires for
///return The user expires for this NFT
function userExpires(uint256 tokenId)external view returns(uint256);
}