Skip to content

Commit

Permalink
Merge branch 'staging' of github.com:valory-xyz/olas-operate-app into…
Browse files Browse the repository at this point in the history
… feat/win-support
  • Loading branch information
solarw committed Aug 29, 2024
2 parents d06eb95 + 6f16c71 commit bc234f8
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 22 deletions.
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 homedir = os.homedir();
* - 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.0rc118';
const OlasMiddlewareVersion = '0.1.0rc120';

const path = require('path');
const { app } = require('electron');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Button, Flex, Popover, theme, Typography } from 'antd';
import { useMemo, useState } from 'react';

import { DeploymentStatus } from '@/client';
import { Chain, DeploymentStatus } from '@/client';
import { OpenAddFundsSection } from '@/components/MainPage/sections/AddFundsSection';
import { CardSection } from '@/components/styled/CardSection';
import { SERVICE_STAKING_TOKEN_MECH_USAGE_CONTRACT_ADDRESSES } from '@/constants/contractAddresses';
import { STAKING_PROGRAM_META } from '@/constants/stakingProgramMeta';
import { UNICODE_SYMBOLS } from '@/constants/symbols';
import { Pages } from '@/enums/PageState';
Expand All @@ -17,7 +18,6 @@ import { useServiceTemplates } from '@/hooks/useServiceTemplates';
import { useStakingContractInfo } from '@/hooks/useStakingContractInfo';
import { useStakingProgram } from '@/hooks/useStakingProgram';
import { ServicesService } from '@/service/Services';
import { Address } from '@/types/Address';
import { getMinimumStakedAmountRequired } from '@/utils/service';

import {
Expand Down Expand Up @@ -54,10 +54,8 @@ const { useToken } = theme;

export const StakingContractSection = ({
stakingProgram,
contractAddress,
}: {
stakingProgram: StakingProgram;
contractAddress: Address;
}) => {
const { goto } = usePageState();
const {
Expand All @@ -76,6 +74,11 @@ export const StakingContractSection = ({
useStakingContractInfo();
const [isFundingSectionOpen, setIsFundingSectionOpen] = useState(false);

const stakingContractAddress =
SERVICE_STAKING_TOKEN_MECH_USAGE_CONTRACT_ADDRESSES[Chain.GNOSIS][
stakingProgram
];

const stakingContractInfoForStakingProgram =
stakingContractInfoRecord?.[stakingProgram];

Expand Down Expand Up @@ -258,7 +261,7 @@ export const StakingContractSection = ({
// here instead of isSelected we should check that the contract is not the old staking contract
// but the one from staking factory (if we want to open govern)
<a
href={`https://gnosisscan.io/address/${contractAddress}`}
href={`https://gnosisscan.io/address/${stakingContractAddress}`}
target="_blank"
className="ml-auto"
>
Expand Down Expand Up @@ -286,7 +289,7 @@ export const StakingContractSection = ({

{cantMigrateAlert}
{/* Switch to program button */}
{
{stakingProgram !== StakingProgram.Alpha && (
<Popover content={!isMigratable && cantMigrateReason}>
<Button
type="primary"
Expand Down Expand Up @@ -319,7 +322,7 @@ export const StakingContractSection = ({
Switch to {activeStakingProgramMeta?.name} contract
</Button>
</Popover>
}
)}
{stakingProgram === StakingProgram.Beta && (
<Button
type="default"
Expand Down
13 changes: 2 additions & 11 deletions frontend/components/ManageStakingPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { CloseOutlined } from '@ant-design/icons';
import { Button, Card } from 'antd';

import { Chain } from '@/client';
import { SERVICE_STAKING_TOKEN_MECH_USAGE_CONTRACT_ADDRESSES } from '@/constants/contractAddresses';
import { Pages } from '@/enums/PageState';
import { StakingProgram } from '@/enums/StakingProgram';
import { usePageState } from '@/hooks/usePageState';
Expand All @@ -26,15 +24,8 @@ export const ManageStakingPage = () => {
}
>
<WhatAreStakingContractsSection />
{Object.entries(
SERVICE_STAKING_TOKEN_MECH_USAGE_CONTRACT_ADDRESSES[Chain.GNOSIS],
).map(([stakingProgram, contractAddress]) => (
<StakingContractSection
key={contractAddress}
stakingProgram={stakingProgram as StakingProgram}
contractAddress={contractAddress}
/>
))}
<StakingContractSection stakingProgram={StakingProgram.Beta} />
<StakingContractSection stakingProgram={StakingProgram.Alpha} />
</Card>
);
};
4 changes: 3 additions & 1 deletion operate/services/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import logging
import os
import shutil
import time
import traceback
import typing as t
from collections import Counter
Expand Down Expand Up @@ -116,7 +117,8 @@ def json(self) -> t.List[t.Dict]:
f"Failed to load service: {path.name}. Exception: {e}"
)
# rename the invalid path
invalid_path = path.parent / f"invalid_{path.name}"
timestamp = int(time.time())
invalid_path = path.parent / f"invalid_{timestamp}_{path.name}"
os.rename(path, invalid_path)
self.logger.info(
f"Renamed invalid service: {path.name} to {invalid_path.name}"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@
"download-binaries": "sh download_binaries.sh",
"build:pearl": "sh build_pearl.sh"
},
"version": "0.1.0-rc118"
"version": "0.1.0-rc120"
}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "olas-operate-middleware"
version = "0.1.0-rc118"
version = "0.1.0-rc120"
description = ""
authors = ["David Vilela <[email protected]>", "Viraj Patel <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit bc234f8

Please sign in to comment.