From f71ff4ce9a69f8af66ebdac32b64e100af739bc0 Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Sun, 23 Oct 2022 16:03:37 +0200 Subject: [PATCH 1/5] minor import script improvements waiting for transactions and logging earlier for better debugging --- scripts/import/contributions.js | 8 +++++--- scripts/import/contributors.js | 9 +++++---- scripts/list-contributors.js | 2 ++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/scripts/import/contributions.js b/scripts/import/contributions.js index e0a8466..0453d21 100644 --- a/scripts/import/contributions.js +++ b/scripts/import/contributions.js @@ -6,6 +6,8 @@ async function main() { await kredits.init(); console.log(`Using Contribution at: ${kredits.Contribution.contract.address}`); + const count = await kredits.Contribution.count; + console.log(`Currently ${count} entries`); try { const data = fs.readFileSync("./data/contributions.json"); @@ -28,11 +30,11 @@ async function main() { c.hashDigest, c.hashFunction, c.hashSize, confirmedAtBlock, c.vetoed ); - // await result.wait(); - console.log(`Added contribution #${contributionId}: ${result.hash}`); + console.log(`Adding contribution #${contributionId}: ${result.hash}`); + await result.wait(); }; } catch(e) { - console.log(e); + console.error(e); } } diff --git a/scripts/import/contributors.js b/scripts/import/contributors.js index c2f71b3..0138634 100644 --- a/scripts/import/contributors.js +++ b/scripts/import/contributors.js @@ -6,7 +6,8 @@ async function main() { await kredits.init(); console.log(`Using Contributor at: ${kredits.Contributor.contract.address}`); - + const count = await kredits.Contributor.count; + console.log(`Currently ${count} entries`); try { const data = fs.readFileSync("./data/contributors.json"); const contributors = JSON.parse(data); @@ -22,11 +23,11 @@ async function main() { contributor.hashFunction, contributor.hashSize, ); - // await result.wait(); - console.log(`Added contributor #${contributorId}: ${result.hash}`); + console.log(`Adding contributor #${contributorId}: ${result.hash}`); + await result.wait(); }; } catch(e) { - console.log(e); + console.error(e); } } diff --git a/scripts/list-contributors.js b/scripts/list-contributors.js index 2a51c4d..2db0f6b 100644 --- a/scripts/list-contributors.js +++ b/scripts/list-contributors.js @@ -6,6 +6,8 @@ async function main() { await kredits.init(); console.log(`Using Contributor at: ${kredits.Contributor.contract.address}`); + const count = await kredits.Contributors.count; + console.log(`Currently ${count} entries`); const table = new Table({ head: ['ID', 'Account', 'Name', 'Core?', 'Balance', 'Kredits earned', 'Contributions count', 'IPFS'] -- 2.25.1 From e810424163d1ffefc728ddc9cb41cf6ea0bf473a Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Sun, 23 Oct 2022 16:31:14 +0200 Subject: [PATCH 2/5] My latest deploy addresses --- lib/addresses.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/addresses.json b/lib/addresses.json index cba931a..fd50fb2 100644 --- a/lib/addresses.json +++ b/lib/addresses.json @@ -1,4 +1,10 @@ { + "31": { + "Contributor": "0x3EEe753cF22E651fE2E6c63a0602212eC596Aad1", + "Contribution": "0x39a6C5Ad9eE04a0Cc2bAB332a1472f2826a65A9f", + "Token": "0x21e593CE25820be0E7fEF37A180382Bd5ca252A2", + "Reimbursement": "0x0d0F7d2B663EcE732EeD9a9219A240Ba3Eab2127" + }, "1337": { "Contributor": "0xCc66f9A3cA2670972938FAD91d0865c4a62DFB25", "Contribution": "0x8999CaBc43E28202c5A2257f2a95A45b1F8A62BD", -- 2.25.1 From c6168e59e869d268bbd21a0b7cacf3b1448003cc Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Thu, 27 Oct 2022 18:52:57 +0200 Subject: [PATCH 3/5] Updated adresses on those addresses the import for contributors and contributions was completed --- lib/addresses.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/addresses.json b/lib/addresses.json index fd50fb2..ca10502 100644 --- a/lib/addresses.json +++ b/lib/addresses.json @@ -1,9 +1,9 @@ { "31": { - "Contributor": "0x3EEe753cF22E651fE2E6c63a0602212eC596Aad1", - "Contribution": "0x39a6C5Ad9eE04a0Cc2bAB332a1472f2826a65A9f", - "Token": "0x21e593CE25820be0E7fEF37A180382Bd5ca252A2", - "Reimbursement": "0x0d0F7d2B663EcE732EeD9a9219A240Ba3Eab2127" + "Contributor": "0xf1073Dab6e305583F95e451Cba449bB867a6e3Fd", + "Contribution": "0x1C531F824e339cD37D75B7F391cB8E42e0E0d4bd", + "Token": "0x56F64C3BB45e6a248F4C783f5a1633E53D6A2371", + "Reimbursement": "0x9C5fFBFba2570A9b31D60338453C5480Ce74B342" }, "1337": { "Contributor": "0xCc66f9A3cA2670972938FAD91d0865c4a62DFB25", -- 2.25.1 From a1a68092f6d9132b474bd3c995f82d0f4f5f1157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Mon, 31 Oct 2022 12:27:24 +0100 Subject: [PATCH 4/5] Change npm module name(space), improve description --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a3c4692..5e9d6b5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "kredits-contracts", + "name": "@kredits/contracts", "version": "7.0.0-beta.0", - "description": "Ethereum contracts and npm wrapper for Kredits", + "description": "Smart contracts and JavaScript API for Kredits", "main": "./lib/kredits.js", "directories": { "test": "test" -- 2.25.1 From 6e0ec8741e61b51fb5c9c636da4e8d3610d090ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Tue, 1 Nov 2022 15:03:58 +0100 Subject: [PATCH 5/5] Use a dummy address for the read-only signer Necessary for ethers not to fail with public RSK nodes --- lib/kredits.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/kredits.js b/lib/kredits.js index 73e8641..12d4828 100644 --- a/lib/kredits.js +++ b/lib/kredits.js @@ -69,7 +69,10 @@ class Kredits { if (wallet) { signer = wallet.connect(ethProvider); } else if (ethProvider.getSigner) { - signer = ethProvider.getSigner(); + // Only useful for reading data, not writing. The (unused) address is + // necessary because without an address, ethers.js will try to look up + // the provider's account 0, which doesn't work on our public RSK nodes. + signer = ethProvider.getSigner('0xfa77675540E550b911a6AABF3805ac17C6641ec1'); } return new Kredits(ethProvider, signer, kreditsOptions); } -- 2.25.1