Get started
Overview
This guide shows how to prepare an EVM smart contract for interacting with Warden Protocol modules.
You're going to call modules from your contract by using functions from the available Warden precompiles.
Prerequisites
Before you start, complete the following prerequisites:
-
Install Foundry by running this command:
curl -L https://foundry.paradigm.xyz | bash \
foundryup -
Prepare the chain, setting up your private key.
1. Create a project and contract
-
Initialize a new Foundry project and navigate to its directory:
forge init warden-smart-contract --no-commit
cd warden-smart-contract -
In the
/src
directory, create a new contract namedWarden.sol
. -
Finally, prepare the contract code. You can use code samples from the following sections:
2. Compile and deploy the contract
-
Export your private key and the RPC URL as environmental variables:
- Local node
- Chiado
export PRIVATE_KEY=my-private-key
export RPC_URL=http://127.0.0.1:8545export PRIVATE_KEY=my-private-key
export RPC_URL=https://evm.chiado.wardenprotocol.orgwarningIn production, never store private keys directly in environment variables. Consider using encrypted keystores or secure key management solutions like
.env
. -
Compile your contract using Foundry:
forge build
-
Deploy the contract:
forge create --rpc-url $RPC_URL --private-key $PRIVATE_KEY src/Warden.sol:WardenContract
-
Export your contract address returned in
Deployed to
:export CONTRACT_ADDRESS=my-contract-address
-
Verify the deployment:
cast code $CONTRACT_ADDRESS --rpc-url $RPC_URL
Next steps
- To dive deeper and find code samples for each function from Warden precompiles, see the following guides:
- Interact with x/warden
- Other modules: coming soon.
- For an overview of the functions, refer to the Precompiles section.