Skip to content

Commit

Permalink
Add feature activation for freeing the DEx
Browse files Browse the repository at this point in the history
  • Loading branch information
dexX7 committed Oct 29, 2019
1 parent 289f032 commit 158250d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/omnicore/rules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ CMainConsensusParams::CMainConsensusParams()
TRADEALLPAIRS_FEATURE_BLOCK = 438500;
FEES_FEATURE_BLOCK = 999999;
FREEZENOTICE_FEATURE_BLOCK = 999999;
FREEDEX_FEATURE_BLOCK = 999999;
}

/**
Expand Down Expand Up @@ -294,6 +295,7 @@ CTestNetConsensusParams::CTestNetConsensusParams()
TRADEALLPAIRS_FEATURE_BLOCK = 0;
FEES_FEATURE_BLOCK = 0;
FREEZENOTICE_FEATURE_BLOCK = 0;
FREEDEX_FEATURE_BLOCK = 0;
}

/**
Expand Down Expand Up @@ -335,6 +337,7 @@ CRegTestConsensusParams::CRegTestConsensusParams()
TRADEALLPAIRS_FEATURE_BLOCK = 999999;
FEES_FEATURE_BLOCK = 999999;
FREEZENOTICE_FEATURE_BLOCK = 999999;
FREEDEX_FEATURE_BLOCK = 999999;
}

//! Consensus parameters for mainnet
Expand Down Expand Up @@ -500,6 +503,9 @@ bool ActivateFeature(uint16_t featureId, int activationBlock, uint32_t minClient
case FEATURE_FREEZENOTICE:
MutableConsensusParams().FREEZENOTICE_FEATURE_BLOCK = activationBlock;
break;
case FEATURE_FREEDEX:
MutableConsensusParams().FREEDEX_FEATURE_BLOCK = activationBlock;
break;
default:
supported = false;
break;
Expand Down Expand Up @@ -571,6 +577,9 @@ bool DeactivateFeature(uint16_t featureId, int transactionBlock)
case FEATURE_FREEZENOTICE:
MutableConsensusParams().FREEZENOTICE_FEATURE_BLOCK = 999999;
break;
case FEATURE_FREEDEX:
MutableConsensusParams().FREEDEX_FEATURE_BLOCK = 999999;
break;
default:
return false;
break;
Expand Down Expand Up @@ -602,6 +611,7 @@ std::string GetFeatureName(uint16_t featureId)
case FEATURE_FEES: return "Fee system (inc 0.05% fee from trades of non-Omni pairs)";
case FEATURE_STOV1: return "Cross-property Send To Owners";
case FEATURE_FREEZENOTICE: return "Activate the waiting period for enabling freezing";
case FEATURE_FREEDEX: return "Activate trading of any token on the distributed exchange";

default: return "Unknown feature";
}
Expand Down Expand Up @@ -649,6 +659,9 @@ bool IsFeatureActivated(uint16_t featureId, int transactionBlock)
case FEATURE_FREEZENOTICE:
activationBlock = params.FREEZENOTICE_FEATURE_BLOCK;
break;
case FEATURE_FREEDEX:
activationBlock = params.FREEDEX_FEATURE_BLOCK;
break;
default:
return false;
}
Expand Down
4 changes: 4 additions & 0 deletions src/omnicore/rules.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const uint16_t FEATURE_FEES = 9;
const uint16_t FEATURE_STOV1 = 10;
//! Feature identifier to activate the waiting period for enabling managed property address freezing
const uint16_t FEATURE_FREEZENOTICE = 14;
//! Feature identifier to activate trading of any token on the distributed exchange
const uint16_t FEATURE_FREEDEX = 15;

//! When (propertyTotalTokens / OMNI_FEE_THRESHOLD) is reached fee distribution will occur
const int64_t OMNI_FEE_THRESHOLD = 100000; // 0.001%
Expand Down Expand Up @@ -141,6 +143,8 @@ class CConsensusParams
int FEES_FEATURE_BLOCK;
//! Block to activate the waiting period for enabling managed property address freezing
int FREEZENOTICE_FEATURE_BLOCK;
//! Block to activate the waiting period to activate trading of any token on the distributed exchange
int FREEDEX_FEATURE_BLOCK;

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

0 comments on commit 158250d

Please sign in to comment.