AutoReplacer
♻️ AutoReplacer.sol
AutoReplacer.sol
The AutoReplacer
contract allows liquidity providers (LPs) to automatically replace their existing LP positions (ERC721 tokens) with new ones — without manual intervention.
This automation ensures yield continuity and reduces the need for active LP management, making liquidity provision easier and more efficient for passive users.
🧩 What It Does
Accepts LP NFTs (representing deposited liquidity at a strike)
Issues a new AutoReplace NFT in return
Tracks metadata about the original LP position
Enables auto-replacement logic through protocol integrations
The system interacts with:
Main.sol
(for market indexing)MarketPool.sol
(to identify and manage LP tokens)ERC721_AutoReplace
(for minting new NFTs)
🔧 Public Functions
startAutoReplace(uint256 index, uint256 id)
startAutoReplace(uint256 index, uint256 id)
Begins the auto-replacement process for a specific LP NFT
Transfers the original NFT to
AutoReplacer
Mints a new AutoReplace NFT to the caller
Stores metadata about the original position for future use
Requirements:
The caller must be the owner of the LP NFT
The NFT is transferred to the contract for custody
👀 View Functions
getERC721_AutoReplace() → address
getERC721_AutoReplace() → address
Returns the address of the deployed
ERC721_AutoReplace
contract
getAutoReplaceInfos(uint256 replacerID) → AutoReplaceInfos
getAutoReplaceInfos(uint256 replacerID) → AutoReplaceInfos
Returns metadata associated with a given AutoReplace token
Includes:
Market index
Original LP token ID
Rewards (if any) accumulated
📦 Struct: AutoReplaceInfos
AutoReplaceInfos
Each AutoReplace NFT is linked to the following data:
index
Market index (from Main.sol
)
id
Original LP NFT ID being replaced
rewards
Accumulated or claimable rewards (if tracked)
🔐 IERC721Receiver Support
This contract implements the IERC721Receiver
interface, allowing it to safely receive NFTs.
This is required when LP NFTs are transferred into AutoReplacer
as part of the replacement process.
📌 Summary
LP Automation
Automatically replaces LP NFTs with minimal interaction
Reward Tracking
Keeps metadata and rewards tied to original LP positions
NFT Custody
Holds LP NFTs until replaced or withdrawn
Passive Friendly
Perfect for yield farmers seeking automation
Last updated