-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(security-issues): remove uniswap sdk with stale ethers
- Loading branch information
Showing
10 changed files
with
327 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { PERMIT2_ADDRESS } from "@uniswap/permit2-sdk"; | ||
import byteCode from '../contracts/permit2.json' | ||
import PERMIT2_ABI from '../../abi/Permit2.abi.json'; | ||
import { ethers } from "hardhat"; | ||
import { Contract } from "ethers"; | ||
import {Permit2Address} from '../../permit2.utils'; | ||
|
||
export async function createPermit2ContractAndDeploy(): Promise<Contract> { | ||
if ((await ethers.provider.getCode(PERMIT2_ADDRESS)) === '0x') { | ||
await ethers.provider.send('hardhat_setCode', [PERMIT2_ADDRESS, byteCode.bytecode]); | ||
if ((await ethers.provider.getCode(Permit2Address)) === '0x') { | ||
await ethers.provider.send('hardhat_setCode', [Permit2Address, byteCode.bytecode]); | ||
} | ||
return ethers.getContractAt(PERMIT2_ABI, PERMIT2_ADDRESS); | ||
return ethers.getContractAt(PERMIT2_ABI, Permit2Address); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { PERMIT2_ADDRESS } from "@uniswap/permit2-sdk"; | ||
import { Contract } from "ethers"; | ||
import Permit2ABI from '../abi/Permit2.abi.json' | ||
import {Permit2Address} from '../permit2.utils'; | ||
|
||
export function getPermit2Contract(): Contract { | ||
return new Contract(PERMIT2_ADDRESS, Permit2ABI) | ||
return new Contract(Permit2Address, Permit2ABI) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,35 @@ | ||
import { EIP712TypedData } from "./eip712.model"; | ||
import { TypedDataDomain, TypedDataField } from "@ethersproject/abstract-signer"; | ||
import { PermitBatchData, PermitSingle } from "@uniswap/permit2-sdk/dist/allowanceTransfer"; | ||
import {TypedDataDomain} from 'ethers'; | ||
|
||
type BigNumberish = bigint | string | number | ||
|
||
export type PermitSingleData = { | ||
domain: TypedDataDomain; | ||
types: Record<string, TypedDataField[]>; | ||
values: PermitSingle; | ||
}; | ||
|
||
export interface PermitDetails { | ||
token: string; | ||
amount: BigNumberish; | ||
expiration: BigNumberish | ||
nonce: BigNumberish | ||
} | ||
|
||
export interface PermitSingle { | ||
details: PermitDetails; | ||
spender: string; | ||
sigDeadline: BigNumberish; | ||
} | ||
|
||
export interface TypedDataField { | ||
name: string; | ||
type: string; | ||
} | ||
|
||
export type Eip712Permit2 = { | ||
types: Record<string, TypedDataField[]>; | ||
domain: TypedDataDomain; | ||
message: PermitSingle | PermitBatchData; | ||
message: PermitSingle; | ||
primaryType: string; | ||
} & EIP712TypedData; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.