Advertisement
Guest User

Untitled

a guest
Jul 5th, 2015
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. def issue_tranche(tx, issuer_pseudonym, asset_name, quantity, tranche_seniority):
  2. # Need to figure out how we want to determine
  3. existing_asset_tranche = CALL('get_asset_tranche', 'asset_name', 'tranche_seniority')
  4.  
  5. # If no tranche has ever been issued
  6. if existing_asset is None:
  7. # Create asset with 0 quantity (has to be better way to do this!
  8. existing_asset = CALL('issuances.issue'(tx, issuer_pseudonym, asset_name, 0)
  9. existing_asset['tranche_seniority'] = (tranche_seniority, quantity)
  10.  
  11. # If `tranche_seniority` has never been issued
  12. elif existing_asset['tranche_seniority'] == None:
  13. # Create tranche
  14. if existing_asset['issuer'] != issuer_pseudonym:
  15. raise ERROR('asset issued by another pseudonym')
  16. existing_asset['tranche_seniority'] = tranche_seniority
  17. existing_asset['quantity'] = quantity
  18.  
  19. # If asset has tranche has already been issued, check approvals and then increase quantity.
  20.  
  21. @importable
  22. @queryable
  23. def get_tranche(asset, tranche_seniority):
  24. return STORAGE['asset', asset]
  25. return STORAGE['tranche_seniority', tranche_seniority]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement