Created
November 2, 2020 16:39
-
-
Save KasraAb/55bfa32d23c8395a38f06416c4731fa6 to your computer and use it in GitHub Desktop.
Initialization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if( this.asset.type === 'manager'){ | |
const Manager = store.account.get(manager.address); | |
const updated_Manager = {...Manager, | |
asset: {...Manager.asset, type:'manager', nash: '10000', nashSupply: '10000'}} ; | |
store.account.set(updated_Manager.address,updated_Manager); | |
} | |
else if ( this.asset.type === 'bond'){ | |
if(!this.asset.price){ | |
errors.push(new TransactionError( | |
'invalid transaction asset', | |
this.id, | |
'.asset', | |
this.asset, | |
'price must be provided')); | |
} | |
else{ | |
const bond = store.account.get(this.senderId); | |
const updated_bond = {...bond, asset: { price: this.asset.price, | |
status: 'not sold', type: 'bond', ownerId: manager.address}} ; | |
store.account.set(updated_bond.address,updated_bond); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment