Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
didi
github_repo_test
Commits
386b5c76
Commit
386b5c76
authored
Aug 13, 2017
by
didi
Browse files
fixed comments
parent
4c02c304
Changes
1
Hide whitespace changes
Inline
Side-by-side
backend/contracts/StreemETH.sol
View file @
386b5c76
...
...
@@ -2,18 +2,13 @@ pragma solidity ^0.4.13;
import
"./Streem.sol"
;
// inspired by https://github.com/mattdf/payment-channel/blob/master/channel.sol
// one instance represents one ERC20 token, the rest is very similar to the normal Streem contract.
// a model where a contract exists per user would offer more implicit security, but be less efficient (?)
contract
StreemETH
is
Streem
{
event
Deposit
(
address
sender
,
uint
amount
);
event
Withdrawal
(
address
sender
,
uint
amount
);
// constructor: just call the base constructor with the right args
function
StreemETH
()
Streem
(
0
,
"Streaming Ether"
,
"SETH"
,
18
)
{}
// function charge is to be handled outside of this contract (direct call of token.transfer(trusteeAddr, amount))
// conversion from StreemETH to ETH
function
withdraw
(
uint256
amount
)
{
// following the Checks-Effects-Interaction Pattern
...
...
@@ -23,7 +18,7 @@ contract StreemETH is Streem {
msg
.
sender
.
transfer
(
amount
);
Withdrawal
(
msg
.
sender
,
amount
);
}
// convers
t
ion from ETH to StreemETH
// conversion from ETH to StreemETH
function
()
payable
{
settledBalances
[
msg
.
sender
]
+=
int
(
msg
.
value
);
totalSupply
+=
msg
.
value
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment