Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump salary and members #24

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
name: Make astar payouts

on:
pull_request:
workflow_dispatch:
schedule:
- cron: "0 0 * * MON"
- cron: "0 /8 * * *"

env:
PAYOUTS_ACCOUNT_MNEMONIC: ${{ secrets.PAYOUTS_ACCOUNT_MNEMONIC }}
BUMP_ACCOUNT_MNEMONIC: ${{ secrets.BUMP_ACCOUNT_MNEMONIC }}

jobs:
build:
Expand All @@ -21,7 +20,7 @@ jobs:
run: yarn install

- name: Run app
run: yarn start:astar
run: yarn start:fellowship

telegram-notification:
needs: [build]
Expand All @@ -37,4 +36,4 @@ jobs:
message: |
💸 Astar payout failed, see logs for details:

Github run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
Github run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
name: Make kilt payouts

on:
pull_request:
workflow_dispatch:
schedule:
- cron: "0 0 * * MON"

env:
PAYOUTS_ACCOUNT_MNEMONIC: ${{ secrets.PAYOUTS_ACCOUNT_MNEMONIC }}
BUMP_ACCOUNT_MNEMONIC: ${{ secrets.BUMP_ACCOUNT_MNEMONIC }}

jobs:
build:
Expand All @@ -21,8 +18,8 @@ jobs:
run: yarn install

- name: Run app
run: yarn start:kilt
run: yarn start:novasama

telegram-notification:
needs: [build]
runs-on: ubuntu-latest
Expand All @@ -37,5 +34,4 @@ jobs:
message: |
💸 Kilt payout failed, see logs for details:

Github run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}

Github run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
40 changes: 0 additions & 40 deletions .github/workflows/relaychain_payout_run.yml

This file was deleted.

8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2025 Novasama Technologies GmbH

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -198,4 +198,4 @@
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Payout Rewards
This project is a TypeScript application that automates payouts for Substrate networks.
# Fellowship observer
This project is a TypeScript application that automates Fellowship members and Salary cycles bump on Polkadot Collective chain.

## Configuration
The application requires a configuration file located at [src/config/conf.ts](src/config/conf.ts). This file contains the necessary configuration options for the application to run.

## Required Environment Variables
The following environment variable is required for the application to function:

`PAYOUTS_ACCOUNT_MNEMONIC` - the mnemonic for the account that will be used to make payouts.
`BUMP_ACCOUNT_MNEMONIC` - the mnemonic for the account that will be used to make bumps.

## Running the Application
The application is designed to be run on a schedule using GitHub Actions.
Expand All @@ -19,11 +19,9 @@ yarn install

Run the app:
```bash
yarn start:relaychain
yarn start:astar
yarn start:kilt
yarn start:fellowship
```

## License
Validator Observer is available under the Apache 2.0 license. See the LICENSE file for more info.
© Novasama Technologies GmbH 2023
Fellowship Observer is available under the Apache 2.0 license. See the LICENSE file for more info.
© Novasama Technologies GmbH 2025
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"description": "Automate payouts",
"main": "App.ts",
"scripts": {
"start:relaychain": "ts-node src/App.ts 'Relaychain'",
"start:astar": "ts-node src/App.ts 'Astar'",
"start:kilt": "ts-node src/App.ts 'Kilt'"
"start:fellowship": "ts-node src/App.ts 'Fellowship-Collectives'",
"start:novasama": "ts-node src/App.ts 'Novasama-Collectives'"
},
"dependencies": {
"@polkadot/api": "^12.1.1",
"@polkadot/api": "^15.3.1",
"@polkadot/types": "15.3.1",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
}
}
}
27 changes: 11 additions & 16 deletions src/App.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { SubstrateConnection } from './connection';
import { RelaychainConfig, config } from './config/conf';
import { config } from './config/conf';
import { Sender } from './utils';
import { getPayoutHelper } from './payoutHelper/PayoutFabric';
import { VoteHelper } from './voteHelper';
import { configManager } from './config/ConfigManager';
import {getBumpHelper} from "./memberBumpHelper/BumpFabric";

interface Connections {
[network: string]: SubstrateConnection;
Expand All @@ -13,30 +12,26 @@ async function main(): Promise<void> {
const networkType = process.argv[2];

let connections: Connections = {}
if (!config.payoutAccount) {
throw new Error('Payout Account does not set, please provide PAYOUTS_ACCOUNT_MNEMONIC variable')
if (!config.bumpAccount) {
throw new Error('Payout Account does not set, please provide BUMP_ACCOUNT_MNEMONIC variable')
}

const sender = new Sender(config.payoutAccount)
const sender = new Sender(config.bumpAccount)

const filteredNetworks = configManager(networkType, config)

for (const network of filteredNetworks) {
// Create connection
const connection = new SubstrateConnection(network.endpoint);
await connection.connect();
connections[network.name] = connection
connections[network.name] = connection;
console.log(`Connected to ${network.name} network`);

// Payout rewards
const payout = getPayoutHelper(network, connections[network.name]);
await payout.payoutRewards(network.validators, sender.generateKeyringPair(), false)
// Bump Fellowship members and salary
const memberBumpHelper = getBumpHelper(network, connections[network.name]);
await memberBumpHelper.bumpMembers(sender.generateKeyringPair());
await memberBumpHelper.bumpSalaryCycle(sender.generateKeyringPair());

// OpenGov voting
if (network instanceof RelaychainConfig) {
const voter = new VoteHelper(connections[network.name]);
await voter.checkVotes(network, sender.generateKeyringPair())
}

// Close connection
await connection.disconnect();
Expand All @@ -46,4 +41,4 @@ async function main(): Promise<void> {
main().catch((err) => {
console.error(err);
process.exit(1);
});
});
9 changes: 4 additions & 5 deletions src/config/ConfigManager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RelaychainConfig, AstarConfig, Config, KiltConfig } from './conf'
import {FellowshipConfig, NovasamaConfig, Config} from './conf'

/**
* Function to manage the configuration of the network.
Expand All @@ -8,10 +8,9 @@ import { RelaychainConfig, AstarConfig, Config, KiltConfig } from './conf'
* @throws {Error} - Throws an error if no networks are found for the given type.
*/
export function configManager(networkType: string, config: Config) {
const filteredNetworks = config.networks.filter(network =>
(networkType === 'Relaychain' && network instanceof RelaychainConfig) ||
(networkType === 'Astar' && network instanceof AstarConfig) ||
(networkType === 'Kilt' && network instanceof KiltConfig)
const filteredNetworks = config.networks.filter(network =>
(networkType === 'Fellowship-Collectives' && network instanceof FellowshipConfig) ||
(networkType === 'Novasama-Collectives' && network instanceof NovasamaConfig)
);

if (filteredNetworks.length === 0) {
Expand Down
Loading