Skip to main content

Smart Contracts (Solidity + Foundry)

The on-chain side is a Foundry project with two contracts.

RupiahToken (IDRT)

A standard ERC20 (18 decimals) — the “money” you save. Includes a mint(to, amount) faucet so anyone can grab test tokens.

Vault

A savings “celengan”: deposit(amount) / withdraw(amount), tracking each address’s balance 1:1.

The contracts

src/RupiahToken.sol (excerpt)
src/Vault.sol (excerpt)
deposit uses the approve → transferFrom pattern, and withdraw follows Checks-Effects-Interactions (state updated before sending tokens) to avoid reentrancy.

Get the project

Deploy to Sepolia

Put your deployer key in an env file (a throwaway test key with Sepolia ETH):
.env
Never commit .env or use a key holding real funds. Add .env to .gitignore.
Deploy both contracts (token first, then the Vault pointing to it):
Foundry prints the deployed addresses:

Verify on Etherscan

Quick sanity check with cast

Next: Frontend Integration

Wire the contracts into the React app.