Make default function payable

pull/35/head
Makoto Inoue 8 years ago
parent df0c2defc8
commit e8262f7c4b
  1. 2
      contracts/bounties/SimpleTokenBounty.sol
  2. 22
      test/Bounty.js

@ -22,7 +22,7 @@ contract SimpleTokenBounty is PullPayment {
address public factoryAddress;
mapping(address => address) public researchers;
function() {
function() payable {
if (claimed) throw;
}

@ -1,7 +1,11 @@
contract('Bounty', function(accounts) {
before(function(){
owner = accounts[0];
researcher = accounts[1];
})
it("can create bounty contract with factory address", function(done){
var target = SecureTargetMock.deployed();
SimpleTokenBounty.new(target.address).
then(function(bounty){
return bounty.factoryAddress.call()
@ -12,6 +16,22 @@ contract('Bounty', function(accounts) {
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(){
before(function(){
targetFactory = SecureTargetFactory.deployed();

Loading…
Cancel
Save