diff --git a/newcoin.vcxproj b/newcoin.vcxproj
index 9837569aed..b6093c53a0 100644
--- a/newcoin.vcxproj
+++ b/newcoin.vcxproj
@@ -275,6 +275,10 @@
+
+
+
+
diff --git a/src/Interpreter.cpp b/src/Interpreter.cpp
index c97b8780c9..dabbb692d1 100644
--- a/src/Interpreter.cpp
+++ b/src/Interpreter.cpp
@@ -21,7 +21,7 @@ Interpreter::Interpreter()
mBlockJump=0;
mFunctionTable.resize(NUM_OF_OPS);
- /*
+
mFunctionTable[INT_OP]=new IntOp();
mFunctionTable[FLOAT_OP]=new FloatOp();
mFunctionTable[UINT160_OP]=new Uint160Op();
@@ -47,6 +47,7 @@ Interpreter::Interpreter()
mFunctionTable[BLOCK_OP]=new SubOp();
mFunctionTable[BLOCK_END_OP]=new SubOp();
mFunctionTable[SEND_XNS_OP]=new SendXNSOp();
+ /*
mFunctionTable[SEND_OP]=new SendOp();
mFunctionTable[REMOVE_CONTRACT_OP]=new SubOp();
mFunctionTable[FEE_OP]=new SubOp();
@@ -70,6 +71,7 @@ Interpreter::Interpreter()
mFunctionTable[GET_ACCEPTOR_ID_OP]=new GetAcceptorIDOp();
mFunctionTable[GET_CONTRACT_ID_OP]=new GetContractIDOp();
*/
+
}
Data::pointer Interpreter::popStack()
diff --git a/src/Operation.h b/src/Operation.h
index 11c37d38f3..b2946f2945 100644
--- a/src/Operation.h
+++ b/src/Operation.h
@@ -102,6 +102,102 @@ public:
}
};
+class MulOp : public Operation
+{
+public:
+ bool work(Interpreter* interpreter)
+ {
+ Data::pointer data1=interpreter->popStack();
+ Data::pointer data2=interpreter->popStack();
+ if( (data1->isInt32() || data1->isFloat()) &&
+ (data2->isInt32() || data2->isFloat()) )
+ {
+ if(data1->isFloat() || data2->isFloat()) interpreter->pushStack(Data::pointer(new FloatData(data1->getFloat()*data2->getFloat())));
+ else interpreter->pushStack(Data::pointer(new IntData(data1->getInt()*data2->getInt())));
+ return(true);
+ }else
+ {
+ return(false);
+ }
+ }
+};
+
+class DivOp : public Operation
+{
+public:
+ bool work(Interpreter* interpreter)
+ {
+ Data::pointer data1=interpreter->popStack();
+ Data::pointer data2=interpreter->popStack();
+ if( (data1->isInt32() || data1->isFloat()) &&
+ (data2->isInt32() || data2->isFloat()) )
+ {
+ if(data1->isFloat() || data2->isFloat()) interpreter->pushStack(Data::pointer(new FloatData(data1->getFloat()/data2->getFloat())));
+ else interpreter->pushStack(Data::pointer(new IntData(data1->getInt()/data2->getInt())));
+ return(true);
+ }else
+ {
+ return(false);
+ }
+ }
+};
+
+class GtrOp : public Operation
+{
+public:
+ bool work(Interpreter* interpreter)
+ {
+ Data::pointer data1=interpreter->popStack();
+ Data::pointer data2=interpreter->popStack();
+ if( (data1->isInt32() || data1->isFloat()) &&
+ (data2->isInt32() || data2->isFloat()) )
+ {
+ interpreter->pushStack(Data::pointer(new BoolData(data1->getFloat()>data2->getFloat())));
+ return(true);
+ }else
+ {
+ return(false);
+ }
+ }
+};
+
+class LessOp : public Operation
+{
+public:
+ bool work(Interpreter* interpreter)
+ {
+ Data::pointer data1=interpreter->popStack();
+ Data::pointer data2=interpreter->popStack();
+ if( (data1->isInt32() || data1->isFloat()) &&
+ (data2->isInt32() || data2->isFloat()) )
+ {
+ interpreter->pushStack(Data::pointer(new FloatData(data1->getFloat()getFloat())));
+ return(true);
+ }else
+ {
+ return(false);
+ }
+ }
+};
+
+class ModOp : public Operation
+{
+public:
+ bool work(Interpreter* interpreter)
+ {
+ Data::pointer data1=interpreter->popStack();
+ Data::pointer data2=interpreter->popStack();
+ if( data1->isInt32() && data2->isInt32() )
+ {
+ interpreter->pushStack(Data::pointer(new IntData(data1->getInt()%data2->getInt())));
+ return(true);
+ }else
+ {
+ return(false);
+ }
+ }
+};
+
class StartBlockOp : public Operation
{
diff --git a/src/RPCServer.cpp b/src/RPCServer.cpp
index ca1eb0dc18..5d596012a5 100644
--- a/src/RPCServer.cpp
+++ b/src/RPCServer.cpp
@@ -1314,11 +1314,9 @@ Json::Value RPCServer::doPeers(const Json::Value& params)
return obj;
}
-// profile offers [submit]
-// profile 0:offers 1:pass_a 2:account_a 3:currency_offer_a 4:pass_b 5:account_b 6:currency_offer_b 7: 8:[submit]
+// profile offers [submit]
+// profile 0:offers 1:pass_a 2:account_a 3:currency_offer_a 4:account_b 5:currency_offer_b 6: 7:[submit]
// issuer is the offering account
-// the amount of each offer will be 1.
-// --> count: defaults to 100, does 2 offers per iteration.
// --> submit: 'submit|true|false': defaults to false
// Prior to running allow each to have a credit line of what they will be getting from the other account.
Json::Value RPCServer::doProfile(const Json::Value ¶ms)
@@ -1333,7 +1331,7 @@ Json::Value RPCServer::doProfile(const Json::Value ¶ms)
uint32 iCount = 100;
bool bSubmit = false;
- if (iArgs < 7 || "offers" != params[0u].asString())
+ if (iArgs < 6 || "offers" != params[0u].asString())
{
return RPCError(rpcINVALID_PARAMS);
}
@@ -1346,27 +1344,27 @@ Json::Value RPCServer::doProfile(const Json::Value ¶ms)
if (!STAmount::currencyFromString(uCurrencyOfferA, params[3u].asString())) //
return RPCError(rpcINVALID_PARAMS);
- if (!naSeedB.setSeedGeneric(params[4u].asString())) //
+ naAccountB.setAccountID(params[4u].asString()); //
+ if (!STAmount::currencyFromString(uCurrencyOfferB, params[5u].asString())) //
return RPCError(rpcINVALID_PARAMS);
- naAccountB.setAccountID(params[5u].asString()); //
- if (!STAmount::currencyFromString(uCurrencyOfferB, params[6u].asString())) //
- return RPCError(rpcINVALID_PARAMS);
+ iCount = lexical_cast_s(params[6u].asString());
- if (iArgs >= 8)
- iCount = lexical_cast_s(params[7u].asString());
-
- if (iArgs >= 9 && "false" != params[8u].asString())
+ if (iArgs >= 8 && "false" != params[7u].asString())
bSubmit = true;
+ Log::setMinSeverity(lsFATAL);
+
boost::posix_time::ptime ptStart(boost::posix_time::microsec_clock::local_time());
- for (int i = iCount; i-- >= 0;) {
+ for(int n=0; nsubmitTransaction(tpOfferA);
-
- NewcoinAddress naMasterGeneratorB;
- NewcoinAddress naAccountPublicB;
- NewcoinAddress naAccountPrivateB;
- AccountState::pointer asSrcB;
- STAmount saSrcBalanceB;
- Json::Value jvObjB = authorize(uint256(0), naSeedB, naAccountB, naAccountPublicB, naAccountPrivateB,
- saSrcBalanceB, theConfig.FEE_DEFAULT, asSrcB, naMasterGeneratorB);
-
- if (!jvObjB.empty())
- return jvObjB;
-
- Transaction::pointer tpOfferB = Transaction::sharedOfferCreate(
- naAccountPublicB, naAccountPrivateB,
- naAccountB, // naSourceAccount,
- asSrcB->getSeq(), // uSeq
- theConfig.FEE_DEFAULT,
- 0, // uSourceTag,
- false, // bPassive
- STAmount(uCurrencyOfferB, naAccountB.getAccountID(), 1), // saTakerPays
- STAmount(uCurrencyOfferA, naAccountA.getAccountID(), 1), // saTakerGets
- 0); // uExpiration
-
- if (bSubmit)
- tpOfferB = mNetOps->submitTransaction(tpOfferB);
}
boost::posix_time::ptime ptEnd(boost::posix_time::microsec_clock::local_time());
boost::posix_time::time_duration tdInterval = ptEnd-ptStart;
long lMicroseconds = tdInterval.total_microseconds();
- int iTransactions = iCount*2;
+ int iTransactions = iCount;
float fRate = lMicroseconds ? iTransactions/(lMicroseconds/1000000.0) : 0.0;
Json::Value obj(Json::objectValue);
diff --git a/src/TransactionAction.cpp b/src/TransactionAction.cpp
index 619a932bc4..e0c61014e1 100644
--- a/src/TransactionAction.cpp
+++ b/src/TransactionAction.cpp
@@ -753,7 +753,7 @@ TER TransactionEngine::takeOffers(
}
if (!sleOfferDir // No offer directory to take.
- || uTakeQuality < uTipQuality // No offer's of sufficient quality available.
+ || uTakeQuality < uTipQuality // No offers of sufficient quality available.
|| (bPassive && uTakeQuality == uTipQuality))
{
// Done.