Skip to content

Instantly share code, notes, and snippets.

@KasraAb
Created November 2, 2020 16:37
Show Gist options
  • Save KasraAb/0cfcfa10e2c949132b3d31fff38f287b to your computer and use it in GitHub Desktop.
Save KasraAb/0cfcfa10e2c949132b3d31fff38f287b to your computer and use it in GitHub Desktop.
NewNash
//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
: new BigNum(Manager.asset.nashSupply).add(this.asset.amount).toString();
const updated_Manager = {...Manager,asset : {...Manager.asset, nashSupply: new_supply}};
store.account.set(updated_Manager.address, updated_Manager);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment