Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'upstream/development' into default-config
Browse files Browse the repository at this point in the history
  • Loading branch information
Venoox committed Jul 31, 2023
2 parents 71d0b69 + 8779299 commit cb5c231
Show file tree
Hide file tree
Showing 42 changed files with 733 additions and 285 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @0xcodercrane

12 changes: 9 additions & 3 deletions .github/ubiquibot-config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
chain-id: 100
base-multiplier: 1500
evm-network-id: 100
price-multiplier: 1.5
time-labels:
- name: "Time: <1 Hour"
weight: 0.125
Expand Down Expand Up @@ -28,6 +28,12 @@ priority-labels:
weight: 4
- name: "Priority: 4 (Emergency)"
weight: 5
default-labels:
- "Time: <1 Hour"
- "Priority: 0 (Normal)"
- "Test"
auto-pay-mode: true
analytics-mode: true
comment-incentives: true
max-concurrent-bounties: 2
promotion-comment: "\n<h6>If you enjoy the DevPool experience, please follow <a href='https://github.com/ubiquity'>Ubiquity on GitHub</a> and star <a href='https://github.com/ubiquity/devpool-directory'>this repo</a> to show your support. It helps a lot!</h6>"
register-wallet-with-verification: false
23 changes: 23 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,26 @@ jobs:

- name: Lint
run: yarn lint

run-migration:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/development')
env:
SUPABASE_ACCESS_TOKEN: ${{ github.ref == 'refs/heads/main' && secrets.PRODUCTION_SUPABASE_ACCESS_TOKEN || secrets.STAGING_SUPABASE_ACCESS_TOKEN }}
SUPABASE_DB_PASSWORD: ${{ github.ref == 'refs/heads/main' && secrets.PRODUCTION_SUPABASE_DB_PASSWORD || secrets.STAGING_SUPABASE_DB_PASSWORD }}
PROJECT_ID: ${{ github.ref == 'refs/heads/main' && secrets.PRODUCTION_SUPABASE_PROJECT_ID || secrets.STAGING_SUPABASE_PROJECT_ID }}

steps:
- name: Checkout repository
uses: actions/checkout@v3

- uses: supabase/setup-cli@v1
with:
version: latest

- name: Link Supabase project
run: supabase link --project-ref $PROJECT_ID

- name: Run migrations
run: supabase db push
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,37 @@ To test the bot, you can:
2. Add a time label, ex: `Time: <1 Day`
3. At this point the bot should add a price label.

## Configuration

`chain-id` is ID of the EVM-compatible network that will be used for payouts.

`base-multiplier` is a base number that will be used to calculate bounty price based on the following formula: `price = base-multiplier * time-label-weight * priority-label-weight / 10`

`time-labels` are labels for marking the time limit of the bounty:

- `name` is a human-readable name
- `weight` is a number that will be used to calculate the bounty price
- `value` is number of seconds that corresponds to the time limit of the bounty

`priority-labels` are labels for marking the priority of the bounty:

- `name` is a human-readable name
- `weight` is a number that will be used to calculate the bounty price

`default-labels` are labels that are applied when an issue is created without any time or priority labels.

`auto-pay-mode` can be `true` or `false` that enables or disables automatic payout of bounties when the issue is closed.

`analytics-mode` can be `true` or `false` that enables or disables weekly analytics collection by Ubiquity.

`incentive-mode` can be `true` or `false` that enables or disables comment incentives. These are comments in the issue by either the creator of the bounty or other users.

`issue-creator-multiplier` is a number that defines a base multiplier for calculating incentive reward for the creator of the issue.

`comment-element-pricing` defines how much is a part of the comment worth. For example `text: 0.1` means that any text in the comment will be multiplied by 0.1

`max-concurrent-bounties` is the maximum number of bounties that can be assigned to a bounty hunter at once. This excludes bounties with pending pull request reviews.

## How to run locally

1. Create a new project at [Supabase](https://supabase.com/). Add `Project URL` and `API Key` to the `.env` file:
Expand Down
16 changes: 16 additions & 0 deletions src/adapters/supabase/helpers/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,22 @@ export const getWalletMultiplier = async (username: string): Promise<number> =>
else return data?.multiplier;
};

/**
* Queries both the wallet multiplier and address in one request registered previously
*
* @param username The username you want to find an address for
* @returns The Multiplier and ERC-20 Address, returns 1 if not found
*
*/

export const getWalletInfo = async (username: string): Promise<{ multiplier: number | null; address: string | null } | number | undefined> => {
const { supabase } = getAdapters();

const { data } = await supabase.from("wallets").select("multiplier, address").eq("user_name", username).single();
if (data?.multiplier == null || data?.address == null) return 1;
else return { multiplier: data?.multiplier, address: data?.address };
};

export const getMultiplierReason = async (username: string): Promise<string> => {
const { supabase } = getAdapters();
const { data } = await supabase.from("wallets").select("reason").eq("user_name", username).single();
Expand Down
Loading

0 comments on commit cb5c231

Please sign in to comment.