Skip to content

ironblocks/ethena-smart-contracts

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🛡️ Ethena + Venn Firewall Integration Demo

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.

🚀 Quick Start

  1. Clone this repository
  2. Install dependencies:
    cd contracts
    forge install
  3. Install node dependencies:
    cd contracts/venn-scripts
    npm install
  4. Set up your environment variables (see Environment Setup)
  5. Follow the deployment and execution flow below

🔄 Deployment and Execution Flow

1. Deploy Contracts

forge script script/Deploy.s.sol --rpc-url $RPC_URL --broadcast

This deploys the Ethena contracts to the network.

2. Set up Venn CLI and Environment

# 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)

3. Enable Venn Policy

venn enable --network holesky

Add the generated policy address to your venn.config.json under the "ApprovedCalls" field.

6. Mint USDe

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

7. Redeem USDe

node contracts/venn-scripts/redeem.js

Executes the redemption flow:

  • USDe approval for redemption
  • Redemption process through Venn Firewall
  • WETH unwrapping to ETH

🔍 Scope

This demo focuses on the following Ethena protocol operations:

  • USDe minting process
  • Token approvals
  • USDe redemption flow

📁 Modified Files with Venn Integration

The following files have been customized to incorporate Venn Firewall:

  • contracts/contracts/EthenaMinting.sol
  • contracts/contracts/USDe.sol

🔗 Example Transactions (Holesky Testnet)

View example transactions of the integration in action on Holesky testnet:

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.

⚙️ Environment Setup

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

🔐 Venn Configuration

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
  }
}

📚 Resources

⚠️ Important Notes

  • 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

📧 Contact

For any questions or support, reach out to our integrator on telegram - @x0b501e7e

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Solidity 99.4%
  • Other 0.6%