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
14b84962
Commit
14b84962
authored
Oct 26, 2016
by
Makoto Inoue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass factory address to bounty
parent
721d8fbb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
14 deletions
+18
-14
InsecureTargetMock.sol
contracts/test-helpers/InsecureTargetMock.sol
+1
-1
SecureTargetMock.sol
contracts/test-helpers/SecureTargetMock.sol
+1
-1
2_deploy_contracts.js
migrations/2_deploy_contracts.js
+2
-2
Bounty.js
test/Bounty.js
+14
-10
No files found.
contracts/test-helpers/InsecureTargetMock.sol
View file @
14b84962
...
...
@@ -6,7 +6,7 @@ contract InsecureTargetMock {
}
}
contract
Deployer
{
contract
InsecureTargetFactory
{
function deployContract() returns (address) {
return new InsecureTargetMock();
}
...
...
contracts/test-helpers/SecureTargetMock.sol
View file @
14b84962
...
...
@@ -6,7 +6,7 @@ contract SecureTargetMock {
}
}
contract
Deployer
{
contract
SecureTargetFactory
{
function deployContract() returns (address) {
return new SecureTargetMock();
}
...
...
migrations/2_deploy_contracts.js
View file @
14b84962
...
...
@@ -7,7 +7,7 @@ module.exports = function(deployer) {
deployer
.
deploy
(
Ownable
);
deployer
.
deploy
(
LimitFunds
);
if
(
deployer
.
network
==
'test'
){
deployer
.
deploy
(
SecureTarget
Mock
);
deployer
.
deploy
(
InsecureTarget
Mock
);
deployer
.
deploy
(
SecureTarget
Factory
);
deployer
.
deploy
(
InsecureTarget
Factory
);
};
};
test/Bounty.js
View file @
14b84962
...
...
@@ -11,17 +11,17 @@ contract('Bounty', function(accounts) {
then
(
done
);
})
it
.
only
(
"can call checkInvariant for SecureTargetMock"
,
function
(
done
){
it
(
"can call checkInvariant for SecureTargetMock"
,
function
(
done
){
var
bounty
;
var
target
=
SecureTargetMock
.
deployed
();
SimpleTokenBounty
.
new
(
target
.
address
).
var
target
Factory
=
SecureTargetFactory
.
deployed
();
SimpleTokenBounty
.
new
(
target
Factory
.
address
).
then
(
function
(
_bounty
)
{
bounty
=
_bounty
;
return
bounty
.
createTarget
.
sendTransaction
({
gas
:
200000
});
return
bounty
.
createTarget
();
}).
then
(
function
()
{
return
bounty
.
checkInvariant
.
call
()
}).
// then(function() {
// return bounty.checkInvariant.call()
// }).
then
(
function
(
result
)
{
assert
.
isTrue
(
result
);
}).
...
...
@@ -29,9 +29,13 @@ contract('Bounty', function(accounts) {
})
it
(
"can call checkInvariant for InsecureTargetMock"
,
function
(
done
){
var
bounty
=
SimpleTokenBounty
.
deployed
();
var
target
=
InsecureTargetMock
.
deployed
();
bounty
.
createTarget
(
target
.
address
).
var
bounty
;
var
targetFactory
=
InsecureTargetFactory
.
deployed
();
SimpleTokenBounty
.
new
(
targetFactory
.
address
).
then
(
function
(
_bounty
)
{
bounty
=
_bounty
;
return
bounty
.
createTarget
();
}).
then
(
function
()
{
return
bounty
.
checkInvariant
.
call
()
}).
...
...
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