2

I `ve got this function at my .sol file

function enter() public payable{
        require(msg.value > .01 ether);
        players.push(msg.sender);
    }

But when i`m trying to send some eth on it from deployed file it says 'invalid address or ENS name'.

const lotteryContract = new ethers.Contract(
        addr,
        LotteryArtifact.abi,
        acc2
    )

    const tx ={
        from:acc2,
        value:ethers.utils.parseEther('2'),
    }

    await lotteryContract.enter(tx)

Seems like it`s syntactically error in this way of calling it.Also i tried to send it this way

 const tx ={
        to:lotteryContract.enter(),
        value:ethers.utils.parseEther('2'),
    }

   await acc1.sendTransaction(tx)

Testing this 'enter' function in remix ide logging this enter image description here

According to the screenshot can anyone explain does 0xf8e81D47203A594245E36C48e151709F0C19fBe8 means the 'enter' function address?

gsh1ne
  • 21
  • 4
  • take a look at this issue https://stackoverflow.com/questions/68198724/how-would-i-send-an-eth-value-to-specific-smart-contract-function-that-is-payabl – Oleksandr Hrin Jan 27 '22 at 12:53

0 Answers0