@0xflydev/labz 1.0.16 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ethers } from "hardhat";
|
|
2
|
+
|
|
3
|
+
async function main() {
|
|
4
|
+
const itemDescription = "Rare Digital Collectible";
|
|
5
|
+
const durationSeconds = 86400; // 1 day
|
|
6
|
+
|
|
7
|
+
console.log("Deploying {{CONTRACT_NAME}}...");
|
|
8
|
+
console.log(" Item:", itemDescription);
|
|
9
|
+
console.log(" Duration:", durationSeconds / 3600, "hours");
|
|
10
|
+
|
|
11
|
+
const AuctionFactory = await ethers.getContractFactory("{{CONTRACT_NAME}}");
|
|
12
|
+
const auction = await AuctionFactory.deploy(itemDescription, durationSeconds);
|
|
13
|
+
|
|
14
|
+
await auction.waitForDeployment();
|
|
15
|
+
|
|
16
|
+
const address = await auction.getAddress();
|
|
17
|
+
console.log("\n{{CONTRACT_NAME}} deployed to:", address);
|
|
18
|
+
|
|
19
|
+
console.log("\nAuction Lifecycle:");
|
|
20
|
+
console.log(" 1. Bid: bid(encryptedAmount, inputProof)");
|
|
21
|
+
console.log(" - Bids are encrypted and sealed");
|
|
22
|
+
console.log(" - No one can see competitors' bids");
|
|
23
|
+
console.log(" 2. Wait: Auction runs until endTime");
|
|
24
|
+
console.log(" 3. Request Reveal: requestWinnerReveal()");
|
|
25
|
+
console.log(" - Marks winner for decryption");
|
|
26
|
+
console.log(" 4. Finalize: finalizeWinner(winnerAddress, winningBid, proof)");
|
|
27
|
+
console.log(" - Verifies decryption proof");
|
|
28
|
+
console.log(" - Announces winner");
|
|
29
|
+
console.log("\nPrivacy Guarantees:");
|
|
30
|
+
console.log(" - Bids encrypted until reveal");
|
|
31
|
+
console.log(" - Losing bids never disclosed");
|
|
32
|
+
console.log(" - Fair competition guaranteed");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
main().catch((error) => {
|
|
36
|
+
console.error(error);
|
|
37
|
+
process.exitCode = 1;
|
|
38
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ethers } from "hardhat";
|
|
2
|
+
|
|
3
|
+
async function main() {
|
|
4
|
+
const tokenName = "Confidential Token";
|
|
5
|
+
const tokenSymbol = "CFHE";
|
|
6
|
+
|
|
7
|
+
console.log("Deploying {{CONTRACT_NAME}}...");
|
|
8
|
+
console.log(" Name:", tokenName);
|
|
9
|
+
console.log(" Symbol:", tokenSymbol);
|
|
10
|
+
|
|
11
|
+
const TokenFactory = await ethers.getContractFactory("{{CONTRACT_NAME}}");
|
|
12
|
+
const token = await TokenFactory.deploy(tokenName, tokenSymbol);
|
|
13
|
+
|
|
14
|
+
await token.waitForDeployment();
|
|
15
|
+
|
|
16
|
+
const address = await token.getAddress();
|
|
17
|
+
console.log("\n{{CONTRACT_NAME}} deployed to:", address);
|
|
18
|
+
|
|
19
|
+
console.log("\nToken Operations:");
|
|
20
|
+
console.log(" - mint(to, encryptedAmount): Mint tokens (owner only)");
|
|
21
|
+
console.log(" - transfer(to, encryptedAmount): Transfer tokens");
|
|
22
|
+
console.log(" - balanceOf(account): Get encrypted balance handle");
|
|
23
|
+
console.log("\nPrivacy Guarantees:");
|
|
24
|
+
console.log(" - Balances are encrypted");
|
|
25
|
+
console.log(" - Transfer amounts are private");
|
|
26
|
+
console.log(" - Only balance owner can decrypt");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
main().catch((error) => {
|
|
30
|
+
console.error(error);
|
|
31
|
+
process.exitCode = 1;
|
|
32
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ethers } from "hardhat";
|
|
2
|
+
|
|
3
|
+
async function main() {
|
|
4
|
+
console.log("Deploying {{CONTRACT_NAME}}...");
|
|
5
|
+
|
|
6
|
+
const VotingFactory = await ethers.getContractFactory("{{CONTRACT_NAME}}");
|
|
7
|
+
const voting = await VotingFactory.deploy();
|
|
8
|
+
|
|
9
|
+
await voting.waitForDeployment();
|
|
10
|
+
|
|
11
|
+
const address = await voting.getAddress();
|
|
12
|
+
console.log("\n{{CONTRACT_NAME}} deployed to:", address);
|
|
13
|
+
|
|
14
|
+
console.log("\nVoting Operations:");
|
|
15
|
+
console.log(" - createProposal(title, description, duration): Create proposal");
|
|
16
|
+
console.log(" - vote(proposalId, encryptedVote): Cast encrypted vote");
|
|
17
|
+
console.log(" - requestTally(proposalId): Request vote count reveal");
|
|
18
|
+
console.log(" - finalizeTally(proposalId, yesVotes, noVotes, proof): Finalize");
|
|
19
|
+
console.log("\nPrivacy Guarantees:");
|
|
20
|
+
console.log(" - Individual votes are encrypted");
|
|
21
|
+
console.log(" - Only final tally is revealed");
|
|
22
|
+
console.log(" - No one knows how you voted");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
main().catch((error) => {
|
|
26
|
+
console.error(error);
|
|
27
|
+
process.exitCode = 1;
|
|
28
|
+
});
|