Make default function payable
This commit is contained in:
@ -22,7 +22,7 @@ contract SimpleTokenBounty is PullPayment {
|
|||||||
address public factoryAddress;
|
address public factoryAddress;
|
||||||
mapping(address => address) public researchers;
|
mapping(address => address) public researchers;
|
||||||
|
|
||||||
function() {
|
function() payable {
|
||||||
if (claimed) throw;
|
if (claimed) throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,11 @@
|
|||||||
contract('Bounty', function(accounts) {
|
contract('Bounty', function(accounts) {
|
||||||
|
before(function(){
|
||||||
|
owner = accounts[0];
|
||||||
|
researcher = accounts[1];
|
||||||
|
})
|
||||||
|
|
||||||
it("can create bounty contract with factory address", function(done){
|
it("can create bounty contract with factory address", function(done){
|
||||||
var target = SecureTargetMock.deployed();
|
var target = SecureTargetMock.deployed();
|
||||||
|
|
||||||
SimpleTokenBounty.new(target.address).
|
SimpleTokenBounty.new(target.address).
|
||||||
then(function(bounty){
|
then(function(bounty){
|
||||||
return bounty.factoryAddress.call()
|
return bounty.factoryAddress.call()
|
||||||
@ -12,6 +16,22 @@ contract('Bounty', function(accounts) {
|
|||||||
then(done);
|
then(done);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("sets reward", function(done){
|
||||||
|
var target = SecureTargetMock.deployed();
|
||||||
|
var reward = web3.toWei(1, "ether");
|
||||||
|
var bounty;
|
||||||
|
SimpleTokenBounty.new(target.address).
|
||||||
|
then(function(bounty){
|
||||||
|
web3.eth.sendTransaction({
|
||||||
|
from:owner,
|
||||||
|
to:bounty.address,
|
||||||
|
value: reward
|
||||||
|
})
|
||||||
|
assert.equal(reward, web3.eth.getBalance(bounty.address).toNumber())
|
||||||
|
}).
|
||||||
|
then(done);
|
||||||
|
})
|
||||||
|
|
||||||
describe("SecureTargetMock", function(){
|
describe("SecureTargetMock", function(){
|
||||||
before(function(){
|
before(function(){
|
||||||
targetFactory = SecureTargetFactory.deployed();
|
targetFactory = SecureTargetFactory.deployed();
|
||||||
|
|||||||
Reference in New Issue
Block a user