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

Add staking deployment vars #313

Merged
merged 22 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
835a618
refactor: remove old readme sections
truemiller Aug 29, 2024
d158a63
Merge pull request #302 from valory-xyz/staging
truemiller Aug 29, 2024
e6128a4
Merge pull request #304 from valory-xyz/fix/readme-outdated
truemiller Aug 30, 2024
0adeefa
feat: add staking deployment vars
jmoreira-valory Sep 2, 2024
ef1bbe0
feat: added pearl beta 2 address & section
truemiller Sep 3, 2024
32872ad
chore: add pearl beta 2 address
jmoreira-valory Sep 3, 2024
4f90bd5
Merge remote-tracking branch 'origin/feat/update_staking' into feat/u…
jmoreira-valory Sep 3, 2024
0ae8d9f
chore: comment env example
truemiller Sep 3, 2024
b86056a
fix: isNil check for low balance
truemiller Sep 3, 2024
440f5e5
fix: serviceFundRequirements coalesce
truemiller Sep 3, 2024
b1da55f
refactor: order and map staking contracts
truemiller Sep 3, 2024
e9a53bb
fix: required olas when both staked and not staked
truemiller Sep 3, 2024
5d2d0fd
feat: update StakingContractSection to support multi-contract
truemiller Sep 3, 2024
9f7e41b
feat: updated STAKING_PROGRAM_META with deprecated and supported migr…
truemiller Sep 3, 2024
66eac9c
fix: isAddress checks to protect against 0xm
truemiller Sep 3, 2024
3291615
feat: added pearl_beta_2 to StakingContractInfo record
truemiller Sep 3, 2024
93a96cb
feat: add pearl_beta_2 Beta2 enum
truemiller Sep 3, 2024
47b353a
chore: comment availableRewards until it's used
truemiller Sep 3, 2024
664b3cb
feat: extend serviceStakingMechUsageContracts with pearl_beta_2, prot…
truemiller Sep 3, 2024
9d22c47
fix: protect against -1 serviceId related errors
truemiller Sep 3, 2024
901d19b
feat: add pearl_beta_2 requirement
truemiller Sep 3, 2024
3293996
bump: rc124 for test release
truemiller Sep 3, 2024
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
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FORK_URL=
NODE_ENV=
FORK_URL=
DEV_RPC=

# TODO: determine if these are needed
STAKING_TEST_KEYS_PATH=
IS_STAGING=
44 changes: 3 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Pearl is an application used to run autonomous agents powered by the OLAS Networ
- Javascript / TypeScript
- Python (3.10)
- Poetry (^1.7.1)
- Docker Engine

## Getting Started

Expand All @@ -26,7 +25,7 @@ The following installation steps assume you have the following on each OS:

<details><summary><h4>NodeJS</summary></h4>

NodeJS is best installed and managed through NVM. It allows you to install and select specific versions of NodeJS. Pearl has been built using version 20.11, LTS.
NodeJS is best installed and managed through NVM. It allows you to install and select specific versions of NodeJS. Pearl has been built using version 20 LTS.

<h5>Linux</h5>

Expand Down Expand Up @@ -117,38 +116,6 @@ If promoted to run `pipx ensurepath`, run it.

</details>

<details><summary><h4>Docker</h4></summary>

<h5>Linux</h5>

*Update the `ubuntu.22.04~jammy` version string to your current OS version before running the following command:*

```bash
VERSION_STRING=5:24.0.7-1~ubuntu.22.04~jammy
sudo apt-get install docker-ce=$VERSION_STRING docker-ce-cli=$VERSION_STRING containerd.io docker-buildx-plugin docker-compose-plugin
sudo usermod -aG docker $USER
```

If you are unsure about your current OS version/codename, you can find it by running:

```bash
lsb_release -a
```

<h5>MacOS</h5>

