TL;DR:

Maximize your earnings through Pesto by engaging in stable long positions on any token. Use leverage to increase your profit significantly more than HODLing can get you.

In the volatile landscape of DeFi, timing and strategy are key to capitalizing on asset appreciation. Pesto simplifies the process of going long, especially on assets like Ethereum (ETH), by offering an intuitive and efficient platform for executing long positions.

Example: Going Long on ETH with Pesto

  1. Market Insight: Current ETH Price: $3,500

  2. Strategic Move with Pesto: Anticipating ETH's rise, you decide to leverage its potential uptrend.

  3. Setting Up Your Long Position:

    1. Deposit: You start by depositing $1,000 USDC as collateral on Pesto.

    2. LTV Utilization: Thanks to Aave's 80% LTV, you're provided with $800 of borrowing power.

    3. Action: You borrow DAI equivalent to $800 and use Pesto to swap it for ETH, obtaining approximately 0.2286 WETH.

  4. Market Uptrend: ETH appreciates to $3,800, aligning with your market prediction.

Securing Your Gains:

  1. Asset Appreciation: The WETH you acquired is now worth approximately $868.28.

  2. Profit Realization: After repaying your borrowed amount plus fees, you're left with a net gain of $68.28 from ETH's price increase.

  3. Not only do you secure a realized profit of $68.28 from the trade, but you also continue to hold the ETH, which has appreciated in value, offering additional unrealized gains of $85.66. This equates to a total profit of $154 (or about 15.4%), minus gas fees and borrowing costs.

A Stable Long Position on ETH created using Pesto

Using Pesto via Foundry

Step 1: Setting up Environment Variables First, set up the required environment variables to interact with the Pesto smart contracts on the Arbitrum network (or your network of choice).

# Arbitrum Sepolia Addresses
export POSITION_FACTORY=0x86Dc69F370C899Ba63dFfE55ACA0662F28Ed1033
export WETH=0x1dF462e2712496373A347f8ad10802a5E95f053D
export DAI=0xc3826e277485c33f3d99c9e0cbbf8449513210ee
export CLIENT=0x0000000000000000000000000000000000000000
export AAVE_POOL=0xBfC91D59fdAA134A4ED45f7B584cAf96D7792Eff
export AAVE_ORACLE=0x0153002d20B96532C639313c2d54c3dA09109309
export LTV=80
export UNI_POOL_FEE=500
export RPC=<YOUR_ARBITRUM_RPC_URL>
export PK=<YOUR_PRIVATE_KEY>

Step 2: Create a Position Contract

Deploy a Position contract using the PositionFactory, specifying WETH as the collateral token, DAI as the debt token, and WETH as the base token.

cast send $POSITION_FACTORY "createPosition(address,address,address)(address)" $WETH $DAI $WETH --rpc-url $RPC --private-key $PK

Step 3: Retrieve the Position Contract Address

Fetch the address of the newly created Position contract to interact with it.

cast call $POSITION_FACTORY "getPositions(address)(address[])" $ACCOUNT --rpc-url $RPC
export POSITION=<YOUR_POSITION_CONTRACT>

Step 4: Approve WETH Spend

Authorize the Position contract to use your WETH for collateral ($1000 = 0.2857 WETH assuming 1 ETH = $3500)

Note that the WETH contract on Arbitrum Sepolia has 18 decimal places, so 0.2875 WETH is represented as 285700000000000000.

cast send $WETH "approve(address,uint256)" $POSITION 285700000000000000 --rpc-url $RPC --private-key $PK  # Approve 0.2857 WETH for simplicity

Step 5: Add Collateral and Borrow

Deposit WETH as collateral and initiate the borrowing of DAI based on an 80% Loan-to-Value ratio.

cast send $POSITION "add(uint256,uint256,uint256,uint24,address)" 285700000000000000 $LTV 0 $UNI_POOL_FEE $CLIENT --rpc-url $RPC --private-key $PK  # Add 0.2857 WETH as collateral

Step 6: Add Leverage

Add leverage by borrowing additional DAI and converting it back into WETH, enhancing your long position.

# Example to add leverage, ensure maxBorrowAmt is calculated based on the available LTV and current market prices
# Calculate max borrowable DAI
cast call $AAVE_POOL "getUserAccountData(address)(uint256,uint256,uint256,uint256,uint256,uint256)" $POSITION --rpc-url $RPC
cast call $AAVE_ORACLE "getAssetPrice(address)" $DAI --rpc-url $RPC

# Assume maxBorrowAmt has been calculated and stored in a variable
cast send $POSITION "addLeverage(uint256,uint256,uint24,address)" maxBorrowAmt 0 $UNI_POOL_FEE $CLIENT --rpc-url $RPC --private-key $PK

Step 7: Closing the Position

When you decide to close the position, you’ll sell the held WETH and repay the borrowed DAI.

cast send $POSITION "reduce(uint24,bool,uint256,uint256,uint256)" $UNI_POOL_FEE true 0 285700000000000000 0 --rpc-url $RPC --private-key $PK

Pesto vs. Traditional Holding:

Direct holding of ETH bought with an initial $1,000 could yield an unrealized profit of $85.66 based on the price increase. However, Pesto’s strategy enhances this by adding a realized profit of $68.28 from the leveraged trade. Collectively, this approach not only matches but exceeds the potential gains from mere holding, illustrating Pesto’s efficiency and strategic advantage in maximizing investment outcomes.

Why Choose Pesto for Long Positions?

Pesto stands out by automating and optimizing the borrowing and swapping steps necessary for going long, directly translating into several key benefits:

  • Reduced Transaction Fees: Pesto’s efficiency cuts down on gas fees, ensuring your investment isn’t eaten up by costs.

  • Streamlined Process: By consolidating steps, Pesto makes it easy for traders to execute long strategies without the need for manual coordination between platforms.

  • Safer Leverage: Utilizing Aave’s 80% LTV means you can leverage your position with a lower risk of liquidation, particularly in volatile markets.

Pesto empowers traders to effortlessly take long positions on promising assets like ETH, leveraging periods of market growth with reduced risk and increased profit potential. Through its simplified, efficient platform, Pesto is unlocking new opportunities for traders looking to invest in the future of DeFi.

Connect with Pesto:

Embrace the future of trading with Pesto. Discover how our platform can revolutionize your investment strategy:

Mirror文章信息

Mirror原文:查看原文

作者地址:0xCd8Be5Bb93467Cf1C523d233E0DaD39c6cD5f60f

内容类型:application/json

应用名称:MirrorXYZ

内容摘要:xDJqkKGEfm9UeV5Oen8a5AUwc6Cci8pI7NwWenjzsZY

原始内容摘要:E3lVz9rwt9tW75LxGLHUDPmYxaiATaFNSzCgqwr1YyA

区块高度:1410323

发布时间:2024-04-23 22:00:47