Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
37f4ff8d
Commit
37f4ff8d
authored
Oct 27, 2016
by
Makoto Inoue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add killable to bounty
parent
e35ba313
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
+22
-3
SimpleTokenBounty.sol
contracts/bounties/SimpleTokenBounty.sol
+2
-2
Bounty.js
test/Bounty.js
+20
-1
No files found.
contracts/bounties/SimpleTokenBounty.sol
View file @
37f4ff8d
pragma solidity ^0.4.0;
import '../PullPayment.sol';
import '../Killable.sol';
/*
* Bounty
* This bounty will pay out if you can cause a SimpleToken's balance
...
...
@@ -16,7 +16,7 @@ contract Target {
function checkInvariant() returns(bool);
}
contract SimpleTokenBounty is PullPayment {
contract SimpleTokenBounty is PullPayment
, Killable
{
Target target;
bool public claimed;
address public factoryAddress;
...
...
test/Bounty.js
View file @
37f4ff8d
...
...
@@ -7,7 +7,7 @@ var sendReward = function(sender, receiver, value){
}
contract
(
'Bounty'
,
function
(
accounts
)
{
it
(
"c
an create
bounty contract with factory address"
,
function
(
done
){
it
(
"c
reates
bounty contract with factory address"
,
function
(
done
){
var
target
=
SecureTargetMock
.
deployed
();
SimpleTokenBounty
.
new
(
target
.
address
).
...
...
@@ -33,6 +33,25 @@ contract('Bounty', function(accounts) {
then
(
done
);
})
it
(
"ends"
,
function
(
done
){
var
target
=
SecureTargetMock
.
deployed
();
var
owner
=
accounts
[
0
];
var
reward
=
web3
.
toWei
(
1
,
"ether"
);
var
bounty
;
SimpleTokenBounty
.
new
(
target
.
address
).
then
(
function
(
_bounty
){
bounty
=
_bounty
;
sendReward
(
owner
,
bounty
.
address
,
reward
);
assert
.
equal
(
reward
,
web3
.
eth
.
getBalance
(
bounty
.
address
).
toNumber
())
return
bounty
.
kill
()
}).
then
(
function
(){
assert
.
equal
(
0
,
web3
.
eth
.
getBalance
(
bounty
.
address
).
toNumber
())
}).
then
(
done
);
})
describe
(
"SecureTargetMock"
,
function
(){
it
(
"checkInvariant returns true"
,
function
(
done
){
var
targetFactory
=
SecureTargetFactory
.
deployed
();
...
...
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