From 9584d6db7fd47a268d527f223f23b495b251e586 Mon Sep 17 00:00:00 2001 From: dimxy Date: Wed, 16 Jan 2019 22:56:30 +0500 Subject: [PATCH] corr cond (single tokens) for buy in GetAssetorigaddrs --- src/cc/CCassetsCore.cpp | 7 +++++-- src/cc/CCassetstx.cpp | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/cc/CCassetsCore.cpp b/src/cc/CCassetsCore.cpp index 9df24b94a..5c48837a1 100644 --- a/src/cc/CCassetsCore.cpp +++ b/src/cc/CCassetsCore.cpp @@ -379,8 +379,11 @@ bool GetAssetorigaddrs(struct CCcontract_info *cp, char *CCaddr, char *destaddr, bool bGetCCaddr = false; if (funcid == 's' || funcid == 'S') bGetCCaddr = GetTokensCCaddress(cp, CCaddr, pubkey2pk(origpubkey)); - else if (funcid == 'b' || funcid == 'B') - bGetCCaddr = GetCCaddress(cp, CCaddr, pubkey2pk(origpubkey)); + else if (funcid == 'b' || funcid == 'B') { + struct CCcontract_info *cpTokens, tokensC; + cpTokens = CCinit(&tokensC, EVAL_TOKENS); + bGetCCaddr = GetCCaddress(cpTokens, CCaddr, pubkey2pk(origpubkey)); + } else { std::cerr << "GetAssetorigaddrs incorrect funcid=" << (char)(funcid?funcid:' ') << std::endl; return false; diff --git a/src/cc/CCassetstx.cpp b/src/cc/CCassetstx.cpp index fb6b5b6db..e60ebf3e6 100644 --- a/src/cc/CCassetstx.cpp +++ b/src/cc/CCassetstx.cpp @@ -723,8 +723,8 @@ std::string FillSell(int64_t txfee, uint256 assetid, uint256 assetid2, uint256 a if (assetid2 != zeroid && inputs > paid_nValue) CCchange = (inputs - paid_nValue); - mtx.vout.push_back(MakeTokensCC1vout(EVAL_ASSETS, orig_assetoshis - received_assetoshis, GetUnspendable(cpAssets, NULL))); // vout.0 tokens cc addr - ask remainder - mtx.vout.push_back(MakeTokensCC1vout(EVAL_ASSETS, received_assetoshis, mypk)); //vout.1 tokens to self + mtx.vout.push_back(MakeTokensCC1vout(EVAL_ASSETS, orig_assetoshis - received_assetoshis, GetUnspendable(cpAssets, NULL))); // vout.0 tokens remainder to unspendable cc addr + mtx.vout.push_back(MakeTokensCC1vout(EVAL_ASSETS, received_assetoshis, mypk)); //vout.1 purchased tokens to self // NOTE: no marker here @@ -735,7 +735,7 @@ std::string FillSell(int64_t txfee, uint256 assetid, uint256 assetid2, uint256 a } else { std::cerr << "FillSell() paid_value=" << paid_nValue << " origpubkey=" << HexStr(pubkey2pk(origpubkey)) << std::endl; - mtx.vout.push_back(CTxOut(paid_nValue, CScript() << origpubkey << OP_CHECKSIG)); //vout.2 coins normal to whom who asked token + mtx.vout.push_back(CTxOut(paid_nValue, CScript() << origpubkey << OP_CHECKSIG)); //vout.2 coins to tokens seller's normal addr } // not implemented