-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from oxen-io/dev
Staking Portal Release: Exit & Liquidation
- Loading branch information
Showing
98 changed files
with
3,597 additions
and
1,412 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Builds | ||
on: | ||
- pull_request | ||
|
||
jobs: | ||
builds: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- uses: pnpm/action-setup@v4 | ||
name: Install pnpm | ||
with: | ||
run_install: false | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
cache: 'pnpm' | ||
node-version-file: '.tool-versions' | ||
|
||
- name: Get pnpm store directory | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||
- uses: actions/cache@v4 | ||
name: Setup pnpm cache | ||
with: | ||
path: ${{ env.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Set environment variables | ||
run: | | ||
grep '^export ' ./apps/staking/scripts/mock-build-env.sh | sed 's/export //' >> $GITHUB_ENV | ||
- name: Run builds | ||
run: pnpm build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Linting | ||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
linting: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- uses: pnpm/action-setup@v4 | ||
name: Install pnpm | ||
with: | ||
run_install: false | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
cache: 'pnpm' | ||
node-version-file: '.tool-versions' | ||
|
||
- name: Get pnpm store directory | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||
- uses: actions/cache@v4 | ||
name: Setup pnpm cache | ||
with: | ||
path: ${{ env.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Run linter | ||
run: pnpm lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Type Checks | ||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
type-checks: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- uses: pnpm/action-setup@v4 | ||
name: Install pnpm | ||
with: | ||
run_install: false | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
cache: 'pnpm' | ||
node-version-file: '.tool-versions' | ||
|
||
- name: Get pnpm store directory | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||
- uses: actions/cache@v4 | ||
name: Setup pnpm cache | ||
with: | ||
path: ${{ env.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Run type checks | ||
run: pnpm check-types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# Contributor Guidelines | ||
|
||
## Advice for new contributors | ||
|
||
Start small. The PRs most likely to be merged are the ones that make small, easily reviewed changes with clear and | ||
specific intentions. | ||
|
||
It's a good idea to gauge interest in your intended work by finding or creating | ||
a [GitHub Issue](https://github.com/oxen-io/websites/issues) for it. | ||
|
||
You're most likely to have your pull request accepted if it addresses an | ||
existing [GitHub Issue](https://github.com/oxen-io/websites/issues) marked with | ||
the [good-first-issue](https://github.com/oxen-io/websites/labels/good%20first%20issue) | ||
tag. | ||
|
||
Of course, we encourage community developers to work on ANY issue, regardless of how it’s tagged, however, if you pick | ||
up or create an issue without the “Good first issue” tag it would be best if you leave a comment on the issue so that | ||
the team can give you any guidance required, especially around UI heavy features. | ||
|
||
## Developer Tips | ||
|
||
See the development section of the [README.md](README.md#development) in the root of the repository. And please read the | ||
`README.md` of any app or package you are interested in contributing to. | ||
|
||
## Tests | ||
|
||
Please write tests! Each app and package has a `README.md` file that explains how to write and run tests for that app or | ||
package. | ||
|
||
You can run all tests at once with the following command: | ||
|
||
```shell | ||
pnpm test | ||
``` | ||
|
||
## GitHub Actions | ||
|
||
You can mock all the GitHub actions by running the following command: | ||
|
||
```shell | ||
pnpm gh | ||
``` | ||
|
||
This will run the linting, type checking, unit tests, and build scripts for all apps and packages. | ||
|
||
## Committing your changes | ||
|
||
Before a commit is accepted the staged changes will be formatted using [prettier](https://prettier.io/) and linted | ||
using [eslint](https://eslint.org/). | ||
|
||
### Commit Message Convention | ||
|
||
This project follows [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) | ||
|
||
Commit messages will be checked using [husky](https://typicode.github.io/husky/#/) | ||
and [commitlint](https://commitlint.js.org/). | ||
|
||
## Pull requests | ||
|
||
So you want to make a pull request? Please observe the following guidelines. | ||
|
||
- First, make sure that your `pnpm test` and `pnpm build` run passes - it's very similar to what our Continuous | ||
Integration servers do to test the app. | ||
- Be sure to add and run tests! | ||
- [Rebase](https://nathanleclaire.com/blog/2014/09/14/dont-be-scared-of-git-rebase/) your changes on the latest `dev` | ||
branch, resolving any conflicts. This ensures that your changes will merge cleanly when you open your PR. | ||
- Make sure the diff between `dev` and your branch contains only the minimal set of changes needed to implement your | ||
feature or bugfix. This will make it easier for the person reviewing your code to approve the changes. Please do not | ||
submit a PR with commented out code or unfinished features. | ||
- Avoid meaningless or too-granular commits. If your branch contains commits like the lines of "Oops, reverted this | ||
change" or "Just experimenting, will delete this later", | ||
please [squash or rebase those changes away](https://robots.thoughtbot.com/git-interactive-rebase-squash-amend-rewriting-history). | ||
- Don't have too few commits. If you have a complicated or long-lived feature branch, it may make sense to break the | ||
changes up into logical atomic chunks to aid in the review process. | ||
- Provide a well written and nicely formatted commit message. | ||
See [this blog post](http://chris.beams.io/posts/git-commit/) for some tips on formatting. As far as content, try to | ||
include in your summary | ||
1. What you changed | ||
2. Why this change was made (including git issue # if appropriate) | ||
3. Any relevant technical details or motivations for your implementation choices that may be helpful to someone | ||
reviewing or auditing the commit history in the future. When in doubt, err on the side of a longer commit | ||
message. Above all, spend some time with the repository. Follow the pull request template added to your pull | ||
request description automatically. Take a look at recent approved pull requests, see how they did things. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Session Staking | ||
|
||
Session Staking is a [Next.js](https://nextjs.org/) app for managing and staking | ||
to [Session Nodes](https://github.com/oxen-io/oxen-core). | ||
|
||
## Getting Started | ||
|
||
You can follow the generic instructions in the root [README.md](../../README.md#getting-started) to get started. | ||
|
||
## Development | ||
|
||
Running the app requires several environment variables to be set. See the [.env.local.template](.env.local.template) | ||
file for a list | ||
of required variables. | ||
|
||
We recommend running the [Session Token Staking Backend](https://github.com/oxen-io/sent-staking-backend/) and | ||
a [Session Node](https://github.com/oxen-io/oxen-core) yourself to ensure any changes you make will work | ||
with the latest changes. | ||
|
||
### Session Node | ||
|
||
You'll need a [Session Node](https://github.com/oxen-io/oxen-core) to make RPC calls to, this node | ||
does not need to be staked to and does not need to join the network as a participating node. You'll need to run the | ||
following to start the node: | ||
|
||
```shell | ||
oxend --stagenet --lmq-public tcp://127.0.0.1:<PORT> --l2-provider https://sepolia-rollup.arbitrum.io/rpc | ||
``` | ||
|
||
You can then set the `NEXT_PUBLIC_SENT_EXPLORER_API_URL` environment variable in your `.env.local` file to point to | ||
the Session Node's RPC endpoint (`tcp://127.0.0.1:<PORT>` in the example above). | ||
|
||
**Note:** You can use any available port for the node RPC endpoint, just make sure it's consistent in all places. | ||
|
||
### Session Token Staking Backend | ||
|
||
Set up the [Session Token Staking Backend](https://github.com/oxen-io/sent-staking-backend/) by following the | ||
instructions in the [README.md](https://github.com/oxen-io/sent-staking-backend/blob/main/README.md). | ||
|
||
Make sure the `config.py` file in the backend directory has the following values: | ||
|
||
```python | ||
stagenet_rpc = 'tcp://127.0.0.1:<PORT>' | ||
``` | ||
|
||
You can then run the backend with the following command: | ||
|
||
```shell | ||
uwsgi --http 127.0.0.1:5000 --master -p 4 -w sent --callable app --fs-reload sent.py | ||
``` | ||
|
||
You can then set the `NEXT_PUBLIC_SENT_STAKING_BACKEND_URL` environment variable in your `.env.local` file to point to | ||
the Session Token Staking Backend's RPC endpoint (`http://127.0.0.1:5000` in the example above). |
Oops, something went wrong.