Skip to content

Commit

Permalink
Merge pull request #58 from ixofoundation/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Michael-Ixo authored Feb 12, 2024
2 parents 26e2549 + 778ebaa commit f86df5b
Show file tree
Hide file tree
Showing 60 changed files with 14,643 additions and 24,920 deletions.
15 changes: 12 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ RPC_URL=https://testnet.ixo.earth/rpc/ #https://impacthub-rpc.lavenderfive.com/
IBC_FROM_MNEMONIC="mango tattoo civil foam frog wheat venue rebuild cloth example alien taste"
IBC_TO_ADDRESS=ixo1tumrhpa5tpegdcs2nhwzft8maprttz66pvntc9

# for web3 file upload helper in tests
WEB3STORAGE_TOKEN=""

# below is needed for test flow SETUP
ROOT_IMPACTS=""
ROOT_EMERGING=""
Expand Down Expand Up @@ -39,3 +36,15 @@ UMUZI_CREDENTIAL_WORKER_AUTH="Bearer "
ROOT_CODER_BYTE=""
ROOT_ED_CODER_BYTE=""
ASSERT_USER_CODER_BYTE_ORACLE=""

# IDCC
IDCC_DAO=""
IDCC_DAO_GOOD_SEED=""
IDCC_DAO_DREAM_IMPACT=""
IDCC_DAO_CCSG=""
IDCC_DAO_BEHub=""
IDCC_DAO_HKGCSE=""
IDCC_DAO_GCP=""
IDCC_DAO_CUHK=""
IDCC_DAO_ICARE=""
IDCC_DAO_SEBC=""
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"editor.formatOnSave": false
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"eslint.validate": ["javascript", "javascriptreact"]
}
50 changes: 25 additions & 25 deletions __tests__/flows/claims.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ export const supamotoClaims2 = () =>
])
);

const collectionId = "8";
const collectionId = "5";

test("Generate Fuel Purchase claims and evaluate them", async () => {
let purchaseData = await csvtojsonV2().fromFile(
Expand Down Expand Up @@ -561,7 +561,7 @@ export const supamotoClaims2 = () =>

for (const stovePurchases of purchaseData) {
index++;
if (index <= 45) continue; // if want to only mint a certain amount of batches add number here (devnet restart)
// if (index <= 67) continue; // if want to only mint a certain amount of batches add number here (devnet restart)
console.log(
"starting batch " + index + " of " + (purchaseData.length - 1)
);
Expand All @@ -570,7 +570,7 @@ export const supamotoClaims2 = () =>
// JSON.stringify(stovePurchases, null, 2)
// );
// add wait for ipfs rate limit
if (index) await timeout(1000 * 30);
if (index) await timeout(1000 * 5);

// create fuelPurchase claims for each purchase
const fpClaims = await axios.post(
Expand Down Expand Up @@ -608,28 +608,28 @@ export const supamotoClaims2 = () =>
);

// evaluate fuelPurchase claims
const fpEvaluations = await axios.post(
ProspectCredentialsWorkerUrl + "claims/evaluate",
{
collectionId: collectionId,
evaluations: fpClaimIds.map((id) => ({
claimId: id,
reason: 1,
status: ixo.claims.v1beta1.EvaluationStatus.APPROVED,
oracle: dids.prospectOracle,
verificationProof: "proof",
})),
},
{
headers: {
Authorization: process.env.PROSPECT_CREDENTIAL_WORKER_AUTH,
},
}
);
assertIsDeliverTxSuccess(fpEvaluations.data);
console.log(
fpClaimIds.length + " FuelPurchase claims successfully evaluated"
);
// const fpEvaluations = await axios.post(
// ProspectCredentialsWorkerUrl + "claims/evaluate",
// {
// collectionId: collectionId,
// evaluations: fpClaimIds.map((id) => ({
// claimId: id,
// reason: 1,
// status: ixo.claims.v1beta1.EvaluationStatus.APPROVED,
// oracle: dids.prospectOracle,
// verificationProof: "proof",
// })),
// },
// {
// headers: {
// Authorization: process.env.PROSPECT_CREDENTIAL_WORKER_AUTH,
// },
// }
// );
// assertIsDeliverTxSuccess(fpEvaluations.data);
// console.log(
// fpClaimIds.length + " FuelPurchase claims successfully evaluated"
// );

// save fuelPurchase claim ids per purchase
stovePurchases.forEach((ps: any[], i) => {
Expand Down
28 changes: 21 additions & 7 deletions __tests__/flows/cosmos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import * as Cosmos from "../modules/Cosmos";
import * as Authz from "../modules/Authz";
import { WalletUsers } from "../helpers/constants";
import Long from "long";
import { Grant } from "../../src/codegen/cosmos/authz/v1beta1/authz";
import { Grant } from "../../src/codegen/cosmos/feegrant/v1beta1/feegrant";
import { createRegistry } from "../../src";
import { fromTimestamp } from "../../src/codegen/helpers";

export const bankBasic = () =>
describe("Testing the cosmos bank module", () => {
Expand Down Expand Up @@ -88,7 +90,7 @@ export const sendTokens = (rounds = 1) =>

export const govDeposit = () =>
describe("Testing deposit funds into proposals", () => {
testMsg("/cosmos.bank.v1beta1.MsgDeposit", () => Cosmos.MsgDeposit(69));
testMsg("/cosmos.bank.v1beta1.MsgDeposit", () => Cosmos.MsgDeposit(446));
});

export const feegrantBasic = () =>
Expand All @@ -104,7 +106,7 @@ export const feegrantAllCurrentUsers = () =>
const address = (await getUser(WalletUsers.tester).getAccounts())[0]
.address;

let allowances: any[] = [];
let allowances: Grant[] = [];
const query = async (key?: Uint8Array) =>
await queryClient.cosmos.feegrant.v1beta1.allowancesByGranter({
granter: address,
Expand All @@ -123,17 +125,29 @@ export const feegrantAllCurrentUsers = () =>
key = res.pagination?.nextKey || undefined;
if (!key?.length) break;
}
// console.log(allowances.length);
console.log(allowances.length);

// to save current grantee addresses incase something goes wrong
// saveFileToPath(
// ["documents", "random", "mainnet_feegrant_addresses.json"],
// ["documents", "random", "mainnet_feegrant_addresses2.json"],
// JSON.stringify(
// allowances.map((a) => a.grantee),
// allowances.map((a) =>
// fromTimestamp(
// createRegistry().decode(a.allowance as any).expiration
// )
// ),
// null,
// 2
// )
// );
saveFileToPath(
["documents", "random", "mainnet_feegrant_addresses.json"],
JSON.stringify(
allowances.map((a) => a.grantee),
null,
2
)
);

// devide grantees into chunks of 200
let granteesChunks = chunkArray<string>(
Expand All @@ -151,7 +165,7 @@ export const feegrantAllCurrentUsers = () =>
}
// then grant all current users new feegrants
for (const grantees of granteesChunks) {
const ress = await Authz.MsgGrantAllowance(
const ress = await Authz.MsgGrantAllowanceFeegrant(
WalletUsers.tester,
grantees
);
Expand Down
Loading

0 comments on commit f86df5b

Please sign in to comment.