script-ether2 – 脚本-ether2区块链毕设代写

区块链毕设代写本文提供国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,script-ether2 – 脚本-ether2区块链毕设代写 是一篇很好的国外资料


pragma solidity ^0.4.26; contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @param _owner The address from which the balance will be retrieved /// @return The balance function balanceOf(address _owner) constant returns (uint256 balance) {} /// @notice send _value token to _to from msg.sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transfer(address _to, uint256 _value) returns (bool success) {} /// @notice send _value token to _to from _from on the condition it is approved by _from /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {} /// @notice msg.sender approves _addr to spend _value tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of wei to be approved for transfer /// @return Whether the approval was successful or not function approve(address _spender, uint256 _value) returns (bool success) {} /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent function allowance(address _owner, address _spender) constant returns (uint256 remaining) {} event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } contract StandardToken is Token { function transfer(address _to, uint256 _value) returns (bool success) { //Default assumes totalSupply can’t be over max (2^256 – 1). //If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn’t wrap. //Replace the if with this one instead. //if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) { if (balances[msg.sender] >= _value && _value > 0) { balances[msg.sender] -= _value; balances[_to] += _value; Transfer(msg.sender, _to, _value); return true; } else { return false; } } function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { //same as above. Replace this line with the following if you want to protect against wrapping uints. //if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) { if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) { balances[_to] += _value; balances[_from] -= _value; allowed[_from][msg.sender] -= _value; Transfer(_from, _to, _value); return true; } else { return false; } } function balanceOf(address _owner) constant returns (uint256 balance) { return balances[_owner]; } function approve(address _spender, uint256 _value) returns (bool success) { allowed[msg.sender][_spender] = _value; Approval(msg.sender, _spender, _value); return true; } function allowance(address _owner, address _spender) constant returns (uint256 remaining) { return allowed[_owner][_spender]; } mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; uint256 public totalSupply; } contract HashnodeTestCoin is StandardToken { // CHANGE THIS. Update the contract name. /* Public variables of the token / / NOTE: The following variables are OPTIONAL vanities. One does not have to include them. They allow one to customise the token contract & in no way influences the core functionality. Some wallets/interfaces might not even bother to look at this information. / string public name; // Token Name uint8 public decimals; // How many decimals to show. To be standard complicant keep it 18 string public symbol; // An identifier: eg SBX, XPR etc.. string public version = ‘H1.0’; uint256 public unitsOneEthCanBuy; // How many units of your coin can be bought by 1 ETH? uint256 public totalEthInWei; // WEI is the smallest unit of ETH (the equivalent of cent in USD or satoshi in BTC). We’ll store the total ETH raised via our ICO here. address public fundsWallet; // Where should the raised ETH go? // This is a constructor function // which means the following function name has to match the contract name declared above function HashnodeTestCoin() { balances[msg.sender] = 100000000000000000000000000; // Give the creator all initial tokens. This is set to 10000 for example. If you want your initial tokens to be X and your decimal is 5, set this value to X * 100000. (CHANGE THIS) totalSupply = 100000000000000000000000000; // Update total supply (10000 for example) (CHANGE THIS) name = “CRYPTOART”; // Set the name for display purposes (CHANGE THIS) decimals = 18; // Amount of decimals for display purposes (CHANGE THIS) symbol = “CART”; // Set the symbol for display purposes (CHANGE THIS) unitsOneEthCanBuy = 10000; // Set the price of your token for the ICO (CHANGE THIS) fundsWallet = msg.sender; // The owner of the contract gets ETH } function() payable{ totalEthInWei = totalEthInWei + msg.value; uint256 amount = msg.value * unitsOneEthCanBuy; require(balances[fundsWallet] >= amount); balances[fundsWallet] = balances[fundsWallet] – amount; balances[msg.sender] = balances[msg.sender] + amount; Transfer(fundsWallet, msg.sender, amount); // Broadcast a message to the blockchain //Transfer ether to fundsWallet fundsWallet.transfer(msg.value); } / Approves and then calls the receiving contract */ function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success) { allowed[msg.sender][_spender] = _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 call should succeed, otherwise one would use vanilla approve instead. if(!“receiveApproval(address,uint256,address,bytes)”))), msg.sender, _value, this, _extraData)) { throw; } return true; } }

We use optional third-party analytics cookies to understand how you use so we can build better products. Learn more.

Initial commit


