diff options
author | Daniel Kirchner <daniel@ekpyron.org> | 2018-09-12 22:21:43 +0800 |
---|---|---|
committer | Daniel Kirchner <daniel@ekpyron.org> | 2018-09-12 22:21:43 +0800 |
commit | 879251a78b2d4e26dc71299d2d7ca989d0855d61 (patch) | |
tree | fedf7b035e527103f178f9670bce4cbbc81d283d /test/compilationTests | |
parent | 1994b51ef3eb8de3617efec9747979c9fb5ed453 (diff) | |
download | dexon-solidity-879251a78b2d4e26dc71299d2d7ca989d0855d61.tar.gz dexon-solidity-879251a78b2d4e26dc71299d2d7ca989d0855d61.tar.zst dexon-solidity-879251a78b2d4e26dc71299d2d7ca989d0855d61.zip |
Update test suite to use address payable.
Diffstat (limited to 'test/compilationTests')
-rw-r--r-- | test/compilationTests/corion/ico.sol | 14 | ||||
-rw-r--r-- | test/compilationTests/corion/module.sol | 22 | ||||
-rw-r--r-- | test/compilationTests/corion/moduleHandler.sol | 8 | ||||
-rw-r--r-- | test/compilationTests/corion/premium.sol | 4 | ||||
-rw-r--r-- | test/compilationTests/corion/provider.sol | 12 | ||||
-rw-r--r-- | test/compilationTests/corion/publisher.sol | 8 | ||||
-rw-r--r-- | test/compilationTests/corion/schelling.sol | 6 | ||||
-rw-r--r-- | test/compilationTests/corion/token.sol | 8 | ||||
-rw-r--r-- | test/compilationTests/zeppelin/MultisigWallet.sol | 2 | ||||
-rw-r--r-- | test/compilationTests/zeppelin/crowdsale/Crowdsale.sol | 4 | ||||
-rw-r--r-- | test/compilationTests/zeppelin/crowdsale/RefundVault.sol | 8 | ||||
-rw-r--r-- | test/compilationTests/zeppelin/lifecycle/Destructible.sol | 2 | ||||
-rw-r--r-- | test/compilationTests/zeppelin/ownership/Claimable.sol | 4 | ||||
-rw-r--r-- | test/compilationTests/zeppelin/ownership/Ownable.sol | 4 | ||||
-rw-r--r-- | test/compilationTests/zeppelin/payment/PullPayment.sol | 2 |
15 files changed, 55 insertions, 53 deletions
diff --git a/test/compilationTests/corion/ico.sol b/test/compilationTests/corion/ico.sol index b1e0bf75..e660389b 100644 --- a/test/compilationTests/corion/ico.sol +++ b/test/compilationTests/corion/ico.sol @@ -27,12 +27,12 @@ contract ico is safeMath { uint256 constant oneSegment = 40320; - address public owner; - address public tokenAddr; - address public premiumAddr; + address payable public owner; + address payable public tokenAddr; + address payable public premiumAddr; uint256 public startBlock; uint256 public icoDelay; - address public foundationAddress; + address payable public foundationAddress; address public icoEtcPriceAddr; uint256 public icoExchangeRate; uint256 public icoExchangeRateSetBlock; @@ -50,7 +50,7 @@ contract ico is safeMath { uint256 public totalMint; uint256 public totalPremiumMint; - constructor(address foundation, address priceSet, uint256 exchangeRate, uint256 startBlockNum, address[] memory genesisAddr, uint256[] memory genesisValue) public { + constructor(address payable foundation, address priceSet, uint256 exchangeRate, uint256 startBlockNum, address[] memory genesisAddr, uint256[] memory genesisValue) public { /* Installation function. @@ -248,7 +248,7 @@ contract ico is safeMath { aborted = true; } - function connectTokens(address tokenContractAddr, address premiumContractAddr) external { + function connectTokens(address payable tokenContractAddr, address payable premiumContractAddr) external { /* Installation function which joins the two token contracts with this contract. Only callable by the owner @@ -284,7 +284,7 @@ contract ico is safeMath { require( buy(msg.sender, address(0x00)) ); } - function buy(address beneficiaryAddress, address affilateAddress) public payable returns (bool success) { + function buy(address payable beneficiaryAddress, address affilateAddress) public payable returns (bool success) { /* Buying a token diff --git a/test/compilationTests/corion/module.sol b/test/compilationTests/corion/module.sol index da4dd344..bd6952b1 100644 --- a/test/compilationTests/corion/module.sol +++ b/test/compilationTests/corion/module.sol @@ -1,8 +1,8 @@ pragma solidity ^0.4.11; contract abstractModuleHandler { - function transfer(address from, address to, uint256 value, bool fee) external returns (bool success) {} - function balanceOf(address owner) public view returns (bool success, uint256 value) {} + function transfer(address payable from, address payable to, uint256 value, bool fee) external returns (bool success) {} + function balanceOf(address payable owner) public view returns (bool success, uint256 value) {} } contract module { @@ -19,7 +19,7 @@ contract module { status public moduleStatus; uint256 public disabledUntil; - address public moduleHandlerAddress; + address payable public moduleHandlerAddress; function disableModule(bool forever) external onlyForModuleHandler returns (bool success) { _disableModule(forever); @@ -36,11 +36,11 @@ contract module { else { disabledUntil = block.number + 5760; } } - function replaceModuleHandler(address newModuleHandlerAddress) external onlyForModuleHandler returns (bool success) { + function replaceModuleHandler(address payable newModuleHandlerAddress) external onlyForModuleHandler returns (bool success) { _replaceModuleHandler(newModuleHandlerAddress); return true; } - function _replaceModuleHandler(address newModuleHandlerAddress) internal { + function _replaceModuleHandler(address payable newModuleHandlerAddress) internal { /* Replace the ModuleHandler address. This function calls the Publisher module. @@ -77,11 +77,11 @@ contract module { moduleStatus = status.Disconnected; } - function replaceModule(address newModuleAddress) external onlyForModuleHandler returns (bool success) { + function replaceModule(address payable newModuleAddress) external onlyForModuleHandler returns (bool success) { _replaceModule(newModuleAddress); return true; } - function _replaceModule(address newModuleAddress) internal { + function _replaceModule(address payable newModuleAddress) internal { /* Replace the module for an another new module. This function calls the Publisher module. @@ -101,20 +101,20 @@ contract module { moduleStatus = status.Disconnected; } - function transferEvent(address from, address to, uint256 value) external onlyForModuleHandler returns (bool success) { + function transferEvent(address payable from, address payable to, uint256 value) external onlyForModuleHandler returns (bool success) { return true; } function newSchellingRoundEvent(uint256 roundID, uint256 reward) external onlyForModuleHandler returns (bool success) { return true; } - function registerModuleHandler(address _moduleHandlerAddress) internal { + function registerModuleHandler(address payable _moduleHandlerAddress) internal { /* Module constructor function for registering ModuleHandler address. */ moduleHandlerAddress = _moduleHandlerAddress; } - function isModuleHandler(address addr) internal returns (bool ret) { + function isModuleHandler(address payable addr) internal returns (bool ret) { /* Test for ModuleHandler address. If the module is not connected then returns always false. @@ -140,4 +140,6 @@ contract module { require( msg.sender == moduleHandlerAddress ); _; } + function() external payable { + } } diff --git a/test/compilationTests/corion/moduleHandler.sol b/test/compilationTests/corion/moduleHandler.sol index 2b513eb1..6b0daf0d 100644 --- a/test/compilationTests/corion/moduleHandler.sol +++ b/test/compilationTests/corion/moduleHandler.sol @@ -25,7 +25,7 @@ contract abstractModule { contract moduleHandler is multiOwner, announcementTypes { struct modules_s { - address addr; + address payable addr; bytes32 name; bool schellingEvent; bool transferEvent; @@ -37,7 +37,7 @@ contract moduleHandler is multiOwner, announcementTypes { constructor(address[] memory newOwners) multiOwner(newOwners) public {} - function load(address foundation, bool forReplace, address Token, address Premium, address Publisher, address Schelling, address Provider) public { + function load(address payable foundation, bool forReplace, address payable Token, address payable Premium, address payable Publisher, address payable Schelling, address payable Provider) public { /* Loading modulest to ModuleHandler. @@ -140,7 +140,7 @@ contract moduleHandler is multiOwner, announcementTypes { } return (true, false, 0); } - function replaceModule(string calldata name, address addr, bool callCallback) external returns (bool success) { + function replaceModule(string calldata name, address payable addr, bool callCallback) external returns (bool success) { /* Module replace, can be called only by the Publisher contract. @@ -178,7 +178,7 @@ contract moduleHandler is multiOwner, announcementTypes { return true; } - function newModule(string calldata name, address addr, bool schellingEvent, bool transferEvent) external returns (bool success) { + function newModule(string calldata name, address payable addr, bool schellingEvent, bool transferEvent) external returns (bool success) { /* Adding new module to the database. Can be called only by the Publisher contract. diff --git a/test/compilationTests/corion/premium.sol b/test/compilationTests/corion/premium.sol index 84277a99..4952a740 100644 --- a/test/compilationTests/corion/premium.sol +++ b/test/compilationTests/corion/premium.sol @@ -12,7 +12,7 @@ contract thirdPartyPContractAbstract { contract ptokenDB is tokenDB {} contract premium is module, safeMath { - function replaceModule(address addr) external returns (bool success) { + function replaceModule(address payable addr) external returns (bool success) { require( super.isModuleHandler(msg.sender) ); require( db.replaceOwner(addr) ); super._replaceModule(addr); @@ -40,7 +40,7 @@ contract premium is module, safeMath { mapping(address => bool) public genesis; - constructor(bool forReplace, address moduleHandler, address dbAddress, address icoContractAddr, address[] memory genesisAddr, uint256[] memory genesisValue) public { + constructor(bool forReplace, address payable moduleHandler, address dbAddress, address icoContractAddr, address[] memory genesisAddr, uint256[] memory genesisValue) public { /* Setup function. If an ICOaddress is defined then the balance of the genesis addresses will be set as well. diff --git a/test/compilationTests/corion/provider.sol b/test/compilationTests/corion/provider.sol index 41857e54..b3b5e8ca 100644 --- a/test/compilationTests/corion/provider.sol +++ b/test/compilationTests/corion/provider.sol @@ -16,7 +16,7 @@ contract provider is module, safeMath, announcementTypes { require( _success ); return true; } - function transferEvent(address from, address to, uint256 value) external returns (bool success) { + function transferEvent(address payable from, address payable to, uint256 value) external returns (bool success) { /* Transaction completed. This function is only available for the modulehandler. It should be checked if the sender or the acceptor does not connect to the provider or it is not a provider itself if so than the change should be recorded. @@ -118,7 +118,7 @@ contract provider is module, safeMath, announcementTypes { uint256 private currentSchellingRound = 1; - constructor(address _moduleHandler) public { + constructor(address payable _moduleHandler) public { /* Install function. @@ -147,7 +147,7 @@ contract provider is module, safeMath, announcementTypes { else { return false; } return true; } - function getUserDetails(address addr, uint256 schellingRound) public view returns (address ProviderAddress, uint256 ProviderHeight, uint256 ConnectedOn, uint256 value) { + function getUserDetails(address payable addr, uint256 schellingRound) public view returns (address ProviderAddress, uint256 ProviderHeight, uint256 ConnectedOn, uint256 value) { /* Collecting the datas of the client. @@ -213,7 +213,7 @@ contract provider is module, safeMath, announcementTypes { return ( ! priv && ( rate >= publicMinRate && rate <= publicMaxRate ) ) || ( priv && ( rate >= privateMinRate && rate <= privateMaxRate ) ); } - function createProvider(bool priv, string calldata name, string calldata website, string calldata country, string calldata info, uint8 rate, bool isForRent, address admin) isReady external { + function createProvider(bool priv, string calldata name, string calldata website, string calldata country, string calldata info, uint8 rate, bool isForRent, address payable admin) isReady external { /* Creating a provider. During the ICO its not allowed to create provider. @@ -270,7 +270,7 @@ contract provider is module, safeMath, announcementTypes { } emit EProviderOpen(msg.sender, currHeight); } - function setProviderDetails(address addr, string calldata website, string calldata country, string calldata info, uint8 rate, address admin) isReady external { + function setProviderDetails(address payable addr, string calldata website, string calldata country, string calldata info, uint8 rate, address payable admin) isReady external { /* Modifying the datas of the provider. This can only be invited by the provider’s admin. @@ -321,7 +321,7 @@ contract provider is module, safeMath, announcementTypes { info = providers[addr].data[height].info; create = providers[addr].data[height].create; } - function getProviderDetails(address addr, uint256 height) public view returns (uint8 rate, bool isForRent, uint256 clientsCount, bool priv, bool getInterest, bool valid) { + function getProviderDetails(address payable addr, uint256 height) public view returns (uint8 rate, bool isForRent, uint256 clientsCount, bool priv, bool getInterest, bool valid) { /* Asking for the datas of the provider. In case the height is unknown then the system will use the last known height. diff --git a/test/compilationTests/corion/publisher.sol b/test/compilationTests/corion/publisher.sol index 6a77bc9e..48090d02 100644 --- a/test/compilationTests/corion/publisher.sol +++ b/test/compilationTests/corion/publisher.sol @@ -9,7 +9,7 @@ contract publisher is announcementTypes, module, safeMath { /* module callbacks */ - function transferEvent(address from, address to, uint256 value) external returns (bool success) { + function transferEvent(address payable from, address payable to, uint256 value) external returns (bool success) { /* Transaction completed. This function is available only for moduleHandler If a transaction is carried out from or to an address which participated in the objection of an announcement, its objection purport is automatically set @@ -54,14 +54,14 @@ contract publisher is announcementTypes, module, safeMath { string _str; uint256 _uint; - address _addr; + address payable _addr; } mapping(uint256 => announcements_s) public announcements; uint256 announcementsLength = 1; mapping (address => uint256[]) public opponents; - constructor(address moduleHandler) public { + constructor(address payable moduleHandler) public { /* Installation function. The installer will be registered in the admin list automatically @@ -116,7 +116,7 @@ contract publisher is announcementTypes, module, safeMath { return _amount * oppositeRate / 100 > weight; } - function newAnnouncement(announcementType Type, string calldata Announcement, string calldata Link, bool Oppositable, string calldata _str, uint256 _uint, address _addr) onlyOwner external { + function newAnnouncement(announcementType Type, string calldata Announcement, string calldata Link, bool Oppositable, string calldata _str, uint256 _uint, address payable _addr) onlyOwner external { /* New announcement. Can be called only by those in the admin list diff --git a/test/compilationTests/corion/schelling.sol b/test/compilationTests/corion/schelling.sol index e9288332..2a327ba0 100644 --- a/test/compilationTests/corion/schelling.sol +++ b/test/compilationTests/corion/schelling.sol @@ -133,13 +133,13 @@ contract schelling is module, announcementTypes, schellingVars { /* module callbacks */ - function replaceModule(address addr) external returns (bool) { + function replaceModule(address payable addr) external returns (bool) { require( super.isModuleHandler(msg.sender) ); require( db.replaceOwner(addr) ); super._replaceModule(addr); return true; } - function transferEvent(address from, address to, uint256 value) external returns (bool) { + function transferEvent(address payable from, address payable to, uint256 value) external returns (bool) { /* Transaction completed. This function can be called only by the ModuleHandler. If this contract is the receiver, the amount will be added to the prize pool of the current round. @@ -247,7 +247,7 @@ contract schelling is module, announcementTypes, schellingVars { bytes1 public belowChar = 0x30; schellingDB private db; - constructor(address _moduleHandler, address _db, bool _forReplace) public { + constructor(address payable _moduleHandler, address _db, bool _forReplace) public { /* Installation function. diff --git a/test/compilationTests/corion/token.sol b/test/compilationTests/corion/token.sol index 6d3f1a1e..f55dc9e6 100644 --- a/test/compilationTests/corion/token.sol +++ b/test/compilationTests/corion/token.sol @@ -15,7 +15,7 @@ contract token is safeMath, module, announcementTypes { /* module callbacks */ - function replaceModule(address addr) external returns (bool success) { + function replaceModule(address payable addr) external returns (bool success) { require( super.isModuleHandler(msg.sender) ); require( db.replaceOwner(addr) ); super._replaceModule(addr); @@ -37,18 +37,18 @@ contract token is safeMath, module, announcementTypes { uint8 public decimals = 6; tokenDB public db; - address public icoAddr; + address payable public icoAddr; uint256 public transactionFeeRate = 20; uint256 public transactionFeeRateM = 1e3; uint256 public transactionFeeMin = 20000; uint256 public transactionFeeMax = 5000000; uint256 public transactionFeeBurn = 80; - address public exchangeAddress; + address payable public exchangeAddress; bool public isICO = true; mapping(address => bool) public genesis; - constructor(bool forReplace, address moduleHandler, address dbAddr, address icoContractAddr, address exchangeContractAddress, address[] memory genesisAddr, uint256[] memory genesisValue) public payable { + constructor(bool forReplace, address payable moduleHandler, address dbAddr, address payable icoContractAddr, address payable exchangeContractAddress, address payable[] memory genesisAddr, uint256[] memory genesisValue) public payable { /* Installation function diff --git a/test/compilationTests/zeppelin/MultisigWallet.sol b/test/compilationTests/zeppelin/MultisigWallet.sol index abad0a01..74a54c7f 100644 --- a/test/compilationTests/zeppelin/MultisigWallet.sol +++ b/test/compilationTests/zeppelin/MultisigWallet.sol @@ -32,7 +32,7 @@ contract MultisigWallet is Multisig, Shareable, DayLimit { /** * @dev destroys the contract sending everything to `_to`. */ - function destroy(address _to) onlymanyowners(keccak256(msg.data)) external { + function destroy(address payable _to) onlymanyowners(keccak256(msg.data)) external { selfdestruct(_to); } diff --git a/test/compilationTests/zeppelin/crowdsale/Crowdsale.sol b/test/compilationTests/zeppelin/crowdsale/Crowdsale.sol index 51eeb7b8..612afc25 100644 --- a/test/compilationTests/zeppelin/crowdsale/Crowdsale.sol +++ b/test/compilationTests/zeppelin/crowdsale/Crowdsale.sol @@ -22,7 +22,7 @@ contract Crowdsale { uint256 public endBlock; // address where funds are collected - address public wallet; + address payable public wallet; // how many token units a buyer gets per wei uint256 public rate; @@ -40,7 +40,7 @@ contract Crowdsale { event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount); - constructor(uint256 _startBlock, uint256 _endBlock, uint256 _rate, address _wallet) public { + constructor(uint256 _startBlock, uint256 _endBlock, uint256 _rate, address payable _wallet) public { require(_startBlock >= block.number); require(_endBlock >= _startBlock); require(_rate > 0); diff --git a/test/compilationTests/zeppelin/crowdsale/RefundVault.sol b/test/compilationTests/zeppelin/crowdsale/RefundVault.sol index b7db8ef2..ef1d8061 100644 --- a/test/compilationTests/zeppelin/crowdsale/RefundVault.sol +++ b/test/compilationTests/zeppelin/crowdsale/RefundVault.sol @@ -15,20 +15,20 @@ contract RefundVault is Ownable { enum State { Active, Refunding, Closed } mapping (address => uint256) public deposited; - address public wallet; + address payable public wallet; State public state; event Closed(); event RefundsEnabled(); event Refunded(address indexed beneficiary, uint256 weiAmount); - constructor(address _wallet) public { + constructor(address payable _wallet) public { require(_wallet != address(0x0)); wallet = _wallet; state = State.Active; } - function deposit(address investor) public onlyOwner payable { + function deposit(address payable investor) public onlyOwner payable { require(state == State.Active); deposited[investor] = deposited[investor].add(msg.value); } @@ -46,7 +46,7 @@ contract RefundVault is Ownable { emit RefundsEnabled(); } - function refund(address investor) public { + function refund(address payable investor) public { require(state == State.Refunding); uint256 depositedValue = deposited[investor]; deposited[investor] = 0; diff --git a/test/compilationTests/zeppelin/lifecycle/Destructible.sol b/test/compilationTests/zeppelin/lifecycle/Destructible.sol index 8b57924d..9b9d8223 100644 --- a/test/compilationTests/zeppelin/lifecycle/Destructible.sol +++ b/test/compilationTests/zeppelin/lifecycle/Destructible.sol @@ -19,7 +19,7 @@ contract Destructible is Ownable { selfdestruct(owner); } - function destroyAndSend(address _recipient) public onlyOwner { + function destroyAndSend(address payable _recipient) public onlyOwner { selfdestruct(_recipient); } } diff --git a/test/compilationTests/zeppelin/ownership/Claimable.sol b/test/compilationTests/zeppelin/ownership/Claimable.sol index 7778e2de..148ad535 100644 --- a/test/compilationTests/zeppelin/ownership/Claimable.sol +++ b/test/compilationTests/zeppelin/ownership/Claimable.sol @@ -10,7 +10,7 @@ import './Ownable.sol'; * This allows the new owner to accept the transfer. */ contract Claimable is Ownable { - address public pendingOwner; + address payable public pendingOwner; /** * @dev Modifier throws if called by any account other than the pendingOwner. @@ -26,7 +26,7 @@ contract Claimable is Ownable { * @dev Allows the current owner to set the pendingOwner address. * @param newOwner The address to transfer ownership to. */ - function transferOwnership(address newOwner) public onlyOwner { + function transferOwnership(address payable newOwner) public onlyOwner { pendingOwner = newOwner; } diff --git a/test/compilationTests/zeppelin/ownership/Ownable.sol b/test/compilationTests/zeppelin/ownership/Ownable.sol index bd175077..3c95127d 100644 --- a/test/compilationTests/zeppelin/ownership/Ownable.sol +++ b/test/compilationTests/zeppelin/ownership/Ownable.sol @@ -7,7 +7,7 @@ pragma solidity ^0.4.11; * functions, this simplifies the implementation of "user permissions". */ contract Ownable { - address public owner; + address payable public owner; /** @@ -34,7 +34,7 @@ contract Ownable { * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ - function transferOwnership(address newOwner) public onlyOwner { + function transferOwnership(address payable newOwner) public onlyOwner { if (newOwner != address(0)) { owner = newOwner; } diff --git a/test/compilationTests/zeppelin/payment/PullPayment.sol b/test/compilationTests/zeppelin/payment/PullPayment.sol index bac1d019..5682d3c2 100644 --- a/test/compilationTests/zeppelin/payment/PullPayment.sol +++ b/test/compilationTests/zeppelin/payment/PullPayment.sol @@ -29,7 +29,7 @@ contract PullPayment { * @dev withdraw accumulated balance, called by payee. */ function withdrawPayments() public { - address payee = msg.sender; + address payable payee = msg.sender; uint256 payment = payments[payee]; if (payment == 0) { |