Skip to content
Snippets Groups Projects
Commit 41606381 authored by Robert Martin-Legene's avatar Robert Martin-Legene
Browse files

solidity v4->v5 distinguises between addresses and payable addresses

parent 512ca90f
No related branches found
No related tags found
No related merge requests found
// vim:filetype=javascript
pragma solidity ^0.4.24;
pragma solidity ^0.5;
contract Distillery {
address owner;
address payable owner;
struct Allowances {
address beneficiary;
address payable beneficiary;
uint topuplimit;
}
Allowances[] thelist;
......@@ -42,7 +42,7 @@ contract Distillery {
// Or returns 0 if the address is not found in thelist.
// 0 : not found
// 1 : first position
function _beneficiaryPosition( address beneficiary ) internal view returns ( uint ) {
function _beneficiaryPosition( address payable beneficiary ) internal view returns ( uint ) {
uint pos = thelist.length;
while ( pos-- > 0 )
if ( beneficiary == thelist[pos].beneficiary )
......@@ -52,7 +52,7 @@ contract Distillery {
// This function returns the "allowance" that a given address is set to.
// Using this function, you don't have to cycle through atPosition() until
// you find the address you want to know about.
function getEtherAllowance( address beneficiary ) public view returns (uint256) {
function getEtherAllowance( address payable beneficiary ) public view returns (uint256) {
uint pos = _beneficiaryPosition( beneficiary );
if ( pos == 0 )
return 0;
......@@ -60,7 +60,7 @@ contract Distillery {
}
// This admin (ownerOnly) function allows the creator of the contract to
// add/change/delete "allowances" per address.
function setEtherAllowance( address beneficiary, uint256 topuplimit ) public onlyOwner {
function setEtherAllowance( address payable beneficiary, uint256 topuplimit ) public onlyOwner {
uint pos = _beneficiaryPosition( beneficiary );
// Not found and trying to delete beneficiary? Just return immediately.
if ( pos == 0 && topuplimit == 0 )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment