Skip to main content
Prerequisites:
  • Foundry (forge, cast) installed
  • Node.js ≥20 (for dotenv, if desired)
  • Funded EVM testnet account (private key)
  • Environment variables.
Follow these steps to install, test, deploy and interact with your contracts on the Ritual Chain testnet.
1

Clone Repository

git clone https://github.com/RitualChain/network-precompiles.git
&& cd network-precompiles
2

Setup Environment

cp .env.example .env

# Note: save PRICE_CALLER_ADDRESS after deployment.
3

Install Node Dependencies

pnpm install
4

Build and Test

pnpm build
&& pnpm test
5

Deploy and Execute

Before deploying, make sure your environment is set. You can use a .env file (see .env.example) or export variables in your shell.
pnpm deploy:price
Alternatively, run Foundry directly:
forge script script/Deploy.s.sol:DeployPriceCaller \
  --rpc-url testnet \
  --private-key $PRIVATE_KEY \
  --broadcast -vvvv
Save/export the deployed address:
export PRICE_CALLER_ADDRESS=0xd3pl0y3d
6

Call GET Method

The script funds the RitualWallet, fetches latest block, calls getEthPrice(uint64), and logs result body.
pnpm getPrice

Cast Method

Call getEthPrice directly on your deployed PriceCaller
# Optional: deposit to RitualWallet (0.1 RIT, lock 500 blocks)
cast send $RITUAL_WALLET_ADDRESS \
  "deposit(uint256)" 500 \
  --value 100000000000000000 \
  --rpc-url $TESTNET_RPC_URL \
  --private-key $PRIVATE_KEY

# Call getEthPrice with latest block number
cast send $PRICE_CALLER_ADDRESS \
  'getEthPrice(uint64)' \
  $(cast block-number --rpc-url $TESTNET_RPC_URL) \
  --gas-limit 5000000 \
  --rpc-url $TESTNET_RPC_URL \
  --private-key $PRIVATE_KEY