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 export #1

Merged
merged 1 commit into from
Feb 2, 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
2 changes: 1 addition & 1 deletion src/contracts/Campaign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export const CreateCampaign = ZkProgram({
},
});

class CampaignProof extends ZkProgram.Proof(CreateCampaign) {}
export class CampaignProof extends ZkProgram.Proof(CreateCampaign) {}

export enum EventEnum {
CAMPAIGN_CREATED = 'campaign-created',
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/Funding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export const CreateRollupProof = ZkProgram({
},
});

class ProofRollupAction extends ZkProgram.Proof(CreateRollupProof) {}
export class ProofRollupAction extends ZkProgram.Proof(CreateRollupProof) {}

export class FundingContract extends SmartContract {
@state(Field) actionState = State<Field>();
Expand Down
18 changes: 6 additions & 12 deletions src/contracts/Participation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,14 @@ export class JoinCampaignInput extends Struct({
}
}

export class checkParticipationIndexInput extends Struct({
export class CheckParticipationIndexInput extends Struct({
campaignId: Field,
projectId: Field,
participationIndex: Field,
indexWitness: indexAndInfoWitness,
}) {
static fromFields(fields: Field[]): checkParticipationIndexInput {
return super.fromFields(fields) as checkParticipationIndexInput;
}
}

export class UpdateCampaignInput extends Struct({}) {
static fromFields(fields: Field[]): UpdateCampaignInput {
return super.fromFields(fields) as UpdateCampaignInput;
static fromFields(fields: Field[]): CheckParticipationIndexInput {
return super.fromFields(fields) as CheckParticipationIndexInput;
}
}

Expand Down Expand Up @@ -208,7 +202,7 @@ export const JoinCampaign = ZkProgram({
},
});

class ParticipationProof extends ZkProgram.Proof(JoinCampaign) {}
export class ParticipationProof extends ZkProgram.Proof(JoinCampaign) {}

export class ParticipationContract extends SmartContract {
// campaignId -> projectId -> index. start from 1, if index = 0 means that project have not participate
Expand Down Expand Up @@ -267,7 +261,7 @@ export class ParticipationContract extends SmartContract {
// check if this is first time join campaign

let notIn = this.checkParticipationIndex(
new checkParticipationIndexInput({
new CheckParticipationIndexInput({
campaignId: input.campaignId,
projectId: input.projectId,
participationIndex: Field(0),
Expand Down Expand Up @@ -341,7 +335,7 @@ export class ParticipationContract extends SmartContract {
this.emitEvent(EventEnum.ACTIONS_REDUCED, lastActionState);
}

@method checkParticipationIndex(input: checkParticipationIndexInput): Bool {
@method checkParticipationIndex(input: CheckParticipationIndexInput): Bool {
let isValid = Bool(true);

let index = IndexStorage.calculateLevel1Index({
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/Treasury.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export const ClaimFund = ZkProgram({
},
});

class TreasuryProof extends ZkProgram.Proof(ClaimFund) {}
export class TreasuryProof extends ZkProgram.Proof(ClaimFund) {}

export enum EventEnum {
ACTIONS_REDUCED = 'actions-reduced',
Expand Down
98 changes: 98 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,101 @@
export * as Constants from './constants.js';
export * as Storage from './contracts/storages.js';
export * as ZkApp from './contracts/index.js';

export {
// Structs
CheckProjectOwerInput,
CreateProjectInput,
UpdateProjectInput,
CreateProjectProofOutput,

// Zk Programs & Proofs
CreateProject,
ProjectProof,

// Smart Contract
ProjectContract,

// Actions & Events
ProjectAction,
EventEnum as ProjectEvents,
} from './contracts/Project.js';

export {
// Structs
CheckCampaignOwerInput,
CreateCampaignInput,
UpdateCampaignInput,
CreateCampaignProofOutput,

// Zk Programs & Proofs
CreateCampaign,
CampaignProof,

// Smart Contract
CampaignContract,

// Actions & Events
CampaignAction,
EventEnum as CampaignEvents,
} from './contracts/Campaign.js';

export {
// Structs
JoinCampaignInput,
CheckParticipationIndexInput,
CreateParticipationProofOutput,

// Zk Programs & Proofs
JoinCampaign,
ParticipationProof,

// Smart Contract
ParticipationContract,

// Actions & Events
ParticipationAction,
EventEnum as ParticipationEvents,
} from './contracts/Participation.js';

export {
// Structs
RequestSent,
CustomScalarArray,
FundingInput,
CheckValueInput,
ReduceOutput as ReduceFundingOutput,
RollupActionsOutput as RollupParticipationActionsOutput,

// Zk Programs & Proofs
ReduceProof,
CreateReduceProof,
ProofRollupAction,
CreateRollupProof,

// Smart Contract
FundingContract,

// Actions & Events
FundingAction,
EventEnum as FundingEvents,
} from './contracts/Funding.js';

export {
// Structs
InvestVector,
ClaimFundInput,
CheckIfNotClaimedInput,
ClaimFundProofOutput,

// Zk Programs & Proofs
TreasuryProof,
ClaimFund,

// Smart Contract
TreasuryContract,

// Actions & Events
TreasuryAction,
EventEnum as TreasuryEvents,
} from './contracts/Treasury.js';
Loading