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

ci: filter proposer trigger branchnames #255

Merged
merged 3 commits into from
Nov 27, 2024
Merged
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
21 changes: 10 additions & 11 deletions .github/workflows/add-new-complex-n-rewarder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ name: Add new Complex N Rewarder
permissions:
contents: write

on: [pull_request]
on:
pull_request:
branches:
- "complexrewarder/add/**"

jobs:
test:
Expand All @@ -14,20 +17,16 @@ jobs:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v4
with:
node-version: 16
- run: |
echo MNEMONIC="test test test test test test test test test test test junk" > .env
echo INFURA_API_KEY="test" >> .env
echo ETHERSCAN_API_KEY="test" >> .env
echo AURORA_API_KEY="test" >> .env
- name: Propose new rewarder
node-version: 18
cache: yarn
- run: cp .env.example .env
- run: yarn
- name: Propose new complex rewarder
env:
SAFE_SIGNER_MNEMONIC: ${{ secrets.SAFE_SIGNER_MNEMONIC }}
AURORA_API_KEY: ${{ secrets.AURORA_API_KEY }}
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
run: |
yarn
yarn hardhat run scripts/ops/safeDeployComplexNRewarder.ts --network aurora
run: yarn hardhat run scripts/ops/safeDeployComplexNRewarder.ts --network aurora
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Added new Complex N Rewarder config to rewarderConfigs.json
21 changes: 10 additions & 11 deletions .github/workflows/add-new-rewarder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ name: Add new rewarder
permissions:
contents: write

on: [pull_request]
on:
pull_request:
branches:
- "rewarder/add/**"

jobs:
test:
Expand All @@ -14,20 +17,16 @@ jobs:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v4
with:
node-version: 16
- run: |
echo MNEMONIC="test test test test test test test test test test test junk" > .env
echo INFURA_API_KEY="test" >> .env
echo ETHERSCAN_API_KEY="test" >> .env
echo AURORA_API_KEY="test" >> .env
node-version: 18
cache: yarn
- run: cp .env.example .env
- run: yarn
- name: Propose new rewarder
env:
SAFE_SIGNER_MNEMONIC: ${{ secrets.SAFE_SIGNER_MNEMONIC }}
AURORA_API_KEY: ${{ secrets.AURORA_API_KEY }}
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
run: |
yarn
yarn hardhat run scripts/ops/safeDeployRewarder.ts --network aurora
run: yarn hardhat run scripts/ops/safeDeployRewarder.ts --network aurora
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Added new rewarder config to rewarderConfigs.json
commit_message: Added new Rewarder config to rewarderConfigs.json
23 changes: 11 additions & 12 deletions .github/workflows/complex-n-rewarder-tokens-per-block.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,30 @@ name: Update Complex N Rewarder Tokens Per Block
permissions:
contents: write

on: [pull_request]
on:
pull_request:
branches:
- "complexrewarder/set/**"

jobs:
complexNRewarderTokensPerBlock:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v4
with:
node-version: 16
- run: |
echo MNEMONIC="test test test test test test test test test test test junk" > .env
echo INFURA_API_KEY="test" >> .env
echo ETHERSCAN_API_KEY="test" >> .env
echo AURORA_API_KEY="test" >> .env
node-version: 18
cache: yarn
- run: cp .env.example .env
- run: yarn
- name: Propose pool allocation
env:
SAFE_SIGNER_MNEMONIC: ${{ secrets.SAFE_SIGNER_MNEMONIC }}
SAFE_PROPOSER_PRIVATE_KEY: ${{ secrets.SAFE_OPS_PROPOSER }}
AURORA_API_KEY: ${{ secrets.AURORA_API_KEY }}
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
run: |
yarn
yarn hardhat run scripts/ops/safeComplexNRewarderTokensPerBlock.ts --network aurora
run: yarn hardhat run scripts/ops/proposerComplexNRewarderTokensPerBlock.ts --network aurora
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Removed complexNRewarderTokensPerBlock.json due to transaction proposed on gnosis safe
5 changes: 4 additions & 1 deletion .github/workflows/rewarder-tokens-per-block.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ name: Update Rewarder Tokens Per Block
permissions:
contents: write

on: [pull_request]
on:
pull_request:
branches:
- "rewarder/set/**"

