Check out the Issue Explorer
Looking to fund some work? You can submit a new Funded Issue here.
# Server-side Implementation of Ocean Faucet for Trilobite Testnet
## How can you help?
We want to create a server side implementation that allows us to distribute Ocean tokens to be used in testnet to user accounts. The final solution should distribute a given number of testnet tokens to the user's account address after the user places a request for tokens.
## What needs to be done?
1. User sends HTTP GET request to server with Account Address in the request query .
2. The timestamp of last deposit of testnet tokens to address is checked. If tokens have been requested and deposited to the account in the last 24 hours, then message is returned stating ‘Sorry, we cannot deposit more tokens in your account for the next **hh:mm** (hours & minutes, the difference between current time of request and last deposited timestamp) since it has been done’.
3. If the timestamp of last deposit is greater than 24 hours, then this server transfers **10** Ocean Tokens to the given account. Timestamp of the deposit is also recorded (which is later used to check spamming token requests).
### Technical stack
- Express.js server (ES6)
- Mongodb database
### Request/Response Schema
The JSON endpoints from the server may include (but not limited to) a) Account address b) Request Agent c) Transfer is a success or failure.
Sample **Request Body**
"address": , //required
"agent": , //optional, Possible values - twitter, telegram, gitter
Sample **Response Body**
"success": true, // whether the tokens have been transferred successfully or not.
"message": (X tokens have been transferred to your account xxxxxxx.
Another example of a **response body** with outcome:false
not 500 (Expected Errors or non-positive flows)
"message": (Tokens were last transferred to this account 2hrs:26mins ago. The next transfer can be done in 21hrs:34mins.)
500 (Internal Server Error)
"message": (Oops! Something went wrong on our end. We will fix it asap.)
### You will need
- You can start setting up the [Ocean Trilobite testnet](https://blog.oceanprotocol.com/a-dive-into-the-ocean-testnet-98fdb43456ce) by looking at this tutorial.
- The two repos you will be dependent on for requesting ocean tokens are [Squid.js](https://github.com/oceanprotocol/squid-js) and [Keeper Contracts](https://github.com/oceanprotocol/keeper-contracts).
- The code for requesting tokens can be [found here](https://github.com/oceanprotocol/squid-js/blob/47f245bbed0cb1025a792112fcc4ec06df999e12/src/ocean/Account.ts#L37).
- Here are [some examples](https://github.com/oceanprotocol/tuna/blob/master/examples/squid/listAccounts.js) to get started with [Squid.js](https://github.com/oceanprotocol/squid-js)
## We are very happy when
[ ] Server is written using Express.js (v4.x.x)
[ ] All dependencies like testnet etc are up and running using npm command or docker compose. You can use our docker-images for each dependent component like keeper-contracts etc and use it here.
[ ] Proper validation for schemas are done for incoming requests.
[ ] Code is written in ES6.
[ ] Unit tests are written with Mocha with coverage > 80%.
> **Note**- The PR for this bounty submission should go in [ocean faucet repo](https://github.com/oceanprotocol/faucet/tree/master/server)
## Seen this problem before?
Any help solving this is welcome. Feel free to leave any comments and help someone else to solve it. We might airdrop tokens to someone even if not directly completing bounty.
## Questions & Reviews
Pull requests will be reviewed by one of the maintainers or long-term contributors. In case of any additional questions feel free to ask in this thread and we will do our best to add the missing info :)
## Things to know
The bounty lifecycle process including payout will be managed using [Gitcoin](https://gitcoin.co/explorer?network=mainnet&keywords=oceanprotocol&order_by=-web3_created).
We'll be responding to your questions here, but for discussion and clarification we recommend to join also our [Gitter channel](https://gitter.im/oceanprotocol/Lobby) where our tech community is accessible.
In order to see the PROCN balance in your wallet you'll need to reference the related token contract with address _0xf2aabdd898a0139195b2b5da7387d43a45ded254_. If you use a Metamask plugin you'll find the the exact steps [here](https://metamask.zendesk.com/hc/en-us/articles/360015489011-Managing-ERC20-Tokens).
Lastly, even if it is a contest bounty, we will reward all valuable contributions and efforts. We greatly appreciate the value our open source community brings to Ocean and will always award some tokens to all great contributions! :smiley:
Once the project was reviewed and merged in the master branch, you will receive the reward. PROCN is a proto-Ocean token. Bounty hunters that earn PROCN will be able to convert them 1:1 to Ocean tokens on network launch (currently Ocean Token is valued at 0.20 EUR). Network launch is expected to happen by Mar 31, 2019. Until then PROCN will be locked and non-transferrable in the ETH wallet to which it is delivered to.