Skip to content

Commit

Permalink
Encoding: provide access to the Exodus address
Browse files Browse the repository at this point in the history
The Exodus address was already available as string, but it seems more useful, to have "public" access in form of a CBitcoinAddress.
  • Loading branch information
dexX7 committed Apr 15, 2015
1 parent 7a62a01 commit fd6cd48
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 21 deletions.
33 changes: 20 additions & 13 deletions src/mastercore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ using namespace mastercore;
// comment out MY_HACK & others here - used for Unit Testing only !
// #define MY_HACK

string exodus_address = "1EXoDusjGwvnjZUyKkxZ4UHEf77z6A5S4P";
static string exodus_address = "1EXoDusjGwvnjZUyKkxZ4UHEf77z6A5S4P";
static const string exodus_testnet = "mpexoDuSkGGqvqrkrjiFng38QPkJQVFyqv";
static const string getmoney_testnet = "moneyqMan7uh8FqdCA2BV5yZ8qVrc9ikLP";

Expand All @@ -109,7 +109,12 @@ uint64_t global_balance_reserved_maineco[100000];
uint64_t global_balance_money_testeco[100000];
uint64_t global_balance_reserved_testeco[100000];

bool autoCommit = true; // whether to automatically commit created transactions, override with --autocommit=false
/**
* Used to indicate, whether to automatically commit created transactions.
*
* Can be set with configuration "-autocommit" or RPC "setautocommit_OMNI".
*/
bool autoCommit = true;

string global_alert_message;

Expand Down Expand Up @@ -3770,18 +3775,20 @@ int mastercore_handler_disc_end(int nBlockNow, CBlockIndex const * pBlockIndex)
return 0;
}

const std::string ExodusAddress()
/**
* Returns the Exodus address.
*
* Main network:
* 1EXoDusjGwvnjZUyKkxZ4UHEf77z6A5S4P
*
* Test network:
* mpexoDuSkGGqvqrkrjiFng38QPkJQVFyqv
*
* @return The Exodus address
*/
const CBitcoinAddress ExodusAddress()
{
return string(exodus_address);
}

const std::string NotificationAddress()
{
static const string addr = "1MpNote1jsHkbQLwEmgoMr29EoUC1nyxxV";

if (isNonMainNet()) {}; // TODO pick a notification address for TestNet

return addr;
return CBitcoinAddress(exodus_address);
}

// the 31-byte packet & the packet #
Expand Down
11 changes: 7 additions & 4 deletions src/mastercore.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#ifndef _MASTERCOIN
#define _MASTERCOIN 1

class CBitcoinAddress;
class CBlockIndex;
class CTransaction;

Expand Down Expand Up @@ -211,12 +212,16 @@ std::string FormatMP(unsigned int, int64_t n, bool fSign = false);
uint256 send_MP(const string &FromAddress, const string &ToAddress, const string &RedeemAddress, unsigned int PropertyID, uint64_t Amount);
int64_t feeCheck(const string &address);

const std::string ExodusAddress();
/** Returns the Exodus address. */
const CBitcoinAddress ExodusAddress();

/** Used to indicate, whether to automatically commit created transactions. */
extern bool autoCommit;

extern int msc_debug_ui;

extern CCriticalSection cs_tally;
extern bool autoCommit;

extern const int msc_debug_dex;

enum TallyType { BALANCE = 0, SELLOFFER_RESERVE = 1, ACCEPT_RESERVE = 2, PENDING = 3, METADEX_RESERVE = 4, TALLY_TYPE_COUNT };
Expand Down Expand Up @@ -519,8 +524,6 @@ extern uint64_t global_balance_reserved_maineco[100000];
extern uint64_t global_balance_money_testeco[100000];
extern uint64_t global_balance_reserved_testeco[100000];

extern std::string exodus_address;

int mastercore_init(void);

int64_t getMPbalance(const string &Address, unsigned int property, TallyType ttype);
Expand Down
5 changes: 3 additions & 2 deletions src/mastercore_sp.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

class CBlockIndex;

#include "base58.h"
#include "uint256.h"
#include "utiltime.h"

Expand Down Expand Up @@ -302,15 +303,15 @@ class CMPSPInfo
openDB();

// special cases for constant SPs MSC and TMSC
implied_msc.issuer = ExodusAddress();
implied_msc.issuer = ExodusAddress().ToString();
implied_msc.prop_type = MSC_PROPERTY_TYPE_DIVISIBLE;
implied_msc.num_tokens = 700000;
implied_msc.category = "N/A";
implied_msc.subcategory = "N/A";
implied_msc.name = "MasterCoin";
implied_msc.url = "www.mastercoin.org";
implied_msc.data = "***data***";
implied_tmsc.issuer = ExodusAddress();
implied_tmsc.issuer = ExodusAddress().ToString();
implied_tmsc.prop_type = MSC_PROPERTY_TYPE_DIVISIBLE;
implied_tmsc.num_tokens = 700000;
implied_tmsc.category = "N/A";
Expand Down
4 changes: 2 additions & 2 deletions src/omnicore_encoding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ bool OmniCore_Encode_ClassB(const std::string& senderAddress, const CPubKey& red
}

// Add the Exodus marker output
CScript scriptExodusOut = GetScriptForDestination(CBitcoinAddress(exodus_address).Get());
vecOutputs.push_back(std::make_pair(scriptExodusOut, GetDustThreshold(scriptExodusOut)));
CScript scriptExodusOutput = GetScriptForDestination(ExodusAddress().Get());
vecOutputs.push_back(std::make_pair(scriptExodusOutput, GetDustThreshold(scriptExodusOutput)));
return true;
}

Expand Down

0 comments on commit fd6cd48

Please sign in to comment.