Skip to content

Commit

Permalink
deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
amazingandyyy committed Apr 8, 2018
1 parent fa59497 commit aee02df
Show file tree
Hide file tree
Showing 7 changed files with 39,615 additions and 11,294 deletions.
3 changes: 2 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
],
"ignore": [
"node_modules",
"dist"
"dist",
"./src/data.json"
]
}
2 changes: 1 addition & 1 deletion src/app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import lotion from 'lotion';
import handler from './handler';
// import genesis from './genesis';
import data from './data';
import data from './data.json';

class App {
constructor() {
Expand Down
58 changes: 58 additions & 0 deletions src/celadon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

function trasactionWithCeledon(state, opts){
console.log(opts.org)
// opts: {
// from:,
// to: ,
// amount: ,
// feePortion,
// org
// }
const { from, to } = opts;
const addressLength = 66;
if(from.length < addressLength || to.length < addressLength) {
return {...state}
}
let userOneBalance = state.balances[from];
let userTwoBalance = state.balances[to];
if((userOneBalance<=10)||userTwoBalance<=10) {
return {...state}
}

const { feePortion, org } = opts;
let amount = opts.amount || Math.random()*((Math.min(userOneBalance, userTwoBalance))/2.4);
let fee = feePortion || 0.01;
amount-=amount*fee;
if(amount>userOneBalance) {
return {...state}
}
userOneBalance-=amount;
userTwoBalance+=amount;

let donations = amount*fee;
amount -= donations;

state.balances = {
...state.balances,
[from]: userOneBalance,
[to]: userTwoBalance
}

state.transactions = [
...state.transactions,
{
timestamp: Date.now() - (Math.floor(Math.random()*300)+100),
from,
to: {
address: to,
amount
},
donations: {
address: org,
amount: donations
}
}
]
}

export {trasactionWithCeledon};
Loading

0 comments on commit aee02df

Please sign in to comment.