token_freeze_v1.zk 643 B

123456789101112131415161718192021222324252627
  1. k = 13;
  2. field = "pallas";
  3. constant "TokenFreeze_V1" {
  4. EcFixedPointBase NULLIFIER_K,
  5. }
  6. witness "TokenFreeze_V1" {
  7. # Token mint authority secret
  8. Base mint_authority,
  9. }
  10. circuit "TokenFreeze_V1" {
  11. # TokenID derivation path (See darkfi_sdk::crypto::ContractId)
  12. derivation_path = witness_base(69);
  13. # Derive public key for the mint authority
  14. mint_public = ec_mul_base(mint_authority, NULLIFIER_K);
  15. mint_x = ec_get_x(mint_public);
  16. mint_y = ec_get_y(mint_public);
  17. constrain_instance(mint_x);
  18. constrain_instance(mint_y);
  19. # Derive the token ID
  20. token_id = poseidon_hash(derivation_path, mint_x, mint_y);
  21. constrain_instance(token_id);
  22. }