Skip to content

Commit ca6be69

Browse files
committed
Add feature switch for DEx "over-offers" and math
The feature is disabled per default for all networks, including regtest mode, to avoid messing up the regtests.
1 parent c7f27da commit ca6be69

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/omnicore/rules.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ CMainConsensusParams::CMainConsensusParams()
147147
MSC_BET_BLOCK = 999999;
148148
// Other feature activations:
149149
GRANTEFFECTS_FEATURE_BLOCK = 999999;
150+
DEXMATH_FEATURE_BLOCK = 999999;
150151
}
151152

152153
/**
@@ -179,6 +180,7 @@ CTestNetConsensusParams::CTestNetConsensusParams()
179180
MSC_BET_BLOCK = 999999;
180181
// Other feature activations:
181182
GRANTEFFECTS_FEATURE_BLOCK = 999999;
183+
DEXMATH_FEATURE_BLOCK = 999999;
182184
}
183185

184186
/**
@@ -211,6 +213,7 @@ CRegTestConsensusParams::CRegTestConsensusParams()
211213
MSC_BET_BLOCK = 999999;
212214
// Other feature activations:
213215
GRANTEFFECTS_FEATURE_BLOCK = 999999;
216+
DEXMATH_FEATURE_BLOCK = 999999;
214217
}
215218

216219
//! Consensus parameters for mainnet
@@ -350,6 +353,13 @@ bool ActivateFeature(uint16_t featureId, int activationBlock, int transactionBlo
350353
"granting tokens, is going to be disabled at block %d.\n",
351354
featureId, params.GRANTEFFECTS_FEATURE_BLOCK);
352355
return true;
356+
case FEATURE_DEXMATH:
357+
MutableConsensusParams().DEXMATH_FEATURE_BLOCK = activationBlock;
358+
PrintToLog("Feature activation of ID %d succeeded. "
359+
"Offering more tokens than available on the traditional DEx "
360+
"is no longer allowed and going to be disabled at block %d.\n",
361+
featureId, params.DEXMATH_FEATURE_BLOCK);
362+
return true;
353363
}
354364

355365
PrintToLog("Feature activation of id %d refused due to unknown feature ID\n", featureId);
@@ -377,6 +387,9 @@ bool IsFeatureActivated(uint16_t featureId, int transactionBlock)
377387
case FEATURE_GRANTEFFECTS:
378388
activationBlock = params.GRANTEFFECTS_FEATURE_BLOCK;
379389
break;
390+
case FEATURE_DEXMATH:
391+
activationBlock = params.DEXMATH_FEATURE_BLOCK;
392+
break;
380393
default:
381394
return false;
382395
}

src/omnicore/rules.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ const uint16_t FEATURE_METADEX = 2;
2222
const uint16_t FEATURE_BETTING = 3;
2323
//! Feature identifier to disable crowdsale participations when "granting tokens"
2424
const uint16_t FEATURE_GRANTEFFECTS = 4;
25+
//! Feature identifier to disable DEx "over-offers" and to switch to plain integer math
26+
const uint16_t FEATURE_DEXMATH = 5;
2527

2628
/** A structure to represent transaction restrictions.
2729
*/
@@ -99,6 +101,8 @@ class CConsensusParams
99101

100102
//! Block to deactivate crowdsale participations when "granting tokens"
101103
int GRANTEFFECTS_FEATURE_BLOCK;
104+
//! Block to disable DEx "over-offers" and to switch to plain integer math
105+
int DEXMATH_FEATURE_BLOCK;
102106

103107
/** Returns a mapping of transaction types, and the blocks at which they are enabled. */
104108
virtual std::vector<TransactionRestriction> GetRestrictions() const;

0 commit comments

Comments
 (0)