Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nucleo
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blockchain
nucleo
Commits
41606381
Commit
41606381
authored
5 years ago
by
Robert Martin-Legene
Browse files
Options
Downloads
Patches
Plain Diff
solidity v4->v5 distinguises between addresses and payable addresses
parent
512ca90f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Distillery.sol
+6
-6
6 additions, 6 deletions
src/Distillery.sol
with
6 additions
and
6 deletions
src/Distillery.sol
+
6
−
6
View file @
41606381
// 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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment