ChainHackers presents ProfitPals, our ETHOnline2023 entry, pioneering the concept of social liquidity mining in DeFi.
- ChainHackers:Â https://chainhackers.xyz/
- ProfitPals:Â https://profitpals.chainhackers.xyz/
ProfitPals is a DeFi solution facilitating optimized yield farming through its fund pools. Managed by DeFi mavens, these pools work with AMMs (automated market makers) to generate returns. By using a predetermined anchor currency, investors can join any fund pool, mint share tokens representing their stake, and benefit from the accumulated yield. The pools are securely managed by operators, ensuring only interactions with approved tokens, with their compensation directly tied to the success of the investors.
- Fund Pools: Curated reservoirs managed by operators, where investors deposit the anchor currency.
- Share Tokens: Represents the investor's stake in the fund pool. Their quantity is dependent on the amount of anchor currency provided and the pool's overall value.
- Yield: Income generated from AMMs, which can be reinvested or withdrawn by investors.
- Approved Token List: A secure list of tokens that the operator can interact with, ensuring safety and consistency.
- Operator Reward: Fixed percentage of yield as compensation for the pool management.
- Deposit Pause: Safety measure to halt new deposits while allowing yield withdrawals and investor share redemptions.
- Fund Pool: A communal pool of funds managed by a single operator. Investors provide an anchor currency and receive share tokens in return.
- Investors' Share: Represents the stake an investor has in the fund pool, via their share tokens.
- Yield: Accumulated income generated from AMM fees.
- Anchor Currency: The designated currency used by investors to deposit into the fund pool.
- Operator Reward Rate: Fixed percentage of yield operators earn for managing a fund pool.
- Approved Token List: Preset list of tokens the operator can interact with, preventing volatile or unreliable tokens from being used.
- Deposit Pause: A mechanism to temporarily halt new deposits while still enabling withdrawals.
Operators can:
- Swap: Exchange tokens within the pool for other tokens from the Approved Token List.
- Liquidity Position Creation: Use tokens to establish a liquidity position in an AMM, bringing it under the fund pool's management.
- Position Increase: Allocate more tokens to an existing AMM position.
- Position Decrease/Close: Reduce or terminate an AMM position, returning the tokens and any earned fees to the fund pool.
Investors can:
- Deposit: Add the anchor currency into any available fund pool and receive share tokens representing their stake.
- Withdraw: Redeem their share tokens anytime to get back their portion of the anchor currency along with any accumulated yield.
- Review Fund Performance: Access information of the fund pool they're invested in.
All interactions with the funds within the fund pool are managed through the primary contract, the FundPool. This ensures:
- Predictability: All actions adhere to the protocol's rules.
- No Direct Control: Operators or investors can't directly access the pool's assets.
- Share Token Mechanism: Investors redeem their funds by burning their share tokens.
- Transparency and Traceability: Every action can be audited.
ProfitPals is designed to address risks in the DeFi space:
- Asset Volatility: Uses a carefully curated token whitelist.
- Operational Dormancy: If operators become inactive, investors can always withdraw without requiring operator confirmation.
- Over-liquidity: "Deposit Pause" ensures liquidity remains manageable.
- Factory Contract: The initiation process starts when an operator wishes to create a new investment pool. ProfitPals uses a specialized "factory" contract for this purpose, which automatically sets up a new pool contract.
- Safe Connection: Once the pool contract is established, the operator connects to it using Safe Wallet. This mechanism ensures secure management and operation of the pool.
- Safety Mechanisms: Concurrently, a corresponding smart account is set up (Guard), which is equipped with filters and validations. These safety mechanisms ensure that the pool's operations remain legitimate and are processed appropriately.
- Investors express their interest by investing assets in an anchor currency into the pool contract.
- As a token of acknowledgment for their contribution, the system mints and provides shares to the investors. These shares represent the investor's stake in the pool and entitle them to a proportionate share of any profits or losses.
- Token Swapping: Upon successful accumulation of the anchor currency tokens within the pool, the operator gains the ability to interact with decentralized exchanges like Uniswap. The operator can connect the pool contract to Uniswap by Safe Wallet, facilitating the swapping of tokens and establishing new currency pairs. This capability allows the operator to adapt the asset mix according to prevailing market conditions.
- Liquidity Provision: Additionally, the operator can contribute assets from the pool as liquidity on platforms like Uniswap. This not only earns fees from liquidity provision but may also offer other beneficial trading opportunities.
The smart account connected with the pool keeps track of all yield-generating activities. As assets within the pool are traded and interact with DeFi platforms, profits (or losses) are captured and accumulated in real-time.
When the time is right, investors can redeem their shares. The system facilitates this by burning the corresponding shares and releasing the assets, adjusted for any profits or losses earned during the period of investment.
For viewing pool details and profits. Investors can also deposit or withdraw funds.
- Operator's Pool Page
- Investor's Pool Page
- My Pools
- My Investments
- Available Pools
Our ETHOnline2023 focus: integration with Uniswap and harnessing Safe smart wallets for the Fund Pool foundation.
Implemented Features:
- An interface for operators to create pools.
- A "Factory" contract designed to create pool contracts. It includes a "Guard" mechanism to impose restrictions on operator activities within the pool.
- The capability to use the pool contract as a wallet on the Uniswap service via Safe Wallet.
During our Proof of Concept (POC) for the hackathon, we've established specific constraints for users:
User Limitations:
- Single Active Position: Only one Uniswap position can be open at any time. Prior to initiating a new position, the previous one must be cleared.
- Liquidity Pair Requirement: Any liquidity position opened must include the anchor currency as one of the pair members.
- Anchor Currency Operations: Activities are detected by monitoring changes in the anchor currency's balance. Valid operations include swaps involving the anchor currency, liquidity pool actions, and minting new Uniswap positions.
- Pools do not operate with a native token. #
- Utilizes the Polygon network. #
Underlying Reasons:
- No Transaction Data Decoding: We can't decode the intricacies of transaction data from Safe UI and the Uniswap Universal router. Instead, our approach is anchored on observing state changes within the contract.
- No Token Iteration: Our system isn't set up to detect all operations involving each token without iterating through token balances.
These constraints are intrinsic to the hackathon POC but are areas we aim to enhance in subsequent iterations.
Monorepo setup: smart contracts in root, frontend in its folder. We integrate Foundry/Forge with GitHub Actions for streamlined CI/CD.
Feedback and pull requests are welcome. Kindly adhere to contribution guidelines.
MIT License.
Thanks to the ETHOnline2023 community for the support!
Unearth the potential of social liquidity mining with ProfitPals!