Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fix 3. double signing #21

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions 3.restricted-mint-multisig/imports/multisig.leo
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ program multisig.aleo {
mapping required_signatures: bool => u64;
mapping proposals: Proposal => u64;
mapping signers: address => bool;
mapping block: ProposalSigner => bool;

struct ProposalSigner {
proposal: Proposal,
signer: address,
}

struct Proposal {
program_address: address,
Expand Down Expand Up @@ -40,9 +46,18 @@ program multisig.aleo {
}

finalize sign(caller: address, proposal: Proposal) {
let temp: ProposalSigner = ProposalSigner {
proposal: proposal,
signer: caller,
};
let is_blocked: bool = Mapping::get_or_use(block, temp, false);
assert_eq(is_blocked, false);

assert(Mapping::get(signers, caller));
let signatures: u64 = Mapping::get_or_use(proposals, proposal, 0u64);
Mapping::set(proposals, proposal, signatures + 1u64);

Mapping::set(block, temp, true);
}

transition add_signer(ticket_: ticket, new_signer: address) {
Expand Down