Skip to content

Commit

Permalink
remove include b1
Browse files Browse the repository at this point in the history
  • Loading branch information
dskvr committed May 22, 2018
1 parent 9470afa commit fb8f417
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 22 deletions.
3 changes: 0 additions & 3 deletions config.default.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ module.exports = {
//The Author
author: "Anonymous",

//Include block.one distribution in snapshot
include_b1: true,

//Minimum balance required for snapshot inclusion.
//Note: 1 EOS is recommended, as there will be a minimum balance required to have the bandwidth required for a functional account. Additionally, this prevents dust from appearing as an initial accounts, and cleans up the chain.
snapshot_minimum_balance: 1,
Expand Down
2 changes: 1 addition & 1 deletion tools/snapshot/classes/Wallet.Final.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class WalletFinal extends Wallet {

process_exclude(complete){
const exclude = [CS_ADDRESS_CROWDSALE, CS_ADDRESS_TOKEN]
if(!this.config.include_b1) exclude.push(CS_ADDRESS_B1)
// if(!this.config.include_b1) exclude.push(CS_ADDRESS_B1)
if(exclude.indexOf(this.address) > -1)
this.accepted = false,
this.register_error = 'exclude'
Expand Down
2 changes: 1 addition & 1 deletion tools/snapshot/classes/Wallet.Ongoing.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class WalletOngoing extends Wallet {

process_exclude(complete){
const exclude = [CS_ADDRESS_CROWDSALE, CS_ADDRESS_TOKEN]
if(!this.config.include_b1) exclude.push(CS_ADDRESS_B1)
// if(!this.config.include_b1) exclude.push(CS_ADDRESS_B1)
if(exclude.indexOf(this.address) > -1)
this.accepted = false,
this.register_error = 'exclude'
Expand Down
14 changes: 7 additions & 7 deletions tools/snapshot/prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ let schema = {
},

//Options
include_b1: {
type: 'boolean',
description: colors.magenta('Include B1 Distribution in Snapshot?'),
message: 'Must be boolean',
default: true,
ask: () => prompt.history('load_config')===false
},
// include_b1: {
// type: 'boolean',
// description: colors.magenta('Include B1 Distribution in Snapshot?'),
// message: 'Must be boolean',
// default: true,
// ask: () => prompt.history('load_config')===false
// },

registration_fallback: {
type: 'boolean',
Expand Down
7 changes: 3 additions & 4 deletions tools/snapshot/tasks/export/snapshot.json.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ module.exports = ( state, complete ) => {
data.parameters = {
period: config.period,
block_begin: state.block_begin,
block_end: state.block_end,
b1_dist: config.include_b1
block_end: state.block_end
// b1_dist: config.include_b1
}
data.meta.author = config.author
data.meta.timestamp_started = state.timestamp_started
Expand All @@ -51,8 +51,7 @@ module.exports = ( state, complete ) => {
}

const get_supply_expected = callback => {
data.supply.expected = 200000000+(config.period*2000000)
if(config.include_b1) data.supply.expected += 100000000
data.supply.expected = 200000000+(config.period*2000000)+100000000
callback()
}

Expand Down
6 changes: 2 additions & 4 deletions tools/snapshot/tests/total-supply.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ let db = require('../models'),

module.exports = ( state, callback ) => {
let query = `SELECT sum(balance_wallet) FROM wallets`
if(!config.include_b1) query = `${query} WHERE address!="${CS_ADDRESS_B1}"`
// if(!config.include_b1) query = `${query} WHERE address!="${CS_ADDRESS_B1}"`

db.sequelize
.query(query, {type: db.sequelize.QueryTypes.SELECT})
.then( sum => {
let total = new bn(parseFloat(sum[0]['sum(balance_wallet)'])),
expected = new bn(200000000).plus(new bn(CS_MAX_PERIOD_INDEX).times(2000000))

if(config.include_b1) expected = expected.plus(new bn(100000000))
expected = new bn(200000000).plus(new bn(CS_MAX_PERIOD_INDEX).times(2000000)).plus(new bn(100000000))

const diff = total.sub(expected)

Expand Down
3 changes: 1 addition & 2 deletions tools/snapshot/utilities/periods.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ const daily_totals = ( callback ) => {
}

const expected_supply = (period, include_b1) => {
let result = new bn(CS_CREATE_FIRST_PERIOD).div(WAD).plus( new bn(CS_CREATE_PER_PERIOD).div(WAD).times(new bn(period)) )
if(include_b1) result.plus(new bn(CS_B1_DISTRIBUTION).div(WAD))
let result = new bn(CS_CREATE_FIRST_PERIOD).div(WAD).plus( new bn(CS_CREATE_PER_PERIOD).div(WAD).times(new bn(period)) ).plus(new bn(CS_B1_DISTRIBUTION).div(WAD))
return result.toFixed(4)
}

Expand Down

0 comments on commit fb8f417

Please sign in to comment.