Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update some naming #13

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 4 additions & 4 deletions src/__tests__/Strategy/MicroGrants.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Address } from "viem";
import { chains } from "../../Client/chains";
import { MicroGrantsStrategy } from "../../strategies/MicroGrantsStrategy/MicroGrantsStrategy";
import { SeaGrantsStrategy } from "../../strategies/SeaGrantsStrategy/SeaGrantsStrategy";
import { NATIVE } from "../utils/utils";

// const alloAddress: Address = "0x79536CC062EE8FAFA7A19a5fa07783BD7F792206";
Expand All @@ -25,11 +25,11 @@ jest.mock("viem", () => ({
}),
}));

describe("Micro Grants Strategy", () => {
let strategy: MicroGrantsStrategy;
describe("Sea Grants Strategy", () => {
let strategy: SeaGrantsStrategy;

beforeEach(() => {
strategy = new MicroGrantsStrategy({
strategy = new SeaGrantsStrategy({
chain: chains.sepolia,
rpc: "rpc",
address,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {

import { Allo } from "../../Allo/Allo";
import { create } from "../../Client/Client";
import { abi, bytecode } from "./microGrants.config";
import { abi, bytecode } from "./seaGrants.config";

import {
ConstructorArgs,
Expand All @@ -28,7 +28,7 @@ import {
SetAllocatorData,
} from "./types";

export class MicroGrantsStrategy {
export class SeaGrantsStrategy {
private client: PublicClient<Transport, Chain>;
private contract: any;

Expand All @@ -41,7 +41,7 @@ export class MicroGrantsStrategy {
this.client = create(chain, rpc);

if (!address)
throw new Error("MicroGrantsStrategy: No strategy address provided");
throw new Error("SeaGrantsStrategy: No strategy address provided");
this.strategy = address;

this.allo = new Allo({ chain, rpc }); // to call allocate
Expand All @@ -62,7 +62,7 @@ export class MicroGrantsStrategy {
private checkPoolId(): void {
if (this.poolId === -1)
throw new Error(
"MicroGrantsStrategy: No poolId provided. Please call `setPoolId` first.",
"SeaGrantsStrategy: No poolId provided. Please call `setPoolId` first."
);
}

Expand All @@ -80,11 +80,11 @@ export class MicroGrantsStrategy {

public async allocated(
allocatorAddress: string,
recipientAddress: string,
recipientAddress: string
): Promise<boolean> {
const allocated = await this.contract.read.allocated(
allocatorAddress,
recipientAddress,
recipientAddress
);

return allocated;
Expand Down Expand Up @@ -174,11 +174,11 @@ export class MicroGrantsStrategy {

public async recipientAllocations(
recipientId: string,
status: Status,
status: Status
): Promise<string> {
const allocations = await this.contract.read.recipientAllocations(
recipientId,
status,
status
);

return allocations;
Expand All @@ -198,7 +198,7 @@ export class MicroGrantsStrategy {
}

public async getInitializeData(
params: InitializeParams,
params: InitializeParams
): Promise<`0x${string}`> {
const encoded: `0x${string}` = encodeAbiParameters(
parseAbiParameters("bool, uint64, uint64, uint256, uint256"),
Expand All @@ -208,7 +208,7 @@ export class MicroGrantsStrategy {
params.allocationEndTime,
params.approvalThreshold,
params.maxRequestedAmountAllowed,
],
]
);

return encoded;
Expand All @@ -217,7 +217,7 @@ export class MicroGrantsStrategy {
public getDeployParams(): DeployParams {
const constructorArgs: `0x${string}` = encodeAbiParameters(
parseAbiParameters("address, string"),
[this.allo.address(), "MicroGrantsv1"],
[this.allo.address(), "SeaGrantsv1"]
);
const constructorArgsNo0x = constructorArgs.slice(2);

Expand All @@ -235,7 +235,7 @@ export class MicroGrantsStrategy {
allocations.forEach((allocation) => {
const encoded: `0x${string}` = encodeAbiParameters(
parseAbiParameters("address, enum"),
[allocation.recipientId, allocation.status],
[allocation.recipientId, allocation.status]
);

encodedParams.push(encoded);
Expand All @@ -258,12 +258,12 @@ export class MicroGrantsStrategy {

public getAllocationData(
recipientId: `0x${string}`,
status: Status,
status: Status
): TransactionData {
this.checkPoolId();
const encoded: `0x${string}` = encodeAbiParameters(
parseAbiParameters("address, enum"),
[recipientId, status],
[recipientId, status]
);

const encodedData = encodeFunctionData({
Expand All @@ -288,7 +288,7 @@ export class MicroGrantsStrategy {
data.recipientAddress,
data.requestedAmount,
data.metadata,
],
]
);

const encodedData = encodeFunctionData({
Expand Down Expand Up @@ -316,7 +316,7 @@ export class MicroGrantsStrategy {
registerData.recipientAddress,
registerData.requestedAmount,
registerData.metadata,
],
]
);

encodedParams.push(encoded);
Expand All @@ -338,11 +338,11 @@ export class MicroGrantsStrategy {
}

public getIncreasemaxRequestedAmountAllowedData(
amount: bigint,
amount: bigint
): TransactionData {
const encoded: `0x${string}` = encodeAbiParameters(
parseAbiParameters("uint256"),
[amount],
[amount]
);

const encodedData = encodeFunctionData({
Expand All @@ -361,7 +361,7 @@ export class MicroGrantsStrategy {
public getSetAllocatorData(data: SetAllocatorData): TransactionData {
const encoded: `0x${string}` = encodeAbiParameters(
parseAbiParameters("address, bool"),
[data.allocatorAddress, data.flag],
[data.allocatorAddress, data.flag]
);

const encodedData = encodeFunctionData({
Expand All @@ -383,7 +383,7 @@ export class MicroGrantsStrategy {
data.forEach((setAllocatorData) => {
const encoded: `0x${string}` = encodeAbiParameters(
parseAbiParameters("address, bool"),
[setAllocatorData.allocatorAddress, setAllocatorData.flag],
[setAllocatorData.allocatorAddress, setAllocatorData.flag]
);

encodedParams.push(encoded);
Expand All @@ -404,11 +404,11 @@ export class MicroGrantsStrategy {

public getUpdatePoolTimestampsData(
allocationStartTime: bigint,
allocationEndTime: bigint,
allocationEndTime: bigint
): TransactionData {
const encoded: `0x${string}` = encodeAbiParameters(
parseAbiParameters("uint64, uint64"),
[allocationStartTime, allocationEndTime],
[allocationStartTime, allocationEndTime]
);

const encodedData = encodeFunctionData({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ export const abi = [
type: "tuple",
},
],
internalType: "struct MicroGrantsStrategy.Recipient",
internalType: "struct SeaGrantsStrategy.Recipient",
name: "",
type: "tuple",
},
Expand Down
Loading