Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def issue_tranche(tx, issuer_pseudonym, asset_name, quantity, tranche_seniority):
- # Need to figure out how we want to determine
- existing_asset_tranche = CALL('get_asset_tranche', 'asset_name', 'tranche_seniority')
- # If no tranche has ever been issued
- if existing_asset is None:
- # Create asset with 0 quantity (has to be better way to do this!
- existing_asset = CALL('issuances.issue'(tx, issuer_pseudonym, asset_name, 0)
- existing_asset['tranche_seniority'] = (tranche_seniority, quantity)
- # If `tranche_seniority` has never been issued
- elif existing_asset['tranche_seniority'] == None:
- # Create tranche
- if existing_asset['issuer'] != issuer_pseudonym:
- raise ERROR('asset issued by another pseudonym')
- existing_asset['tranche_seniority'] = tranche_seniority
- existing_asset['quantity'] = quantity
- # If asset has tranche has already been issued, check approvals and then increase quantity.
- @importable
- @queryable
- def get_tranche(asset, tranche_seniority):
- return STORAGE['asset', asset]
- return STORAGE['tranche_seniority', tranche_seniority]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement