Skip to content

Commit 5f75092

Browse files
authored
Merge pull request #679 from opentaps/main
Maintainers file per #598
2 parents 8686ac2 + 7081997 commit 5f75092

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

MAINTAINERS.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Maintainers
2+
===========
3+
4+
See [the documentation on Maintainers](https://hyperledger-fabric.readthedocs.io/en/latest/CONTRIBUTING.html#maintainers) to learn about the role of the maintainers and the process to become one.
5+
6+
**Active Maintainers**
7+
8+
| Name | GitHub | Affiliation
9+
|-------------------|-------------|----------------------------
10+
| Bertrand Rioux | [brioux](https://github.com/brioux) | [Two Ravens Consulting](https://tworavens.consulting/)
11+
| Si Chen | [opentaps](https://github.com/opentaps) | [Open Source Strategies](https://www.opensourcestrategies.com/)
12+
| Kamlesh Nagware | [knagware9](https://github.com/knagware9) | [SnapperTech](https://snapperfuturetech.com/)

app/api-server/controller/synchronizer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ export const syncWalletRoles = async (address: string, opts: OPTS_TYPE, data?: P
277277
console.log('saved wallet address: ', w.address)
278278
} catch (err) {
279279
console.error(err)
280-
throw new Error('Error in getNumOfUniqueTokens: ' + err)
280+
throw new Error('Error in syncWalletRoles: ' + err)
281281
}
282282
}
283283

hardhat/hardhat.config.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,40 @@ task("oilAndGasBenchmarkBasins","Use admin account to issue demo carbon tracker
927927
}
928928
)
929929

930+
task("grantConsumerRole", "Give users who register by email a consumer role")
931+
.addParam("contract","")
932+
.setAction(async (taskArgs, hre) => {
933+
const db = await PostgresDBService.getInstance();
934+
935+
const wallets = await db.getWalletRepo().selectAll();
936+
937+
const { deployer } = await hre.getNamedAccounts();
938+
const NetEmissionsTokenNetwork = await hre.ethers.getContractFactory("NetEmissionsTokenNetwork");
939+
const contract = await NetEmissionsTokenNetwork.attach(taskArgs.contract);
940+
for (const w in wallets) {
941+
const wallet = wallets[w];
942+
if (wallet && wallet.email && wallet.email.length > 0 && !wallet.roles) {
943+
console.log(`Wallet ${wallet.address}, email: ${wallet.email}`);
944+
945+
try {
946+
// check roles
947+
const roles = await contract.connect(await hre.ethers.getSigner(deployer)).getRoles(wallet.address);
948+
if(!roles.isConsumer){
949+
console.log(`Registed user ${wallet.address}, email: ${wallet.email} as consumer`);
950+
await contract.connect(await hre.ethers.getSigner(deployer)).registerConsumer(wallet.address);
951+
} else {
952+
console.warn('Already registered as consumer on network.')
953+
await db.getWalletRepo().ensureWalletHasRoles(wallet.address, ['Consumer'])
954+
}
955+
} catch (err) {
956+
console.error('An error occurred: ', err);
957+
}
958+
}
959+
}
960+
961+
await db.close()
962+
}
963+
)
930964

931965
task("grantAdminRole", "Grants an account the DEFAULT_ADMIN_ROLE for a given contract")
932966
.addParam("contract", "")

0 commit comments

Comments
 (0)