This project is a simple application for requesting and depositing tokens on the Ethereum network through a smart contract written in Solidity. The application uses MetaMask to connect to an Ethereum wallet and interact with the smart contract.
- Solidity: Programming language for writing smart contracts.
- Web3.js: JavaScript library for interacting with the Ethereum blockchain.
- MetaMask: Ethereum wallet for connecting to the application and executing transactions.
- Remix IDE: Integrated development environment (IDE) for writing, compiling, and deploying smart contracts.
- Open Remix IDE.
- Create a new file named
Contract.soland paste the smart contract code into it. - Compile the contract by selecting the "Solidity Compiler" tab and clicking "Compile Contract.sol".
- Deploy the contract to the Ethereum network by selecting the "Deploy & Run Transactions" tab, choosing the environment (e.g., JavaScript VM or Injected Web3 if using MetaMask), and clicking "Deploy".
- Copy the contract address after deployment and replace
<YOUR_CONTRACT_ADDRESS>in thescript.jsfile with this address. - Copy the ABI of the contract from Remix IDE (under the "Solidity Compiler" tab) and replace
<ABI of the smart contract>in thescript.jsfile with the ABI.
- Open the
index.htmlfile in your browser. - Connect to MetaMask and select the account you want to use.
- Use the buttons on the interface to interact with the smart contract:
- Get Balance: View your token balance.
- Request Tokens: Request tokens (maximum 100 tokens per request, and requests can only be made at even timestamps).
- Deposit Tokens: Deposit Ether into the contract (only the contract owner can perform this function).
Contract.sol: Smart contract written in Solidity.index.html: Simple user interface.script.js: JavaScript for interacting with the smart contract via Web3.js.style.css: CSS file for styling the user interface (if applicable).
This project is distributed under the MIT License. See the MIT License for more details.