def burn(self, params): sp.set_type(params, sp.TRecord(address=sp.TAddress, value=sp.TNat)) sp.verify(sp.sender == self.data.administrator) sp.verify(self.data.balances[params.address].balance >= params.value) self.data.balances[params.address].balance = sp.as_nat( self.data.balances[params.address].balance - params.value) self.data.totalSupply = sp.as_nat(self.data.totalSupply - params.value)
class FA12(sp.Contract): def __init__(self, admin): with open('metadata/metadata.json', 'r') as f: #loads then dumps to confirm correctly formatted json metadata = json.dumps(json.load(f)) self.init(paused=False, balances=sp.big_map(tvalue=sp.TRecord(approvals=sp.TMap(sp.TAddress, sp.TNat), balance=sp.TNat)), administrator=admin, totalSupply=0, permits=sp.big_map(tkey=sp.TPair(sp.TAddress, sp.TBytes), tvalue=sp.TTimestamp), user_expiries=sp.big_map(tkey=sp.TAddress, tvalue=sp.TOption(sp.TNat)), permit_expiries=sp.big_map(tkey=sp.TPair(sp.TAddress, sp.TBytes), tvalue=sp.TOption(sp.TNat)), counter=0, default_expiry = 50000, max_expiry = 2628000, metadata=sp.big_map(l={"": sp.bytes_of_string("tezos-storage:md-json"), "md-json": sp.bytes_of_string(metadata)})) @sp.entry_point def transfer(self, params): sp.set_type(params, sp.TRecord(from_=sp.TAddress, to_=sp.TAddress, value=sp.TNat)).layout(("from_ as from", ("to_ as to", "value"))) sender = sp.local("sender", sp.sender) sp.if (self.transfer_presigned(params)): # Setting sender.value to from_ so call to transfer_helper will be authorized sender.value = params.from_ sp.verify((sender.value == self.data.administrator) | (~self.data.paused & ((params.from_ == sender.value) | (self.data.balances[params.from_].approvals[sender.value] >= params.value)))) self.addAddressIfNecessary(params.to_) sp.verify(self.data.balances[params.from_].balance >= params.value) self.data.balances[params.from_].balance = sp.as_nat( self.data.balances[params.from_].balance - params.value) self.data.balances[params.to_].balance += params.value sp.if ((params.from_ != sender.value) & (self.data.administrator != sender.value)): self.data.balances[params.from_].approvals[sender.value] = sp.as_nat( self.data.balances[params.from_].approvals[sender.value] - params.value)
def withdrawToken(self,params): sp.verify(params.amount > 0) sp.verify(self.data.ledger.contains(sp.sender)) sp.verify(self.data.ledger[sp.sender].balance >= params.amount) self.data.ledger[sp.sender].balance = sp.as_nat(self.data.ledger[sp.sender].balance - params.amount) self.data.totalSupply = sp.as_nat(self.data.totalSupply - params.amount) sp.send(sp.sender,sp.mutez(params.amount*100))
def InitializeExchange(self, params): token_amount = sp.as_nat(params.token_amount) candidate = params.candidate sp.verify(self.data.invariant == sp.mutez(0), message="Wrong invariant") sp.verify(self.data.totalShares == 0, message="Wrong totalShares") sp.verify(((sp.amount > sp.mutez(1)) & ( sp.amount < sp.tez(500000000))), message="Wrong amount") sp.verify(token_amount > sp.nat(10), message="Wrong tokenAmount") self.data.tokenPool = token_amount self.data.tezPool = sp.amount self.data.invariant = sp.split_tokens(self.data.tezPool, self.data.tokenPool, sp.nat(1)) self.data.shares[sp.sender] = sp.nat(1000) self.data.totalShares = sp.nat(1000) token_contract = sp.contract( sp.TRecord(account_from=sp.TAddress, destination=sp.TAddress, value=sp.TNat), address=self.data.tokenAddress, entry_point="Transfer" ).open_some() sp.transfer(sp.record(account_from=sp.sender, destination=self.data.address, value=token_amount), sp.mutez(0), token_contract) self.data.candidates[sp.sender] = candidate self.data.votes[candidate] = sp.as_nat(1000) self.data.delegated = candidate sp.set_delegate(sp.some(candidate))
class FA12_Permit(FA12, Permit): def __init__(self, admin): self.error_message=Error_message() with open('metadata/metadata.json', 'r') as f: #loads then dumps to confirm correctly formatted json md = json.dumps(json.load(f)) FA12.__init__(self, admin, permit_data = init_permit_data(), metadata = init_metadata(md)) #overrides @sp.entry_point def transfer(self, params): sp.set_type(params, sp.TRecord(from_=sp.TAddress, to_=sp.TAddress, value=sp.TNat)).layout(("from_ as from", ("to_ as to", "value"))) sender = sp.local("sender", sp.sender) sp.if (self.transfer_presigned(params)): # Setting sender.value to from_ so call to transfer_helper will be authorized sender.value = params.from_ sp.verify((sender.value == self.data.administrator) | (~self.data.paused & ((params.from_ == sender.value) | (self.data.balances[params.from_].approvals[sender.value] >= params.value))), self.error_message.user_unauthorized()) self.addAddressIfNecessary(params.to_) sp.verify(self.data.balances[params.from_].balance >= params.value, self.error_message.balance_insufficient()) self.data.balances[params.from_].balance = sp.as_nat( self.data.balances[params.from_].balance - params.value) self.data.balances[params.to_].balance += params.value sp.if ((params.from_ != sender.value) & (self.data.administrator != sender.value)): self.data.balances[params.from_].approvals[sender.value] = sp.as_nat( self.data.balances[params.from_].approvals[sender.value] - params.value)
def transfer(self, params): sp.set_type( params, sp.TRecord(from_=sp.TAddress, to_=sp.TAddress, value=sp.TNat)).layout( ("from_ as from", ("to_ as to", "value"))) sender = sp.local("sender", sp.sender) with sp.if_((self.transfer_presigned(params))): # Setting sender.value to from_ so call to transfer_helper will be authorized sender.value = params.from_ sp.verify((sender.value == self.data.administrator) | ( ~self.data.paused & ( (params.from_ == sender.value) | (self.data.balances[ params.from_].approvals[sender.value] >= params.value)))) self.addAddressIfNecessary(params.to_) sp.verify(self.data.balances[params.from_].balance >= params.value) self.data.balances[params.from_].balance = sp.as_nat( self.data.balances[params.from_].balance - params.value) self.data.balances[params.to_].balance += params.value with sp.if_(((params.from_ != sender.value) & (self.data.administrator != sender.value))): self.data.balances[params.from_].approvals[ sender.value] = sp.as_nat( self.data.balances[params.from_].approvals[sender.value] - params.value)
def claimFor(self, beneficiery): sp.verify(self.data.schedules.contains(beneficiery)) sp.for schedule_name in self.data.schedules[beneficiery].keys(): schedule = self.data.schedules[beneficiery][schedule_name] vested_amount = self._vested( sp.record( beneficiery= beneficiery, schedule_name= schedule_name ) ) claim_amount = sp.local('claim_amount', sp.as_nat(0)) claim_amount.value = sp.as_nat(vested_amount - schedule.claimed_amount) schedule.claimed_amount += claim_amount.value self._transfer( sp.record( from_ = sp.self_address, to_ = beneficiery, amount = claim_amount.value, token_id = schedule.token_id, token_address = schedule.token_address ) )
def dispatchRoyalties(self, params): sp.verify(sp.sender == self.data.administrator) rounded = sp.as_nat(10**10) muCVRtez = sp.as_nat(self.data.circulatingSupply)*rounded // params.amount + 1 sp.for address in params.addresses: sp.if (self.data.balances.contains(address) & (sp.as_nat(self.data.balances[address].balance)*rounded > muCVRtez)): sendMuTez = sp.as_nat(self.data.balances[address].balance)*rounded // muCVRtez sp.send(address, sp.mutez(sendMuTez))
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))
def burn(self, params): sp.set_type(params, sp.TRecord(address = sp.TAddress, value = sp.TNat , owner = sp.TAddress)) sp.verify(self.data.Indexer[params.address].contains(sp.sender)) sp.if params.address == params.owner | sp.sender == params.address: sp.verify(self.data.balances[params.address].balance >= params.value) self.data.balances[params.address].balance = sp.as_nat(self.data.balances[params.address].balance - params.value) self.data.totalSupply = sp.as_nat(self.data.totalSupply - params.value)
def transfer(self, params): sp.verify((sp.sender == self.data.administrator) | (~self.data.paused & ((params.fro == sp.sender) | (self.data.balances[params.fro].approvals[sp.sender] >= params.value)))) self.addAddressIfNecessary(params.to) sp.verify(self.data.balances[params.fro].balance >= params.value) self.data.balances[params.fro].balance = sp.as_nat(self.data.balances[params.fro].balance - params.value) self.data.balances[params.to].balance += params.value sp.if (params.fro != sp.sender) & (self.data.administrator != sp.sender): self.data.balances[params.fro].approvals[sp.sender] = sp.as_nat(self.data.balances[params.fro].approvals[sp.sender] - params.value)
def _vested(self, params): vested_amount = sp.local('vested_amount', sp.as_nat(0)) sp.verify(self.data.schedules.contains(params.beneficiery) & self.data.schedules[params.beneficiery].contains(params.schedule_name)) schedule = self.data.schedules[params.beneficiery][params.schedule_name] sp.verify(schedule.claimed_amount < schedule.vesting_amount) sp.if schedule.revoked: vested_amount.value = sp.as_nat(0)
def internal_transfer(self, from_, to_, value): # Add both addresses if necessary self.addAddressIfNecessary(from_) self.addAddressIfNecessary(to_) # Verify is the balance is sufficient sp.verify(self.data.balances[from_].balance >=value, "Insufficient Balance") # Update the account from which the transfer is made self.data.balances[from_].balance = sp.as_nat(self.data.balances[from_].balance - value) # Update the account to which the transfer is made self.data.balances[to_].balance += value sp.if (from_ != sp.sender): self.data.balances[from_].approvals[sp.sender] = sp.as_nat(self.data.balances[from_].approvals[sp.sender] - value)
def transfer(self, params): sp.set_type(params, sp.TRecord(from_ = sp.TAddress, to_ = sp.TAddress, value = sp.TNat).layout(("from_ as from", ("to_ as to", "value")))) sp.verify((sp.sender == self.data.administrator) | (~self.data.paused & ((params.from_ == sp.sender) | (self.data.ledger[params.from_].approvals[sp.sender] >= params.value)))) self.addAddressIfNecessary(params.to_) sp.verify(self.data.ledger[params.from_].balance >= params.value) self.data.ledger[params.from_].balance = sp.as_nat(self.data.ledger[params.from_].balance - params.value) self.data.ledger[params.to_].balance += params.value sp.if (params.from_ != sp.sender) & (self.data.administrator != sp.sender): self.data.ledger[params.from_].approvals[sp.sender] = sp.as_nat(self.data.ledger[params.from_].approvals[sp.sender] - params.value)
def transfer(self, params): sp.set_type(params, sp.TRecord(from_ = sp.TAddress, to_ = sp.TAddress, value = sp.TNat).layout(("from_ as from", ("to_ as to", "value")))) sp.verify(self.is_administrator(sp.sender) | (~self.is_paused() & ((params.from_ == sp.sender) | (self.data.balances[params.from_].approvals[sp.sender] >= params.value))), FA12_Error.NotAllowed) self.addAddressIfNecessary(params.from_) self.addAddressIfNecessary(params.to_) sp.verify(self.data.balances[params.from_].balance >= params.value, FA12_Error.InsufficientBalance) self.data.balances[params.from_].balance = sp.as_nat(self.data.balances[params.from_].balance - params.value) self.data.balances[params.to_].balance += params.value sp.if (params.from_ != sp.sender) & (~self.is_administrator(sp.sender)): self.data.balances[params.from_].approvals[sp.sender] = sp.as_nat(self.data.balances[params.from_].approvals[sp.sender] - params.value)
def permit(self, params): sp.set_type( params, sp.TList(sp.TPair(sp.TKey, sp.TPair(sp.TSignature, sp.TBytes)))) sp.verify(~self.data.paused) with sp.for_('permit', params) as permit: params_hash = sp.snd(sp.snd(permit)) unsigned = sp.pack( sp.pair(sp.pair(sp.chain_id, sp.self_address), sp.pair(self.data.counter, params_hash))) pk_address = sp.to_address( sp.implicit_account(sp.hash_key(sp.fst(permit)))) permit_key = sp.pair(pk_address, params_hash) permit_exists = self.data.permits.contains(permit_key) effective_expiry = self.getEffectiveExpiry( sp.pair(pk_address, params_hash)) permit_submission_timestamp = self.data.permits[permit_key] sp.verify( ~(permit_exists & (sp.as_nat(sp.now - permit_submission_timestamp) < effective_expiry)), sp.pair("DUP_PERMIT", params_hash)) sp.verify( sp.check_signature(sp.fst(permit), sp.fst(sp.snd(permit)), unsigned), sp.pair("MISSIGNED", unsigned)) self.data.permits[sp.pair(pk_address, params_hash)] = sp.now self.data.counter = self.data.counter + 1
def transfer(self, params): sp.verify( ~self.data.paused ) sp.set_type(params, sp.TList(Transfer.get_type())) sp.for transfer in params: Transfer.set_type_and_layout(transfer) from_user = Ledger_key.make(Transfer.get_from(transfer), Transfer.get_token_id(transfer)) to_user = Ledger_key.make(Transfer.get_to(transfer), Transfer.get_token_id(transfer)) if support_operator: sp.verify( (sp.sender == self.data.administrator) | (Transfer.get_from(transfer) == sp.sender) | self.data.ledger[from_user].operators.contains(sp.sender)) else: sp.verify( (sp.sender == self.data.administrator) | (Transfer.get_from(transfer) == sp.sender)) sp.verify( self.data.ledger[from_user].balance >= Transfer.get_amount(transfer)) self.data.ledger[from_user].balance = sp.as_nat( self.data.ledger[from_user].balance - Transfer.get_amount(transfer)) sp.if self.data.ledger.contains(to_user): self.data.ledger[to_user].balance += Transfer.get_amount(transfer)
def transfer(self, params): sp.verify( ~self.data.paused ) sp.set_type(params, self.batch_transfer.get_type()) sp.for transfer in params: current_from = transfer.from_ if self.config.support_operator: sp.verify( (sp.sender == self.data.administrator) | (current_from == sp.sender) | self.operator_set.is_member(self.data.operators, current_from, sp.sender), message = self.error_message.not_operator()) else: sp.verify( (sp.sender == self.data.administrator) | (current_from == sp.sender), message = self.error_message.not_owner()) sp.for tx in transfer.txs: #sp.verify(tx.amount > 0, message = "TRANSFER_OF_ZERO") if self.config.single_asset: sp.verify(tx.token_id == 0, "single-asset: token-id <> 0") sp.verify(self.data.tokens.contains(tx.token_id), message = self.error_message.token_undefined()) # If amount is 0 we do nothing now: sp.if (tx.amount > 0): from_user = self.ledger_key.make(current_from, tx.token_id) sp.verify( (self.data.ledger[from_user].balance >= tx.amount), message = self.error_message.insufficient_balance()) to_user = self.ledger_key.make(tx.to_, tx.token_id) self.data.ledger[from_user].balance = sp.as_nat( self.data.ledger[from_user].balance - tx.amount) sp.if self.data.ledger.contains(to_user): self.data.ledger[to_user].balance += tx.amount
def meta_transfer(self, params): sp.verify(sp.sender == self.data.administrator) sp.set_type(params, BatchMetaTransfer.get_type()) sp.for meta_transfer in params: source_account_key_hash = sp.hash_key( meta_transfer.from_public_key) source_account = sp.to_address( sp.implicit_account(source_account_key_hash)) sp.verify(self.data.nonces.get( source_account, 0)+1 == meta_transfer.nonce) packed_data = sp.pack( BatchMetaTransfer.get_signing_payload(meta_transfer)) sp.verify(sp.check_signature(meta_transfer.from_public_key, meta_transfer.signature, packed_data), message=ErrorMessage.invalid_signature()) self.data.nonces[source_account] = meta_transfer.nonce sp.for tx in meta_transfer.txs: from_user = LedgerKey.make(source_account, tx.token_id) to_user = LedgerKey.make(tx.to_, tx.token_id) sp.verify(tx.amount > 0, message=ErrorMessage.transfer_of_zero()) sp.verify(self.data.ledger[from_user] >= tx.amount, message=ErrorMessage.insufficient_balance()) self.data.ledger[from_user] = sp.as_nat( self.data.ledger[from_user] - tx.amount) self.data.ledger[to_user] = self.data.ledger.get( to_user, 0) + tx.amount sp.if self.data.ledger[from_user] == 0: del self.data.ledger[from_user]
def mint(self, params): sp.verify(params.value>0) tezValue=sp.tez(sp.as_nat(params.value)) sp.verify(sp.amount == tezValue) self.addAddressIfNecessary(params.address) self.data.ledger[params.address].balance += abs(self.data.xtzPrice*params.value*100) self.data.totalSupply += abs(self.data.xtzPrice*params.value*100)
def test(): scenario = sp.test_scenario() # GIVEN a token contract token = FA12.FA12(admin=Addresses.GOVERNOR_ADDRESS) scenario += token # AND a reserve contract reserve = FarmRewardReserve( rewardTokenAddress=token.address, revokeAddress=Addresses.REVOKE_ADDRESS, ) scenario += reserve # AND the reserve contract has some tokens. tokenAmount = 123456789 scenario += token.mint( sp.record( address=reserve.address, value=tokenAmount)).run(sender=Addresses.GOVERNOR_ADDRESS) # WHEN revoke is called revokeAmount = 500 scenario += reserve.revoke(revokeAmount).run( sender=Addresses.GOVERNOR_ADDRESS) # THEN tokens are revoked scenario.verify(token.data.balances[Addresses.REVOKE_ADDRESS].balance == revokeAmount) scenario.verify(token.data.balances[reserve.address].balance == sp.as_nat(tokenAmount - revokeAmount))
def mint(self, params): tezValue=sp.tez(sp.as_nat(params.amount)) sp.verify(sp.amount == tezValue) self.addAddressIfNecessary(params.address) self.data.balances[params.address].balance += params.amount*10000 self.data.totalSupply += params.amount*10000
def list_job(self, _job_id, _company, _job_description, _contact, _max_hires): # Cannot post another job with the same ID sp.verify(~self.data.jobs.contains(_job_id)) sp.verify(_max_hires > 0) sp.verify(sp.amount > sp.mutez(0)) self.data.jobs[_job_id] = sp.record(owner=sp.source, company=_company, job_description=_job_description, stipend=sp.mutez(sp.fst(sp.ediv( sp.amount, sp.mutez(sp.as_nat(_max_hires))).open_some())), contact=_contact, status=0, applications={}, selected={}, max_hires=_max_hires, cur_hires=0)
def transfer_presigned(self, params): sp.set_type( params, sp.TRecord(from_=sp.TAddress, to_=sp.TAddress, value=sp.TNat)) params_hash = sp.blake2b(sp.pack(params)) #unsigned = sp.blake2b(mi.operator("SELF; ADDRESS; CHAIN_ID; PAIR; PAIR; PACK", [sp.TPair(sp.TNat, sp.TBytes)], [sp.TBytes])(sp.pair(self.data.counter, params_hash))) permit_key = sp.pair(params.from_, params_hash) effective_expiry = sp.local("effective_expiry", 0) with sp.if_(self.data.permits.contains(permit_key)): permit_submission_timestamp = self.data.permits[permit_key] with sp.if_( self.data.permit_expiries.contains(permit_key) & self.data.permit_expiries[permit_key].is_some()): effective_expiry.value = self.data.permit_expiries[ permit_key].open_some() with sp.else_(): with sp.if_( self.data.user_expiries.contains(params.from_) & self.data.user_expiries[params.from_].is_some()): effective_expiry.value = self.data.user_expiries[ params.from_].open_some() with sp.else_(): effective_expiry.value = self.data.default_expiry # Deleting permit regardless of whether or not its expired with sp.if_( sp.as_nat(sp.now - permit_submission_timestamp) >= effective_expiry.value): # Expired self.delete_permit(permit_key) sp.result(sp.bool(False)) with sp.else_(): self.delete_permit(permit_key) sp.result(sp.bool(True)) with sp.else_(): sp.result(sp.bool(False))
def withdrawPayout(self): sp.verify(self.data.result.is_some()) sp.if self.data.result.open_some() == Position.Long: sp.verify(self.data.sharesLong.contains(sp.sender)) totalPayout = sp.local('totalPayout', 0) sp.for i in self.data.sharesLong[sp.sender].keys(): sp.if self.data.sharesLong[sp.sender][i] > 0: totalPayout.value += (sp.as_nat(self.data.sharesLong[sp.sender][i]) * 1000000)
def burn(self, token_amounts): """Allows to burn tokens on the calling admin's address, only a token administrator can do this""" sp.set_type(token_amounts, TokenAmount.get_batch_type()) sp.for token_amount in token_amounts: token_context = self.data.token_context[token_amount.token_id] administrator_ledger_key = LedgerKey.make(sp.sender, token_amount.token_id) redeem_address_ledger_key = LedgerKey.make(token_context.redeem_address, token_amount.token_id) sp.verify(self.data.administrators.get(administrator_ledger_key, sp.nat(0))==AdministratorState.IS_ADMIN, message = AdministrableErrorMessage.NOT_ADMIN) sp.verify(self.data.ledger[redeem_address_ledger_key]>=token_amount.amount, message = FA2ErrorMessage.INSUFFICIENT_BALANCE) self.data.ledger[redeem_address_ledger_key] = sp.as_nat(self.data.ledger.get(redeem_address_ledger_key, 0) - token_amount.amount) self.data.total_supply[token_amount.token_id] = sp.as_nat(self.data.total_supply.get(token_amount.token_id, 0) - token_amount.amount) token_context.total_burned += token_amount.amount self.data.token_context[token_amount.token_id] = token_context sp.if self.data.ledger[administrator_ledger_key] == 0: del self.data.ledger[administrator_ledger_key]
def setExpiry(self, params): sp.set_type( params, sp.TRecord(address=sp.TAddress, seconds=sp.TNat, permit=sp.TOption(sp.TBytes))).layout( ("address", ("seconds", "permit"))) sp.verify(~self.data.paused) sp.verify(params.seconds <= self.data.max_expiry, "MAX_SECONDS_EXCEEDED") sp.verify_equal(params.address, sp.sender, message="NOT_AUTHORIZED") with sp.if_(params.permit.is_some()): some_permit = params.permit.open_some() sp.verify( self.data.permits.contains(sp.pair(params.address, some_permit)), "PERMIT_NONEXISTENT") permit_submission_timestamp = self.data.permits[sp.pair( params.address, some_permit)] with sp.if_( self.data.permit_expiries.contains( sp.pair(params.address, some_permit)) & self.data.permit_expiries[sp.pair( params.address, some_permit)].is_some()): permit_expiry = self.data.permit_expiries[sp.pair( params.address, some_permit)].open_some() sp.verify( sp.as_nat(sp.now - permit_submission_timestamp) < permit_expiry, "PERMIT_REVOKED") with sp.else_(): with sp.if_( self.data.user_expiries.contains(params.address) & self.data.user_expiries[params.address].is_some()): user_expiry = self.data.user_expiries[ params.address].open_some() sp.verify( sp.as_nat(sp.now - permit_submission_timestamp) < user_expiry, "PERMIT_REVOKED") with sp.else_(): sp.verify( sp.as_nat(sp.now - permit_submission_timestamp) < self.data.default_expiry, "PERMIT_REVOKED") self.data.permit_expiries[sp.pair( params.address, some_permit)] = sp.some(params.seconds) self.data.user_expiries[params.address] = sp.some(params.seconds)
def __init__(self, owner, totalSupply): self.init( owner=owner, totalSupply=sp.as_nat(totalSupply), ledger=sp.big_map({ owner: sp.record(balance=sp.as_nat(totalSupply), allowances={}) }, tkey=sp.TAddress, tvalue=sp.TRecord( balance=sp.TNat, allowances=sp.TMap( sp.TAddress, sp.TNat ) ) ) )
def mint(self, params): sp.verify(params.value>0) tezValue=sp.tez(sp.as_nat(params.value)) sp.verify(sp.amount == tezValue) c = sp.contract(sp.TRecord(address = sp.TAddress, amount = sp.TInt), self.data.OrO, entry_point = "getDataMint").open_some() mydata = sp.record(address = sp.sender,amount=params.value) sp.transfer(mydata, sp.mutez(10), c)
def contribute(self, params): sp.verify(sp.now <= self.data.end_date) tezValue=sp.tez(sp.as_nat(params.amount)) sp.verify(sp.amount == tezValue) c = sp.contract(sp.TRecord(address = sp.TAddress, amount = sp.TInt), self.data.tokenContract, entry_point = "mint").open_some() sp.if self.data.xtzContributionTotal < 50000 : mydata = sp.record(address = sp.sender,amount=params.amount*1200) sp.transfer(mydata, sp.amount, c) mydata = sp.record(address = self.data.administrator,amount=params.amount*120) sp.transfer(mydata, sp.mutez(0), c)