pragma solidity^0.4.26;合同令牌{//@return total amount of tokens function totalSupply()常量返回(uint256 supply){}///@param_owner将从中检索余额的地址//@return The balancefunction balanceOf(address_owner)常量返回(uint256 balance){}///@notice send_value Token to _tofrom消息发送者/// @param_to The address of The recipient///@param_value要传输的令牌量///@return函数传输是否成功(address_to,uint256_value)返回(bool success){}//@notice send_value token to _tofrom _from,条件是_from///@param_from发送方//@param_to the address of the recipient///@param_value要传输的令牌量//@返回传输是否成功函数transferFrom(address_from,address_to,uint256_value)返回(bool success){}//@notice消息发送者批准u addr花费u value tokens//@paramu spender能够转移代币的账户地址//@param_value要批准转移的wei金额//@return无论批准是否成功,函数approve(addressu spender,uint256_value)返回(bool success){}///@param_owner拥有令牌的帐户的地址//@param_spender能够转移令牌的帐户的地址//@return允许花费的函数允许的剩余令牌数量(addressu owner,address_spender)常量返回(uint256 remaining){}事件传输(address indexed_from,address indexed_to,uint256_value);事件批准(address indexed_owner,address indexed_spender,uint256_value);}合同标准令牌是令牌{函数传输(address _to,uint256u value)返回(bool success){/默认假设totalSupply不能超过max(2^256-1)。//如果您的代币不包括totalSupply,并且随着时间的推移可以发行更多的代币,那么您需要检查它是否不包装。//用这个代替if。//如果(余额[消息发送者]>=u value&balances[_to]+u value>balances[_to]){if(余额[发件人.msg]>=u value&u value>0){余额[消息发送者]将余额转移到U值(消息发送者,u-to,_-value);return true;}else{return false;}}函数传输自(address}from,addressu to,uint256u value)返回(bool success){//同上。如果您想防止包装uint,请将此行替换为以下内容。//if(balances[u from]>=u value&allowed[u from][消息发送者]>=u value&balances[_to]+u value>balances[u to]){if(balances[_from]>=u value&allowed[_from][消息发送者]>=u value&u value>0){balances[_to]+=u value;余额[_-from]-=u value;允许[u-from][消息发送者]—=u值;Transfer(_from,_to,_value);return true;}else{return false;}function balanceOf(address_owner)常量返回(uint256 balance){return balances[_owner];}函数approve(address_spender,uint256_value)返回(bool success){允许[消息发送者][u spender]=_value;审批(消息发送者,u spender,_value);返回true;}函数允许量(address _owner,address_spender)常量返回(剩余uint256){return allowed[_owner][u spender];}映射(address=>uint256)balances;mapping(address=>uint256))allowed;uint256 public totalSupply;}contract HashnodeTestCoin is StandardToken{//更改此项。更新合同名称。/*令牌的公共变量//注意:以下变量是可选的虚变量。你不必包括他们。它们允许用户定制代币合约,并且不会影响核心功能。一些钱包/接口甚至可能懒得查看这些信息。/string public name;//令牌名uint8 public decimals;//要显示的小数位数。作为标准的共犯,请保留它18个字符串的公共符号;//一个标识符:例如SBX、XPR等。。string public version=’H1.0’;uint256 public unitsOneEthCanBuy;//1以太币可以购买多少单位?uint256 public totalEthInWei;//WEI是ETH的最小单位(相当于美元中的美分或BTC中的satoshi)。我们将在这里存储通过ICO筹集的总ETH。address public fund swallet;//筹集到的ETH应该去哪里?//这是一个构造函数函数//,这意味着下面的函数名必须与函数HashnodeTestCoin(){balances)上面声明的约定名称匹配[消息发送者]=1000000000000000000000000;//给创建者所有初始令牌。例如,设置为10000。如果您希望初始标记为X,而十进制数为5,请将该值设置为X*100000。(更改此项)totalSupply=1000000000000000000000000;//更新总供应量(例如10000)(更改此项)name=“CRYPTOART”;//设置用于显示的名称(更改此项)decimals=18;//用于显示目的的小数位数(CHANGE THIS)symbol=“CART”;//设置用于显示的符号(CHANGE THIS)unitsOneEthCanBuy=10000;//设置ICO(CHANGE THIS)fundsWallet=消息发送者;//合同的所有者获得ETH}function()应付{totalEthInWei=totalEthInWei+消息值;uint256金额=消息值*可以购买的单位;要求(余额[fundsWallet]>=金额);余额[fundsWallet]=余额[fundsWallet]-amount;余额[消息发送者]=余额[消息发送者]+金额;转账(资金转账,消息发送者,amount);//向区块链blockchain广播消息//传输以太到fundsWallet资金转移(消息值); }/approve然后调用接收协定*/函数approveAndCall(addressu spender,uint256u value,bytesu extraData)返回(bool success){allowed[消息发送者][u spender]=_value;审批(消息发送者,u spender,_value);//调用要通知的合同的receiveApproval函数。它手工制作函数签名,这样就不必为此在这里包含一个合同。//receiveApproval(addressu from,uint256u value,addressu tokenContract,bytesu extraData)//假设什么时候调用应该成功,否则将使用vanilla approve。如果(!_斯宾德呼叫(字节4(字节32(sha3(“接收批准(address,uint256,address,bytes)”)),消息发送者,u value,this,_extraData)){throw;}return true;}


Initial commit


区块链毕设网(全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 !
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » script-ether2 – 脚本-ether2区块链毕设代写


立即查看 了解详情