I am getting the error while deposit the amount in remix.

Following is my code

 pragma solidity ^0.4.19;

 contract Savings {
 address owner;
 uint256 deadline;

modifier onlyOwner() {
    require(msg.sender == owner);

function deposit(uint256 amount) public payable {
    require(msg.value == amount);

function Savings(uint256 numberOfDays) public payable {
    owner = msg.sender;
    deadline = now + (numberOfDays * 1 days);

function withdraw() public onlyOwner  {
    require(now >= deadline);


I copied your code into remix and tried depositing. seems to work fine. If I am not entering the value in the field, I am able to observe the error you observed. Please check if you have added the amount in wei.

  • Yes, It works for me as well thanks for your time May 13 '19 at 10:03
  • you are welcome :)
    – Sanjay S B
    May 13 '19 at 10:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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