Skip to content

Commit

Permalink
Merge #1125: Pay exact amount for indivisible tokens
Browse files Browse the repository at this point in the history
babf9f0 Pay exact amount for divisible tokens (Peter Bushnell)

Pull request description:

Tree-SHA512: 880a6ba1278b5138cbd8ecfbb835f961a014dda9a3cdc5c295cdd67cdf622e1d6be1eefabdecaeb29dcfc6326c9c7f7524bf96a7569ee1ff4c5c4dbcbaff38d6
  • Loading branch information
dexX7 committed May 5, 2020
2 parents 44c1100 + babf9f0 commit b42db31
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/omnicore/rpctx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,11 @@ static UniValue omni_senddexpay(const JSONRPCRequest& request)
const CAmount amountToPayInBTC = calculateDesiredBTC(acceptOffer->getOfferAmountOriginal(), acceptOffer->getBTCDesiredOriginal(), amountAccepted);

if (nAmount > amountToPayInBTC) {
throw JSONRPCError(RPC_MISC_ERROR, strprintf("Paying more than required: %lld BTC to pay for %lld tokens", FormatMoney(amountToPayInBTC), FormatMoney(amountAccepted)));
throw JSONRPCError(RPC_MISC_ERROR, strprintf("Paying more than required: %lld BTC to pay for %lld tokens", FormatMoney(amountToPayInBTC), FormatMP(propertyId, amountAccepted)));
}

if (!isPropertyDivisible(propertyId) && nAmount < amountToPayInBTC) {
throw JSONRPCError(RPC_MISC_ERROR, strprintf("Paying less than required: %lld BTC to pay for %lld tokens", FormatMoney(amountToPayInBTC), FormatMP(propertyId, amountAccepted)));
}
}

Expand Down

0 comments on commit b42db31

Please sign in to comment.