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
334073a6
Commit
334073a6
authored
Oct 22, 2016
by
Makoto Inoue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix typo
parent
bc3f2a66
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
10 deletions
+10
-10
Bounty.sol
contracts/Bounty.sol
+4
-4
InsecureTargetMock.sol
contracts/test-helpers/InsecureTargetMock.sol
+1
-1
SecureTargetMock.sol
contracts/test-helpers/SecureTargetMock.sol
+1
-1
Bounty.js
test/Bounty.js
+4
-4
No files found.
contracts/Bounty.sol
View file @
334073a6
...
@@ -9,7 +9,7 @@ import './PullPayment.sol';
...
@@ -9,7 +9,7 @@ import './PullPayment.sol';
*/
*/
contract Target {
contract Target {
function checkInvari
e
nt() returns(bool);
function checkInvari
a
nt() returns(bool);
}
}
contract Bounty is PullPayment {
contract Bounty is PullPayment {
...
@@ -27,15 +27,15 @@ contract Bounty is PullPayment {
...
@@ -27,15 +27,15 @@ contract Bounty is PullPayment {
return target;
return target;
}
}
function checkInvari
e
nt() returns(bool){
function checkInvari
a
nt() returns(bool){
return target.checkInvari
e
nt();
return target.checkInvari
a
nt();
}
}
function claim(Target target) {
function claim(Target target) {
address researcher = researchers[target];
address researcher = researchers[target];
if (researcher == 0) throw;
if (researcher == 0) throw;
// Check Target contract invariants
// Check Target contract invariants
if (!target.checkInvari
e
nt()) {
if (!target.checkInvari
a
nt()) {
throw;
throw;
}
}
asyncSend(researcher, this.balance);
asyncSend(researcher, this.balance);
...
...
contracts/test-helpers/InsecureTargetMock.sol
View file @
334073a6
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
contract InsecureTargetMock {
contract InsecureTargetMock {
function checkInvari
e
nt() returns(bool){
function checkInvari
a
nt() returns(bool){
return false;
return false;
}
}
}
}
contracts/test-helpers/SecureTargetMock.sol
View file @
334073a6
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
contract SecureTargetMock {
contract SecureTargetMock {
function checkInvari
e
nt() returns(bool){
function checkInvari
a
nt() returns(bool){
return true;
return true;
}
}
}
}
test/Bounty.js
View file @
334073a6
contract
(
'Bounty'
,
function
(
accounts
)
{
contract
(
'Bounty'
,
function
(
accounts
)
{
it
(
"can call checkInvari
e
nt for InsecureTargetMock"
,
function
(
done
){
it
(
"can call checkInvari
a
nt for InsecureTargetMock"
,
function
(
done
){
var
bounty
=
Bounty
.
deployed
();
var
bounty
=
Bounty
.
deployed
();
var
target
=
SecureTargetMock
.
deployed
();
var
target
=
SecureTargetMock
.
deployed
();
bounty
.
createTarget
(
target
.
address
).
bounty
.
createTarget
(
target
.
address
).
then
(
function
()
{
then
(
function
()
{
return
bounty
.
checkInvari
e
nt
.
call
()
return
bounty
.
checkInvari
a
nt
.
call
()
}).
}).
then
(
function
(
result
)
{
then
(
function
(
result
)
{
assert
.
isTrue
(
result
);
assert
.
isTrue
(
result
);
...
@@ -12,12 +12,12 @@ contract('Bounty', function(accounts) {
...
@@ -12,12 +12,12 @@ contract('Bounty', function(accounts) {
then
(
done
);
then
(
done
);
})
})
it
(
"can call checkInvari
e
nt for InsecureTargetMock"
,
function
(
done
){
it
(
"can call checkInvari
a
nt for InsecureTargetMock"
,
function
(
done
){
var
bounty
=
Bounty
.
deployed
();
var
bounty
=
Bounty
.
deployed
();
var
target
=
InsecureTargetMock
.
deployed
();
var
target
=
InsecureTargetMock
.
deployed
();
bounty
.
createTarget
(
target
.
address
).
bounty
.
createTarget
(
target
.
address
).
then
(
function
()
{
then
(
function
()
{
return
bounty
.
checkInvari
e
nt
.
call
()
return
bounty
.
checkInvari
a
nt
.
call
()
}).
}).
then
(
function
(
result
)
{
then
(
function
(
result
)
{
assert
.
isFalse
(
result
);
assert
.
isFalse
(
result
);
...
...
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