DAPP智慧合約借貸理財挖礦系統開發案例程式碼部署方案
智慧合約已在各種區塊鏈網路中得以實施,其中主要的依然是比特幣和以太坊。雖然比特幣網路以使用比特幣執行交易聞名,它的協議也可以用來建立智慧合約。
以太坊則是開發I34-合約I633-部署53I9,目前為止最引人注目的智慧合約框架,因為它是專門為支援智慧合約的使用建立的。用Solidity語言程式設計,以太坊智慧合約框架有助於促進去中心化網路,便於用智慧合約處理交易。
除了加密貨幣之外,在不同行業的也有使用者場景,例如選舉、供應鏈最佳化、電子商務中可有效利用智慧合約。
/** pragma solidity 0.5.0; // File: src/erc777/IERC777.sol /** * @dev Interface of the ERC777Token standard as defined in the EIP. * * This contract uses the * [ERC1820 registry standard]() to let * token holders and recipients react to token movements by using setting implementers * for the associated interfaces in said registry. See `IERC1820Registry` and * `ERC1820Implementer`. */ interface IERC777 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() external view returns (string memory); /** * @dev Returns the smallest part of the token that is not divisible. This * means all token operations (creation, movement and destruction) must have * amounts that are a multiple of this number. * * For most token contracts, this value will equal 1. */ function granularity() external view returns (uint256); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by an account (`owner`). */ function balanceOf(address owner) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * If send or receive hooks are registered for the caller and `recipient`, * the corresponding functions will be called with `data` and empty * `operatorData`. See `IERC777Sender` and `IERC777Recipient`. * * Emits a `Sent` event. * * Requirements * * - the caller must have at least `amount` tokens. * - `recipient` cannot be the zero address. * - if `recipient` is a contract, it must implement the `tokensReceived` * interface. */ function send(address recipient, uint256 amount, bytes calldata data) external; /** * @dev Destroys `amount` tokens from the caller's account, reducing the * total supply. * * If a send hook is registered for the caller, the corresponding function * will be called with `data` and empty `operatorData`. See `IERC777Sender`. * * Emits a `Burned` event. * * Requirements * * - the caller must have at least `amount` tokens. */ function burn(uint256 amount, bytes calldata data) external; /** * @dev Returns true if an account is an operator of `tokenHolder`. * Operators can send and burn tokens on behalf of their owners. All * accounts are their own operator. * * See `operatorSend` and `operatorBurn`. */ function isOperatorFor(address operator, address tokenHolder) external view returns (bool); /** * @dev Make an account an operator of the caller. * * See `isOperatorFor`. * * Emits an `AuthorizedOperator` event. * * Requirements * * - `operator` cannot be calling address. */ function authorizeOperator(address operator) external; /** * @dev Make an account an operator of the caller. * * See `isOperatorFor` and `defaultOperators`. * * Emits a `RevokedOperator` event. * * Requirements * * - `operator` cannot be calling address. */ function revokeOperator(address operator) external; /** * @dev Returns the list of default operators. These accounts are operators * for all token holders, even if `authorizeOperator` was never called on * them. * * This list is immutable, but individual holders may revoke these via * `revokeOperator`, in which case `isOperatorFor` will return false. */ function defaultOperators() external view returns (address[] memory); /** * @dev Moves `amount` tokens from `sender` to `recipient`. The caller must * be an operator of `sender`. * * If send or receive hooks are registered for `sender` and `recipient`, * the corresponding functions will be called with `data` and * `operatorData`. See `IERC777Sender` and `IERC777Recipient`. * * Emits a `Sent` event. * * Requirements * * - `sender` cannot be the zero address. * - `sender` must have at least `amount` tokens. * - the caller must be an operator for `sender`. * - `recipient` cannot be the zero address. * - if `recipient` is a contract, it must implement the `tokensReceived` * interface. */ function operatorSend( address sender, address recipient, uint256 amount, bytes calldata data, bytes calldata operatorData ) external; /** * @dev Destoys `amount` tokens from `account`, reducing the total supply. * The caller must be an operator of `account`. * * If a send hook is registered for `account`, the corresponding function * will be called with `data` and `operatorData`. See `IERC777Sender`. * * Emits a `Burned` event. * * Requirements * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. * - the caller must be an operator for `account`. */ function operatorBurn( address account, uint256 amount, bytes calldata data, bytes calldata operatorData ) external; event Sent( address indexed operator, address indexed from, address indexed to, uint256 amount, bytes data, bytes operatorData ); event Minted(address indexed operator, address indexed to, uint256 amount, bytes data, bytes operatorData); event Burned(address indexed operator, address indexed from, uint256 amount, bytes data, bytes operatorData); event AuthorizedOperator(address indexed operator, address indexed tokenHolder); event RevokedOperator(address indexed operator, address indexed tokenHolder); } // File: src/erc777/IERC777Recipient.sol /** * @dev Interface of the ERC777TokensRecipient standard as defined in the EIP. * * Accounts can be notified of `IERC777` tokens being sent to them by having a * contract implement this interface (contract holders can be their own * implementer) and registering it on the * [ERC1820 global registry](). * * See `IERC1820Registry` and `ERC1820Implementer`. */ interface IERC777Recipient { /** * @dev Called by an `IERC777` token contract whenever tokens are being * moved or created into a registered account (`to`). The type of operation * is conveyed by `from` being the zero address or not. * * This call occurs _after_ the token contract's state is updated, so * `IERC777.balanceOf`, etc., can be used to query the post-operation state. * * This function may revert to prevent the operation from being executed. */ function tokensReceived( address operator, address from, address to, uint amount, bytes calldata userData, bytes calldata operatorData ) external; } // File: src/erc777/IERC777Sender.sol /** * @dev Interface of the ERC777TokensSender standard as defined in the EIP. * * `IERC777` Token holders can be notified of operations performed on their * tokens by having a contract implement this interface (contract holders can be * their own implementer) and registering it on the * [ERC1820 global registry](). * * See `IERC1820Registry` and `ERC1820Implementer`. */ interface IERC777Sender { /** * @dev Called by an `IERC777` token contract whenever a registered holder's * (`from`) tokens are about to be moved or destroyed. The type of operation * is conveyed by `to` being the zero address or not. * * This call occurs _before_ the token contract's state is updated, so * `IERC777.balanceOf`, etc., can be used to query the pre-operation state. * * This function may revert to prevent the operation from being executed. */ function tokensToSend( address operator, address from, address to, uint amount, bytes calldata userData, bytes calldata operatorData ) external; }
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/70011332/viewspace-2938255/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 什麼是智慧合約?智慧合約dapp系統借貸理財系統開發案例(原始碼)APP原始碼
- DAPP/ULAB借貸理財質押挖礦開發方案丨DAPP/ULAB借貸理財質押挖礦系統開發詳細邏輯APP
- DeFi生態借貸合約質押挖礦系統開發案例/DAPP/LPAPP
- 分投趣借貸挖礦系統開發技術/DAPP借貸理財挖礦系統開發功能以及邏輯詳情(案例原始碼)APP原始碼
- DAPP借貸理財質押挖礦開發邏輯丨DAPP借貸理財質押挖礦系統開發(詳情及規則)丨原始碼APP原始碼
- Defi 借貸挖礦丨 DAPP 智慧合約模式系統開發技術介紹APP模式
- NFT數字藏品質押借貸挖礦dapp系統開發智慧合約詳情APP
- dapp/defi/lp/ulab借貸理財質押挖礦系統開發詳情丨ulab借貸理財質押挖礦開發運營版APP
- DAPP智慧合約理財質押挖礦分紅系統開發詳細需求及原始碼部署APP原始碼
- defi/dapp/nft/ulab質押挖礦借貸理財持幣生息系統開發詳細及案例丨原始碼部署APP原始碼
- DAPP智慧合約LP質押挖礦系統開發案例搭建APP
- DAPP智慧合約燃燒挖礦軟體系統開發方案APP
- 智慧合約DAPP挖礦系統開發應用APP
- DEFI借貸協議系統開發技術支援丨DEFI智慧合約挖礦模式開發詳細方案協議模式
- NFT數字藏品質押借貸挖礦dapp系統開發合約技術詳情APP
- 分投趣借貸理財質押挖礦開發運營版丨分趣投借貸理財質押挖礦系統開發詳情規則及原始碼原始碼
- FIL NEW挖礦系統開發智慧合約方案
- 智慧合約DAPP理財模式系統開發技術方案APP模式
- DAPP代幣智慧合約質押挖礦系統開發方案搭建APP
- 智慧合約LP質押挖礦系統開發DAPPAPP
- defi/dapp/lp代幣合約挖礦系統開發(開發案例)丨代幣合約挖礦系統開發(原始碼及說明)APP原始碼
- DAPP智慧合約NFT鏈上質押挖礦系統開發搭建方案APP
- 智慧合約DAPP理財返現系統開發技術方案APP
- 馬蹄鏈智慧合約DAPP開發需求丨馬蹄鏈智慧合約DAPP質押挖礦系統開發(開發案例)APP
- defi預售代幣/系統開發技術/DAPP合約借貸/質押挖礦開發元件技術APP元件
- 智慧合約Dapp理財返傭系統開發APP
- dapp合約代幣理財系統開發方案模式APP模式
- PAXG節點質押挖礦系統開發/dapp智慧合約開發/流動性挖礦/詳細方案/原始碼功能APP原始碼
- ProTradex借貸挖礦系統開發技術
- DAPP智慧合約鏈上質押挖礦模式系統開發丨公鏈挖礦系統開發原始碼搭建APP模式原始碼
- DAPP質押挖礦開發技術/Defi預售代幣借貸合約/原始碼開發詳情APP原始碼
- DAPP區塊鏈挖礦專案系統開發丨智慧合約程式開發APP區塊鏈
- DAPP代幣挖礦模式系統開發|DAPP合約APP模式
- DEFI借貸協議智慧合約開發技術丨dapp智慧合約系統開發應用詳情協議APP
- defi質押挖礦智慧合約dapp系統開發詳解APP
- DAPP代幣預售系統原始碼開發/原始碼/借貸質押挖礦/LP預售代幣合約細節APP原始碼
- 智慧合約LP池質押挖礦系統開發功能案例
- DAPP/NFT質押借貸系統合約開發技術詳解(程式碼示例)APP