defi質押挖礦代幣分紅dapp系統開發案例智慧合約模式定製
質押挖礦是一種挖礦方式,這種挖礦方式不需要使用大量計算機算力來獲取數字貨幣,而是質押一定數量的數字貨幣,執行一段時間後就能產生新的數字貨幣,新產生的數字貨幣就是獲得的收益。
智慧合約開發I34-合約I633-部署53I9,根據邏輯來編寫和運作。只要滿足輸入要求,也就是說只要程式碼編寫的要求被滿足,合約中的義務將在安全和去信任的網路中得到執行。
using SafeMath for uint256; using Address for address; struct Balance { uint256 value; uint256 exchangeRate; } uint256 constant RATE_SCALE = 10**18; uint256 constant DECIMAL_SCALE = 10**18; IERC1820Registry internal _erc1820 = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24); mapping(address => Balance) internal _balances; uint256 internal _totalSupply; uint256 internal _exchangeRate; string internal _name; string internal _symbol; uint8 internal _decimals; // We inline the result of the following hashes because Solidity doesn't resolve them at compile time. // See // keccak256("ERC777TokensSender") bytes32 constant internal TOKENS_SENDER_INTERFACE_HASH = 0x29ddb589b1fb5fc7cf394961c1adf5f8c6454761adf795e67fe149f658abe895; // keccak256("ERC777TokensRecipient") bytes32 constant internal TOKENS_RECIPIENT_INTERFACE_HASH = 0xb281fc8c12954d22544db45de3159a39272895b169a852b314f9cc762e44c53b; //Empty, This is only used to respond the defaultOperators query. address[] internal _defaultOperatorsArray; // For each account, a mapping of its operators and revoked default operators. mapping(address => mapping(address => bool)) internal _operators; // ERC20-allowances mapping (address => mapping (address => uint256)) internal _allowances; constructor( string memory symbol, string memory name, uint8 decimals ) public { require(decimals <= 18, "decimals must be less or equal than 18"); _name = name; _symbol = symbol; _decimals = decimals; _exchangeRate = 10**18; // register interfaces _erc1820.setInterfaceImplementer(address(this), keccak256("ERC777Token"), address(this)); _erc1820.setInterfaceImplementer(address(this), keccak256("ERC20Token"), address(this)); } /** * @dev See `IERC777.name`. */ function name() external view returns (string memory) { return _name; } /** * @dev See `IERC777.symbol`. */ function symbol() external view returns (string memory) { return _symbol; } /** * @dev See `ERC20Detailed.decimals`. * * Always returns 18, as per the * [ERC777 EIP](). */ function decimals() external view returns (uint8) { return _decimals; } /** * @dev See `IERC777.granularity`. * * This implementation always returns `1`. */ function granularity() external view returns (uint256) { return 1; } /** * @dev See `IERC777.totalSupply`. */ function totalSupply() external view returns (uint256) { return _totalSupply.div(DECIMAL_SCALE); } /** * @dev Returns the amount of tokens owned by an account (`tokenHolder`). */ function balanceOf(address who) external view returns (uint256) { return _balanceOf(who); } function _balanceOf(address who) internal view returns (uint256) { return _getBalance(who).value.div(DECIMAL_SCALE); } function accuracyBalanceOf(address who) external view returns (uint256) { return _getBalance(who).value ; } /** * @dev See `IERC777.send`. * * Also emits a `Transfer` event for ERC20 compatibility. */ function send(address recipient, uint256 amount, bytes calldata data) external { _send(msg.sender, msg.sender, recipient, amount, data, "", true); }
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/70011332/viewspace-2938320/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 代幣智慧合約質押流動性挖礦分紅開發丨代幣智慧合約質押流動性挖礦分紅系統開發
- DAPP/Defi代幣智慧合約質押挖礦系統技術開發原理APP
- NFT質押代幣分紅dapp系統開發功能|合約定製案例APP
- DAPP代幣質押挖礦分紅系統開發模式分析APP模式
- ARB鏈質押挖礦代幣空投dapp系統開發智慧合約定製APP
- dapp/lp/defi代幣合約質押挖礦分紅系統開發詳細及規則丨原始碼案例APP原始碼
- DAPP質押挖礦分紅系統開發|DAPP合約APP
- DAPP公鏈代幣質押挖礦系統開發(智慧合約)APP
- DAPP公鏈代幣智慧合約質押挖礦系統開發APP
- DAPP代幣智慧合約質押挖礦系統開發方案搭建APP
- DAPP/Defi代幣智慧合約開發原理丨LP質押挖礦系統開發詳情APP
- IDO/DAPP代幣合約質押挖礦分紅系統開發(詳情方案)APP
- DAPP/Defi代幣預售質押挖礦分紅系統技術開發程式APP
- defi質押挖礦智慧合約dapp系統開發詳解APP
- 深入分析智慧合約DAPP代幣合約流動性質押挖礦分紅系統開發(案例開發及原始碼)APP原始碼
- Defi代幣預售合約LP質押挖礦系統開發(智慧合約元件分析)元件
- DAPP丨LP代幣合約流動性質押挖礦分紅系統開發(開發需求及案例)APP
- OP鏈DAPP合約代幣質押挖礦系統開發APP
- Defi/DAPP智慧合約質押挖礦系統開發/DeFi應用/NFT/DAPPAPP
- DAPP智慧合約眾籌互助質押挖礦分紅系統開發APP
- DAPP智慧合約代幣質押流動性挖礦分紅系統開發原始碼丨(詳細及案例)APP原始碼
- dapp質押分紅系統開發|DAPP合約代幣開發APP
- DAPP/Defi代幣預售LP質押挖礦分紅系統技術開發解析APP
- 代幣智慧合約流動性質押挖礦開發穩定版丨代幣智慧合約流動性質押挖礦系統開發方案
- BSC鏈代幣合約質押挖礦分紅模式系統開發詳情丨 DApp 技術棧模式APP
- dapp/defi智慧合約流動性LP質押挖礦分紅系統開發方案原始碼APP原始碼
- DAPP合約代幣分紅模式系統開發案例APP模式
- Defi/LP/DAPP代幣合約流動性質押挖礦系統開發/Solidity合約示例APPSolid
- defi/dapp/lp代幣合約挖礦系統開發(開發案例)丨代幣合約挖礦系統開發(原始碼及說明)APP原始碼
- DAPP智慧合約LP質押挖礦系統開發案例搭建APP
- DeFi預售代幣LP質押挖礦分紅系統開發詳情
- DAPP鏈上合約質押挖礦分紅開發原理丨DAPP鏈上合約質押挖礦分紅系統開發邏輯及方案APP
- NFT代幣質押子母幣分紅dapp系統開發邏輯模式定製(案例演示)APP模式
- DAPP智慧合約流動性質押挖礦系統模式開發/DEFI/DAPP/NFT/LPAPP模式
- 單雙幣質押流動性挖礦dapp系統開發智慧合約模式定製邏輯APP模式
- 雲算力質押挖礦dapp系統開發模式詳情(智慧合約定製)APP模式
- DeFi生態借貸合約質押挖礦系統開發案例/DAPP/LPAPP
- DAPP代幣挖礦模式系統開發|DAPP合約APP模式