-
Notifications
You must be signed in to change notification settings - Fork 100
Expand file tree
/
Copy pathdeploy_contract.ts
More file actions
30 lines (22 loc) · 1.3 KB
/
deploy_contract.ts
File metadata and controls
30 lines (22 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { EasyPrivateVotingContract } from "../src/artifacts/EasyPrivateVoting.js"
import { createLogger, PXE, Logger, SponsoredFeePaymentMethod, Fr } from "@aztec/aztec.js";
import { TokenContract } from "@aztec/noir-contracts.js/Token"
import { setupPXE } from "../src/utils/setup_pxe.js";
import { getSponsoredFPCInstance } from "../src/utils/sponsored_fpc.js";
import { SponsoredFPCContract } from "@aztec/noir-contracts.js/SponsoredFPC";
import { deploySchnorrAccount } from "../src/utils/deploy_account.js";
async function main() {
let pxe: PXE;
let logger: Logger;
logger = createLogger('aztec:aztec-starter');
pxe = await setupPXE();
const sponsoredFPC = await getSponsoredFPCInstance();
await pxe.registerContract({ instance: sponsoredFPC, artifact: SponsoredFPCContract.artifact });
const sponsoredPaymentMethod = new SponsoredFeePaymentMethod(sponsoredFPC.address);
let accountManager = await deploySchnorrAccount(pxe);
const wallet = await accountManager.getWallet();
const address = await accountManager.getAddress();
const votingContract = await EasyPrivateVotingContract.deploy(wallet, address).send({ fee: { paymentMethod: sponsoredPaymentMethod } }).deployed({timeout: 120000});
logger.info(`Voting Contract deployed at: ${votingContract.address}`);
}
main();