I am quite new to solidity and ethereum smart contracts, so I am trying to create a new Table contract, from an existing Room Contract, but i have been running into this problem.

Note: The constructor should be payable if you send value

Even though my Table constructor is a payable constructor.

Here is my code:

pragma solidity ^0.4.0;

contract Room {
    address[] public Tables;

    function Room() public payable {}

    function createTable(uint minimum) public payable {
        address createdTable = new Table(minimum);

    function getCreatedTables() public view returns(address[]) {
        return Tables;

contract Table {
    struct Player {
        address player;
        uint value;

    Player[] public players;
    uint public minimumBet;
    uint public maxPlayers = 2;
    mapping(address => bool) public availablePlayers;

    function Table(uint minimum) public payable {
        minimumBet = minimum;

    modifier restricted() {
        require(players.length < maxPlayers);

    function getTotalPlayers() public view returns(uint) {
        return players.length;

    function enterTable() public restricted payable {
        require(msg.value >= minimumBet);

        availablePlayers[msg.sender] = true;
        Player memory newPlayer = Player({
            player: msg.sender,
            value: msg.value

  • I think that message shows up any time a transaction is reverted, so don't read too much into it. What were you doing when you saw the revert error? Were you deploying the contract, or were you calling one of its functions?
    – user19510
    Commented Apr 3, 2018 at 3:34
  • i called the createTable function and this message showed up, also there was no table contract deployed.
    – aditya
    Commented Apr 3, 2018 at 3:46

1 Answer 1


The error showed up when calling createTable. The problem with that function is that it doesn't send any ether to Table's constructor. Try this:

address createdTable = (new Table).value(msg.value)(minimum);

This attaches all the ether sent to createTable to the call to Table's constructor.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.