import { assert, ByteString, hash256, method, prop, SmartContract, FixedArray, fill, toByteString } from 'scrypt-ts'
// TODO: Define `Candidate` type.
export const N = 2
export type Candidates = FixedArray<Candidate, typeof N>
export class Voting extends SmartContract {
@prop(true)
candidates: Candidates
constructor(names: FixedArray<Name, typeof N>) {
super(...arguments)
// initialize fixed array
this.candidates = fill({
name: toByteString(''),
votesReceived: 0n,
}, N)
// set names and set votes they received to 0
for (let i = 0; i < N; i++) {
this.candidates[i] = {
name: names[i],
votesReceived: 0n,
}
}
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX