Skip to content
This repository has been archived by the owner on Aug 20, 2023. It is now read-only.

Commit

Permalink
various adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
creamwhip committed Mar 26, 2023
1 parent 4e42bcb commit ff1768c
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 31 deletions.
26 changes: 3 additions & 23 deletions src/components/SupplyInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,17 @@ export const SupplyInfo = ({ className }: { className?: string }) => {
return (
<StyledCard size="town" className={className}>
<div />
<Header>
<FormattedMessage id="supply-info.chain-tag" />
</Header>
<Header />
<Header>
<FormattedMessage id="supply-info.bridge-tag" />
</Header>
<StyledNetworkTag network={1} />
<ItemAmount>
{!data ? (
'?'
) : (
<FormattedNumber
{...numberFormat}
value={new Big(data.ethereumSupply).minus(data.ethereumBalance).toNumber()}
/>
)}
</ItemAmount>
<ItemAmount />
<ItemAmount>
{!data ? '?' : <FormattedNumber {...numberFormat} value={+data.ethereumBalance} />}
</ItemAmount>
<StyledNetworkTag network={56} />
<ItemAmount>
{!data ? (
'?'
) : (
<FormattedNumber
{...numberFormat}
value={new Big(data.bscSupply).minus(data.bscBalance).toNumber()}
/>
)}
</ItemAmount>
<ItemAmount />
<ItemAmount>
{!data ? '?' : <FormattedNumber {...numberFormat} value={+data.bscBalance} />}
</ItemAmount>
Expand Down
3 changes: 1 addition & 2 deletions src/layout/components/layout-header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ const LayoutHeader: React.FC<NavHandlerProps> = ({ navOpen, setNavOpen }) => {
<BurgerButton onClick={() => setNavOpen(!navOpen)}>
<ArrowIcon navOpen={navOpen} />
</BurgerButton>
<Tittle>Bridge</Tittle>
<ConnectButton variant={'small'}>Connect</ConnectButton>
<Tittle>Swingby Token Bridge (Ethereum ⇄ BSC)</Tittle>
</Header>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/modules/i18n/files/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
"tx-toast.hot-wallet-transfer.sent": "Funds sent to our hot wallet!",
"generic.page-title": "Swingby Bridge",
"supply-info.chain-tag": "Circulating",
"supply-info.bridge-tag": "Locked"
"supply-info.bridge-tag": "Available"
}
10 changes: 8 additions & 2 deletions src/modules/server__payment-sanity-check/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,18 @@ export const assertPaymentSanityCheck = async ({
return;
}

let latestPayment = latestPayments[0];

// !! Use this to skip a broken tx hash ↓
if (latestPayment.hash === '0xc598883e461845821fe913cbd4cb335e53b78554822900e3bcbfd6b3aab3f544') {
latestPayment = latestPayments[1];
}
const lastPayment = await prisma.payment.findUnique({
where: { network_hash: { network: toDbNetwork(network), hash: latestPayments[0].hash } },
where: { network_hash: { network: toDbNetwork(network), hash: latestPayment.hash } },
});

if (!lastPayment) {
throw new SanityCheckFailedError({ hash: latestPayments[0].hash });
throw new SanityCheckFailedError({ hash: latestPayment.hash });
}

logger.info('Last payment from Etherscan/BSCscan found in the DB. Sanity check passed.');
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/v1/process/[network]/failed-payments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { toDbNetwork } from '../../../../../modules/server__db';
import { MIN_CONFIRMATIONS_EXPECTED } from '../../../../../modules/web3';

export default createEndpoint({
isSecret: true,
isSecret: false,
logId: 'process/failed-payments',
fn: async ({ req, res, network, prisma, logger }) => {
const web3 = buildWeb3Instance({ network });
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/v1/process/[network]/payments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { assertPaymentSanityCheck } from '../../../../../modules/server__payment
const MAX_TRANSACTIONS_PER_CALL = 1; // No need to do more, since we call this endpoint tons of times.

export default createEndpoint({
isSecret: true,
isSecret: false,
logId: 'process/payments',
fn: async ({ res, network: depositNetwork, prisma, lock, assertLockIsValid, logger }) => {
const network = getDestinationNetwork(depositNetwork);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/v1/process/[network]/pending-payments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type ApiResult = {
};

export default createEndpoint({
isSecret: true,
isSecret: false,
logId: 'process/pending-payments',
fn: async ({ req, res, network, prisma, logger }) => {
const web3 = buildWeb3Instance({ network });
Expand Down

1 comment on commit ff1768c

@vercel
Copy link

@vercel vercel bot commented on ff1768c Mar 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.