n8n-nodes-frax
v1.0.0
Published
n8n community node for Frax Finance ecosystem - FRAX stablecoin, frxETH liquid staking, Fraxlend, FraxFerry bridge, Fraxswap DEX, and more
Maintainers
Readme
n8n-nodes-frax
[Velocity BPA Licensing Notice]
This n8n node is licensed under the Business Source License 1.1 (BSL 1.1).
Use of this node by for-profit organizations in production environments requires a commercial license from Velocity BPA.
For licensing information, visit https://velobpa.com/licensing or contact [email protected].
A comprehensive n8n community node package for the Frax Finance ecosystem. Interact with FRAX stablecoin, frxETH liquid staking, Fraxlend lending markets, FraxFerry bridge, Fraxswap DEX with TWAMM, and more.
Features
Supported Tokens & Products
| Product | Description | |---------|-------------| | FRAX | Algorithmic stablecoin (v2) | | frxUSD | Fully-backed stablecoin (v3) | | sFRAX | Staked FRAX (ERC-4626 vault) | | sfrxUSD | Staked frxUSD | | FXS | Frax Share governance token | | veFXS | Vote-escrowed FXS for governance | | frxETH | Liquid staking ETH derivative | | sfrxETH | Staked frxETH (ERC-4626 vault) |
Supported Protocols
| Protocol | Description | |----------|-------------| | Fraxlend | Isolated lending markets | | Fraxswap | DEX with TWAMM (Time-Weighted AMM) | | FraxFerry | Native cross-chain bridge | | Gauges | Liquidity mining rewards | | AMOs | Algorithmic Market Operations | | Governance | Protocol governance and voting |
Supported Networks
- Ethereum Mainnet
- Fraxtal (Frax L2)
- Arbitrum One
- Optimism
- Polygon
- Base
- BNB Chain
- Avalanche
Installation
From npm (recommended)
cd ~/.n8n
npm install n8n-nodes-fraxManual Installation
- Download the latest release
- Extract to
~/.n8n/nodes/ - Restart n8n
From Source
git clone https://github.com/Velocity-BPA/n8n-nodes-frax.git
cd n8n-nodes-frax
pnpm install
pnpm buildCredentials Setup
Frax Network Credentials
| Field | Description | |-------|-------------| | Network | Select blockchain network | | RPC URL | Custom RPC endpoint (optional) | | Private Key | For signing transactions (optional for read-only) | | Chain ID | Auto-populated, override for custom networks |
Frax API Credentials
| Field | Description | |-------|-------------| | API Endpoint | Frax API URL | | API Key | Authentication key (if required) | | Subgraph URL | GraphQL subgraph endpoint |
Operations Reference
FRAX Operations
| Operation | Description | |-----------|-------------| | Get Balance | Get FRAX balance for address | | Transfer | Send FRAX to another address | | Approve | Approve spending allowance | | Get Allowance | Check spending allowance | | Get Total Supply | Total FRAX in circulation | | Get Price | Current FRAX price |
sFRAX Operations (Staking)
| Operation | Description | |-----------|-------------| | Stake FRAX | Deposit FRAX to mint sFRAX | | Unstake | Redeem sFRAX for FRAX | | Get Exchange Rate | sFRAX to FRAX conversion rate | | Get APY | Current staking yield | | Preview Deposit | Simulate deposit outcome |
veFXS Operations (Governance)
| Operation | Description | |-----------|-------------| | Lock FXS | Create veFXS position | | Increase Lock | Add more FXS to existing lock | | Extend Lock | Increase lock duration | | Get Voting Power | Calculate governance voting power | | Withdraw | Claim expired lock |
Fraxlend Operations (Lending)
| Operation | Description | |-----------|-------------| | Get Markets | List available lending markets | | Deposit Collateral | Add collateral to position | | Borrow | Borrow FRAX against collateral | | Repay | Repay borrowed FRAX | | Get Health Factor | Position liquidation risk |
Fraxswap Operations (DEX)
| Operation | Description | |-----------|-------------| | Get Swap Quote | Estimate swap output | | Execute Swap | Perform token swap | | Create TWAMM Order | Long-term swap order | | Cancel TWAMM | Cancel pending order | | Add Liquidity | Provide LP tokens |
FraxFerry Operations (Bridge)
| Operation | Description | |-----------|-------------| | Get Routes | Available bridge routes | | Initiate Bridge | Start cross-chain transfer | | Get Bridge Status | Check transfer progress | | Estimate Time | Expected transfer duration |
Usage Examples
Stake FRAX for Yield
1. Add "Frax" node to workflow
2. Select resource: "sFRAX"
3. Select operation: "Stake FRAX"
4. Enter amount to stake
5. Execute workflowMonitor Large Transfers
1. Add "Frax Trigger" node
2. Select event: "FRAX Transfer"
3. Set minimum amount: 10000
4. Connect to notification/alert workflowCheck Lending Position Health
1. Add "Frax" node
2. Select resource: "Fraxlend"
3. Select operation: "Get Health Factor"
4. Enter market address
5. Execute to check liquidation riskExecute TWAMM Order
1. Add "Frax" node
2. Select resource: "Fraxswap"
3. Select operation: "Create TWAMM Order"
4. Enter pool address, token, amount
5. Select duration (1 hour to 7 days)
6. Execute to create long-term orderBridge FRAX Cross-Chain
1. Add "Frax" node
2. Select resource: "FraxFerry"
3. Select operation: "Initiate Bridge"
4. Enter amount and optional recipient
5. Execute to start bridge transferTrigger Events
The Frax Trigger node monitors real-time blockchain events:
| Event | Description | |-------|-------------| | FRAX Transfer | Any FRAX token transfer | | FXS Transfer | Any FXS token transfer | | frxETH Transfer | Any frxETH transfer | | sFRAX Deposit | New sFRAX stake | | sFRAX Withdraw | sFRAX redemption | | sfrxETH Deposit | New sfrxETH stake | | sfrxETH Withdraw | sfrxETH redemption | | veFXS Lock | New FXS lock created | | veFXS Withdraw | veFXS position withdrawn |
Trigger Filters
- Filter Address: Only trigger for events involving specific address
- Minimum Amount: Only trigger for amounts above threshold
Technical Details
DeFi Concepts
ERC-4626 Vaults: sFRAX and sfrxETH are tokenized vaults that automatically compound yield. The exchange rate increases over time as yield accrues.
veFXS Mechanics: Lock FXS for 1 week to 4 years. Longer locks = more voting power. veFXS decays linearly to zero at unlock time.
TWAMM Orders: Split large swaps into smaller chunks executed over time, reducing price impact and MEV exposure.
Health Factor: Ratio of collateral value to debt. Below 1.0 means liquidation risk. Monitor positions and maintain healthy ratios.
Security Best Practices
- Never share private keys
- Use dedicated wallets for automation
- Set appropriate gas limits
- Monitor health factors on lending positions
- Use test networks before mainnet
- Verify contract addresses
Development
Prerequisites
- Node.js >= 18.10
- pnpm >= 9.1
Build from Source
git clone https://github.com/Velocity-BPA/n8n-nodes-frax.git
cd n8n-nodes-frax
pnpm install
pnpm buildRun Tests
pnpm testRun with Coverage
pnpm test:coverageLint Code
pnpm lint
pnpm lintfixProject Structure
n8n-nodes-frax/
├── credentials/ # Credential definitions
│ ├── FraxNetwork.credentials.ts
│ ├── FraxApi.credentials.ts
│ └── Fraxlend.credentials.ts
├── nodes/
│ └── Frax/
│ ├── Frax.node.ts # Main action node
│ ├── FraxTrigger.node.ts # Event trigger node
│ ├── actions/ # Operation handlers
│ ├── transport/ # Blockchain clients
│ ├── constants/ # Contract addresses, configs
│ └── utils/ # Helper functions
├── test/ # Test files
├── package.json
└── README.mdTroubleshooting
Common Issues
"Contract not available on network"
- Some contracts are only deployed on certain networks
- Check supported networks for the operation
"Private key not configured"
- Write operations require a private key
- Add private key to Frax Network credentials
"Insufficient balance"
- Check token balance before transactions
- Ensure enough native token for gas
"Health factor too low"
- Add collateral or repay debt
- Monitor positions regularly
Getting Help
Licensing
This n8n community node is licensed under the Business Source License 1.1.
Free Use
Permitted for personal, educational, research, and internal business use.
Commercial Use
Use of this node within any SaaS, PaaS, hosted platform, managed service, or paid automation offering requires a commercial license.
For licensing inquiries: [email protected]
See LICENSE, COMMERCIAL_LICENSE.md, and LICENSING_FAQ.md for details.
Author
Velocity BPA
- Website: velobpa.com
- GitHub: Velocity-BPA
Changelog
v1.0.0
- Initial release
- Full Frax ecosystem support
- 16 resource types with 100+ operations
- Real-time event triggers
- Multi-network support
