Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transfer rewards via cli #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import program from "commander";
import BN from "bn.js";

import { DPOSUser, CryptoUtils, GatewayVersion } from "loom-js";
import { DPOSUser, CryptoUtils, GatewayVersion, LocalAddress, Address } from "loom-js";
import { ICandidate } from "loom-js/dist/contracts/dpos";
const coinMultiplier = new BN(10).pow(new BN(18))

const payout_candidates = require('./lean_payouts.json')

program
.version('0.1.0')
.option('-c, --config <path>', 'config file absolute path')
Expand Down Expand Up @@ -311,4 +313,26 @@ program
}
});

program
.command("transfer-missing-rewards")
.description("transfers missing rewards to predefined list of users")
.action(async function() {
const user = await createUser(config)
var total = new BN(0)
for (let candidate of payout_candidates) {
let target = new Address(
'default', LocalAddress.fromHexString(candidate.dappchain_address)
)
let amount = new BN((candidate.amount_owed * 1000000000000000000).toString(), 10);
console.log('target: ', target)
console.log('amount: ', amount.toString())
try {
await user.dappchainLoom.transferAsync(target, amount)
} catch (err) {
console.error(err);
}
}

});

program.version("0.1.0").parse(process.argv);