Compare commits

..
55 changed files with 780 additions and 1689 deletions
+1
View File
@@ -33,4 +33,5 @@ jobs:
config: baseUrl=${{ github.event.inputs.url }}
env: grepTags=@live
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+1 -1
View File
@@ -66,7 +66,7 @@ jobs:
######
- name: Run Cypress tests
run: yarn nx run ${{ matrix.project }}:e2e ${{ env.SKIP_CACHE }} --browser chrome --env.grepTags="${{ inputs.tags }}"
run: yarn nx run ${{ matrix.project }}:e2e ${{ env.SKIP_CACHE }} --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --browser chrome --env.grepTags="${{ inputs.tags }}"
working-directory: frontend-monorepo
env:
CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }}
-51
View File
@@ -148,7 +148,6 @@ jobs:
ENV_NAME=${{ env.ENV_NAME }}
tags: |
vegaprotocol/${{ matrix.app }}:${{ github.ref_name }}
vegaprotocol/${{ matrix.app }}:mainnet
# bucket creation in github.com/vegaprotocol/terraform//frontend
- name: Publish dist to s3
@@ -175,53 +174,3 @@ jobs:
if: ${{ matrix.app == 'trading' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
with:
files: ${{ matrix.app }}-ipfs-hash
- name: Trigger fleek deployment
if: ${{ matrix.app == 'trading' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
run: |
# display info about app
curl -H "Authorization: ${{ secrets.FLEEK_API_KEY }}" \
-H "Content-Type: application/json" \
-d '{"query": "query{getSiteById(siteId:\"f8f2e051-f18e-49e6-b876-0a39369dc0d8\"){id latestDeploy{id status}}}"}' \
https://api.fleek.co/graphql
# trigger new deployment as base image is always set to vegaprotocol/trading:mainnet
curl -H "Authorization: ${{ secrets.FLEEK_API_KEY }}" \
-H "Content-Type: application/json" \
-d '{"query": "mutation{triggerDeploy(siteId:\"f8f2e051-f18e-49e6-b876-0a39369dc0d8\"){id status}}"}' \
https://api.fleek.co/graphql
- name: Checkout vega.xyz
if: ${{ matrix.app == 'trading' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
uses: actions/checkout@v3
with:
repository: vegaprotocol/vega.xyz
path: './vega-xyz'
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
- name: Update hash on interstitial page
if: ${{ matrix.app == 'trading' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
env:
GH_TOKEN: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
run: |
curl -L https://dist.ipfs.tech/kubo/v0.20.0/kubo_v0.20.0_linux-amd64.tar.gz -o kubo.tgz
tar -xzf kubo.tgz
export PATH="$PATH:$PWD/kubo"
which ipfs
new_hash=$(cat ${{ matrix.app }}-ipfs-hash)
cd vega-xyz
./interstital-allow-update.sh ${new_hash}
git config --global user.email "vega-ci-bot@vega.xyz"
git config --global user.name "vega-ci-bot"
git add interstitial-allow.json netlify.toml
commit_msg="feat(ci): Update CID for console release @ ${{ github.ref }}"
git commit -m "${commit_msg}"
git push origin main
# branch_name=${{ github.ref_name }}-hash-update
# git checkout -b "${branch_name}"
# git add interstitial-allow.json netlify.toml
# git push -u origin "${branch_name}"
# pr_url="$(gh pr create --title "${commit_msg}" --body 'update ipfs hash for console @ ${{ github.ref }}')"
# echo $pr_url
# gh pr merge --admin --auto $pr_url
+1 -1
View File
@@ -11,7 +11,7 @@ recalculate-ipfs:
echo "ipfs hash inside the image"
docker run --rm ${TAG} cat /ipfs-hash
echo "recalculating ipfs hash"
docker run --rm ${TAG} ipfs add -r /usr/share/nginx/html
docker run --rm ${TAG} ipfs add -rw /usr/share/nginx/html
.PHONY: eject-ipfs-hash
unpack:
@@ -1,5 +1,3 @@
import { Icon } from '@vegaprotocol/ui-toolkit';
// https://github.com/vegaprotocol/vega/blob/develop/core/blockchain/response.go
export const ErrorCodes = new Map([
[51, 'Transaction failed validation'],
@@ -30,11 +28,7 @@ export const ChainResponseCode = ({
}: ChainResponseCodeProps) => {
const isSuccess = successCodes.has(code);
const icon = isSuccess ? (
<Icon name="tick-circle" className="fill-vega-green-550" />
) : (
<Icon name="cross" className="fill-vega-pink-550" />
);
const icon = isSuccess ? '✅' : '❌';
const label = ErrorCodes.get(code) || 'Unknown response code';
// Hack for batches with many errors - see https://github.com/vegaprotocol/vega/issues/7245
@@ -42,7 +36,7 @@ export const ChainResponseCode = ({
error && error.length > 100 ? error.replace(/,/g, ',\r\n') : error;
return (
<div title={`Response code: ${code} - ${label}`} className=" inline-block">
<div title={`Response code: ${code} - ${label}`} className="inline-block">
<span
className="mr-2"
aria-label={isSuccess ? 'Success' : 'Warning'}
@@ -4,7 +4,6 @@ import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint
import { TxDetailsShared } from './shared/tx-details-shared';
import { TableCell, TableRow, TableWithTbody } from '../../table';
import ProposalLink from '../../links/proposal-link/proposal-link';
import { VoteIcon } from '../../vote-icon/vote-icon';
interface TxProposalVoteProps {
txData: BlockExplorerTransactionResult | undefined;
@@ -31,22 +30,27 @@ export const TxProposalVote = ({
return <>{t('Awaiting Block Explorer transaction details')}</>;
}
const vote = txData.command.voteSubmission.value === 'VALUE_YES';
const vote = txData.command.voteSubmission.value ? '👍' : '👎';
return (
<TableWithTbody className="mb-8" allowWrap={true}>
<TxDetailsShared txData={txData} pubKey={pubKey} blockData={blockData} />
<TableRow modifier="bordered">
<TableCell>{t('Proposal ID')}</TableCell>
<TableCell>{txData.command.voteSubmission.proposalId}</TableCell>
</TableRow>
<TableRow modifier="bordered">
<TableCell>{t('Proposal details')}</TableCell>
<TableCell>
<ProposalLink id={txData.command.voteSubmission.proposalId} />
</TableCell>
</TableRow>
<TableRow modifier="bordered">
<TableCell>{t('Proposal')}</TableCell>
<TableCell>{txData.command.voteSubmission.proposalId}</TableCell>
</TableRow>
<TableRow modifier="bordered">
<TableCell>{t('Vote')}</TableCell>
<TableCell>
<VoteIcon vote={vote} />
</TableCell>
<TableCell>{vote}</TableCell>
</TableRow>
</TableWithTbody>
);
@@ -1,6 +1,5 @@
import { t } from '@vegaprotocol/i18n';
import type { components } from '../../../types/explorer';
import { VoteIcon } from '../vote-icon/vote-icon';
interface TxOrderTypeProps {
orderType: string;
@@ -138,15 +137,12 @@ export const TxOrderType = ({ orderType, command }: TxOrderTypeProps) => {
let type = displayString[orderType] || orderType;
let colours =
'text-white dark:text-white bg-vega-dark-150 dark:bg-vega-dark-250';
'text-white dark:text-white bg-vega-dark-150 dark:bg-vega-dark-150';
// This will get unwieldy and should probably produce a different colour of tag
if (type === 'Chain Event' && !!command?.chainEvent) {
type = getLabelForChainEvent(command.chainEvent);
colours = 'text-white dark-text-white bg-vega-pink dark:bg-vega-pink';
} else if (type === 'Validator Heartbeat') {
colours =
'text-white dark-text-white bg-vega-light-200 dark:bg-vega-dark-100';
} else if (type === 'Proposal' || type === 'Governance Proposal') {
if (command && !!command.proposalSubmission) {
type = getLabelForProposal(command.proposalSubmission);
@@ -154,16 +150,6 @@ export const TxOrderType = ({ orderType, command }: TxOrderTypeProps) => {
colours = 'text-black bg-vega-yellow';
}
if (type === 'Vote on Proposal') {
return (
<VoteIcon
vote={command?.voteSubmission?.value === 'VALUE_YES'}
yesText="Proposal vote"
noText="Proposal vote"
/>
);
}
if (type === 'Vote on Proposal' || type === 'Vote Submission') {
colours = 'text-black bg-vega-yellow';
}
@@ -98,6 +98,6 @@ describe('Txs infinite list item', () => {
expect(screen.getByTestId('pub-key')).toHaveTextContent('testPubKey');
expect(screen.getByTestId('tx-type')).toHaveTextContent('testType');
expect(screen.getByTestId('tx-block')).toHaveTextContent('1');
expect(screen.getByTestId('tx-success')).toHaveTextContent('Success');
expect(screen.getByTestId('tx-success')).toHaveTextContent('Success: ✅');
});
});
@@ -31,7 +31,7 @@ export const TxsInfiniteListItem = ({
return (
<div
data-testid="transaction-row"
className="flex items-center h-full border-t border-neutral-600 dark:border-neutral-800 txs-infinite-list-item grid grid-cols-10"
className="flex items-center h-full border-t border-neutral-600 dark:border-neutral-800 txs-infinite-list-item grid grid-cols-10 py-2"
>
<div
className="text-sm col-span-10 md:col-span-3 leading-none"
@@ -83,7 +83,7 @@ export const TxsInfiniteListItem = ({
data-testid="tx-success"
>
<span className="md:hidden uppercase text-vega-dark-300">
Success&nbsp;
Success:&nbsp;
</span>
{isNumber(code) ? (
<ChainResponseCode code={code} hideLabel={true} />
@@ -1,37 +0,0 @@
import { render } from '@testing-library/react';
import { VoteIcon } from './vote-icon';
describe('Vote TX icon', () => {
it('should use the text For by default for yes votes', () => {
const yes = render(<VoteIcon vote={true} />);
expect(yes.getByTestId('label')).toHaveTextContent('For');
});
it('should use the yesText for yes votes if specified', () => {
const yes = render(<VoteIcon vote={true} yesText="Test" />);
expect(yes.getByTestId('label')).toHaveTextContent('Test');
});
it('should display the tick icon for yes votes', () => {
const no = render(<VoteIcon vote={true} />);
expect(no.getByRole('img')).toHaveAttribute(
'aria-label',
'tick-circle icon'
);
});
it('should use the text Against by default for no votes', () => {
const no = render(<VoteIcon vote={false} />);
expect(no.getByTestId('label')).toHaveTextContent('Against');
});
it('should use the noText for no votes if specified', () => {
const no = render(<VoteIcon vote={false} noText="Test" />);
expect(no.getByTestId('label')).toHaveTextContent('Test');
});
it('should display the delete icon for no votes', () => {
const no = render(<VoteIcon vote={false} />);
expect(no.getByRole('img')).toHaveAttribute('aria-label', 'delete icon');
});
});
@@ -1,40 +0,0 @@
import { Icon } from '@vegaprotocol/ui-toolkit';
import type { IconName } from '@vegaprotocol/ui-toolkit';
export interface VoteIconProps {
// True is a yes vote, false is undefined or no vorte
vote: boolean;
// Defaults to 'For', but can be any text
yesText?: string;
// Defaults to 'Against', but can be any text
noText?: string;
}
/**
* Displays a lozenge with an icon representing the way a user voted for a proposal.
* The yes and no text can be overridden
*
* @returns
*/
export function VoteIcon({
vote,
yesText = 'For',
noText = 'Against',
}: VoteIconProps) {
const label = vote ? yesText : noText;
const bg = vote ? 'bg-vega-green-550' : 'bg-vega-pink-550';
const icon: IconName = vote ? 'tick-circle' : 'delete';
const fill = vote ? 'vega-green-300' : 'vega-pink-300';
const text = vote ? 'vega-green-200' : 'vega-pink-200';
return (
<div
className={`voteicon inline-block my-1 py-1 px-2 py rounded-md text-white leading-one sm align-top ${bg}`}
>
<Icon name={icon} size={3} className={`mr-2 p-0 fill-${fill}`} />
<span className={`text-base text-${text}`} data-testid="label">
{label}
</span>
</div>
);
}
-4
View File
@@ -60,7 +60,3 @@
--ag-row-hover-color: theme(colors.neutral[800]);
--ag-font-size: 12px;
}
.voteicon svg {
vertical-align: baseline;
}
@@ -57,6 +57,7 @@ context(
// 2001-STKE-002, 2001-STKE-032
before('visit staking tab and connect vega wallet', function () {
cy.visit('/');
cy.validatorsSelfDelegate();
ethereumWalletConnect();
// this is a workaround for #2422 which can be removed once issue is resolved
cy.associateTokensToVegaWallet('4');
@@ -109,7 +109,7 @@ context(
);
cy.getByTestId('protocol-upgrade-proposal-status').should(
'have.text',
'Approved by validators '
'Approved '
);
});
});
@@ -136,7 +136,7 @@ context(
);
cy.getByTestId('protocol-upgrade-state').should(
'have.text',
'Approved by validators'
'Approved'
);
cy.getByTestId('protocol-upgrade-release-tag').should(
'have.text',
@@ -31,6 +31,9 @@ const totalPenaltyToolTip = '[data-testid="total-penalty-tooltip"]';
const epochCountDown = '[data-testid="epoch-countdown"]';
const stakeNumberRegex = /^\d{1,3}(,\d{3})*(\.\d+)?$/;
// If running locally, validators need to have self-stake to be displayed
// Run cy.validatorsSelfDelegate() in before hook
context('Validators Page - verify elements on page', function () {
before('navigate to validators page', function () {
cy.visit('/validators');
-2
View File
@@ -33,6 +33,4 @@ before(() => {
aliasGQLQuery(req, 'ChainId', chainIdQuery());
aliasGQLQuery(req, 'Statistics', statisticsQuery());
});
// Self stake validators so they are displayed
cy.validatorsSelfDelegate();
});
@@ -3,6 +3,7 @@ import {
StakingBridge,
Token,
TokenVesting,
TokenFaucetable,
CollateralBridge,
} from '@vegaprotocol/smart-contracts';
import { ethers, Wallet } from 'ethers';
@@ -40,7 +41,7 @@ export async function depositAsset(
decimalPlaces: number
) {
// Approve asset
const faucet = new Token(assetEthAddress, signer);
const faucet = new TokenFaucetable(assetEthAddress, signer);
cy.wrap(
faucet.approve(Erc20BridgeAddress, amount + '0'.repeat(decimalPlaces + 1)),
{
@@ -61,7 +62,7 @@ export async function depositAsset(
}
export async function faucetAsset(assetEthAddress: string) {
const faucet = new Token(assetEthAddress, signer);
const faucet = new TokenFaucetable(assetEthAddress, signer);
await promiseWithTimeout(faucet.faucet(), 10 * 60 * 1000, 'faucet asset');
}
+12 -39
View File
@@ -2,6 +2,7 @@ import './i18n';
import React, { useEffect } from 'react';
import * as Sentry from '@sentry/react';
import { Integrations } from '@sentry/tracing';
import { BrowserRouter as Router, useLocation } from 'react-router-dom';
import { AppLoader } from './app-loader';
import { NetworkInfo } from '@vegaprotocol/network-info';
@@ -183,10 +184,6 @@ const ScrollToTop = () => {
return null;
};
const removeQueryParams = (url: string) => {
return url.split('?')[0];
};
const AppContainer = () => {
const { config, loading, error } = useEthereumConfig();
const {
@@ -207,46 +204,22 @@ const AppContainer = () => {
if (ENV.dsn && telemetryOn) {
Sentry.init({
dsn: ENV.dsn,
integrations: [new Integrations.BrowserTracing()],
tracesSampleRate: 0.1,
enabled: true,
environment: VEGA_ENV,
release: GIT_COMMIT_HASH,
beforeSend(event) {
const requestUrl = event.request?.url;
const transaction = event.transaction;
const updatedRequest =
requestUrl && requestUrl.includes('/test?')
? { ...event.request, url: removeQueryParams(requestUrl) }
: event.request;
const updatedTransaction =
transaction && transaction.includes('/test?')
? removeQueryParams(transaction)
: transaction;
const updatedBreadcrumbs = event.breadcrumbs?.map((breadcrumb) => {
if (
breadcrumb.type === 'navigation' &&
breadcrumb.data?.to?.includes('/test?')
) {
return {
...breadcrumb,
data: {
...breadcrumb.data,
to: removeQueryParams(breadcrumb.data.to),
},
};
}
return breadcrumb;
});
return {
...event,
request: updatedRequest,
transaction: updatedTransaction,
breadcrumbs: updatedBreadcrumbs ?? event.breadcrumbs,
};
if (event.request?.url?.includes('/claim?')) {
return {
...event,
request: {
...event.request,
url: event.request?.url.split('?')[0],
},
};
}
return event;
},
});
Sentry.setTag('branch', GIT_BRANCH);
@@ -202,7 +202,6 @@
"tokenVotes": "Token votes",
"liquidityVotes": "Liquidity votes",
"castYourVote": "Cast your vote",
"yourVote": "Your vote",
"for": "For",
"against": "Against",
"majorityRequired": "Majority Required",
@@ -788,9 +787,9 @@
"homeVegaTokenButtonText": "Manage tokens",
"downloadProposalJson": "Download proposal as JSON",
"networkUpgrade": "Network Upgrade",
"PROTOCOL_UPGRADE_PROPOSAL_STATUS_APPROVED": "Approved by validators",
"PROTOCOL_UPGRADE_PROPOSAL_STATUS_PENDING": "Waiting for validator votes",
"PROTOCOL_UPGRADE_PROPOSAL_STATUS_REJECTED": "Declined by validators",
"PROTOCOL_UPGRADE_PROPOSAL_STATUS_APPROVED": "Approved",
"PROTOCOL_UPGRADE_PROPOSAL_STATUS_PENDING": "Pending",
"PROTOCOL_UPGRADE_PROPOSAL_STATUS_REJECTED": "Rejected",
"PROTOCOL_UPGRADE_PROPOSAL_STATUS_UNSPECIFIED": "Unspecified",
"vegaRelease{release}": "Vega Release {{release}}",
"upgradeBlockHeight": "Upgrade block height",
@@ -50,22 +50,7 @@ export const useTranches = create<TranchesStore>()((set) => ({
?.map((t) => {
const tranche_progress =
t.duration !== 0 ? (now - t.cliff_start) / t.duration : 0;
let lockedDecimal;
if (t.duration !== 0) {
if (tranche_progress < 0) {
lockedDecimal = 1;
} else {
lockedDecimal = 1 - tranche_progress;
}
} else {
if (now < t.cliff_start) {
lockedDecimal = 1;
} else {
lockedDecimal = 0;
}
}
const clampedLockedDecimal = Math.max(0, Math.min(1, lockedDecimal));
const lockedDecimal = tranche_progress < 0 ? 1 : 1 - tranche_progress;
return {
tranche_id: t.tranche_id,
tranche_start: secondsToDate(t.cliff_start),
@@ -75,7 +60,7 @@ export const useTranches = create<TranchesStore>()((set) => ({
toBigNum(t.current_balance, decimals)
),
locked_amount: toBigNum(t.initial_balance, decimals).times(
clampedLockedDecimal
lockedDecimal
),
users: t.users,
};
@@ -24,6 +24,7 @@ const openProposalClosesNextMonth = generateProposal({
},
terms: {
closingDatetime: nextMonth.toString(),
enactmentDatetime: nextMonth.toString(),
},
});
@@ -35,6 +36,7 @@ const openProposalClosesNextWeek = generateProposal({
},
terms: {
closingDatetime: nextWeek.toString(),
enactmentDatetime: nextWeek.toString(),
},
});
@@ -43,6 +45,7 @@ const enactedProposalClosedLastWeek = generateProposal({
state: ProposalState.STATE_ENACTED,
terms: {
closingDatetime: lastWeek.toString(),
enactmentDatetime: lastWeek.toString(),
},
});
@@ -51,6 +54,7 @@ const failedProposalClosedLastMonth = generateProposal({
state: ProposalState.STATE_FAILED,
terms: {
closingDatetime: lastMonth.toString(),
enactmentDatetime: lastMonth.toString(),
},
});
@@ -32,9 +32,7 @@ describe('ProtocolUpgradeProposalDetailInfo', () => {
it('should render the state', () => {
const { getByTestId } = renderComponent();
expect(getByTestId('protocol-upgrade-state')).toHaveTextContent(
'Waiting for validator votes'
);
expect(getByTestId('protocol-upgrade-state')).toHaveTextContent('Pending');
});
it('should render the vega release tag', () => {
@@ -26,34 +26,28 @@ describe('ProtocolUpgradeProposalsListItem', () => {
status:
ProtocolUpgradeProposalStatus.PROTOCOL_UPGRADE_PROPOSAL_STATUS_REJECTED,
icon: 'protocol-upgrade-proposal-status-icon-rejected',
text: 'Declined by validators',
},
{
status:
ProtocolUpgradeProposalStatus.PROTOCOL_UPGRADE_PROPOSAL_STATUS_PENDING,
icon: 'protocol-upgrade-proposal-status-icon-pending',
text: 'Waiting for validator votes',
},
{
status:
ProtocolUpgradeProposalStatus.PROTOCOL_UPGRADE_PROPOSAL_STATUS_APPROVED,
icon: 'protocol-upgrade-proposal-status-icon-approved',
text: 'Approved by validators',
},
{
status:
ProtocolUpgradeProposalStatus.PROTOCOL_UPGRADE_PROPOSAL_STATUS_UNSPECIFIED,
icon: 'protocol-upgrade-proposal-status-icon-unspecified',
text: 'Unspecified',
},
];
statuses.forEach(({ status, icon, text }) => {
statuses.forEach(({ status, icon }) => {
renderComponent({ ...proposal, status });
const statusIcon = screen.getByTestId(icon);
const textContent = screen.getByText(text);
expect(statusIcon).toBeInTheDocument();
expect(textContent).toBeInTheDocument();
});
});
@@ -111,9 +111,7 @@ describe('Vote buttons', () => {
</AppStateProvider>
);
expect(
screen.getByText(
'You need some VEGA tokens to participate in governance.'
)
screen.getByText('You need some VEGA tokens to participate in governance')
).toBeTruthy();
});
@@ -2,12 +2,7 @@ import { format } from 'date-fns';
import React, { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { useVegaWallet, useVegaWalletDialogStore } from '@vegaprotocol/wallet';
import {
AsyncRenderer,
Button,
ButtonLink,
ExternalLink,
} from '@vegaprotocol/ui-toolkit';
import { AsyncRenderer, Button, ButtonLink } from '@vegaprotocol/ui-toolkit';
import { addDecimal, toBigNum } from '@vegaprotocol/utils';
import { ProposalState, VoteValue } from '@vegaprotocol/types';
import {
@@ -166,12 +161,7 @@ export const VoteButtons = ({
{changeVote || (voteState === VoteState.NotCast && proposalVotable) ? (
<>
{currentStakeAvailable.isLessThanOrEqualTo(0) && (
<>
<p data-testid="no-stake-available">{t('noGovernanceTokens')}.</p>
<ExternalLink href="https://blog.vega.xyz/how-to-vote-on-vega-2195d1e52ec5">
{t('findOutMoreAboutHowToVote')}
</ExternalLink>
</>
<p data-testid="no-stake-available">{t('noGovernanceTokens')}</p>
)}
<div className="flex gap-4" data-testid="vote-buttons">
@@ -1,6 +1,6 @@
import { useTranslation } from 'react-i18next';
import { formatDistanceToNow } from 'date-fns';
import { RoundedWrapper, Icon, ExternalLink } from '@vegaprotocol/ui-toolkit';
import { RoundedWrapper, Icon } from '@vegaprotocol/ui-toolkit';
import { useVegaWallet } from '@vegaprotocol/wallet';
import { ProposalState } from '@vegaprotocol/types';
import { useVoteSubmit, VoteProgress } from '@vegaprotocol/proposals';
@@ -202,12 +202,7 @@ export const VoteDetails = ({
)}
<section className="mt-10">
{proposal?.state === ProposalState.STATE_OPEN ? (
<SubHeading title={t('castYourVote')} />
) : (
<SubHeading title={t('yourVote')} />
)}
<SubHeading title={t('castYourVote')} />
{pubKey ? (
proposal && (
<VoteButtonsContainer
@@ -229,9 +224,6 @@ export const VoteDetails = ({
<Icon name={'info-sign'} />
<div>{t('connectAVegaWalletToVote')}</div>
</div>
<ExternalLink href="https://blog.vega.xyz/how-to-vote-on-vega-2195d1e52ec5">
{t('findOutMoreAboutHowToVote')}
</ExternalLink>
</div>
<ConnectToVega />
</RoundedWrapper>
@@ -20,11 +20,8 @@ import { useProtocolUpgradeProposalsQuery } from '@vegaprotocol/proposals';
const orderByDate = (arr: ProposalFieldsFragment[]) =>
orderBy(
arr,
[
(p) => new Date(p?.terms?.closingDatetime).getTime(),
(p) => new Date(p?.datetime).getTime(),
],
['asc', 'asc']
[(p) => new Date(p?.terms?.closingDatetime).getTime(), (p) => p.id],
['desc', 'desc']
);
const orderByUpgradeBlockHeight = (
@@ -54,16 +54,22 @@ export const TrancheItem = ({
{formatNumber(total, 2)}
</span>
</div>
<div className="grid grid-cols-2 my-2">
<div>
<span>{t('Starts unlocking')}:</span>{' '}
<span>{format(tranche.tranche_start, DATE_FORMAT_LONG)}</span>
</div>
<div className="justify-self-end">
<span>{t('Fully unlocked')}:</span>{' '}
<span>{format(tranche.tranche_end, DATE_FORMAT_LONG)}</span>
</div>
</div>
<table className="w-full">
<tbody>
<tr>
<td>{t('Starts unlocking')}</td>
<td className="text-right">
{format(tranche.tranche_start, DATE_FORMAT_LONG)}
</td>
</tr>
<tr>
<td>{t('Fully unlocked')}</td>
<td className="text-right">
{format(tranche.tranche_end, DATE_FORMAT_LONG)}
</td>
</tr>
</tbody>
</table>
<LockedProgress
locked={locked}
unlocked={unlocked}
+69 -322
View File
@@ -1,37 +1,4 @@
[
{
"tranche_id": 59,
"tranche_start": "2024-05-01T00:00:00.000Z",
"tranche_end": "2024-11-01T00:00:00.000Z",
"total_added": "15000",
"total_removed": "0",
"locked_amount": "15000",
"deposits": [
{
"amount": "15000",
"user": "0xA530ac2B576eF27C09B7b55C83b3E163D167e9AE",
"tx": "0x90af73d7321833fc32445850655a1210f0298845b9222e695e1229801f7a95b0"
}
],
"withdrawals": [],
"users": [
{
"address": "0xA530ac2B576eF27C09B7b55C83b3E163D167e9AE",
"deposits": [
{
"amount": "15000",
"user": "0xA530ac2B576eF27C09B7b55C83b3E163D167e9AE",
"tranche_id": 59,
"tx": "0x90af73d7321833fc32445850655a1210f0298845b9222e695e1229801f7a95b0"
}
],
"withdrawals": [],
"total_tokens": "15000",
"withdrawn_tokens": "0",
"remaining_tokens": "15000"
}
]
},
{
"tranche_id": 58,
"tranche_start": "2023-05-11T00:00:00.000Z",
@@ -81,8 +48,8 @@
"tranche_start": "2023-04-20T00:00:00.000Z",
"tranche_end": "2023-05-20T00:00:00.000Z",
"total_added": "19242.125",
"total_removed": "2249.511113406525",
"locked_amount": "3199.3076512827919033125",
"total_removed": "1979.64045368475",
"locked_amount": "5608.9383879726076446",
"deposits": [
{
"amount": "188",
@@ -271,11 +238,6 @@
"user": "0xDd7a98557586ce21f770662319C2047C5a3bD605",
"tx": "0x47f5bf2c758c5270dd1b6519ac649ddabef8199f8a0bae319e36f8ac5c9c142e"
},
{
"amount": "269.870659721775",
"user": "0x1447Efc62d5077d7AbB20492dF831Dd6c9Eb1756",
"tx": "0x156ef84c345adecdf7b1c55756b1f4326716d1b0191ce1a208f614fc807ce033"
},
{
"amount": "202.093666077975",
"user": "0x1447Efc62d5077d7AbB20492dF831Dd6c9Eb1756",
@@ -349,12 +311,6 @@
}
],
"withdrawals": [
{
"amount": "269.870659721775",
"user": "0x1447Efc62d5077d7AbB20492dF831Dd6c9Eb1756",
"tranche_id": 56,
"tx": "0x156ef84c345adecdf7b1c55756b1f4326716d1b0191ce1a208f614fc807ce033"
},
{
"amount": "202.093666077975",
"user": "0x1447Efc62d5077d7AbB20492dF831Dd6c9Eb1756",
@@ -381,8 +337,8 @@
}
],
"total_tokens": "1207.5",
"withdrawn_tokens": "866.872728582",
"remaining_tokens": "340.627271418"
"withdrawn_tokens": "597.002068860225",
"remaining_tokens": "610.497931139775"
},
{
"address": "0x33Ce1D9E53AFb7367E34749517C086405a651a95",
@@ -943,7 +899,7 @@
"tranche_start": "2023-04-06T00:00:00.000Z",
"tranche_end": "2023-05-06T00:00:00.000Z",
"total_added": "14610",
"total_removed": "6918.45090157707",
"total_removed": "6675.45090157707",
"locked_amount": "0",
"deposits": [
{
@@ -1148,21 +1104,6 @@
"user": "0x2586bA83696a92b5467Aaa0CF9EEC052F28F2c02",
"tx": "0x5aa922056cad64f97a7dfa750da57d63abfdaea4499192d4d57958bfb4fba2ea"
},
{
"amount": "33",
"user": "0xBf1AaB792D729fA125e6D7122D4b916a1E1C44B1",
"tx": "0xd2c2f11c150797924c49f6022957d701052268c7335ef3927597fca4f1b544a2"
},
{
"amount": "114",
"user": "0x8D416A61bCccf4E6aF5598302BC4e41f97401652",
"tx": "0x619088e473d63826e10d3516619b505cb0a82884a5b8158146ff8ab79307967d"
},
{
"amount": "96",
"user": "0x6324334064d1d807940191C658d925DA7d323b12",
"tx": "0xd4d9926de15e6dc4992c47e9fbb9d25bf873d7e331524994bb6139a2953ea96a"
},
{
"amount": "106.53500000286",
"user": "0x6F32AA5A6198329c16e438512F992a0548C856f9",
@@ -1308,17 +1249,10 @@
"tx": "0xc7736d362d5ffdd16dc26f25047f52fa6238f60837e831b149b6ebb25a0d9281"
}
],
"withdrawals": [
{
"amount": "33",
"user": "0xBf1AaB792D729fA125e6D7122D4b916a1E1C44B1",
"tranche_id": 54,
"tx": "0xd2c2f11c150797924c49f6022957d701052268c7335ef3927597fca4f1b544a2"
}
],
"withdrawals": [],
"total_tokens": "33",
"withdrawn_tokens": "33",
"remaining_tokens": "0"
"withdrawn_tokens": "0",
"remaining_tokens": "33"
},
{
"address": "0xB0Dbf35C0918536B62a2FbcCC852bCffDB41d6aF",
@@ -1465,17 +1399,10 @@
"tx": "0x96b16197328b59556848409bcc4ebf1f71648485fabedde2848461247aa4be32"
}
],
"withdrawals": [
{
"amount": "96",
"user": "0x6324334064d1d807940191C658d925DA7d323b12",
"tranche_id": 54,
"tx": "0xd4d9926de15e6dc4992c47e9fbb9d25bf873d7e331524994bb6139a2953ea96a"
}
],
"withdrawals": [],
"total_tokens": "96",
"withdrawn_tokens": "96",
"remaining_tokens": "0"
"withdrawn_tokens": "0",
"remaining_tokens": "96"
},
{
"address": "0x268070d5EEd5b24E34a5F4C17B5482178b18089D",
@@ -1646,17 +1573,10 @@
"tx": "0x09d7342bca4e0fdc9f5a40e18e402b0328991d0df5da17b834c67b149e270808"
}
],
"withdrawals": [
{
"amount": "114",
"user": "0x8D416A61bCccf4E6aF5598302BC4e41f97401652",
"tranche_id": 54,
"tx": "0x619088e473d63826e10d3516619b505cb0a82884a5b8158146ff8ab79307967d"
}
],
"withdrawals": [],
"total_tokens": "114",
"withdrawn_tokens": "114",
"remaining_tokens": "0"
"withdrawn_tokens": "0",
"remaining_tokens": "114"
},
{
"address": "0x9E53F72210479BF46aE7ABF77c48B0d611b3c3dB",
@@ -1940,7 +1860,7 @@
"tranche_start": "2023-03-06T00:00:00.000Z",
"tranche_end": "2023-04-06T00:00:00.000Z",
"total_added": "14099",
"total_removed": "4373.49002352036",
"total_removed": "3785.49002352036",
"locked_amount": "0",
"deposits": [
{
@@ -2710,16 +2630,6 @@
"user": "0x2a65Ae527C6Ff4665e048B0E0883c486A7BA4DBc",
"tx": "0xb0edcc25e422bc3db3ad8027dfdfc0928abd7a8af8957a1699e4cf2dc8cee8f7"
},
{
"amount": "558",
"user": "0xA7f89FF809549F4577993de3d1B3017241a53F40",
"tx": "0x84e5ff587c312b578fa946e2dce386cdf19c7638602b12eceaaab7de563f8394"
},
{
"amount": "30",
"user": "0x8D416A61bCccf4E6aF5598302BC4e41f97401652",
"tx": "0x6a6dc596ec40beefbe40b32666cbef8ea31d1ce73c0c11f57a1e60f9ea242b8d"
},
{
"amount": "30",
"user": "0xBe9F912Ad481C61B653463E8F1D2b2b310D49861",
@@ -3951,17 +3861,10 @@
"tx": "0xecbb3424e425019a8ebdb9326f662c3520f220fbecdfdaa4770c282001a0f5eb"
}
],
"withdrawals": [
{
"amount": "30",
"user": "0x8D416A61bCccf4E6aF5598302BC4e41f97401652",
"tranche_id": 53,
"tx": "0x6a6dc596ec40beefbe40b32666cbef8ea31d1ce73c0c11f57a1e60f9ea242b8d"
}
],
"withdrawals": [],
"total_tokens": "30",
"withdrawn_tokens": "30",
"remaining_tokens": "0"
"withdrawn_tokens": "0",
"remaining_tokens": "30"
},
{
"address": "0x83D7eD53E7CB97b542F1F71f40561d51F8019C8B",
@@ -4543,17 +4446,10 @@
"tx": "0x46d80a145d2f49ef3152cbfaa6d2bb054deabe21396ab43553a3f076e2db62e1"
}
],
"withdrawals": [
{
"amount": "558",
"user": "0xA7f89FF809549F4577993de3d1B3017241a53F40",
"tranche_id": 53,
"tx": "0x84e5ff587c312b578fa946e2dce386cdf19c7638602b12eceaaab7de563f8394"
}
],
"withdrawals": [],
"total_tokens": "558",
"withdrawn_tokens": "558",
"remaining_tokens": "0"
"withdrawn_tokens": "0",
"remaining_tokens": "558"
},
{
"address": "0x363D3d06d70761c34D6EfEB25E409A9549E6970D",
@@ -5011,7 +4907,7 @@
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "86666.297",
"total_removed": "0",
"locked_amount": "48435.2942072747597588603",
"locked_amount": "49327.3172923405910546417",
"deposits": [
{
"amount": "86666.297",
@@ -5077,7 +4973,7 @@
"tranche_end": "2023-06-01T00:00:00.000Z",
"total_added": "2500",
"total_removed": "0",
"locked_amount": "233.35129858567365",
"locked_amount": "284.955770502645375",
"deposits": [
{
"amount": "2500",
@@ -5110,7 +5006,7 @@
"tranche_end": "2023-11-01T00:00:00.000Z",
"total_added": "15000.000000000000015",
"total_removed": "0",
"locked_amount": "13857.715315519323013857715315519323",
"locked_amount": "14163.9766379830905141639766379830905",
"deposits": [
{
"amount": "1.5e-14",
@@ -5152,15 +5048,10 @@
"tranche_id": 46,
"tranche_start": "2023-11-01T00:00:00.000Z",
"tranche_end": "2024-05-01T00:00:00.000Z",
"total_added": "22500",
"total_added": "7500",
"total_removed": "0",
"locked_amount": "22500",
"locked_amount": "7500",
"deposits": [
{
"amount": "15000",
"user": "0x2539b51EbDE65a75672aBcfE9439a706a99D18D1",
"tx": "0x959f5eed214f5376e834c2c20ed2a23a75c4465240c2776452ade80afa11ae2e"
},
{
"amount": "7500",
"user": "0xA530ac2B576eF27C09B7b55C83b3E163D167e9AE",
@@ -5169,21 +5060,6 @@
],
"withdrawals": [],
"users": [
{
"address": "0x2539b51EbDE65a75672aBcfE9439a706a99D18D1",
"deposits": [
{
"amount": "15000",
"user": "0x2539b51EbDE65a75672aBcfE9439a706a99D18D1",
"tranche_id": 46,
"tx": "0x959f5eed214f5376e834c2c20ed2a23a75c4465240c2776452ade80afa11ae2e"
}
],
"withdrawals": [],
"total_tokens": "15000",
"withdrawn_tokens": "0",
"remaining_tokens": "15000"
},
{
"address": "0xA530ac2B576eF27C09B7b55C83b3E163D167e9AE",
"deposits": [
@@ -5218,7 +5094,7 @@
"tranche_end": "2023-09-01T00:00:00.000Z",
"total_added": "17500",
"total_removed": "0",
"locked_amount": "10365.7040999899345",
"locked_amount": "10723.00897619766325",
"deposits": [
{
"amount": "12500",
@@ -5485,7 +5361,7 @@
"tranche_end": "2023-08-01T00:00:00.000Z",
"total_added": "37500",
"total_removed": "18302.01762945",
"locked_amount": "16157.7295311540825",
"locked_amount": "16936.07322360343725",
"deposits": [
{
"amount": "7500",
@@ -5915,7 +5791,7 @@
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "129999.45",
"total_removed": "0",
"locked_amount": "48391.1030956730271686715",
"locked_amount": "49282.312321912380332265",
"deposits": [
{
"amount": "129999.45",
@@ -5948,7 +5824,7 @@
"tranche_end": "2024-04-01T00:00:00.000Z",
"total_added": "54144.7663",
"total_removed": "0",
"locked_amount": "47633.78041726290106106372",
"locked_amount": "48189.54915726316779685587",
"deposits": [
{
"amount": "54144.7663",
@@ -5981,7 +5857,7 @@
"tranche_end": "2023-09-03T00:00:00.000Z",
"total_added": "62600",
"total_removed": "0",
"locked_amount": "19035.19782470827248",
"locked_amount": "19679.51570903094634",
"deposits": [
{
"amount": "10000",
@@ -6174,7 +6050,7 @@
"tranche_end": "2023-09-17T00:00:00.000Z",
"total_added": "5000",
"total_removed": "0",
"locked_amount": "1712.164034753932",
"locked_amount": "1763.627124556063",
"deposits": [
{
"amount": "5000",
@@ -7243,7 +7119,7 @@
"tranche_end": "2023-06-02T00:00:00.000Z",
"total_added": "1939928.38",
"total_removed": "1709370.7872515768348",
"locked_amount": "95603.78713182322084178028",
"locked_amount": "115570.728817751808474185",
"deposits": [
{
"amount": "1852091.69",
@@ -41115,7 +40991,7 @@
"tranche_end": "2023-06-05T00:00:00.000Z",
"total_added": "3732368.4671",
"total_removed": "715655.108029600523393",
"locked_amount": "171411.0598475595488585533025",
"locked_amount": "202093.2974680882797136777084",
"deposits": [
{
"amount": "1998.95815",
@@ -42507,8 +42383,8 @@
"tranche_start": "2022-06-05T00:00:00.000Z",
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "15870102.715470999700000001",
"total_removed": "882197.30251812695176852",
"locked_amount": "5907500.19821835867969082523486646844714787",
"total_removed": "873375.18460711694221852",
"locked_amount": "6016297.4428328087189762607645230040375777",
"deposits": [
{
"amount": "16249.93",
@@ -43027,16 +42903,6 @@
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tx": "0x989d22d5ba66353cb132b5643100a99e78133e5d40aef1ac91ed6ab0a2290299"
},
{
"amount": "2195.39447101000955",
"user": "0xe3eB4CF43C072658401996b71D43eE26E573562D",
"tx": "0xa515dafd399b366ba7f510ea6314587eb19e83fa92dbd5c2a212f3541a0cc4ef"
},
{
"amount": "6626.72344",
"user": "0xF4c75FdbAe821C6B5DBB9f001bB23cBA58D1bA37",
"tx": "0xdedcbf90e8f19c2a732ba2da663f59b5a19ad94800ddca6a3575019f19e9ca20"
},
{
"amount": "10150.87581603206683",
"user": "0xe3eB4CF43C072658401996b71D43eE26E573562D",
@@ -47007,12 +46873,6 @@
}
],
"withdrawals": [
{
"amount": "2195.39447101000955",
"user": "0xe3eB4CF43C072658401996b71D43eE26E573562D",
"tranche_id": 2,
"tx": "0xa515dafd399b366ba7f510ea6314587eb19e83fa92dbd5c2a212f3541a0cc4ef"
},
{
"amount": "10150.87581603206683",
"user": "0xe3eB4CF43C072658401996b71D43eE26E573562D",
@@ -47303,8 +47163,8 @@
}
],
"total_tokens": "150551.801",
"withdrawn_tokens": "93772.59940382165655",
"remaining_tokens": "56779.20159617834345"
"withdrawn_tokens": "91577.204932811647",
"remaining_tokens": "58974.596067188353"
},
{
"address": "0x4d982Ab0823fD2f48e934a7be2bb0a5374a26148",
@@ -47524,12 +47384,6 @@
}
],
"withdrawals": [
{
"amount": "6626.72344",
"user": "0xF4c75FdbAe821C6B5DBB9f001bB23cBA58D1bA37",
"tranche_id": 2,
"tx": "0xdedcbf90e8f19c2a732ba2da663f59b5a19ad94800ddca6a3575019f19e9ca20"
},
{
"amount": "1784.722222",
"user": "0xF4c75FdbAe821C6B5DBB9f001bB23cBA58D1bA37",
@@ -47790,8 +47644,8 @@
}
],
"total_tokens": "200000",
"withdrawn_tokens": "125368.96374",
"remaining_tokens": "74631.03626"
"withdrawn_tokens": "118742.2403",
"remaining_tokens": "81257.7597"
},
{
"address": "0x1b956E6c00E238194B331eddEFF72Cb5f28A8d01",
@@ -59316,8 +59170,8 @@
"tranche_start": "2022-06-05T00:00:00.000Z",
"tranche_end": "2023-06-05T00:00:00.000Z",
"total_added": "472355.6199999996",
"total_removed": "44796.7287294743416",
"locked_amount": "27161.0622602365460539456394114544",
"total_removed": "44544.1737890903416",
"locked_amount": "32022.838198356764871382775241",
"deposits": [
{
"amount": "3000",
@@ -65946,16 +65800,6 @@
"user": "0x3F9E884B459a6AaC3f66b72555611AdE68a7F472",
"tx": "0x4697229c7f272bd3fc06ecdc1b15143d28e20083e15f1b3cadb3fc80e80af180"
},
{
"amount": "186.817193048",
"user": "0x0003423D0A1858B6Eaf9a67914aBc67cDF989c2F",
"tx": "0x7f120bd664d54bdabddad1ddb7ffdd84fbaa2630f1657289e3a7b11503ec4018"
},
{
"amount": "65.737747336",
"user": "0xAc5bd5a3890B12B0da7cF1Ad846F6b8b260B60CC",
"tx": "0x8a4862b1fdacb7e24492397fac234152aae4146d9cca2f0a476e918cbe130af7"
},
{
"amount": "182.662252664",
"user": "0xb1169C6daAc76bAcaf0D8f87641Fc38fbabe569F",
@@ -71211,17 +71055,10 @@
"tx": "0x1c2c084e3efafb2ffa09c0b259bd229cce0d6da04dd092d911c7e6136a7ac8a9"
}
],
"withdrawals": [
{
"amount": "186.817193048",
"user": "0x0003423D0A1858B6Eaf9a67914aBc67cDF989c2F",
"tranche_id": 5,
"tx": "0x7f120bd664d54bdabddad1ddb7ffdd84fbaa2630f1657289e3a7b11503ec4018"
}
],
"withdrawals": [],
"total_tokens": "200",
"withdrawn_tokens": "186.817193048",
"remaining_tokens": "13.182806952"
"withdrawn_tokens": "0",
"remaining_tokens": "200"
},
{
"address": "0x659ce8E49DA0c872AAC44c70496122044CbcA911",
@@ -71542,12 +71379,6 @@
}
],
"withdrawals": [
{
"amount": "65.737747336",
"user": "0xAc5bd5a3890B12B0da7cF1Ad846F6b8b260B60CC",
"tranche_id": 5,
"tx": "0x8a4862b1fdacb7e24492397fac234152aae4146d9cca2f0a476e918cbe130af7"
},
{
"amount": "309.708054284",
"user": "0xAc5bd5a3890B12B0da7cF1Ad846F6b8b260B60CC",
@@ -71556,8 +71387,8 @@
}
],
"total_tokens": "400",
"withdrawn_tokens": "375.44580162",
"remaining_tokens": "24.55419838"
"withdrawn_tokens": "309.708054284",
"remaining_tokens": "90.291945716"
},
{
"address": "0x71bA18Cb18d7Cd338CF6E911882E717A8dEf8041",
@@ -89140,7 +88971,7 @@
"tranche_start": "2021-12-05T00:00:00.000Z",
"tranche_end": "2022-06-05T00:00:00.000Z",
"total_added": "171288.42",
"total_removed": "71890.5995794947989",
"total_removed": "70140.5995794947989",
"locked_amount": "0",
"deposits": [
{
@@ -93365,41 +93196,6 @@
}
],
"withdrawals": [
{
"amount": "250",
"user": "0xcAEbd70D80D5aB92Ae5A2E1c92F479298826548C",
"tx": "0x7ffbc82e96bb7c796feb548a7ca48a7430a47dae3f2e9de859e6d45ac31a4e6c"
},
{
"amount": "250",
"user": "0xac494D6eC2CcA7C9BD1caD0c1D0516F3706c6b7c",
"tx": "0x85a5d2a4faa6490fc25e080f09dc4d9b5fb3857d762042ba2dcbc0f04de41e0c"
},
{
"amount": "250",
"user": "0x4eE1C5ED78143f298ae4E5E17e538a99E8512db7",
"tx": "0xcb7b99dc5240cdcaaed2fae06e9fd8172db0387179fe09b5f1e1cefff16c6025"
},
{
"amount": "250",
"user": "0x01E41ffFBcBC9DDA6E2e9e7291cA8AcCE1AF2091",
"tx": "0x0af2b3703c268eed4532409b52b6fae066207adf80f9dd2fc17b7aacc40f2879"
},
{
"amount": "250",
"user": "0xa9C1CA1E66CB3063352433843521861844A2Fd33",
"tx": "0x8fad99b8976fff57a099e59351ae96379ec3041e32ccce144727eea29cfffe59"
},
{
"amount": "250",
"user": "0x13A01db15250975cE4f7AddF5C20CC1f5056Fc47",
"tx": "0xc4bcffd71245b9f2af79e04fd58740f7b4cce50da80a405403c959563d132f2c"
},
{
"amount": "250",
"user": "0x2A6Ea2aBEf3D7d7A76CBeF3c297eE0eF9a86BBA8",
"tx": "0x163b699e8a25073ad1ad45c8a8f9b1348eb0b648d3f4bc6f3f64648e0ad726bf"
},
{
"amount": "250",
"user": "0x0E3407C9A94effa675471afe7A9D37e687C32141",
@@ -95742,17 +95538,10 @@
"tx": "0x87b7e454992157e175f824cbd5cbfd068ce890b8603edcb70174bae9b5c4afc8"
}
],
"withdrawals": [
{
"amount": "250",
"user": "0x13A01db15250975cE4f7AddF5C20CC1f5056Fc47",
"tranche_id": 6,
"tx": "0xc4bcffd71245b9f2af79e04fd58740f7b4cce50da80a405403c959563d132f2c"
}
],
"withdrawals": [],
"total_tokens": "250",
"withdrawn_tokens": "250",
"remaining_tokens": "0"
"withdrawn_tokens": "0",
"remaining_tokens": "250"
},
{
"address": "0x7b4127D262acC0Ff3dB2D0521d1F1f3b602243C2",
@@ -98265,17 +98054,10 @@
"tx": "0x1c2c084e3efafb2ffa09c0b259bd229cce0d6da04dd092d911c7e6136a7ac8a9"
}
],
"withdrawals": [
{
"amount": "250",
"user": "0x4eE1C5ED78143f298ae4E5E17e538a99E8512db7",
"tranche_id": 6,
"tx": "0xcb7b99dc5240cdcaaed2fae06e9fd8172db0387179fe09b5f1e1cefff16c6025"
}
],
"withdrawals": [],
"total_tokens": "250",
"withdrawn_tokens": "250",
"remaining_tokens": "0"
"withdrawn_tokens": "0",
"remaining_tokens": "250"
},
{
"address": "0x1dC24e9601e40013a12CB9976a519860c4eDF359",
@@ -98317,17 +98099,10 @@
"tx": "0x1c2c084e3efafb2ffa09c0b259bd229cce0d6da04dd092d911c7e6136a7ac8a9"
}
],
"withdrawals": [
{
"amount": "250",
"user": "0x01E41ffFBcBC9DDA6E2e9e7291cA8AcCE1AF2091",
"tranche_id": 6,
"tx": "0x0af2b3703c268eed4532409b52b6fae066207adf80f9dd2fc17b7aacc40f2879"
}
],
"withdrawals": [],
"total_tokens": "250",
"withdrawn_tokens": "250",
"remaining_tokens": "0"
"withdrawn_tokens": "0",
"remaining_tokens": "250"
},
{
"address": "0x6EE016F4512C910b401B18087BBAC15412dD97cA",
@@ -98661,17 +98436,10 @@
"tx": "0x1c2c084e3efafb2ffa09c0b259bd229cce0d6da04dd092d911c7e6136a7ac8a9"
}
],
"withdrawals": [
{
"amount": "250",
"user": "0xac494D6eC2CcA7C9BD1caD0c1D0516F3706c6b7c",
"tranche_id": 6,
"tx": "0x85a5d2a4faa6490fc25e080f09dc4d9b5fb3857d762042ba2dcbc0f04de41e0c"
}
],
"withdrawals": [],
"total_tokens": "250",
"withdrawn_tokens": "250",
"remaining_tokens": "0"
"withdrawn_tokens": "0",
"remaining_tokens": "250"
},
{
"address": "0xa7137DA63B53138A6DCdC9D9a010F42F951F1113",
@@ -98713,17 +98481,10 @@
"tx": "0x1c2c084e3efafb2ffa09c0b259bd229cce0d6da04dd092d911c7e6136a7ac8a9"
}
],
"withdrawals": [
{
"amount": "250",
"user": "0xa9C1CA1E66CB3063352433843521861844A2Fd33",
"tranche_id": 6,
"tx": "0x8fad99b8976fff57a099e59351ae96379ec3041e32ccce144727eea29cfffe59"
}
],
"withdrawals": [],
"total_tokens": "250",
"withdrawn_tokens": "250",
"remaining_tokens": "0"
"withdrawn_tokens": "0",
"remaining_tokens": "250"
},
{
"address": "0xbCd93996629B0fFA1DfaE74Bb6e107ddB1CE7934",
@@ -98750,17 +98511,10 @@
"tx": "0x1c2c084e3efafb2ffa09c0b259bd229cce0d6da04dd092d911c7e6136a7ac8a9"
}
],
"withdrawals": [
{
"amount": "250",
"user": "0xcAEbd70D80D5aB92Ae5A2E1c92F479298826548C",
"tranche_id": 6,
"tx": "0x7ffbc82e96bb7c796feb548a7ca48a7430a47dae3f2e9de859e6d45ac31a4e6c"
}
],
"withdrawals": [],
"total_tokens": "250",
"withdrawn_tokens": "250",
"remaining_tokens": "0"
"withdrawn_tokens": "0",
"remaining_tokens": "250"
},
{
"address": "0x64Aac7Cb63317DE77C331686E0b2dAA41303Adf0",
@@ -98839,17 +98593,10 @@
"tx": "0x1c2c084e3efafb2ffa09c0b259bd229cce0d6da04dd092d911c7e6136a7ac8a9"
}
],
"withdrawals": [
{
"amount": "250",
"user": "0x2A6Ea2aBEf3D7d7A76CBeF3c297eE0eF9a86BBA8",
"tranche_id": 6,
"tx": "0x163b699e8a25073ad1ad45c8a8f9b1348eb0b648d3f4bc6f3f64648e0ad726bf"
}
],
"withdrawals": [],
"total_tokens": "250",
"withdrawn_tokens": "250",
"remaining_tokens": "0"
"withdrawn_tokens": "0",
"remaining_tokens": "250"
},
{
"address": "0x5D84C52FEf44a84298422f0F87147F80145e2043",
+6
View File
@@ -0,0 +1,6 @@
FROM --platform=amd64 nginx:1.23-alpine@sha256:6318314189b40e73145a48060bff4783a116c34cc7241532d0d94198fb2c9629
EXPOSE 80
WORKDIR /usr/share/nginx/html
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
RUN rm -rf /usr/share/nginx/html/*
COPY ./dist-result/ /usr/share/nginx/html/
+29
View File
@@ -0,0 +1,29 @@
# Build container
ARG NODE_VERSION
FROM --platform=amd64 node:${NODE_VERSION}-alpine3.16 as build
WORKDIR /app
# Argument to allow building of different apps
ARG APP
ARG ENV_NAME=""
RUN apk add --update --no-cache \
python3 \
make \
gcc \
g++
COPY . ./
RUN yarn --network-timeout 100000 --pure-lockfile
# work around for different build process in trading
RUN sh docker/docker-build.sh
# Server environment
# if this fails you need to docker pull nginx:1.23-alpine and pin new SHA
# this is to ensure that we run always same version of alpine to make sure ipfs is indempotent
FROM --platform=amd64 nginx:1.23-alpine@sha256:6318314189b40e73145a48060bff4783a116c34cc7241532d0d94198fb2c9629
# configuration of system
EXPOSE 80
# Copy dist
WORKDIR /usr/share/nginx/html
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
RUN rm -rf /usr/share/nginx/html/*
COPY --from=build /app/dist/apps/${APP}/* /usr/share/nginx/html
RUN apk add --no-cache go-ipfs; ipfs init && echo "$(ipfs add -rQ .)" > /ipfs-hash; apk del go-ipfs
+1 -1
View File
@@ -27,5 +27,5 @@ RUN rm -rf /usr/share/nginx/html/*
COPY --from=build /app/dist/apps/${APP}/* /usr/share/nginx/html
RUN apk add --no-cache go-ipfs==0.16.0-r6 \
&& ipfs init \
&& echo "$(ipfs add -rQ /usr/share/nginx/html)" > /ipfs-hash \
&& echo "$(ipfs add -rwQ /usr/share/nginx/html)" > /ipfs-hash \
&& echo "ipfs hash of this build: $(cat /ipfs-hash)"
+1 -1
View File
@@ -5,6 +5,6 @@ RUN rm -rf /usr/share/nginx/html/*
COPY ./dist-result/ /usr/share/nginx/html/
RUN apk add --no-cache go-ipfs==0.16.0-r6 \
&& ipfs init \
&& echo "$(ipfs add -rQ /usr/share/nginx/html)" > /ipfs-hash \
&& echo "$(ipfs add -rwQ /usr/share/nginx/html)" > /ipfs-hash \
&& echo "ipfs hash of this build: $(cat /ipfs-hash)"
@@ -1,6 +1,4 @@
import { gql } from 'graphql-request';
import { selfDelegate } from '../capsule/self-delegate';
import { requestGQL, setGraphQLEndpoint } from '../capsule/request';
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
@@ -21,143 +19,112 @@ export const addValidatorsSelfDelegate = () => {
vegaUrl: Cypress.env('VEGA_URL'),
faucetUrl: Cypress.env('FAUCET_URL'),
};
setGraphQLEndpoint(config.vegaUrl);
cy.wrap(getStakedByOperator()).as('selfStakeAmount');
cy.get('@selfStakeAmount').then((selfStakeAmount) => {
if (String(selfStakeAmount) == '0') {
// Get node wallet recovery phrases
cy.exec('vegacapsule nodes ls --home-path ~/.vegacapsule/testnet/')
.its('stdout')
.then((result) => {
const obj = JSON.parse(result);
console.log(obj);
cy.writeFile(
'./src/fixtures/wallet/node0RecoveryPhrase',
obj['testnet-nodeset-validators-0-validator'].Vega.NodeWalletInfo
.VegaWalletRecoveryPhrase
);
cy.writeFile(
'./src/fixtures/wallet/node1RecoveryPhrase',
obj['testnet-nodeset-validators-1-validator'].Vega.NodeWalletInfo
.VegaWalletRecoveryPhrase
);
cy.wrap(
obj['testnet-nodeset-validators-0-validator'].Vega.NodeWalletInfo
.VegaWalletPublicKey
).as('node0PubKey');
cy.wrap(
obj['testnet-nodeset-validators-1-validator'].Vega.NodeWalletInfo
.VegaWalletPublicKey
).as('node1PubKey');
cy.wrap(
obj['testnet-nodeset-validators-0-validator'].Vega.NodeWalletInfo
.VegaWalletID
).as('node0Id');
cy.wrap(
obj['testnet-nodeset-validators-1-validator'].Vega.NodeWalletInfo
.VegaWalletID
).as('node1Id');
});
// Import node wallets
cy.exec(
'vega wallet import -w node0_wallet --recovery-phrase-file ./src/fixtures/wallet/node0RecoveryPhrase -p ./src/fixtures/wallet/passphrase --home ~/.vegacapsule/testnet/wallet'
// Get node wallet recovery phrases
cy.exec('vegacapsule nodes ls --home-path ~/.vegacapsule/testnet/')
.its('stdout')
.then((result) => {
const obj = JSON.parse(result);
console.log(obj);
cy.writeFile(
'./src/fixtures/wallet/node0RecoveryPhrase',
obj['testnet-nodeset-validators-0-validator'].Vega.NodeWalletInfo
.VegaWalletRecoveryPhrase
);
cy.exec(
'vega wallet import -w node1_wallet --recovery-phrase-file ./src/fixtures/wallet/node1RecoveryPhrase -p ./src/fixtures/wallet/passphrase --home ~/.vegacapsule/testnet/wallet'
cy.writeFile(
'./src/fixtures/wallet/node1RecoveryPhrase',
obj['testnet-nodeset-validators-1-validator'].Vega.NodeWalletInfo
.VegaWalletRecoveryPhrase
);
cy.wrap(
obj['testnet-nodeset-validators-0-validator'].Vega.NodeWalletInfo
.VegaWalletPublicKey
).as('node0PubKey');
cy.wrap(
obj['testnet-nodeset-validators-1-validator'].Vega.NodeWalletInfo
.VegaWalletPublicKey
).as('node1PubKey');
// Initialise api token
cy.exec(
'vega wallet api-token init --home ~/.vegacapsule/testnet/wallet --passphrase-file ./src/fixtures/wallet/passphrase'
);
cy.wrap(
obj['testnet-nodeset-validators-0-validator'].Vega.NodeWalletInfo
.VegaWalletID
).as('node0Id');
cy.wrap(
obj['testnet-nodeset-validators-1-validator'].Vega.NodeWalletInfo
.VegaWalletID
).as('node1Id');
});
// Generate api tokens for wallets
cy.exec(
'vega wallet api-token generate --wallet-name node0_wallet --tokens-passphrase-file ./src/fixtures/wallet/passphrase --wallet-passphrase-file ./src/fixtures/wallet/passphrase --home ~/.vegacapsule/testnet/wallet'
)
.its('stdout')
.then((result) => {
const apiToken = result.match('[a-zA-Z0-9]{64}');
if (apiToken) {
cy.wrap(apiToken[0]).as('node0ApiToken');
}
});
// Import node wallets
cy.exec(
'vega wallet import -w node0_wallet --recovery-phrase-file ./src/fixtures/wallet/node0RecoveryPhrase -p ./src/fixtures/wallet/passphrase --home ~/.vegacapsule/testnet/wallet'
);
cy.exec(
'vega wallet import -w node1_wallet --recovery-phrase-file ./src/fixtures/wallet/node1RecoveryPhrase -p ./src/fixtures/wallet/passphrase --home ~/.vegacapsule/testnet/wallet'
);
cy.exec(
'vega wallet api-token generate --wallet-name node1_wallet --tokens-passphrase-file ./src/fixtures/wallet/passphrase --wallet-passphrase-file ./src/fixtures/wallet/passphrase --home ~/.vegacapsule/testnet/wallet'
)
.its('stdout')
.then((result) => {
const apiToken = result.match('[a-zA-Z0-9]{64}');
if (apiToken) {
cy.wrap(apiToken[0]).as('node1ApiToken');
}
});
// Initialise api token
cy.exec(
'vega wallet api-token init --home ~/.vegacapsule/testnet/wallet --passphrase-file ./src/fixtures/wallet/passphrase'
);
cy.updateCapsuleMultiSig();
cy.highlight('Validators self-delegating');
// Generate api tokens for wallets
cy.exec(
'vega wallet api-token generate --wallet-name node0_wallet --tokens-passphrase-file ./src/fixtures/wallet/passphrase --wallet-passphrase-file ./src/fixtures/wallet/passphrase --home ~/.vegacapsule/testnet/wallet'
)
.its('stdout')
.then((result) => {
const apiToken = result.match('[a-zA-Z0-9]{64}');
if (apiToken) {
cy.wrap(apiToken[0]).as('node0ApiToken');
}
});
// Self delegating Node 0 wallet
cy.get('@node0PubKey').then((node0PubKey) => {
cy.get('@node0ApiToken').then((node0ApiToken) => {
cy.get('@node0Id').then((node0Id) => {
cy.wrap(
selfDelegate(
config,
String(node0PubKey),
String(node0ApiToken),
String(node0Id)
),
{ timeout: 60000 }
);
// Self delegating Node 1 wallet
cy.get('@node1PubKey').then((node1PubKey) => {
cy.get('@node1ApiToken').then((node1ApiToken) => {
cy.get('@node1Id').then((node1Id) => {
cy.wrap(
selfDelegate(
config,
String(node1PubKey),
String(node1ApiToken),
String(node1Id)
),
{ timeout: 60000 }
);
});
});
cy.exec(
'vega wallet api-token generate --wallet-name node1_wallet --tokens-passphrase-file ./src/fixtures/wallet/passphrase --wallet-passphrase-file ./src/fixtures/wallet/passphrase --home ~/.vegacapsule/testnet/wallet'
)
.its('stdout')
.then((result) => {
const apiToken = result.match('[a-zA-Z0-9]{64}');
if (apiToken) {
cy.wrap(apiToken[0]).as('node1ApiToken');
}
});
cy.updateCapsuleMultiSig();
cy.highlight('Validators self-delegating');
// Self delegating Node 0 wallet
cy.get('@node0PubKey').then((node0PubKey) => {
cy.get('@node0ApiToken').then((node0ApiToken) => {
cy.get('@node0Id').then((node0Id) => {
cy.wrap(
selfDelegate(
config,
String(node0PubKey),
String(node0ApiToken),
String(node0Id)
),
{ timeout: 60000 }
);
// Self delegating Node 1 wallet
cy.get('@node1PubKey').then((node1PubKey) => {
cy.get('@node1ApiToken').then((node1ApiToken) => {
cy.get('@node1Id').then((node1Id) => {
cy.wrap(
selfDelegate(
config,
String(node1PubKey),
String(node1ApiToken),
String(node1Id)
),
{ timeout: 60000 }
);
});
});
});
});
}
});
});
});
};
async function getStakedByOperator() {
const query = gql`
query ExplorerNodes {
nodesConnection {
edges {
node {
stakedByOperator
}
}
}
}
`;
const res = await requestGQL<{
nodesConnection: {
edges: Array<{
node: {
stakedByOperator: string;
};
}>;
};
}>(query);
return res.nodesConnection.edges[0].node.stakedByOperator;
}
@@ -3,7 +3,6 @@ import { useMemo } from 'react';
import { useCallback } from 'react';
import { t } from '@vegaprotocol/i18n';
import * as Schema from '@vegaprotocol/types';
import { addDecimalsFormatNumber } from '@vegaprotocol/utils';
interface OrderTypeCellProps {
value?: Schema.OrderType;
@@ -24,15 +23,7 @@ export const OrderTypeCell = ({
}
if (!value) return '-';
if (order?.peggedOrder) {
const reference =
Schema.PeggedReferenceMapping[order.peggedOrder?.reference];
// the offset (e.g. + 0.001 for a Sell, or -1231.023 for a Buy)
const side = order.side === Schema.Side.SIDE_BUY ? '-' : '+';
const offset = addDecimalsFormatNumber(
order.peggedOrder?.offset,
order.market.decimalPlaces
);
return t('%s %s %s Peg limit', [reference, side, offset]);
return t('Pegged');
}
if (order?.liquidityProvision) {
return t('Liquidity provision');
+4 -1
View File
@@ -36,7 +36,10 @@ export const DepositManager = ({
const bridgeContract = useBridgeContract();
const closeDepositDialog = useDepositDialog((state) => state.close);
const { getBalances, reset, balances } = useDepositBalances(asset);
const { getBalances, reset, balances } = useDepositBalances(
asset,
isFaucetable
);
// Set up approve transaction
const approve = useSubmitApproval(asset, getBalances);
@@ -28,9 +28,13 @@ const initialState: DepositBalances = {
* Hook which fetches all the balances required for depositing
* whenever the asset changes in the form
*/
export const useDepositBalances = (asset: Asset | undefined) => {
export const useDepositBalances = (
asset: Asset | undefined,
isFaucetable: boolean
) => {
const tokenContract = useTokenContract(
isAssetTypeERC20(asset) ? asset.source.contractAddress : undefined
isAssetTypeERC20(asset) ? asset.source.contractAddress : undefined,
isFaucetable
);
const bridgeContract = useBridgeContract();
const getAllowance = useGetAllowance(tokenContract, asset);
+2 -1
View File
@@ -20,7 +20,8 @@ export const useSubmitApproval = (
});
const { config } = useEthereumConfig();
const contract = useTokenContract(
isAssetTypeERC20(asset) ? asset.source.contractAddress : undefined
isAssetTypeERC20(asset) ? asset.source.contractAddress : undefined,
true
);
// When tx is confirmed refresh balances
+2 -1
View File
@@ -18,7 +18,8 @@ export const useSubmitFaucet = (
return state.transactions.find((t) => t?.id === id);
});
const contract = useTokenContract(
isAssetTypeERC20(asset) ? asset.source.contractAddress : undefined
isAssetTypeERC20(asset) ? asset.source.contractAddress : undefined,
true
);
// When tx is confirmed refresh balances
@@ -21,8 +21,6 @@ fragment OrderFields on Order {
}
peggedOrder {
__typename
reference
offset
}
}
@@ -66,7 +64,6 @@ fragment OrderUpdateFields on OrderUpdate {
type
side
size
remaining
status
rejectionReason
price
@@ -78,8 +75,6 @@ fragment OrderUpdateFields on OrderUpdate {
liquidityProvisionId
peggedOrder {
__typename
reference
offset
}
}
@@ -3,14 +3,14 @@ import * as Types from '@vegaprotocol/types';
import { gql } from '@apollo/client';
import * as Apollo from '@apollo/client';
const defaultOptions = {} as const;
export type OrderFieldsFragment = { __typename?: 'Order', id: string, type?: Types.OrderType | null, side: Types.Side, size: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, price: string, timeInForce: Types.OrderTimeInForce, remaining: string, expiresAt?: any | null, createdAt: any, updatedAt?: any | null, postOnly?: boolean | null, reduceOnly?: boolean | null, market: { __typename?: 'Market', id: string }, liquidityProvision?: { __typename: 'LiquidityProvision' } | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null };
export type OrderFieldsFragment = { __typename?: 'Order', id: string, type?: Types.OrderType | null, side: Types.Side, size: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, price: string, timeInForce: Types.OrderTimeInForce, remaining: string, expiresAt?: any | null, createdAt: any, updatedAt?: any | null, postOnly?: boolean | null, reduceOnly?: boolean | null, market: { __typename?: 'Market', id: string }, liquidityProvision?: { __typename: 'LiquidityProvision' } | null, peggedOrder?: { __typename: 'PeggedOrder' } | null };
export type OrderByIdQueryVariables = Types.Exact<{
orderId: Types.Scalars['ID'];
}>;
export type OrderByIdQuery = { __typename?: 'Query', orderByID: { __typename?: 'Order', id: string, type?: Types.OrderType | null, side: Types.Side, size: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, price: string, timeInForce: Types.OrderTimeInForce, remaining: string, expiresAt?: any | null, createdAt: any, updatedAt?: any | null, postOnly?: boolean | null, reduceOnly?: boolean | null, market: { __typename?: 'Market', id: string }, liquidityProvision?: { __typename: 'LiquidityProvision' } | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null } };
export type OrderByIdQuery = { __typename?: 'Query', orderByID: { __typename?: 'Order', id: string, type?: Types.OrderType | null, side: Types.Side, size: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, price: string, timeInForce: Types.OrderTimeInForce, remaining: string, expiresAt?: any | null, createdAt: any, updatedAt?: any | null, postOnly?: boolean | null, reduceOnly?: boolean | null, market: { __typename?: 'Market', id: string }, liquidityProvision?: { __typename: 'LiquidityProvision' } | null, peggedOrder?: { __typename: 'PeggedOrder' } | null } };
export type OrdersQueryVariables = Types.Exact<{
partyId: Types.Scalars['ID'];
@@ -20,9 +20,9 @@ export type OrdersQueryVariables = Types.Exact<{
}>;
export type OrdersQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, ordersConnection?: { __typename?: 'OrderConnection', edges?: Array<{ __typename?: 'OrderEdge', cursor?: string | null, node: { __typename?: 'Order', id: string, type?: Types.OrderType | null, side: Types.Side, size: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, price: string, timeInForce: Types.OrderTimeInForce, remaining: string, expiresAt?: any | null, createdAt: any, updatedAt?: any | null, postOnly?: boolean | null, reduceOnly?: boolean | null, market: { __typename?: 'Market', id: string }, liquidityProvision?: { __typename: 'LiquidityProvision' } | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null } }> | null, pageInfo?: { __typename?: 'PageInfo', startCursor: string, endCursor: string, hasNextPage: boolean, hasPreviousPage: boolean } | null } | null } | null };
export type OrdersQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, ordersConnection?: { __typename?: 'OrderConnection', edges?: Array<{ __typename?: 'OrderEdge', cursor?: string | null, node: { __typename?: 'Order', id: string, type?: Types.OrderType | null, side: Types.Side, size: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, price: string, timeInForce: Types.OrderTimeInForce, remaining: string, expiresAt?: any | null, createdAt: any, updatedAt?: any | null, postOnly?: boolean | null, reduceOnly?: boolean | null, market: { __typename?: 'Market', id: string }, liquidityProvision?: { __typename: 'LiquidityProvision' } | null, peggedOrder?: { __typename: 'PeggedOrder' } | null } }> | null, pageInfo?: { __typename?: 'PageInfo', startCursor: string, endCursor: string, hasNextPage: boolean, hasPreviousPage: boolean } | null } | null } | null };
export type OrderUpdateFieldsFragment = { __typename?: 'OrderUpdate', id: string, marketId: string, type?: Types.OrderType | null, side: Types.Side, size: string, remaining: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, price: string, timeInForce: Types.OrderTimeInForce, expiresAt?: any | null, createdAt: any, updatedAt?: any | null, liquidityProvisionId?: string | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null };
export type OrderUpdateFieldsFragment = { __typename?: 'OrderUpdate', id: string, marketId: string, type?: Types.OrderType | null, side: Types.Side, size: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, price: string, timeInForce: Types.OrderTimeInForce, remaining: string, expiresAt?: any | null, createdAt: any, updatedAt?: any | null, liquidityProvisionId?: string | null, peggedOrder?: { __typename: 'PeggedOrder' } | null };
export type OrdersUpdateSubscriptionVariables = Types.Exact<{
partyId: Types.Scalars['ID'];
@@ -30,7 +30,7 @@ export type OrdersUpdateSubscriptionVariables = Types.Exact<{
}>;
export type OrdersUpdateSubscription = { __typename?: 'Subscription', orders?: Array<{ __typename?: 'OrderUpdate', id: string, marketId: string, type?: Types.OrderType | null, side: Types.Side, size: string, remaining: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, price: string, timeInForce: Types.OrderTimeInForce, expiresAt?: any | null, createdAt: any, updatedAt?: any | null, liquidityProvisionId?: string | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null }> | null };
export type OrdersUpdateSubscription = { __typename?: 'Subscription', orders?: Array<{ __typename?: 'OrderUpdate', id: string, marketId: string, type?: Types.OrderType | null, side: Types.Side, size: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, price: string, timeInForce: Types.OrderTimeInForce, remaining: string, expiresAt?: any | null, createdAt: any, updatedAt?: any | null, liquidityProvisionId?: string | null, peggedOrder?: { __typename: 'PeggedOrder' } | null }> | null };
export const OrderFieldsFragmentDoc = gql`
fragment OrderFields on Order {
@@ -56,8 +56,6 @@ export const OrderFieldsFragmentDoc = gql`
}
peggedOrder {
__typename
reference
offset
}
}
`;
@@ -68,7 +66,6 @@ export const OrderUpdateFieldsFragmentDoc = gql`
type
side
size
remaining
status
rejectionReason
price
@@ -80,8 +77,6 @@ export const OrderUpdateFieldsFragmentDoc = gql`
liquidityProvisionId
peggedOrder {
__typename
reference
offset
}
}
`;
@@ -213,8 +213,6 @@ describe('OrderListTable', () => {
timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC,
peggedOrder: {
__typename: 'PeggedOrder',
reference: Schema.PeggedReference.PEGGED_REFERENCE_MID,
offset: '100',
},
});
@@ -224,7 +222,7 @@ describe('OrderListTable', () => {
const amendCell = getAmendCell();
const typeCell = screen.getAllByRole('gridcell')[2];
expect(typeCell).toHaveTextContent('Mid - 10.0 Peg limit');
expect(typeCell).toHaveTextContent('Pegged');
expect(amendCell.queryAllByRole('button')).toHaveLength(0);
});
+122 -212
View File
@@ -1,19 +1,4 @@
[
{
"inputs": [
{ "internalType": "string", "name": "_name", "type": "string" },
{ "internalType": "string", "name": "_symbol", "type": "string" },
{ "internalType": "uint8", "name": "_decimals", "type": "uint8" },
{
"internalType": "uint256",
"name": "total_supply_whole_tokens",
"type": "uint256"
},
{ "internalType": "uint256", "name": "faucet_amount", "type": "uint256" }
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
@@ -39,25 +24,6 @@
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
@@ -84,205 +50,149 @@
"type": "event"
},
{
"inputs": [
{ "internalType": "address", "name": "owner", "type": "address" },
{ "internalType": "address", "name": "spender", "type": "address" }
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "allowance",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function",
"constant": true
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "spender", "type": "address" },
{ "internalType": "uint256", "name": "value", "type": "uint256" }
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"name": "approve",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "account", "type": "address" }
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "balanceOf",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function",
"constant": true
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "approve",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "decimals",
"outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [
{ "internalType": "address", "name": "spender", "type": "address" },
"outputs": [
{
"internalType": "uint256",
"name": "subtractedValue",
"type": "uint256"
"internalType": "uint8",
"name": "",
"type": "uint8"
}
],
"name": "decreaseAllowance",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "spender", "type": "address" },
{ "internalType": "uint256", "name": "addedValue", "type": "uint256" }
],
"name": "increaseAllowance",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "isOwner",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "kill",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "owner",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [
{ "internalType": "address", "name": "recipient", "type": "address" },
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
],
"name": "transfer",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "sender", "type": "address" },
{ "internalType": "address", "name": "recipient", "type": "address" },
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
],
"name": "transferFrom",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "newOwner", "type": "address" }
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "faucet",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "account", "type": "address" },
{ "internalType": "uint256", "name": "value", "type": "uint256" }
],
"name": "issue",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amount", "type": "uint256" },
{
"internalType": "address",
"name": "bridge_address",
"type": "address"
},
{
"internalType": "bytes32",
"name": "vega_public_key",
"type": "bytes32"
}
],
"name": "admin_deposit_single",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amount", "type": "uint256" },
{
"internalType": "address",
"name": "bridge_address",
"type": "address"
},
{
"internalType": "bytes32[]",
"name": "vega_public_keys",
"type": "bytes32[]"
}
],
"name": "admin_deposit_bulk",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
@@ -0,0 +1,288 @@
[
{
"inputs": [
{ "internalType": "string", "name": "_name", "type": "string" },
{ "internalType": "string", "name": "_symbol", "type": "string" },
{ "internalType": "uint8", "name": "_decimals", "type": "uint8" },
{
"internalType": "uint256",
"name": "total_supply_whole_tokens",
"type": "uint256"
},
{ "internalType": "uint256", "name": "faucet_amount", "type": "uint256" }
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "spender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [
{ "internalType": "address", "name": "owner", "type": "address" },
{ "internalType": "address", "name": "spender", "type": "address" }
],
"name": "allowance",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [
{ "internalType": "address", "name": "spender", "type": "address" },
{ "internalType": "uint256", "name": "value", "type": "uint256" }
],
"name": "approve",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "account", "type": "address" }
],
"name": "balanceOf",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "decimals",
"outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [
{ "internalType": "address", "name": "spender", "type": "address" },
{
"internalType": "uint256",
"name": "subtractedValue",
"type": "uint256"
}
],
"name": "decreaseAllowance",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "spender", "type": "address" },
{ "internalType": "uint256", "name": "addedValue", "type": "uint256" }
],
"name": "increaseAllowance",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "isOwner",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "kill",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "owner",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function",
"constant": true
},
{
"inputs": [
{ "internalType": "address", "name": "recipient", "type": "address" },
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
],
"name": "transfer",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "sender", "type": "address" },
{ "internalType": "address", "name": "recipient", "type": "address" },
{ "internalType": "uint256", "name": "amount", "type": "uint256" }
],
"name": "transferFrom",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "newOwner", "type": "address" }
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "faucet",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "account", "type": "address" },
{ "internalType": "uint256", "name": "value", "type": "uint256" }
],
"name": "issue",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amount", "type": "uint256" },
{
"internalType": "address",
"name": "bridge_address",
"type": "address"
},
{
"internalType": "bytes32",
"name": "vega_public_key",
"type": "bytes32"
}
],
"name": "admin_deposit_single",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "amount", "type": "uint256" },
{
"internalType": "address",
"name": "bridge_address",
"type": "address"
},
{
"internalType": "bytes32[]",
"name": "vega_public_keys",
"type": "bytes32[]"
}
],
"name": "admin_deposit_bulk",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
@@ -1,671 +0,0 @@
[
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_upgradedAddress",
"type": "address"
}
],
"name": "deprecate",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_spender",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "approve",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "deprecated",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_evilUser",
"type": "address"
}
],
"name": "addBlackList",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_from",
"type": "address"
},
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "upgradedAddress",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "",
"type": "address"
}
],
"name": "balances",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "decimals",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "maximumFee",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "_totalSupply",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "unpause",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_maker",
"type": "address"
}
],
"name": "getBlackListStatus",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "",
"type": "address"
},
{
"name": "",
"type": "address"
}
],
"name": "allowed",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "paused",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "who",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "pause",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "getOwner",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "owner",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_to",
"type": "address"
},
{
"name": "_value",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "newBasisPoints",
"type": "uint256"
},
{
"name": "newMaxFee",
"type": "uint256"
}
],
"name": "setParams",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "amount",
"type": "uint256"
}
],
"name": "issue",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "amount",
"type": "uint256"
}
],
"name": "redeem",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "_owner",
"type": "address"
},
{
"name": "_spender",
"type": "address"
}
],
"name": "allowance",
"outputs": [
{
"name": "remaining",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "basisPointsRate",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "",
"type": "address"
}
],
"name": "isBlackListed",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_clearedUser",
"type": "address"
}
],
"name": "removeBlackList",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "MAX_UINT",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "_blackListedUser",
"type": "address"
}
],
"name": "destroyBlackFunds",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"name": "_initialSupply",
"type": "uint256"
},
{
"name": "_name",
"type": "string"
},
{
"name": "_symbol",
"type": "string"
},
{
"name": "_decimals",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "amount",
"type": "uint256"
}
],
"name": "Issue",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "amount",
"type": "uint256"
}
],
"name": "Redeem",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "newAddress",
"type": "address"
}
],
"name": "Deprecate",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "feeBasisPoints",
"type": "uint256"
},
{
"indexed": false,
"name": "maxFee",
"type": "uint256"
}
],
"name": "Params",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "_blackListedUser",
"type": "address"
},
{
"indexed": false,
"name": "_balance",
"type": "uint256"
}
],
"name": "DestroyedBlackFunds",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "_user",
"type": "address"
}
],
"name": "AddedBlackList",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "_user",
"type": "address"
}
],
"name": "RemovedBlackList",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "owner",
"type": "address"
},
{
"indexed": true,
"name": "spender",
"type": "address"
},
{
"indexed": false,
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "from",
"type": "address"
},
{
"indexed": true,
"name": "to",
"type": "address"
},
{
"indexed": false,
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"anonymous": false,
"inputs": [],
"name": "Pause",
"type": "event"
},
{
"anonymous": false,
"inputs": [],
"name": "Unpause",
"type": "event"
}
]
+3 -5
View File
@@ -1,5 +1,5 @@
import { ethers } from 'ethers';
import { hexlify, toUtf8Bytes } from 'ethers/lib/utils';
import { hexlify } from 'ethers/lib/utils';
import abi from '../abis/claim_abi.json';
import { calcGasBuffer } from '../utils';
@@ -70,7 +70,7 @@ export class Claim {
tranche,
expiry,
},
hexlify(toUtf8Bytes(country)),
hexlify(country),
target,
].filter(Boolean);
const res = await this.contract.estimateGas[method](...args);
@@ -110,9 +110,7 @@ export class Claim {
* @return {Promise<boolean>}
*/
async isCountryBlocked(country: string): Promise<boolean> {
const isAllowed = await this.contract.allowed_countries(
hexlify(toUtf8Bytes(country))
);
const isAllowed = await this.contract.allowed_countries(hexlify(country));
return !isAllowed;
}
}
@@ -44,7 +44,7 @@ export class CollateralBridge {
is_asset_listed(address: string) {
return this.contract.is_asset_listed(address);
}
get_withdraw_threshold(assetSource: string): Promise<BigNumber> {
get_withdraw_threshold(assetSource: string) {
return this.contract.get_withdraw_threshold(assetSource);
}
default_withdraw_delay() {
@@ -5,4 +5,5 @@ export * from './collateral-bridge';
export * from './staking-bridge';
export * from './token-vesting';
export * from './token';
export * from './token-faucetable';
export * from './multisig-control';
@@ -0,0 +1,44 @@
import type { BigNumber } from 'ethers';
import { ethers } from 'ethers';
import erc20AbiFaucetable from '../abis/erc20_abi_faucet.json';
import { calcGasBuffer } from '../utils';
export class TokenFaucetable {
public contract: ethers.Contract;
public address: string;
constructor(
address: string,
signerOrProvider: ethers.Signer | ethers.providers.Provider
) {
this.contract = new ethers.Contract(
address,
erc20AbiFaucetable,
signerOrProvider
);
this.address = address;
}
totalSupply() {
return this.contract.totalSupply();
}
balanceOf(account: string): Promise<BigNumber> {
return this.contract.balanceOf(account);
}
allowance(owner: string, spender: string): Promise<BigNumber> {
return this.contract.allowance(owner, spender);
}
async approve(spender: string, amount: string) {
const res = await this.contract.estimateGas.approve(spender, amount);
const gasLimit = calcGasBuffer(res);
return this.contract.approve(spender, amount, { gasLimit });
}
decimals(): Promise<number> {
return this.contract.decimals();
}
async faucet() {
const res = await this.contract.estimateGas.faucet();
const gasLimit = calcGasBuffer(res);
return this.contract.faucet({ gasLimit });
}
}
+2 -13
View File
@@ -1,11 +1,8 @@
import type { BigNumber } from 'ethers';
import { ethers } from 'ethers';
import erc20Abi from '../abis/erc20_abi.json';
import erc20AbiTether from '../abis/erc20_abi_tether.json';
import { calcGasBuffer } from '../utils';
const TETHER_ADDRESS = '0xdAC17F958D2ee523a2206206994597C13D831ec7';
export class Token {
public contract: ethers.Contract;
public address: string;
@@ -14,13 +11,7 @@ export class Token {
address: string,
signerOrProvider: ethers.Signer | ethers.providers.Provider
) {
let abi: typeof erc20Abi | typeof erc20AbiTether = erc20Abi;
// USDT (Tether) has a different ABI
if (address === TETHER_ADDRESS) {
abi = erc20AbiTether;
}
this.contract = new ethers.Contract(address, abi, signerOrProvider);
this.contract = new ethers.Contract(address, erc20Abi, signerOrProvider);
this.address = address;
}
@@ -42,8 +33,6 @@ export class Token {
return this.contract.decimals();
}
async faucet() {
const res = await this.contract.estimateGas.faucet();
const gasLimit = calcGasBuffer(res);
return this.contract.faucet({ gasLimit });
/* No op */
}
}
+1 -7
View File
@@ -1,4 +1,4 @@
import type { ConditionOperator, PeggedReference } from './__generated__/types';
import type { ConditionOperator } from './__generated__/types';
import type {
AccountType,
AuctionTrigger,
@@ -474,9 +474,3 @@ export const ConditionOperatorMapping: { [C in ConditionOperator]: string } = {
OPERATOR_LESS_THAN: 'Less than',
OPERATOR_LESS_THAN_OR_EQUAL: 'Less than or equal to',
};
export const PeggedReferenceMapping: { [R in PeggedReference]: string } = {
PEGGED_REFERENCE_BEST_ASK: 'Ask',
PEGGED_REFERENCE_BEST_BID: 'Bid',
PEGGED_REFERENCE_MID: 'Mid',
};
@@ -3,6 +3,7 @@ import produce from 'immer';
import type { MultisigControl } from '@vegaprotocol/smart-contracts';
import type { CollateralBridge } from '@vegaprotocol/smart-contracts';
import type { Token } from '@vegaprotocol/smart-contracts';
import type { TokenFaucetable } from '@vegaprotocol/smart-contracts';
import type { DepositBusEventFieldsFragment } from '@vegaprotocol/wallet';
@@ -10,11 +11,12 @@ import type { EthTxState } from './use-ethereum-transaction';
import { EthTxStatus } from './use-ethereum-transaction';
import { subscribeWithSelector } from 'zustand/middleware';
type Contract = MultisigControl | CollateralBridge | Token;
type Contract = MultisigControl | CollateralBridge | Token | TokenFaucetable;
type ContractMethod =
| keyof MultisigControl
| keyof CollateralBridge
| keyof Token;
| keyof Token
| keyof TokenFaucetable;
export interface EthStoredTxState extends EthTxState {
id: number;
+9 -4
View File
@@ -1,8 +1,8 @@
import { Token } from '@vegaprotocol/smart-contracts';
import { Token, TokenFaucetable } from '@vegaprotocol/smart-contracts';
import { useWeb3React } from '@web3-react/core';
import { useMemo } from 'react';
export const useTokenContract = (address?: string) => {
export const useTokenContract = (address?: string, faucetable = false) => {
const { provider } = useWeb3React();
const contract = useMemo(() => {
@@ -11,8 +11,13 @@ export const useTokenContract = (address?: string) => {
}
const signer = provider.getSigner();
return new Token(address, signer || provider);
}, [provider, address]);
if (faucetable) {
return new TokenFaucetable(address, signer || provider);
} else {
return new Token(address, signer || provider);
}
}, [provider, address, faucetable]);
return contract;
};
+8 -6
View File
@@ -70,14 +70,13 @@ const WithdrawDelayNotification = ({
return (
<Notification
intent={Intent.Warning}
key={symbol}
testId={
threshold.isEqualTo(0)
? 'withdrawals-delay-notification'
: 'amount-withdrawal-delay-notification'
threshold.isFinite()
? 'amount-withdrawal-delay-notification'
: 'withdrawals-delay-notification'
}
message={[
threshold.isEqualTo(0)
!threshold.isFinite()
? t('All %s withdrawals are subject to a %s delay.', replacements)
: t('Withdrawals of %s %s or more will be delayed for %s.', [
formatNumber(threshold, decimals),
@@ -167,7 +166,10 @@ export const WithdrawForm = ({
};
const showWithdrawDelayNotification =
delay && selectedAsset && new BigNumber(amount).isGreaterThan(threshold);
delay &&
selectedAsset &&
(!threshold.isFinite() ||
new BigNumber(amount).isGreaterThanOrEqualTo(threshold));
return (
<>
@@ -120,7 +120,7 @@ describe('WithdrawManager', () => {
it('shows withdraw delay notification if amount greater than threshold', async () => {
render(generateJsx(props));
fireEvent.change(screen.getByLabelText('Amount'), {
target: { value: '1001' },
target: { value: '1000' },
});
expect(
await screen.findByTestId('amount-withdrawal-delay-notification')
@@ -128,7 +128,7 @@ describe('WithdrawManager', () => {
});
it('shows withdraw delay notification if threshold is 0', async () => {
withdrawAsset.threshold = new BigNumber(0);
withdrawAsset.threshold = new BigNumber(Infinity);
render(generateJsx(props));
fireEvent.change(screen.getByLabelText('Amount'), {
target: { value: '0.01' },