I'm having issues sending ETH to an extremely basic smart contract. Here's the smart contract code:

// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

contract hodl {
  uint num;
  uint value;
  constructor() {
      num = 69;
      value = 0;
  event showNum(uint num);
  event seeSender(address addy, uint value);

  fallback() external payable {
    emit seeSender(msg.sender, msg.value);
    emit showNum(num);
    num += 1;

  function printNum() public returns (uint y){
    emit showNum(num);
    return num;

  function printValue() public returns (uint y){
    return value;


Here's the deployment code if it matters (file name is 2_deploy_contract.js):

const hodl = artifacts.require("hodl.sol");

module.exports = function (deployer) {

Here's the output from my terminal:

truffle(ganache)> c = await hodl.deployed()
truffle(ganache)> c.sendTransaction({from: ‘0x40Fdb0DceC71c8e3b414FB04351C9eDd45116120’, value: ‘1000000000000000'})
c.sendTransaction({from: ‘0x40Fdb0DceC71c8e3b414FB04351C9eDd45116120’, value: ‘1000000000000000'})

Uncaught SyntaxError: Invalid or unexpected token
  • In javascript to delimit string you can use single quotes ' or double quotes ". The character you are using isn't the correct one .
    – Ismael
    Nov 30 '21 at 4:47
  • That doesn't change anything unfortunately Dec 2 '21 at 1:05
  • If you got the same error it means there is another quote that has to be replaced. If you got a different error then you can edit the question to add it.
    – Ismael
    Dec 2 '21 at 3:14

Shouldn't const hodl = require('hodl.sol');


const hodl = require('hodl');

  • I think either one is fine Dec 2 '21 at 0:56
  • did you try it? cuz you're supposed to import the contract name not the file name Dec 2 '21 at 1:55

So I'm super dumb and realized I wasn't sending enough WEI to notice a change in the accounts value. That was the issue.

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.