Skip to content
This repository has been archived by the owner on Feb 8, 2025. It is now read-only.

Z 343 upgrade approver #289

Merged
merged 3 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/src/core/database/database.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class DatabaseService implements OnModuleInit {
.withConfig({
allow_user_specified_id: true /* Required for account insertion */,
})
.withRetryOptions({ attempts: 7 });
.withRetryOptions({ attempts: 10 });
this.DANGEROUS_superuserClient = this.__client.withConfig({ apply_access_policies: false });
}

Expand Down
3 changes: 0 additions & 3 deletions app/src/app/(nav)/[account]/(home)/send.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import { SendTo } from '#/send/SendTo';
import { match } from 'ts-pattern';
import { TransferMode } from '#/send/TransferMode';
import { TransferFromMode } from '#/send/TransferFromMode';

Check warning on line 26 in app/src/app/(nav)/[account]/(home)/send.tsx

View workflow job for this annotation

GitHub Actions / app-tests

'TransferFromMode' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 26 in app/src/app/(nav)/[account]/(home)/send.tsx

View workflow job for this annotation

GitHub Actions / app-tests

'TransferFromMode' is defined but never used. Allowed unused vars must match /^_/u
import { Text } from 'react-native-paper';

const Query = graphql`
Expand Down Expand Up @@ -103,9 +103,6 @@
.with('transfer', () => (
<TransferMode account={account} token={token} to={to} amount={amount} />
))
.with('transferFrom', () => (
<TransferFromMode account={account} token={token} to={to} amount={amount} />
))
.exhaustive()}
</Scrollable>
</Pane>
Expand Down
2 changes: 1 addition & 1 deletion app/src/components/send/SendModeChips.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Scrollable } from '#/Scrollable';
import { CheckAllIcon, ContactsOutlineIcon, DataIcon, OutboundIcon } from '@theme/icons';
import { createStyles, useStyles } from '@theme/styles';

export type SendMode = 'transfer' | 'transferFrom'; // | 'approve' | 'data';
export type SendMode = 'transfer'; // | 'transferFrom' | 'approve' | 'data';

export interface SendModeChipsProps {
mode: SendMode;
Expand Down
25 changes: 15 additions & 10 deletions app/src/components/send/TransferMode.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { asAddress, asFp, UAddress } from 'lib';
import { asAddress, asFp, isEthToken, UAddress } from 'lib';
import { Actions } from '#/layout/Actions';
import { Button } from '#/Button';
import { graphql } from 'relay-runtime';
Expand All @@ -11,7 +11,6 @@ import Decimal from 'decimal.js';
import { CheckAllIcon } from '@theme/icons';
import { useRouter } from 'expo-router';
import { ampli } from '~/lib/ampli';
import { useMemo } from 'react';
import { usePreparedTransaction } from '~/hooks/mutations/usePreparedTransaction';

const Account = graphql`
Expand Down Expand Up @@ -40,15 +39,21 @@ export function TransferMode({ to, amount, ...props }: TransferModeProps) {
const token = useFragment(Token, props.token);
const router = useRouter();

const amountFp = asFp(amount, token.decimals, Decimal.ROUND_DOWN);
const operations = to && [
{
to: asAddress(token.address),
data: encodeFunctionData({
abi: ERC20,
functionName: 'transfer',
args: [asAddress(to), asFp(amount, token.decimals, Decimal.ROUND_DOWN)],
}),
},
isEthToken(asAddress(token.address))
? {
to: asAddress(to),
value: amountFp,
}
: {
to: asAddress(token.address),
data: encodeFunctionData({
abi: ERC20,
functionName: 'transfer',
args: [asAddress(to), amountFp],
}),
},
];
const propose = usePreparedTransaction({
account,
Expand Down
4 changes: 2 additions & 2 deletions packages/lib/src/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export const PAYMASTER = {
};

export const UPGRADE_APPROVER = addresses({
zksync: '0x006629B301Ce7EF02ff2622e99752B2b2695B167',
'zksync-sepolia': '0x70fa585aFdbe80Ad4619bcCec17B86d31f017a23',
zksync: '0x34c1ADDf5BbF24a76b3968Ec9B6f9FEd75159AAf',
'zksync-sepolia': '0x64Ce53387A29fa667e3E99f576e7718CdfAB6DBa',
});

function addresses(
Expand Down
Loading