diff options
author | Erik Kundt <bitshift@posteo.org> | 2018-07-11 21:57:07 +0800 |
---|---|---|
committer | Erik Kundt <bitshift@posteo.org> | 2018-07-16 20:49:55 +0800 |
commit | 893f4cf092c98d13116741d1ebc19846f6873536 (patch) | |
tree | 9449cbeb1abd76e2ca83804caa44c9f93f916de5 /test/contracts | |
parent | 931794001e92cbfe99c91da037cf36a1808d9df1 (diff) | |
download | dexon-solidity-893f4cf092c98d13116741d1ebc19846f6873536.tar.gz dexon-solidity-893f4cf092c98d13116741d1ebc19846f6873536.tar.zst dexon-solidity-893f4cf092c98d13116741d1ebc19846f6873536.zip |
Specifies visibility in unit tests.
Diffstat (limited to 'test/contracts')
-rw-r--r-- | test/contracts/FixedFeeRegistrar.cpp | 30 | ||||
-rw-r--r-- | test/contracts/Wallet.cpp | 16 |
2 files changed, 23 insertions, 23 deletions
diff --git a/test/contracts/FixedFeeRegistrar.cpp b/test/contracts/FixedFeeRegistrar.cpp index ff683de0..bc0c4118 100644 --- a/test/contracts/FixedFeeRegistrar.cpp +++ b/test/contracts/FixedFeeRegistrar.cpp @@ -58,10 +58,10 @@ pragma solidity ^0.4.0; contract Registrar { event Changed(string indexed name); - function owner(string memory _name) view returns (address o_owner); - function addr(string memory _name) view returns (address o_address); - function subRegistrar(string memory _name) view returns (address o_subRegistrar); - function content(string memory _name) view returns (bytes32 o_content); + function owner(string memory _name) public view returns (address o_owner); + function addr(string memory _name) public view returns (address o_address); + function subRegistrar(string memory _name) public view returns (address o_subRegistrar); + function content(string memory _name) public view returns (bytes32 o_content); } contract FixedFeeRegistrar is Registrar { @@ -74,47 +74,47 @@ contract FixedFeeRegistrar is Registrar { modifier onlyrecordowner(string memory _name) { if (m_record(_name).owner == msg.sender) _; } - function reserve(string memory _name) payable { + function reserve(string memory _name) public payable { Record storage rec = m_record(_name); if (rec.owner == 0x0000000000000000000000000000000000000000 && msg.value >= c_fee) { rec.owner = msg.sender; emit Changed(_name); } } - function disown(string memory _name, address _refund) onlyrecordowner(_name) { + function disown(string memory _name, address _refund) onlyrecordowner(_name) public { delete m_recordData[uint(keccak256(bytes(_name))) / 8]; if (!_refund.send(c_fee)) throw; emit Changed(_name); } - function transfer(string memory _name, address _newOwner) onlyrecordowner(_name) { + function transfer(string memory _name, address _newOwner) onlyrecordowner(_name) public { m_record(_name).owner = _newOwner; emit Changed(_name); } - function setAddr(string memory _name, address _a) onlyrecordowner(_name) { + function setAddr(string memory _name, address _a) onlyrecordowner(_name) public { m_record(_name).addr = _a; emit Changed(_name); } - function setSubRegistrar(string memory _name, address _registrar) onlyrecordowner(_name) { + function setSubRegistrar(string memory _name, address _registrar) onlyrecordowner(_name) public { m_record(_name).subRegistrar = _registrar; emit Changed(_name); } - function setContent(string memory _name, bytes32 _content) onlyrecordowner(_name) { + function setContent(string memory _name, bytes32 _content) onlyrecordowner(_name) public { m_record(_name).content = _content; emit Changed(_name); } - function record(string memory _name) view returns (address o_addr, address o_subRegistrar, bytes32 o_content, address o_owner) { + function record(string memory _name) public view returns (address o_addr, address o_subRegistrar, bytes32 o_content, address o_owner) { Record storage rec = m_record(_name); o_addr = rec.addr; o_subRegistrar = rec.subRegistrar; o_content = rec.content; o_owner = rec.owner; } - function addr(string memory _name) view returns (address) { return m_record(_name).addr; } - function subRegistrar(string memory _name) view returns (address) { return m_record(_name).subRegistrar; } - function content(string memory _name) view returns (bytes32) { return m_record(_name).content; } - function owner(string memory _name) view returns (address) { return m_record(_name).owner; } + function addr(string memory _name) public view returns (address) { return m_record(_name).addr; } + function subRegistrar(string memory _name) public view returns (address) { return m_record(_name).subRegistrar; } + function content(string memory _name) public view returns (bytes32) { return m_record(_name).content; } + function owner(string memory _name) public view returns (address) { return m_record(_name).owner; } Record[2**253] m_recordData; function m_record(string memory _name) view internal returns (Record storage o_record) { diff --git a/test/contracts/Wallet.cpp b/test/contracts/Wallet.cpp index 08470d8e..e22d6646 100644 --- a/test/contracts/Wallet.cpp +++ b/test/contracts/Wallet.cpp @@ -101,7 +101,7 @@ contract multiowned { // constructor is given number of sigs required to do protected "onlymanyowners" transactions // as well as the selection of addresses capable of confirming them. - constructor(address[] memory _owners, uint _required) { + constructor(address[] memory _owners, uint _required) public { m_numOwners = _owners.length + 1; m_owners[1] = uint(msg.sender); m_ownerIndex[uint(msg.sender)] = 1; @@ -173,11 +173,11 @@ contract multiowned { emit RequirementChanged(_newRequired); } - function isOwner(address _addr) returns (bool) { + function isOwner(address _addr) public returns (bool) { return m_ownerIndex[uint(_addr)] > 0; } - function hasConfirmed(bytes32 _operation, address _owner) view returns (bool) { + function hasConfirmed(bytes32 _operation, address _owner) public view returns (bool) { PendingState storage pending = m_pending[_operation]; uint ownerIndex = m_ownerIndex[uint(_owner)]; @@ -288,7 +288,7 @@ contract daylimit is multiowned { // METHODS // constructor - stores initial daily limit and records the present day's index. - constructor(uint _limit) { + constructor(uint _limit) public { m_dailyLimit = _limit; m_lastDay = today(); } @@ -348,7 +348,7 @@ contract multisig { // TODO: document function changeOwner(address _from, address _to) external; function execute(address _to, uint _value, bytes _data) external returns (bytes32); - function confirm(bytes32 _h) returns (bool); + function confirm(bytes32 _h) public returns (bool); } // usage: @@ -369,7 +369,7 @@ contract Wallet is multisig, multiowned, daylimit { // constructor - just pass on the owner array to the multiowned and // the limit to daylimit - constructor(address[] memory _owners, uint _required, uint _daylimit) payable + constructor(address[] memory _owners, uint _required, uint _daylimit) public payable multiowned(_owners, _required) daylimit(_daylimit) { } @@ -385,7 +385,7 @@ contract Wallet is multisig, multiowned, daylimit { emit Deposit(msg.sender, msg.value); } - // Outside-visible transact entry point. Executes transaction immediately if below daily spend limit. + // Outside-visible transact entry point. Executes transacion immediately if below daily spend limit. // If not, goes into multisig process. We provide a hash on return to allow the sender to provide // shortcuts for the other confirmations (allowing them to avoid replicating the _to, _value // and _data arguments). They still get the option of using them if they want, anyways. @@ -409,7 +409,7 @@ contract Wallet is multisig, multiowned, daylimit { // confirm a transaction through just the hash. we use the previous transactions map, m_txs, in order // to determine the body of the transaction from the hash provided. - function confirm(bytes32 _h) onlymanyowners(_h) returns (bool) { + function confirm(bytes32 _h) onlymanyowners(_h) public returns (bool) { if (m_txs[_h].to != 0x0000000000000000000000000000000000000000) { m_txs[_h].to.call.value(m_txs[_h].value)(m_txs[_h].data); emit MultiTransact(msg.sender, _h, m_txs[_h].value, m_txs[_h].to, m_txs[_h].data); |