Bounty: PoolTogether Integration - 250 OP Reward
kamescg opened this issue Β· 2 comments
π¨βπ» User Story
As a Web3 protocol developer I want to easily integrate decentralized finance primitives into my application.
More specifically I want to utilize PoolTogether the prize savings network. Giving users the ability to easily deposit into a web3 savings network and automatically win prizes.
π Disclaimer
To be eligible for the payout you must first get approval to work on the bounty.
- Join the β‘οΈTurboETH Discord channel
- Introduce yourself in the
general
channel - Announce your interest in the
bounty
channel
It's recommended to share a link to your personal Github account when introducing yourself.
𧱠Project
Integrate the PoolTogether V4 protocol into the TurboETH.
The integration should include the ability to deposit and withdraw from the PoolTogether prize savings network on Ethereum, Optimism and Polygon.
Example of PrizePool and Ticket smart contracts deployed on Optimism:
- YieldSourcePrizePool - 0x79Bc8bD53244bC8a9C8c27509a2d573650A83373
- Ticket - 0x62BB4fc73094c83B5e952C2180B23fA7054954c4
PoolTogether users interact with the YieldSourcePrizePool
smart contract. Mainly calling the depositTo
, depositToAndDelegate
and withdraw
functions.
The Ticket
contract is the ERC20 token that "holds" the chance to win prizes. A ptUSDC
token is minted 1-to-1 when USDC
is deposited into the YieldSourcePrizePool
smart contract.
Required Functionality:
- WAGMI CLI configuration to auto-generate read,write and event hooks
- Deposit into PoolTogether V4
- Withdraw from PoolTogether V4
Developer Tasks:
- Add essential PoolTogether V4 smart contract artifacts
-
yield-source-prize-pool-abi.json
andyield-source-prize-pool-bytecode.json
-
ticket-abi.json
andticket-bytecode.json
-
- Create
wagmi.config.js
- Configure to use essential smart contract artifacts - Create Component -
form-yield-source-prize-pool-deposit.tsx
- Create Component -
form-yield-source-prize-pool-withdraw.tsx
- Create Contract List -
prize-pool-contract-list.ts
The Contract List should include the USDC prizes pool and ticket addresses.
https://dev.pooltogether.com/protocol/deployments/mainnet/
Template - PrizePool Contract Address List
{
1: '',
10: '0x79Bc8bD53244bC8a9C8c27509a2d573650A83373',
137: '',
}
Template - Ticket Contract Address List
{
1: '',
10: '0x62BB4fc73094c83B5e952C2180B23fA7054954c4',
137: '',
}
The contract lists can be passed into a hook like the one below to easily update the deposit
and withdraw
components with the right smart contract addresses.
import { useNetwork } from 'wagmi'
interface ContractChainList {
[key: number]: string
}
export const useLoadContractFromChainId = (list: ContractChainList) => {
const { chain } = useNetwork()
return list[chain?.id || 1] || undefined
}
# Example of Usage - USDC Tokens
const contractAddress = useLoadContractFromChainId({
1: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
4: '0x4f96fe3b7a6cf9725f59d353f723c1bdb64ca6aa',
137: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
})
Potential File Structure
Integration
The PoolTogether integration should be added to the integrations/pooltogether-v4
folder.
integrations/pooltogether-v4
ββ abis/
β ββ yield-source-prize-pool-abi.json
β ββ yield-source-prize-pool-bytecode.json
ββ components/
β ββ form-yield-source-prize-pool-deposit.tsx
β ββ form-yield-source-prize-pool-withdraw.tsx
ββ hooks/
β ββ **/*.ts
ββ utils/
β ββ **/*.ts
ββ prize-pool-contract-list.ts
ββ ticket-contract-list.ts
ββ pooltogether-v4-wagmi.ts
ββ wagmi.config.ts
ββ README.md```
Application
The application pages should be added to the app/pooltogether-v4
folder.
app/pooltogether-v4
ββ deposit
β ββ page.tsx
ββ withdraw
β ββ page.tsx
π° Bounty Reward
The bounty reward is 250 tokens and TurboETH DevPass digital collectible.
TurboETH is the recipient of 18,271.88 OP Tokens from Optimism Retroactive Public Goods Funding. The OP tokens earned from the PGF program are the primary funding source for TurboETH bounties.
Notice
The final integration may not resemble the proposed integration - that's O.K - a natural part of software development.
During development you might discover an original hypothesis doesn't make sense. No problem. Make a comment and clearly explain why a new approach is better than old one. Get rewarded for thinking out of the box.
The final bounty reward can be increased to match new bounty tasks.
Resources
- β‘οΈ TurboETH
- Documentation - http://docs.turboeth.xyz
- π PoolTogether
- Documentation - https://dev.pooltogether.com
- Application - https://app.pooltogether.com
Feel likes the perfect bounty ! I've been part of the PoolTogether for a year and a half, building tools and adding features to the current PoolTogether ecosystem. Also I was able to try TurboETH for a "PoolTogether Dashboard".
This bounty will help me to dig more in TurboETH as well as providing components for futur projects
I think it's a perfect fit too @MAlvarez-0. Thanks for hopping the Discord and sharing some of your background.
Consider the bounty yours π€