Monorepo for Aesthetic.Computer
aesthetic.computer
1/**
2 * Keeps FA2 v5 Release Candidate - Offline Source Checks
3 *
4 * These tests intentionally avoid network access.
5 * They validate local v5 contract source invariants required for the v5 RC (v6 will be production).
6 */
7
8import fs from 'node:fs';
9import path from 'node:path';
10
11describe('🚀 Keeps FA2 v5 Release Candidate - Source Checks', () => {
12 const v5ContractPath = path.join(process.cwd(), 'tezos', 'keeps_fa2_v5.py');
13 const launchPlanPath = path.join(process.cwd(), 'tezos', 'V5-LAUNCH-PLAN.md');
14
15 let v5ContractSource;
16 let launchPlanSource;
17
18 beforeAll(() => {
19 v5ContractSource = fs.readFileSync(v5ContractPath, 'utf8');
20 launchPlanSource = fs.readFileSync(launchPlanPath, 'utf8');
21 });
22
23 it('uses v5 default keep fee of 2.5 XTZ', () => {
24 expect(v5ContractSource).toContain('self.data.keep_fee = sp.mutez(2500000)');
25 });
26
27 it('has explicit v5 pause/edit rejection messages', () => {
28 expect(v5ContractSource).toContain('"MINTING_PAUSED"');
29 expect(v5ContractSource).toContain('"EDITING_PAUSED"');
30 expect(v5ContractSource).toContain('"INSUFFICIENT_FEE"');
31 });
32
33 it('preserves v4 safety entrypoints in v5 contract', () => {
34 const requiredEntrypoints = [
35 'def pause(',
36 'def unpause(',
37 'def set_default_royalty(',
38 'def admin_transfer('
39 ];
40
41 requiredEntrypoints.forEach((entrypoint) => {
42 expect(v5ContractSource).toContain(entrypoint);
43 });
44 });
45
46 it('keeps duplicate prevention and creator tracking', () => {
47 expect(v5ContractSource).toContain('self.data.content_hashes');
48 expect(v5ContractSource).toContain('self.data.token_creators');
49 expect(v5ContractSource).toContain('"DUPLICATE_CONTENT_HASH"');
50 });
51
52 it('preserves content_hash as immutable during edit_metadata', () => {
53 // edit_metadata must read existing content_hash and re-inject after update
54 expect(v5ContractSource).toContain('original_hash = existing_info.get("content_hash"');
55 expect(v5ContractSource).toContain('token_info["content_hash"] = original_hash');
56 });
57
58 it('preserves royalties as immutable during edit_metadata', () => {
59 // edit_metadata must keep the original royalties bytes after update
60 expect(v5ContractSource).toContain('original_royalties = existing_info.get("royalties"');
61 expect(v5ContractSource).toContain('token_info["royalties"] = original_royalties');
62 });
63
64 it('documents v5 launch as the release candidate path', () => {
65 expect(launchPlanSource).toContain('Keeps FA2 v5 Launch Plan');
66 expect(launchPlanSource).toContain('Goal:**');
67 expect(launchPlanSource).toContain('Create `keeps_fa2_v5.py` from v4');
68 });
69});