MCPcopy Create free account
hub / github.com/ElementsProject/elements / stepBy

Function stepBy

src/qt/bitcoinamountfield.cpp:112–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110 }
111
112 void stepBy(int steps) override
113 {
114 bool valid = false;
115 auto val = value(&valid);
116 CAmount currentSingleStep = singleStep;
117 if (!currentSingleStep) {
118 if (current_asset == Params().GetConsensus().pegged_asset) {
119 currentSingleStep = 100000; // satoshis
120 } else {
121 currentSingleStep = 100000000; // a whole asset
122 }
123 }
124 val.second = val.second + steps * currentSingleStep;
125 val.second = qMax(val.second, CAmount(0));
126 val.second = qBound(m_min_amount, val.second, m_max_amount);
127 // ELEMENTS: issued assets can have values > MAX_MONEY
128 if (val.first == Params().GetConsensus().pegged_asset)
129 {
130 val.second = qMin(val.second, BitcoinUnits::maxMoney());
131 }
132 setValue(val);
133 }
134
135 void setDisplayUnit(const CAsset& asset)
136 {

Callers

nothing calls this directly

Calls 3

valueFunction · 0.85
setValueFunction · 0.85
ParamsClass · 0.50

Tested by

no test coverage detected