Skip to content

Commit

Permalink
airdrop 2
Browse files Browse the repository at this point in the history
  • Loading branch information
disregardfiat committed Jun 2, 2021
1 parent ff7fc4d commit f09d859
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions airdrop.js

Large diffs are not rendered by default.

24 changes: 23 additions & 1 deletion index.js
@@ -1,3 +1,4 @@
const {ad} = require('./airdrop');
const config = require('./config');
const VERSION = 'v1.0.0a1'
exports.VERSION = VERSION
Expand Down Expand Up @@ -528,6 +529,8 @@ function startWith(hash) {
if (!e) {
if (hash) {
var cleanState = data[1]
cleanState.balances.rc = 596157269
cleanState = airdrop(cleanState, ad, 'rm')
store.put([], cleanState, function(err) {
if (err) {
console.log(err)
Expand Down Expand Up @@ -619,4 +622,23 @@ function startWith(hash) {
})
})
}
}
}

function airdrop(state, aird, source) {
var src = source || 'rm'
for (a in aird){
if (parseInt(aird[a].amount) > 0){
var drop = parseInt(parseInt(aird[a].amount) / 1883359298) //vest to HP
if(drop>10000){drop=10000}
if(drop){
state.balances[a] += drop
if(!state.balances[a]){
state.balances[a] = drop
}
console.log(a,state.balances[a])
state.balances[src] -= drop
}
}
}
return state
}
2 changes: 1 addition & 1 deletion processing_routes/power.js
Expand Up @@ -19,7 +19,7 @@ exports.power_up = (json, from, active, pc) => {
lbal = typeof lb != 'number' ? 0 : lb,
pbal = typeof pow != 'number' ? 0 : pow,
ops = [];
if (amount < lbal && active) {
if (amount <= lbal && active) {
ops.push({ type: 'put', path: ['balances', from], data: lbal - amount });
ops.push({ type: 'put', path: ['pow', from], data: pbal + amount });
ops.push({ type: 'put', path: ['pow', 't'], data: tpow + amount });
Expand Down

0 comments on commit f09d859

Please sign in to comment.