This repository demonstrates the integration of Venn Firewall with Ethena protocol, focusing specifically on USDe minting and redemption flows. The implementation showcases how Venn's transaction firewall can be used to secure and monitor critical DeFi operations.
- Clone this repository
- Install dependencies:
cd contracts forge install
- Install node dependencies:
cd contracts/venn-scripts npm install
- Set up your environment variables (see Environment Setup)
- Follow the deployment and execution flow below
forge script script/Deploy.s.sol --rpc-url $RPC_URL --broadcast
This deploys the Ethena contracts to the network.
# Install Venn CLI globally
npm i -g @vennbuild/cli
Set up your environment variables and create venn.config.json (see Environment Setup) and (Venn Configuration)
venn enable --network holesky
Add the generated policy address to your venn.config.json under the "ApprovedCalls" field.
node contracts/venn-scripts/mint.js
Executes the minting flow:
- WETH wrapping from ETH
- WETH approval for Ethena staking contract
- USDe minting through Venn Firewall
node contracts/venn-scripts/redeem.js
Executes the redemption flow:
- USDe approval for redemption
- Redemption process through Venn Firewall
- WETH unwrapping to ETH
This demo focuses on the following Ethena protocol operations:
- USDe minting process
- Token approvals
- USDe redemption flow
The following files have been customized to incorporate Venn Firewall:
contracts/contracts/EthenaMinting.sol
contracts/contracts/USDe.sol
View example transactions of the integration in action on Holesky testnet:
- USDe Minting: 0xd672f06c9d518de1e918b0f138d8636f7fa74dc39c3617aa6e60f0903cfe8003
- USDe Redemption: 0x20ff955f7ffabf9123bb5667d183cf2f8fb0ab66eb0c16b27787bc6252b8fc56
These transactions are examples of successful minting and redemption flows. They are only possible if the necessary calls are approved and the transactions are sent through the Venn dApp SDK.
Create a .env
file in the contracts
directory with the following:
# Network
PRIVATE_KEY=your_private_key
USER_PRIVATE_KEY=your_user_private_key // for signing orders
RPC_URL=your_holesky_rpc_url
VENN_NODE_URL=venn_node_url
VENN_PRIVATE_KEY=your_venn_api_key // should be the same as deployer private key
ETHENA_MINTING_ADDRESS=ethena_minting_address
USDE_ADDRESS=usde_address
WETH_ADDRESS=weth_address
Create a venn.config.json
file containing firewall configurations for:
{
"networks": {
"holesky": {
"EthenaMinting": "...", // EthenaMinting contract address
"USDe": "..." // USDe contract address
},
"ApprovedCalls": "..." // address of the deployed policy
}
}
- This is a demonstration project - test thoroughly before production use
- Ensure proper environment variables are set
- Monitor Venn Firewall logs for security alerts
- All transactions are executed through Venn's secure infrastructure
For any questions or support, reach out to our integrator on telegram - @x0b501e7e