You can [install Docker Desktop via the Docker website](https://www.docker.com/products/docker-desktop/). Be sure to select the correct version for your system's CPU architecture.

If you are unsure about your system's CPU architecture, run the following command:

```bash
uname -p
# x86 64 Intel chip
# arm64 Apple chip
```

</details>

<h3>Setting up your .env file</h3>

Create an `.env` file in the root directory, or rename `.env.example` to `.env`.
Expand Down Expand Up @@ -202,7 +169,7 @@ Provided your system dependencies are installed, environment variables are set,
You can start Pearl by running the following command in the root directory:

```bash
yarn start
yarn dev
```

This will run Electron, which launches the NextJS frontend and the Python backend as child processes.
Expand Down Expand Up @@ -254,9 +221,4 @@ poetry run python scripts/fund.py 0xYOURADDRESS
poetry run python scripts/transfer_olas.py PATH_TO_KEY_CONTAINING_OLAS ADDRESS_TO_TRANSFER AMOUNT
```

</details>

<h2>Notes and Common Issues</h2>

- If Pearl is running, it will kill any attempt to run another Pearl instance. This is to ensure there are no port conflicts.
- Enivironment variables are cached in the terminal, if you change them while your terminal is open, you will need to restart the terminal.
</details>
2 changes: 1 addition & 1 deletion electron/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const { paths } = require('./constants');
* - use "" (nothing as a suffix) for latest release candidate, for example "0.1.0rc26"
* - use "alpha" for alpha release, for example "0.1.0rc26-alpha"
*/
const OlasMiddlewareVersion = '0.1.0rc120';
const OlasMiddlewareVersion = '0.1.0rc124';

const path = require('path');
const { app } = require('electron');
Expand Down
5 changes: 5 additions & 0 deletions frontend/components/MainPage/sections/GasBalanceSection.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ArrowUpOutlined, InfoCircleOutlined } from '@ant-design/icons';
import { Skeleton, Tooltip, Typography } from 'antd';
import { isNil } from 'lodash';
import { useEffect, useMemo, useState } from 'react';
import styled from 'styled-components';

Expand Down Expand Up @@ -65,6 +66,10 @@ const BalanceStatus = () => {
]);

const status = useMemo(() => {
if (isNil(isLowBalance)) {
return { statusName: 'Loading...', StatusComponent: EmptyDot };
}

if (isLowBalance) {
return { statusName: 'Too low', StatusComponent: EmptyDot };
}
Expand Down
3 changes: 2 additions & 1 deletion frontend/components/MainPage/sections/NeedsFundsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ const useNeedsFunds = () => {
const hasEnoughOlasForInitialFunding = useMemo(() => {
const olasInSafe = safeBalance?.OLAS || 0;
const olasStakedBySafe = totalOlasStakedBalance || 0;
const olasRequiredToFundService = serviceFundRequirements.olas || 0;

const olasInSafeAndStaked = olasInSafe + olasStakedBySafe;

return olasInSafeAndStaked >= serviceFundRequirements.olas;
return olasInSafeAndStaked >= olasRequiredToFundService;
}, [
safeBalance?.OLAS,
totalOlasStakedBalance,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Flex, Typography } from 'antd';

import { CustomAlert } from '@/components/Alert';
import { UNICODE_SYMBOLS } from '@/constants/symbols';
import { useStakingProgram } from '@/hooks/useStakingProgram';

const { Text } = Typography;

Expand All @@ -14,8 +15,11 @@ export const AlertInsufficientMigrationFunds = ({
stakedOlasBalance: number;
totalOlasRequiredForStaking: number;
}) => {
const requiredOlasDeposit =
totalOlasRequiredForStaking - (stakedOlasBalance + masterSafeOlasBalance);
const { activeStakingProgram } = useStakingProgram();

const requiredOlasDeposit = activeStakingProgram
? totalOlasRequiredForStaking - (stakedOlasBalance + masterSafeOlasBalance) // when staked
: totalOlasRequiredForStaking - masterSafeOlasBalance; // when not staked

return (
<CustomAlert
Expand Down
Loading
Loading