Code Review
Branch 1.0.8
Discussion and Review
Incorporating Consensus Changes to processing_routes/nodes.js
- Allows Nodes to update more than DEX Fee Votes
Non consensus changes to version number, config, and API
- Increment Version Number
- Improves compatibility with Front Ends
- Example Front End Code For Governance Ops:
saveNodeSettings() {
let updates = {};
for (var i = 0; i < this.features.node.opts.length; i++) {
if (this.features.node.opts[i].val) {
updates[this.features.node.opts[i].json] = this.features.node.opts[i].val;
}
}
broadcastCJA(updates, `${this.prefix}${this.features.node.id}`, `Updating ${this.TOKEN} Node...`, lapi.split('://')[1])
}
Changes to processing_routes/nodes.js
- Looks for the
dv
election - Actually incorporates the elections into existing nodes.
@@ -47,7 +47,7 @@ exports.node_add = function(json, from, active, pc) {
if (ds > 10000) {
ds = 10000
}
>>>>> -
var dv = parseInt(json.ds) || 0 //dao vote 10000 = 100.00% / 1 = 0.01%
<<<<<
>>>>> +
var dv = parseInt(json.dv) || 0 //dao vote 10000 = 100.00% / 1 = 0.01%
<<<<<
//the portion of the claim that will be put into the chains DAO. Recommend 10-15%
if (dv < 0) {
dv = 1500
@@ -101,6 +101,10 @@ exports.node_add = function(json, from, active, pc) {
var b = a;
b.domain = json.domain ? json.domain : b.domain;
b.bidRate = bid ? bid : b.bidRate;
>>>>> +
b.dm = dm ? dm : b.dm || 10000;
b.ds = ds ? ds : b.ds || 0;
b.dv = dv ? dv : b.dv || 1500;
b.liquidity = liquidity ? liquidity : b.liquidity || 100;
<<<<<
if(mskey)b.mskey = mskey
ops = [{ type: 'put', path: ['markets', 'node', from], data: b }]
}
Changes to index.js
- Version Number Change
@@ -1,5 +1,5 @@
const config = require('./config');
>>>>> -
const VERSION = 'v1.0.7'
<<<<<
>>>>> +
const VERSION = 'v1.0.8'
<<<<<
exports.VERSION = VERSION
Changes to config.js
- Adding a Model to the Protocol API to help HoneyComb Apps interact with templates
@@ -83,6 +83,81 @@ const features = {
claimdrop: true, //claim drops
inflation: false //inflation
}
>>>>> +
const featuresModel = {
claim_id: 'claim',
claim_S: 'Airdrop',
claim_B: true,
claim_json: 'drop',
rewards_id: 'shares_claim',
rewards_S: 'Rewards',
rewards_B: true,
rewards_json: 'claim',
rewardSel: false,
reward2Gov: false,
send_id: 'send',
send_S: 'Send',
send_B: true,
send_json: 'send',
powup_id: 'power_up',
powup_B: false,
pow_val: '',
powdn_id: 'power_down',
powdn_B: false,
powsel_up: true,
govup_id: 'gov_up',
govup_B: true,
gov_val: '',
govsel_up: true,
govdn_id: 'gov_down',
govdn_B: true,
node: {
id: 'node_add',
opts: [{
S: 'Domain',
type: 'text',
info: 'https://no-trailing-slash.com',
json: 'domain',
val: ''
},
{
S: 'DEX Fee Vote',
type: 'number',
info: '500 = .5%',
max: 1000,
min: 0,
json: 'bidRate',
val: ''
},
{
S: 'DEX Max Vote',
type: 'number',
info: '10000 = 100%',
max: 10000,
min: 0,
json: 'dm',
val: ''
},
{
S: 'DEX Slope Vote',
type: 'number',
info: '10000 = 100%',
max: 10000,
min: 0,
json: 'ds',
val: ''
},
{
S: 'DAO Claim Vote',
type: 'number',
info: '1500 = 15%',
max: 10000,
min: 0,
json: 'dv',
val: ''
}
],
}
}
<<<<<
const adverts = [
'https://camo.githubusercontent.com/954558e3ca2d68e0034cae13663d9807dcce3fcf/68747470733a2f2f697066732e627573792e6f72672f697066732f516d64354b78395548366a666e5a6748724a583339744172474e6b514253376359465032357a3467467132576f50'
]
@@ -153,7 +228,8 @@ let config = {
features,
snapcs,
stream,
>>>>> -
mode
<<<<<
>>>>> +
mode,
featuresModel
<<<<<
};
Changes to routes/api.js
- Pipe Above features to the protocol API endpoint
@@ -776,6 +776,7 @@ exports.protocol = (req, res, next) => {
multisig: config.msaccount,
jsontoken: config.jsonTokenName,
memoKey: config.msPubMemo,
>>>>> +
features: config.featuresModel,
<<<<<
behind: RAM.behind,
info: '/markets will return node information and published APIs for the consensus nodes, you may check these other APIs to ensure that the information in the API is in consensus.\nThe prefix is used to address this tokens architecture built on Hive.',
VERSION
oh right
Wonderful.