jobs:
rewarderTokensPerBlock:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/set-allocation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ name: Set Pool Allocation
permissions:
contents: write

on: [pull_request]
on:
pull_request:
branches:
- "allocation/set/**"

jobs:
setAllocation:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/set-emissions.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Set MCV1 Emissions

on: [workflow_dispatch]
on:
pull_request:
branches:
- "emissions/set/**"

jobs:
setAllocation:
Expand Down
84 changes: 84 additions & 0 deletions scripts/ops/proposerComplexNRewarderTokensPerBlock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import fs from "fs-extra";
import { ethers } from "hardhat";
import Safe from "@gnosis.pm/safe-core-sdk";
import EthersAdapter from "@gnosis.pm/safe-ethers-lib";
import { SafeEthersSigner, SafeService } from "@gnosis.pm/safe-ethers-adapters";
import { Wallet } from "ethers";
import { JsonRpcProvider } from "@ethersproject/providers";
import { ops, SAFE_SERVICE_URL } from "../constants";

type ComplexNRewarderTokensPerBlockConfig = {
Rewarder: string;
TokensPerBlock: number[];
};

const { AURORA_API_KEY, SAFE_PROPOSER_PRIVATE_KEY } = process.env;
if (!AURORA_API_KEY) {
throw new Error("*** AURORA_API_KEY NOT FOUND IN ENV");
}
if (!SAFE_PROPOSER_PRIVATE_KEY) {
throw new Error("*** SAFE_PROPOSER_PRIVATE_KEY NOT FOUND IN ENV");
}

const AURORA_URL = "https://mainnet.aurora.dev/" + AURORA_API_KEY;

const provider = new JsonRpcProvider(AURORA_URL);

const signer = new Wallet(SAFE_PROPOSER_PRIVATE_KEY, provider);
const service = new SafeService(SAFE_SERVICE_URL);
console.info("Setup SafeEthersSigner");
const ethAdapter = new EthersAdapter({ ethers, signer });

console.info("*** Using signer address: ", signer.address);
console.info("*** Using SAFE_SERVICE_URL: ", SAFE_SERVICE_URL);

async function main() {
const safe = await Safe.create({ ethAdapter, safeAddress: ops });
const safeSigner = new SafeEthersSigner(safe, service, provider);

console.info("*** Proposing updating complex n rewarder tokens per block ***");

let complexNRewarderTokensPerBlockConfig: ComplexNRewarderTokensPerBlockConfig | undefined;
try {
complexNRewarderTokensPerBlockConfig = await fs.readJSON("./complexNRewarderTokensPerBlockConfig.json");
console.info("*** complexNRewarderTokensPerBlockConfig.json found ***");
console.info(JSON.stringify(complexNRewarderTokensPerBlockConfig));
if (
complexNRewarderTokensPerBlockConfig &&
typeof complexNRewarderTokensPerBlockConfig?.Rewarder === "string" &&
complexNRewarderTokensPerBlockConfig?.TokensPerBlock.length > 0
) {
const { Rewarder, TokensPerBlock } = complexNRewarderTokensPerBlockConfig;
const complexNRewarder = await ethers.getContractFactory("ComplexNRewarder");
const rewarder = complexNRewarder.attach(Rewarder);

console.info(`Rewarder address: ${rewarder.address}`);
for (let i = 0; i < TokensPerBlock.length; i++) {
console.info(`Tokens Per Block ${i}: ${TokensPerBlock[i]}`);
}

await rewarder.connect(safeSigner).setRewardRate(TokensPerBlock);

console.info("*** USER ACTION REQUIRED ***");
console.info("Go to the Gnosis Safe Web App to confirm the transaction");
console.info(`https://gnosis-safe.io/app/aurora:${ops}/transactions/queue`);
console.info(`*** Please verify the proposed rewarder tokens per block tx`);

// NOTE - Used because fs.promises.rm is not a function error on github actions, weird
await fs.remove("./complexNRewarderTokensPerBlockConfig.json");
console.info("*** Removed complexNRewarderTokensPerBlockConfig.json file, no longer needed");
}
} catch (err) {
console.error(err);
console.info("*** No complexNRewarderTokensPerBlockConfig.json found");
}
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
.then(() => process.exit(0))
.catch((error: Error) => {
console.error(error);
process.exit(1);
});
Loading