Document helper scripts to interact with the contracts
This commit is contained in:
@@ -30,19 +30,18 @@ module.exports = function(callback) {
|
||||
let ipfsHash = process.argv[5] || 'QmQyZJT9uikzDYTZLhhyVZ5ReZVCoMucYzyvDokDJsijhj';
|
||||
let contributorMultihash = getBytes32FromMultiash(ipfsHash);
|
||||
let isCore = true;
|
||||
operator.addContributor(contributorToAddAddress, contributorMultihash.digest, contributorMultihash.hashFunction, contributorMultihash.size, isCore).then((result) => {
|
||||
console.log('Contributor added, tx: ', result.tx);
|
||||
});
|
||||
let contributorResult = await operator.addContributor(contributorToAddAddress, contributorMultihash.digest, contributorMultihash.hashFunction, contributorMultihash.size, isCore);
|
||||
console.log('Contributor added, tx: ', contributorResult.tx);
|
||||
|
||||
var contributorId = await contributors.getContributorIdByAddress(contributorToAddAddress);
|
||||
let contributorId = await contributors.getContributorIdByAddress(contributorToAddAddress);
|
||||
let proposalMultihash = getBytes32FromMultiash('QmQNA1hhVyL1Vm6HiRxXe9xmc6LUMBDyiNMVgsjThtyevs');
|
||||
operator.addProposal(contributorId, 23, proposalMultihash.digest, proposalMultihash.hashFunction, proposalMultihash.size).then((result) => {
|
||||
console.log('Proposal added, tx: ', result.tx);
|
||||
});
|
||||
let proposalResult = await operator.addProposal(contributorId, 23, proposalMultihash.digest, proposalMultihash.hashFunction, proposalMultihash.size);
|
||||
console.log('Proposal added, tx: ', proposalResult.tx);
|
||||
|
||||
var proposalId = await operator.proposalsCount();
|
||||
operator.vote(proposalId.toNumber()-1).then((result) => {
|
||||
console.log('Voted for proposal', proposalId, result.tx);
|
||||
})
|
||||
let proposalId = await operator.proposalsCount();
|
||||
let votingResult = operator.vote(proposalId.toNumber()-1);
|
||||
console.log('Voted for proposal', proposalId.toString(), votingResult.tx);
|
||||
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -32,9 +32,9 @@ module.exports = function(callback) {
|
||||
|
||||
let contributorId = await contributors.getContributorIdByAddress(recipientAddress);
|
||||
|
||||
operator.addProposal(contributorId.toNumber(), 23, multihash.digest, multihash.hashFunction, multihash.size).then((result) => {
|
||||
console.log('Proposal added, tx: ', result.tx);
|
||||
});
|
||||
let result = await operator.addProposal(contributorId.toNumber(), 23, multihash.digest, multihash.hashFunction, multihash.size);
|
||||
console.log('Proposal added, tx: ', result.tx);
|
||||
|
||||
callback();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -29,4 +29,6 @@ module.exports = function(callback) {
|
||||
seeds.ipfsContent.forEach((content) => {
|
||||
ipfs.add(new ipfs.Buffer(JSON.stringify(content))).then((result) => { console.log(`[IPFS] added ${result[0].hash}`) });
|
||||
});
|
||||
|
||||
callback();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
module.exports = function(cb) {
|
||||
module.exports = function(callback) {
|
||||
let recipient = process.argv[4];
|
||||
if (!recipient) {
|
||||
console.log('Please provide a recipient address');
|
||||
@@ -8,4 +8,6 @@ module.exports = function(cb) {
|
||||
let amount = parseInt(process.argv[5]) || 1;
|
||||
console.log(recipient);
|
||||
web3.eth.sendTransaction({to: recipient, value: web3.toWei(amount), from: web3.eth.accounts[0]}, console.log);
|
||||
|
||||
callback();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user