From 73be06412fdeb0453c11fa708d4e211947569ec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Venturo?= Date: Mon, 23 Jul 2018 15:44:14 -0300 Subject: [PATCH] Remove payable from Destructible constructor (#1107) * Destructible no longer has a payable constructor. * Fixed linter errors. --- contracts/lifecycle/Destructible.sol | 3 --- contracts/mocks/DestructibleMock.sol | 7 +++++++ test/lifecycle/Destructible.test.js | 10 ++++++++-- 3 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 contracts/mocks/DestructibleMock.sol diff --git a/contracts/lifecycle/Destructible.sol b/contracts/lifecycle/Destructible.sol index d18972ee1..263af8eb5 100644 --- a/contracts/lifecycle/Destructible.sol +++ b/contracts/lifecycle/Destructible.sol @@ -9,9 +9,6 @@ import "../ownership/Ownable.sol"; * @dev Base contract that can be destroyed by owner. All funds in contract will be sent to the owner. */ contract Destructible is Ownable { - - constructor() public payable { } - /** * @dev Transfers the current balance to the owner and terminates the contract. */ diff --git a/contracts/mocks/DestructibleMock.sol b/contracts/mocks/DestructibleMock.sol new file mode 100644 index 000000000..9265d73c5 --- /dev/null +++ b/contracts/mocks/DestructibleMock.sol @@ -0,0 +1,7 @@ +pragma solidity ^0.4.24; + +import "../lifecycle/Destructible.sol"; + +contract DestructibleMock is Destructible { + function() payable public {} +} diff --git a/test/lifecycle/Destructible.test.js b/test/lifecycle/Destructible.test.js index 86e095144..469cc7e4a 100644 --- a/test/lifecycle/Destructible.test.js +++ b/test/lifecycle/Destructible.test.js @@ -1,9 +1,15 @@ -var Destructible = artifacts.require('Destructible'); +const DestructibleMock = artifacts.require('DestructibleMock'); const { ethGetBalance } = require('../helpers/web3'); contract('Destructible', function (accounts) { beforeEach(async function () { - this.destructible = await Destructible.new({ from: accounts[0], value: web3.toWei('10', 'ether') }); + this.destructible = await DestructibleMock.new({ from: accounts[0] }); + await web3.eth.sendTransaction({ + from: accounts[0], + to: this.destructible.address, + value: web3.toWei('10', 'ether'), + }); + this.owner = await this.destructible.owner(); });