def rewardfunds(self,daoid): sp.verify(self.data.addDAOdata[daoid].disputestatus==1) x=self.data.addDAOdata[daoid].winprojectid y=self.data.addDAOdata[daoid].winproposalid sendadd=self.data.addprojectdata[x].proowner count=self.data.addDAOdata[daoid].maxmember contribution=self.data.addDAOdata[daoid].min_contribution sp.for x in sp.range(0,count): sendfunds=contribution+contribution
class SimpleLottery(sp.Contract): def __init__(self): self.init(limit = 5, ticketToAddress = sp.map(tkey = sp.TNat, tvalue = sp.TAddress), id = 0, previousWinners = sp.list(t = sp.TAddress)) @sp.entry_point def buyTicket(self, qty): sp.verify(sp.tez(qty) == sp.amount) change = sp.local('change', sp.tez(0)) canBuy = sp.local('canBuy', qty) remaining = sp.as_nat(self.data.limit - self.data.id) sp.if qty > remaining: canBuy.value = remaining change.value = sp.tez(sp.as_nat(qty - remaining)) sp.for i in sp.range(1, canBuy.value + 1): self.data.ticketToAddress[self.data.id] = sp.sender self.data.id += 1
def resetLottery(self): self.data.id = 0 sp.for i in sp.range(0, self.data.limit): del self.data.ticketToAddress[i]
def iter_on_operator(metaset, ledger, upd, action): if assume_consecutive_token_ids: sp.for tok in sp.range(0, metaset + 1): user = Ledger_key.make(upd.owner, tok) action(ledger[user], upd.operator)
def all_tokens(self): if self.config.assume_consecutive_token_ids: sp.result(sp.range(0, self.data.all_tokens)) else: sp.result(self.data.all_tokens.elements())
def factorial(self, x): self.data.value = 1 sp.for y in sp.range(1, x + 1): self.data.value *= y
def factorial(self, params): self.data.storedValue = 1 sp.for x in sp.range(1, params.op+1): self.data.storedValue *= x