MCPcopy
hub / github.com/Uniswap/v2-core / getApprovalDigest

Function getApprovalDigest

test/shared/utilities.ts:52–80  ·  view source on GitHub ↗
(
  token: Contract,
  approve: {
    owner: string
    spender: string
    value: BigNumber
  },
  nonce: BigNumber,
  deadline: BigNumber
)

Source from the content-addressed store, hash-verified

50}
51
52export async function getApprovalDigest(
53 token: Contract,
54 approve: {
55 owner: string
56 spender: string
57 value: BigNumber
58 },
59 nonce: BigNumber,
60 deadline: BigNumber
61): Promise<string> {
62 const name = await token.name()
63 const DOMAIN_SEPARATOR = getDomainSeparator(name, token.address)
64 return keccak256(
65 solidityPack(
66 ['bytes1', 'bytes1', 'bytes32', 'bytes32'],
67 [
68 '0x19',
69 '0x01',
70 DOMAIN_SEPARATOR,
71 keccak256(
72 defaultAbiCoder.encode(
73 ['bytes32', 'address', 'address', 'uint256', 'uint256', 'uint256'],
74 [PERMIT_TYPEHASH, approve.owner, approve.spender, approve.value, nonce, deadline]
75 )
76 )
77 ]
78 )
79 )
80}
81
82export async function mineBlock(provider: Web3Provider, timestamp: number): Promise<void> {
83 await new Promise(async (resolve, reject) => {

Callers 1

Calls 1

getDomainSeparatorFunction · 0.85

Tested by

no test coverage detected