Moved stack allocation from memory to calldata

This commit is contained in:
PedroCailleret
2023-05-22 06:40:53 -03:00
parent 4281526d77
commit 26a495246e
43 changed files with 933 additions and 826 deletions

View File

@@ -12,53 +12,26 @@ import {
Reputation,
} from "../../src/types";
// exported interfaces
export interface Deploys {
signers: string[];
p2pix: string;
token: string;
}
import { Call, RepFixture, P2PixAndReputation, DepositArgs, LockArgs } from "./interfaces";
export interface Lock {
sellerKey: BigNumber;
counter: BigNumber;
expirationBlock: BigNumber;
pixTarget: string;
token: string;
buyerAddress: string;
amount: BigNumber;
}
export interface Call {
target: string;
callData: string;
}
export interface Result {
success: boolean;
returnData: string;
}
export interface P2pixFixture {
p2pix: P2PIX;
erc20: MockToken;
proof: string[];
merkleRoot: string;
}
export interface RepFixture {
reputation: Reputation;
}
export interface MtcFixture {
multicall: Multicall;
}
type P2PixAndReputation = P2pixFixture &
RepFixture &
MtcFixture;
// exported constants
export const createDepositArgs = (pixTarget: string, allowlistRoot: string, token: string, amount: BigNumber, valid:boolean): DepositArgs => ({
pixTarget,
allowlistRoot,
token,
amount,
valid,
});
export const createLockArgs = (seller: string, token: string, amount: BigNumber, merkleProof: string[], expiredLocks: BigNumber[]): LockArgs => ({
seller,
token,
amount,
merkleProof,
expiredLocks,
});
export const getSignerAddrs = (
amount: number,
addrs: SignerWithAddress[],

71
test/utils/interfaces.ts Normal file
View File

@@ -0,0 +1,71 @@
import { BigNumber } from "ethers";
import {
MockToken,
Multicall,
P2PIX,
Reputation,
} from "../../src/types";
// exported interfaces
export interface Deploys {
signers: string[];
p2pix: string;
token: string;
}
export interface DepositArgs {
pixTarget: string;
allowlistRoot: string;
token: string;
amount: BigNumber;
valid: boolean;
}
export interface LockArgs {
seller: string;
token: string;
amount: BigNumber;
merkleProof: string[];
expiredLocks: BigNumber[];
}
export interface Lock {
counter: BigNumber;
expirationBlock: BigNumber;
pixTarget: string;
amount: BigNumber;
token: string;
buyerAddress: string;
seller: string;
}
export interface Call {
target: string;
callData: string;
}
export interface Result {
success: boolean;
returnData: string;
}
export interface P2pixFixture {
p2pix: P2PIX;
erc20: MockToken;
proof: string[];
merkleRoot: string;
}
export interface RepFixture {
reputation: Reputation;
}
export interface MtcFixture {
multicall: Multicall;
}
export type P2PixAndReputation = P2pixFixture &
RepFixture &
MtcFixture;