ETH send from contract to web page

Hi to everyone here at Morales forum! I’m very new to all this but very excited as well :fire:
Following some tutorials I wrote a simple contract where people can deposit some ETH, (MATIC in my case) and I will be able to withdraw it.
For what I understand, in solidity I can’t specify any input field so I wish to know what’s the best way, to implement a simple interface with point 1 and 2 of my screenshot in a web page.

this is the Solidity code:

pragma solidity ^0.8.1;

contract test {

    address public owner;
    bool public paused;

constructor() {
    owner = msg.sender;
}

function sendMoney() public payable { }


function setPaused(bool _paused) public {
    require(msg.sender == owner, "You are not the owner"); paused = _paused;
}


function withdrawAllMoney(address payable _to) public {
    require(owner == msg.sender, "You cannot withdraw.");
    require(paused == false, "Contract Paused");
    _to.transfer(address(this).balance);
}


}

thank you!

you want to implement a simple interface for sendMoney contract function call?
if that is the case, you can use Moralis.executeFunction to call that contract function after you add in input in the interface with the value that user wants to send

1 Like

hey @cryptokid thanks for the reply. As I said I’m very new to programming, can you please show me an example? thanks in advance.

first you have to read that data from some input fields and print it with console.log to the browser console when you click on a button, do you know how to do that part?

1 Like

please be patient :wink: