Variable NewsletterProgramConst
NewsletterProgram: "program newsletter_v0_1_0.aleo;\n\nstruct Bytes24:\n b0 as u8;\n b1 as u8;\n b2 as u8;\n b3 as u8;\n b4 as u8;\n b5 as u8;\n b6 as u8;\n b7 as u8;\n b8 as u8;\n b9 as u8;\n b10 as u8;\n b11 as u8;\n b12 as u8;\n b13 as u8;\n b14 as u8;\n b15 as u8;\n b16 as u8;\n b17 as u8;\n b18 as u8;\n b19 as u8;\n b20 as u8;\n b21 as u8;\n b22 as u8;\n b23 as u8;\n\nstruct Bytes64:\n b0 as u128;\n b1 as u128;\n b2 as u128;\n b3 as u128;\n\nstruct SharedSecret:\n shared_public_key as Bytes64;\n recipient as Bytes64;\n\nstruct SharedIssue:\n nonce as Bytes64;\n path as Bytes64;\n\nrecord Newsletter:\n owner as address.private;\n op as address.private;\n id as field.private;\n member_sequence as field.private;\n base as boolean.private;\n revision as boolean.private;\n title as Bytes64.private;\n title_nonce as Bytes24.private;\n template as Bytes64.private;\n template_nonce as Bytes24.private;\n content as Bytes64.private;\n content_nonce as Bytes24.private;\n group_symmetric_key as Bytes64.private;\n individual_private_key as Bytes64.private;\n\nrecord Subscription:\n owner as address.private;\n op as address.private;\n id as field.private;\n member_sequence as field.private;\n member_secret_idx as field.private;\n\n\nmapping newsletter_member_sequence:\n\tkey left as field.public;\n\tvalue right as field.public;\n\n\nmapping member_secrets:\n\tkey left as field.public;\n\tvalue right as SharedSecret.public;\n\n\nmapping newsletter_issue_sequence:\n\tkey left as field.public;\n\tvalue right as field.public;\n\n\nmapping newsletter_issues:\n\tkey left as field.public;\n\tvalue right as SharedIssue.public;\n\nclosure cantors_pairing:\n input r0 as field;\n input r1 as field;\n add r0 r1 into r2;\n add r0 r1 into r3;\n add r3 1field into r4;\n mul r2 r4 into r5;\n div r5 2field into r6;\n add r6 r1 into r7;\n output r7 as field;\n\n\nclosure is_empty_bytes64:\n input r0 as Bytes64;\n is.eq r0.b0 r0.b1 into r1;\n is.eq r0.b0 0u128 into r2;\n and r1 r2 into r3;\n is.eq r0.b2 r0.b3 into r4;\n is.eq r0.b2 0u128 into r5;\n and r4 r5 into r6;\n and r3 r6 into r7;\n output r7 as boolean;\n\n\nfunction main:\n input r0 as Bytes64.private;\n input r1 as Bytes24.private;\n input r2 as Bytes64.private;\n input r3 as Bytes24.private;\n input r4 as Bytes64.private;\n input r5 as Bytes24.private;\n input r6 as Bytes64.private;\n input r7 as Bytes64.private;\n input r8 as Bytes64.private;\n input r9 as Bytes64.private;\n call is_empty_bytes64 r8 into r10;\n not r10 into r11;\n assert.eq r11 true;\n call is_empty_bytes64 r9 into r12;\n not r12 into r13;\n assert.eq r13 true;\n hash.bhp256 r6 into r14 as field; call cantors_pairing r14 1field into r15;\n cast self.caller self.caller r14 1field true false r0 r1 r2 r3 r4 r5 r6 r7 into r16 as Newsletter.record;\n output r16 as Newsletter.record;\n\n finalize r14 1field r15 r8 r9;\n\nfinalize main:\n input r0 as field.public;\n input r1 as field.public;\n input r2 as field.public;\n input r3 as Bytes64.public;\n input r4 as Bytes64.public;\n is.eq r1 1field into r5;\n assert.eq r5 true;\n contains newsletter_member_sequence[r0] into r6;\n is.eq r6 false into r7;\n assert.eq r7 true;\n contains member_secrets[r2] into r8;\n is.eq r8 false into r9;\n assert.eq r9 true;\n set r1 into newsletter_member_sequence[r0];\n cast r3 r4 into r10 as SharedSecret;\n set r10 into member_secrets[r2];\n\n\nfunction invite:\n input r0 as Newsletter.record;\n input r1 as address.private;\n is.eq r0.owner self.caller into r2;\n assert.eq r2 true;\n is.eq r0.op self.caller into r3;\n assert.eq r3 true;\n is.eq r0.base true into r4;\n assert.eq r4 true;\n is.eq r0.revision false into r5;\n assert.eq r5 true;\n add r0.member_sequence 1field into r6;\n cast 0u128 0u128 0u128 0u128 into r7 as Bytes64;\n cast self.caller r0.op r0.id r6 r0.base r0.revision r0.title r0.title_nonce r0.template r0.template_nonce r0.content r0.content_nonce r0.group_symmetric_key r0.individual_private_key into r8 as Newsletter.record;\n not r0.base into r9;\n not r0.revision into r10;\n cast r1 r0.op r0.id r6 r9 r10 r0.title r0.title_nonce r0.template r0.template_nonce r0.content r0.content_nonce r0.group_symmetric_key r7 into r11 as Newsletter.record;\n output r8 as Newsletter.record;\n output r11 as Newsletter.record;\n\n finalize r0.id r6;\n\nfinalize invite:\n input r0 as field.public;\n input r1 as field.public;\n contains newsletter_member_sequence[r0] into r2;\n is.eq r2 true into r3;\n assert.eq r3 true;\n set r1 into newsletter_member_sequence[r0];\n\n\nfunction accept:\n input r0 as Newsletter.record;\n input r1 as Bytes64.private;\n input r2 as Bytes64.private;\n input r3 as Bytes64.private;\n is.eq self.caller r0.owner into r4;\n assert.eq r4 true;\n is.neq self.caller r0.op into r5;\n assert.eq r5 true;\n is.eq r0.base false into r6;\n assert.eq r6 true;\n is.eq r0.revision true into r7;\n assert.eq r7 true;\n call is_empty_bytes64 r2 into r8;\n not r8 into r9;\n assert.eq r9 true;\n call is_empty_bytes64 r3 into r10;\n not r10 into r11;\n assert.eq r11 true;\n call cantors_pairing r0.id r0.member_sequence into r12;\n cast self.caller r0.op r0.id r0.member_sequence r0.base r0.revision r0.title r0.title_nonce r0.template r0.template_nonce r0.content r0.content_nonce r0.group_symmetric_key r1 into r13 as Newsletter.record;\n cast self.caller r0.op r0.id r0.member_sequence r12 into r14 as Subscription.record;\n cast r0.op r0.op r0.id r0.member_sequence r12 into r15 as Subscription.record;\n output r13 as Newsletter.record;\n output r14 as Subscription.record;\n output r15 as Subscription.record;\n\n finalize r12 r2 r3;\n\nfinalize accept:\n input r0 as field.public;\n input r1 as Bytes64.public;\n input r2 as Bytes64.public;\n contains member_secrets[r0] into r3;\n is.eq r3 false into r4;\n assert.eq r4 true;\n cast r1 r2 into r5 as SharedSecret;\n set r5 into member_secrets[r0];\n\n\nfunction deliver:\n input r0 as Newsletter.record;\n input r1 as Bytes64.private;\n input r2 as Bytes24.private;\n input r3 as Bytes64.private;\n input r4 as Bytes24.private;\n input r5 as Bytes64.private;\n input r6 as Bytes64.private;\n is.eq r0.owner self.caller into r7;\n assert.eq r7 true;\n call is_empty_bytes64 r5 into r8;\n not r8 into r9;\n assert.eq r9 true;\n call is_empty_bytes64 r6 into r10;\n not r10 into r11;\n assert.eq r11 true;\n cast self.caller r0.op r0.id r0.member_sequence r0.base r0.revision r1 r2 r0.template r0.template_nonce r3 r4 r0.group_symmetric_key r0.individual_private_key into r12 as Newsletter.record;\n output r12 as Newsletter.record;\n\n finalize r0.id r5 r6;\n\nfinalize deliver:\n input r0 as field.public;\n input r1 as Bytes64.public;\n input r2 as Bytes64.public;\n get.or_use newsletter_issue_sequence[r0] 0field into r3;\n add r0 r3 into r4;\n add r0 r3 into r5;\n add r5 1field into r6;\n mul r4 r6 into r7;\n div r7 2field into r8;\n add r8 r3 into r9;\n contains newsletter_issues[r9] into r10;\n is.eq r10 false into r11;\n assert.eq r11 true;\n add r3 1field into r12;\n set r12 into newsletter_issue_sequence[r0];\n cast r2 r1 into r13 as SharedIssue;\n set r13 into newsletter_issues[r9];\n\n\nfunction update:\n input r0 as Newsletter.record;\n input r1 as Bytes64.private;\n input r2 as Bytes24.private;\n input r3 as Bytes64.private;\n input r4 as Bytes24.private;\n input r5 as Bytes64.private;\n input r6 as Bytes24.private;\n is.eq r0.owner self.caller into r7;\n assert.eq r7 true;\n is.eq r0.base true into r8;\n assert.eq r8 true;\n is.eq r0.revision false into r9;\n assert.eq r9 true;\n cast self.caller r0.op r0.id r0.member_sequence r0.base r0.revision r1 r2 r3 r4 r5 r6 r0.group_symmetric_key r0.individual_private_key into r10 as Newsletter.record;\n output r10 as Newsletter.record;\n\n\nfunction unsub:\n input r0 as Subscription.record;\n is.eq r0.owner self.caller into r1;\n is.eq r0.op self.caller into r2;\n or r1 r2 into r3;\n assert.eq r3 true;\n is.eq r0.owner self.caller into r4;\n output r4 as boolean.private;\n\n finalize r0.member_secret_idx;\n\nfinalize unsub:\n input r0 as field.public;\n contains member_secrets[r0] into r1;\n is.eq r1 true into r2;\n assert.eq r2 true;\n remove member_secrets[r0];\n" = ...
This is the newsletter program deployed on Aleo Testnet v3. It is meant to review and be used with the deploy action for the leo wallet to deploy.