Skip to content

Commit

Permalink
Merge branch 'master' into kogisin/108-improve-sim-tests
Browse files Browse the repository at this point in the history
* master: (22 commits)
  fix: use farmingPoolAcc and terminationAcc for consistency
  docs: add missing comments
  fix: last add_request_proposals
  docs: update renamed variables and remove mvp_legacy.md
  feat: rename public plan proposal requests
  feat: rename NewPublicPlanProposal to NewPublicPlanProposalHandler
  docs: update README.md
  fix: workflow target branch and description for main branch
  doc: fix to be broken links by renaming branch name
  move codeowners from contributing file to the CODEOWNERS file
  create CODEOWNERS file
  feat: generate proto files
  edit farming.proto
  docs: add os checking for sed -i option (tendermint#184)
  docs: specify which module is used for module name
  feat: bump budget to v0.1.1 (tendermint#177)
  docs: improve documentation for audit release (tendermint#178)
  fix: withdraw rewards only when staked amount changes (tendermint#180)
  fix: emit rewards_withdrawn only when positive amount is withdrawn
  docs: add helpful docs for audit (tendermint#176)
  ...

# Conflicts:
#	x/farming/simulation/proposals.go
  • Loading branch information
jaybxyz committed Oct 27, 2021
2 parents acf6f2f + dea1446 commit b954984
Show file tree
Hide file tree
Showing 54 changed files with 1,199 additions and 1,175 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
client/docs/swagger-ui/* linguist-vendored
*.ts linguist-generated
*.js linguist-generated
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ write a little note why.
- [ ] Code follows the [module structure standards](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules/structure.md).
- [ ] Wrote unit and integration
- [ ] Updated relevant documentation (`docs/`) or specification (`x/<module>/spec/`)
- [ ] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code).
- [ ] Added relevant `godoc` [comments](https://go.dev/blog/godoc).
- [ ] Re-reviewed `Files changed` in the Github PR explorer
- [ ] Review `Codecov Report` in the comment section below once CI passes
2 changes: 1 addition & 1 deletion .github/workflows/linkchecker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
pull_request:
push:
branches:
- master
- main
- develop
schedule:
- cron: '* */24 * * *'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Lint
# Lint runs golangci-lint over the entire cosmos-sdk repository
# This workflow is run on every pull request and push to master
# This workflow is run on every pull request and push to main
# The `golangci` will pass without running if no *.{go, mod, sum} files have been changed.
on:
pull_request:
push:
branches:
- master
- main
jobs:
golangci:
name: golangci-lint
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sims.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:
push:
branches:
- master
- main
- develop

jobs:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
name: Tests / Code Coverage
# Tests / Code Coverage workflow runs unit tests and uploads a code coverage report
# This workflow is run on pushes to master & every Pull Requests where a .go, .mod, .sum have been changed
# This workflow is run on pushes to main & every Pull Requests where a .go, .mod, .sum have been changed
on:
pull_request:
push:
branches:
- master
- main
jobs:
cleanup-runs:
runs-on: ubuntu-latest
steps:
- uses: rokroskar/workflow-run-cleanup-action@master
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master' && github.ref != 'refs/heads/develop'"
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop'"

build:
runs-on: ubuntu-latest
Expand Down
7 changes: 7 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# CODEOWNERS: https://help.github.com/articles/about-codeowners/

# Docs
*.md @barriebyron

# Primary repo maintainers
* @dongsam @kogisin @hallazzang
20 changes: 19 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# Contributing

TODO: add context
We welcome contributions to our codebase and documentation.

Before you create a PR on the farming module, make sure that you read and comply with this document. See the [open issues](https://github.com/tendermint/farming/issues) that we need help with.

Feel free to inform us if you are willing to work on an issue. Note that the `main` branch contains the latest development version.

We follow standard GitHub best practices:

- Fork the repository
- Make sure your `branch` is from the tip of `main` branch
- Make your commits to resolve an issue
- Submit a pull request to `main`

General guidance:

- Make sure you run tests by running `make test-all` locally to see there is any issue
- Review all the checks on your PR and review the code coverage report

Thank you for your contribution!
45 changes: 22 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,47 @@
[![codecov](https://codecov.io/gh/tendermint/farming/branch/master/graph/badge.svg)](https://codecov.io/gh/tendermint/farming?branch=master)
[![codecov](https://codecov.io/gh/tendermint/farming/branch/main/graph/badge.svg)](https://codecov.io/gh/tendermint/farming?branch=main)
[![PkgGoDev](https://pkg.go.dev/badge/github.com/tendermint/farming)](https://pkg.go.dev/github.com/tendermint/farming)

# Farming Module

A farming module is a Cosmos SDK module that implements farming functionality, which provides farming rewards to participants called farmers. One use case is to use this module to provide incentives for liquidity pool investors for their pool participation.
The farming module is a Cosmos SDK module that implements farming functionality, which provides farming rewards to participants called farmers. A primary use case is to use this module to provide incentives for liquidity pool investors for their pool participation.

**Farming module v1 is in active development - see "master" branch for the v1 mainnet version**
**Farming module v1 is in active development**
- see the [main](https://github.com/tendermint/farming/tree/main) branch for the latest
- see [releases](https://github.com/tendermint/farming/releases) for the latest release

## Installation
### Requirements
## Dependencies

If you haven't already, install Golang by following the [official docs](https://golang.org/doc/install). Make sure that your `GOPATH` and `GOBIN` environment variables are properly set up.

Requirement | Notes
----------- | -----------------
Go version | Go1.15 or higher
Cosmos SDK | v0.44.0 or higher
Go version | Go1.16 or higher
Cosmos SDK | v0.44.2 or higher

### Get Farming Module source code
## Installation

```bash
# Use git to clone farming module source code and install `farmingd`
git clone https://github.com/tendermint/farming.git
cd farming
make install
```

## Development
## Getting Started

### Test
To get started to the project, visit the [TECHNICAL-SETUP.md](./TECHNICAL-SETUP.md) docs.

```bash
make test-all
```
## Documentation

### Setup local testnet using script
The farming module documentation is available in [docs](./docs) folder and technical specification is available in [specs](https://github.com/tendermint/farming/blob/main/x/farming/spec/README.md) folder.

```bash
# This script bootstraps a single local testnet.
# Note that config, data, and keys are created in the ./data/localnet folder and
# RPC, GRPC, and REST ports are all open.
$ make localnet
```
These are some of the documents that help you to quickly get you on board with the farming module.

- [How to bootstrap a local network with farming module](./docs/Tutorials/localnet)
- [How to use Command Line Interfaces](./docs/How-To/cli)
- [How to use gRPC-gateway REST Routes](./docs/How-To)
- [Demo for how to budget and farming modules](./docs/Tutorials/demo/budget_with_farming.md)

## Resources
## Contributing

- [Documentation about Command-line and REST API Interfaces](./docs/How-To)
- [Demo](./docs/Tutorials/demo)
We welcome contributions from everyone. The [main](https://github.com/tendermint/farming/tree/main) branch contains the development version of the code. You can branch of from main and create a pull request, or maintain your own fork and submit a cross-repository pull request. If you're not sure where to start check out [CONTRIBUTING.md](./CONTRIBUTING.md) for our guidelines & policies for how we develop farming module. Thank you to all those who have contributed to farming module!
70 changes: 58 additions & 12 deletions TECHNICAL-SETUP.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,68 @@
# Technical Setup

## Setup git hooks for Conventional Commit
To ensure you have a successful experience working with our farming module, we recommend this technical setup.

## Github Integration

Click the GitHub icon in the sidebar for GitHub integration and follow the prompts.

Clone the repos you work in

- Fork or clone the https://github.com/tendermint/farming repository.

Internal Tendermint users have different permissions, if you're not sure, fork the repo.

## Software Requirement

To build the project:

- [Golang](https://golang.org/dl/) v1.16 or higher
- [make](https://www.gnu.org/software/make/) to use `Makefile` targets

## Development Environment Setup

Setup git hooks for conventional commit.

1. Install [`pre-commit`](https://pre-commit.com/)
2. Run this command:

```
$ pre-commit install --hook-type commit-msg
```

2. Run the following command:
```bash
pre-commit install --hook-type commit-msg
```

3. (Optional for macOS users) Install GNU `grep`:
1. Run `brew install grep`
2. Add this line to your shell profile:

4. Run the following command
```bash
brew install grep
```

5. Add the line to your shell profile:
```bash
export PATH="/usr/local/opt/grep/libexec/gnubin:$PATH"
```

Now, whenever you make a commit, the `pre-commit` hook will be run to check if the commit message conforms [Conventional Commit](https://www.conventionalcommits.org/) rule.

## Building

To build the farming module node and command line client, run the `make build` command from the project's root folder. The output of the build will be generated in the `build` folder.
For cross-builds use the standard `GOOS` and `GOARCH` env vars. i.e. to build for windows:
```bash
GOOS=windows GOARCH=amd64 make build
```
export PATH="/usr/local/opt/grep/libexec/gnubin:$PATH"
```
Now, whenever you make a commit, the `pre-commit` hook will be run to check if the commit message
conforms [Conventional Commit](https://www.conventionalcommits.org/) rule.
## Installation
To install the node client on your machine, run `make install` command from the project's root folder.

> 💡 you can also use the default `go` command to build the project, check the content of the [Makefile](https://github.com/tendermint/farming/blob/main/Makefile#L90) for reference

## Testing

Run `make test-all` command to run tests.

> 💡 you can also use the default `go` command to build the project, check the content of the [Makefile](https://github.com/tendermint/farming/blob/main/Makefile#L145) for reference

5 changes: 2 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ func NewFarmingApp(
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).
AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)).
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)).
AddRoute(farmingtypes.RouterKey, farming.NewPublicPlanProposal(app.FarmingKeeper))
AddRoute(farmingtypes.RouterKey, farming.NewPublicPlanProposalHandler(app.FarmingKeeper))

govKeeper := govkeeper.NewKeeper(
appCodec, keys[govtypes.StoreKey], app.GetSubspace(govtypes.ModuleName), app.AccountKeeper, app.BankKeeper,
Expand Down Expand Up @@ -445,14 +445,13 @@ func NewFarmingApp(
gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper),
mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper),
budget.NewAppModule(appCodec, app.BudgetKeeper, app.AccountKeeper, app.BankKeeper),
farming.NewAppModule(appCodec, app.FarmingKeeper, app.AccountKeeper, app.BankKeeper),
staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper),
distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper),
params.NewAppModule(app.ParamsKeeper),
evidence.NewAppModule(app.EvidenceKeeper),
liquidity.NewAppModule(appCodec, app.LiquidityKeeper, app.AccountKeeper, app.BankKeeper, app.DistrKeeper),
budget.NewAppModule(appCodec, app.BudgetKeeper, app.AccountKeeper, app.BankKeeper),
farming.NewAppModule(appCodec, app.FarmingKeeper, app.AccountKeeper, app.BankKeeper),
)

app.sm.RegisterStoreDecoders()
Expand Down
2 changes: 1 addition & 1 deletion client/docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"info": {
"title": "Cosmos SDK Farming Module - REST and gRPC Gateway docs",
"description": "A REST interface for state queries, transactions",
"version": "0.1.2"
"version": "0.1.3"
},
"apis": [
{
Expand Down
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

Loading

0 comments on commit b954984

Please sign in to comment.