MCPcopy Create free account
hub / github.com/PolymathNetwork/polymath-core / exploreAddress

Function exploreAddress

CLI/commands/dividends_manager.js:77–100  ·  view source on GitHub ↗
(currentCheckpoint)

Source from the content-addressed store, hash-verified

75}
76
77async function exploreAddress(currentCheckpoint) {
78 let address = readlineSync.question('Enter address to explore: ', {
79 limit: function (input) {
80 return web3.utils.isAddress(input);
81 },
82 limitMessage: "Must be a valid address",
83 });
84 let checkpoint = null;
85 if (currentCheckpoint > 0) {
86 checkpoint = await selectCheckpoint(false);
87 }
88
89 let balance = web3.utils.fromWei(await securityToken.methods.balanceOf(address).call());
90 let totalSupply = web3.utils.fromWei(await securityToken.methods.totalSupply().call());
91 console.log(`Balance of ${address} is: ${balance} ${tokenSymbol}`);
92 console.log(`TotalSupply is: ${totalSupply} ${tokenSymbol}`);
93
94 if (checkpoint) {
95 let balanceAt = web3.utils.fromWei(await securityToken.methods.balanceOfAt(address, checkpoint).call());
96 let totalSupplyAt = web3.utils.fromWei(await securityToken.methods.totalSupplyAt(checkpoint).call());
97 console.log(`Balance of ${address} at checkpoint ${checkpoint}: ${balanceAt} ${tokenSymbol}`);
98 console.log(`TotalSupply at checkpoint ${checkpoint} is: ${totalSupplyAt} ${tokenSymbol}`);
99 }
100}
101
102async function configExistingModules(dividendModules) {
103 let options = dividendModules.map(m => `${m.name} at ${m.address}`);

Callers 1

executeAppFunction · 0.85

Calls 1

selectCheckpointFunction · 0.85

Tested by

no test coverage detected