From 9a87b47409a2b11117f5f009517de915e2bd6c4e Mon Sep 17 00:00:00 2001 From: KayaKerem Date: Wed, 15 Nov 2023 16:21:12 +0300 Subject: [PATCH 1/2] hasSigned issue --- .vscode/settings.json | 1 + .../imports/multisig.leo | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/3.restricted-mint-multisig/imports/multisig.leo b/3.restricted-mint-multisig/imports/multisig.leo index 1652050..66ed4dc 100644 --- a/3.restricted-mint-multisig/imports/multisig.leo +++ b/3.restricted-mint-multisig/imports/multisig.leo @@ -3,13 +3,21 @@ program multisig.aleo { const CHANGE_REQUIRED_SIGNATURES_FN: field = 2field; mapping required_signatures: bool => u64; - mapping proposals: Proposal => u64; mapping signers: address => bool; + mapping isSigned: UniqueSign => bool; + mapping proposals: Proposal => u64; + + + struct UniqueSign { + user: address, + proposal: Proposal + } struct Proposal { program_address: address, function_id: field, args_hash: field, + } record ticket { @@ -40,6 +48,12 @@ program multisig.aleo { } finalize sign(caller: address, proposal: Proposal) { + let unique:UniqueSign = UniqueSign { + user: caller, + proposal: proposal + }; + + assert(!Mapping::get(isSigned, unique)); assert(Mapping::get(signers, caller)); let signatures: u64 = Mapping::get_or_use(proposals, proposal, 0u64); Mapping::set(proposals, proposal, signatures + 1u64); @@ -75,4 +89,4 @@ program multisig.aleo { } transition burn(ticket_: ticket) {} -} +} \ No newline at end of file From a10ef5790ffe16e0182f1db38e03f92971aefa8e Mon Sep 17 00:00:00 2001 From: Kerem Kaya <56508511+KayaKerem@users.noreply.github.com> Date: Wed, 15 Nov 2023 17:05:37 +0300 Subject: [PATCH 2/2] Update multisig.leo --- 3.restricted-mint-multisig/imports/multisig.leo | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/3.restricted-mint-multisig/imports/multisig.leo b/3.restricted-mint-multisig/imports/multisig.leo index 66ed4dc..98e0435 100644 --- a/3.restricted-mint-multisig/imports/multisig.leo +++ b/3.restricted-mint-multisig/imports/multisig.leo @@ -52,8 +52,10 @@ program multisig.aleo { user: caller, proposal: proposal }; - + assert(!Mapping::get(isSigned, unique)); + Mapping::set(isSigned,unique,true) + assert(Mapping::get(signers, caller)); let signatures: u64 = Mapping::get_or_use(proposals, proposal, 0u64); Mapping::set(proposals, proposal, signatures + 1u64); @@ -89,4 +91,4 @@ program multisig.aleo { } transition burn(ticket_: ticket) {} -} \ No newline at end of file +}