NOTE - To submit solution to this bounty, comment your submissions in this bounty issue within the deadline. This bounty expires on 30th November 00:00 CET. Any submissions after expiration period will not be considered. First submission that satisfies all criteria after consulting with Ocean Bounty team will be declared winner. Only one winner will be chosen.
TL;DR
Write a simple solidity smart contract that allows users to lock their Liquidity Pool Tokens (ERC20) into this smart contract and then withdraw based on the unlock schedule (timelock feature)
Questions & Reviews
You can reach out to me for any queries via email to ecosystem@oceanprotocol.com or post your questions in our discord channel - Ocean Protocol's Discord
Introduction
Datatokens are the interface to connect data assets with blockchain and DeFi tools. Crypto wallets become data wallets, crypto exchanges become data marketplaces, DAOs for data co-ops, and more via DeFi composability. It’s “data legos”.
These datatokens (ERC20) are then pooled into Balancer based AMM pools called datatoken pools and paired with OCEAN tokens. Users can add and remove liquidity. Whenever liquidity is added into these pools, pools mints LPT(Liquidity Pool Tokens) which are basically pool shares representing one's added liquidity in the pool and these pool shares are then used to redeem/remove liquidity from the pool by the holder of the pool shares.
Why this contract?
Note - The terms "LPTs" and "Pool Shares" have same meaning in our context.
Note - The terms "Pledge" and "Lockup" have same meaning in our context.
Datatoken Pool Owners (aka data providers) holds 100 Pool shares whenever they create datatoken pools. OCEAN community then adds liquidity into those pools and this occurence makes this pools a honeypot which a malicious pool owner can exploit by removing all of their liquidity simultaneously (aka rugpull). So, to protect community from such incidents and to build their trust, data providers will use this smart contract to willingly lock-up their pool shares. And hence prove themselves to be good actors of the data market. These pool shares can then be unlocked based on the "cool-off" and "unlock percentage" set into the contract at the time of lockup.
Contract Specifications
Globals - cool-off period, percentage shares to unlock, maybe struct to register pledges info
(cool-off period and percentage shares should be configurable by contract owner)
Function - lockup pool shares
(args - datatoken pool address, pool owner address, amount of pool shares)
(This function should transfer given pool shares amount to this smart contract. assumed that this smart contract has allowance to spend LPTs of given amount and maintain the balances of this LPTs)
Function - withdraw pool shares
(Allows to withdraw only unlocked % of pool shares based on cool-off period and percent to unlock)
Function - get Pledged balance (currently locked up Pool Shares) of a given account
Example
Lets take following configs -
datatoken Pool - etherscan link
pool owner - etherscan link
cool-off period - 1 week
percent unlock - 1%
Let's suppose pool owner decides to lockup/pledge their 100 pool shares in this contract, then -
1) every week pool owners can withdraw 1% of the total pool shares pledged meaning after first week they can remove only 1 pool share
2) If they don't remove it their unlocked pool shares balance keeps increasing. Meaning if pool owner decides to withdraw pool shares after 4 weeks, they can unlock 4 pool shares and so on.
Datatokens Pool Pledge
This bounty is not active anymore
NOTE - To submit solution to this bounty, comment your submissions in this bounty issue within the deadline. This bounty expires on 30th November 00:00 CET. Any submissions after expiration period will not be considered. First submission that satisfies all criteria after consulting with Ocean Bounty team will be declared winner. Only one winner will be chosen.
TL;DR
Write a simple solidity smart contract that allows users to lock their Liquidity Pool Tokens (ERC20) into this smart contract and then withdraw based on the unlock schedule (timelock feature)
Questions & Reviews
You can reach out to me for any queries via email to ecosystem@oceanprotocol.com or post your questions in our discord channel - Ocean Protocol's Discord
Introduction
Datatokens are the interface to connect data assets with blockchain and DeFi tools. Crypto wallets become data wallets, crypto exchanges become data marketplaces, DAOs for data co-ops, and more via DeFi composability. It’s “data legos”. These datatokens (ERC20) are then pooled into Balancer based AMM pools called datatoken pools and paired with OCEAN tokens. Users can add and remove liquidity. Whenever liquidity is added into these pools, pools mints LPT(Liquidity Pool Tokens) which are basically pool shares representing one's added liquidity in the pool and these pool shares are then used to redeem/remove liquidity from the pool by the holder of the pool shares.
Why this contract?
Datatoken Pool Owners (aka data providers) holds 100 Pool shares whenever they create datatoken pools. OCEAN community then adds liquidity into those pools and this occurence makes this pools a honeypot which a malicious pool owner can exploit by removing all of their liquidity simultaneously (aka rugpull). So, to protect community from such incidents and to build their trust, data providers will use this smart contract to willingly lock-up their pool shares. And hence prove themselves to be good actors of the data market. These pool shares can then be unlocked based on the "cool-off" and "unlock percentage" set into the contract at the time of lockup.
Contract Specifications
Globals - cool-off period, percentage shares to unlock, maybe struct to register pledges info (cool-off period and percentage shares should be configurable by contract owner)
Function - lockup pool shares (args - datatoken pool address, pool owner address, amount of pool shares) (This function should transfer given pool shares amount to this smart contract. assumed that this smart contract has allowance to spend LPTs of given amount and maintain the balances of this LPTs)
Function - withdraw pool shares (Allows to withdraw only unlocked % of pool shares based on cool-off period and percent to unlock)
Function - get Pledged balance (currently locked up Pool Shares) of a given account
Example
Lets take following configs - datatoken Pool - etherscan link pool owner - etherscan link cool-off period - 1 week percent unlock - 1%
Let's suppose pool owner decides to lockup/pledge their 100 pool shares in this contract, then - 1) every week pool owners can withdraw 1% of the total pool shares pledged meaning after first week they can remove only 1 pool share 2) If they don't remove it their unlocked pool shares balance keeps increasing. Meaning if pool owner decides to withdraw pool shares after 4 weeks, they can unlock 4 pool shares and so on.
Resources for Developers