Changes to logging and README

This commit is contained in:
Andy Tudhope 2018-03-20 13:23:07 +02:00
parent 5c805dca5a
commit 1362bc33a3
3 changed files with 15 additions and 2557 deletions

View File

@ -1,10 +1,9 @@
/*
* Bot that receives a POST request (from a GitHub issue comment webhook)
* and in case it's a comment that has "@autobounty <decimal> <currency>"
* awards that bounty to the address posted earlier in the thread (by the
* commiteth bot).
* REVIEW parsing, non-persisting storage of addresses, hardcoded string length.
* Depends on commiteth version as of 2017-06-10.
* Bot that receives a POST request (from a GitHub issue comment webhook),
* finds the address of the bounty contract and funds it automatically
* with either ETH or any ERC20/223 token.
* REVIEW hardcoded string length.
* Depends on openbounty version as of 2018-03-20.
*/
const config = require('./config')
@ -90,5 +89,5 @@ async function processRequest (req) {
const port = process.env.PORT || 8181
app.listen(port, function () {
bot.info('Autobounty listening on port', port)
bot.info('Autobounty listening on port' + port)
})

2504
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,12 +3,12 @@
### Massive Thanks to the Amazing Aragon Team for starting this project! Original repo **[here](https://github.com/aragon/autobounty)**
#### Status Autobounty bot for OpenBounty
A Github bot that will automatically fund issues that are labelled with **[bounty](https://github.com/status-im/status-react/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3Abountyy)**.
A docker bot that will automatically fund issues that are labelled with **[bounty](https://github.com/status-im/status-react/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3Abountyy)**.
These bounties will use [Status OpenBounty](https://openbounty.status.im/) to incentivize community members to participate and contribute to the development of Open Source Software projects like Status, Riot and Aragon.
Open source is awesome, but it is also hard work that needs to be rewarded to ensure top quality work. It's also important that everyone in the world gets a fair chance to do it.
Open source is awesome, but it is challenging and needs to be rewarded to ensure top quality work. It's also important that everyone in the world gets a fair chance to do it.
#### 🦋 We at Status, Aragon and Riot are using [OpenBounty](https://openbounty.status.im/) to reward open source contributions outside our Core teams.
#### We at Status, Aragon and Riot are using [OpenBounty](https://openbounty.status.im/) to reward open source contributions outside our Core teams.
All issues tagged with **[bounty](https://github.com/status-im/status-react/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3Abounty)** are eligible for a bounty on a succesfully merged Pull Request that solves the issue. Currently bounties have to be funded one after the other and manually by a real human being. This bot's purpose in life is therefore to create and automate the process of funding issues so that contributors can be rewarded accordingly.
#### The process
@ -18,10 +18,10 @@ All issues tagged with **[bounty](https://github.com/status-im/status-react/issu
3. [Status OpenBounty](https://openbounty.status.im/) bot adds a bounty to the issue and it is displayed in the issue's comments
4. Webhook is triggered for issue comments.
5. Autobounty checks if the request needs funding (by default: if the user status-open-bounty posts a new comment). If it needs funding proceed to 6 otherwise do nothing.
6. Bot waits for X minutes (configurable parameter) to allow label corrections before proceeding.
6. Bot waits for X seconds (configurable parameter) to allow label corrections before proceeding.
7. Address to fund is obtained from status-open-bounty comment.
8. Amount to fund is computed as the hours of work corresponding to the given label times the configured price per hour divided by the token price obtained from etherscan.io (amount_of_work * price_per_hour / token_price).
9. The gas price for the transaction is retrieved from ethgasstation and the maximum gas used is a config param.
8. Amount to fund is computed as the hours of work corresponding to the given label multiplied by the configured price per hour, divided by the token price obtained from etherscan.io (amount_of_work * price_per_hour / token_price).
9. The gas price for the transaction is retrieved from ethgasstation and the minimun safeLow amount is used.
10. With all the information the bot funds the bounty from config param *sourceAddress*.
@ -31,47 +31,11 @@ All issues tagged with **[bounty](https://github.com/status-im/status-react/issu
Autobounty is build using docker. Before building the image, you need to set up a configuration as follows:
The [config]() folder contains the files for configuring the bot. The description for the variables can be found in *default.js*. Create a production config file (e.g. *production.js*) uing the {default,development}.js as template to override the default ones.
The config folder contains the files for configuring the bot. The description for the variables can be found in *default.js*. Simply input the missing information to override the default values in this file.
**Remeber** to set the environment variable *NODE_ENV* in the dockerfile (e.g. `ENV NODE_ENV production`) and *WEBHOOK_SECRET* to the value specified in the secret field during the webhook creation (e.g. for random creation *ruby -rsecurerandom -e 'puts SecureRandom.hex(20)'*).
**Remember** to set the *WEBHOOK_SECRET* to the value specified in the secret field during the webhook creation (e.g. for random creation *ruby -rsecurerandom -e 'puts SecureRandom.hex(20)'*).
)
```javascript
// Debug mode for testing the bot
debug: true,
// URL where the bot is listening (e.g. '/funding')
urlEndpoint: '',
// URL for the signer (e.g. 'https://ropsten.infura.io')
signerPath: '',
// Address with the funding for the bounties
sourceAddress: '',
// Token of the currency for fetching real time prices (e.g. 'SNT')
token: '',
// Limit for the gas used in a transaction (e.g. 92000)
gasLimit: 0,
// Price per hour you will pay in dolars (e.g. 35)
priceHour: 0,
// Delay before funding a bounty (e.g. 3600000)
delayInMiliSeconds: 0,
// Bounty Labels for the issues and the correspondent houres (e.g. {'bounty-xs': 3})
bountyLabels: {},
// username for the bot which has to comment for starting the process (e.g. status-bounty-)
githubUsername: '',
// Activate real transactions
realTransaction: false
```
##### Github Webhook
Create a github webhook with the following information:
@ -96,5 +60,4 @@ docker run -p 8080:8080 autobounty
* Bot always **aborts on error** and logs the cause of the error in the folder ./log. The aborted transaction must then be manually funded.
* **Only one token** can be specified on the configuration file variable *token*.
* Autobounty bot assumes that the status-open-bounty will only post a single message. In case two messages are posted the issue would be **funded two times**.
The ongoing requests are not recorded in any persistent data storage. If the machine crashes during a request processing the request will be lost.
* Ongoing requests are not recorded in any persistent data storage. If the machine crashes during a request processing the request will be lost.