Skip to content

Commit

Permalink
Update version 0.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
huyminh1115 committed Jan 13, 2024
1 parent ace0361 commit c61d919
Show file tree
Hide file tree
Showing 8 changed files with 640 additions and 467 deletions.
9 changes: 8 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@
"feepayerKeyPath": "/home/huyminh/.cache/zkapp-cli/keys/myaccount.json",
"feepayerAlias": "myaccount",
"fee": "0.1"
},
"randomaccount": {
"url": "https://proxy.berkeley.minaexplorer.com/graphql",
"keyPath": "keys/randomaccount.json",
"feepayerKeyPath": "/home/huyminh/.cache/zkapp-cli/keys/myaccount.json",
"feepayerAlias": "myaccount",
"fee": "0.1"
}
}
}
}
67 changes: 55 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auxo-dev/platform",
"version": "0.1.3",
"version": "0.1.4",
"description": "Auxo's On-chain Funding platform on Mina blockchain",
"author": "",
"license": "Apache-2.0",
Expand Down Expand Up @@ -64,7 +64,7 @@
"zkapp-cli": "^0.15.0"
},
"dependencies": {
"@auxo-dev/dkg": "0.2.9",
"@auxo-dev/dkg": "0.2.12",
"@auxo-dev/auxo-libs": "0.3.5",
"o1js": "0.15.1"
}
Expand Down
27 changes: 9 additions & 18 deletions src/contracts/Treasury.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { ZkApp } from '@auxo-dev/dkg';

import { INSTANCE_LIMITS, ZkAppEnum } from '../constants.js';

import { Level1CWitness as indexWitness } from './ParticipationStorage.js';
import { Level1CWitness as IndexWitness } from './ParticipationStorage.js';

const DefaultLevel1Root = EMPTY_LEVEL_1_TREE().getRoot();

Expand All @@ -60,12 +60,11 @@ export class ClaimFundInput extends Struct({
projectId: Field,
requestId: Field, // TODO: Funding check requestId
payeeAddress: PublicKey, // TODO: Project check address
M: ZkApp.Request.RequestVector,
D: ZkApp.Request.RequestVector,
DWitness: MerkleMapWitness,
M: ZkApp.Request.RequestVector, // check Funding
D: ZkApp.Request.RequestVector, // check at request
DWitness: MerkleMapWitness, // TODO check request contract
investVector: InvestVector,
participationIndex: Field,
indexWitness: indexWitness,
participationIndexWitness: IndexWitness,
claimedIndex: Level1CWitness,
participationRef: ZkAppRef,
}) {
Expand Down Expand Up @@ -113,7 +112,7 @@ export const ClaimFund = ZkProgram({
});
},
},
createTreasury: {
nextStep: {
privateInputs: [
SelfProof<Void, ClaimFundProofOutput>,
TreasuryAction,
Expand Down Expand Up @@ -238,17 +237,9 @@ export class TreasuryContract extends SmartContract {
// const participationContract = new ParticipationContract(
// input.participationRef.address
// );
// check index in contract participant

// participationContract
// .checkParticipationIndex(
// new checkParticipationIndexInput({
// campaignId: input.campaignId,
// projectId: input.projectId,
// participationIndex: input.participationIndex,
// indexWitness: input.indexWitness,
// })
// )
// .assertEquals(Bool(true));
let participationIndex = input.participationIndexWitness.calculateIndex();

// check if claimed
this.checkIfNotClaimed(
Expand All @@ -260,7 +251,7 @@ export class TreasuryContract extends SmartContract {
).assertEquals(Bool(true));

let claimAmount = input.investVector.get(
input.participationIndex.sub(Field(1)) // since index start from 1
participationIndex.sub(Field(1)) // since index start from 1
);

// send invest amount
Expand Down
2 changes: 1 addition & 1 deletion src/libs/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function updateOutOfSnark(state: Field, action: Field[][]) {
return AccountUpdate.Actions.updateSequenceState(state, actionsHash);
}

const DEFAULT_WAIT_TIME = 7 * 60 * 1000; // 7m
const DEFAULT_WAIT_TIME = 10 * 60 * 1000; // 7m

export async function wait(time?: number): Promise<void> {
let waitTime = time || DEFAULT_WAIT_TIME;
Expand Down
8 changes: 7 additions & 1 deletion src/scripts/Funding.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ describe('Funding', () => {
let fundingContract = contracts[Contract.FUNDING]
.contract as FundingContract;
console.log('RollUp funding...');
let balance = Number(Account(fundingContract.address).balance.get());
console.log('Contract balance: ', balance);

await fetchAllContract(contracts, [Contract.REQUEST]);

Expand Down Expand Up @@ -335,6 +337,10 @@ describe('Funding', () => {
)
);
});

balance = Number(Account(fundingContract.address).balance.get());
await proveAndSend(tx, [feePayerKey], Contract.FUNDING, '');

console.log('Contract balance after: ', balance);
});
});
})
Loading

0 comments on commit c61d919

Please sign in to comment.