()
| 1870 | } |
| 1871 | |
| 1872 | async function exploreAccount() { |
| 1873 | let account = readlineSync.question('Enter the account to explore: ', { |
| 1874 | limit: function (input) { |
| 1875 | return web3.utils.isAddress(input); |
| 1876 | }, |
| 1877 | limitMessage: "Must be a valid address" |
| 1878 | }); |
| 1879 | |
| 1880 | let appliyngDailyRestriction = null; |
| 1881 | let applyingCustomRestriction = null; |
| 1882 | let hasIndividualRestrictions = false; |
| 1883 | let isExempted = await currentTransferManager.methods.exemptList(account).call(); |
| 1884 | if (!isExempted) { |
| 1885 | let individuallDailyRestriction = await currentTransferManager.methods.individualDailyRestriction(account).call(); |
| 1886 | if (parseInt(individuallDailyRestriction.endTime) !== 0) { |
| 1887 | appliyngDailyRestriction = individuallDailyRestriction; |
| 1888 | } |
| 1889 | let customRestriction = await currentTransferManager.methods.individualRestriction(account).call(); |
| 1890 | if (parseInt(customRestriction.endTime) !== 0) { |
| 1891 | applyingCustomRestriction = customRestriction; |
| 1892 | } |
| 1893 | |
| 1894 | hasIndividualRestrictions = applyingCustomRestriction || appliyngDailyRestriction; |
| 1895 | |
| 1896 | if (!hasIndividualRestrictions) { |
| 1897 | let globalDailyRestriction = await currentTransferManager.methods.defaultDailyRestriction().call(); |
| 1898 | if (parseInt(globalDailyRestriction.endTime) !== 0) { |
| 1899 | appliyngDailyRestriction = globalDailyRestriction; |
| 1900 | } |
| 1901 | let globalCustomRestriction = await currentTransferManager.methods.defaultRestriction().call(); |
| 1902 | if (parseInt(globalCustomRestriction.endTime) === 0) { |
| 1903 | applyingCustomRestriction = globalCustomRestriction; |
| 1904 | } |
| 1905 | } |
| 1906 | } |
| 1907 | |
| 1908 | console.log(`*** Applying restrictions for ${account} ***`, '\n'); |
| 1909 | |
| 1910 | console.log(`- Daily restriction: ${appliyngDailyRestriction ? (!hasIndividualRestrictions ? 'global' : '') : 'None'}`); |
| 1911 | if (appliyngDailyRestriction) { |
| 1912 | console.log(` Type: ${RESTRICTION_TYPES[appliyngDailyRestriction.typeOfRestriction]}`); |
| 1913 | console.log(` Allowed tokens: ${appliyngDailyRestriction.typeOfRestriction === "0" ? `${web3.utils.fromWei(appliyngDailyRestriction.allowedTokens)} ${tokenSymbol}` : `${fromWeiPercentage(appliyngDailyRestriction.allowedTokens)}%`}`); |
| 1914 | console.log(` Start time: ${moment.unix(appliyngDailyRestriction.startTime).format('MMMM Do YYYY, HH:mm:ss')}`); |
| 1915 | console.log(` Rolling period: ${appliyngDailyRestriction.rollingPeriodInDays} days`); |
| 1916 | console.log(` End time: ${moment.unix(appliyngDailyRestriction.endTime).format('MMMM Do YYYY, HH:mm:ss')} `); |
| 1917 | } |
| 1918 | console.log(`- Other restriction: ${applyingCustomRestriction ? (!hasIndividualRestrictions ? 'global' : '') : 'None'} `); |
| 1919 | if (applyingCustomRestriction) { |
| 1920 | console.log(` Type: ${RESTRICTION_TYPES[applyingCustomRestriction.typeOfRestriction]}`); |
| 1921 | console.log(` Allowed tokens: ${applyingCustomRestriction.typeOfRestriction === "0" ? `${web3.utils.fromWei(applyingCustomRestriction.allowedTokens)} ${tokenSymbol}` : `${fromWeiPercentage(applyingCustomRestriction.allowedTokens)}%`}`); |
| 1922 | console.log(` Start time: ${moment.unix(applyingCustomRestriction.startTime).format('MMMM Do YYYY, HH:mm:ss')}`); |
| 1923 | console.log(` Rolling period: ${applyingCustomRestriction.rollingPeriodInDays} days`); |
| 1924 | console.log(` End time: ${moment.unix(applyingCustomRestriction.endTime).format('MMMM Do YYYY, HH:mm:ss')} `); |
| 1925 | } |
| 1926 | |
| 1927 | if (applyingCustomRestriction || appliyngDailyRestriction) { |
| 1928 | let bucketDetails; |
| 1929 | if (hasIndividualRestrictions) { |
no test coverage detected