Skip to content

Commit

Permalink
Merge pull request #302 from valory-xyz/staging
Browse files Browse the repository at this point in the history
Merging staging into main for rc120 full release
  • Loading branch information
truemiller authored Aug 29, 2024
2 parents aa9235c + f04521d commit d158a63
Show file tree
Hide file tree
Showing 13 changed files with 731 additions and 462 deletions.
5 changes: 4 additions & 1 deletion .gitleaksignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ d8149e9b5b7bd6a7ed7bc1039900702f1d4f287b:operate/services/manage.py:generic-api-
99c0f139b037da2587708212fcf6d0e20786d0ba:operate/services/manage.py:generic-api-key:455
91ec07457f69e9a29f63693ac8ef887e4b5f49f0:operate/services/manage.py:generic-api-key:454
410bea2bd02ff54da69387fe8f3b58793e09f7b0:operate/services/manage.py:generic-api-key:421
410bea2bd02ff54da69387fe8f3b58793e09f7b0:operate/services/manage.py:generic-api-key:422
410bea2bd02ff54da69387fe8f3b58793e09f7b0:operate/services/manage.py:generic-api-key:422
467e8e64f51fb3659e5af17ba53ab587ec24fc30:operate/services/manage.py:generic-api-key:290
64afe2ea92daafa2515c054f0e09931622d99f31:operate/services/manage.py:generic-api-key:290
64afe2ea92daafa2515c054f0e09931622d99f31:operate/services/manage.py:generic-api-key:289
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.0rc117';
const OlasMiddlewareVersion = '0.1.0rc120';

const path = require('path');
const { app } = require('electron');
Expand Down
59 changes: 30 additions & 29 deletions frontend/components/MainPage/sections/AddFundsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import styled from 'styled-components';
import { UNICODE_SYMBOLS } from '@/constants/symbols';
import { COW_SWAP_GNOSIS_XDAI_OLAS_URL } from '@/constants/urls';
import { useWallet } from '@/hooks/useWallet';
import { Address } from '@/types/Address';
import { copyToClipboard } from '@/utils/copyToClipboard';
import { truncateAddress } from '@/utils/truncate';

Expand All @@ -35,23 +34,6 @@ const CustomizedCardSection = styled(CardSection)<{ border?: boolean }>`

export const AddFundsSection = () => {
const [isAddFundsVisible, setIsAddFundsVisible] = useState(false);
const { masterSafeAddress } = useWallet();

const fundingAddress: Address | undefined = masterSafeAddress;

const truncatedFundingAddress: string | undefined = useMemo(
() => fundingAddress && truncateAddress(fundingAddress),
[fundingAddress],
);

const handleCopyAddress = useCallback(
() =>
fundingAddress &&
copyToClipboard(fundingAddress).then(() =>
message.success('Copied successfully!'),
),
[fundingAddress],
);

return (
<>
Expand All @@ -75,17 +57,36 @@ export const AddFundsSection = () => {
</Popover>
</CustomizedCardSection>

{isAddFundsVisible && (
<>
<AddFundsWarningAlertSection />
<AddFundsAddressSection
truncatedFundingAddress={truncatedFundingAddress}
fundingAddress={fundingAddress}
handleCopy={handleCopyAddress}
/>
<AddFundsGetTokensSection />
</>
)}
{isAddFundsVisible && <OpenAddFundsSection />}
</>
);
};

export const OpenAddFundsSection = () => {
const { masterSafeAddress } = useWallet();

const truncatedFundingAddress: string | undefined = useMemo(
() => masterSafeAddress && truncateAddress(masterSafeAddress),
[masterSafeAddress],
);

const handleCopyAddress = useCallback(
() =>
masterSafeAddress &&
copyToClipboard(masterSafeAddress).then(() =>
message.success('Copied successfully!'),
),
[masterSafeAddress],
);
return (
<>
<AddFundsWarningAlertSection />
<AddFundsAddressSection
truncatedFundingAddress={truncatedFundingAddress}
fundingAddress={masterSafeAddress}
handleCopy={handleCopyAddress}
/>
<AddFundsGetTokensSection />
</>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,35 @@ import { UNICODE_SYMBOLS } from '@/constants/symbols';
const { Text } = Typography;

export const AlertInsufficientMigrationFunds = ({
totalOlasBalance,
masterSafeOlasBalance,
stakedOlasBalance,
totalOlasRequiredForStaking,
}: {
totalOlasBalance: number;
}) => (
<CustomAlert
type="warning"
showIcon
message={
<Flex vertical gap={4}>
<Text className="font-weight-600">
Insufficient amount of funds to switch
</Text>
masterSafeOlasBalance: number;
stakedOlasBalance: number;
totalOlasRequiredForStaking: number;
}) => {
const requiredOlasDeposit =
totalOlasRequiredForStaking - (stakedOlasBalance + masterSafeOlasBalance);

<Text>Add funds to your account to meet the program requirements.</Text>
<Text>
Your current OLAS balance:{' '}
<span className="font-weight-600">{totalOlasBalance} OLAS</span>
</Text>
</Flex>
}
/>
);
return (
<CustomAlert
type="warning"
showIcon
message={
<Flex vertical gap={4}>
<Text className="font-weight-600">
An additional {requiredOlasDeposit} OLAS is required to switch
</Text>
<Text>
Add <strong>{requiredOlasDeposit} OLAS</strong> to your account to
meet the contract requirements and switch.
</Text>
</Flex>
}
/>
);
};

export const AlertNoSlots = () => (
<CustomAlert
Expand Down
Loading

0 comments on commit d158a63

Please sign in to comment.