project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4
project screenshot 5
project screenshot 6

1fx

Decentralized forex trading with up to 30x leveraging built with Aave and 1inch.

1fx

Created At

ETHGlobal Lisbon

Winner of

🏊 Polygon — Build on Polygon

🥇 1inch — Open Track

🥇 Aave Grants DAO — Best Use of Aave/GHO

Project Description

1fx is a cutting-edge protocol designed to empower traders with the ability to establish significantly leveraged positions within the Aave protocol. This is achieved by concentrating on token pairs that fall under the same eMode category.

The eMode category, which can be activated by a user, permits a higher collateral factor for asset arrangements that exhibit a high correlation. This feature provides traders the flexibility to maintain multiple leveraged positions simultaneously. Each position is meticulously isolated from the rest, ensuring the integrity of individual trades.

Every position is represented by a UUPS upgradeable abstract account. This account safeguards the balances in Aave on behalf of the user. Leveraging this architecture, users can open such a position seamlessly in a single transaction, streamlining their trading operations and enhancing efficiency.

How it's Made

1fx leverages four primary features to facilitate single-click margin positioning.

  1. Abstract Accounts with Create2: At the heart of 1fx is a factory contract that deploys unique entities known as slots, essentially abstract accounts that signify an individual leveraged position.

  2. eMode Activation: Following the deposit, the slot contract enables eMode, a feature that empowers users to hold high-leverage positions.

  3. Aave Flash Loans: These flash loans play a crucial role in promoting the cost-effective generation of leveraged positions

The system eliminates the need to cycle through borrow-swap-supply loops to establish the desired leverage. Here's how the process unfolds when opening a position with a 10 USDC deposit as collateral and USDT as debt - all within a single transaction:

(i) The factory creates an abstract account (the slot) using create2.

(ii) An initial collateral of 10 USDC is supplied to the slot.

(iii) The slot then flash loans the target collateral amount (in this case, for a 20x leverage on the initial deposit, it would be 190 USDC).

(iv) The slot supplies the acquired 190 USDC.

(v) With eMode enabled, the slot can borrow roughly 0.95 x 200 (=190) USDT.

(vi) This 190 USDT is then swapped for USDC to enable the repayment of the flash loan.

(vii) Consequently, the slot now maintains a 20x leveraged position in USDC/USDT on Aave on behalf of the user.

-> this sequence of interactions is showcased in the slot https://polygonscan.com/address/0xB5Cee144309B9e36e7bce1B5B07432f8F2f42224#code and its creation transaction (it uses 20x leverage on 1 USDC initial deposit).

  1. 1inch Router/API: This heavily optimized router utilizes the input from the 1inch API. The calldata from the API is transferred into the flash loan where the swap from the borrowed currency to the collateral currency, as described in step (vi), is executed.
background image mobile

Join the mailing list

Get the latest news and updates