diff --git a/dapps/Makefile b/dapps/Makefile index ad2edcc5..e53763ce 100644 --- a/dapps/Makefile +++ b/dapps/Makefile @@ -1,6 +1,6 @@ include ../*.mk -.PHONY: all motoko rust build perf +.PHONY: all motoko rust azle build perf all: build perf motoko: @@ -9,7 +9,10 @@ motoko: rust: $(call build,rust) -build: motoko rust +azle: + $(call build,azle) + +build: motoko rust azle perf: $(call perf_two,dapps,basic_dao.sh,nft.sh) diff --git a/dapps/azle/basic_dao/defaults.ts b/dapps/azle/basic_dao/defaults.ts new file mode 100644 index 00000000..1685a7b6 --- /dev/null +++ b/dapps/azle/basic_dao/defaults.ts @@ -0,0 +1,13 @@ +import { SystemParams, Tokens } from "./types"; + +export function tokens(): Tokens { + return { amount_e8s: 0n }; +} + +export function systemParams(): SystemParams { + return { + transfer_fee: tokens(), + proposal_vote_threshold: tokens(), + proposal_submission_deposit: tokens(), + }; +} diff --git a/dapps/azle/basic_dao/env.ts b/dapps/azle/basic_dao/env.ts new file mode 100644 index 00000000..5da46844 --- /dev/null +++ b/dapps/azle/basic_dao/env.ts @@ -0,0 +1,59 @@ +import { ic, nat64, Principal } from "azle"; + +export interface Environment { + now(): nat64; + caller(): Principal; + canisterId(): Principal; +} + +export class CanisterEnvironment implements Environment { + now(): nat64 { + return ic.time(); + } + + caller(): Principal { + return ic.caller(); + } + + canisterId(): Principal { + return ic.id(); + } +} + +export class EmptyEnvironment implements Environment { + now(): nat64 { + throw "not implemented"; + } + + caller(): Principal { + throw "not implemented"; + } + + canisterId(): Principal { + throw "not implemented"; + } +} + +export class TestEnvironment implements Environment { + _now: nat64; + _caller: Principal; + _canisterId: Principal; + + constructor(now: nat64, caller: Principal, canisterId: Principal) { + this._now = now; + this._caller = caller; + this._canisterId = canisterId; + } + + now(): nat64 { + return this._now; + } + + caller(): Principal { + return this._caller; + } + + canisterId(): Principal { + return this._canisterId; + } +} diff --git a/dapps/azle/basic_dao/index.did b/dapps/azle/basic_dao/index.did new file mode 100644 index 00000000..d5f00508 --- /dev/null +++ b/dapps/azle/basic_dao/index.did @@ -0,0 +1,11 @@ +service: (record {system_params:record {transfer_fee:record {amount_e8s:nat64}; proposal_vote_threshold:record {amount_e8s:nat64}; proposal_submission_deposit:record {amount_e8s:nat64}}; accounts:vec record {owner:principal; tokens:record {amount_e8s:nat64}}; proposals:vec record {id:nat64; votes_no:record {amount_e8s:nat64}; voters:vec principal; state:variant {Failed:text; Open; Executing; Rejected; Succeeded; Accepted}; timestamp:nat64; proposer:principal; votes_yes:record {amount_e8s:nat64}; payload:record {method:text; canister_id:principal; message:vec nat8}}}) -> { + account_balance: () -> (record {amount_e8s:nat64}) query; + get_proposal: (nat64) -> (opt record {id:nat64; votes_no:record {amount_e8s:nat64}; voters:vec principal; state:variant {Failed:text; Open; Executing; Rejected; Succeeded; Accepted}; timestamp:nat64; proposer:principal; votes_yes:record {amount_e8s:nat64}; payload:record {method:text; canister_id:principal; message:vec nat8}}) query; + get_system_params: () -> (record {transfer_fee:record {amount_e8s:nat64}; proposal_vote_threshold:record {amount_e8s:nat64}; proposal_submission_deposit:record {amount_e8s:nat64}}) query; + list_accounts: () -> (vec record {owner:principal; tokens:record {amount_e8s:nat64}}) query; + list_proposals: () -> (vec record {id:nat64; votes_no:record {amount_e8s:nat64}; voters:vec principal; state:variant {Failed:text; Open; Executing; Rejected; Succeeded; Accepted}; timestamp:nat64; proposer:principal; votes_yes:record {amount_e8s:nat64}; payload:record {method:text; canister_id:principal; message:vec nat8}}) query; + submit_proposal: (record {method:text; canister_id:principal; message:vec nat8}) -> (variant {Ok:nat64; Err:text}); + transfer: (record {to:principal; amount:record {amount_e8s:nat64}}) -> (variant {Ok; Err:text}); + update_system_params: (record {transfer_fee:opt record {amount_e8s:nat64}; proposal_vote_threshold:opt record {amount_e8s:nat64}; proposal_submission_deposit:opt record {amount_e8s:nat64}}) -> (); + vote: (record {vote:variant {No; Yes}; proposal_id:nat64}) -> (variant {Ok:variant {Failed:text; Open; Executing; Rejected; Succeeded; Accepted}; Err:text}); +} diff --git a/dapps/azle/basic_dao/index.ts b/dapps/azle/basic_dao/index.ts new file mode 100644 index 00000000..7f98ee25 --- /dev/null +++ b/dapps/azle/basic_dao/index.ts @@ -0,0 +1,76 @@ +import { + Canister, + ic, + init, + nat64, + Null, + Opt, + postUpgrade, + preUpgrade, + query, + Result, + text, + update, + Vec, + Void, +} from "azle"; +import { BasicDaoService } from "./service"; +import { + Account, + BasicDaoStableStorage, + Proposal, + ProposalPayload, + ProposalState, + SystemParams, + Tokens, + TransferArgs, + UpdateSystemParamsPayload, + VoteArgs, +} from "./types"; +import { CanisterEnvironment } from "./env"; + +let service = BasicDaoService.default(); + +export default Canister({ + init: init([BasicDaoStableStorage], (initState) => { + ic.stableGrow(4096); + + let initService = BasicDaoService.from(initState); + initService.env = new CanisterEnvironment(); + + service = initService; + }), + // pre_upgrade: preUpgrade(() => {}), + // post_upgrade: postUpgrade([], () => {}), + get_system_params: query([], SystemParams, () => { + return service.systemParams; + }), + transfer: update([TransferArgs], Result(Null, text), (args) => { + return service.transfer(args); + }), + account_balance: query([], Tokens, () => { + return service.accountBalance(); + }), + list_accounts: query([], Vec(Account), () => { + return service.listAccounts(); + }), + submit_proposal: update( + [ProposalPayload], + Result(nat64, text), + (proposal) => { + return service.submitProposal(proposal); + } + ), + get_proposal: query([nat64], Opt(Proposal), (proposalId) => { + return service.getProposal(proposalId); + }), + list_proposals: query([], Vec(Proposal), () => { + return service.listProposals(); + }), + vote: update([VoteArgs], Result(ProposalState, text), (args) => { + return service.vote(args); + }), + update_system_params: update([UpdateSystemParamsPayload], Void, (payload) => { + return service.updateSystemParams(payload); + }), +}); diff --git a/dapps/azle/basic_dao/service.ts b/dapps/azle/basic_dao/service.ts new file mode 100644 index 00000000..8b99d5ef --- /dev/null +++ b/dapps/azle/basic_dao/service.ts @@ -0,0 +1,281 @@ +import { + Err, + nat64, + None, + Null, + Ok, + Opt, + Principal, + Result, + Some, + text, + Vec, + Void, +} from "azle"; +import { + Account, + BasicDaoStableStorage, + Proposal, + ProposalPayload, + ProposalState, + SystemParams, + Tokens, + TransferArgs, + UpdateSystemParamsPayload, + VoteArgs, +} from "./types"; +import { EmptyEnvironment, Environment } from "./env"; +import * as Default from "./defaults"; + +type BasicDaoConstructorArgs = { + env: Environment; + accounts: Map; + proposals: Map; + nextProposalId: nat64; + systemParams: SystemParams; +}; + +/** Implements the Basic DAO interface */ +export class BasicDaoService { + env: Environment; + accounts: Map; + proposals: Map; + nextProposalId: nat64; + systemParams: SystemParams; + + constructor({ + env, + accounts, + proposals, + nextProposalId, + systemParams, + }: BasicDaoConstructorArgs) { + this.env = env; + this.accounts = accounts; + this.proposals = proposals; + this.nextProposalId = nextProposalId; + this.systemParams = systemParams; + } + + static default(): BasicDaoService { + return new BasicDaoService({ + env: new EmptyEnvironment(), + accounts: new Map(), + proposals: new Map(), + nextProposalId: 0n, + systemParams: Default.systemParams(), + }); + } + + static from(stable: BasicDaoStableStorage) { + const accounts = new Map( + stable.accounts.map((account) => [account.owner, account.tokens]) + ); + const proposals = new Map( + stable.proposals.map((proposal) => [proposal.id, proposal]) + ); + + return new BasicDaoService({ + env: new EmptyEnvironment(), + accounts, + proposals, + nextProposalId: 0n, + systemParams: stable.system_params, + }); + } + + /** Transfer tokens from the caller's account to another account */ + transfer(transfer: TransferArgs): Result { + const caller = this.env.caller(); + + let account = this.accounts.get(caller); + + if (account === undefined) { + return Err("Caller needs an account to transfer funds"); + } + + if (account.amount_e8s < transfer.amount.amount_e8s) { + return Err( + `Caller's account has insufficient funds to transfer ${transfer.amount}` + ); + } else { + account.amount_e8s -= + transfer.amount.amount_e8s + this.systemParams.transfer_fee.amount_e8s; + + let toAccount = + this.accounts.get(transfer.to) ?? + (() => { + const newAccount = Default.tokens(); + this.accounts.set(transfer.to, newAccount); + return newAccount; + })(); + toAccount.amount_e8s += transfer.amount.amount_e8s; + } + + return Ok(null); + } + + /** Return the account balance of the caller */ + accountBalance(): Tokens { + const caller = this.env.caller(); + const tokens = this.accounts.get(caller); + + return tokens ?? Default.tokens(); + } + + /** Lists all accounts */ + listAccounts(): Account[] { + return Array.from(this.accounts.entries()).map(([key, value]) => ({ + owner: key, + tokens: value, + })); + } + + /** + * Submit a proposal + * + * A proposal contains a canister ID, method name and method args. If enough + * users vote "yes" on the proposal, the given method will be called with the + * given method args on the given canister. + */ + submitProposal(payload: ProposalPayload): Result { + const deductionResult = this.deductProposalSubmissionDeposit(); + + if (deductionResult.Err !== undefined) { + return deductionResult; + } + + const proposalId = this.nextProposalId; + this.nextProposalId += 1n; + + const proposal: Proposal = { + id: proposalId, + timestamp: this.env.now(), + proposer: this.env.caller(), + payload, + state: { Open: null }, + votes_yes: Default.tokens(), + votes_no: Default.tokens(), + voters: [], + }; + + this.proposals.set(proposalId, proposal); + + return Ok(proposalId); + } + + /** Return the proposal with the given ID, if one exists */ + getProposal(proposalId: nat64): Opt { + const proposal = this.proposals.get(proposalId); + + return proposal === undefined ? None : Some(proposal); + } + + /** Return the list of all proposals */ + listProposals(): Vec { + return Array.from(this.proposals.values()); + } + + /** Vote on an open proposal */ + vote(args: VoteArgs): Result { + const caller = this.env.caller(); + + let proposal = this.proposals.get(args.proposal_id); + + if (proposal === undefined) { + return Err(`No proposal with ID ${args.proposal_id} exists`); + } + + if (!("Open" in proposal.state)) { + return Err(`Proposal ${args.proposal_id} is not open for voting`); + } + + const votingTokens = this.accounts.get(caller); + + if (votingTokens === undefined) { + return Err(`Caller does not have any tokens to vote with`); + } + + if (proposal.voters.includes(this.env.caller())) { + return Err("Already voted"); + } + + if ("Yes" in args.vote) { + proposal.votes_yes.amount_e8s += votingTokens.amount_e8s; + } else { + proposal.votes_no.amount_e8s += votingTokens.amount_e8s; + } + + proposal.voters.push(caller); + + if ( + proposal.votes_yes.amount_e8s >= + this.systemParams.proposal_vote_threshold.amount_e8s + ) { + // Refund the proposal deposit when the proposal is accepted + let account = this.accounts.get(proposal.proposer); + + if (account !== undefined) { + account.amount_e8s += + this.systemParams.proposal_submission_deposit.amount_e8s; + } + + proposal.state = { Accepted: null }; + } + + if ( + proposal.votes_no.amount_e8s >= + this.systemParams.proposal_vote_threshold.amount_e8s + ) { + proposal.state = { Rejected: null }; + } + + return Ok(proposal.state); + } + + updateSystemParams(payload: UpdateSystemParamsPayload) { + if (this.env.caller().toText() !== this.env.canisterId().toText()) { + return; + } + + if (payload.transfer_fee.Some !== undefined) { + this.systemParams.transfer_fee.amount_e8s = + payload.transfer_fee.Some.amount_e8s; + } + + if (payload.proposal_vote_threshold.Some !== undefined) { + this.systemParams.proposal_vote_threshold.amount_e8s = + payload.proposal_vote_threshold.Some.amount_e8s; + } + + if (payload.proposal_submission_deposit.Some !== undefined) { + this.systemParams.proposal_submission_deposit.amount_e8s = + payload.proposal_submission_deposit.Some.amount_e8s; + } + } + + /** Deduct the proposal submission deposit from the caller's account */ + deductProposalSubmissionDeposit(): Result { + const caller = this.env.caller(); + + let account = this.accounts.get(caller); + + if (account === undefined) { + return Err("Caller needs an account to submit a proposal"); + } + + if ( + account.amount_e8s < + this.systemParams.proposal_submission_deposit.amount_e8s + ) { + return Err( + `Caller's account must have at least ${this.systemParams.proposal_submission_deposit} to submit a proposal` + ); + } + + account.amount_e8s -= + this.systemParams.proposal_submission_deposit.amount_e8s; + + return Ok(undefined); + } +} diff --git a/dapps/azle/basic_dao/types.ts b/dapps/azle/basic_dao/types.ts new file mode 100644 index 00000000..2b6c6ed1 --- /dev/null +++ b/dapps/azle/basic_dao/types.ts @@ -0,0 +1,90 @@ +import { + blob, + nat64, + Null, + Opt, + Principal, + Record, + text, + Variant, + Vec, +} from "azle"; + +export const Tokens = Record({ + amount_e8s: nat64, +}); +export type Tokens = typeof Tokens; + +export const TransferArgs = Record({ + to: Principal, + amount: Tokens, +}); +export type TransferArgs = typeof TransferArgs; + +export const Account = Record({ + owner: Principal, + tokens: Tokens, +}); +export type Account = typeof Account; + +export const ProposalPayload = Record({ + canister_id: Principal, + method: text, + message: blob, +}); +export type ProposalPayload = typeof ProposalPayload; + +export const ProposalState = Variant({ + Open: Null, + Accepted: Null, + Rejected: Null, + Executing: Null, + Succeeded: Null, + Failed: text, +}); +export type ProposalState = typeof ProposalState; + +export const Proposal = Record({ + id: nat64, + timestamp: nat64, + proposer: Principal, + payload: ProposalPayload, + state: ProposalState, + votes_yes: Tokens, + votes_no: Tokens, + voters: Vec(Principal), +}); +export type Proposal = typeof Proposal; + +export const SystemParams = Record({ + transfer_fee: Tokens, + proposal_vote_threshold: Tokens, + proposal_submission_deposit: Tokens, +}); +export type SystemParams = typeof SystemParams; + +export const UpdateSystemParamsPayload = Record({ + transfer_fee: Opt(Tokens), + proposal_vote_threshold: Opt(Tokens), + proposal_submission_deposit: Opt(Tokens), +}); +export type UpdateSystemParamsPayload = typeof UpdateSystemParamsPayload; + +export const Vote = Variant({ + Yes: Null, + No: Null, +}); +export type Vote = typeof Vote; + +export const VoteArgs = Record({ + proposal_id: nat64, + vote: Vote, +}); +export type VoteArgs = typeof VoteArgs; + +export const BasicDaoStableStorage = Record({ + accounts: Vec(Account), + proposals: Vec(Proposal), + system_params: SystemParams, +}); +export type BasicDaoStableStorage = typeof BasicDaoStableStorage; diff --git a/dapps/azle/dfx.json b/dapps/azle/dfx.json new file mode 100644 index 00000000..c3ae8ca9 --- /dev/null +++ b/dapps/azle/dfx.json @@ -0,0 +1,12 @@ +{ + "canisters": { + "basic_dao": { + "type": "custom", + "main": "basic_dao/index.ts", + "candid": "basic_dao/index.did", + "build": "npx azle basic_dao", + "wasm": ".azle/basic_dao/basic_dao.wasm", + "gzip": false + } + } +} diff --git a/dapps/azle/package-lock.json b/dapps/azle/package-lock.json new file mode 100644 index 00000000..cef65c36 --- /dev/null +++ b/dapps/azle/package-lock.json @@ -0,0 +1,906 @@ +{ + "name": "azle", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "azle": "^0.18.2" + } + }, + "node_modules/@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "engines": { + "node": ">= 12" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "dependencies": { + "@cspotcode/source-map-consumer": "0.8.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@dfinity/candid": { + "version": "0.19.2", + "resolved": "git+ssh://git@github.com/demergent-labs/candid.git#5797fa906b1a7cc30c161dbb0eb919283ce2f80d", + "license": "Apache-2.0", + "peerDependencies": { + "@dfinity/principal": "^0.19.2" + } + }, + "node_modules/@dfinity/principal": { + "version": "0.19.3", + "resolved": "https://registry.npmjs.org/@dfinity/principal/-/principal-0.19.3.tgz", + "integrity": "sha512-+nixVvdGt7ECxRvLXDXsvU9q9sSPssBtDQ4bXa149SK6gcYcmZ6lfWIi3DJNqj3tGROxILVBsguel9tECappsA==", + "dependencies": { + "@noble/hashes": "^1.3.1" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.4.tgz", + "integrity": "sha512-uBIbiYMeSsy2U0XQoOGVVcpIktjLMEKa7ryz2RLr7L/vTnANNEsPVAh4xOv7ondGz6ac1zVb0F8Jx20rQikffQ==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.4.tgz", + "integrity": "sha512-mRsi2vJsk4Bx/AFsNBqOH2fqedxn5L/moT58xgg51DjX1la64Z3Npicut2VbhvDFO26qjWtPMsVxCd80YTFVeg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.4.tgz", + "integrity": "sha512-4iPufZ1TMOD3oBlGFqHXBpa3KFT46aLl6Vy7gwed0ZSYgHaZ/mihbYb4t7Z9etjkC9Al3ZYIoOaHrU60gcMy7g==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.4.tgz", + "integrity": "sha512-Lviw8EzxsVQKpbS+rSt6/6zjn9ashUZ7Tbuvc2YENgRl0yZTktGlachZ9KMJUsVjZEGFVu336kl5lBgDN6PmpA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.4.tgz", + "integrity": "sha512-YHbSFlLgDwglFn0lAO3Zsdrife9jcQXQhgRp77YiTDja23FrC2uwnhXMNkAucthsf+Psr7sTwYEryxz6FPAVqw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.4.tgz", + "integrity": "sha512-vz59ijyrTG22Hshaj620e5yhs2dU1WJy723ofc+KUgxVCM6zxQESmWdMuVmUzxtGqtj5heHyB44PjV/HKsEmuQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.4.tgz", + "integrity": "sha512-3sRbQ6W5kAiVQRBWREGJNd1YE7OgzS0AmOGjDmX/qZZecq8NFlQsQH0IfXjjmD0XtUYqr64e0EKNFjMUlPL3Cw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.4.tgz", + "integrity": "sha512-z/4ArqOo9EImzTi4b6Vq+pthLnepFzJ92BnofU1jgNlcVb+UqynVFdoXMCFreTK7FdhqAzH0vmdwW5373Hm9pg==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.4.tgz", + "integrity": "sha512-ZWmWORaPbsPwmyu7eIEATFlaqm0QGt+joRE9sKcnVUG3oBbr/KYdNE2TnkzdQwX6EDRdg/x8Q4EZQTXoClUqqA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.4.tgz", + "integrity": "sha512-EGc4vYM7i1GRUIMqRZNCTzJh25MHePYsnQfKDexD8uPTCm9mK56NIL04LUfX2aaJ+C9vyEp2fJ7jbqFEYgO9lQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.4.tgz", + "integrity": "sha512-WVhIKO26kmm8lPmNrUikxSpXcgd6HDog0cx12BUfA2PkmURHSgx9G6vA19lrlQOMw+UjMZ+l3PpbtzffCxFDRg==", + "cpu": [ + "loong64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.4.tgz", + "integrity": "sha512-keYY+Hlj5w86hNp5JJPuZNbvW4jql7c1eXdBUHIJGTeN/+0QFutU3GrS+c27L+NTmzi73yhtojHk+lr2+502Mw==", + "cpu": [ + "mips64el" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.4.tgz", + "integrity": "sha512-tQ92n0WMXyEsCH4m32S21fND8VxNiVazUbU4IUGVXQpWiaAxOBvtOtbEt3cXIV3GEBydYsY8pyeRMJx9kn3rvw==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.4.tgz", + "integrity": "sha512-tRRBey6fG9tqGH6V75xH3lFPpj9E8BH+N+zjSUCnFOX93kEzqS0WdyJHkta/mmJHn7MBaa++9P4ARiU4ykjhig==", + "cpu": [ + "riscv64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.4.tgz", + "integrity": "sha512-152aLpQqKZYhThiJ+uAM4PcuLCAOxDsCekIbnGzPKVBRUDlgaaAfaUl5NYkB1hgY6WN4sPkejxKlANgVcGl9Qg==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.4.tgz", + "integrity": "sha512-Mi4aNA3rz1BNFtB7aGadMD0MavmzuuXNTaYL6/uiYIs08U7YMPETpgNn5oue3ICr+inKwItOwSsJDYkrE9ekVg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.4.tgz", + "integrity": "sha512-9+Wxx1i5N/CYo505CTT7T+ix4lVzEdz0uCoYGxM5JDVlP2YdDC1Bdz+Khv6IbqmisT0Si928eAxbmGkcbiuM/A==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.4.tgz", + "integrity": "sha512-MFsHleM5/rWRW9EivFssop+OulYVUoVcqkyOkjiynKBCGBj9Lihl7kh9IzrreDyXa4sNkquei5/DTP4uCk25xw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.4.tgz", + "integrity": "sha512-6Xq8SpK46yLvrGxjp6HftkDwPP49puU4OF0hEL4dTxqCbfx09LyrbUj/D7tmIRMj5D5FCUPksBbxyQhp8tmHzw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.4.tgz", + "integrity": "sha512-PkIl7Jq4mP6ke7QKwyg4fD4Xvn8PXisagV/+HntWoDEdmerB2LTukRZg728Yd1Fj+LuEX75t/hKXE2Ppk8Hh1w==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.4.tgz", + "integrity": "sha512-ga676Hnvw7/ycdKB53qPusvsKdwrWzEyJ+AtItHGoARszIqvjffTwaaW3b2L6l90i7MO9i+dlAW415INuRhSGg==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.4.tgz", + "integrity": "sha512-HP0GDNla1T3ZL8Ko/SHAS2GgtjOg+VmWnnYLhuTksr++EnduYB0f3Y2LzHsUwb2iQ13JGoY6G3R8h6Du/WG6uA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@noble/hashes": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", + "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@swc/core": { + "version": "1.3.93", + "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.93.tgz", + "integrity": "sha512-690GRr1wUGmGYZHk7fUduX/JUwViMF2o74mnZYIWEcJaCcd9MQfkhsxPBtjeg6tF+h266/Cf3RPYhsFBzzxXcA==", + "hasInstallScript": true, + "dependencies": { + "@swc/counter": "^0.1.1", + "@swc/types": "^0.1.5" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/swc" + }, + "optionalDependencies": { + "@swc/core-darwin-arm64": "1.3.93", + "@swc/core-darwin-x64": "1.3.93", + "@swc/core-linux-arm-gnueabihf": "1.3.93", + "@swc/core-linux-arm64-gnu": "1.3.93", + "@swc/core-linux-arm64-musl": "1.3.93", + "@swc/core-linux-x64-gnu": "1.3.93", + "@swc/core-linux-x64-musl": "1.3.93", + "@swc/core-win32-arm64-msvc": "1.3.93", + "@swc/core-win32-ia32-msvc": "1.3.93", + "@swc/core-win32-x64-msvc": "1.3.93" + }, + "peerDependencies": { + "@swc/helpers": "^0.5.0" + }, + "peerDependenciesMeta": { + "@swc/helpers": { + "optional": true + } + } + }, + "node_modules/@swc/core-darwin-arm64": { + "version": "1.3.93", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.93.tgz", + "integrity": "sha512-gEKgk7FVIgltnIfDO6GntyuQBBlAYg5imHpRgLxB1zSI27ijVVkksc6QwISzFZAhKYaBWIsFSVeL9AYSziAF7A==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-darwin-x64": { + "version": "1.3.93", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.3.93.tgz", + "integrity": "sha512-ZQPxm/fXdDQtn3yrYSL/gFfA8OfZ5jTi33yFQq6vcg/Y8talpZ+MgdSlYM0FkLrZdMTYYTNFiuBQuuvkA+av+Q==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-arm-gnueabihf": { + "version": "1.3.93", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.93.tgz", + "integrity": "sha512-OYFMMI2yV+aNe3wMgYhODxHdqUB/jrK0SEMHHS44GZpk8MuBXEF+Mcz4qjkY5Q1EH7KVQqXb/gVWwdgTHpjM2A==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-arm64-gnu": { + "version": "1.3.93", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.93.tgz", + "integrity": "sha512-BT4dT78odKnJMNiq5HdjBsv29CiIdcCcImAPxeFqAeFw1LL6gh9nzI8E96oWc+0lVT5lfhoesCk4Qm7J6bty8w==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-arm64-musl": { + "version": "1.3.93", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.93.tgz", + "integrity": "sha512-yH5fWEl1bktouC0mhh0Chuxp7HEO4uCtS/ly1Vmf18gs6wZ8DOOkgAEVv2dNKIryy+Na++ljx4Ym7C8tSJTrLw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-x64-gnu": { + "version": "1.3.93", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.93.tgz", + "integrity": "sha512-OFUdx64qvrGJhXKEyxosHxgoUVgba2ztYh7BnMiU5hP8lbI8G13W40J0SN3CmFQwPP30+3oEbW7LWzhKEaYjlg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-linux-x64-musl": { + "version": "1.3.93", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.93.tgz", + "integrity": "sha512-4B8lSRwEq1XYm6xhxHhvHmKAS7pUp1Q7E33NQ2TlmFhfKvCOh86qvThcjAOo57x8DRwmpvEVrqvpXtYagMN6Ig==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-win32-arm64-msvc": { + "version": "1.3.93", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.93.tgz", + "integrity": "sha512-BHShlxtkven8ZjjvZ5QR6sC5fZCJ9bMujEkiha6W4cBUTY7ce7qGFyHmQd+iPC85d9kD/0cCiX/Xez8u0BhO7w==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-win32-ia32-msvc": { + "version": "1.3.93", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.93.tgz", + "integrity": "sha512-nEwNWnz4JzYAK6asVvb92yeylfxMYih7eMQOnT7ZVlZN5ba9WF29xJ6kcQKs9HRH6MvWhz9+wRgv3FcjlU6HYA==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/core-win32-x64-msvc": { + "version": "1.3.93", + "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.93.tgz", + "integrity": "sha512-jibQ0zUr4kwJaQVwgmH+svS04bYTPnPw/ZkNInzxS+wFAtzINBYcU8s2PMWbDb2NGYiRSEeoSGyAvS9H+24JFA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=10" + } + }, + "node_modules/@swc/counter": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.2.tgz", + "integrity": "sha512-9F4ys4C74eSTEUNndnER3VJ15oru2NumfQxS8geE+f3eB5xvfxpWyqE5XlVnxb/R14uoXi6SLbBwwiDSkv+XEw==" + }, + "node_modules/@swc/types": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/@swc/types/-/types-0.1.5.tgz", + "integrity": "sha512-myfUej5naTBWnqOCc/MdVOLVjXUXtIA+NpDrDBKJtLLg2shUjBu3cZmB/85RyitKc55+lUUyl7oRfLOvkr2hsw==" + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==" + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==" + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==" + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==" + }, + "node_modules/@types/node": { + "version": "20.8.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.6.tgz", + "integrity": "sha512-eWO4K2Ji70QzKUqRy6oyJWUeB7+g2cRagT3T/nxYibYcT4y2BDL8lqolRXjTHmkZCdJfIPaY73KbJAZmcryxTQ==", + "peer": true, + "dependencies": { + "undici-types": "~5.25.1" + } + }, + "node_modules/@types/uuid": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.5.tgz", + "integrity": "sha512-xfHdwa1FMJ082prjSJpoEI57GZITiQz10r3vEJCHa2khEFQjKy91aWKz6+zybzssCvXUwE1LQWgWVwZ4nYUvHQ==" + }, + "node_modules/acorn": { + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" + }, + "node_modules/azle": { + "version": "0.18.4", + "resolved": "https://registry.npmjs.org/azle/-/azle-0.18.4.tgz", + "integrity": "sha512-kQWtlDM/sZS7K5A1e07rLBNMX9VMvoOhyIYtN7TnxK+XSEsGZyozJ1pBdvwVEn0rPRnGiLMZbiVBVIXiRkiiAw==", + "dependencies": { + "@dfinity/candid": "github:demergent-labs/candid#minimum_viable", + "@dfinity/principal": "^0.19.0", + "@swc/core": "^1.3.86", + "@types/uuid": "^9.0.4", + "buffer": "^6.0.3", + "esbuild": "^0.19.3", + "fs-extra": "10.0.1", + "js-sha256": "0.9.0", + "text-encoding": "0.7.0", + "ts-node": "10.3.1", + "typescript": "^5.2.2", + "uuid": "^9.0.1" + }, + "bin": { + "azle": "bin.js" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" + }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/esbuild": { + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.4.tgz", + "integrity": "sha512-x7jL0tbRRpv4QUyuDMjONtWFciygUxWaUM1kMX2zWxI0X2YWOt7MSA0g4UdeSiHM8fcYVzpQhKYOycZwxTdZkA==", + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.19.4", + "@esbuild/android-arm64": "0.19.4", + "@esbuild/android-x64": "0.19.4", + "@esbuild/darwin-arm64": "0.19.4", + "@esbuild/darwin-x64": "0.19.4", + "@esbuild/freebsd-arm64": "0.19.4", + "@esbuild/freebsd-x64": "0.19.4", + "@esbuild/linux-arm": "0.19.4", + "@esbuild/linux-arm64": "0.19.4", + "@esbuild/linux-ia32": "0.19.4", + "@esbuild/linux-loong64": "0.19.4", + "@esbuild/linux-mips64el": "0.19.4", + "@esbuild/linux-ppc64": "0.19.4", + "@esbuild/linux-riscv64": "0.19.4", + "@esbuild/linux-s390x": "0.19.4", + "@esbuild/linux-x64": "0.19.4", + "@esbuild/netbsd-x64": "0.19.4", + "@esbuild/openbsd-x64": "0.19.4", + "@esbuild/sunos-x64": "0.19.4", + "@esbuild/win32-arm64": "0.19.4", + "@esbuild/win32-ia32": "0.19.4", + "@esbuild/win32-x64": "0.19.4" + } + }, + "node_modules/fs-extra": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.1.tgz", + "integrity": "sha512-NbdoVMZso2Lsrn/QwLXOy6rm0ufY2zEOKCDzJR/0kBsb0E6qed0P3iYK+Ath3BfvXEeu4JhEtXLgILx5psUfag==", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/js-sha256": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.9.0.tgz", + "integrity": "sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==" + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" + }, + "node_modules/text-encoding": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/text-encoding/-/text-encoding-0.7.0.tgz", + "integrity": "sha512-oJQ3f1hrOnbRLOcwKz0Liq2IcrvDeZRHXhd9RgLrsT+DjWY/nty1Hi7v3dtkaEYbPYe0mUoOfzRrMwfXXwgPUA==", + "deprecated": "no longer maintained" + }, + "node_modules/ts-node": { + "version": "10.3.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.3.1.tgz", + "integrity": "sha512-Yw3W2mYzhHfCHOICGNJqa0i+rbL0rAyg7ZIHxU+K4pgY8gd2Lh1j+XbHCusJMykbj6RZMJVOY0MlHVd+GOivcw==", + "dependencies": { + "@cspotcode/source-map-support": "0.7.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/typescript": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "5.25.3", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.25.3.tgz", + "integrity": "sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA==", + "peer": true + }, + "node_modules/universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "engines": { + "node": ">=6" + } + } + } +} diff --git a/dapps/azle/package.json b/dapps/azle/package.json new file mode 100644 index 00000000..a1d65452 --- /dev/null +++ b/dapps/azle/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "azle": "^0.18.2" + } +} diff --git a/dapps/azle/tsconfig.json b/dapps/azle/tsconfig.json new file mode 100644 index 00000000..1388b861 --- /dev/null +++ b/dapps/azle/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "strict": true, + "target": "ES2020", + "experimentalDecorators": true, + "strictPropertyInitialization": false, + "moduleResolution": "node", + "allowJs": true, + "outDir": "HACK_BECAUSE_OF_ALLOW_JS" + } +} diff --git a/dapps/basic_dao.sh b/dapps/basic_dao.sh index 46f4d0d1..93132305 100644 --- a/dapps/basic_dao.sh +++ b/dapps/basic_dao.sh @@ -10,6 +10,7 @@ identity genesis; let motoko = wasm_profiling("motoko/.dfx/local/canisters/basic_dao/basic_dao.wasm", mo_config); let rust = wasm_profiling("rust/.dfx/local/canisters/basic_dao/basic_dao.wasm", rs_config); +let azle = wasm_profiling("azle/.dfx/local/canisters/basic_dao/basic_dao.wasm", ts_config); let file = "README.md"; output(file, "\n## Basic DAO\n\n| |binary_size|init|transfer_token|submit_proposal|vote_proposal|upgrade|\n|--|--:|--:|--:|--:|--:|--:|\n"); @@ -18,16 +19,16 @@ function perf(wasm, title) { let init = encode wasm.__init_args( record { accounts = vec { - record { owner = genesis; tokens = record { amount_e8s = 1_000_000_000_000 } }; - record { owner = alice; tokens = record { amount_e8s = 100 } }; - record { owner = bob; tokens = record { amount_e8s = 200 } }; - record { owner = cathy; tokens = record { amount_e8s = 300 } }; + record { owner = genesis; tokens = record { amount_e8s = (1_000_000_000_000: nat64) } }; + record { owner = alice; tokens = record { amount_e8s = (100: nat64) } }; + record { owner = bob; tokens = record { amount_e8s = (200: nat64) } }; + record { owner = cathy; tokens = record { amount_e8s = (300: nat64) } }; }; proposals = vec {}; system_params = record { - transfer_fee = record { amount_e8s = 100 }; - proposal_vote_threshold = record { amount_e8s = 100 }; - proposal_submission_deposit = record { amount_e8s = 100 }; + transfer_fee = record { amount_e8s = (100: nat64) }; + proposal_vote_threshold = record { amount_e8s = (100: nat64) }; + proposal_submission_deposit = record { amount_e8s = (100: nat64) }; }; } ); @@ -37,14 +38,14 @@ call DAO.__get_cycles(); output(file, stringify("|", title, "|", wasm.size(), "|", _, "|")); // transfer tokens -let _ = call DAO.transfer(record { to = dory; amount = record { amount_e8s = 400 } }); +let _ = call DAO.transfer(record { to = dory; amount = record { amount_e8s = (400: nat64) } }); let svg = stringify(title, "_dao_transfer.svg"); output(file, stringify("[", __cost__, "](", svg, ")|")); flamegraph(DAO, "DAO.transfer", svg); // alice makes a proposal identity alice; -let update_transfer_fee = record { transfer_fee = opt record { amount_e8s = 10_000 } }; +let update_transfer_fee = record { transfer_fee = opt record { amount_e8s = (10_000: nat64) } }; call DAO.submit_proposal( record { canister_id = DAO; @@ -76,3 +77,4 @@ assert _?.proposer == alice; perf(motoko, "Motoko"); perf(rust, "Rust"); +perf(azle, "Azle"); diff --git a/prelude.sh b/prelude.sh index 7f0f880d..5c75c7aa 100644 --- a/prelude.sh +++ b/prelude.sh @@ -35,3 +35,4 @@ function get_memory(cid) { let mo_config = record { start_page = 16; page_limit = 4096 }; let rs_config = record { start_page = 1; page_limit = 4096 }; +let ts_config = record { start_page = 1; page_limit = 4096 };