update seeds
This commit is contained in:
parent
203199c268
commit
1594bf0e17
@ -1,10 +1,11 @@
|
||||
let contractCalls = [
|
||||
['Contributor', 'add', [{ account: '0x7e8f313c56f809188313aa274fa67ee58c31515d', name: 'bumi', isCore: true, kind: 'preson', url: '', github_username: 'bumi', github_uid: 318, wiki_username: 'bumi' }, {gasLimit: 200000}]],
|
||||
['Contributor', 'add', [{ account: '0xa502eb4021f3b9ab62f75b57a94e1cfbf81fd827', name: 'raucau', isCore: true, kind: 'person', url: '', github_username: 'skddc', github_uid: 842, wiki_username: 'raucau' }, {gasLimit: 200000}]],
|
||||
['Operator', 'addProposal', [{ contributorId: 2, amount: 42, kind: 'code', description: 'runs the seeds', url: '' }, {gasLimit: 350000}]],
|
||||
['Operator', 'addProposal', [{ contributorId: 3, amount: 23, kind: 'code', description: 'runs the seeds', url: '' }, {gasLimit: 350000}]],
|
||||
['Operator', 'addProposal', [{contributorId: 3, amount: 100, kind: 'code', description: 'hacks on kredits', url: '' }, {gasLimit: 350000}]],
|
||||
['Operator', 'vote', ['1', {gasLimit: 250000}]]
|
||||
['Proposal', 'addProposal', [{ contributorId: 2, amount: 42, kind: 'code', description: 'runs the seeds', url: '' }, {gasLimit: 350000}]],
|
||||
['Proposal', 'addProposal', [{ contributorId: 3, amount: 23, kind: 'code', description: 'runs the seeds', url: '' }, {gasLimit: 350000}]],
|
||||
['Proposal', 'addProposal', [{contributorId: 3, amount: 100, kind: 'code', description: 'hacks on kredits', url: '' }, {gasLimit: 350000}]],
|
||||
['Proposal', 'vote', ['1', {gasLimit: 250000}]],
|
||||
['Contribution', 'addContribution', [{contributorAccount: '0xa502eb4021f3b9ab62f75b57a94e1cfbf81fd827', amount: 100, kind: 'code', description: 'hacks on kredits', url: '' }, {gasLimit: 350000}]],
|
||||
];
|
||||
let funds = [
|
||||
'0x7e8f313c56f809188313aa274fa67ee58c31515d',
|
||||
|
@ -6,46 +6,41 @@ const Kredits = require('../lib/kredits');
|
||||
|
||||
const each = require('async-each-series');
|
||||
|
||||
module.exports = function(callback) {
|
||||
const Registry = artifacts.require('./Registry.sol');
|
||||
|
||||
Registry.deployed().then(async (registry) => {
|
||||
|
||||
const networkId = parseInt(web3.version.network);
|
||||
const provider = new ethers.providers.Web3Provider(
|
||||
web3.currentProvider, { chainId: networkId }
|
||||
);
|
||||
const kredits = await Kredits.setup(provider, provider.getSigner());
|
||||
|
||||
let fundingAmount = 2;
|
||||
each(seeds.funds, (address, next) => {
|
||||
console.log(`funding ${address} with 2 ETH`);
|
||||
web3.eth.sendTransaction({
|
||||
to: address,
|
||||
value: web3.toWei(fundingAmount),
|
||||
from: web3.eth.accounts[0]
|
||||
},
|
||||
(result) => { next(); }
|
||||
)
|
||||
});
|
||||
|
||||
each(seeds.contractCalls, (call, next) => {
|
||||
let [contractName, method, args] = call;
|
||||
let contractWrapper = kredits[contractName];
|
||||
let func;
|
||||
if (contractWrapper[method]) {
|
||||
func = contractWrapper[method];
|
||||
} else {
|
||||
func = contractWrapper.functions[method];
|
||||
}
|
||||
func.apply(contractWrapper, args).then((result) => {
|
||||
console.log(`[OK] kredits.${contractName}.${method}(${JSON.stringify(args)}) => ${result.hash}`);
|
||||
next();
|
||||
}).catch((error) => {
|
||||
console.log(`[FAILD] kredits.${contractName}.${method}(${JSON.stringify(args)})`);
|
||||
callback(error)
|
||||
});
|
||||
}, () => { console.log("\nDone!") });
|
||||
module.exports = async function(callback) {
|
||||
const networkId = parseInt(web3.version.network);
|
||||
const provider = new ethers.providers.Web3Provider(
|
||||
web3.currentProvider, { chainId: networkId }
|
||||
);
|
||||
const kredits = await new Kredits(provider, provider.getSigner()).init();
|
||||
|
||||
let fundingAmount = 2;
|
||||
each(seeds.funds, (address, next) => {
|
||||
console.log(`funding ${address} with 2 ETH`);
|
||||
web3.eth.sendTransaction({
|
||||
to: address,
|
||||
value: web3.toWei(fundingAmount),
|
||||
from: web3.eth.accounts[0]
|
||||
},
|
||||
(result) => { next(); }
|
||||
)
|
||||
});
|
||||
|
||||
each(seeds.contractCalls, (call, next) => {
|
||||
let [contractName, method, args] = call;
|
||||
let contractWrapper = kredits[contractName];
|
||||
let func;
|
||||
if (contractWrapper[method]) {
|
||||
func = contractWrapper[method];
|
||||
} else {
|
||||
func = contractWrapper.functions[method];
|
||||
}
|
||||
func.apply(contractWrapper, args).then((result) => {
|
||||
console.log(`[OK] kredits.${contractName}.${method}(${JSON.stringify(args)}) => ${result.hash}`);
|
||||
next();
|
||||
}).catch((error) => {
|
||||
console.log(`[FAILD] kredits.${contractName}.${method}(${JSON.stringify(args)})`);
|
||||
callback(error)
|
||||
});
|
||||
}, () => { console.log("\nDone!") });
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user