Skip to content

Instantly share code, notes, and snippets.

@Tschakki
Tschakki / cast-vote_transaction.js
Created June 8, 2020 13:19
Decentralized Organization Chain - Add Poll tx snippet
if (recipient.asset.poll.votes) {
let votes = recipient.asset.poll.votes;
if (votes[vote]) {
++votes[vote];
recipient.asset.poll.votes = votes;
} else {
recipient.asset.poll.votes = { ...votes, [vote]: 1 };
}
} else {
recipient.asset.poll.votes = { [vote]: 1 };
@Tschakki
Tschakki / add-poll_transaction.js
Created June 8, 2020 13:16
Decentralized Organization Chain - Add Poll tx snippet
if (sender.asset.user.type !== "board") {
errors.push(
new TransactionError("Sender is not registered as a board member.")
);
}
@Tschakki
Tschakki / register-investor_transaction.js
Created June 8, 2020 12:39
Decentralized Organization Chain - Register Investor tx snippet
if (!user.type || user.type !== "investor") {
errors.push(
new TransactionError("Invalid user type for this transaction.")
);
}