diff --git a/index.mjs b/index.mjs index 24ea358..c20284c 100644 --- a/index.mjs +++ b/index.mjs @@ -4,7 +4,7 @@ const stdlib = loadStdlib(process.env); const startingBalance = stdlib.parseCurrency(100); -const accGovernor=await stdlib.newTestAccount(2, startingBalance); +const accGovernor= await stdlib.newTestAccount(2, startingBalance); console.log('Hello, Alice and Bob!'); console.log('Launching...'); @@ -17,8 +17,8 @@ console.log('Starting backends...'); const voters=[] const startingVoting=()=>{ - const acc =await stdlib.newTestAccount(startingBalance) - const ctc=acc.Contract(backend,ctcGovernor.getInfo()) + const acc = await stdlib.newTestAccount(startingBalance) + const ctc = acc.Contract(backend,ctcGovernor.getInfo()) voters } diff --git a/index.rsh b/index.rsh index e72c981..63c33d8 100644 --- a/index.rsh +++ b/index.rsh @@ -47,7 +47,7 @@ export const main = Reach.App(() => { .invariant(balance() == (voteFor + voteAgainst) * ticketPrice) .while(keepGoing()) .api_(Voter.vote, (vote) => { - return [0, (k) => { + return [ticketPrice, (k) => { const [nF, nA] = vote ? [1, 0] : [0, 1] return [voteFor + nF, voteAgainst + nA] }] @@ -69,5 +69,7 @@ export const main = Reach.App(() => { const [ [], k ] = call(Voter.showOutcome); k(outcome); commit() + transfe(balance()).to(Governor); + commit(); exit(); });