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
//update recipient's account | |
const new_recipient_nash = (!recipient.asset.nash)? this.asset.amount | |
: new BigNum(recipient.asset.nash).add(this.asset.amount).toString(); | |
const updated_recipient = { ...recipient, asset: { ...recipient.asset, nash: new_recipient_nash} }; | |
store.account.set(updated_recipient.address, updated_recipient); | |
//update sender's account | |
const new_sender_nash = new BigNum(sender.asset.nash).sub(this.asset.amount).toString(); |
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
//update bond's account | |
const updated_bond = {...bond, asset: {...bond.asset, ownerId: this.asset.newOwnerId}}; | |
store.account.set(updated_bond.address, updated_bond); |
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
//update sender's account | |
const new_sender_nash = new BigNum(sender.asset.nash).sub(bond.asset.price).toString() ; | |
const updated_sender = {...sender, asset: {...sender.asset, nash: new_sender_nash} }; | |
store.account.set(updated_sender.address, updated_sender); | |
//update bond's account | |
const updated_bond = {...bond, asset: {...bond.asset, ownerId:sender.address, status: 'sold'}}; |
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
//update bond's account | |
const updated_bond = { ...bond, asset: { ...bond.asset, ownerId: '', status: 'expired'} }; | |
store.account.set(updated_bond.address, updated_bond); | |
//update owner's account | |
const new_owner_nash = (!owner.asset.nash)? '100' : new BigNum(owner.asset.nash).add('100').toString(); | |
const updated_owner = { ...owner, asset: { ...owner.asset, nash : new_owner_nash } }; |
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
//update recipient's account | |
const new_recipient_nash = (!recipient.asset.nash)? this.asset.amount | |
: new BigNum(recipient.asset.nash).add(this.asset.amount).toString(); | |
const updated_recipient = { ...recipient, asset: { ...recipient.asset, nash: new_recipient_nash} }; | |
store.account.set(updated_recipient.address, updated_recipient); | |
//update Manager's account | |
const new_supply = (!Manager.asset.nashSupply) ? this.asset.amount |
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); | |
} |