Skip to content

Commit

Permalink
Merge pull request #289 from zallo-labs/Z-343-upgrade-approver
Browse files Browse the repository at this point in the history
Z 343 upgrade approver
  • Loading branch information
hbriese authored Aug 20, 2024
2 parents 7a88540 + 1a773a1 commit 3fbabbc
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
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 @@ -103,9 +103,6 @@ function SendScreen() {
.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

0 comments on commit 3fbabbc

Please sign in to comment.