FINTOCH分趣投系統開發技術詳細及案例原始碼
//Send _value amount of tokens from address _from to address _to
//The transferFrom method is used for a withdraw workflow,allowing contracts to send
//tokens on your behalf,for example to"deposit"to a contract address and/or to charge
//fees in sub-currencies;the command should fail unless the _from account has
//deliberately authorized the sender of the message via some mechanism;we propose
//these standardized APIs for approval:
function transferFrom(
address _from,
address _to,
uint256 _amount
)returns(bool success){詳情及案例:MrsFu123
require(isSealed());
//implicitly claim bonus for both sender and receiver
claimBonus(_from);
claimBonus(_to);
//according to VEN's total supply,never overflow here
if(accounts[_from].balance>=_amount
&&allowed_from>=_amount
&&_amount>0){
accounts[_from].balance-=uint112(_amount);
allowed_from-=_amount;
accounts[_to].balance=_amount.add(accounts[_to].balance).toUINT112();
Transfer(_from,_to,_amount);
return true;
}else{
return false;
}
}
//Allow _spender to withdraw from your account,multiple times,up to the _value amount.
//If this function is called again it overwrites the current allowance with _value.
function approve(address _spender,uint256 _amount)returns(bool success){
allowedmsg.sender=_amount;
Approval(msg.sender,_spender,_amount);
return true;
}
/Approves and then calls the receiving contract/
function approveAndCall(address _spender,uint256 _value,bytes _extraData)returns(bool success){
allowedmsg.sender=_value;
Approval(msg.sender,_spender,_value);
//call the receiveApproval function on the contract you want to be notified.This crafts the function signature manually so one doesn't have to include a contract in here just for this.
//receiveApproval(address _from,uint256 _value,address _tokenContract,bytes _extraData)
//it is assumed that when does this that the callshouldsucceed,otherwise one would use vanilla approve instead.
//if(!_spender.call(bytes4(bytes32(sha3("receiveApproval(address,uint256,address,bytes)"))),msg.sender,_value,this,_extraData)){revert();}
ApprovalReceiver(_spender).receiveApproval(msg.sender,_value,this,_extraData);
return true;
}
function allowance(address _owner,address _spender)constant returns(uint256 remaining){
return allowed_owner;
}
//Mint tokens and assign to some one
function mint(address _owner,uint256 _amount,bool _isRaw,uint32 timestamp)onlyOwner{
if(_isRaw){
accounts[_owner].rawTokens=_amount.add(accounts[_owner].rawTokens).toUINT112();
supplies.rawTokens=_amount.add(supplies.rawTokens).toUINT128();
}else{
accounts[_owner].balance=_amount.add(accounts[_owner].balance).toUINT112();
}
accounts[_owner].lastMintedTimestamp=timestamp;
supplies.total=_amount.add(supplies.total).toUINT128();
Transfer(0,_owner,_amount);
}
//Offer bonus to raw tokens holder
function offerBonus(uint256 _bonus)onlyOwner{
bonusOffered=bonusOffered.add(_bonus);
supplies.total=_bonus.add(supplies.total).toUINT128();
Transfer(0,this,_bonus);
}
//Set owner to zero address,to disable mint,and enable token transfer
function seal()onlyOwner{
setOwner(0);
}
}
contract ApprovalReceiver{
function receiveApproval(address _from,uint256 _value,address _tokenContract,bytes _extraData);
}
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69956839/viewspace-2939097/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- fintoch分投趣系統開發技術詳細及分析丨分投趣fintoch系統原始碼案例原始碼
- 分投趣fintoch開發丨fintoch分投趣系統開發方案詳細丨分投趣fintoch系統原始碼案例原始碼
- Fintoch分趣投系統丨Fintoch分趣投系統開發(技術分析)及原始碼部署原始碼
- 分投趣(Fintoch)系統技術開發細節分析
- 分投趣(Fintoch)開發丨分投趣原始碼系統技術開發丨Solidity技術語言原始碼Solid
- 分投趣Fintoch系統智慧合約開發技術丨分投趣Fintoch技術開發示例
- 分投趣Fintoch(系統開發)丨分投趣Fintoch智慧合約技術開發原理
- Fintoch(分投趣)系統開發特性及功能(原始碼演示)原始碼
- 分投趣fintoch合約系統開發詳情技術介紹
- 分投趣借貸系統dapp開發丨分投趣Fintoch瘋狂功能丨系統技術開發分投趣APP
- fintoch分投趣智慧合約技術系統開發搭建
- 分投趣Fintoch智慧合約系統開發原始碼示例原始碼
- 分趣投開發原理丨分趣投系統開發(開發案例)丨分趣投系統原始碼部署原始碼
- Fintech分投趣開發功能丨分投趣Fintoch智慧合約系統開發原始碼示例原始碼
- 深度解析:分投趣fintoch模式系統開發技術(成熟合約技術)模式
- 分投趣FINTOCH借貸理財系統開發詳情丨 DApp 技術棧APP
- 關於分投趣fintoch系統開發原始碼邏輯分析方案原始碼
- 分投趣(Fintoch)智慧合約系統制度開發詳情
- Fintoch分投趣系統合約開發搭建
- 分投趣Fintoch借貸質押模式系統開發部署技術介紹模式
- 分投趣Fintoch智慧合約系統開發原理
- 分投趣fintoch系統開發借貸模式搭建模式
- 電競系統開發技術詳情,掌趣電競系統開發案例(原始碼)原始碼
- 合約量化系統開發技術詳細及原始碼原始碼
- Fintoch分投趣質押系統搭建開發|分投趣質押借貸模式搭建模式
- 關於分投趣fintoch合約系統開發邏輯
- Stepn跑鞋跑步鏈遊系統開發/趣步系統開發/詳情案例/成熟技術/原始碼版原始碼
- Fintoch分投趣模式系統開發/區塊鏈DAPP合約模式區塊鏈APP
- 分投趣fintoch系統合約開發分析(Solidity程式語言)Solid
- Defi/IDO分投趣借貸質押系統開發技術丨Defi分投趣借貸開發模式詳情模式
- 分投趣借貸挖礦系統開發技術/DAPP借貸理財挖礦系統開發功能以及邏輯詳情(案例原始碼)APP原始碼
- 分投趣借貸模式開發系統搭建技術模式
- Demo/分投趣Fintoch系統專案開發合約分解模式方案模式
- Python語言編寫/分投趣系統技術開發程式碼示例Python
- 分投趣系統開發智慧合約丨DAPP分投趣開發功能詳情及邏輯介紹APP
- Dapp/Stepn跑鞋鏈遊系統開發詳細技術案例/成熟方案/原始碼功能APP原始碼
- 分投趣fintoch去中心化交易平臺dapp系統開發智慧合約部署詳情中心化APP
- DAPP/Stepn跑鞋鏈遊跑步運動模式/系統開發/技術案例/方案詳細/規則及原始碼APP模式原始碼