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 abis/bytecode #52

Merged
merged 6 commits into from
Mar 20, 2024
Merged
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
1 change: 1 addition & 0 deletions dist/chains.config.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import { Chain } from "viem";
/** Reference for supported chains: https://github.com/gitcoinco/grants-stack/issues/3107 */
export declare const supportedChains: Chain[];
2 changes: 2 additions & 0 deletions dist/chains.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.supportedChains = void 0;
const chains_1 = require("viem/chains");
/** Local development chain support */
const devChain1 = {
id: 1337,
name: "Development 1",
Expand All @@ -22,6 +23,7 @@ const devChain1 = {
},
},
};
/** Reference for supported chains: https://github.com/gitcoinco/grants-stack/issues/3107 */
exports.supportedChains = [
chains_1.mainnet,
chains_1.optimism,
Expand Down
2 changes: 1 addition & 1 deletion dist/strategies/DirectGrants/DirectGrantsStrategy.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export declare class DirectGrantsStrategy {
getUpcomingMilestone(recipientAddress: `0x${string}`): Promise<any>;
getPayouts(recipientIds: `0x${string}`[]): Promise<PayoutSummary[]>;
getSetMilestonesData(recipientId: `0x${string}`, milestones: Milestone[]): TransactionData;
getReviewSetMilestonesData(recipientId: `0x${string}`, status: Status): TransactionData;
getReviewSetMilestonesData(recipientId: `0x${string}`, status: Status, milestoneHash: `0x${string}`): TransactionData;
getSubmitMilestonesData(recipientId: `0x${string}`, milestoneId: number, metadata: Metadata): TransactionData;
getRejectMilestoneData(recipientId: `0x${string}`, milestoneId: number): TransactionData;
getSetRecipientStatusToInReviewData(recipientIds: `0x${string}`[]): TransactionData;
Expand Down
21 changes: 13 additions & 8 deletions dist/strategies/DirectGrants/DirectGrantsStrategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class DirectGrantsStrategy {
}
// Get the DirectGrants strategy InitializeData
getInitializeData(params) {
const encoded = (0, viem_1.encodeAbiParameters)((0, viem_1.parseAbiParameters)("bool, bool, bool, uint128, uint128"), [
const encoded = (0, viem_1.encodeAbiParameters)((0, viem_1.parseAbiParameters)("bool,bool,bool,uint128,uint128"), [
params.registryGating,
params.metadataRequired,
params.grantAmountRequired,
Expand All @@ -47,7 +47,7 @@ class DirectGrantsStrategy {
return encoded;
}
getDeployParams() {
const constructorArgs = (0, viem_1.encodeAbiParameters)((0, viem_1.parseAbiParameters)("address, string"), [this.allo.address(), "DirectGrantsSimpleStrategy1.1"]);
const constructorArgs = (0, viem_1.encodeAbiParameters)((0, viem_1.parseAbiParameters)("address,string"), [this.allo.address(), "DirectGrantsSimpleStrategy1.1"]);
const constructorArgsNo0x = constructorArgs.slice(2);
return {
abi: directGrants_config_1.abi,
Expand Down Expand Up @@ -227,9 +227,14 @@ class DirectGrantsStrategy {
value: "0",
};
}
getReviewSetMilestonesData(recipientId, status) {
getReviewSetMilestonesData(recipientId, status, milestoneHash) {
this.checkPoolId();
const encoded = (0, viem_1.encodeAbiParameters)((0, viem_1.parseAbiParameters)("address, uint256"), [recipientId, BigInt(status)]);
// todo: add milestone hash logic
const encoded = (0, viem_1.encodeFunctionData)({
abi: directGrants_config_1.abi,
functionName: "reviewSetMilestones",
args: [recipientId, status, milestoneHash],
});
return {
to: this.strategy,
data: encoded,
Expand Down Expand Up @@ -290,7 +295,7 @@ class DirectGrantsStrategy {
}
getRegisterRecipientData(data) {
this.checkPoolId();
const encoded = (0, viem_1.encodeAbiParameters)((0, viem_1.parseAbiParameters)("address, address, uint256, (uint256, string)"), [
const encoded = (0, viem_1.encodeAbiParameters)((0, viem_1.parseAbiParameters)("address,address,uint256,(uint256,string)"), [
data.registryAnchor || types_1.ZERO_ADDRESS,
data.recipientAddress,
data.grantAmount,
Expand All @@ -311,7 +316,7 @@ class DirectGrantsStrategy {
this.checkPoolId();
const encodedParams = [];
data.forEach((registerData) => {
const encoded = (0, viem_1.encodeAbiParameters)((0, viem_1.parseAbiParameters)("address, address, uint256, (uint256, string)"), [
const encoded = (0, viem_1.encodeAbiParameters)((0, viem_1.parseAbiParameters)("address,address,uint256,(uint256,string)"), [
registerData.registryAnchor || types_1.ZERO_ADDRESS,
registerData.recipientAddress,
registerData.grantAmount,
Expand All @@ -333,7 +338,7 @@ class DirectGrantsStrategy {
}
getAllocationData(recipientId, status, grantAmount) {
this.checkPoolId();
const encoded = (0, viem_1.encodeAbiParameters)((0, viem_1.parseAbiParameters)("address, uint8, uint256"), [recipientId, status, grantAmount]);
const encoded = (0, viem_1.encodeAbiParameters)((0, viem_1.parseAbiParameters)("address,uint8,uint256"), [recipientId, status, grantAmount]);
const encodedData = (0, viem_1.encodeFunctionData)({
abi: allo_config_1.abi,
functionName: "allocate",
Expand All @@ -349,7 +354,7 @@ class DirectGrantsStrategy {
this.checkPoolId();
const encodedParams = [];
allocations.forEach((allocation) => {
const encoded = (0, viem_1.encodeAbiParameters)((0, viem_1.parseAbiParameters)("address, uint8, uint256"), [
const encoded = (0, viem_1.encodeAbiParameters)((0, viem_1.parseAbiParameters)("address,uint8,uint256"), [
allocation.recipientId,
allocation.status,
BigInt(allocation.grantAmount),
Expand Down
34 changes: 21 additions & 13 deletions dist/strategies/DirectGrants/directGrants.config.d.ts

Large diffs are not rendered by default.

36 changes: 23 additions & 13 deletions dist/strategies/DirectGrants/directGrants.config.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export declare class DonationVotingMerkleDistributionStrategy {
getInitializeData(data: InitializeData): Promise<`0x${string}`>;
/**
*
* @param data - Allocation: (address,(((address,uint256),uint256,uint256),bytes32))
* @param data - Allocation: (address,(((address,uint256),uint256,uint256),bytes))
* @returns `0x${string}`
*/
getEncodedAllocation(data: Allocation): `0x${string}`;
Expand Down Expand Up @@ -135,7 +135,7 @@ export declare class DonationVotingMerkleDistributionStrategy {
index: bigint;
statusRow: bigint;
}[], refRecipientsCounter: bigint): TransactionData;
updateDistribution(merkleRoot: string, distributionMetadata: Metadata): TransactionData;
updateDistribution(merkleRoot: `0x${string}`, distributionMetadata: Metadata): TransactionData;
updatePoolTimestamps(registrationStartTime: bigint, registrationEndTime: bigint, allocationStartTime: bigint, allocationEndTime: bigint): TransactionData;
withdraw(amount: bigint): TransactionData;
withdraw(address: `0x${string}`): TransactionData;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const Client_1 = require("../../Client/Client");
const types_1 = require("../../Common/types");
const chains_config_1 = require("../../chains.config");
const types_2 = require("../../types");
const donationVoting_config_1 = require("./donationVoting.config");
const donationVotingDirect_config_1 = require("./donationVotingDirect.config");
const donationVotingVault_config_1 = require("./donationVotingVault.config");
const types_3 = require("./types");
Expand All @@ -32,7 +31,7 @@ class DonationVotingMerkleDistributionStrategy {
if (address) {
this.contract = (0, viem_1.getContract)({
address: address,
abi: donationVoting_config_1.abi,
abi: donationVotingVault_config_1.abi,
publicClient: this.client,
});
this.strategy = address;
Expand All @@ -54,7 +53,7 @@ class DonationVotingMerkleDistributionStrategy {
setContract(address) {
this.contract = (0, viem_1.getContract)({
address: address,
abi: donationVoting_config_1.abi,
abi: donationVotingVault_config_1.abi,
publicClient: this.client,
});
this.strategy = address;
Expand Down Expand Up @@ -317,11 +316,11 @@ class DonationVotingMerkleDistributionStrategy {
}
/**
*
* @param data - Allocation: (address,(((address,uint256),uint256,uint256),bytes32))
* @param data - Allocation: (address,(((address,uint256),uint256,uint256),bytes))
* @returns `0x${string}`
*/
getEncodedAllocation(data) {
const encoded = (0, viem_1.encodeAbiParameters)((0, viem_1.parseAbiParameters)("address, uint8, (((address, uint256), uint256, uint256), bytes32)"), [
const encoded = (0, viem_1.encodeAbiParameters)((0, viem_1.parseAbiParameters)("address,uint8,(((address,uint256),uint256,uint256),bytes)"), [
data.recipientId,
data.permitType,
[
Expand Down Expand Up @@ -515,15 +514,10 @@ class DonationVotingMerkleDistributionStrategy {
*/
getClaimData(claims) {
this.checkPoolId();
const encoded = [];
claims.forEach((claim) => {
const encodedClaimParams = (0, viem_1.encodeAbiParameters)((0, viem_1.parseAbiParameters)("address, address"), [claim.recipientId, claim.token]);
encoded.push(encodedClaimParams);
});
const encodedData = (0, viem_1.encodeFunctionData)({
abi: donationVoting_config_1.abi,
abi: donationVotingVault_config_1.abi,
functionName: "claim",
args: [encoded],
args: [claims],
});
return {
to: this.strategy,
Expand All @@ -541,7 +535,7 @@ class DonationVotingMerkleDistributionStrategy {
multicall(data) {
this.checkPoolId();
const encodedData = (0, viem_1.encodeFunctionData)({
abi: donationVoting_config_1.abi,
abi: donationVotingVault_config_1.abi,
functionName: "multicall",
args: [data],
});
Expand All @@ -560,7 +554,7 @@ class DonationVotingMerkleDistributionStrategy {
*/
reviewRecipients(statuses, refRecipientsCounter) {
const data = (0, viem_1.encodeFunctionData)({
abi: donationVoting_config_1.abi,
abi: donationVotingVault_config_1.abi,
functionName: "reviewRecipients",
args: [statuses, refRecipientsCounter],
});
Expand All @@ -572,7 +566,7 @@ class DonationVotingMerkleDistributionStrategy {
}
updateDistribution(merkleRoot, distributionMetadata) {
const data = (0, viem_1.encodeFunctionData)({
abi: donationVoting_config_1.abi,
abi: donationVotingVault_config_1.abi,
functionName: "updateDistribution",
args: [merkleRoot, distributionMetadata],
});
Expand All @@ -584,7 +578,7 @@ class DonationVotingMerkleDistributionStrategy {
}
updatePoolTimestamps(registrationStartTime, registrationEndTime, allocationStartTime, allocationEndTime) {
const data = (0, viem_1.encodeFunctionData)({
abi: donationVoting_config_1.abi,
abi: donationVotingVault_config_1.abi,
functionName: "updatePoolTimestamps",
args: [
registrationStartTime,
Expand All @@ -599,11 +593,11 @@ class DonationVotingMerkleDistributionStrategy {
value: "0",
};
}
withdraw(amount) {
withdraw(address) {
const data = (0, viem_1.encodeFunctionData)({
abi: donationVoting_config_1.abi,
abi: donationVotingVault_config_1.abi,
functionName: "withdraw",
args: [amount],
args: [address],
});
return {
to: this.strategy,
Expand Down
Loading
Loading