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

Learn Badge - Stable Workshop #26

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
18 changes: 17 additions & 1 deletion 3.restricted-mint-multisig/imports/multisig.leo
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -40,6 +48,14 @@ program multisig.aleo {
}

finalize sign(caller: address, proposal: Proposal) {
let unique:UniqueSign = UniqueSign {
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);
Expand Down