| 32 | } |
| 33 | |
| 34 | async function transfer() { |
| 35 | // Let's check if token has already been deployed, if it has, skip to STO |
| 36 | await securityTokenRegistry.methods.getSecurityTokenAddress(_tokenSymbol).call({}, function (error, result) { |
| 37 | if (result != "0x0000000000000000000000000000000000000000") { |
| 38 | console.log('\x1b[32m%s\x1b[0m', "Token deployed at address " + result + "."); |
| 39 | let securityTokenABI = abis.securityToken(); |
| 40 | securityToken = new web3.eth.Contract(securityTokenABI, result); |
| 41 | } |
| 42 | }); |
| 43 | |
| 44 | try{ |
| 45 | let transferAction = securityToken.methods.transfer(_transferTo,web3.utils.toWei(_transferAmount,"ether")); |
| 46 | let receipt = await common.sendTransaction(transferAction); |
| 47 | let event = common.getEventFromLogs(securityToken._jsonInterface, receipt.logs, 'Transfer'); |
| 48 | console.log(` |
| 49 | Account ${event.from} |
| 50 | transferred ${web3.utils.fromWei(event.value,"ether")} tokens |
| 51 | to account ${event.to}` |
| 52 | ); |
| 53 | } catch (err){ |
| 54 | console.log(err); |
| 55 | console.log("There was an error processing the transfer transaction. \n The most probable cause for this error is one of the involved accounts not being in the whitelist or under a lockup period.") |
| 56 | return; |
| 57 | } |
| 58 | }; |
| 59 | |
| 60 | module.exports = { |
| 61 | executeApp: async function(tokenSymbol, transferTo, transferAmount) { |