diff options
| author | Adam Soltys <[email protected]> | 2022-02-26 00:38:26 -0500 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-02-26 00:38:26 -0500 |
| commit | 697ab316268031964955dee1293d61347f69ce3d (patch) | |
| tree | 060630a390c280cb16c15a40b0c0d98196a54b0e | |
| parent | 3098f0c849f696b39714799c6c1663936946e61b (diff) | |
| download | coinos-server-697ab316268031964955dee1293d61347f69ce3d.tar.gz coinos-server-697ab316268031964955dee1293d61347f69ce3d.zip | |
fix rounding errors
| -rw-r--r-- | routes/assets.js | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/routes/assets.js b/routes/assets.js index df0e5c31..a426e2bc 100644 --- a/routes/assets.js +++ b/routes/assets.js @@ -102,17 +102,19 @@ app.post( const version = 0; let contract = { - entity: { domain }, - issuer_pubkey, - name, - precision, - version - } + entity: { domain }, + issuer_pubkey, + name, + precision, + version + }; if (filename) contract.file = filename; if (ticker) contract.ticker = ticker; - contract = Object.keys(contract).sort().reduce((r, k) => (r[k] = contract[k], r), {}); + contract = Object.keys(contract) + .sort() + .reduce((r, k) => ((r[k] = contract[k]), r), {}); l.info( "attempting issuance", @@ -228,7 +230,7 @@ app.post( account_id: account.id, user_id, hash: txid, - amount: params.asset_amount * SATS, + amount: Math.round(params.asset_amount * SATS), received: true, confirmed: false, address: asset_address, @@ -256,7 +258,7 @@ app.post( precision: 8, name: `${name} Reissuance Token`, balance: 0, - pending: address ? 0 : token_amount * SATS + pending: address ? 0 : Math.round(token_amount * SATS) }, { transaction } ); @@ -268,7 +270,7 @@ app.post( account_id: account.id, user_id, hash: txid, - amount: token_amount * SATS, + amount: Math.round(token_amount * SATS), received: true, confirmed: false, address: token_address, |
