
TL;DR:
Pesto introduces an innovative way to engage in spread short positions, allowing users to simultaneously short one asset and long another. This strategy leverages the liquidity of Aave and Uniswap to execute both actions in one streamlined process, offering a unique opportunity for traders looking to capitalize on the differential movements of two assets.
In the volatile world of DeFi, having the right tools can significantly impact your trading success. The spread short position stands out as a sophisticated strategy for traders who seek to profit from the relative performance of two different assets. Pesto, with its minimalist approach, simplifies this complex strategy, making it accessible to a wider audience. Here’s how you can utilize Pesto for a spread short position, taking advantage of market trends without getting bogged down in complexity.
Spread shorting is a versatile strategy in the DeFi space, going beyond traditional pair trading to include various sophisticated applications. For example:
Pair Trading: The most straightforward use of spread shorts, where you might long Ethereum (ETH) while shorting Bitcoin (BTC), betting on ETH outperforming BTC.
Volatility Plays: This strategy involves capitalizing on expected differences in volatility between two crypto assets. If you predict that one token will exhibit higher volatility relative to another, you might long the more volatile token and short the less volatile one, which can be particularly effective in derivatives markets where option prices are influenced by volatility.
Event-Driven Strategies: These strategies use spread shorts around specific events like protocol upgrades, hard forks, or regulatory announcements that might differently impact related assets within the crypto space.
Market Setup:
Current BTC Price: $70,000
Current ETH Price: $3,500
Your Move with Pesto: You believe BTC is overvalued and due for a correction, while ETH has growth potential.
Initiating the Spread Short:
Deposit: You put down $1,000 USDC as collateral.
LTV Utilization: With Aave's 80% LTV, you effectively have $800 to work with.
Action: You borrow 0.0114 WBTC (worth $800 at $70,000 per BTC) and simultaneously swap it for WETH on Uniswap through Pesto, getting approximately 0.2286 WETH.
Market Reaction: BTC experiences a significant drop to $60,000, while ETH climbs to $3,800.
Closing for Profit:
Buy Back BTC: Now cheaper, you spend $685.71 (at $60,000 per BTC) to buy back the 0.0114 BTC.
Profit Realization: The initial $800 worth of BTC swapped for ETH is now valued higher due to ETH's price increase. You're left with a profit of $182.57 (or about 18.2%), subtracting the cost to repurchase BTC and any fees.

Prerequisites:
Install and configure Foundry.
Set the required environment variables for interacting with the smart contracts on Arbitrum’s Sepolia network.
Environment Setup:
# Addresses below for Arbitrum Sepolia
export POSITION_FACTORY=0x86Dc69F370C899Ba63dFfE55ACA0662F28Ed1033
export USDC=0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d
export WETH=0x1dF462e2712496373A347f8ad10802a5E95f053D
export WBTC=0x3ba8429a2a30685820f07fc40dff3d2b17488f85
export CLIENT=0x0000000000000000000000000000000000000000
export AAVE_POOL=0xBfC91D59fdAA134A4ED45f7B584cAf96D7792Eff
export AAVE_ORACLE=0x0153002d20B96532C639313c2d54c3dA09109309
export LTV=70
export UNI_POOL_FEE=500
export RPC=<YOUR_ARBITRUM_SEPOLIA_RPC_URL>
export PK=<YOUR_PRIVATE_KEY>
Step 1: Create a Position Contract
This step involves deploying a Position contract using the PositionFactory. The contract uses USDC as the collateral, WBTC as the debt token, and WETH as the base token.
cast send $POSITION_FACTORY "createPosition(address,address,address)(address)" $USDC $WBTC $WETH --rpc-url $RPC --private-key $PK
Step 2: Retrieve the Position Contract Address
Fetch the newly created Position contract’s address.
cast call $POSITION_FACTORY "getPositions(address)(address[])" $ACCOUNT --rpc-url $RPC
export POSITION=<YOUR_POSITION_CONTRACTS>
Step 3: Approve USDC Spend
Approve the Position contract to spend your USDC.
Note that the USDC contract on Arbitrum Sepolia has 6 decimal places, so $1000 is represented as 1000000000.
cast send $USDC "approve(address,uint256)" $POSITION 1000000000 --rpc-url $RPC --private-key $PK
Step 4: Add Collateral
Add $1,000 USDC as collateral to the Position. This step will initiate the borrowing of WBTC based on an 80% Loan-to-Value (LTV) ratio.
cast send $POSITION "add(uint256,uint256,uint256,uint24,address)" 1000000000 $LTV 0 $UNI_POOL_FEE $CLIENT --rpc-url $RPC --private-key $PK
Step 5: Add Leverage
Calculate the maximum amount of WBTC that can be borrowed and then add leverage to the position by borrowing additional WBTC and swapping it for more USDC.
# Calculate the maximum WETH borrow amount
cast call $AAVE_POOL "getUserAccountData(address)(uint256,uint256,uint256,uint256,uint256,uint256)" $POSITION --rpc-url $RPC cast call $AAVE_ORACLE "getAssetPrice(address)" $WBTC --rpc-url $RPC
# Replace maxBorrowAmt with the calculated value from the above commands
cast send $POSITION "addLeverage(uint256,uint256,uint24,address)" maxBorrowAmt 0 $UNI_POOL_FEE $CLIENT --rpc-url $RPC --private-key $PK
Step 6: Closing the Position
When ready to close the position, reduce the position to sell the held assets and repay the borrowed amount.
cast send $POSITION "reduce(uint24,bool,uint256,uint256,uint256)" $UNI_POOL_FEE true 0 1000000000 0 --rpc-url $RPC --private-key $PK
Pesto transforms what traditionally requires multiple complex steps into a straightforward, efficient process. This not only saves on transaction fees but also makes executing sophisticated strategies like spread shorts more accessible to a wider audience.
Lower Gas Fees: With 25% lower gas fees compared to similar platforms, Pesto ensures that more of your money goes into your trading strategy, not costs.
Simplified Transactions: Borrowing from Aave and swapping on Uniswap is automated into one smooth step, saving you time and hassle.
Optimized for Lower Risk: Pesto’s approach allows for safer leverage with better liquidation protections, thanks to its strategic use of Aave.
With Pesto, traders can efficiently navigate the complexities of spread short strategies, capitalizing on market movements between BTC and ETH with reduced risk and increased potential for profit. Pesto’s integration of DeFi tools and streamlined processes opens up new possibilities for both novice and experienced traders alike.
Leverage Pesto to enhance your trading strategy. For more insights and updates:
Website: https://pesto.finance/
Documentation: https://docs.pesto.finance/
Telegram: https://t.me/pestofinance

