-
Notifications
You must be signed in to change notification settings - Fork 7
/
flows.json
1 lines (1 loc) · 283 KB
/
flows.json
1
[{"id":"e769bed0.7d2b7","type":"tab","label":"Global Config","disabled":false,"info":"Set all global parameters"},{"id":"507c6c45.0c62b4","type":"tab","label":"Collab- 19 Info Bot","disabled":false,"info":""},{"id":"2d3e2335.2a164c","type":"tab","label":"Contract Wallet Flow","disabled":false,"info":""},{"id":"3867c68b.1306da","type":"tab","label":"(Vote and New Proposal)","disabled":false,"info":""},{"id":"da8d4d9f.ceb7b","type":"tab","label":"Noti Listener","disabled":false,"info":""},{"id":"3e3253ba.73217c","type":"tab","label":"TRF ERC20 Token","disabled":false,"info":""},{"id":"960930e5.d6aff","type":"tab","label":"Group Manager","disabled":false,"info":""},{"id":"32ecfd36.7ca7a2","type":"tab","label":"Sender Node","disabled":false,"info":""},{"id":"170efd68.bfb693","type":"tab","label":"Funding Proposal Flow","disabled":false,"info":""},{"id":"3ab44c3f.7208e4","type":"tab","label":"Depricated","disabled":false,"info":""},{"id":"5338f0fd.b175f","type":"tab","label":"Broadcast Message","disabled":false,"info":""},{"id":"bd469ba9.d6e0d8","type":"subflow","name":"Block Chain Event Listener","info":"","category":"","in":[{"x":20,"y":80,"wires":[{"id":"8fcbfae.cfcac08"}]}],"out":[{"x":760,"y":80,"wires":[{"id":"b7757edd.6b446","port":0},{"id":"b7757edd.6b446","port":1}]}],"env":[],"color":"#DDAA99"},{"id":"8342788e.337c18","type":"subflow","name":"Initilise User","info":"","category":"","in":[{"x":40,"y":240,"wires":[{"id":"45e310f4.97889"}]}],"out":[{"x":1000,"y":200,"wires":[{"id":"e394da02.ff4aa8","port":0},{"id":"ff026359.c6b57","port":1}]},{"x":1000,"y":240,"wires":[{"id":"160381b2.1a63fe","port":1},{"id":"1de7a7ea.ae7bc8","port":1}]}],"env":[],"color":"#DDAA99"},{"id":"eb348c5b.99945","type":"subflow","name":"Abi Events","info":"","category":"","in":[{"x":420,"y":280,"wires":[{"id":"4370e2d0.6726dc"}]}],"out":[{"x":740,"y":280,"wires":[{"id":"4370e2d0.6726dc","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"7e9a59cc.c495e8","type":"subflow","name":"Contract Event Listener","info":"","category":"","in":[{"x":180,"y":280,"wires":[{"id":"3924fd54.e22db2"}]}],"out":[{"x":580,"y":280,"wires":[{"id":"3924fd54.e22db2","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"2d0ecfb0.969f6","type":"subflow","name":"Telegram Sender With Tracking","info":"","category":"","in":[{"x":200,"y":280,"wires":[{"id":"53be3054.8067a"}]}],"out":[{"x":780,"y":280,"wires":[{"id":"531d1273.bcb73c","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"5c764a0d.f85564","type":"subflow","name":"Delete Message","info":"","category":"","in":[{"x":120,"y":180,"wires":[{"id":"80cfd10d.15c5"}]}],"out":[],"env":[],"color":"#DDAA99"},{"id":"c67eccc4.042ec","type":"subflow","name":"SDK v2 Helper","info":"","category":"","in":[{"x":320,"y":140,"wires":[{"id":"87294638.56b3d8"}]}],"out":[{"x":660,"y":140,"wires":[{"id":"87294638.56b3d8","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"9e5e594a.494868","type":"subflow","name":"Balance ERC20","info":"","category":"","in":[{"x":360,"y":300,"wires":[{"id":"e2fede67.006c2"}]}],"out":[{"x":780,"y":300,"wires":[{"id":"e2fede67.006c2","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"9b059efc.f650b","type":"subflow","name":"Get Eth Balance","info":"","category":"","in":[{"x":400,"y":220,"wires":[{"id":"f991b316.67ea2"}]}],"out":[{"x":700,"y":220,"wires":[{"id":"f991b316.67ea2","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"e730b986.339628","type":"subflow","name":"ETH and Token Balance","info":"","category":"","in":[{"x":40,"y":140,"wires":[{"id":"a438882b.30cdb8"}]}],"out":[{"x":1100,"y":140,"wires":[{"id":"ad9aeaf3.58eae8","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"48d0467c.b38be8","type":"subflow","name":"Encode Data","info":"","category":"","in":[{"x":420,"y":240,"wires":[{"id":"16cec28c.1236cd"}]}],"out":[{"x":720,"y":240,"wires":[{"id":"16cec28c.1236cd","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"f3b533a7.b8e5b","type":"subflow","name":"kickChatMember","info":"","category":"","in":[{"x":340,"y":320,"wires":[{"id":"68b34fe.9e7bfb"},{"id":"54d4b29b.aebd9c"}]}],"out":[{"x":700,"y":320,"wires":[{"id":"68b34fe.9e7bfb","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"fd7a3a71.e58138","type":"subflow","name":"AWS KMS","info":"","category":"","in":[{"x":240,"y":360,"wires":[{"id":"54893cd1.1373d4"}]}],"out":[{"x":580,"y":360,"wires":[{"id":"54893cd1.1373d4","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"6b23cad2.b43514","type":"subflow","name":"Decrypt PK","info":"","category":"","in":[{"x":140,"y":320,"wires":[{"id":"87dd9373.2b32"}]}],"out":[{"x":1120,"y":320,"wires":[{"id":"2f7a35d2.4f7b9a","port":0},{"id":"87dd9373.2b32","port":1}]}],"env":[],"color":"#DDAA99"},{"id":"27eb9c12.0fb5c4","type":"subflow","name":"Community Bank","info":"# Community bank details\n - ETH and DAI balance","category":"","in":[{"x":460,"y":440,"wires":[{"id":"613eb832.81dbc8"}]}],"out":[{"x":1320,"y":440,"wires":[{"id":"9ee2bbe6.432a38","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"12d3ed6c.11fdf3","type":"chatbot-telegram-node","z":"","botname":"Collab Land Bot","usernames":"","providerToken":"","polling":"1000","store":"","log":"","debug":false,"webHook":"","connectMode":"polling"},{"id":"a65faee5.5fdcc","type":"node-config-airtable","z":"","name":"Collab Airtable"},{"id":"784f1d9a.2a3ad4","type":"chatbot-telegram-node","z":"","botname":"Collab 19","usernames":"","providerToken":"","polling":"300","store":"","log":"","debug":false,"webHook":"","connectMode":"polling"},{"id":"8fcbfae.cfcac08","type":"function","z":"bd469ba9.d6e0d8","name":"BC EventListener","func":"ethers = global.get('ethers');\nlet provider = ethers.getDefaultProvider(msg.payload.network);\n\nlet filter = {\n address: msg.payload.address\n}\n\nprovider.on(filter, (result) => {\n msg.payload.transaction = result;\n node.send(msg);\n});\n\nreturn;","outputs":1,"noerr":0,"x":230,"y":80,"wires":[["d118f143.85bd6"]]},{"id":"d118f143.85bd6","type":"function","z":"bd469ba9.d6e0d8","name":"Parse Trx","func":"ethers = global.get('ethers');\nlet provider = ethers.getDefaultProvider(msg.payload.network);\nlet transactionHash = msg.payload.transaction.transactionHash;\n\nif(msg.payload.abi === undefined){\n node.send(msg);\n node.done();\n}else{\n iface = new ethers.utils.Interface (msg.payload.abi);\n msg.payload.iface = iface;\n \n provider.getTransaction(transactionHash).then((transaction) => {\n transaction.wait(2);\n msg.payload.trxObj = transaction;\n init(transaction);\n });\n}\n\nasync function init(transaction){\n try{\n const parsedData = await iface.parseTransaction(transaction) ;\n msg.payload.parsedData = parsedData;\n }catch(e){\n msg.payload.error = e;\n } \n node.send(msg);\n node.done();\n}\n\nreturn ;","outputs":1,"noerr":0,"x":420,"y":80,"wires":[["b7757edd.6b446"]]},{"id":"b7757edd.6b446","type":"function","z":"bd469ba9.d6e0d8","name":"","func":"if(msg.payload.parsedData === null || msg.payload.parsedData === undefined){\n return [null, msg]\n}\nrecord = {\n \"event_name\" : msg.payload.parsedData.name, \n \"from\" : msg.payload.trxObj.from,\n \"to\" : msg.payload.trxObj.to,\n \"raw\" : msg.payload.trxObj.raw,\n \"data\" : msg.payload.trxObj.data,\n \"hash\" : msg.payload.trxObj.hash\n}\nmsg.payload.record = record;\nreturn [ msg, null ];","outputs":2,"noerr":0,"x":590,"y":80,"wires":[[],[]]},{"id":"8b78c5da.9f79e8","type":"debug","z":"bd469ba9.d6e0d8","name":"BC Event Listener","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":570,"y":220,"wires":[]},{"id":"45e310f4.97889","type":"function","z":"8342788e.337c18","name":"Get User","func":"msg.payload.filter = `({user_id} = '${msg.payload.userId.toString()}')`;\nreturn msg;","outputs":1,"noerr":0,"x":200,"y":240,"wires":[["160381b2.1a63fe"]]},{"id":"160381b2.1a63fe","type":"node-airtable","z":"8342788e.337c18","name":"Get User","auth":"a65faee5.5fdcc","table":"user","tableType":"str","action":"list","filter":"payload.filter","filterType":"msg","record":"payload","recordType":"msg","records":"","recordsType":"msg","output":"payload.result","x":380,"y":240,"wires":[["ff026359.c6b57"],[]]},{"id":"ff026359.c6b57","type":"function","z":"8342788e.337c18","name":"Get Or Add New USer","func":"result = msg.payload.result;\ndelete msg.payload.filter;\ndelete msg.payload.result;\nif(JSON.stringify(result) === '{}'){\n msg.payload.user = {\n \"user_id\": msg.payload.userId.toString(),\n \"chat_id\": msg.payload.chatId.toString(),\n \"user_name\": msg.payload.username,\n \"notification\" : true,\n \"status\" : \"pending\"\n };\n return [msg ,null]\n}else{\n msg.payload.user = result[0];\n msg.payload.user.newUser = false;\n return [null,msg];\n}\nreturn;","outputs":2,"noerr":0,"x":580,"y":200,"wires":[["1de7a7ea.ae7bc8"],[]]},{"id":"1de7a7ea.ae7bc8","type":"node-airtable","z":"8342788e.337c18","name":"Add user to airtable","auth":"a65faee5.5fdcc","table":"user","tableType":"str","action":"post","filter":"","filterType":"msg","record":"payload.user","recordType":"msg","records":"","recordsType":"msg","output":"payload.user","x":810,"y":180,"wires":[["e394da02.ff4aa8"],[]]},{"id":"e394da02.ff4aa8","type":"change","z":"8342788e.337c18","name":"","rules":[{"t":"set","p":"payload.user.newUser","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":850,"y":120,"wires":[[]]},{"id":"5e9abd42.74e494","type":"comment","z":"507c6c45.0c62b4","name":"Step I: Onboarding","info":"","x":210,"y":240,"wires":[]},{"id":"c7c2caf5.d22378","type":"change","z":"507c6c45.0c62b4","name":"","rules":[{"t":"set","p":"payload.username","pt":"msg","to":"originalMessage.from.username","tot":"msg"},{"t":"set","p":"payload.network","pt":"msg","to":"network","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":840,"y":320,"wires":[["d0e06493.9fdf08"]]},{"id":"d0e06493.9fdf08","type":"subflow:8342788e.337c18","z":"507c6c45.0c62b4","name":"","env":[],"x":1130,"y":320,"wires":[["5b05260d.3b9808"],["81c2f52e.3eded8"]]},{"id":"81c2f52e.3eded8","type":"debug","z":"507c6c45.0c62b4","name":"InitUser: Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1160,"y":380,"wires":[]},{"id":"ddfe2b19.db25f8","type":"switch","z":"507c6c45.0c62b4","name":"","property":"payload.user.newUser","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1930,"y":320,"wires":[["7496c0b5.ed054"],["7496c0b5.ed054"]]},{"id":"30eb70da.7e161","type":"debug","z":"507c6c45.0c62b4","name":"Telegram Input Node","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":240,"y":320,"wires":[]},{"id":"fde38021.ef774","type":"link in","z":"32ecfd36.7ca7a2","name":"In: Sender Node","links":["7aed3dae.199544","82d39ccd.0eb9f","6894eeb4.56963","9e23aec9.8544b","dd9fe108.b255","6e787929.7ed6f8","2d8bbaae.ef3226","d8c74207.5e5c3","432016bc.94dcb8","be1f8e11.415f2","7fa98952.0a9f38","3933dd8.d824a22","eb03d39a.ec957","f51749be.e1b438","6de8a88d.3084e8","bcd877a4.8442a8","869522dc.15bd3","32596b5c.aff244","a0a5c983.918c88","1105712d.44886f","aaf52b6d.7f3658","a0e315c3.b7d328","7bd81e81.8176f","23ec474a.6746b8","92a7a9a7.8a05b8","2f85b7bb.ebf388","3a60333d.2ed34c","1744769c.142559","865fd3e7.03b5f","726b9915.74b5b8","df729b66.fde978","3c9ebcf.ff09044","e77262c.cf39ea","358d45ec.35b18a","325bb1a2.1c3a6e","dd2830f8.95373","18844b76.a630c5","6e9e625b.c25bec","bbddc5.083b8238","16d91417.8f03cc","3146ec66.0a90e4","d60a6582.9a9e08","fa77d43a.7be4b8","825ac95c.cc82f8","7a6da5ad.ef573c","1059e118.552a9f","1747acdf.bdd363","694c5be4.b4bef4","f9b94395.38632","193b0fd5.ae59d","8944325b.d33b3","7d75e50.dd51e1c","3388ef84.f6179","10c58843.6dbef8","2d6694fd.3d379c","a1623a23.c38318","6869ebec.bd8624","b8b57679.dc1358","d3f97206.77163","c467075e.920658","467986a4.897678","e6105c8c.14dd1","ebba952a.1cf1f8","61a58c0d.2d4514","40f930c0.b7a4b","389135e5.f949aa","dda3200.9d646e","5343610c.af817","2482b8b1.8a6118","b08fff88.4d213","9c428c36.194d4","2122ca1f.230036"],"x":215,"y":260,"wires":[["f4fc440a.830a18"]]},{"id":"515edb39.5b3c14","type":"debug","z":"32ecfd36.7ca7a2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":625,"y":260,"wires":[]},{"id":"caa162cc.6e3dd","type":"change","z":"32ecfd36.7ca7a2","name":"","rules":[{"t":"set","p":"payload.type","pt":"msg","to":"action","tot":"str"},{"t":"set","p":"payload.content","pt":"msg","to":"typing","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":380,"wires":[["d059ff44.169fd"]]},{"id":"54eb3296.c8abac","type":"link in","z":"32ecfd36.7ca7a2","name":"In: Typing","links":["21a1c78a.46f468","fa862f71.d969a","1c88f636.201aba","10b9e7e7.b6c948","d53b167a.063018","ed2fe047.7144f","ae2dc658.b7dfa8","e8aacc02.15472","325386ea.770c0a","eb1ee663.e46508","6987fb62.2c66e4","e84c85ba.26e978","555aff62.4318a"],"x":215,"y":380,"wires":[["caa162cc.6e3dd"]]},{"id":"7496c0b5.ed054","type":"link out","z":"507c6c45.0c62b4","name":"Out: RUE","links":["68616b59.a5b004"],"x":2075,"y":320,"wires":[]},{"id":"8556ff4a.d0e39","type":"chatbot-telegram-receive","z":"507c6c45.0c62b4","bot":"784f1d9a.2a3ad4","botProduction":"","x":210,"y":380,"wires":[["30eb70da.7e161","beb55e34.f3bc7"]]},{"id":"f4fc440a.830a18","type":"chatbot-telegram-send","z":"32ecfd36.7ca7a2","bot":"784f1d9a.2a3ad4","botProduction":"","track":false,"passThrough":false,"outputs":0,"x":390,"y":260,"wires":[]},{"id":"d059ff44.169fd","type":"chatbot-telegram-send","z":"32ecfd36.7ca7a2","bot":"784f1d9a.2a3ad4","botProduction":"","track":false,"passThrough":false,"outputs":0,"x":610,"y":380,"wires":[]},{"id":"4370e2d0.6726dc","type":"function","z":"eb348c5b.99945","name":"Events from abi","func":"ethers = global.get('ethers');\niface = new ethers.utils.Interface (msg.payload.abi);\n\nevents = [];\n\nfor (const [key, value] of Object.entries(iface.events)) {\n if (events.includes(value.name) === false) {\n events.push(value.name);\n }\n // events.push({\n // key\n // \"name\" : value.name\n // })\n}\n\nmsg.payload.events = events;\nreturn msg;","outputs":1,"noerr":0,"x":580,"y":280,"wires":[[]]},{"id":"3924fd54.e22db2","type":"function","z":"7e9a59cc.c495e8","name":"Contract Event Listener","func":"ethers = global.get('ethers');\nlet provider = ethers.getDefaultProvider(msg.payload.network);\nlet utils = ethers.utils;\n\nvar ContractAddress = msg.payload.address;\n\nlet abi = msg.payload.abi\n\nlet contract = new ethers.Contract(ContractAddress, abi, provider);\n\n// contract.on('CastVote', (event) => {\n// msg.payload.CastVote = event;\n// node.send(msg);\n// });\n\n// contract.on('CastVote', (parm1 , address, bool, uint256, event) => {\n// msg.payload.CastVote = event;\n// msg.payload.parm1 = parm1;\n// msg.payload.address = address;\n// msg.payload.bool = bool;\n// msg.payload.uint256 = uint256;\n// node.send(msg);\n// });\n\n// contract.on('CastVote', (parm1 , address, bool, uint256, event) => {\n// msg.payload.CastVote = event;\n// msg.payload.parm1 = parm1;\n// msg.payload.address = address;\n// msg.payload.bool = bool;\n// msg.payload.uint256 = uint256;\n// node.send(msg);\n// });\n\nif(msg.payload.eventName === undefined || msg.payload.eventName === 'all'){\n contract.on({\n address: msg.payload.address,\n }, (...args) => {\n msg.payload.event = args;\n node.send(msg);\n });\n}else {\n contract.on(msg.payload.eventName, (...args) => {\n msg.payload.event = args;\n node.send(msg);\n });\n}\n\n\n\n// contract.on('StartVote', (event) => {\n// msg.payload.StartVote = event;\n// node.send(msg);\n// });\n\n// contract.on('ExecuteVote', (event) => {\n// msg.payload.ExecuteVote = event;\n// node.send(msg);\n// });\n\n// contract.on(filter1, (event) => {\n// msg.payload.contractEvent = event;\n// node.send(msg);\n// });","outputs":1,"noerr":0,"x":390,"y":280,"wires":[[]]},{"id":"53be3054.8067a","type":"chatbot-telegram-send","z":"2d0ecfb0.969f6","bot":"784f1d9a.2a3ad4","botProduction":"","track":true,"passThrough":false,"outputs":1,"x":370,"y":280,"wires":[["531d1273.bcb73c"]]},{"id":"531d1273.bcb73c","type":"subflow:8342788e.337c18","z":"2d0ecfb0.969f6","name":"","env":[],"x":590,"y":280,"wires":[[],[]]},{"id":"c452a18a.1eb53","type":"function","z":"507c6c45.0c62b4","name":"User Cache","func":"cache = global.get(msg.payload.user.fields.user_id);\nif(cache === undefined){\n cache = {};\n global.set(msg.payload.user.fields.user_id, cache);\n}\nreturn msg;","outputs":1,"noerr":0,"x":1530,"y":340,"wires":[["33cf86b0.4adf3a"]]},{"id":"d9c49e9d.3d094","type":"http request","z":"5c764a0d.f85564","name":"","method":"GET","ret":"txt","paytoqs":true,"url":"https://api.telegram.org/bot958026503:AAFsjXW-9cE7wDdOKk4MfY2Fu6DrUhQ-NWo/deleteMessage","tls":"","persist":false,"proxy":"","authType":"","x":510,"y":120,"wires":[[]]},{"id":"bdb47d40.86e4d","type":"function","z":"5c764a0d.f85564","name":"","func":"//message_id = msg.originalMessage.message_id;\nmessage_id = msg.payload.message_id;\nchat_id = msg.payload.chatId;\nmsg.payload = {\n chat_id,\n message_id\n};\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":120,"wires":[["d9c49e9d.3d094"]]},{"id":"33cf86b0.4adf3a","type":"switch","z":"507c6c45.0c62b4","name":"","property":"originalMessage.chat.type","propertyType":"msg","rules":[{"t":"eq","v":"private","vt":"str"},{"t":"eq","v":"supergroup","vt":"str"},{"t":"eq","v":"group","vt":"str"},{"t":"eq","v":"otherwise","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":1750,"y":340,"wires":[["ddfe2b19.db25f8"],["af086043.38b0d"],["af086043.38b0d"],[]]},{"id":"af086043.38b0d","type":"debug","z":"507c6c45.0c62b4","name":"Supergroup/Group","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1970,"y":380,"wires":[]},{"id":"87294638.56b3d8","type":"function","z":"c67eccc4.042ec","name":"SDK v2 Helper","func":"\n// create sdk\nfetch = global.get('fetch');\nWebSocket = global.get('ws');\nabridged = global.get(\"abridged\");\n\nNotificationTypes = abridged.NotificationTypes;\nconst {privateKey, address, action, debug, recipient, value, data, authKey } = msg.payload.sdkPayload;\n\nlet sdk;\nlet account;\nif(debug)\n node.warn({\"Network\" : msg.payload.network});\ntry{\nif(msg.payload.network === 'mainnet'){\n sdk = abridged.createSdk({\n authKeyModule: {\n privateKey\n },\n queryProviderEndpoint: msg.payload.sdkPayload.queryProviderEndPoint,\n fetch,\n WebSocket\n })\n}else{\n sdk = abridged.createKovanSdk({\n authKeyModule: {\n privateKey\n },\n queryProviderEndpoint: msg.payload.sdkPayload.queryProviderEndPoint,\n fetch,\n WebSocket\n })\n}\n}catch(error){\n msg.payload.sdkPayload.done = true;\n msg.payload.sdkPayload.error = error;\n node.send(msg,false);\n node.done();\n return;\n}\n\nmsg.payload.sdkPayload.gaurdianKey = sdk.state$.authKey$.address$._value;\n// connect sdk\nasync function createOrConnectAccount (){\n try{\n account = await sdk.createAccount(address);\n msg.payload.sdkPayload.account = account;\n }catch(error){\n \n }\n if(debug)\n node.warn(msg);\n}\n\nasync function batchExecute() {\n const options = {\n recipient: recipient,\n value: value,\n data: data,\n };\n\n try{\n let batch = await sdk.batchExecuteAccountTransaction(options);\n msg.payload.sdkPayload.batchExecute = batch;\n if(debug)\n node.warn(msg);\n }catch(error){\n msg.payload.sdkPayload.batchExecuteError = error;\n throw error;\n }\n}\n\nasync function setAuthKey () {\n output = await sdk.batchSetAccountAuthKey({\n authKey: authKey,\n type: \"Owner\"\n })\n msg.payload.sdkPayload.authKeyOutput = output;\n if(debug)\n node.warn(msg);\n}\n\nasync function estimateBatch() {\n const refundToken = {}; // optional\n try{\n let batch = await sdk.estimateBatch(refundToken);\n msg.payload.sdkPayload.estimateBatch = batch;\n if(debug)\n node.warn(msg);\n }catch(error){\n msg.payload.sdkPayload.estimateBatchError = error;\n throw error;\n }\n}\n\nasync function submitBatch() {\n const gasPrice = null; // optional\n let key;\n try{\n key = await sdk.submitBatch(gasPrice)\n msg.payload.sdkPayload.submitBatchKey = key;\n if(debug)\n node.warn(msg);\n }catch(error){\n msg.payload.sdkPayload.submitBatchError = error;\n throw error;\n }\n \n const subscribtion = sdk\n .state$\n .notification$\n .subscribe(notification => {\n if (notification === null) {\n // msg.payload.tempError = 'notification is null';\n // node.send(msg,false);\n }else{\n if (notification.type === NotificationTypes.RelayedTransactionUpdated && notification.payload.state === 'Sending') {\n // if (notification.type === NotificationTypes.RelayedTransactionUpdated && notification.payload.state === 'Sent') {\n msg.payload.sdkPayload.notification = notification.payload;\n msg.payload.sdkPayload.done = true;\n node.send(msg);\n node.done();\n // resolve(notification.payload.hash);\n subscribtion.unsubscribe();\n return;\n }\n }\n });\n}\n\nasync function resetSdk() {\n await sdk.resetAccount();\n}\n\nasync function process() {\n await createOrConnectAccount();\n if(action === \"SDK_ACTION_SET_AUTH_KEY\"){\n try{\n await setAuthKey(); \n await estimateBatch();\n await submitBatch();\n }catch(error){\n msg.payload.sdkPayload.done = true;\n node.send(msg,false);\n node.done();\n await sdk.resetBatch();\n }\n } else if(action === \"SDK_ACTION_EXECUTE_TRX\"){\n try{\n await sdk.resetBatch();\n await batchExecute();\n await estimateBatch();\n await submitBatch();\n }catch(error){\n msg.payload.sdkPayload.done = true;\n msg.payload.sdkPayload.error = error;\n node.send(msg,false);\n node.done();\n await sdk.resetBatch();\n }\n }else {\n await resetSdk();\n msg.payload.sdkPayload.done = true;\n node.send(msg,false);\n node.done();\n } \n}\n\nprocess();","outputs":1,"noerr":0,"x":480,"y":140,"wires":[[]]},{"id":"e31bf996.927ba8","type":"switch","z":"2d3e2335.2a164c","name":"","property":"payload.user.fields.account","propertyType":"msg","rules":[{"t":"istype","v":"undefined","vt":"undefined"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":690,"y":520,"wires":[["986877f9.1d8c78"],["94970e5.6c3caf"]]},{"id":"986877f9.1d8c78","type":"function","z":"2d3e2335.2a164c","name":"Create and attach abridged wallet","func":"ethers = global.get('ethers');\n\nlet wallet = ethers.Wallet.createRandom();\nmsg.payload.privateKey = wallet.privateKey;\nreturn msg;","outputs":1,"noerr":0,"x":980,"y":500,"wires":[["ac6aa31a.8385d"]]},{"id":"94970e5.6c3caf","type":"node-airtable","z":"2d3e2335.2a164c","name":"Get Account","auth":"a65faee5.5fdcc","table":"accounts","tableType":"str","action":"get","filter":"","filterType":"msg","record":"payload.user.fields.account[0]","recordType":"msg","records":"payload.payload","recordsType":"msg","output":"payload.user.account","x":910,"y":560,"wires":[["28343b73.02b5b4","905fe9f2.36f8d8"],[]]},{"id":"28343b73.02b5b4","type":"debug","z":"2d3e2335.2a164c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1050,"y":600,"wires":[]},{"id":"ac6aa31a.8385d","type":"change","z":"2d3e2335.2a164c","name":"","rules":[{"t":"set","p":"payload.network","pt":"msg","to":"network","tot":"global"},{"t":"set","p":"payload.sdkPayload.queryProviderEndPoint","pt":"msg","to":"queryProviderEndPoint","tot":"global"},{"t":"set","p":"payload.sdkPayload.privateKey","pt":"msg","to":"payload.privateKey","tot":"msg"},{"t":"set","p":"msg.payload.sdkPayload.debug","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1270,"y":500,"wires":[["6ff219d7.e99558"]]},{"id":"6ff219d7.e99558","type":"subflow:c67eccc4.042ec","z":"2d3e2335.2a164c","name":"","env":[],"x":1510,"y":500,"wires":[["2ed3a1ba.cd163e","2c0d07b4.9d29c8"]]},{"id":"4e8ce51a.d9ef1c","type":"function","z":"2d3e2335.2a164c","name":"Create new acccount entry","func":"\nif(msg.payload.encryptedData === undefined){\n return [null, msg]\n}\n// \"pk\": msg.payload.sdkPayload.privateKey,\n// \"pk\": msg.payload.encryptedData,\nmsg.payload.payload = \n{\n \"user_id\" : msg.payload.user.fields.user_id,\n \"guardian_key\": msg.payload.sdkPayload.gaurdianKey,\n \"account_address\": msg.payload.sdkPayload.account.address,\n \"pk\": msg.payload.encryptedData,\n \"external_deposit_address\": msg.payload.sdkPayload.account.externalDepositAddress,\n \"wallet_type\" : \"abridged\"\n\n}\n\nreturn [ msg, null ];","outputs":2,"noerr":0,"x":1780,"y":560,"wires":[["a9625510.901088"],["67fb087d.d9f7e8"]]},{"id":"a9625510.901088","type":"node-airtable","z":"2d3e2335.2a164c","name":"New Account","auth":"a65faee5.5fdcc","table":"accounts","tableType":"str","action":"post","filter":"","filterType":"msg","record":"payload.payload","recordType":"msg","records":"payload.payload","recordsType":"msg","output":"payload.account","x":2060,"y":560,"wires":[["de3bcf.6111f43"],[]]},{"id":"de3bcf.6111f43","type":"change","z":"2d3e2335.2a164c","name":"","rules":[{"t":"delete","p":"payload.payload","pt":"msg"},{"t":"delete","p":"payload.sdkPayload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2250,"y":500,"wires":[["af48bc0e.39c35"]]},{"id":"af48bc0e.39c35","type":"function","z":"2d3e2335.2a164c","name":"Update User","func":"\nmsg.payload.payload = [\n {\n \"id\": msg.payload.user.id,\n \"fields\": {\n \"account\":[msg.payload.account.id]\n }\n }\n]\nreturn msg;","outputs":1,"noerr":0,"x":2450,"y":500,"wires":[["12e0317b.dae27f"]]},{"id":"12e0317b.dae27f","type":"node-airtable","z":"2d3e2335.2a164c","name":"Update User","auth":"a65faee5.5fdcc","table":"user","tableType":"str","action":"put","filter":"","filterType":"msg","record":"payload.user","recordType":"msg","records":"payload.payload","recordsType":"msg","output":"payload.record","x":2660,"y":500,"wires":[["296c9b2a.5f2474"],[]]},{"id":"296c9b2a.5f2474","type":"change","z":"2d3e2335.2a164c","name":"","rules":[{"t":"set","p":"payload.record[0]","pt":"msg","to":"payload.user","tot":"msg"},{"t":"move","p":"payload.account","pt":"msg","to":"payload.user.account","tot":"msg"},{"t":"delete","p":"payload.record","pt":"msg"},{"t":"delete","p":"payload.payload","pt":"msg"},{"t":"delete","p":"payload.privateKey","pt":"msg"},{"t":"delete","p":"payload.filterBy","pt":"msg"},{"t":"delete","p":"payload.content","pt":"msg"},{"t":"delete","p":"payload.tableName","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2850,"y":500,"wires":[["41d0eaf5.76e9e4","c63d2827.820d68"]]},{"id":"41d0eaf5.76e9e4","type":"debug","z":"2d3e2335.2a164c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":2720,"y":140,"wires":[]},{"id":"905fe9f2.36f8d8","type":"link out","z":"2d3e2335.2a164c","name":"","links":["1be09419.82373c"],"x":1295,"y":560,"wires":[]},{"id":"e2fede67.006c2","type":"function","z":"9e5e594a.494868","name":"Get ERC 20 Token Balance","func":"ethers = global.get('ethers');\nlet provider = ethers.getDefaultProvider(msg.payload.network);\nlet contract = new ethers.Contract(msg.payload.address_contract, msg.payload.abi, provider);\n\nasync function getBalance () {\n try{\n const balance = await contract.balanceOf(msg.payload.address);\n msg.payload.tokenBalance = ethers.utils.formatEther(balance);\n }catch(error){\n msg.payload.error = error;\n }\n node.send(msg);\n node.done();\n}\n\ngetBalance();\nreturn;","outputs":1,"noerr":0,"x":560,"y":300,"wires":[[]]},{"id":"f991b316.67ea2","type":"function","z":"9b059efc.f650b","name":"Get Eth Bal","func":"fetch = global.get('fetch');\nethers = global.get('ethers');\npostData = {\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_getBalance\",\n \"params\": [\n msg.payload.address,\n \"latest\"\n ],\n \"id\": 1\n}\n\nasync function getBalance(url = '', data = {}) {\n // Default options are marked with *\n const response = await fetch(url, {\n method: 'POST', // *GET, POST, PUT, DELETE, etc.\n body: JSON.stringify(data) // body data type must match \"Content-Type\" header\n });\n return await response.json(); // parses JSON response into native JavaScript objects\n}\n\ngetBalance(msg.payload.queryProviderEndPoint, postData)\n .then((data) => {\n msg.payload.balance = ethers.utils.formatEther(data.result);\n node.send(msg);\n node.done();\n });\n ","outputs":1,"noerr":0,"x":550,"y":220,"wires":[[]]},{"id":"48c3e0a8.103cd","type":"debug","z":"9b059efc.f650b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":490,"y":300,"wires":[]},{"id":"a438882b.30cdb8","type":"change","z":"e730b986.339628","name":"","rules":[{"t":"set","p":"payload.network","pt":"msg","to":"netwrok","tot":"global"},{"t":"set","p":"payload.queryProviderEndPoint","pt":"msg","to":"queryProviderEndPoint","tot":"global"},{"t":"set","p":"payload.address","pt":"msg","to":"payload.user.account.fields.account_address","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":200,"y":140,"wires":[["9c127ae2.36b5f8"]]},{"id":"9c127ae2.36b5f8","type":"subflow:9b059efc.f650b","z":"e730b986.339628","name":"","env":[],"x":440,"y":140,"wires":[["480bb8e0.faa078"]]},{"id":"480bb8e0.faa078","type":"change","z":"e730b986.339628","name":"","rules":[{"t":"set","p":"payload.address_contract","pt":"msg","to":"address_c19_token","tot":"global"},{"t":"set","p":"payload.abi","pt":"msg","to":"abi_erc20","tot":"global"},{"t":"set","p":"payload.network","pt":"msg","to":"network","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":140,"wires":[["ad9aeaf3.58eae8"]]},{"id":"ad9aeaf3.58eae8","type":"subflow:9e5e594a.494868","z":"e730b986.339628","name":"","env":[],"x":900,"y":140,"wires":[[]]},{"id":"5e1e1577.c04cec","type":"debug","z":"e730b986.339628","name":"User and group details","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":900,"y":200,"wires":[]},{"id":"26567e4.c15df82","type":"debug","z":"e730b986.339628","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":930,"y":80,"wires":[]},{"id":"513f0e1b.37665","type":"debug","z":"e730b986.339628","name":"Input: ETH and Token Balance","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":230,"y":80,"wires":[]},{"id":"16cec28c.1236cd","type":"function","z":"48d0467c.b38be8","name":"Encode Data","func":"ethers = global.get('ethers');\nlet iface = new ethers.utils.Interface(msg.payload.config.abi);\nlet encodedData = iface.functions[msg.payload.config.apiCall].encode(msg.payload.config.args);\nmsg.payload.config.encodedData = encodedData;\nreturn msg;\n","outputs":1,"noerr":0,"x":570,"y":240,"wires":[[]]},{"id":"79b2bc7d.0cf364","type":"link in","z":"2d3e2335.2a164c","name":"In: Init Account","links":["cd0fb71a.c0a348","9f806a6c.2c24b8"],"x":495,"y":520,"wires":[["e31bf996.927ba8"]]},{"id":"12045afb.de22f5","type":"function","z":"2d3e2335.2a164c","name":"Purchase Eth","func":"if(msg.payload.balance === undefined)\n msg.payload.balance = 0;\nwyreLink = global.get('wyre_link');\nwyreLink = `${wyreLink}?destCurrency=ETH&dest=${msg.payload.user.account.fields.account_address}&accountId=AC_8MAWQ88LVEA`\n// wyreLink = `${wyreLink}?destCurrency=ETH&dest=${msg.payload.user.account.fields.account_address}`\n\nbuttons = [];\n\nverificationUrl = `${global.get('web_wallet_url')}&id=${msg.payload.user.id}`\nabridgedWalletUrl = `${global.get('react_server_url')}/init?id=${msg.payload.user.id}&url=${global.get('node_red_server_url')}`\n\nbuttons.push(button = {\n\t\"type\": \"url\",\n\t\"label\": \"Wyre\",\n\t\"url\": wyreLink,\n\t\"alert\": false,\n\t\"style\": \"\"\n}, {\n\t\t\"type\": \"newline\"\n\t}, {\n\t\"type\": \"postback\",\n\t\"label\": \"Menu\",\n\t\"value\": \"/cancel\",\n\t\"answer\": \"\",\n\t\"alert\": false,\n\t\"style\": \"\"} )\n\nmsg.payload.type = \"inline-buttons\";\ntokenBalance = msg.payload.tokenBalance === undefined ? 0 : msg.payload.tokenBalance;\n\n\nmsg.payload.content = `\nETH Acquisition: \n1 Send ETH to your address below\n2 Purchase via debit card using the Wyre button \n\nYou will receive a notification when the transaction completes (typically 5 mins, can take longer).\n\nIf you need C19, make sure you've donated to the relief fund!\n♢ETH balance: ${msg.payload.balance}\n🔆C19 Token balance: ${tokenBalance}\nAccount address: ${msg.payload.user.account.fields.account_address}\n`;\n\nmsg.payload.buttons = buttons;\n\nreturn msg;","outputs":1,"noerr":0,"x":530,"y":1580,"wires":[["5abcedd.348f314","7812190c.d00c78","94da2bed.4f5078"]]},{"id":"5abcedd.348f314","type":"chatbot-telegram-send","z":"2d3e2335.2a164c","bot":"784f1d9a.2a3ad4","botProduction":"","track":false,"passThrough":false,"outputs":0,"x":770,"y":1620,"wires":[]},{"id":"1be09419.82373c","type":"link in","z":"2d3e2335.2a164c","name":"In: Wyre Flow","links":["c5a08f5c.7e75d","327ad4c1.46f64c","7a4f8493.68122c","a5c323af.9155f","2223c177.aa7eae","ddda7c67.885fd","d587bde9.e22eb","f94b0f2b.7b6a8","905fe9f2.36f8d8","4e8c11ae.a4bb1"],"x":135,"y":1580,"wires":[["644c28f4.aaadf8","64c73837.72aee8"]]},{"id":"644c28f4.aaadf8","type":"chatbot-conversation","z":"2d3e2335.2a164c","name":"","botDevelopment":"24145e37.52cb02","botProduction":"","chatId":"1111","userId":"","transport":"telegram","store":"","x":310,"y":1580,"wires":[["12045afb.de22f5"]]},{"id":"64c73837.72aee8","type":"debug","z":"2d3e2335.2a164c","name":"Start Wyre Flow","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":300,"y":1540,"wires":[]},{"id":"3a15607.50ebda","type":"simple-queue","z":"2d3e2335.2a164c","name":"Balance Queue","firstMessageBypass":true,"bypassInterval":"1000","x":1180,"y":1680,"wires":[["2a0af4fb.096c2c"]]},{"id":"689caa20.8d5284","type":"inject","z":"2d3e2335.2a164c","name":"","topic":"","payload":"","payloadType":"date","repeat":"3","crontab":"","once":true,"onceDelay":"5","x":750,"y":1680,"wires":[["2a610a83.8f2526"]]},{"id":"2a610a83.8f2526","type":"change","z":"2d3e2335.2a164c","name":"","rules":[{"t":"set","p":"trigger","pt":"msg","to":"1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":960,"y":1680,"wires":[["3a15607.50ebda"]]},{"id":"7d726e7f.a26cb","type":"subflow:9b059efc.f650b","z":"2d3e2335.2a164c","name":"","env":[],"x":1620,"y":1680,"wires":[["fc43f756.7a48c8"]]},{"id":"2a0af4fb.096c2c","type":"change","z":"2d3e2335.2a164c","name":"","rules":[{"t":"set","p":"payload.network","pt":"msg","to":"netwrok","tot":"global"},{"t":"set","p":"payload.queryProviderEndPoint","pt":"msg","to":"queryProviderEndPoint","tot":"global"},{"t":"set","p":"payload.chatId","pt":"msg","to":"payload.user.fields.dm_id","tot":"msg"},{"t":"set","p":"payload.groupId","pt":"msg","to":"msg.payload.user.fields.group_id[0]","tot":"msg"},{"t":"set","p":"payload.address","pt":"msg","to":"payload.user.account.fields.account_address","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1400,"y":1680,"wires":[["7d726e7f.a26cb"]]},{"id":"fc43f756.7a48c8","type":"switch","z":"2d3e2335.2a164c","name":"","property":"payload.balance","propertyType":"msg","rules":[{"t":"lte","v":"payload.oldBalance","vt":"msg"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":1830,"y":1680,"wires":[["69dcb34f.5b930c"],["5ba779a9.90b5f8","42d6981f.cd6fd8"]]},{"id":"fe820651.985bb8","type":"debug","z":"2d3e2335.2a164c","name":"Listener Terminated","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":2210,"y":1620,"wires":[]},{"id":"1d608e40.259c32","type":"debug","z":"2d3e2335.2a164c","name":"Balance Listener","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1710,"y":1720,"wires":[]},{"id":"92b19ee3.141d5","type":"delay","z":"2d3e2335.2a164c","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1480,"y":1620,"wires":[["3a15607.50ebda"]]},{"id":"5ba779a9.90b5f8","type":"chatbot-conversation","z":"2d3e2335.2a164c","name":"","botDevelopment":"24145e37.52cb02","botProduction":"","chatId":"1111","userId":"","transport":"telegram","store":"","x":2090,"y":1720,"wires":[["a59110d9.6995"]]},{"id":"a59110d9.6995","type":"function","z":"2d3e2335.2a164c","name":"Deposit Success","func":"msg.payload.chatId = msg.payload.user.fields.chat_id;\nbuttons = [];\n\nbuttons.push(button = {\n\t\"type\": \"postback\",\n\t\"label\": `Account`,\n\t\"value\": `/account`,\n\t\"style\": \"\"\n});\n\nbuttons.push(button = {\n\t\"type\": \"postback\",\n\t\"label\": `Menu`,\n\t\"value\": `/menu`,\n\t\"style\": \"\"\n});\n\nmsg.payload.type = \"inline-buttons\";\nmsg.payload.content = `Success!!!\nETH balance: ${msg.payload.balance}\nC19 Token balance: ${msg.payload.tokenBalance}\n`;\nmsg.payload.buttons = buttons;\n\nreturn msg;","outputs":1,"noerr":0,"x":2310,"y":1720,"wires":[["a1623a23.c38318"]]},{"id":"7812190c.d00c78","type":"debug","z":"2d3e2335.2a164c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":570,"y":1540,"wires":[]},{"id":"b6ac7ad6.a78f38","type":"comment","z":"2d3e2335.2a164c","name":"Wyre Flow","info":"","x":180,"y":1480,"wires":[]},{"id":"69dcb34f.5b930c","type":"function","z":"2d3e2335.2a164c","name":"","func":"let cacheBalanceListener = flow.get('cache_balance_listener');\nif(cacheBalanceListener === undefined){\n cacheBalanceListener = {}\n}\n\nlet count = cacheBalanceListener[msg.payload.userId.toString()] ;\nmsg.payload.count = count;\nif (isNaN(count))\n count = 0;\ncount++;\n// msg.payload.count = count\nif(count > 200){ // 800 secs\n return [null, msg]\n}\ncacheBalanceListener[msg.payload.userId.toString()] = count;\nflow.set('cache_balance_listener', cacheBalanceListener);\nreturn [ msg, null];","outputs":2,"noerr":0,"x":1950,"y":1620,"wires":[["92b19ee3.141d5"],["42d6981f.cd6fd8","fe820651.985bb8"]]},{"id":"bc45d4c6.aea018","type":"debug","z":"2d3e2335.2a164c","name":"Listening","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":2140,"y":1520,"wires":[]},{"id":"c63d2827.820d68","type":"chatbot-conversation","z":"2d3e2335.2a164c","name":"","botDevelopment":"24145e37.52cb02","botProduction":"","chatId":"1111","userId":"","transport":"telegram","store":"","x":2390,"y":580,"wires":[["4f9a486c.7578b8"]]},{"id":"4f9a486c.7578b8","type":"function","z":"2d3e2335.2a164c","name":"Welcome message","func":"\n\nmsg.payload.type = 'inline-buttons'\nmsg.payload.name = 'Main Menu'\nmsg.payload.content = '⛑️HI! Welcome to Collab19!\\n\\nI was created to help people organize resources in a novel way.\\n\\nThe Collab19 is a non-profit initiative specifically formed to grant funds to those most affected by COVid-19.\\n\\n'\nmsg.payload.buttons = [{\n\t\t\"type\": \"newline\"\n\t}, {\n\t\t\"type\": \"postback\",\n\t\t\"label\": \"Take me to the Menu\",\n\t\t\"value\": \"/menu\",\n\t\t\"answer\": \"\",\n\t\t\"alert\": false,\n\t\t\"style\": \"\"\n\t}, {\n\t\t\"type\": \"newline\"\n\t}, {\n\t\t\"type\": \"postback\",\n\t\t\"label\": \"How does this work? 🤔\",\n\t\t\"value\": \"/collabinfo\",\n\t\t\"answer\": \"\",\n\t\t\"alert\": false,\n\t\t\"style\": \"\"\n\t}]\n\t\nmsg.payload.chatId = msg.payload.user.fields.chat_id;\nreturn msg;\n\n\n// msg.payload.type = \"message\";\n// msg.payload.content = `\n// *UNDER ACTIVE DEVELOPMENT*\n\n// HI! Welcome to Collab19!\n\n// I was created to help people organize resources in a novel way. The Collab19 specifically formed to grant funds to those most affected by COVid-19.\n\n// Click the 'Learn More' button for more information, or continue to membership to participate. \n\n// Your account address is ${msg.payload.user.account.fields.account_address}\n\n// Please follow the Wyre button, or send $10-$20 (~0.05 ETH) to receive your C19 membership token and donate to the cause.\n// `;\n// return msg;","outputs":1,"noerr":0,"x":2610,"y":580,"wires":[["40f930c0.b7a4b"]]},{"id":"b3ea2274.e623d","type":"link in","z":"2d3e2335.2a164c","name":"In: Accounts","links":["28015b70.5ca024","a106f70c.6fd638","760f79e.bddf588"],"x":155,"y":1960,"wires":[["5ab4b9b2.8cc958"]]},{"id":"5ab4b9b2.8cc958","type":"switch","z":"2d3e2335.2a164c","name":"","property":"payload.user.fields.account","propertyType":"msg","rules":[{"t":"istype","v":"undefined","vt":"undefined"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":330,"y":1960,"wires":[["f515cfbd.3d637"],["71385f73.cbe49"]]},{"id":"71385f73.cbe49","type":"node-airtable","z":"2d3e2335.2a164c","name":"Get Account","auth":"a65faee5.5fdcc","table":"accounts","tableType":"str","action":"get","filter":"","filterType":"msg","record":"payload.user.fields.account[0]","recordType":"msg","records":"payload.payload","recordsType":"msg","output":"payload.user.account","x":410,"y":2020,"wires":[["eb107697.1c2738"],[]]},{"id":"f515cfbd.3d637","type":"chatbot-conversation","z":"2d3e2335.2a164c","name":"","botDevelopment":"24145e37.52cb02","botProduction":"","chatId":"1111","userId":"","transport":"telegram","store":"","x":585,"y":1920,"wires":[["d7b960a7.51ab2"]]},{"id":"d7b960a7.51ab2","type":"function","z":"2d3e2335.2a164c","name":"No associated account contract","func":"msg.payload.chatId = msg.payload.user.fields.chat_id;\n\nmsg.payload.type = \"message\";\nmsg.payload.content = `\nHey, you do not have associated contract account. May be you are using metamask.\n`;\nreturn msg;","outputs":1,"noerr":0,"x":845,"y":1920,"wires":[["1747acdf.bdd363"]]},{"id":"52eec2e1.320a6c","type":"subflow:e730b986.339628","z":"2d3e2335.2a164c","name":"","env":[],"x":830,"y":2000,"wires":[["4cb7c571.8eb35c","b4ffed7.88ea81"]]},{"id":"a634c847.201ca8","type":"function","z":"2d3e2335.2a164c","name":"Account Details","func":"\nbuttons = [];\n\n \nbuttons.push({\n\t\"type\": \"postback\",\n\t\"label\": \"⛑️Donate to the Relief Fund\",\n\t\"value\": `/donate`,\n\t\"alert\": false,\n\t\"style\": \"\"\n});\n\nbuttons.push({\n \"type\": \"newline\"\n});\n\nbuttons.push({\n\t\"type\": \"postback\",\n\t\"label\": \"Withdraw\",\n\t\"value\": `/transfereth`,\n\t\"alert\": false,\n\t\"style\": \"\"\n});\n\nbuttons.push({\n\t\"type\": \"postback\",\n\t\"label\": \"Deposit\",\n\t\"value\": `/addeth`,\n\t\"alert\": false,\n\t\"style\": \"\"\n});\n\n\nbuttons.push({\n\t \"type\": \"newline\"\n});\n\nbuttons.push({\n\t\"type\": \"postback\",\n\t\"label\": \"Menu\",\n\t\"value\": `/menu`,\n\t\"alert\": false,\n\t\"style\": \"\"\n});\n\t\nmsg.payload.type = \"inline-buttons\";\nmsg.payload.content = `Here is your account summary (reminder, this is on mainnet)\n\nIf you need a C19 token remember to donate to the relief fund!\n\n♢ETH balance: ${msg.payload.balance}\n🔆C19 Token: ${msg.payload.tokenBalance}\nAccount address: ${msg.payload.user.account.fields.account_address}\n\n`;\nmsg.payload.buttons = buttons;\nmsg.payload.chatId = msg.payload.user.fields.chat_id;\n\nreturn msg;","outputs":1,"noerr":0,"x":1280,"y":2000,"wires":[["1747acdf.bdd363"]]},{"id":"4cb7c571.8eb35c","type":"chatbot-conversation","z":"2d3e2335.2a164c","name":"","botDevelopment":"24145e37.52cb02","botProduction":"","chatId":"1111","userId":"","transport":"telegram","store":"","x":1070,"y":2000,"wires":[["a634c847.201ca8"]]},{"id":"8851c4c6.1d2778","type":"comment","z":"2d3e2335.2a164c","name":"Account Details","info":"","x":340,"y":1900,"wires":[]},{"id":"68616b59.a5b004","type":"link in","z":"2d3e2335.2a164c","name":"In: Contract Wallet","links":["5814e1d6.ca799","7496c0b5.ed054"],"x":135,"y":640,"wires":[["b3dc859e.4c84c8","ae2dc658.b7dfa8","7d11184f.f522d8"]]},{"id":"4f6fe15f.6f0da","type":"switch","z":"2d3e2335.2a164c","name":"","property":"payload.content","propertyType":"msg","rules":[{"t":"eq","v":"/account","vt":"str"},{"t":"eq","v":"/addeth","vt":"str"},{"t":"eq","v":"/addc19","vt":"str"},{"t":"eq","v":"nometamask","vt":"str"},{"t":"eq","v":"/swap","vt":"str"},{"t":"eq","v":"/swaptoeth","vt":"str"},{"t":"eq","v":"/transfereth","vt":"str"},{"t":"eq","v":"notification_off","vt":"str"},{"t":"eq","v":"notification_on","vt":"str"},{"t":"eq","v":"/donate","vt":"str"},{"t":"eq","v":"/signal","vt":"str"},{"t":"eq","v":"/fund","vt":"str"},{"t":"eq","v":"/membership","vt":"str"},{"t":"eq","v":"/learnsystem","vt":"str"},{"t":"eq","v":"/accountinfo","vt":"str"},{"t":"eq","v":"/proposalinfo","vt":"str"},{"t":"eq","v":"/socialinfo","vt":"str"},{"t":"eq","v":"/morecollabinfo","vt":"str"},{"t":"eq","v":"/learntech","vt":"str"},{"t":"eq","v":"/abridged","vt":"str"},{"t":"eq","v":"/aragon","vt":"str"},{"t":"eq","v":"/ethereum","vt":"str"},{"t":"eq","v":"/proposalmenu","vt":"str"},{"t":"istype","v":"json","vt":"json"},{"t":"eq","v":"/socialmenu","vt":"str"},{"t":"eq","v":"/savepk","vt":"str"},{"t":"eq","v":"/bank","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":28,"x":1190,"y":820,"wires":[["a106f70c.6fd638"],["ddda7c67.885fd"],["5c97f5d5.bb496c"],["9f806a6c.2c24b8"],["56a837d.c2d81c8"],["ce0a4397.8bb3a"],["b7ead684.4df4d8"],["672c03f6.be73ac"],["672c03f6.be73ac"],["4e61c052.b74e"],["4c49b385.500eec"],["9694a737.4e3408"],["b8c16c1e.080fb"],["26190053.7c715"],["69b29436.23876c"],["ee9cc6b0.7918b8"],["df1dd321.8da34"],["16e10b7b.833e65"],["b265e3f.f21fe2"],["f2dade09.4b8b6"],["d479e355.e7759"],["223c7555.ce457a"],["be4d7eb3.2fabd"],["71423983.aa0d28"],["15e12f8a.f9f8"],["9b30f1a4.55b89"],["2e6e6d5b.129ad2"],["248e95d0.0e491a","9dfd4554.3fc538"]]},{"id":"a106f70c.6fd638","type":"link out","z":"2d3e2335.2a164c","name":"","links":["b3ea2274.e623d"],"x":1335,"y":600,"wires":[]},{"id":"ddda7c67.885fd","type":"link out","z":"2d3e2335.2a164c","name":"","links":["1be09419.82373c"],"x":1375,"y":620,"wires":[]},{"id":"b3dc859e.4c84c8","type":"switch","z":"2d3e2335.2a164c","name":"","property":"payload.user.fields.account","propertyType":"msg","rules":[{"t":"istype","v":"undefined","vt":"undefined"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":390,"y":620,"wires":[["e31bf996.927ba8"],["31e7b813.2ae4d8"]]},{"id":"40ee465e.9022c8","type":"node-airtable","z":"2d3e2335.2a164c","name":"Get Account","auth":"a65faee5.5fdcc","table":"accounts","tableType":"str","action":"get","filter":"","filterType":"msg","record":"payload.user.fields.account[0]","recordType":"msg","records":"payload.payload","recordsType":"msg","output":"payload.user.account","x":710,"y":760,"wires":[["f6f2180b.8a5268"],[]]},{"id":"f6f2180b.8a5268","type":"subflow:e730b986.339628","z":"2d3e2335.2a164c","name":"","env":[],"x":810,"y":820,"wires":[["4f6fe15f.6f0da","de83564c.097c08","9f45b5b2.e08928"]]},{"id":"5c97f5d5.bb496c","type":"link out","z":"2d3e2335.2a164c","name":"","links":[],"x":1355,"y":660,"wires":[]},{"id":"9f806a6c.2c24b8","type":"link out","z":"2d3e2335.2a164c","name":"","links":["79b2bc7d.0cf364"],"x":1395,"y":680,"wires":[]},{"id":"248e95d0.0e491a","type":"debug","z":"2d3e2335.2a164c","name":"Contract Wallet: Unknown","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":920,"y":1000,"wires":[]},{"id":"56a837d.c2d81c8","type":"link out","z":"2d3e2335.2a164c","name":"","links":["da10593a.768f78","f73f0ebf.f1319"],"x":1355,"y":700,"wires":[]},{"id":"67c28c8c.e55304","type":"link in","z":"2d3e2335.2a164c","name":"","links":["9f45b5b2.e08928"],"x":895,"y":1500,"wires":[["94da2bed.4f5078"]]},{"id":"94da2bed.4f5078","type":"function","z":"2d3e2335.2a164c","name":"","func":"let cacheBalanceListener = flow.get('cache_balance_listener');\nif(cacheBalanceListener === undefined){\n cacheBalanceListener = {}\n}\n\nlet count = cacheBalanceListener[msg.payload.userId.toString()] ;\nif (count > 0){ // already listening just reset counter\n // delete cacheBalanceListener[msg.payload.userId.toString()];\n // flow.set('cache_balance_listener', cacheBalanceListener);\n return [msg, null];\n}\n\nmsg.payload.oldBalance = msg.payload.balance;\nreturn [null, msg]\n","outputs":2,"noerr":0,"x":990,"y":1580,"wires":[["d984b655.5f4c78"],["3a15607.50ebda","477007b8.fd5888"]]},{"id":"d984b655.5f4c78","type":"debug","z":"2d3e2335.2a164c","name":"Already Listening, Reset to 0","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1320,"y":1560,"wires":[]},{"id":"42d6981f.cd6fd8","type":"function","z":"2d3e2335.2a164c","name":"Clear Listener","func":"let cacheBalanceListener = flow.get('cache_balance_listener');\ndelete cacheBalanceListener[msg.payload.userId.toString()];\nflow.set('cache_balance_listener', cacheBalanceListener);\nreturn;","outputs":1,"noerr":0,"x":2200,"y":1660,"wires":[[]]},{"id":"477007b8.fd5888","type":"debug","z":"2d3e2335.2a164c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1210,"y":1600,"wires":[]},{"id":"ce0a4397.8bb3a","type":"link out","z":"2d3e2335.2a164c","name":"Out: Swap to ETH","links":["c0aaddf3.dab42","40e72ca2.411ea4","a58dedc6.70975"],"x":1395,"y":720,"wires":[]},{"id":"8f8d1a0e.5ea838","type":"link in","z":"3867c68b.1306da","name":"In: User Action","links":["1468912e.79ed0f","71423983.aa0d28","7352c0ad.79852"],"x":135,"y":480,"wires":[["2e54c0e0.791e8"]]},{"id":"2e54c0e0.791e8","type":"json","z":"3867c68b.1306da","name":"","property":"payload.content","action":"obj","pretty":false,"x":270,"y":480,"wires":[["d4c15458.c3d248","d7ed42ac.2b721"]]},{"id":"911dbc61.f74ee","type":"switch","z":"3867c68b.1306da","name":"","property":"payload.content.ac","propertyType":"msg","rules":[{"t":"eq","v":"vote_y","vt":"str"},{"t":"eq","v":"vote_n","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":665,"y":480,"wires":[["92a44b4.875e8b8"],["92a44b4.875e8b8"],["c1ff94fd.ab6fe8"]]},{"id":"c1ff94fd.ab6fe8","type":"debug","z":"3867c68b.1306da","name":"Unknown action","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":680,"y":540,"wires":[]},{"id":"92a44b4.875e8b8","type":"subflow:e730b986.339628","z":"3867c68b.1306da","name":"","env":[],"x":890,"y":480,"wires":[["1316af7a.fa53c1","8bb9c687.4d2b78"]]},{"id":"8bb9c687.4d2b78","type":"function","z":"3867c68b.1306da","name":"Vote on app","func":"ethers = global.get(\"ethers\");\n\nlet abi = global.get(\"abi_aragon_app_voting\");\n\nif(msg.payload.balance <= global.get('min_eth_for_gas_fee')){\n msg.payload.error = 'Please make sure to have enough ETH to pay for gas fee.';\n return [null, msg];\n}\n\nif(msg.payload.tokenBalance <= 0){\n msg.payload.error = 'Seems you dont have enough C19 token to vote.';\n return [null, msg];\n}\n\nvote = msg.payload.content.ac === 'vote_y' ? true : false\n\nmsg.payload.config = {\n \"recipient\" : global.get('address_c19_voting_app'), // address received from JY\n abi,\n \"apiCall\" : \"vote\",\n \"args\" : [parseInt(msg.payload.content.id), vote, true],\n \"value\" : \"0x0\"\n};\n\n\nreturn [ msg, null ];\n\n","outputs":2,"noerr":0,"x":1130,"y":480,"wires":[["92fa02aa.c83ac","71736622.0ba1e8"],["92fa02aa.c83ac","ea741ad1.e53ef8"]]},{"id":"ea741ad1.e53ef8","type":"function","z":"3867c68b.1306da","name":"","func":"msg.payload.chatId = msg.payload.user.fields.chat_id;\n\nmsg.payload.type = \"message\";\nmsg.payload.content = `${msg.payload.error}\n\n♢ETH balance: ${msg.payload.balance}\n🔆C19 Token balance: ${msg.payload.tokenBalance}\nAccount address: ${msg.payload.user.account.fields.account_address}\n`;\n\nreturn msg;","outputs":1,"noerr":0,"x":1190,"y":540,"wires":[["6869ebec.bd8624"]]},{"id":"71736622.0ba1e8","type":"subflow:48d0467c.b38be8","z":"3867c68b.1306da","name":"","env":[],"x":1370,"y":480,"wires":[["7ad11924.b33ae8","6987fb62.2c66e4","4f7fe652.5efe48"]]},{"id":"32b61554.2f925a","type":"change","z":"3867c68b.1306da","name":"","rules":[{"t":"set","p":"payload.sdkPayload.debug","pt":"msg","to":"true","tot":"bool"},{"t":"set","p":"payload.network","pt":"msg","to":"network","tot":"global"},{"t":"set","p":"payload.sdkPayload.address","pt":"msg","to":"payload.user.account.fields.account_address","tot":"msg"},{"t":"set","p":"payload.sdkPayload.privateKey","pt":"msg","to":"payload.user.account.fields.pk","tot":"msg"},{"t":"set","p":"payload.sdkPayload.action","pt":"msg","to":"SDK_ACTION_EXECUTE_TRX","tot":"global"},{"t":"set","p":"payload.sdkPayload.queryProviderEndPoint","pt":"msg","to":"queryProviderEndPoint","tot":"global"},{"t":"set","p":"payload.sdkPayload.value","pt":"msg","to":"payload.config.value","tot":"msg"},{"t":"set","p":"msg.payload.sdkPayload.recipient","pt":"msg","to":"payload.config.recipient","tot":"msg"},{"t":"set","p":"payload.sdkPayload.data","pt":"msg","to":"payload.config.encodedData","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1740,"y":480,"wires":[["908699a6.f70fd8"]]},{"id":"908699a6.f70fd8","type":"subflow:c67eccc4.042ec","z":"3867c68b.1306da","name":"","env":[],"x":1960,"y":480,"wires":[["6a9a1391.eb029c","726de740.44f6a8"]]},{"id":"6a9a1391.eb029c","type":"switch","z":"3867c68b.1306da","name":"","property":"payload.sdkPayload.done","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":1710,"y":520,"wires":[["825c78f0.fec328"]]},{"id":"825c78f0.fec328","type":"function","z":"3867c68b.1306da","name":"Voting Result","func":"msg.payload.chatId = msg.payload.user.fields.chat_id;\nvoteId = msg.payload.content.id;\n\nif(msg.payload.sdkPayload.error === undefined){\n \n buttons = [];\n buttons.push({\n \t\"type\": \"url\",\n \t\"label\": \"View Vote\",\n \t\"url\": `${global.get('c19_app_url')}/${global.get('address_c19_voting_app')}/vote/${voteId}`,\n \t\"alert\": false,\n \t\"style\": \"\"\n });\n \n buttons.push({\n \t\"type\": \"url\",\n \t\"label\": \"View Transaction\",\n \t\"url\": `${global.get('ether_scan_url')}/tx/${msg.payload.sdkPayload.notification.hash}`,\n \t\"alert\": false,\n \t\"style\": \"\"\n });\n \n buttons.push(button = {\n \t\"type\": \"newline\"\n });\n \n buttons.push(button = {\n \t\"type\": \"postback\",\n \t\"label\": `Menu`,\n \t\"value\": `/menu`,\n \t\"style\": \"\"\n }); \n \n msg.payload.type = \"inline-buttons\";\n msg.payload.content = `Thank you, your vote has been submitted.`;\n msg.payload.buttons = buttons;\n}else{\n msg.payload.type = \"message\";\n msg.payload.content = `${msg.payload.sdkPayload.error} `\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":1910,"y":520,"wires":[["c467075e.920658"]]},{"id":"7ad11924.b33ae8","type":"debug","z":"3867c68b.1306da","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1390,"y":440,"wires":[]},{"id":"d4c15458.c3d248","type":"debug","z":"3867c68b.1306da","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":290,"y":520,"wires":[]},{"id":"1316af7a.fa53c1","type":"debug","z":"3867c68b.1306da","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":870,"y":520,"wires":[]},{"id":"92fa02aa.c83ac","type":"debug","z":"3867c68b.1306da","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1170,"y":440,"wires":[]},{"id":"d7ed42ac.2b721","type":"node-airtable","z":"3867c68b.1306da","name":"Get Account","auth":"a65faee5.5fdcc","table":"accounts","tableType":"str","action":"get","filter":"","filterType":"msg","record":"payload.user.fields.account[0]","recordType":"msg","records":"payload.payload","recordsType":"msg","output":"payload.user.account","x":490,"y":480,"wires":[["911dbc61.f74ee","eb1ee663.e46508"],[]]},{"id":"d53f9120.7ca7a","type":"inject","z":"da8d4d9f.ceb7b","name":"","topic":"","payload":"{}","payloadType":"json","repeat":"","crontab":"","once":true,"onceDelay":"3","x":210,"y":300,"wires":[["6d0408e0.40b008","54d7669a.f30bd8"]]},{"id":"6d0408e0.40b008","type":"debug","z":"da8d4d9f.ceb7b","name":"Collab19: Listener Input Node","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":290,"y":260,"wires":[]},{"id":"29565323.b1d75c","type":"function","z":"da8d4d9f.ceb7b","name":"Contract Event Listener","func":"ethers = global.get('ethers');\nlet provider = ethers.getDefaultProvider(msg.payload.network);\nlet utils = ethers.utils;\n\nvar ContractAddress = msg.payload.address;\nlet abi = msg.payload.abi\nlet contract = new ethers.Contract(ContractAddress, abi, provider);\n\ncontract.on(msg.payload.eventName, (...args) => {\n msg.payload.event = args;\n node.send(msg);\n});","outputs":1,"noerr":0,"x":970,"y":280,"wires":[["3f61ff1.5f969","30a2c8ea.b0bf98"]]},{"id":"30a2c8ea.b0bf98","type":"debug","z":"da8d4d9f.ceb7b","name":"New Notification Event","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1020,"y":320,"wires":[]},{"id":"54d7669a.f30bd8","type":"change","z":"da8d4d9f.ceb7b","name":"","rules":[{"t":"set","p":"msg.payload.address","pt":"msg","to":"address_c19_voting_app","tot":"global"},{"t":"set","p":"msg.payload.network","pt":"msg","to":"mainnet","tot":"str"},{"t":"set","p":"msg.payload.abi","pt":"msg","to":"abi_aragon_app_voting","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":300,"wires":[["e021a708.c854f8","601e51aa.7176a","8b13e416.cd9178","b64522ba.db802"]]},{"id":"e021a708.c854f8","type":"change","z":"da8d4d9f.ceb7b","name":"StartVote","rules":[{"t":"set","p":"payload.eventName","pt":"msg","to":"StartVote","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":220,"wires":[["29565323.b1d75c"]]},{"id":"601e51aa.7176a","type":"change","z":"da8d4d9f.ceb7b","name":"CastVote","rules":[{"t":"set","p":"payload.eventName","pt":"msg","to":"CastVote","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":280,"wires":[["29565323.b1d75c"]]},{"id":"8b13e416.cd9178","type":"change","z":"da8d4d9f.ceb7b","name":"ExecuteVote","rules":[{"t":"set","p":"payload.eventName","pt":"msg","to":"ExecuteVote","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":340,"wires":[["29565323.b1d75c"]]},{"id":"b64522ba.db802","type":"change","z":"da8d4d9f.ceb7b","name":"All","rules":[{"t":"set","p":"payload.eventName","pt":"msg","to":"all","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":400,"wires":[[]]},{"id":"4d8286e2.5b3b08","type":"link in","z":"da8d4d9f.ceb7b","name":"In: New Event","links":["3f61ff1.5f969"],"x":155,"y":680,"wires":[["54affe4f.0341d","ddce49d4.4f1a68"]]},{"id":"3f61ff1.5f969","type":"link out","z":"da8d4d9f.ceb7b","name":"Out: New Event","links":["4d8286e2.5b3b08"],"x":1155,"y":280,"wires":[]},{"id":"81d72f9f.c54c3","type":"switch","z":"da8d4d9f.ceb7b","name":"","property":"payload.eventName","propertyType":"msg","rules":[{"t":"eq","v":"StartVote","vt":"str"},{"t":"eq","v":"CastVote","vt":"str"},{"t":"eq","v":"ExecuteVote","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":4,"x":430,"y":680,"wires":[["dee494b9.ace728"],["6e239062.b1e64"],["e91e6d2f.88cba"],["7f2c31ed.1c59b"]]},{"id":"dee494b9.ace728","type":"function","z":"da8d4d9f.ceb7b","name":"New Vote Created Notification","func":"\nbuttons = [];\n\nvoteId = parseInt(msg.payload.event[0]._hex);\nvoteText = msg.payload.event[2];\nbuttons.push({\n\t\"type\": \"postback\",\n\t\"label\": \"Yes 👍\",\n\t\"value\": `{\"d\":\"ar\", \"ac\":\"vote_y\", \"id\":\"${voteId}\"}`,\n\t\"alert\": false,\n\t\"style\": \"\"\n});\n\nbuttons.push({\n\t\t\"type\": \"postback\",\n\t\t\"label\": \"No 👎\",\n\t\t\"value\": `{\"d\":\"ar\", \"ac\":\"vote_n\", \"id\":\"${voteId}\"}`,\n\t\t\"alert\": false,\n\t\t\"style\": \"\"\n\t});\n\nbuttons.push({\n\t \"type\": \"newline\"\n});\n\n\nbuttons.push({\n\t\"type\": \"url\",\n\t\"label\": \"🔊 View Vote\",\n\t\"url\": `${global.get('c19_app_url')}/${global.get('address_c19_voting_app')}/vote/${voteId}`,\n\t\"alert\": false,\n\t\"style\": \"\"\n});\n\t\nbuttons.push(button = {\n\t\"type\": \"postback\",\n\t\"label\": `Menu`,\n\t\"value\": `/menu`,\n\t\"style\": \"\"\n});\n\nmsg.payload.type = \"inline-buttons\";\nmsg.payload.content = `New proposal \"${voteText}\" created. Vote# ${voteId}.\n\nVote using below buttons`;\nmsg.payload.buttons = buttons;\n\nreturn msg;","outputs":1,"noerr":0,"x":710,"y":600,"wires":[["10f3e741.5883d9","556d30d8.3f7de"]]},{"id":"6e239062.b1e64","type":"function","z":"da8d4d9f.ceb7b","name":"Cast vote","func":"\nbuttons = [];\nvoteId = parseInt(msg.payload.event[0]._hex);\nvoteValue = msg.payload.event[2];\nvoter = msg.payload.event[1];\n\nvoteValue = voteValue ? 'Yes' : 'No'\n\nbuttons.push({\n\t\t\"type\": \"url\",\n\t\t\"label\": \"🔊 View Vote\",\n\t\t\"url\": `${global.get('c19_app_url')}/${global.get('address_c19_voting_app')}/vote/${voteId}`,\n\t\t\"alert\": false,\n\t\t\"style\": \"\"\n});\n\nbuttons.push(button = {\n\t\"type\": \"postback\",\n\t\"label\": `Menu`,\n\t\"value\": `/menu`,\n\t\"style\": \"\"\n});\n\t\nmsg.payload.type = \"inline-buttons\";\nmsg.payload.content = `New \"CastVote\" event for Vote# ${voteId}\nVote: ${voteValue}\nVoter: ${voter}\n`;\nmsg.payload.buttons = buttons;\n\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":660,"wires":[["10f3e741.5883d9"]]},{"id":"10f3e741.5883d9","type":"function","z":"da8d4d9f.ceb7b","name":"Change","func":"msg.notification = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":900,"y":660,"wires":[["6377d83b.eba908"]]},{"id":"6377d83b.eba908","type":"link out","z":"da8d4d9f.ceb7b","name":"","links":["687fb365.2be1dc"],"x":1075,"y":660,"wires":[]},{"id":"54affe4f.0341d","type":"chatbot-conversation","z":"da8d4d9f.ceb7b","name":"","botDevelopment":"24145e37.52cb02","botProduction":"","chatId":"111","userId":"","transport":"telegram","store":"","x":270,"y":680,"wires":[["81d72f9f.c54c3"]]},{"id":"ddce49d4.4f1a68","type":"debug","z":"da8d4d9f.ceb7b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":290,"y":640,"wires":[]},{"id":"7f2c31ed.1c59b","type":"debug","z":"da8d4d9f.ceb7b","name":"Unhandled Vote Event","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":360,"y":740,"wires":[]},{"id":"8eb34c59.1416c","type":"switch","z":"da8d4d9f.ceb7b","name":"","property":"records","propertyType":"msg","rules":[{"t":"empty"},{"t":"nempty"}],"checkall":"true","repair":false,"outputs":2,"x":810,"y":1040,"wires":[[],["92412d86.22382"]]},{"id":"6528dd2a.0a8804","type":"debug","z":"da8d4d9f.ceb7b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":830,"y":1000,"wires":[]},{"id":"7acd2b23.32d1d4","type":"delay","z":"da8d4d9f.ceb7b","name":"","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":970,"y":1120,"wires":[["2c3c9cd5.cb59e4"]]},{"id":"92412d86.22382","type":"array-loop","z":"da8d4d9f.ceb7b","name":"","key":"123","keyType":"msg","reset":false,"resetValue":"value-null","array":"records","arrayType":"msg","x":1050,"y":1060,"wires":[[],["7acd2b23.32d1d4"]]},{"id":"2c3c9cd5.cb59e4","type":"function","z":"da8d4d9f.ceb7b","name":"","func":"chatId = msg.payload.fields.chat_id;\nvoteEnabled = msg.payload.fields.account === undefined ? false : true;\n\nmsg.payload = msg.notification;\nmsg.payload.chatId = chatId;\n\n// if(msg.payload.eventName === 'StartVote' && voteEnabled === false){\n// //do not how voting button\n// delete msg.payload.buttons[0];\n// delete msg.payload.buttons[1];\n// delete msg.payload.buttons[2];\n// node.warn({\"voteEnabled False\": msg.payload});\n// }\n\nreturn msg;","outputs":1,"noerr":0,"x":1170,"y":1120,"wires":[["92412d86.22382","16d91417.8f03cc"]]},{"id":"2103933f.dbf71c","type":"node-airtable","z":"da8d4d9f.ceb7b","name":"Get All Users","auth":"a65faee5.5fdcc","table":"user","tableType":"str","action":"list","filter":"","filterType":"str","record":"","recordType":"msg","records":"","recordsType":"msg","output":"payload.records","x":370,"y":1040,"wires":[["3475d273.61403e"],[]]},{"id":"3475d273.61403e","type":"function","z":"da8d4d9f.ceb7b","name":"Notificattion enabled?","func":"\n// whiteListedUsers = flow.get('whitelisted');\n\nlet filteredUsers = msg.payload.records.filter(record => record.fields.notification === true);\nmsg.records = filteredUsers;\n\nreturn msg;","outputs":1,"noerr":0,"x":600,"y":1040,"wires":[["8eb34c59.1416c","afc1a975.c00368"]]},{"id":"afc1a975.c00368","type":"debug","z":"da8d4d9f.ceb7b","name":"Notification Enabled","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":640,"y":980,"wires":[]},{"id":"75f447dd.0aee08","type":"debug","z":"da8d4d9f.ceb7b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1170,"y":1220,"wires":[]},{"id":"687fb365.2be1dc","type":"link in","z":"da8d4d9f.ceb7b","name":"","links":["6377d83b.eba908"],"x":195,"y":1040,"wires":[["2103933f.dbf71c"]]},{"id":"16d91417.8f03cc","type":"link out","z":"da8d4d9f.ceb7b","name":"","links":["fde38021.ef774"],"x":1335,"y":1120,"wires":[]},{"id":"e91e6d2f.88cba","type":"function","z":"da8d4d9f.ceb7b","name":"ExecuteVote","func":"\nbuttons = [];\nvoteId = parseInt(msg.payload.event[0]._hex);\nvoteValue = msg.payload.event[1];\n\nvoteValue = voteValue ? 'Yes' : 'No'\n\nbuttons.push({\n\t\t\"type\": \"url\",\n\t\t\"label\": \"🔊 View Vote\",\n\t\t\"url\": `${global.get('c19_app_url')}/${global.get('address_c19_voting_app')}/vote/${voteId}`,\n\t\t\"alert\": false,\n\t\t\"style\": \"\"\n});\n\nbuttons.push(button = {\n\t\"type\": \"postback\",\n\t\"label\": `Menu`,\n\t\"value\": `/menu`,\n\t\"style\": \"\"\n});\n\t\nmsg.payload.type = \"inline-buttons\";\nmsg.payload.content = `Vote# ${voteId} Executed\n`;\nmsg.payload.buttons = buttons;\n\nreturn msg;","outputs":1,"noerr":0,"x":650,"y":720,"wires":[["e257283b.3e0688","10f3e741.5883d9"]]},{"id":"e257283b.3e0688","type":"debug","z":"da8d4d9f.ceb7b","name":"Execute Vote Data","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":670,"y":760,"wires":[]},{"id":"280b1c47.5cae74","type":"link in","z":"2d3e2335.2a164c","name":"In: Eth Trf","links":["3c927981.4328c6","fac7aac7.c358c8","64f023b9.f6040c"],"x":135,"y":2720,"wires":[["5bf15d92.cba814","e27a759b.f45328"]]},{"id":"99ca96a7.93c558","type":"comment","z":"2d3e2335.2a164c","name":"Transfer ETH","info":"","x":150,"y":2420,"wires":[]},{"id":"b65b920f.7e24c","type":"subflow:e730b986.339628","z":"2d3e2335.2a164c","name":"","env":[],"x":710,"y":2720,"wires":[["d2771a2.3f98ce8"]]},{"id":"e27a759b.f45328","type":"subflow:8342788e.337c18","z":"2d3e2335.2a164c","name":"","env":[],"x":290,"y":2720,"wires":[["3ffb0ad8.7593c6"],[]]},{"id":"3ffb0ad8.7593c6","type":"node-airtable","z":"2d3e2335.2a164c","name":"Get Account","auth":"a65faee5.5fdcc","table":"accounts","tableType":"str","action":"get","filter":"","filterType":"msg","record":"payload.user.fields.account[0]","recordType":"msg","records":"payload.payload","recordsType":"msg","output":"payload.user.account","x":490,"y":2720,"wires":[["b65b920f.7e24c"],[]]},{"id":"d2771a2.3f98ce8","type":"function","z":"2d3e2335.2a164c","name":"Transfer eth to address","func":"const eth_sdk = global.get(\"ethsdk\");\nconst ethers = global.get(\"ethers\");\nconst gasFee = '0.002'\n\nif(msg.payload.balance < gasFee){ // gas fee for trf\n msg.payload.error = 'Insufficient Balance, Transaction canceled.';\n return [null, msg];\n}\n\nrequestedTrfAmount = ethers.utils.parseEther(msg.payload.amount);\nbalance = ethers.utils.parseEther(msg.payload.balance);\nif(balance.lt(requestedTrfAmount.add(ethers.utils.parseEther(gasFee)))){\n msg.payload.error = 'Insufficient Balance, Transaction canceled.'\n return [null, msg]\n}\n\nmsg.payload.config = {\n \"recipient\" : msg.payload.recipient,\n \"value\": requestedTrfAmount.toHexString()\n};\n\nreturn [ msg, null ];\n\n","outputs":2,"noerr":0,"x":970,"y":2720,"wires":[["d5947d57.e3653"],["4de36c9a.c95b64"]]},{"id":"f180ad86.c81e8","type":"change","z":"2d3e2335.2a164c","name":"","rules":[{"t":"set","p":"payload.sdkPayload.debug","pt":"msg","to":"true","tot":"bool"},{"t":"set","p":"payload.network","pt":"msg","to":"network","tot":"global"},{"t":"set","p":"payload.sdkPayload.address","pt":"msg","to":"payload.user.account.fields.account_address","tot":"msg"},{"t":"set","p":"payload.sdkPayload.privateKey","pt":"msg","to":"payload.user.account.fields.pk","tot":"msg"},{"t":"set","p":"payload.sdkPayload.action","pt":"msg","to":"SDK_ACTION_EXECUTE_TRX","tot":"global"},{"t":"set","p":"payload.sdkPayload.queryProviderEndPoint","pt":"msg","to":"queryProviderEndPoint","tot":"global"},{"t":"set","p":"msg.payload.sdkPayload.recipient","pt":"msg","to":"payload.config.recipient","tot":"msg"},{"t":"set","p":"payload.sdkPayload.value","pt":"msg","to":"payload.config.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1400,"y":2700,"wires":[["55a2e4ff.29a1ac"]]},{"id":"d7d4ca57.0efb68","type":"switch","z":"2d3e2335.2a164c","name":"","property":"payload.sdkPayload.done","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":1510,"y":2760,"wires":[["38ba571.1359ea8"]]},{"id":"d73c39e2.f95e18","type":"debug","z":"2d3e2335.2a164c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1310,"y":2820,"wires":[]},{"id":"4de36c9a.c95b64","type":"chatbot-conversation","z":"2d3e2335.2a164c","name":"","botDevelopment":"4c02f411.5d93bc","botProduction":"","chatId":"1111","userId":"","transport":"","store":"","x":930,"y":2780,"wires":[["f663e6d9.8399c8"]]},{"id":"f663e6d9.8399c8","type":"function","z":"2d3e2335.2a164c","name":"","func":"msg.payload.chatId = msg.payload.user.fields.chat_id;\n\nmsg.payload.type = \"message\";\nmsg.payload.content = `${msg.payload.error}\n\n♢ETH balance: ${msg.payload.balance}\n🔆Membership Token : ${msg.payload.tokenBalance}\nAccount address: ${msg.payload.user.account.fields.account_address}\n`;\n\nreturn msg;","outputs":1,"noerr":0,"x":930,"y":2860,"wires":[["825ac95c.cc82f8"]]},{"id":"38ba571.1359ea8","type":"function","z":"2d3e2335.2a164c","name":"Eth Trf","func":"msg.payload.chatId = msg.payload.user.fields.chat_id;\n\nmsg.payload.type = \"message\";\nif(msg.payload.sdkPayload.error === undefined){\n buttons = [];\n \n buttons.push({\n\t\t\"type\": \"url\",\n\t\t\"label\": \"View Transaction\",\n\t\t\"url\": `${global.get('ether_scan_url')}/tx/${msg.payload.sdkPayload.notification.hash}`,\n\t\t\"alert\": false,\n\t\t\"style\": \"\"\n });\n buttons.push(button = {\n\t\"type\": \"postback\",\n\t\"label\": `Account`,\n\t\"value\": `/account`,\n\t\"style\": \"\"\n });\n\n buttons.push(button = {\n \t\"type\": \"postback\",\n \t\"label\": `Menu`,\n \t\"value\": `/menu`,\n \t\"style\": \"\"\n });\n msg.payload.buttons = buttons;\n msg.payload.type = \"inline-buttons\";\n msg.payload.content = `Congrats!!! Eth transfer initiated, verify on etherscan `;\n}else{\n msg.payload.content = `${msg.payload.sdkPayload.error} `\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":1690,"y":2760,"wires":[["fa77d43a.7be4b8","88d2b916.b1b408"]]},{"id":"b7ead684.4df4d8","type":"link out","z":"2d3e2335.2a164c","name":"Out: Trf Eth","links":["8cbf5472.303bd8"],"x":1355,"y":740,"wires":[]},{"id":"8cbf5472.303bd8","type":"link in","z":"2d3e2335.2a164c","name":"On: Ask to account Address","links":["b7ead684.4df4d8"],"x":135,"y":3120,"wires":[["6ac0e083.a3646","69e1b8a5.fe6df8"]]},{"id":"69e1b8a5.fe6df8","type":"function","z":"2d3e2335.2a164c","name":"","func":"msg.payload.chatId = msg.payload.user.fields.chat_id;\n\nmsg.payload.content = `\n♢ETH balance: ${msg.payload.balance}\nAccount Address: ${msg.payload.user.account.fields.account_address}\n\nPlease provide amount followed by recipient address. ex <amount> <address>\n`;\n\nmsg.payload.type = 'buttons';\nmsg.payload.buttons = [{\n\t\"type\": \"keyboardButton\",\n\t\"label\": \"Main Menu\"\n}]\n\nreturn msg;","outputs":1,"noerr":0,"x":270,"y":3120,"wires":[["437ceb4d.016d64"]]},{"id":"437ceb4d.016d64","type":"chatbot-telegram-send","z":"2d3e2335.2a164c","bot":"784f1d9a.2a3ad4","botProduction":"","track":true,"passThrough":false,"outputs":1,"x":490,"y":3120,"wires":[["59787336.02dacc"]]},{"id":"55a2e4ff.29a1ac","type":"subflow:c67eccc4.042ec","z":"2d3e2335.2a164c","name":"","env":[],"x":1280,"y":2760,"wires":[["d7d4ca57.0efb68","d73c39e2.f95e18"]]},{"id":"857b7d27.c5785","type":"subflow:e730b986.339628","z":"3867c68b.1306da","name":"","env":[],"x":910,"y":960,"wires":[["29c51ab5.404376","898ae0b3.1c976"]]},{"id":"898ae0b3.1c976","type":"function","z":"3867c68b.1306da","name":"Create Voting Proposal","func":"ethers = global.get(\"ethers\");\n\nlet abi = global.get(\"abi_aragon_app_voting\");\n\nconst tokenManagerAddress = global.get(\"address_token_manager\");\n\nif(msg.payload.balance <= global.get('min_eth_for_gas_fee')){\n msg.payload.error = 'Please make sure to have enough ETH to pay for gas fee.';\n return [null, msg];\n}\n\nfunction encodeData(args) {\n const votingAppAdd = global.get('address_c19_voting_app').replace('0x', ''); // old c19 voting app\n let iface = new ethers.utils.Interface(abi);\n let encodedData = iface.functions['newVote'].encode(args);\n encodedData = encodedData.replace('0x', `0x00000001${votingAppAdd}000000c4`)\n encodedData = encodedData.replace('0100000000', '0400000001')\n console.log(encodedData);\n msg.payload.enData = encodedData;\n return encodedData;\n}\n\n_executtionScript = encodeData(['0x0', msg.payload.proposalData]);\n\nmsg.payload.config = {\n \"recipient\" : tokenManagerAddress,\n abi,\n \"apiCall\" : \"forward\",\n \"args\" : [_executtionScript],\n \"value\" : \"0x0\"\n};\n\nreturn [ msg, null ];\n\n","outputs":2,"noerr":0,"x":1190,"y":960,"wires":[["c09beadc.4923a8","36ebbcd.ee7b944"],["c09beadc.4923a8","6c9cdcc1.6df134"]]},{"id":"6c9cdcc1.6df134","type":"function","z":"3867c68b.1306da","name":"","func":"msg.payload.chatId = msg.payload.user.fields.chat_id;\n\nmsg.payload.type = \"message\";\nmsg.payload.content = `${msg.payload.error}\n\nETH balance: ${msg.payload.balance}\nC19 Token balance: ${tokenBalance}\nAccount address: ${msg.payload.user.account.fields.account_address}\n`;\n\nreturn msg;","outputs":1,"noerr":0,"x":1210,"y":1000,"wires":[["b8b57679.dc1358"]]},{"id":"36ebbcd.ee7b944","type":"subflow:48d0467c.b38be8","z":"3867c68b.1306da","name":"","env":[],"x":1430,"y":960,"wires":[["f4aa5fc7.b0e69","325386ea.770c0a","7507c062.faee3"]]},{"id":"24d08dc.7c63472","type":"change","z":"3867c68b.1306da","name":"","rules":[{"t":"set","p":"payload.sdkPayload.debug","pt":"msg","to":"true","tot":"bool"},{"t":"set","p":"payload.network","pt":"msg","to":"network","tot":"global"},{"t":"set","p":"payload.sdkPayload.address","pt":"msg","to":"payload.user.account.fields.account_address","tot":"msg"},{"t":"set","p":"payload.sdkPayload.privateKey","pt":"msg","to":"payload.user.account.fields.pk","tot":"msg"},{"t":"set","p":"payload.sdkPayload.action","pt":"msg","to":"SDK_ACTION_EXECUTE_TRX","tot":"global"},{"t":"set","p":"payload.sdkPayload.queryProviderEndPoint","pt":"msg","to":"queryProviderEndPoint","tot":"global"},{"t":"set","p":"payload.sdkPayload.value","pt":"msg","to":"payload.config.value","tot":"msg"},{"t":"set","p":"msg.payload.sdkPayload.recipient","pt":"msg","to":"payload.config.recipient","tot":"msg"},{"t":"set","p":"payload.sdkPayload.data","pt":"msg","to":"payload.config.encodedData","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1880,"y":960,"wires":[["17585e2d.e082f2"]]},{"id":"17585e2d.e082f2","type":"subflow:c67eccc4.042ec","z":"3867c68b.1306da","name":"","env":[],"x":2080,"y":980,"wires":[["17c0bc06.940034","ca7187ac.d76f58"]]},{"id":"17c0bc06.940034","type":"switch","z":"3867c68b.1306da","name":"","property":"payload.sdkPayload.done","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":1850,"y":1020,"wires":[["b82001.40cca"]]},{"id":"b82001.40cca","type":"function","z":"3867c68b.1306da","name":"Proposal Result","func":"msg.payload.chatId = msg.payload.user.fields.chat_id;\n\nif(msg.payload.sdkPayload.error === undefined){\n \n buttons = [];\n buttons.push({\n \t\"type\": \"url\",\n \t\"label\": \"View Proposal\",\n \t\"url\": `${global.get('c19_app_url')}/${global.get('address_c19_voting_app')}/`,\n \t\"alert\": false,\n \t\"style\": \"\"\n });\n \n buttons.push({\n \t\"type\": \"url\",\n \t\"label\": \"View Transaction\",\n \t\"url\": `${global.get('ether_scan_url')}/tx/${msg.payload.sdkPayload.notification.hash}`,\n \t\"alert\": false,\n \t\"style\": \"\"\n });\n \n buttons.push(button = {\n \t\"type\": \"newline\"\n });\n \n buttons.push(button = {\n \t\"type\": \"postback\",\n \t\"label\": `Menu`,\n \t\"value\": `/menu`,\n \t\"style\": \"\"\n }); \n \n msg.payload.type = \"inline-buttons\";\n msg.payload.content = `Thank you, your proposal has been submitted.`;\n msg.payload.buttons = buttons;\n}else{\n msg.payload.type = \"message\";\n msg.payload.content = `${msg.payload.sdkPayload.error} `\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":2060,"y":1020,"wires":[["d3f97206.77163"]]},{"id":"f4aa5fc7.b0e69","type":"debug","z":"3867c68b.1306da","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1470,"y":920,"wires":[]},{"id":"875a78e7.099fa8","type":"debug","z":"3867c68b.1306da","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":430,"y":1000,"wires":[]},{"id":"29c51ab5.404376","type":"debug","z":"3867c68b.1306da","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":950,"y":1000,"wires":[]},{"id":"c09beadc.4923a8","type":"debug","z":"3867c68b.1306da","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1470,"y":860,"wires":[]},{"id":"1c345feb.b981d","type":"node-airtable","z":"3867c68b.1306da","name":"Get Account","auth":"a65faee5.5fdcc","table":"accounts","tableType":"str","action":"get","filter":"","filterType":"msg","record":"payload.user.fields.account[0]","recordType":"msg","records":"payload.payload","recordsType":"msg","output":"payload.user.account","x":670,"y":960,"wires":[["857b7d27.c5785","e8aacc02.15472"],[]]},{"id":"3dec4dc3.4940f2","type":"subflow:8342788e.337c18","z":"3867c68b.1306da","name":"","env":[],"x":410,"y":960,"wires":[["1c345feb.b981d"],[]]},{"id":"21cd3401.08a05c","type":"link in","z":"3867c68b.1306da","name":"In: Create Proposal","links":["a89e8bd1.faa438"],"x":215,"y":960,"wires":[["3dec4dc3.4940f2"]]},{"id":"ca7187ac.d76f58","type":"debug","z":"3867c68b.1306da","name":"SDK Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":2220,"y":920,"wires":[]},{"id":"e1366015.34164","type":"function","z":"2d3e2335.2a164c","name":"","func":"\ntry{\n inputs = msg.payload.content.split(' ');\n if(inputs === undefined || inputs.length !== 2){\n msg.payload.content = `Invalid arguments. Use format below\n<amount> <recipient address>\n `\n msg.payload.type = 'buttons';\n msg.payload.buttons = [{\n \t\"type\": \"keyboardButton\",\n \t\"label\": \"Main Menu\"\n }]\n return [null, msg, null];\n }\n if(isNaN(inputs[0])){\n msg.payload.content = `Invalid amount. Use format below\n<amount> <recipient address>\n `\n msg.payload.type = 'buttons';\n msg.payload.buttons = [{\n \t\"type\": \"keyboardButton\",\n \t\"label\": \"Main Menu\"\n }]\n return [null, msg, null];\n }\n msg.payload.inputs = inputs;\n}catch(error){\n msg.payload.content = error;\n return [null, null, msg];\n}\n\nreturn [msg, null, null];","outputs":3,"noerr":0,"x":830,"y":3120,"wires":[["bb287062.0241b","10e51f83.0aea5"],["437ceb4d.016d64"],["d60a6582.9a9e08"]]},{"id":"6ac0e083.a3646","type":"debug","z":"2d3e2335.2a164c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":330,"y":3080,"wires":[]},{"id":"bb287062.0241b","type":"debug","z":"2d3e2335.2a164c","name":"Confirm","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1000,"y":3080,"wires":[]},{"id":"10e51f83.0aea5","type":"function","z":"2d3e2335.2a164c","name":"Send ETH confirmation","func":"\nbuttons = [];\n\nbuttons.push(button = {\n\t\"type\": \"postback\",\n\t\"label\": `Confirm 👍`,\n\t\"value\": `${msg.payload.inputs[0]} ${msg.payload.inputs[1]}`,\n\t\"style\": \"\"\n});\n\nbuttons.push(button = {\n\t\"type\": \"postback\",\n\t\"label\": `Reject 👎`,\n\t\"value\": `/reject`,\n\t\"style\": \"\"\n});\n\nmsg.payload.type = \"inline-buttons\";\nmsg.payload.content = `\nTransaction summarry:\nETH amount: ${msg.payload.inputs[0]}\nRecipient: ${msg.payload.inputs[1]}\n`;\nmsg.payload.buttons = buttons;\n\nreturn msg;","outputs":1,"noerr":0,"x":1050,"y":3120,"wires":[["25048b1e.6e5da4"]]},{"id":"25048b1e.6e5da4","type":"chatbot-telegram-send","z":"2d3e2335.2a164c","bot":"784f1d9a.2a3ad4","botProduction":"","track":true,"passThrough":false,"outputs":1,"x":1310,"y":3120,"wires":[["25afd021.770cb","2674d64e.98a57a","fa5338f.85ab4c8"]]},{"id":"25afd021.770cb","type":"debug","z":"2d3e2335.2a164c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1330,"y":3080,"wires":[]},{"id":"2674d64e.98a57a","type":"switch","z":"2d3e2335.2a164c","name":"","property":"payload.content","propertyType":"msg","rules":[{"t":"eq","v":"/reject","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":1510,"y":3120,"wires":[["52dd7b90.2dcb84"],["ae70a1d8.26381"]]},{"id":"3146ec66.0a90e4","type":"link out","z":"2d3e2335.2a164c","name":"","links":["fde38021.ef774"],"x":1815,"y":3100,"wires":[]},{"id":"d60a6582.9a9e08","type":"link out","z":"2d3e2335.2a164c","name":"","links":["fde38021.ef774"],"x":995,"y":3180,"wires":[]},{"id":"fa77d43a.7be4b8","type":"link out","z":"2d3e2335.2a164c","name":"","links":["fde38021.ef774"],"x":1855,"y":2760,"wires":[]},{"id":"825ac95c.cc82f8","type":"link out","z":"2d3e2335.2a164c","name":"","links":["fde38021.ef774"],"x":1035,"y":2860,"wires":[]},{"id":"1747acdf.bdd363","type":"link out","z":"2d3e2335.2a164c","name":"","links":["fde38021.ef774"],"x":1110,"y":1920,"wires":[]},{"id":"52dd7b90.2dcb84","type":"function","z":"2d3e2335.2a164c","name":"","func":"msg.payload.content = `Tranaction canceled!!!`\nreturn msg;","outputs":1,"noerr":0,"x":1670,"y":3100,"wires":[["3146ec66.0a90e4"]]},{"id":"ae70a1d8.26381","type":"function","z":"2d3e2335.2a164c","name":"","func":"inputs = msg.payload.content.split(' ');\nif(inputs === undefined || inputs.length !== 2){\n msg.payload.content = `Invalid arguments. Transaction canceled`\n return [msg, null];\n}\n\nmsg.payload.amount = inputs[0];\nmsg.payload.recipient = inputs[1];\n\nreturn [null, msg];","outputs":2,"noerr":0,"x":1670,"y":3140,"wires":[["3146ec66.0a90e4"],["3c927981.4328c6"]]},{"id":"3c927981.4328c6","type":"link out","z":"2d3e2335.2a164c","name":"","links":["280b1c47.5cae74"],"x":1815,"y":3160,"wires":[]},{"id":"5bf15d92.cba814","type":"debug","z":"2d3e2335.2a164c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":230,"y":2760,"wires":[]},{"id":"4e61c052.b74e","type":"link out","z":"2d3e2335.2a164c","name":"","links":["d9000593.918678","558148c4.684508"],"x":1435,"y":780,"wires":[]},{"id":"4d1432b1.bc371c","type":"function","z":"3e3253ba.73217c","name":"Trf C19 token to address","func":"\nethers = global.get(\"ethers\");\n\nlet abi = global.get(\"abi_erc20\");\nnumOfTokens = ethers.utils.parseEther('1');\n\nmsg.payload.config = {\ncontractAddress: global.get('address_c19_token'),\n abi,\n \"pk\" : global.get('pk_c19_token_holder'),\n \"apiCall\" : \"transfer\", \n \"args\" : [msg.payload.recipient, numOfTokens]\n}\nreturn msg;","outputs":1,"noerr":0,"x":1050,"y":480,"wires":[["57825faa.2e2c9","fddd95fd.52efc8"]]},{"id":"fddd95fd.52efc8","type":"function","z":"3e3253ba.73217c","name":"Contract Executor ","func":"ethers = global.get('ethers');\nlet network = 'mainnet'\n\nlet { pk, contractAddress, apiCall, args, abi, byteCode } = msg.payload.config;\nconst provider = ethers.getDefaultProvider(network);\n\nlet wallet;\nlet contract;\n\nif(pk){\n wallet = new ethers.Wallet(pk, provider);\n contract = new ethers.Contract(contractAddress, abi, wallet);\n}else{\n // read only\n contract = new ethers.Contract(contractAddress, abi, provider);\n}\n\n// All overrides are optional\nlet overrides = {\n // The maximum units of gas for the transaction to use\n gasLimit: 800000,\n\n // The price (in wei) per unit of gas\n gasPrice: ethers.utils.parseUnits('8.0', 'gwei'),\n\n};\n\nargs.push(overrides);\n\n\nlet func = contract[apiCall];\nasync function process () {\n try{\n let resp = await func.apply(node, args);\n // msg.payload.trxHash = resp.hash;\n msg.payload.response = resp;\n }catch(error){\n msg.payload.error = error;\n }\n node.send(msg, false);\n node.done();\n return;\n}\n\nprocess();\n\nreturn;","outputs":1,"noerr":0,"x":1310,"y":480,"wires":[["10554b42.291355","92120cff.a336f"]]},{"id":"10554b42.291355","type":"function","z":"3e3253ba.73217c","name":"","func":"if(msg.payload.error === undefined){\n return [msg, null]\n}else{\n msg.payload.type = 'message';\n msg.payload.content = msg.payload.error\n return [null, msg]\n}\n\n","outputs":2,"noerr":0,"x":1550,"y":480,"wires":[["b78d7940.db52e8","e04641d1.c89b2"],["ca6a8092.1d4f","e6105c8c.14dd1"]]},{"id":"92120cff.a336f","type":"debug","z":"3e3253ba.73217c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1350,"y":420,"wires":[]},{"id":"b78d7940.db52e8","type":"debug","z":"3e3253ba.73217c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1570,"y":420,"wires":[]},{"id":"4eb90528.73573c","type":"link in","z":"3e3253ba.73217c","name":"In: trf c19 token","links":["b1da3e5.48286c","d1a79c28.7fdf8","5f14be1b.780d6","9c8a4e02.80d9a"],"x":155,"y":480,"wires":[["a4bbea08.79d128"]]},{"id":"b1da3e5.48286c","type":"link out","z":"2d3e2335.2a164c","name":"Out: Trf New C19 Token","links":["4eb90528.73573c"],"x":2035,"y":1800,"wires":[]},{"id":"874fdf86.4f674","type":"comment","z":"3e3253ba.73217c","name":"Check if already have token","info":"","x":480,"y":420,"wires":[]},{"id":"27fb2358.2a374c","type":"subflow:9e5e594a.494868","z":"3e3253ba.73217c","name":"","env":[],"x":580,"y":480,"wires":[["f513dc0c.5f0c6"]]},{"id":"a4bbea08.79d128","type":"change","z":"3e3253ba.73217c","name":"","rules":[{"t":"set","p":"payload.address_contract","pt":"msg","to":"address_c19_token","tot":"global"},{"t":"set","p":"payload.abi","pt":"msg","to":"abi_erc20","tot":"global"},{"t":"set","p":"payload.network","pt":"msg","to":"network","tot":"global"},{"t":"set","p":"payload.recipient","pt":"msg","to":"payload.user.account.fields.account_address","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":480,"wires":[["27fb2358.2a374c"]]},{"id":"57825faa.2e2c9","type":"debug","z":"3e3253ba.73217c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1030,"y":540,"wires":[]},{"id":"f513dc0c.5f0c6","type":"switch","z":"3e3253ba.73217c","name":"","property":"payload.tokenBalance","propertyType":"msg","rules":[{"t":"lt","v":"1","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":810,"y":480,"wires":[["aff7aa2.21f8d58","4d1432b1.bc371c"],["a85d9a15.f033e8"]]},{"id":"a85d9a15.f033e8","type":"debug","z":"3e3253ba.73217c","name":"Already have token, do not transfer","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":700,"y":540,"wires":[]},{"id":"5b05260d.3b9808","type":"switch","z":"507c6c45.0c62b4","name":"","property":"maintenance","propertyType":"global","rules":[{"t":"true"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":1310,"y":320,"wires":[["8b035d92.efa74"],["c452a18a.1eb53"]]},{"id":"193b0fd5.ae59d","type":"link out","z":"507c6c45.0c62b4","name":"","links":["fde38021.ef774"],"x":1795,"y":280,"wires":[]},{"id":"8b035d92.efa74","type":"switch","z":"507c6c45.0c62b4","name":"","property":"payload.user.fields.whitelisted","propertyType":"msg","rules":[{"t":"true"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":1510,"y":280,"wires":[["c452a18a.1eb53"],["6b28b1f2.b62c6"]]},{"id":"6b28b1f2.b62c6","type":"function","z":"507c6c45.0c62b4","name":"","func":"msg.payload.content = `Collab19 is currently whitelisted. Please contact @OKduncan for access.\n`\nreturn msg;","outputs":1,"noerr":0,"x":1690,"y":280,"wires":[["193b0fd5.ae59d"]]},{"id":"cfc2ee60.03217","type":"debug","z":"507c6c45.0c62b4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1270,"y":280,"wires":[]},{"id":"8944325b.d33b3","type":"link out","z":"2d3e2335.2a164c","name":"","links":["fde38021.ef774"],"x":1995,"y":1080,"wires":[]},{"id":"a58dedc6.70975","type":"link in","z":"3ab44c3f.7208e4","name":"In: Swap To ETH","links":["ce0a4397.8bb3a"],"x":155,"y":300,"wires":[[]]},{"id":"8880ad49.0a488","type":"switch","z":"3ab44c3f.7208e4","name":"","property":"payload.user.fields.whitelisted","propertyType":"msg","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":330,"y":300,"wires":[["b08d7f3b.4fc4a"],["f64b1940.f7f308"]]},{"id":"b08d7f3b.4fc4a","type":"subflow:e730b986.339628","z":"3ab44c3f.7208e4","name":"","env":[],"x":485,"y":360,"wires":[["963fa63.d304758"]]},{"id":"963fa63.d304758","type":"function","z":"3ab44c3f.7208e4","name":"UNISWAP: Token To ETH","func":"ethers = global.get(\"ethers\");\n\nlet abi = global.get(\"abi_exchange_uniswap\");\nconst tokens_sold = ethers.utils.parseEther(msg.payload.tokenBalance);\nif(tokens_sold <= 0){\n msg.payload.error = 'Can not initate swap, token balance is 0';\n return [null, msg];\n}\n\nif(msg.payload.balance <= global.get('min_eth_for_gas_fee')){\n msg.payload.error = 'Please make sure to have enough ETH to pay for gas fee.';\n return [null, msg];\n}\n\nmin_eth = ethers.utils.parseEther('0.000000000000000001');\n\nmsg.payload.config = {\n \"recipient\" : global.get('address_uniswap_c19_exchange'),\n abi,\n \"apiCall\" : \"tokenToEthSwapInput\",\n \"value\" : ethers.utils.parseEther('0').toHexString(),\n \"args\" : [tokens_sold, min_eth, ethers.utils.parseEther('100')]\n};\n\n\nreturn [ msg, null ];\n\n","outputs":2,"noerr":0,"x":765,"y":360,"wires":[["c1f7d0f0.701ae","96ef3514.106788"],["93694936.4f72c8","8052eefe.f5afd"]]},{"id":"c1f7d0f0.701ae","type":"subflow:48d0467c.b38be8","z":"3ab44c3f.7208e4","name":"","env":[],"x":1005,"y":360,"wires":[["16fa33bd.c6006c"]]},{"id":"16fa33bd.c6006c","type":"change","z":"3ab44c3f.7208e4","name":"","rules":[{"t":"set","p":"payload.sdkPayload.debug","pt":"msg","to":"true","tot":"bool"},{"t":"set","p":"payload.sdkPayload.address","pt":"msg","to":"payload.user.account.fields.account_address","tot":"msg"},{"t":"set","p":"payload.sdkPayload.privateKey","pt":"msg","to":"payload.user.account.fields.pk","tot":"msg"},{"t":"set","p":"payload.sdkPayload.action","pt":"msg","to":"SDK_ACTION_EXECUTE_TRX","tot":"global"},{"t":"set","p":"payload.sdkPayload.queryProviderEndPoint","pt":"msg","to":"queryProviderEndPoint","tot":"global"},{"t":"set","p":"payload.sdkPayload.value","pt":"msg","to":"payload.config.value","tot":"msg"},{"t":"set","p":"msg.payload.sdkPayload.recipient","pt":"msg","to":"payload.config.recipient","tot":"msg"},{"t":"set","p":"payload.sdkPayload.data","pt":"msg","to":"payload.config.encodedData","tot":"msg"},{"t":"set","p":"payload.network","pt":"msg","to":"network","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":1195,"y":360,"wires":[["7dd30956.3f3028"]]},{"id":"7dd30956.3f3028","type":"subflow:c67eccc4.042ec","z":"3ab44c3f.7208e4","name":"","env":[],"x":1120,"y":420,"wires":[["7a4a4a23.4c4034","6986a519.41cdbc"]]},{"id":"7a4a4a23.4c4034","type":"switch","z":"3ab44c3f.7208e4","name":"","property":"payload.sdkPayload.done","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":1290,"y":420,"wires":[["3306246a.0bc36c"]]},{"id":"3306246a.0bc36c","type":"chatbot-conversation","z":"3ab44c3f.7208e4","name":"","botDevelopment":"4c02f411.5d93bc","botProduction":"","chatId":"1111","userId":"","transport":"","store":"","x":1450,"y":420,"wires":[["9ad757a7.9b6328"]]},{"id":"9ad757a7.9b6328","type":"function","z":"3ab44c3f.7208e4","name":"Uniswap Success Message","func":"msg.payload.chatId = msg.payload.user.fields.chat_id;\n\nmsg.payload.type = \"message\";\nif(msg.payload.sdkPayload.error === undefined){\n msg.payload.content = `Congrats!!! SWAP transaction is initiate, verify on etherscan here ${global.get('ether_scan_url')}/tx/${msg.payload.sdkPayload.notification.hash}`;\n}else{\n msg.payload.content = `Error ${msg.payload.sdkPayload.error} `\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":1200,"y":480,"wires":[["3388ef84.f6179"]]},{"id":"934f7475.a95768","type":"comment","z":"3ab44c3f.7208e4","name":"SWAP Token to ETH","info":"","x":790,"y":240,"wires":[]},{"id":"93694936.4f72c8","type":"chatbot-conversation","z":"3ab44c3f.7208e4","name":"","botDevelopment":"4c02f411.5d93bc","botProduction":"","chatId":"1111","userId":"","transport":"","store":"","x":750,"y":420,"wires":[["76ba34ed.c158fc"]]},{"id":"76ba34ed.c158fc","type":"function","z":"3ab44c3f.7208e4","name":"","func":"msg.payload.chatId = msg.payload.user.fields.chat_id;\n\nmsg.payload.type = \"message\";\nmsg.payload.content = `${msg.payload.error}\n\n♢ETH balance: ${msg.payload.balance}\n🔆C19 balance: ${msg.payload.tokenBalance}\nAccount Address: ${msg.payload.user.account.fields.account_address}\n`;\n\nreturn msg;","outputs":1,"noerr":0,"x":830,"y":480,"wires":[["7d75e50.dd51e1c"]]},{"id":"6986a519.41cdbc","type":"debug","z":"3ab44c3f.7208e4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1320,"y":520,"wires":[]},{"id":"96ef3514.106788","type":"debug","z":"3ab44c3f.7208e4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":940,"y":320,"wires":[]},{"id":"8052eefe.f5afd","type":"debug","z":"3ab44c3f.7208e4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":710,"y":300,"wires":[]},{"id":"d66ec381.cfb76","type":"comment","z":"3ab44c3f.7208e4","name":"SWAP Token to ETH (inject)","info":"","x":180,"y":100,"wires":[]},{"id":"f64b1940.f7f308","type":"debug","z":"3ab44c3f.7208e4","name":"User is not whitelisted","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":300,"y":380,"wires":[]},{"id":"7d75e50.dd51e1c","type":"link out","z":"3ab44c3f.7208e4","name":"","links":["fde38021.ef774"],"x":795,"y":540,"wires":[]},{"id":"3388ef84.f6179","type":"link out","z":"3ab44c3f.7208e4","name":"","links":["fde38021.ef774"],"x":1435,"y":480,"wires":[]},{"id":"558148c4.684508","type":"link in","z":"2d3e2335.2a164c","name":"On: Ask to account Address","links":["4e61c052.b74e"],"x":135,"y":2360,"wires":[["b1299bae.8ef658","369209ff.386e36"]]},{"id":"b1299bae.8ef658","type":"function","z":"2d3e2335.2a164c","name":"","func":"msg.payload.chatId = msg.payload.user.fields.chat_id;\n\nmsg.payload.content = `\n♢ETH balance: ${msg.payload.balance}\nAccount Address: ${msg.payload.user.account.fields.account_address}\n\nPlease provide ETH donation amount (transaction may take a few minutes)\n\n(For new members, min donation is $5 USD. If membership tokens take longer than 20 minutes to arrive, please contact support in the main menu.)\n`;\n\nmsg.payload.type = 'buttons';\nmsg.payload.buttons = [{\n\t\"type\": \"keyboardButton\",\n\t\"label\": \"Main Menu\"\n}]\n\n\nreturn msg;","outputs":1,"noerr":0,"x":250,"y":2360,"wires":[["1c5fbcb.d8efb43"]]},{"id":"1c5fbcb.d8efb43","type":"chatbot-telegram-send","z":"2d3e2335.2a164c","bot":"784f1d9a.2a3ad4","botProduction":"","track":true,"passThrough":false,"outputs":1,"x":430,"y":2360,"wires":[["edf75f8f.2354","6d3b2265.f31a5c"]]},{"id":"c86016f1.4ffda8","type":"function","z":"2d3e2335.2a164c","name":"","func":"\ntry{\n if(isNaN(msg.payload.content)){\n msg.payload.content = `Invalid amount. Please enter valid amount.`\n msg.payload.type = 'buttons';\n msg.payload.buttons = [{\n \"type\": \"keyboardButton\",\n \"label\": \"Main Menu\"\n }]\n return [null, msg, null];\n }\n}catch(error){\n msg.payload.content = error;\n return [null, null, msg];\n}\n\nreturn [msg, null, null];","outputs":3,"noerr":0,"x":650,"y":2360,"wires":[["43d6517b.048bb","3781d486.53eb8c"],["1c5fbcb.d8efb43"],["2d6694fd.3d379c"]]},{"id":"369209ff.386e36","type":"debug","z":"2d3e2335.2a164c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":270,"y":2320,"wires":[]},{"id":"43d6517b.048bb","type":"debug","z":"2d3e2335.2a164c","name":"Confirm","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":840,"y":2300,"wires":[]},{"id":"3781d486.53eb8c","type":"function","z":"2d3e2335.2a164c","name":"Donation Summary","func":"\nbuttons = [];\n\nbuttons.push(button = {\n\t\"type\": \"postback\",\n\t\"label\": `Confirm 👍`,\n\t\"value\": `${msg.payload.content} ${global.get('donation_address')}`,\n\t\"style\": \"\"\n});\n\nbuttons.push(button = {\n\t\"type\": \"postback\",\n\t\"label\": `Reject 👎`,\n\t\"value\": `/reject`,\n\t\"style\": \"\"\n});\n\nmsg.payload.type = \"inline-buttons\";\nmsg.payload.content = `\nDonation summarry:\nETH amount: ${msg.payload.content}\nRecipient: ${global.get('donation_address')}\n`;\nmsg.payload.buttons = buttons;\n\nreturn msg;","outputs":1,"noerr":0,"x":870,"y":2340,"wires":[["36023485.75147c"]]},{"id":"36023485.75147c","type":"chatbot-telegram-send","z":"2d3e2335.2a164c","bot":"784f1d9a.2a3ad4","botProduction":"","track":true,"passThrough":false,"outputs":1,"x":870,"y":2380,"wires":[["726ca8e8.6c23a8","43967a10.adf204","25dadc88.be5854"]]},{"id":"726ca8e8.6c23a8","type":"debug","z":"2d3e2335.2a164c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1110,"y":2440,"wires":[]},{"id":"43967a10.adf204","type":"switch","z":"2d3e2335.2a164c","name":"","property":"payload.content","propertyType":"msg","rules":[{"t":"eq","v":"/reject","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":1130,"y":2380,"wires":[["74664494.16279c"],["cc3b412a.ab407"]]},{"id":"10c58843.6dbef8","type":"link out","z":"2d3e2335.2a164c","name":"","links":["fde38021.ef774"],"x":1495,"y":2340,"wires":[]},{"id":"2d6694fd.3d379c","type":"link out","z":"2d3e2335.2a164c","name":"","links":["fde38021.ef774"],"x":775,"y":2440,"wires":[]},{"id":"74664494.16279c","type":"function","z":"2d3e2335.2a164c","name":"","func":"msg.payload.content = `Tranaction canceled!!!`\nreturn msg;","outputs":1,"noerr":0,"x":1310,"y":2340,"wires":[["10c58843.6dbef8"]]},{"id":"cc3b412a.ab407","type":"function","z":"2d3e2335.2a164c","name":"","func":"inputs = msg.payload.content.split(' ');\nif(inputs === undefined || inputs.length !== 2){\n msg.payload.content = `Invalid arguments. Transaction canceled`\n return [msg, null];\n}\n\nmsg.payload.amount = inputs[0];\nmsg.payload.recipient = inputs[1];\nmsg.payload.isDonation = true;\n\nreturn [null, msg];","outputs":2,"noerr":0,"x":1310,"y":2380,"wires":[["10c58843.6dbef8"],["64f023b9.f6040c"]]},{"id":"64f023b9.f6040c","type":"link out","z":"2d3e2335.2a164c","name":"","links":["280b1c47.5cae74"],"x":1415,"y":2400,"wires":[]},{"id":"f73f0ebf.f1319","type":"link in","z":"3ab44c3f.7208e4","name":"In: Uniswap","links":["814dbd31.3bdcd","975cbecd.ca0a2","aceb4f5c.08c55","43f45740.934618","503d4305.f7571c","bb97b23b.b7231","56a837d.c2d81c8"],"x":195,"y":860,"wires":[[]]},{"id":"a900b075.f6a8a","type":"comment","z":"3ab44c3f.7208e4","name":"SWAP","info":"We are asking for token Symobol and Token contract address. \n- Need to call uniswap exchange contract to get\n - token exchange address if exists.\n - if exists then check token price?\n - swap ETH for token","x":290,"y":780,"wires":[]},{"id":"25e194f8.96287c","type":"function","z":"3ab44c3f.7208e4","name":"UNISWAP: ETH TO Token","func":"ethers = global.get(\"ethers\");\n\nlet abi = global.get(\"abi_exchange_uniswap\");\netherAmount = ethers.utils.parseEther(msg.payload.balance);\nlet gasBuffer = ethers.utils.parseEther(flow.get('gas_buffer'));\n\nswapAmount = etherAmount.sub(gasBuffer);\n\n// calculate 0.5% of swap amount\nmargin = ethers.utils.parseEther('0.5');\nfact = ethers.utils.parseEther('100');\npercMul = margin.mul(swapAmount);\nperc = percMul.div(fact);\n\nswapAmount = swapAmount.sub(perc);\nmsg.payload.swapAmount = swapAmount;\nmsg.payload.perc = perc;\nmsg.payload.gasBuffer = gasBuffer;\n\n\nif(swapAmount.lte(ethers.utils.bigNumberify('0'))){\n return [null, msg];\n}\n\nswapAmount = swapAmount.toHexString();\n\nmimToken = ethers.utils.parseEther('0.0000000000000001');\n\nmsg.payload.config = {\n// \"recipient\" : \"0x8779C708e2C3b1067de9Cd63698E4334866c691C\", // dai uniswap exchange address\n \"recipient\" : global.get('address_uniswap_c19_exchange'),\n abi,\n \"apiCall\" : \"ethToTokenSwapInput\",\n \"value\" : swapAmount,\n \"args\" : [mimToken, ethers.utils.parseEther('100')]\n};\n\n\nreturn [ msg, null ];\n\n","outputs":2,"noerr":0,"x":350,"y":920,"wires":[["13b17f3f.8c8a01","e942b9ba.7e2688"],["849d6045.dd76b"]]},{"id":"13b17f3f.8c8a01","type":"subflow:48d0467c.b38be8","z":"3ab44c3f.7208e4","name":"","env":[],"x":670,"y":920,"wires":[["60f9bead.f1a2d"]]},{"id":"60f9bead.f1a2d","type":"change","z":"3ab44c3f.7208e4","name":"","rules":[{"t":"set","p":"payload.sdkPayload.debug","pt":"msg","to":"false","tot":"bool"},{"t":"set","p":"payload.sdkPayload.address","pt":"msg","to":"payload.user.account.fields.account_address","tot":"msg"},{"t":"set","p":"payload.sdkPayload.privateKey","pt":"msg","to":"payload.user.account.fields.pk","tot":"msg"},{"t":"set","p":"payload.sdkPayload.action","pt":"msg","to":"SDK_ACTION_EXECUTE_TRX","tot":"global"},{"t":"set","p":"payload.sdkPayload.queryProviderEndPoint","pt":"msg","to":"queryProviderEndPoint","tot":"global"},{"t":"set","p":"payload.sdkPayload.value","pt":"msg","to":"payload.config.value","tot":"msg"},{"t":"set","p":"msg.payload.sdkPayload.recipient","pt":"msg","to":"payload.config.recipient","tot":"msg"},{"t":"set","p":"payload.sdkPayload.data","pt":"msg","to":"payload.config.encodedData","tot":"msg"},{"t":"set","p":"payload.network","pt":"msg","to":"network","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":880,"y":920,"wires":[["be96579b.fec908"]]},{"id":"be96579b.fec908","type":"subflow:c67eccc4.042ec","z":"3ab44c3f.7208e4","name":"","env":[],"x":1100,"y":920,"wires":[["6094eb66.a08134","3c910f4d.b54fc"]]},{"id":"9fd36683.d9ede8","type":"chatbot-conversation","z":"3ab44c3f.7208e4","name":"","botDevelopment":"4c02f411.5d93bc","botProduction":"","chatId":"1111","userId":"","transport":"","store":"","x":1050,"y":980,"wires":[["bf4d653c.513bd8"]]},{"id":"bf4d653c.513bd8","type":"function","z":"3ab44c3f.7208e4","name":"Uniswap Success Message","func":"msg.payload.chatId = msg.payload.user.fields.chat_id;\n\nif(msg.payload.sdkPayload.error === undefined){\n buttons = [];\n buttons.push(button = {\n \t\"type\": \"postback\",\n \t\"label\": `Account`,\n \t\"value\": `/account`,\n \t\"style\": \"\"\n });\n buttons.push(button = {\n \t\"type\": \"url\",\n \t\"label\": `View on Etherscan`,\n \t\"url\": `${global.get('ether_scan_url')}/tx/${msg.payload.sdkPayload.notification.hash}`,\n \t\"style\": \"\"\n });\n \n msg.payload.type = \"inline-buttons\";\n msg.payload.content = `Congrats!!! SWAP transaction is initiated`;\n msg.payload.buttons = buttons;\n // msg.payload.content = `Congrats!!! SWAP transaction is initiated, verify on etherscan here ${global.get('ether_scan_url')}/tx/${msg.payload.sdkPayload.notification.hash}`;\n}else{\n msg.payload.type = \"message\"\n msg.payload.content = `${msg.payload.sdkPayload.error}`\n}\nreturn msg;","outputs":1,"noerr":0,"x":980,"y":1040,"wires":[["6cd96c99.222514"]]},{"id":"6cd96c99.222514","type":"chatbot-telegram-send","z":"3ab44c3f.7208e4","bot":"784f1d9a.2a3ad4","botProduction":"","track":false,"passThrough":false,"outputs":0,"x":1250,"y":1040,"wires":[]},{"id":"6094eb66.a08134","type":"switch","z":"3ab44c3f.7208e4","name":"","property":"payload.sdkPayload.done","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":890,"y":980,"wires":[["9fd36683.d9ede8"]]},{"id":"7d0cd8e3.05a568","type":"debug","z":"3ab44c3f.7208e4","name":"Input: Swap","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":130,"y":780,"wires":[]},{"id":"db20e18d.9698d","type":"subflow:e730b986.339628","z":"3ab44c3f.7208e4","name":"","env":[],"x":377,"y":858,"wires":[["25e194f8.96287c"]]},{"id":"849d6045.dd76b","type":"chatbot-conversation","z":"3ab44c3f.7208e4","name":"","botDevelopment":"4c02f411.5d93bc","botProduction":"","chatId":"1111","userId":"","transport":"","store":"","x":290,"y":980,"wires":[["d4065917.a3e7e8"]]},{"id":"d4065917.a3e7e8","type":"function","z":"3ab44c3f.7208e4","name":"","func":"msg.payload.chatId = msg.payload.user.fields.chat_id;\n\nmsg.payload.type = \"message\";\nmsg.payload.content = `You dont have enough eth to swap for C19 token\n\nETH balance: ${msg.payload.balance}\nToken balance: ${msg.payload.tokenBalance}\nAccount Address: ${msg.payload.user.account.fields.account_address}\n`;\n\nreturn msg;","outputs":1,"noerr":0,"x":450,"y":980,"wires":[["21f84346.a9eadc"]]},{"id":"21f84346.a9eadc","type":"chatbot-telegram-send","z":"3ab44c3f.7208e4","bot":"784f1d9a.2a3ad4","botProduction":"","track":false,"passThrough":false,"outputs":0,"x":650,"y":980,"wires":[]},{"id":"e942b9ba.7e2688","type":"chatbot-conversation","z":"3ab44c3f.7208e4","name":"","botDevelopment":"4c02f411.5d93bc","botProduction":"","chatId":"1111","userId":"","transport":"","store":"","x":670,"y":860,"wires":[["92c86ab5.531fe8"]]},{"id":"92c86ab5.531fe8","type":"function","z":"3ab44c3f.7208e4","name":"","func":"msg.payload.chatId = msg.payload.user.fields.chat_id;\n\nmsg.payload.type = \"message\";\nmsg.payload.content = `Please wait...\n`;\n\nreturn msg;","outputs":1,"noerr":0,"x":850,"y":860,"wires":[["821d8e8.4e4a37"]]},{"id":"821d8e8.4e4a37","type":"chatbot-telegram-send","z":"3ab44c3f.7208e4","bot":"784f1d9a.2a3ad4","botProduction":"","track":false,"passThrough":false,"outputs":0,"x":1050,"y":860,"wires":[]},{"id":"3c910f4d.b54fc","type":"debug","z":"3ab44c3f.7208e4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1290,"y":900,"wires":[]},{"id":"9279554e.00b808","type":"comment","z":"3ab44c3f.7208e4","name":"Ask for token swap","info":"","x":210,"y":1360,"wires":[]},{"id":"1e85b5e.fec3b4a","type":"subflow:e730b986.339628","z":"3ab44c3f.7208e4","name":"","env":[],"x":330,"y":1400,"wires":[["326aa3ab.c83c6c","760c8889.5b2288"]]},{"id":"fddef4dc.a18708","type":"chatbot-telegram-send","z":"3ab44c3f.7208e4","bot":"784f1d9a.2a3ad4","botProduction":"","track":false,"passThrough":false,"outputs":0,"x":1370,"y":1300,"wires":[]},{"id":"36bc0395.dee85c","type":"function","z":"3ab44c3f.7208e4","name":"Swap Button","func":"msg.payload.chatId = msg.payload.user.fields.chat_id;\nbuttons = [];\n\nbuttons.push(button = {\n\t\"type\": \"postback\",\n\t\"label\": `Swap ETH for C19 Tokens`,\n\t\"value\": `/swap`,\n\t\"style\": \"\"\n});\n\nmsg.payload.type = \"inline-buttons\";\nmsg.payload.content = `\nIn order to swap please make sure you have enough ETH at address ${msg.payload.user.account.fields.account_address}\n\n♢ETH balance: ${msg.payload.balance}\n🔆C19 balance: ${msg.payload.tokenBalance}\n`;\nmsg.payload.buttons = buttons;\n\nreturn msg;","outputs":1,"noerr":0,"x":1170,"y":1300,"wires":[["fddef4dc.a18708"]]},{"id":"bf328ee8.e105a","type":"link in","z":"3ab44c3f.7208e4","name":"In: ETH and Token Balance","links":[],"x":135,"y":1400,"wires":[[]]},{"id":"19187322.145ced","type":"switch","z":"3ab44c3f.7208e4","name":"","property":"payload.balance","propertyType":"msg","rules":[{"t":"gt","v":"gas_buffer","vt":"flow"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":710,"y":1380,"wires":[["ea599.d712ca67","c9766a45.268f38"],["fe0ff0b0.4cace"]]},{"id":"fe0ff0b0.4cace","type":"debug","z":"3ab44c3f.7208e4","name":"Not Enough ETH","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":930,"y":1420,"wires":[]},{"id":"326aa3ab.c83c6c","type":"debug","z":"3ab44c3f.7208e4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":410,"y":1360,"wires":[]},{"id":"ea599.d712ca67","type":"debug","z":"3ab44c3f.7208e4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":1300,"wires":[]},{"id":"760c8889.5b2288","type":"switch","z":"3ab44c3f.7208e4","name":"","property":"payload.error","propertyType":"msg","rules":[{"t":"istype","v":"undefined","vt":"undefined"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":550,"y":1400,"wires":[["19187322.145ced"],["f346830a.95e38"]]},{"id":"f346830a.95e38","type":"chatbot-conversation","z":"3ab44c3f.7208e4","name":"","botDevelopment":"24145e37.52cb02","botProduction":"","chatId":"1111","userId":"","transport":"telegram","store":"","x":290,"y":1460,"wires":[["aea9d20.36bd63"]]},{"id":"aea9d20.36bd63","type":"function","z":"3ab44c3f.7208e4","name":"","func":"msg.payload.chatId = msg.payload.user.fields.chat_id;\nbuttons = [];\n\n\nmsg.payload.type = \"message\";\nmsg.payload.content = msg.payload.error;\n\nreturn msg;","outputs":1,"noerr":0,"x":450,"y":1460,"wires":[["e1e48030.afe16"]]},{"id":"e1e48030.afe16","type":"chatbot-telegram-send","z":"3ab44c3f.7208e4","bot":"784f1d9a.2a3ad4","botProduction":"","track":false,"passThrough":false,"outputs":0,"x":630,"y":1460,"wires":[]},{"id":"c9766a45.268f38","type":"chatbot-conversation","z":"3ab44c3f.7208e4","name":"","botDevelopment":"24145e37.52cb02","botProduction":"","chatId":"1111","userId":"","transport":"telegram","store":"","x":990,"y":1300,"wires":[["36bc0395.dee85c"]]},{"id":"71c810b3.44156","type":"comment","z":"2d3e2335.2a164c","name":"Donate","info":"","x":250,"y":2260,"wires":[]},{"id":"795a2584.4eac3c","type":"comment","z":"2d3e2335.2a164c","name":"Transfer ETH to Address","info":"","x":330,"y":3020,"wires":[]},{"id":"e04641d1.c89b2","type":"chatbot-conversation","z":"3e3253ba.73217c","name":"","botDevelopment":"24145e37.52cb02","botProduction":"","chatId":"1111","userId":"","transport":"telegram","store":"","x":1770,"y":440,"wires":[["ba2f6a46.ac55d8"]]},{"id":"ba2f6a46.ac55d8","type":"function","z":"3e3253ba.73217c","name":"Token Deposit Success","func":"msg.payload.chatId = msg.payload.user.fields.chat_id;\nbuttons = [];\n\nbuttons.push(button = {\n\t\"type\": \"postback\",\n\t\"label\": `Account`,\n\t\"value\": `/account`,\n\t\"style\": \"\"\n});\n\nbuttons.push(button = {\n\t\"type\": \"postback\",\n\t\"label\": `Menu`,\n\t\"value\": `/menu`,\n\t\"style\": \"\"\n});\n\nbuttons.push(button = {\n\t\"type\": \"newline\"\n});\n\nbuttons.push({\n\t\"type\": \"url\",\n\t\"label\": \"View Transaction\",\n\t\"url\": `${global.get('ether_scan_url')}/tx/${msg.payload.response.hash}`,\n\t\"alert\": false,\n\t\"style\": \"\"\n});\n\n\n\nmsg.payload.type = \"inline-buttons\";\nmsg.payload.content = `We've initiated transaction to add a membership token to your account.`;\nmsg.payload.buttons = buttons;\n\nreturn msg;","outputs":1,"noerr":0,"x":2010,"y":440,"wires":[["467986a4.897678"]]},{"id":"aff7aa2.21f8d58","type":"debug","z":"3e3253ba.73217c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":730,"y":420,"wires":[]},{"id":"a1623a23.c38318","type":"link out","z":"2d3e2335.2a164c","name":"","links":["fde38021.ef774"],"x":2475,"y":1720,"wires":[]},{"id":"698dc584.b813fc","type":"link out","z":"2d3e2335.2a164c","name":"Out: Delete Previous Message","links":["ce132d60.5c711","21fac98a.f11ad6"],"x":555,"y":2980,"wires":[]},{"id":"fa5338f.85ab4c8","type":"link out","z":"2d3e2335.2a164c","name":"Out: Delete Previous Message","links":["ce132d60.5c711","21fac98a.f11ad6"],"x":1455,"y":3160,"wires":[]},{"id":"25dadc88.be5854","type":"link out","z":"2d3e2335.2a164c","name":"Out: Delete Previous Message","links":["ce132d60.5c711","21fac98a.f11ad6"],"x":935,"y":2420,"wires":[]},{"id":"edf75f8f.2354","type":"link out","z":"2d3e2335.2a164c","name":"Out: Delete Previous Message","links":["ce132d60.5c711","21fac98a.f11ad6"],"x":455,"y":2320,"wires":[]},{"id":"181eb9a1.4e9e46","type":"link out","z":"2d3e2335.2a164c","name":"Out: Delete Previous Message","links":["ce132d60.5c711","21fac98a.f11ad6"],"x":735,"y":320,"wires":[]},{"id":"2c0d07b4.9d29c8","type":"debug","z":"2d3e2335.2a164c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1690,"y":440,"wires":[]},{"id":"9dfd4554.3fc538","type":"function","z":"2d3e2335.2a164c","name":"Main Menu","func":"\nnotificationObj = {\n\t\"type\": \"postback\",\n\t\"label\": \"🔊 Enable Notifications\",\n\t\"value\": \"notification_on\",\n\t\"answer\": \"\",\n\t\"alert\": false,\n\t\"style\": \"\"\n}\n\n\nif(msg.payload.user.fields.notification === true){\n notificationObj.label = '🔇 Disable Notifications'\n notificationObj.value = \"notification_off\"\n}else{\n \n}\n\nmsg.payload.type = 'inline-buttons'\nmsg.payload.name = 'Main Menu'\nmsg.payload.content = '\\n\\nThanks for joining! Choose from the following options to interact with the Collab DAO and community!\\n\\n⛑️Membership - join and access members only features (vote, propose, and members chat)\\n\\n🙏 Donate to the Relief Fund - donate to add funds to be distributed to people and initiatives fighting Covid-19!\\n\\n💰Account - donate, upload, and withdraw ETH\\n\\n🤓Support - find technical support\\n\\n🌀Community Coordination - find community members, submit initiatives, this is where the coordination happens!\\n\\n🏦Proposal System - submit proposals for members to vote on. This is where the decision-making happens!\\n\\nClick the Membership button to donate to the relief fund and receive a C19 membership token to unlock the members only (MO) features!\\n\\nCall /collabinfo anytime to go through the overview.'\nmsg.payload.buttons = [{\n\t\t\"type\": \"postback\",\n\t\t\"label\": \"⛑️Join Membership\",\n\t\t\"value\": \"/membership\",\n\t\t\"answer\": \"\",\n\t\t\"alert\": false,\n\t\t\"style\": \"\"\n\t}, {\n\t\t\"type\": \"newline\"\n\t}, {\n\t\t\"type\": \"postback\",\n\t\t\"label\": \"🙏 Donate to the Relief Fund\",\n\t\t\"value\": \"/donate\",\n\t\t\"answer\": \"\",\n\t\t\"alert\": false,\n\t\t\"style\": \"\"\n\t}, {\n\t\t\"type\": \"newline\"\n\t}, notificationObj, \n\t{\n\t\t\"type\": \"url\",\n\t\t\"label\": \"🤓Support \",\n\t\t\"url\": \"https://t.me/AbridgedEA\",\n\t\t\"webViewHeightRatio\": \"tall\",\n\t\t\"extensions\": false,\n\t\t\"answer\": \"\",\n\t\t\"alert\": false\n\t}, {\n\t\t\"type\": \"newline\"\n\t}, {\n\t\t\"type\": \"postback\",\n\t\t\"label\": \"💰Account\",\n\t\t\"value\": \"/account\",\n\t\t\"answer\": \"\",\n\t\t\"alert\": false,\n\t\t\"style\": \"\"\n\t}, {\n\t\t\"type\": \"newline\"\n\t},\n\t{\n\t\t\"type\": \"postback\",\n\t\t\"label\": \"🌀Social Sub Menu\",\n\t\t\"value\": \"/socialmenu\",\n\t\t\"answer\": \"\",\n\t\t\"alert\": false,\n\t\t\"style\": \"\"\n\t}, {\n\t\t\"type\": \"newline\"\n\t},\n\t{\n\t\t\"type\": \"postback\",\n\t\t\"label\": \"🏦Proposal Sub Menu\",\n\t\t\"value\": \"/proposalmenu\",\n\t\t\"answer\": \"\",\n\t\t\"alert\": false,\n\t\t\"style\": \"\"\n\t}]\n\t\nreturn msg;","outputs":1,"noerr":0,"x":1630,"y":1380,"wires":[["8944325b.d33b3"]]},{"id":"1c3c761.65f6e8a","type":"chatbot-inline-buttons","z":"2d3e2335.2a164c","name":"Main menu","buttons":[{"type":"url","label":"🔆 DAO Interface","url":"https://mainnet.aragon.org/#/collab/home/","webViewHeightRatio":"tall","extensions":false,"answer":"","alert":false},{"type":"newline"},{"type":"postback","label":"🔊 Enable Notifications","value":"notifications","answer":"","alert":false,"style":""},{"type":"url","label":"🤗 Public Community","url":"https://t.me/joinchat/HcTaOxhr7mt9K7mBTMxlHw","webViewHeightRatio":"tall","extensions":false,"answer":"","alert":false},{"type":"newline"},{"type":"url","label":"📜 Info ","url":"https://www.collab19.live/","webViewHeightRatio":"tall","extensions":false,"answer":"","alert":false},{"type":"url","label":"💪 Support ","url":"https://t.me/AbridgedEA","webViewHeightRatio":"tall","extensions":false,"answer":"","alert":false},{"type":"newline"},{"type":"url","label":"Tokehholders Chat 🗣️","url":"https://t.me/joinchat/Hgw0mRy5uH3dDELcTSoeMw","webViewHeightRatio":"tall","extensions":false,"answer":"","alert":false},{"type":"postback","label":"💰Account","value":"/account","answer":"","alert":false,"style":""}],"message":"*UNDER ACTIVE DEVELOPMENT*\n\nThanks for joining! You now have access to propose how the community will spend funds available.\n\nChoose from the following options to further interact with the Collab DAO and community!","x":1790,"y":720,"wires":[[]]},{"id":"672c03f6.be73ac","type":"function","z":"2d3e2335.2a164c","name":"Update notification","func":"notification = msg.payload.content === 'notification_on' ? true : false\nmsg.payload.payload = [\n {\n \"id\": msg.payload.user.id,\n \"fields\": {\n \"notification\": notification\n }\n }\n]\nreturn msg;","outputs":1,"noerr":0,"x":1570,"y":760,"wires":[["e92bdb1f.9f2de8"]]},{"id":"e92bdb1f.9f2de8","type":"node-airtable","z":"2d3e2335.2a164c","name":"Update User","auth":"a65faee5.5fdcc","table":"user","tableType":"str","action":"put","filter":"","filterType":"msg","record":"payload.user","recordType":"msg","records":"payload.payload","recordsType":"msg","output":"payload.record","x":1830,"y":780,"wires":[[],[]]},{"id":"4c49b385.500eec","type":"link out","z":"2d3e2335.2a164c","name":"Out: New Proposal","links":["fb6f42bc.1f81c"],"x":1375,"y":800,"wires":[]},{"id":"fb6f42bc.1f81c","type":"link in","z":"2d3e2335.2a164c","name":"In: New Proposal","links":["4c49b385.500eec"],"x":155,"y":1160,"wires":[["1fbff352.12f38d"]]},{"id":"1fbff352.12f38d","type":"function","z":"2d3e2335.2a164c","name":"New proposal message","func":"msg.payload.content = `Format: <title> <forum link> \n\nFind more information in the Creating Proposals post here: https://forum.collab19.live/t/proposal-guidelines/16 (Max 25 char)\n\nHit /menu to cancel.\n`\nmsg.payload.type = 'buttons';\nmsg.payload.buttons = [{\n\t\"type\": \"keyboardButton\",\n\t\"label\": \"Main Menu\"\n}]\n\nreturn msg;","outputs":1,"noerr":0,"x":370,"y":1160,"wires":[["e4c2bc00.403c4"]]},{"id":"e4c2bc00.403c4","type":"chatbot-telegram-send","z":"2d3e2335.2a164c","bot":"784f1d9a.2a3ad4","botProduction":"","track":true,"passThrough":false,"outputs":1,"x":650,"y":1160,"wires":[["2c3bdc41.259234","6ad51ac3.f2da44"]]},{"id":"a48db6c0.3c7b18","type":"function","z":"2d3e2335.2a164c","name":"New proposal user's data","func":"temp = msg.payload.content;\n\nif(temp.length > 25){\n temp = temp.substring(0,25);\n}\n\nmsg.payload.proposalData = temp\n\nreturn msg;","outputs":1,"noerr":0,"x":1070,"y":1160,"wires":[["a89e8bd1.faa438"]]},{"id":"a89e8bd1.faa438","type":"link out","z":"2d3e2335.2a164c","name":"Out: Add Proposal","links":["21cd3401.08a05c","e74f48ea.765e48"],"x":1275,"y":1160,"wires":[]},{"id":"2c3bdc41.259234","type":"debug","z":"2d3e2335.2a164c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":870,"y":1220,"wires":[]},{"id":"9cf41a31.052bd8","type":"comment","z":"3867c68b.1306da","name":"Create New Voting Proposal","info":"","x":480,"y":900,"wires":[]},{"id":"71423983.aa0d28","type":"link out","z":"2d3e2335.2a164c","name":"Out: User Action","links":["8f8d1a0e.5ea838","4999a322.e67ebc"],"x":1435,"y":900,"wires":[]},{"id":"726de740.44f6a8","type":"debug","z":"3867c68b.1306da","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":2190,"y":460,"wires":[]},{"id":"ec16bbde.86b318","type":"comment","z":"3867c68b.1306da","name":"Voteing Flow","info":"","x":510,"y":420,"wires":[]},{"id":"6869ebec.bd8624","type":"link out","z":"3867c68b.1306da","name":"","links":["fde38021.ef774"],"x":1295,"y":540,"wires":[]},{"id":"b8b57679.dc1358","type":"link out","z":"3867c68b.1306da","name":"","links":["fde38021.ef774"],"x":1315,"y":1000,"wires":[]},{"id":"d3f97206.77163","type":"link out","z":"3867c68b.1306da","name":"","links":["fde38021.ef774"],"x":2195,"y":1020,"wires":[]},{"id":"c467075e.920658","type":"link out","z":"3867c68b.1306da","name":"","links":["fde38021.ef774"],"x":2055,"y":520,"wires":[]},{"id":"467986a4.897678","type":"link out","z":"3e3253ba.73217c","name":"","links":["fde38021.ef774"],"x":2195,"y":440,"wires":[]},{"id":"ae2dc658.b7dfa8","type":"link out","z":"2d3e2335.2a164c","name":"","links":["54eb3296.c8abac"],"x":335,"y":560,"wires":[]},{"id":"e8aacc02.15472","type":"link out","z":"3867c68b.1306da","name":"","links":["54eb3296.c8abac"],"x":775,"y":900,"wires":[]},{"id":"325386ea.770c0a","type":"link out","z":"3867c68b.1306da","name":"","links":["54eb3296.c8abac"],"x":1695,"y":820,"wires":[]},{"id":"eb1ee663.e46508","type":"link out","z":"3867c68b.1306da","name":"","links":["54eb3296.c8abac"],"x":635,"y":400,"wires":[]},{"id":"6987fb62.2c66e4","type":"link out","z":"3867c68b.1306da","name":"","links":["54eb3296.c8abac"],"x":1535,"y":320,"wires":[]},{"id":"ca6a8092.1d4f","type":"debug","z":"3e3253ba.73217c","name":"Token trf error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1500,"y":540,"wires":[]},{"id":"e6105c8c.14dd1","type":"link out","z":"3e3253ba.73217c","name":"","links":["fde38021.ef774"],"x":1715,"y":520,"wires":[]},{"id":"9486c4b.5c04338","type":"subflow:5c764a0d.f85564","z":"2d3e2335.2a164c","name":"","env":[],"x":1800,"y":860,"wires":[]},{"id":"144781f7.2b45ae","type":"function","z":"2d3e2335.2a164c","name":"","func":"msg.payload.chat_id = msg.payload.chatId;\nmsg.payload.message_id = msg.originalMessage.message_id - 1;\nreturn msg;","outputs":1,"noerr":0,"x":1580,"y":860,"wires":[["9486c4b.5c04338"]]},{"id":"2cc2fc64.6d7bb4","type":"subflow:5c764a0d.f85564","z":"2d3e2335.2a164c","name":"","env":[],"x":1000,"y":380,"wires":[]},{"id":"766ad09e.68f7b","type":"function","z":"2d3e2335.2a164c","name":"","func":"msg.payload.chat_id = msg.payload.chatId;\nmsg.payload.message_id = msg.originalMessage.message_id - 1;\nreturn msg;","outputs":1,"noerr":0,"x":790,"y":380,"wires":[["2cc2fc64.6d7bb4"]]},{"id":"7d11184f.f522d8","type":"switch","z":"2d3e2335.2a164c","name":"","property":"payload.content","propertyType":"msg","rules":[{"t":"eq","v":"/start","vt":"str"},{"t":"istype","v":"json","vt":"json"},{"t":"eq","v":"/menu","vt":"str"},{"t":"else"}],"checkall":"false","repair":false,"outputs":4,"x":410,"y":380,"wires":[[],[],[],["93a38472.f045d8"]]},{"id":"6ad51ac3.f2da44","type":"switch","z":"2d3e2335.2a164c","name":"","property":"payload.content","propertyType":"msg","rules":[{"t":"eq","v":"/cancel","vt":"str"},{"t":"eq","v":"Main Menu","vt":"str"},{"t":"eq","v":"/menu","vt":"str"},{"t":"eq","v":"/start","vt":"str"},{"t":"eq","v":"/help","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":6,"x":850,"y":1160,"wires":[["1589546d.5f0cbc"],["1589546d.5f0cbc"],["1589546d.5f0cbc"],["1589546d.5f0cbc"],["1589546d.5f0cbc"],["a48db6c0.3c7b18"]]},{"id":"93a38472.f045d8","type":"delay","z":"2d3e2335.2a164c","name":"","pauseType":"delay","timeout":"400","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":590,"y":380,"wires":[["181eb9a1.4e9e46"]]},{"id":"beb55e34.f3bc7","type":"switch","z":"507c6c45.0c62b4","name":"","property":"payload.type","propertyType":"msg","rules":[{"t":"eq","v":"message","vt":"str"},{"t":"eq","v":"event","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":470,"y":380,"wires":[["53a5a1f5.5a46f"],["cd9e13c1.44203"],[]]},{"id":"cd9e13c1.44203","type":"switch","z":"507c6c45.0c62b4","name":"","property":"payload.eventType","propertyType":"msg","rules":[{"t":"eq","v":"new-user","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":610,"y":420,"wires":[["ee09053a.56d9c8"],[]]},{"id":"ee09053a.56d9c8","type":"link out","z":"507c6c45.0c62b4","name":"Out: New User Event","links":["ba62cb34.3135a8"],"x":735,"y":420,"wires":[]},{"id":"ba62cb34.3135a8","type":"link in","z":"960930e5.d6aff","name":"In: New User Event","links":["ee09053a.56d9c8"],"x":180,"y":300,"wires":[["707a939c.75865c"]]},{"id":"1e4d4495.2ef3bb","type":"node-airtable","z":"960930e5.d6aff","name":"Get User","auth":"a65faee5.5fdcc","table":"user","tableType":"str","action":"list","filter":"payload.filter","filterType":"msg","record":"","recordType":"msg","records":"","recordsType":"msg","output":"payload.users","x":460,"y":300,"wires":[["92f7346e.1edc78"],[]]},{"id":"92f7346e.1edc78","type":"change","z":"960930e5.d6aff","name":"","rules":[{"t":"set","p":"payload.user","pt":"msg","to":"payload.users[0]","tot":"msg"},{"t":"delete","p":"payload.users","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":300,"wires":[["2f7ef948.5a2086"]]},{"id":"2f7ef948.5a2086","type":"switch","z":"960930e5.d6aff","name":"","property":"payload.user","propertyType":"msg","rules":[{"t":"istype","v":"undefined","vt":"undefined"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":850,"y":300,"wires":[["516d481d.80ad68","b461c491.4e9e08"],["ade3e91a.3a6018","1d92c7d3.3a69a8"]]},{"id":"707a939c.75865c","type":"function","z":"960930e5.d6aff","name":"","func":"msg.payload.filter = `({user_id} = '${msg.payload.userId.toString()}')`;\nreturn msg;","outputs":1,"noerr":0,"x":310,"y":300,"wires":[["1e4d4495.2ef3bb"]]},{"id":"516d481d.80ad68","type":"debug","z":"960930e5.d6aff","name":"Kick user out","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1070,"y":260,"wires":[]},{"id":"ade3e91a.3a6018","type":"debug","z":"960930e5.d6aff","name":"Check for token balance","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1110,"y":320,"wires":[]},{"id":"53d5575f.633b08","type":"switch","z":"960930e5.d6aff","name":"","property":"records.length","propertyType":"msg","rules":[{"t":"gt","v":"0","vt":"str"},{"t":"nempty"}],"checkall":"true","repair":false,"outputs":2,"x":810,"y":620,"wires":[["bf9838b8.8c4568"],[]]},{"id":"2d9013a8.2015bc","type":"node-airtable","z":"960930e5.d6aff","name":"List Active Users","auth":"a65faee5.5fdcc","table":"user","tableType":"str","action":"list","filter":"({status} = 'active')","filterType":"str","record":"payload.id","recordType":"msg","records":"","recordsType":"msg","output":"records","x":650,"y":600,"wires":[["53d5575f.633b08","fef6f322.0be31"],[]]},{"id":"c4459774.3d93a8","type":"function","z":"960930e5.d6aff","name":"","func":"\nreturn msg;","outputs":1,"noerr":0,"x":1170,"y":680,"wires":[["bf9838b8.8c4568","bc384216.a2af8"]]},{"id":"abb63e85.1be6d","type":"delay","z":"960930e5.d6aff","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1010,"y":680,"wires":[["c4459774.3d93a8"]]},{"id":"fef6f322.0be31","type":"debug","z":"960930e5.d6aff","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":810,"y":560,"wires":[]},{"id":"1d4b5490.fa1bfb","type":"link out","z":"960930e5.d6aff","name":"","links":["8ab47d39.91299"],"x":1495,"y":680,"wires":[]},{"id":"bf9838b8.8c4568","type":"array-loop","z":"960930e5.d6aff","name":"","key":"123","keyType":"msg","reset":false,"resetValue":"value-null","array":"records","arrayType":"msg","x":1030,"y":620,"wires":[["891c680a.568b98"],["abb63e85.1be6d"]]},{"id":"e7b83c8a.ee4b8","type":"function","z":"960930e5.d6aff","name":"Token address cache","func":"tokenAddress = flow.get('token_address');\nif(tokenAddress === undefined){\n tokenAddress = {};\n}\nflow.set('token_address', tokenAddress);\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":600,"wires":[["2d9013a8.2015bc"]]},{"id":"6a4bc665.6d9128","type":"function","z":"960930e5.d6aff","name":"Token address cache","func":"tokenAddress = flow.get('token_address');\ntokenAddress = {};\nflow.set('token_address', tokenAddress);\nreturn msg;","outputs":1,"noerr":0,"x":1400,"y":600,"wires":[[]]},{"id":"891c680a.568b98","type":"delay","z":"960930e5.d6aff","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1200,"y":600,"wires":[["6a4bc665.6d9128"]]},{"id":"381891b7.66840e","type":"comment","z":"960930e5.d6aff","name":"Runs every 5 mins","info":"","x":230,"y":540,"wires":[]},{"id":"7a41e597.10475c","type":"inject","z":"960930e5.d6aff","name":"","topic":"","payload":"{}","payloadType":"json","repeat":"300","crontab":"","once":true,"onceDelay":"3","x":210,"y":580,"wires":[["e7b83c8a.ee4b8"]]},{"id":"ac2ba7dd.39b9e8","type":"inject","z":"960930e5.d6aff","name":"","topic":"","payload":"{}","payloadType":"json","repeat":"","crontab":"","once":true,"onceDelay":"2","x":210,"y":620,"wires":[[]]},{"id":"ba123ed9.361cd","type":"node-airtable","z":"960930e5.d6aff","name":"Get Account","auth":"a65faee5.5fdcc","table":"accounts","tableType":"str","action":"get","filter":"","filterType":"msg","record":"payload.user.fields.account[0]","recordType":"msg","records":"payload.payload","recordsType":"msg","output":"payload.user.account","x":410,"y":1080,"wires":[["6787c8ae.db9ea8"],["b00b01c6.a271c"]]},{"id":"8ab47d39.91299","type":"link in","z":"960930e5.d6aff","name":"","links":["1d4b5490.fa1bfb","1d92c7d3.3a69a8"],"x":235,"y":1080,"wires":[["ba123ed9.361cd"]]},{"id":"6787c8ae.db9ea8","type":"change","z":"960930e5.d6aff","name":"","rules":[{"t":"set","p":"payload.network","pt":"msg","to":"network","tot":"global"},{"t":"set","p":"payload.address_contract","pt":"msg","to":"address_c19_token","tot":"global"},{"t":"set","p":"payload.abi","pt":"msg","to":"abi_erc20","tot":"global"},{"t":"set","p":"payload.address","pt":"msg","to":"payload.user.account.fields.account_address","tot":"msg"},{"t":"set","p":"payload.userId","pt":"msg","to":"payload.user.fields.user_id","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":1040,"wires":[["1fde43e6.bb239c"]]},{"id":"1fde43e6.bb239c","type":"subflow:9e5e594a.494868","z":"960930e5.d6aff","name":"","env":[],"x":860,"y":1040,"wires":[["7f6a4ac.4a213b4"]]},{"id":"68b34fe.9e7bfb","type":"function","z":"f3b533a7.b8e5b","name":"","func":"const Telegram = global.get('telegram');\nconst token = msg.payload.token;\n\nconst telegram = new Telegram(token, {\n agent: null, // https.Agent instance, allows custom proxy, certificate, keep alive, etc.\n webhookReply: true // Reply via webhook\n})\n\nasync function getChatMember() {\n try{\n const result = await telegram.kickChatMember(msg.payload.chatId, msg.payload.userId);\n msg.payload.result = result;\n node.send(msg);\n node.done();\n }catch(error){\n msg.payload.error = error;\n node.send(msg);\n node.done();\n }\n \n}\n\ngetChatMember();\n\n\nreturn","outputs":1,"noerr":0,"x":510,"y":320,"wires":[[]]},{"id":"54d4b29b.aebd9c","type":"debug","z":"f3b533a7.b8e5b","name":"Kick Chat Member","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":510,"y":380,"wires":[]},{"id":"7f6a4ac.4a213b4","type":"switch","z":"960930e5.d6aff","name":"","property":"payload.tokenBalance","propertyType":"msg","rules":[{"t":"gte","v":"0.5","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1050,"y":1040,"wires":[["c841b70d.25aa88"],["b00b01c6.a271c"]]},{"id":"b00b01c6.a271c","type":"change","z":"960930e5.d6aff","name":"","rules":[{"t":"set","p":"payload.token","pt":"msg","to":"token_telegram_bot","tot":"global"},{"t":"set","p":"payload.chatId","pt":"msg","to":"group_chat_id","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":1100,"wires":[["cd9c8e5d.b69c9","c32344e9.fa5158"]]},{"id":"c32344e9.fa5158","type":"subflow:f3b533a7.b8e5b","z":"960930e5.d6aff","name":"","env":[],"x":1050,"y":1100,"wires":[["35c72e1.e4c05d2","2e9021de.b05fae"]]},{"id":"35c72e1.e4c05d2","type":"debug","z":"960930e5.d6aff","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1070,"y":1140,"wires":[]},{"id":"2e9021de.b05fae","type":"switch","z":"960930e5.d6aff","name":"","property":"payload.result","propertyType":"msg","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1270,"y":1100,"wires":[["8774274f.d24148","e48cc47.faca538"],["8774274f.d24148"]]},{"id":"e48cc47.faca538","type":"function","z":"960930e5.d6aff","name":"Set banned","func":"\nmsg.payload.record = [\n {\n \"id\": msg.payload.user.id,\n \"fields\": {\n \"status\":\"banned\"\n }\n }\n]\n\nreturn msg;","outputs":1,"noerr":0,"x":1470,"y":1080,"wires":[["4b875586.2c6d0c"]]},{"id":"8774274f.d24148","type":"debug","z":"960930e5.d6aff","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1470,"y":1120,"wires":[]},{"id":"4b875586.2c6d0c","type":"node-airtable","z":"960930e5.d6aff","name":"Upate user table","auth":"a65faee5.5fdcc","table":"user","tableType":"str","action":"put","filter":"","filterType":"msg","record":"payload.record","recordType":"msg","records":"payload.record","recordsType":"msg","output":"payload.result","x":1660,"y":1080,"wires":[[],[]]},{"id":"a8d9b6c8.ac6b18","type":"debug","z":"960930e5.d6aff","name":"Group Manager: Token Balance","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":970,"y":980,"wires":[]},{"id":"cd9c8e5d.b69c9","type":"debug","z":"960930e5.d6aff","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":850,"y":1140,"wires":[]},{"id":"7a8be440.23508c","type":"debug","z":"960930e5.d6aff","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":410,"y":1020,"wires":[]},{"id":"bc384216.a2af8","type":"change","z":"960930e5.d6aff","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"payload.user","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1370,"y":680,"wires":[["1d4b5490.fa1bfb"]]},{"id":"40d8870d.95ac18","type":"link in","z":"960930e5.d6aff","name":"","links":["b461c491.4e9e08"],"x":675,"y":1140,"wires":[["b00b01c6.a271c"]]},{"id":"b461c491.4e9e08","type":"link out","z":"960930e5.d6aff","name":"","links":["40d8870d.95ac18"],"x":995,"y":220,"wires":[]},{"id":"1d92c7d3.3a69a8","type":"link out","z":"960930e5.d6aff","name":"","links":["8ab47d39.91299"],"x":975,"y":360,"wires":[]},{"id":"53a5a1f5.5a46f","type":"switch","z":"507c6c45.0c62b4","name":"","property":"originalMessage.chat.type","propertyType":"msg","rules":[{"t":"eq","v":"private","vt":"str"},{"t":"eq","v":"supergroup","vt":"str"},{"t":"eq","v":"group","vt":"str"},{"t":"eq","v":"otherwise","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":670,"y":340,"wires":[["c7c2caf5.d22378"],[],[],[]]},{"id":"c841b70d.25aa88","type":"function","z":"960930e5.d6aff","name":"Set Active if not","func":"if(msg.payload.user.fields.status !== 'active'){\n msg.payload.record = [\n {\n \"id\": msg.payload.user.id,\n \"fields\": {\n \"status\":\"active\"\n }\n }\n ]\n return msg;\n}\nreturn;\n","outputs":1,"noerr":0,"x":1240,"y":1020,"wires":[["4e9ea3ab.a7527c"]]},{"id":"4e9ea3ab.a7527c","type":"node-airtable","z":"960930e5.d6aff","name":"Upate user table","auth":"a65faee5.5fdcc","table":"user","tableType":"str","action":"put","filter":"","filterType":"msg","record":"payload.record","recordType":"msg","records":"payload.record","recordsType":"msg","output":"payload.result","x":1440,"y":1020,"wires":[[],[]]},{"id":"481a3b9e.42be44","type":"function","z":"5c764a0d.f85564","name":"Delete Message","func":"const Telegram = global.get('telegram');\nconst token = msg.payload.token;\n\nconst telegram = new Telegram(token, {\n agent: null, // https.Agent instance, allows custom proxy, certificate, keep alive, etc.\n webhookReply: true // Reply via webhook\n})\n\nasync function deleteMessage() {\n try{\n const result = await telegram.deleteMessage(msg.payload.chatId, msg.payload.message_id);\n msg.payload.result = result;\n node.send(msg);\n node.done();\n }catch(error){\n msg.payload.error = error;\n node.send(msg);\n node.done();\n }\n \n}\n\ndeleteMessage();\n\n\nreturn","outputs":1,"noerr":0,"x":520,"y":180,"wires":[[]]},{"id":"80cfd10d.15c5","type":"change","z":"5c764a0d.f85564","name":"","rules":[{"t":"set","p":"payload.token","pt":"msg","to":"token_telegram_bot","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":180,"wires":[["481a3b9e.42be44"]]},{"id":"deec242c.9469b8","type":"inject","z":"960930e5.d6aff","name":"","topic":"","payload":"{}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":310,"y":1660,"wires":[["87d8ffb4.6e726"]]},{"id":"87d8ffb4.6e726","type":"change","z":"960930e5.d6aff","name":"","rules":[{"t":"set","p":"payload.userId","pt":"msg","to":"531448013","tot":"str"},{"t":"set","p":"payload.chatId","pt":"msg","to":"group_chat_id","tot":"global"},{"t":"set","p":"payload.token","pt":"msg","to":"token_telegram_bot","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":1660,"wires":[["1076ae93.743cb1"]]},{"id":"1076ae93.743cb1","type":"function","z":"960930e5.d6aff","name":"","func":"const Telegram = global.get('telegram');\nconst token = msg.payload.token;\n\nconst telegram = new Telegram(token, {\n agent: null, // https.Agent instance, allows custom proxy, certificate, keep alive, etc.\n webhookReply: true // Reply via webhook\n})\n\nasync function getChatMember() {\n try{\n const result = await telegram.unbanChatMember(msg.payload.chatId, msg.payload.userId);\n msg.payload.result = result;\n node.send(msg);\n node.done();\n }catch(error){\n msg.payload.error = error;\n node.send(msg);\n node.done();\n }\n \n}\n\ngetChatMember();\n\n\nreturn","outputs":1,"noerr":0,"x":770,"y":1640,"wires":[["4a16cfbc.2793c"]]},{"id":"4a16cfbc.2793c","type":"debug","z":"960930e5.d6aff","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":970,"y":1640,"wires":[]},{"id":"b1661bd6.5b4998","type":"link in","z":"960930e5.d6aff","name":"In: Unban User","links":["de83564c.097c08"],"x":275,"y":1580,"wires":[["e13aec4.df9581"]]},{"id":"de83564c.097c08","type":"link out","z":"2d3e2335.2a164c","name":"Out: Unban user","links":["b1661bd6.5b4998"],"x":1055,"y":780,"wires":[]},{"id":"e13aec4.df9581","type":"switch","z":"960930e5.d6aff","name":"","property":"payload.user.fields.status","propertyType":"msg","rules":[{"t":"eq","v":"banned","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":390,"y":1580,"wires":[["b150fec3.cf8b"],[]]},{"id":"b150fec3.cf8b","type":"change","z":"960930e5.d6aff","name":"","rules":[{"t":"set","p":"payload.chatId","pt":"msg","to":"group_chat_id","tot":"global"},{"t":"set","p":"payload.token","pt":"msg","to":"token_telegram_bot","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":1580,"wires":[["1076ae93.743cb1"]]},{"id":"6fdb49a1.c0b108","type":"link in","z":"2d3e2335.2a164c","name":"In: Membership Prep","links":["b8c16c1e.080fb"],"x":155,"y":1380,"wires":[["d9fa160f.09a248"]]},{"id":"d9fa160f.09a248","type":"function","z":"2d3e2335.2a164c","name":"Membership Prep","func":"buttons = [];\nbuttons.push(button = {\n\t\"type\": \"postback\",\n\t\"label\": \"Continue\",\n\t\"value\": \"/addeth\",\n\t\"answer\": \"\",\n\t\"alert\": false,\n\t\"style\": \"\"\n }, {\n\t\t\"type\": \"url\",\n\t\t\"label\": \"Learn More\",\n\t\t\"url\": \"https://collab19.live/\",\n\t\t\"webViewHeightRatio\": \"tall\",\n\t\t\"extensions\": false,\n\t\t\"answer\": \"\",\n\t\t\"alert\": false\n\t})\n\nmsg.payload.type = \"inline-buttons\";\ntokenBalance = msg.payload.tokenBalance === undefined ? 0 : msg.payload.tokenBalance;\n\n\nmsg.payload.content = `\nTo officially join, new members must add at least $10USD of ETH to their Collab19 account and then submit a donation to the relief fund.\n\nAfter this, your account will receive the DAO membership token (C19).\n`;\n\nmsg.payload.buttons = buttons;\n\nreturn msg;","outputs":1,"noerr":0,"x":350,"y":1380,"wires":[["b527a9a8.849e68"]]},{"id":"b8c16c1e.080fb","type":"link out","z":"2d3e2335.2a164c","name":"Out: Membership Prep","links":["6fdb49a1.c0b108"],"x":1335,"y":840,"wires":[]},{"id":"b527a9a8.849e68","type":"chatbot-telegram-send","z":"2d3e2335.2a164c","bot":"784f1d9a.2a3ad4","botProduction":"","track":false,"passThrough":false,"outputs":0,"x":570,"y":1380,"wires":[]},{"id":"9694a737.4e3408","type":"link out","z":"2d3e2335.2a164c","name":"Fund","links":["d5592c4d.fc9c6","78bbb92.ac31248","b5d9a821.499668"],"x":1415,"y":820,"wires":[]},{"id":"1589546d.5f0cbc","type":"link out","z":"2d3e2335.2a164c","name":"Outt: Trf to input node","links":["746831b9.0fdea"],"x":975,"y":1100,"wires":[]},{"id":"746831b9.0fdea","type":"link in","z":"507c6c45.0c62b4","name":"In: Recursive Node","links":["1589546d.5f0cbc","6f35458.bf0d2bc","5181fe75.41f97","6ffd056f.e4a26c","47d3fde.79e2504","c31abf63.1cdcc","b9e389f9.d6d878","b7be0ade.529398"],"x":555,"y":280,"wires":[["53a5a1f5.5a46f"]]},{"id":"59787336.02dacc","type":"switch","z":"2d3e2335.2a164c","name":"","property":"payload.content","propertyType":"msg","rules":[{"t":"eq","v":"/cancel","vt":"str"},{"t":"eq","v":"/menu","vt":"str"},{"t":"eq","v":"Main Menu","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":4,"x":690,"y":3080,"wires":[["6f35458.bf0d2bc"],["6f35458.bf0d2bc"],["6f35458.bf0d2bc"],["e1366015.34164"]]},{"id":"6f35458.bf0d2bc","type":"link out","z":"2d3e2335.2a164c","name":"Outt: Trf to input node","links":["746831b9.0fdea"],"x":815,"y":3020,"wires":[]},{"id":"6d3b2265.f31a5c","type":"switch","z":"2d3e2335.2a164c","name":"","property":"payload.content","propertyType":"msg","rules":[{"t":"eq","v":"/cancel","vt":"str"},{"t":"eq","v":"/menu","vt":"str"},{"t":"eq","v":"Main Menu","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":4,"x":590,"y":2280,"wires":[["5181fe75.41f97"],["5181fe75.41f97"],["5181fe75.41f97"],["c86016f1.4ffda8"]]},{"id":"5181fe75.41f97","type":"link out","z":"2d3e2335.2a164c","name":"Outt: Trf to input node","links":["746831b9.0fdea"],"x":715,"y":2220,"wires":[]},{"id":"54893cd1.1373d4","type":"function","z":"fd7a3a71.e58138","name":"AWS KMS","func":"awsClientNode = global.get('aws_client_node');\nAWS = global.get('AWS');\n\n\nAWS.config.accessKeyId = global.get('AWS_ACCESS_KEY_ID')\nAWS.config.secretAccessKey = global.get('AWS_SECREAT_ACCESS_KEY')\n\nconst { KmsKeyringNode, encrypt, decrypt } = awsClientNode\n/* Start by constructing a keyring. We'll create a KMS keyring.\n * Specify an AWS Key Management Service (AWS KMS) customer master key (CMK) to be the\n * generator key in the keyring. This CMK generates a data key and encrypts it. \n * To use the keyring to encrypt data, you need kms:GenerateDataKey permission \n * on this CMK. To decrypt, you need kms:Decrypt permission. \n */\nconst generatorKeyId = global.get('KMS_GENERATOR_KEY_ID')\n\n/* You can specify additional CMKs for the keyring. The data key that the generator key\n * creates is also encrypted by the additional CMKs you specify. To encrypt data, \n * you need kms:Encrypt permission on this CMK. To decrypt, you need kms:Decrypt permission.\n */\nconst keyIds = [global.get('KMS_KEY_ID')]\n\n/* Create the KMS keyring */\nconst keyring = new KmsKeyringNode({ generatorKeyId, keyIds })\n\n/* Set an encryption context For more information: \n * https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context\n */\nconst context = {\n stage: 'prod',\n purpose: 'encrypt pks',\n origin: 'us-east-2'\n}\n\n\nasync function encryptKey(cleartext) {\n try{\n const { result } = await encrypt(keyring, cleartext, { context })\n msg.payload.encryptedData = JSON.stringify(result)\n }catch(error){\n msg.payload.error = error;\n }\n node.send(msg);\n node.done();\n}\n\nasync function decryptKey(encryptedData) {\n try{\n const { plaintext, messageHeader } = await decrypt(keyring, encryptedData)\n msg.payload.decryptedData = String.fromCharCode.apply(null, plaintext);\n }catch(error){\n msg.payload.error = error;\n }\n node.send(msg);\n node.done();\n \n}\n\nif(msg.payload.action === 'ENCRYPT'){\n encryptKey(msg.payload.data);\n}else if(msg.payload.action === 'DECRYPT'){\n json = JSON.parse(msg.payload.data);\n var buf = Buffer.from(json.data);\n decryptKey(buf);\n}\n\nreturn;","outputs":1,"noerr":0,"x":430,"y":360,"wires":[[]]},{"id":"fce869f3.c46b18","type":"inject","z":"fd7a3a71.e58138","name":"","topic":"","payload":"{}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":480,"wires":[[]]},{"id":"85a6505c.08fc9","type":"debug","z":"fd7a3a71.e58138","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":650,"y":200,"wires":[]},{"id":"77887c1e.1569e4","type":"subflow:fd7a3a71.e58138","z":"2d3e2335.2a164c","name":"","env":[],"x":1900,"y":500,"wires":[["4e8ce51a.d9ef1c"]]},{"id":"2ed3a1ba.cd163e","type":"change","z":"2d3e2335.2a164c","name":"Encrypt PK","rules":[{"t":"set","p":"payload.action","pt":"msg","to":"ENCRYPT","tot":"str"},{"t":"set","p":"payload.data","pt":"msg","to":"payload.sdkPayload.privateKey","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1710,"y":500,"wires":[["77887c1e.1569e4"]]},{"id":"67fb087d.d9f7e8","type":"debug","z":"2d3e2335.2a164c","name":"Error During Exceptation","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1810,"y":620,"wires":[]},{"id":"8f17f38c.efe59","type":"change","z":"6b23cad2.b43514","name":"","rules":[{"t":"set","p":"payload.action","pt":"msg","to":"DECRYPT","tot":"str"},{"t":"set","p":"payload.data","pt":"msg","to":"payload.user.account.fields.pk","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":280,"wires":[["48d2df41.33cee"]]},{"id":"48d2df41.33cee","type":"subflow:fd7a3a71.e58138","z":"6b23cad2.b43514","name":"","env":[],"x":760,"y":280,"wires":[["2f7a35d2.4f7b9a"]]},{"id":"2f7a35d2.4f7b9a","type":"change","z":"6b23cad2.b43514","name":"","rules":[{"t":"set","p":"payload.user.account.fields.pk","pt":"msg","to":"payload.decryptedData","tot":"msg"},{"t":"delete","p":"payload.action","pt":"msg"},{"t":"delete","p":"payload.decryptedData","pt":"msg"},{"t":"delete","p":"payload.data","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":980,"y":280,"wires":[[]]},{"id":"4f7fe652.5efe48","type":"subflow:6b23cad2.b43514","z":"3867c68b.1306da","name":"","x":1550,"y":480,"wires":[["32b61554.2f925a"]]},{"id":"b4ffed7.88ea81","type":"debug","z":"2d3e2335.2a164c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1020,"y":2100,"wires":[]},{"id":"7507c062.faee3","type":"subflow:6b23cad2.b43514","z":"3867c68b.1306da","name":"","x":1670,"y":960,"wires":[["24d08dc.7c63472"]]},{"id":"d5947d57.e3653","type":"subflow:6b23cad2.b43514","z":"2d3e2335.2a164c","name":"","x":1210,"y":2700,"wires":[["f180ad86.c81e8"]]},{"id":"eb107697.1c2738","type":"subflow:6b23cad2.b43514","z":"2d3e2335.2a164c","name":"","env":[],"x":610,"y":2020,"wires":[["52eec2e1.320a6c"]]},{"id":"87dd9373.2b32","type":"switch","z":"6b23cad2.b43514","name":"","property":"payload.user.account.fields.pk","propertyType":"msg","rules":[{"t":"istype","v":"json","vt":"json"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":310,"y":320,"wires":[["8f17f38c.efe59"],[]]},{"id":"d5a29573.08eb08","type":"switch","z":"2d3e2335.2a164c","name":"","property":"payload.balance","propertyType":"msg","rules":[{"t":"gt","v":"0","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1050,"y":1500,"wires":[["321a02d6.d3d4ae"],[]]},{"id":"5f14be1b.780d6","type":"link out","z":"2d3e2335.2a164c","name":"","links":["4eb90528.73573c"],"x":1355,"y":1460,"wires":[]},{"id":"60c671a.6e0609","type":"debug","z":"2d3e2335.2a164c","name":"Already Tried","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1410,"y":1500,"wires":[]},{"id":"321a02d6.d3d4ae","type":"function","z":"2d3e2335.2a164c","name":"","func":"posted = flow.get(msg.payload.userId.toString());\nif(posted === undefined){\n flow.set(msg.payload.userId.toString(), true);\n return [msg, null]\n}\nreturn [null, msg ] ;","outputs":2,"noerr":0,"x":1210,"y":1500,"wires":[["5f14be1b.780d6"],["60c671a.6e0609"]]},{"id":"d6e933c6.27aee","type":"comment","z":"960930e5.d6aff","name":"Unban user","info":"","x":330,"y":1520,"wires":[]},{"id":"21fac98a.f11ad6","type":"link in","z":"32ecfd36.7ca7a2","name":"In: Delete Previous Message","links":["68af27fc.4d9758","698dc584.b813fc","fa5338f.85ab4c8","25dadc88.be5854","edf75f8f.2354","181eb9a1.4e9e46","3171a65c.19fd5a","4e9515da.15483c","fc202f07.8d269","114c8548.e2816b","5005358a.1c545c","44bb7554.6a97cc"],"x":215,"y":500,"wires":[["2e82adb3.f3d642"]]},{"id":"2e82adb3.f3d642","type":"change","z":"32ecfd36.7ca7a2","name":"","rules":[{"t":"set","p":"payload.chat_id","pt":"msg","to":"payload.chatId","tot":"msg"},{"t":"set","p":"payload.message_id","pt":"msg","to":"originalMessage.message_id","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":500,"wires":[["935f7338.bac1f"]]},{"id":"935f7338.bac1f","type":"subflow:5c764a0d.f85564","z":"32ecfd36.7ca7a2","name":"","env":[],"x":600,"y":500,"wires":[]},{"id":"e45bc2b3.282a2","type":"inject","z":"3ab44c3f.7208e4","name":"Uniswap Factry ABI","topic":"","payload":"[{\"name\":\"NewExchange\",\"inputs\":[{\"type\":\"address\",\"name\":\"token\",\"indexed\":true},{\"type\":\"address\",\"name\":\"exchange\",\"indexed\":true}],\"anonymous\":false,\"type\":\"event\"},{\"name\":\"initializeFactory\",\"outputs\":[],\"inputs\":[{\"type\":\"address\",\"name\":\"template\"}],\"constant\":false,\"payable\":false,\"type\":\"function\",\"gas\":35725},{\"name\":\"createExchange\",\"outputs\":[{\"type\":\"address\",\"name\":\"out\"}],\"inputs\":[{\"type\":\"address\",\"name\":\"token\"}],\"constant\":false,\"payable\":false,\"type\":\"function\",\"gas\":187911},{\"name\":\"getExchange\",\"outputs\":[{\"type\":\"address\",\"name\":\"out\"}],\"inputs\":[{\"type\":\"address\",\"name\":\"token\"}],\"constant\":true,\"payable\":false,\"type\":\"function\",\"gas\":715},{\"name\":\"getToken\",\"outputs\":[{\"type\":\"address\",\"name\":\"out\"}],\"inputs\":[{\"type\":\"address\",\"name\":\"exchange\"}],\"constant\":true,\"payable\":false,\"type\":\"function\",\"gas\":745},{\"name\":\"getTokenWithId\",\"outputs\":[{\"type\":\"address\",\"name\":\"out\"}],\"inputs\":[{\"type\":\"uint256\",\"name\":\"token_id\"}],\"constant\":true,\"payable\":false,\"type\":\"function\",\"gas\":736},{\"name\":\"exchangeTemplate\",\"outputs\":[{\"type\":\"address\",\"name\":\"out\"}],\"inputs\":[],\"constant\":true,\"payable\":false,\"type\":\"function\",\"gas\":633},{\"name\":\"tokenCount\",\"outputs\":[{\"type\":\"uint256\",\"name\":\"out\"}],\"inputs\":[],\"constant\":true,\"payable\":false,\"type\":\"function\",\"gas\":663}]","payloadType":"json","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":480,"y":60,"wires":[["6459ec27.567234"]]},{"id":"6459ec27.567234","type":"json","z":"3ab44c3f.7208e4","name":"","property":"payload","action":"obj","pretty":false,"x":710,"y":60,"wires":[["c4229488.7dd168"]]},{"id":"c4229488.7dd168","type":"change","z":"3ab44c3f.7208e4","name":"Abi Uniswap: Factory","rules":[{"t":"set","p":"abi_uniswap_exchange_factory","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":940,"y":60,"wires":[[]]},{"id":"fc8bceb9.e5406","type":"inject","z":"3ab44c3f.7208e4","name":"Abi Uniswap Exchange","topic":"","payload":"[{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"min_liquidity\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"max_tokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"addLiquidity\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"min_tokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"ethToTokenSwapInput\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_bought\",\"type\":\"uint256\"}],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_bought\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"ethToTokenSwapOutput\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"eth_sold\",\"type\":\"uint256\"}],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"min_tokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"ethToTokenTransferInput\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_bought\",\"type\":\"uint256\"}],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_bought\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"ethToTokenTransferOutput\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"eth_sold\",\"type\":\"uint256\"}],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"factoryAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"factory\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"eth_sold\",\"type\":\"uint256\"}],\"name\":\"getEthToTokenInputPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_bought\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_bought\",\"type\":\"uint256\"}],\"name\":\"getEthToTokenOutputPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"eth_sold\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_sold\",\"type\":\"uint256\"}],\"name\":\"getTokenToEthInputPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"eth_bought\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"eth_bought\",\"type\":\"uint256\"}],\"name\":\"getTokenToEthOutputPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_sold\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"min_eth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"min_tokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"removeLiquidity\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"token_addr\",\"type\":\"address\"}],\"name\":\"setup\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"tokenAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_sold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"min_eth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"tokenToEthSwapInput\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"eth_bought\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"eth_bought\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"max_tokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"}],\"name\":\"tokenToEthSwapOutput\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_sold\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_sold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"min_eth\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"tokenToEthTransferInput\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"eth_bought\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"eth_bought\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"max_tokens\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"name\":\"tokenToEthTransferOutput\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_sold\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_sold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"min_tokens_bought\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"min_eth_bought\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"exchange_addr\",\"type\":\"address\"}],\"name\":\"tokenToExchangeSwapInput\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_bought\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_bought\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"max_tokens_sold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"max_eth_sold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"exchange_addr\",\"type\":\"address\"}],\"name\":\"tokenToExchangeSwapOutput\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_sold\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_sold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"min_tokens_bought\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"min_eth_bought\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"exchange_addr\",\"type\":\"address\"}],\"name\":\"tokenToExchangeTransferInput\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_bought\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_bought\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"max_tokens_sold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"max_eth_sold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"exchange_addr\",\"type\":\"address\"}],\"name\":\"tokenToExchangeTransferOutput\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_sold\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_sold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"min_tokens_bought\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"min_eth_bought\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"token_addr\",\"type\":\"address\"}],\"name\":\"tokenToTokenSwapInput\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_bought\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_bought\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"max_tokens_sold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"max_eth_sold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"token_addr\",\"type\":\"address\"}],\"name\":\"tokenToTokenSwapOutput\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_sold\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_sold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"min_tokens_bought\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"min_eth_bought\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token_addr\",\"type\":\"address\"}],\"name\":\"tokenToTokenTransferInput\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_bought\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_bought\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"max_tokens_sold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"max_eth_sold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token_addr\",\"type\":\"address\"}],\"name\":\"tokenToTokenTransferOutput\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"tokens_sold\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]","payloadType":"json","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":490,"y":140,"wires":[["b533351b.7fb348"]]},{"id":"b533351b.7fb348","type":"json","z":"3ab44c3f.7208e4","name":"","property":"payload","action":"obj","pretty":false,"x":710,"y":140,"wires":[["6270f858.2ddd08"]]},{"id":"6270f858.2ddd08","type":"change","z":"3ab44c3f.7208e4","name":"Abi Uniswap: Exchange","rules":[{"t":"set","p":"abi_exchange_uniswap","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":140,"wires":[[]]},{"id":"b70b50c0.dae11","type":"comment","z":"e769bed0.7d2b7","name":"Update airtable keys in this table config. (DO NOT DELETE, JUST UPDATE)","info":"","x":380,"y":140,"wires":[]},{"id":"a62378e7.0b5248","type":"node-airtable","z":"e769bed0.7d2b7","name":"Airtable Config","auth":"a65faee5.5fdcc","table":"user","tableType":"str","action":"list","filter":"","filterType":"msg","record":"payload.id","recordType":"msg","records":"","recordsType":"msg","output":"","x":200,"y":200,"wires":[[],[]]},{"id":"cfeae5bd.b59f58","type":"chatbot-telegram-receive","z":"e769bed0.7d2b7","bot":"784f1d9a.2a3ad4","botProduction":"","x":430,"y":200,"wires":[[]]},{"id":"949be9fb.0fe4f8","type":"inject","z":"e769bed0.7d2b7","name":"Aragon voting app abi","topic":"","payload":"{\"environments\":{\"default\":{\"registry\":\"0x5f6f7e8cc7346a11ca2def8f827b7a0b612c56a1\",\"appName\":\"voting.aragonpm.eth\",\"network\":\"rpc\"},\"rinkeby\":{\"registry\":\"0x98Df287B6C145399Aaa709692c8D308357bC085D\",\"appName\":\"voting.aragonpm.eth\",\"network\":\"rinkeby\"},\"staging\":{\"registry\":\"0xfe03625ea880a8cba336f9b5ad6e15b0a3b5a939\",\"appName\":\"voting.aragonpm.eth\",\"network\":\"rinkeby\"},\"mainnet\":{\"registry\":\"0x314159265dd8dbb310642f98f50c066173c1259b\",\"appName\":\"voting.aragonpm.eth\",\"network\":\"mainnet\"},\"ropsten\":{\"registry\":\"0x6afe2cacee211ea9179992f89dc61ff25c61e923\",\"appName\":\"voting.aragonpm.eth\",\"network\":\"ropsten\"},\"rinkeby-old\":{\"registry\":\"0xfbae32d1cde62858bc45f51efc8cc4fa1415447e\",\"appName\":\"voting.aragonpm.eth\",\"network\":\"rinkeby\"}},\"roles\":[{\"name\":\"Create new votes\",\"id\":\"CREATE_VOTES_ROLE\",\"params\":[],\"bytes\":\"0xe7dcd7275292e064d090fbc5f3bd7995be23b502c1fed5cd94cfddbbdcd32bbc\"},{\"name\":\"Modify support\",\"id\":\"MODIFY_SUPPORT_ROLE\",\"params\":[\"New support\",\"Current support\"],\"bytes\":\"0xda3972983e62bdf826c4b807c4c9c2b8a941e1f83dfa76d53d6aeac11e1be650\"},{\"name\":\"Modify quorum\",\"id\":\"MODIFY_QUORUM_ROLE\",\"params\":[\"New quorum\",\"Current quorum\"],\"bytes\":\"0xad15e7261800b4bb73f1b69d3864565ffb1fd00cb93cf14fe48da8f1f2149f39\"}],\"path\":\"contracts/Voting.sol\",\"appName\":\"voting.aragonpm.eth\",\"env\":{\"registry\":\"0x98Df287B6C145399Aaa709692c8D308357bC085D\",\"appName\":\"voting.aragonpm.eth\",\"network\":\"rinkeby\"},\"appId\":\"0x9fa3927f639745e587912d4b0fea7ef9013bf93fb907d29faeab57417ba6e1d4\",\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"hasInitialized\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_script\",\"type\":\"bytes\"}],\"name\":\"getEVMScriptExecutor\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getRecoveryVault\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"MODIFY_QUORUM_ROLE\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"MODIFY_SUPPORT_ROLE\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"token\",\"type\":\"address\"}],\"name\":\"allowRecoverability\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"appId\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getInitializationBlock\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"transferToVault\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_sender\",\"type\":\"address\"},{\"name\":\"_role\",\"type\":\"bytes32\"},{\"name\":\"_params\",\"type\":\"uint256[]\"}],\"name\":\"canPerform\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getEVMScriptRegistry\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"voteTime\",\"outputs\":[{\"name\":\"\",\"type\":\"uint64\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"CREATE_VOTES_ROLE\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"kernel\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"minAcceptQuorumPct\",\"outputs\":[{\"name\":\"\",\"type\":\"uint64\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"isPetrified\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"votesLength\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"supportRequiredPct\",\"outputs\":[{\"name\":\"\",\"type\":\"uint64\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"PCT_BASE\",\"outputs\":[{\"name\":\"\",\"type\":\"uint64\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"voteId\",\"type\":\"uint256\"},{\"indexed\":true,\"name\":\"creator\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"metadata\",\"type\":\"string\"}],\"name\":\"StartVote\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"voteId\",\"type\":\"uint256\"},{\"indexed\":true,\"name\":\"voter\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"supports\",\"type\":\"bool\"},{\"indexed\":false,\"name\":\"stake\",\"type\":\"uint256\"}],\"name\":\"CastVote\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"voteId\",\"type\":\"uint256\"}],\"name\":\"ExecuteVote\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"supportRequiredPct\",\"type\":\"uint64\"}],\"name\":\"ChangeSupportRequired\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"minAcceptQuorumPct\",\"type\":\"uint64\"}],\"name\":\"ChangeMinQuorum\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"executor\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"script\",\"type\":\"bytes\"},{\"indexed\":false,\"name\":\"input\",\"type\":\"bytes\"},{\"indexed\":false,\"name\":\"returnData\",\"type\":\"bytes\"}],\"name\":\"ScriptResult\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"vault\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RecoverToVault\",\"type\":\"event\"},{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"},{\"name\":\"_supportRequiredPct\",\"type\":\"uint64\"},{\"name\":\"_minAcceptQuorumPct\",\"type\":\"uint64\"},{\"name\":\"_voteTime\",\"type\":\"uint64\"}],\"name\":\"initialize\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_supportRequiredPct\",\"type\":\"uint64\"}],\"name\":\"changeSupportRequiredPct\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_minAcceptQuorumPct\",\"type\":\"uint64\"}],\"name\":\"changeMinAcceptQuorumPct\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_executionScript\",\"type\":\"bytes\"},{\"name\":\"_metadata\",\"type\":\"string\"}],\"name\":\"newVote\",\"outputs\":[{\"name\":\"voteId\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_executionScript\",\"type\":\"bytes\"},{\"name\":\"_metadata\",\"type\":\"string\"},{\"name\":\"_castVote\",\"type\":\"bool\"},{\"name\":\"_executesIfDecided\",\"type\":\"bool\"}],\"name\":\"newVote\",\"outputs\":[{\"name\":\"voteId\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_voteId\",\"type\":\"uint256\"},{\"name\":\"_supports\",\"type\":\"bool\"},{\"name\":\"_executesIfDecided\",\"type\":\"bool\"}],\"name\":\"vote\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_voteId\",\"type\":\"uint256\"}],\"name\":\"executeVote\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"isForwarder\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_evmScript\",\"type\":\"bytes\"}],\"name\":\"forward\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_sender\",\"type\":\"address\"},{\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"canForward\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_voteId\",\"type\":\"uint256\"}],\"name\":\"canExecute\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_voteId\",\"type\":\"uint256\"},{\"name\":\"_voter\",\"type\":\"address\"}],\"name\":\"canVote\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_voteId\",\"type\":\"uint256\"}],\"name\":\"getVote\",\"outputs\":[{\"name\":\"open\",\"type\":\"bool\"},{\"name\":\"executed\",\"type\":\"bool\"},{\"name\":\"startDate\",\"type\":\"uint64\"},{\"name\":\"snapshotBlock\",\"type\":\"uint64\"},{\"name\":\"supportRequired\",\"type\":\"uint64\"},{\"name\":\"minAcceptQuorum\",\"type\":\"uint64\"},{\"name\":\"yea\",\"type\":\"uint256\"},{\"name\":\"nay\",\"type\":\"uint256\"},{\"name\":\"votingPower\",\"type\":\"uint256\"},{\"name\":\"script\",\"type\":\"bytes\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_voteId\",\"type\":\"uint256\"},{\"name\":\"_voter\",\"type\":\"address\"}],\"name\":\"getVoterState\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"functions\":[{\"sig\":\"initialize(address,uint64,uint64,uint64)\",\"roles\":[],\"notice\":\"Initialize Voting app with `_token.symbol(): string` for governance, minimum support of `@formatPct(_supportRequiredPct)`%, minimum acceptance quorum of `@formatPct(_minAcceptQuorumPct)`%, and a voting duration of `@transformTime(_voteTime)`\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"},{\"name\":\"_supportRequiredPct\",\"type\":\"uint64\"},{\"name\":\"_minAcceptQuorumPct\",\"type\":\"uint64\"},{\"name\":\"_voteTime\",\"type\":\"uint64\"}],\"name\":\"initialize\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"changeSupportRequiredPct(uint64)\",\"roles\":[\"MODIFY_SUPPORT_ROLE\"],\"notice\":\"Change required support to `@formatPct(_supportRequiredPct)`%\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_supportRequiredPct\",\"type\":\"uint64\"}],\"name\":\"changeSupportRequiredPct\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"changeMinAcceptQuorumPct(uint64)\",\"roles\":[\"MODIFY_QUORUM_ROLE\"],\"notice\":\"Change minimum acceptance quorum to `@formatPct(_minAcceptQuorumPct)`%\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_minAcceptQuorumPct\",\"type\":\"uint64\"}],\"name\":\"changeMinAcceptQuorumPct\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"newVote(bytes,string)\",\"roles\":[\"CREATE_VOTES_ROLE\"],\"notice\":\"Create a new vote about \\\"`_metadata`\\\"\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_executionScript\",\"type\":\"bytes\"},{\"name\":\"_metadata\",\"type\":\"string\"}],\"name\":\"newVote\",\"outputs\":[{\"name\":\"voteId\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"newVote(bytes,string,bool,bool)\",\"roles\":[\"CREATE_VOTES_ROLE\"],\"notice\":\"Create a new vote about \\\"`_metadata`\\\"\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_executionScript\",\"type\":\"bytes\"},{\"name\":\"_metadata\",\"type\":\"string\"},{\"name\":\"_castVote\",\"type\":\"bool\"},{\"name\":\"_executesIfDecided\",\"type\":\"bool\"}],\"name\":\"newVote\",\"outputs\":[{\"name\":\"voteId\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"vote(uint256,bool,bool)\",\"roles\":[],\"notice\":\"Vote `_supports ? 'yes' : 'no'` in vote #`_voteId`\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_voteId\",\"type\":\"uint256\"},{\"name\":\"_supports\",\"type\":\"bool\"},{\"name\":\"_executesIfDecided\",\"type\":\"bool\"}],\"name\":\"vote\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"executeVote(uint256)\",\"roles\":[],\"notice\":\"Execute vote #`_voteId`\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_voteId\",\"type\":\"uint256\"}],\"name\":\"executeVote\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"forward(bytes)\",\"roles\":[],\"notice\":\"Creates a vote to execute the desired action, and casts a support vote if possible\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_evmScript\",\"type\":\"bytes\"}],\"name\":\"forward\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}}],\"deprecatedFunctions\":{}}","payloadType":"json","repeat":"","crontab":"","once":true,"onceDelay":"0.2","x":240,"y":880,"wires":[["d332af10.b3eae"]]},{"id":"d332af10.b3eae","type":"json","z":"e769bed0.7d2b7","name":"","property":"payload.data","action":"obj","pretty":false,"x":450,"y":880,"wires":[["266ebcc4.6944d4"]]},{"id":"266ebcc4.6944d4","type":"change","z":"e769bed0.7d2b7","name":"abi aragon app voting","rules":[{"t":"set","p":"abi_aragon_app_voting","pt":"global","to":"payload.abi","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":880,"wires":[[]]},{"id":"962134c7.649a28","type":"inject","z":"e769bed0.7d2b7","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":210,"y":340,"wires":[["20c5b321.f4008c"]]},{"id":"20c5b321.f4008c","type":"change","z":"e769bed0.7d2b7","name":"","rules":[{"t":"set","p":"maintenance","pt":"global","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":340,"wires":[[]]},{"id":"3628b302.62b67c","type":"inject","z":"e769bed0.7d2b7","name":"Set Bot Token","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":220,"y":280,"wires":[["a6524761.d84628"]]},{"id":"a6524761.d84628","type":"change","z":"e769bed0.7d2b7","name":"","rules":[{"t":"set","p":"token_telegram_bot","pt":"global","to":"958026503:AAFsjXW-9cE7wDdOKk4MfY2Fu6DrUhQ-NWo","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":280,"wires":[[]]},{"id":"8a8cca36.625fb8","type":"inject","z":"e769bed0.7d2b7","name":"Set: Mainnet / Kovan","topic":"","payload":"{\"_comment\":\"change kovan/mainnet\",\"network\":\"mainnet\"}","payloadType":"json","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":240,"y":500,"wires":[["3fcaf149.bf46be"]]},{"id":"1139fe7c.bd90c2","type":"change","z":"e769bed0.7d2b7","name":"Kovan Const","rules":[{"t":"set","p":"wyre_account_id","pt":"global","to":"","tot":"str"},{"t":"set","p":"queryProviderEndPoint","pt":"global","to":"","tot":"str"},{"t":"set","p":"network","pt":"global","to":"kovan","tot":"str"},{"t":"set","p":"wyre_link","pt":"global","to":"https://pay.testwyre.com/purchase","tot":"str"},{"t":"set","p":"address_contract_uniswap_exchange","pt":"global","to":"0xD3E51Ef092B2845f10401a0159B2B96e8B6c3D30","tot":"str"},{"t":"set","p":"ether_scan_url","pt":"global","to":"https://kovan.etherscan.io","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":540,"wires":[["50fd6c07.441ea4"]]},{"id":"3fcaf149.bf46be","type":"switch","z":"e769bed0.7d2b7","name":"","property":"payload.network","propertyType":"msg","rules":[{"t":"eq","v":"mainnet","vt":"str"},{"t":"eq","v":"kovan","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":450,"y":500,"wires":[["6c7d3a85.afc844","88bc79.11609388"],["1139fe7c.bd90c2","6c8b447a.90ed2c"]]},{"id":"6c7d3a85.afc844","type":"change","z":"e769bed0.7d2b7","name":"Mainnet Conts","rules":[{"t":"set","p":"network","pt":"global","to":"mainnet","tot":"str"},{"t":"set","p":"queryProviderEndPoint","pt":"global","to":"","tot":"str"},{"t":"set","p":"wyre_account_id","pt":"global","to":"","tot":"str"},{"t":"set","p":"wyre_link","pt":"global","to":"https://pay.sendwyre.com/purchase","tot":"str"},{"t":"set","p":"ether_scan_url","pt":"global","to":"https://etherscan.io","tot":"str"},{"t":"set","p":"address_c19_voting_app","pt":"global","to":"","tot":"str"},{"t":"set","p":"address_c19_finance","pt":"global","to":"","tot":"str"},{"t":"set","p":"address_contract_uniswap_exchange","pt":"global","to":"0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95","tot":"str"},{"t":"set","p":"address_token_manager","pt":"global","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":460,"wires":[["50fd6c07.441ea4"]]},{"id":"50fd6c07.441ea4","type":"change","z":"e769bed0.7d2b7","name":"Common Consts","rules":[{"t":"set","p":"wyre_default_amount","pt":"global","to":"0","tot":"num"},{"t":"set","p":"min_eth","pt":"global","to":"0.0","tot":"num"},{"t":"set","p":"SDK_ACTION_SET_AUTH_KEY","pt":"global","to":"SDK_ACTION_SET_AUTH_KEY","tot":"str"},{"t":"set","p":"SDK_ACTION_EXECUTE_TRX","pt":"global","to":"SDK_ACTION_EXECUTE_TRX","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":970,"y":500,"wires":[["a3328cd.579a77"]]},{"id":"88bc79.11609388","type":"debug","z":"e769bed0.7d2b7","name":"FLOW: Mainnet","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":700,"y":420,"wires":[]},{"id":"6c8b447a.90ed2c","type":"debug","z":"e769bed0.7d2b7","name":"FLOW: Kovan","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":700,"y":580,"wires":[]},{"id":"a3328cd.579a77","type":"change","z":"e769bed0.7d2b7","name":"","rules":[{"t":"set","p":"address_c19_token","pt":"global","to":"","tot":"str"},{"t":"set","p":"c19_app_url","pt":"global","to":"https://mainnet.aragon.org/#/","tot":"str"},{"t":"set","p":"gas_buffer","pt":"flow","to":"0.05","tot":"str"},{"t":"set","p":"min_eth_for_gas_fee","pt":"global","to":"0.005","tot":"str"},{"t":"set","p":"donation_address","pt":"global","to":"","tot":"str"},{"t":"set","p":"group_chat_id","pt":"global","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1200,"y":500,"wires":[["8c50b57c.171f68"]]},{"id":"d675ad8.b0a315","type":"inject","z":"e769bed0.7d2b7","name":"ERC20 Abi","topic":"","payload":"[{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_spender\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_from\",\"type\":\"address\"},{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"name\":\"balance\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"},{\"name\":\"_spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"}]","payloadType":"json","repeat":"","crontab":"","once":true,"onceDelay":"0.2","x":210,"y":800,"wires":[["d14d55ac.60fad8"]]},{"id":"d14d55ac.60fad8","type":"json","z":"e769bed0.7d2b7","name":"","property":"payload","action":"obj","pretty":false,"x":450,"y":800,"wires":[["e76f7c76.a2cad"]]},{"id":"e76f7c76.a2cad","type":"change","z":"e769bed0.7d2b7","name":"Abi ERC20","rules":[{"t":"set","p":"abi_erc20","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":800,"wires":[[]]},{"id":"5e59d8d1.997a68","type":"inject","z":"3ab44c3f.7208e4","name":"Aragon token app abi","topic":"","payload":"{\"environments\":{\"default\":{\"registry\":\"0x5f6f7e8cc7346a11ca2def8f827b7a0b612c56a1\",\"appName\":\"token-manager.aragonpm.eth\",\"network\":\"rpc\"},\"rinkeby\":{\"registry\":\"0x98Df287B6C145399Aaa709692c8D308357bC085D\",\"appName\":\"token-manager.aragonpm.eth\",\"network\":\"rinkeby\"},\"staging\":{\"registry\":\"0xfe03625ea880a8cba336f9b5ad6e15b0a3b5a939\",\"appName\":\"token-manager.aragonpm.eth\",\"network\":\"rinkeby\"},\"mainnet\":{\"registry\":\"0x314159265dd8dbb310642f98f50c066173c1259b\",\"appName\":\"token-manager.aragonpm.eth\",\"network\":\"mainnet\"},\"ropsten\":{\"registry\":\"0x6afe2cacee211ea9179992f89dc61ff25c61e923\",\"appName\":\"token-manager.aragonpm.eth\",\"network\":\"ropsten\"},\"rinkeby-old\":{\"registry\":\"0xfbae32d1cde62858bc45f51efc8cc4fa1415447e\",\"appName\":\"token-manager.aragonpm.eth\",\"network\":\"rinkeby\"}},\"roles\":[{\"name\":\"Mint tokens\",\"id\":\"MINT_ROLE\",\"params\":[\"Receiver\",\"Token amount\"],\"bytes\":\"0x154c00819833dac601ee5ddded6fda79d9d8b506b911b3dbd54cdb95fe6c3686\"},{\"name\":\"Issue tokens\",\"id\":\"ISSUE_ROLE\",\"params\":[\"Token amount\"],\"bytes\":\"0x2406f1e99f79cea012fb88c5c36566feaeefee0f4b98d3a376b49310222b53c4\"},{\"name\":\"Assign tokens\",\"id\":\"ASSIGN_ROLE\",\"params\":[\"Receiver\",\"Token amount\"],\"bytes\":\"0xf5a08927c847d7a29dc35e105208dbde5ce951392105d712761cc5d17440e2ff\"},{\"name\":\"Revoke vesting\",\"id\":\"REVOKE_VESTINGS_ROLE\",\"params\":[\"Holder\"],\"bytes\":\"0x95ffc68daedf1eb334cfcd22ee24a5eeb5a8e58aa40679f2ad247a84140f8d6e\"},{\"name\":\"Burn tokens\",\"id\":\"BURN_ROLE\",\"params\":[\"Holder\",\"Token amount\"],\"bytes\":\"0xe97b137254058bd94f28d2f3eb79e2d34074ffb488d042e3bc958e0a57d2fa22\"}],\"path\":\"contracts/TokenManager.sol\",\"appName\":\"token-manager.aragonpm.eth\",\"env\":{\"registry\":\"0x98Df287B6C145399Aaa709692c8D308357bC085D\",\"appName\":\"token-manager.aragonpm.eth\",\"network\":\"rinkeby\"},\"appId\":\"0x6b20a3010614eeebf2138ccec99f028a61c811b3b1a3343b6ff635985c75c91f\",\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"hasInitialized\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"MAX_VESTINGS_PER_ADDRESS\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_script\",\"type\":\"bytes\"}],\"name\":\"getEVMScriptExecutor\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getRecoveryVault\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"appId\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"ISSUE_ROLE\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getInitializationBlock\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"}],\"name\":\"vestingsLengths\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"transferToVault\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_sender\",\"type\":\"address\"},{\"name\":\"_role\",\"type\":\"bytes32\"},{\"name\":\"_params\",\"type\":\"uint256[]\"}],\"name\":\"canPerform\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getEVMScriptRegistry\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"ASSIGN_ROLE\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"BURN_ROLE\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"kernel\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"isPetrified\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"MINT_ROLE\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"maxAccountTokens\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"REVOKE_VESTINGS_ROLE\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"token\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"vestingId\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"NewVesting\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"vestingId\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"nonVestedAmount\",\"type\":\"uint256\"}],\"name\":\"RevokeVesting\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"executor\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"script\",\"type\":\"bytes\"},{\"indexed\":false,\"name\":\"input\",\"type\":\"bytes\"},{\"indexed\":false,\"name\":\"returnData\",\"type\":\"bytes\"}],\"name\":\"ScriptResult\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"vault\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RecoverToVault\",\"type\":\"event\"},{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"},{\"name\":\"_transferable\",\"type\":\"bool\"},{\"name\":\"_maxAccountTokens\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_receiver\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"issue\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_receiver\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"assign\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_holder\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_receiver\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"},{\"name\":\"_start\",\"type\":\"uint64\"},{\"name\":\"_cliff\",\"type\":\"uint64\"},{\"name\":\"_vested\",\"type\":\"uint64\"},{\"name\":\"_revokable\",\"type\":\"bool\"}],\"name\":\"assignVested\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_holder\",\"type\":\"address\"},{\"name\":\"_vestingId\",\"type\":\"uint256\"}],\"name\":\"revokeVesting\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_from\",\"type\":\"address\"},{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"onTransfer\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"\",\"type\":\"address\"},{\"name\":\"\",\"type\":\"address\"},{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"onApprove\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"\",\"type\":\"address\"}],\"name\":\"proxyPayment\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"isForwarder\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_evmScript\",\"type\":\"bytes\"}],\"name\":\"forward\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_sender\",\"type\":\"address\"},{\"name\":\"\",\"type\":\"bytes\"}],\"name\":\"canForward\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_recipient\",\"type\":\"address\"},{\"name\":\"_vestingId\",\"type\":\"uint256\"}],\"name\":\"getVesting\",\"outputs\":[{\"name\":\"amount\",\"type\":\"uint256\"},{\"name\":\"start\",\"type\":\"uint64\"},{\"name\":\"cliff\",\"type\":\"uint64\"},{\"name\":\"vesting\",\"type\":\"uint64\"},{\"name\":\"revokable\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_holder\",\"type\":\"address\"}],\"name\":\"spendableBalanceOf\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_holder\",\"type\":\"address\"},{\"name\":\"_time\",\"type\":\"uint256\"}],\"name\":\"transferableBalance\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"allowRecoverability\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"functions\":[{\"sig\":\"initialize(address,bool,uint256)\",\"roles\":[],\"notice\":\"Initialize Token Manager for `_token.symbol(): string`, whose tokens are `_transferable ? '' : 'not'` transferable`_maxAccountTokens > 0 ? ' and limited to a maximum of ' + @tokenAmount(_token, _maxAccountTokens, false) + ' per account' : ''`\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"},{\"name\":\"_transferable\",\"type\":\"bool\"},{\"name\":\"_maxAccountTokens\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"mint(address,uint256)\",\"roles\":[\"MINT_ROLE\"],\"notice\":\"Mint `@tokenAmount(self.token(): address, _amount, false)` tokens for `_receiver`\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_receiver\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"mint\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"issue(uint256)\",\"roles\":[\"ISSUE_ROLE\"],\"notice\":\"Mint `@tokenAmount(self.token(): address, _amount, false)` tokens for the Token Manager\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"issue\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"assign(address,uint256)\",\"roles\":[\"ASSIGN_ROLE\"],\"notice\":\"Assign `@tokenAmount(self.token(): address, _amount, false)` tokens to `_receiver` from the Token Manager's holdings\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_receiver\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"assign\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"burn(address,uint256)\",\"roles\":[\"BURN_ROLE\"],\"notice\":\"Burn `@tokenAmount(self.token(): address, _amount, false)` tokens from `_holder`\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_holder\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"burn\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"assignVested(address,uint256,uint64,uint64,uint64,bool)\",\"roles\":[\"ASSIGN_ROLE\"],\"notice\":\"Assign `@tokenAmount(self.token(): address, _amount, false)` tokens to `_receiver` from the Token Manager's holdings with a `_revokable : 'revokable' : ''` vesting starting at `@formatDate(_start)`, cliff at `@formatDate(_cliff)` (first portion of tokens transferable), and completed vesting at `@formatDate(_vested)` (all tokens transferable)\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_receiver\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"},{\"name\":\"_start\",\"type\":\"uint64\"},{\"name\":\"_cliff\",\"type\":\"uint64\"},{\"name\":\"_vested\",\"type\":\"uint64\"},{\"name\":\"_revokable\",\"type\":\"bool\"}],\"name\":\"assignVested\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"revokeVesting(address,uint256)\",\"roles\":[\"REVOKE_VESTINGS_ROLE\"],\"notice\":\"Revoke vesting #`_vestingId` from `_holder`, returning unvested tokens to the Token Manager\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_holder\",\"type\":\"address\"},{\"name\":\"_vestingId\",\"type\":\"uint256\"}],\"name\":\"revokeVesting\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"onTransfer(address,address,uint256)\",\"roles\":[],\"notice\":null,\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_from\",\"type\":\"address\"},{\"name\":\"_to\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"onTransfer\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"onApprove(address,address,uint256)\",\"roles\":[],\"notice\":null,\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"\",\"type\":\"address\"},{\"name\":\"\",\"type\":\"address\"},{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"onApprove\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"proxyPayment(address)\",\"roles\":[],\"notice\":null,\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"\",\"type\":\"address\"}],\"name\":\"proxyPayment\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"}},{\"sig\":\"forward(bytes)\",\"roles\":[],\"notice\":\"Execute desired action as a token holder\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_evmScript\",\"type\":\"bytes\"}],\"name\":\"forward\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}}],\"deprecatedFunctions\":{\"1.0.0\":[{\"sig\":\"onTransfer(address,address,uint)\",\"roles\":[],\"notice\":null},{\"sig\":\"onApprove(address,address,uint)\",\"roles\":[],\"notice\":null}]}}","payloadType":"json","repeat":"","crontab":"","once":true,"onceDelay":"0.2","x":1240,"y":140,"wires":[["f4f7be9b.8d95a"]]},{"id":"f4f7be9b.8d95a","type":"json","z":"3ab44c3f.7208e4","name":"","property":"payload.data","action":"obj","pretty":false,"x":1450,"y":140,"wires":[["b0566036.404fc"]]},{"id":"b0566036.404fc","type":"change","z":"3ab44c3f.7208e4","name":"abi aragon app token","rules":[{"t":"set","p":"abi_aragon_app_token","pt":"global","to":"payload.abi","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1660,"y":140,"wires":[[]]},{"id":"af5311d8.3686f","type":"comment","z":"e769bed0.7d2b7","name":"Set global constants","info":"","x":230,"y":440,"wires":[]},{"id":"40f930c0.b7a4b","type":"link out","z":"2d3e2335.2a164c","name":"","links":["fde38021.ef774"],"x":2775,"y":580,"wires":[]},{"id":"eb277809.2f35c8","type":"subflow:e730b986.339628","z":"3867c68b.1306da","name":"","env":[],"x":790,"y":1340,"wires":[["a0fd5ad9.cd6e68","d6228afc.230ca8"]]},{"id":"d6228afc.230ca8","type":"function","z":"3867c68b.1306da","name":"Create Funding Proposal","func":"ethers = global.get(\"ethers\");\nweb3_eth_abi = global.get('web3_eth_abi');\n\nnode.warn({\"web3_eth_abi\" : web3_eth_abi});\n\nconst abi_voting = global.get(\"abi_aragon_app_voting\");\nconst abi_finance = global.get(\"abi_aragon_app_finance\");\nconst CALLSCRIPT_ID = '0x00000001';\n\nconst { /*tokenAddress, */ recipient, amount, optionalData } = msg.payload.fundingProposalData;\n\nconst requestedFund = ethers.utils.parseEther(amount);\n\nconst tokenAddress = \"0x6b175474e89094c44da98b954eedeac495271d0f\"; // dai address mainnet\n\nconst from = msg.payload.user.account.fields.account_address;\nconst aragonFinanceContractAddress = global.get('address_c19_finance'); // finance contract address\nconst VOTING_APP_ID = global.get('address_c19_voting_app');\n\n// we may want to convert amount to parse ether\n\nif(msg.payload.balance <= global.get('min_eth_for_gas_fee')){\n msg.payload.error = 'Please make sure to have enough ETH to pay for gas fee.';\n return [null, msg];\n}\n\nfunction encodeCallScript(actions) {\n return actions.reduce((script, { to, data }) => {\n const address = web3_eth_abi.encodeParameter('address', to)\n const dataLength = web3_eth_abi.encodeParameter('uint256', (data.length - 2) / 2).toString('hex')\n\n return script + address.slice(26) + dataLength.slice(58) + data.slice(2)\n }, CALLSCRIPT_ID)\n}\n\nfunction encodeData() {\n // call newImmediatePayment on finance abi to encode data with 4 parms \n let iface = new ethers.utils.Interface(abi_finance);\n // ETH/TOKEN address, receiver's address, amount (001000000000000000), optional data \"\"\n let args = [tokenAddress, recipient, requestedFund, optionalData];\n \n let encodedData = iface.functions['newImmediatePayment'].encode(args);\n node.warn({'[ Abi Encoded Data (newImmediatePayment) ]': encodedData})\n\n const dataToEncode = [\n { from: from, to: aragonFinanceContractAddress, data: encodedData }\n ];\n\n let firstEncodedData = encodeCallScript(dataToEncode);\n node.warn({'[ First Scrript Encoded Data ]': firstEncodedData});\n\n const forwardEncoded = encodeForward(firstEncodedData);\n node.warn({'[ Abi Encoded Data (forward) ]' : forwardEncoded });\n //encode script again\n const action = [{\n to: VOTING_APP_ID,\n data: forwardEncoded\n }]\n const result = encodeCallScript(action);\n node.warn({'[ Second Script Encoded Data ]' : result });\n return result;\n \n}\n\nfunction encodeForward(data) {\n let iface = new ethers.utils.Interface(abi_voting);\n let args = [data];\n let encodedData = iface.functions['forward'].encode(args);\n return encodedData;\n}\n\n_executtionScript = encodeData();\n\nmsg.payload.config = {\n \"recipient\" : \"0x9231549259236b5A8C74A7B537308AcdC0d1fa3f\",\n abi: abi_voting,\n \"apiCall\" : \"forward\",\n \"args\" : [_executtionScript],\n \"value\" : \"0x0\"\n};\n\nreturn [ msg, null ];\n\n","outputs":2,"noerr":0,"x":1070,"y":1340,"wires":[["50964c5a.626c44","374fb0fa.49c59"],["9dad9541.b34468","2c104af.6afb9b6"]]},{"id":"9dad9541.b34468","type":"function","z":"3867c68b.1306da","name":"","func":"msg.payload.chatId = msg.payload.user.fields.chat_id;\n\nmsg.payload.type = \"message\";\nmsg.payload.content = `${msg.payload.error}\n\nETH balance: ${msg.payload.balance}\nC19 Token balance: ${msg.payload.tokenBalance}\nAccount address: ${msg.payload.user.account.fields.account_address}\n`;\n\nreturn msg;","outputs":1,"noerr":0,"x":1290,"y":1440,"wires":[["389135e5.f949aa"]]},{"id":"374fb0fa.49c59","type":"subflow:48d0467c.b38be8","z":"3867c68b.1306da","name":"","env":[],"x":1310,"y":1340,"wires":[["10f8a0ec.4970ff","ba0d480e.7ccb48"]]},{"id":"61c2eaa7.e8a154","type":"change","z":"3867c68b.1306da","name":"","rules":[{"t":"set","p":"payload.sdkPayload.debug","pt":"msg","to":"true","tot":"bool"},{"t":"set","p":"payload.network","pt":"msg","to":"network","tot":"global"},{"t":"set","p":"payload.sdkPayload.address","pt":"msg","to":"payload.user.account.fields.account_address","tot":"msg"},{"t":"set","p":"payload.sdkPayload.privateKey","pt":"msg","to":"payload.user.account.fields.pk","tot":"msg"},{"t":"set","p":"payload.sdkPayload.action","pt":"msg","to":"SDK_ACTION_EXECUTE_TRX","tot":"global"},{"t":"set","p":"payload.sdkPayload.queryProviderEndPoint","pt":"msg","to":"queryProviderEndPoint","tot":"global"},{"t":"set","p":"payload.sdkPayload.value","pt":"msg","to":"payload.config.value","tot":"msg"},{"t":"set","p":"msg.payload.sdkPayload.recipient","pt":"msg","to":"payload.config.recipient","tot":"msg"},{"t":"set","p":"payload.sdkPayload.data","pt":"msg","to":"payload.config.encodedData","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1720,"y":1340,"wires":[["129a21c1.b1545e","f2563a7e.3141f8"]]},{"id":"f2563a7e.3141f8","type":"subflow:c67eccc4.042ec","z":"3867c68b.1306da","name":"","env":[],"x":1960,"y":1340,"wires":[["49f1ebb5.80f344","975fe2.46bf402"]]},{"id":"49f1ebb5.80f344","type":"switch","z":"3867c68b.1306da","name":"","property":"payload.sdkPayload.done","propertyType":"msg","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":1730,"y":1400,"wires":[["2ca44d2e.daddf2"]]},{"id":"2ca44d2e.daddf2","type":"function","z":"3867c68b.1306da","name":"Proposal Result","func":"msg.payload.chatId = msg.payload.user.fields.chat_id;\n\nif(msg.payload.sdkPayload.error === undefined){\n \n buttons = [];\n buttons.push({\n \t\"type\": \"url\",\n \t\"label\": \"View Proposal\",\n \t\"url\": `${global.get('c19_app_url')}/${global.get('address_c19_voting_app')}/`,\n \t\"alert\": false,\n \t\"style\": \"\"\n });\n \n buttons.push({\n \t\"type\": \"url\",\n \t\"label\": \"View Transaction\",\n \t\"url\": `${global.get('ether_scan_url')}/tx/${msg.payload.sdkPayload.notification.hash}`,\n \t\"alert\": false,\n \t\"style\": \"\"\n });\n \n buttons.push(button = {\n \t\"type\": \"newline\"\n });\n \n buttons.push(button = {\n \t\"type\": \"postback\",\n \t\"label\": `Menu`,\n \t\"value\": `/menu`,\n \t\"style\": \"\"\n }); \n \n msg.payload.type = \"inline-buttons\";\n msg.payload.content = `Thank you, your proposal has been submitted.`;\n msg.payload.buttons = buttons;\n}else{\n msg.payload.type = \"message\";\n msg.payload.content = `${msg.payload.sdkPayload.error} `\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":1940,"y":1400,"wires":[["dda3200.9d646e"]]},{"id":"10f8a0ec.4970ff","type":"debug","z":"3867c68b.1306da","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1490,"y":1300,"wires":[]},{"id":"dcb2a9c2.0001a8","type":"debug","z":"3867c68b.1306da","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":630,"y":1460,"wires":[]},{"id":"a0fd5ad9.cd6e68","type":"debug","z":"3867c68b.1306da","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":830,"y":1380,"wires":[]},{"id":"50964c5a.626c44","type":"debug","z":"3867c68b.1306da","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1090,"y":1280,"wires":[]},{"id":"1b373bd7.9d73a4","type":"node-airtable","z":"3867c68b.1306da","name":"Get Account","auth":"a65faee5.5fdcc","table":"accounts","tableType":"str","action":"get","filter":"","filterType":"msg","record":"payload.user.fields.account[0]","recordType":"msg","records":"payload.payload","recordsType":"msg","output":"payload.user.account","x":510,"y":1340,"wires":[["eb277809.2f35c8","e84c85ba.26e978"],[]]},{"id":"eb03b741.5ac678","type":"subflow:8342788e.337c18","z":"3867c68b.1306da","name":"","env":[],"x":290,"y":1340,"wires":[["1b373bd7.9d73a4"],[]]},{"id":"975fe2.46bf402","type":"debug","z":"3867c68b.1306da","name":"SDK Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":2100,"y":1300,"wires":[]},{"id":"ca9ee242.4a5f7","type":"comment","z":"3867c68b.1306da","name":"Create New Funding Proposal","info":"","x":600,"y":1200,"wires":[]},{"id":"389135e5.f949aa","type":"link out","z":"3867c68b.1306da","name":"","links":["fde38021.ef774"],"x":1395,"y":1440,"wires":[]},{"id":"dda3200.9d646e","type":"link out","z":"3867c68b.1306da","name":"","links":["fde38021.ef774"],"x":2115,"y":1400,"wires":[]},{"id":"e84c85ba.26e978","type":"link out","z":"3867c68b.1306da","name":"","links":["54eb3296.c8abac"],"x":655,"y":1280,"wires":[]},{"id":"555aff62.4318a","type":"link out","z":"3867c68b.1306da","name":"","links":["54eb3296.c8abac"],"x":1675,"y":1220,"wires":[]},{"id":"ba0d480e.7ccb48","type":"subflow:6b23cad2.b43514","z":"3867c68b.1306da","name":"","env":[],"x":1510,"y":1340,"wires":[["61c2eaa7.e8a154","555aff62.4318a"]]},{"id":"8c3746c7.34d508","type":"link in","z":"3867c68b.1306da","name":"In: New Funding Proposal","links":["8f8113a4.711f"],"x":55,"y":1340,"wires":[["eb03b741.5ac678"]]},{"id":"4cc56af6.b23894","type":"function","z":"3867c68b.1306da","name":"Create Funding Proposal","func":"ethers = global.get(\"ethers\");\nweb3_eth_abi = global.get('web3_eth_abi');\n\nnode.warn({\"web3_eth_abi\" : web3_eth_abi});\n\nconst abi_voting = global.get(\"abi_aragon_app_voting\");\nconst abi_finance = global.get(\"abi_aragon_app_finance\");\nconst CALLSCRIPT_ID = '0x00000001';\n\nconst { tokenAddress, receiverAddress, amount, optionalData } = msg.payload.fundingProposalData;\nconst from = '0xa150A1DFf75035558b82171CF7804081205Ffbb2'; //msg.payload.user.account.fields.account_address;\nconst aragonFinanceContractAddress = '0x0adf7eb5530bbb230f4f1eb5dae0b9f6082dcf79'; // finance contract address\nconst VOTING_APP_ID = '0x97e83d934746ebd535db3fdb40304d803bfdc4c2';//global.get('address_c19_voting_app');\n\n// we may want to convert amount to parse ether\n\nif(msg.payload.balance <= global.get('min_eth_for_gas_fee')){\n msg.payload.error = 'Please make sure to have enough ETH to pay for gas fee.';\n return [null, msg];\n}\n\nfunction encodeCallScript(actions) {\n return actions.reduce((script, { to, data }) => {\n const address = web3_eth_abi.encodeParameter('address', to)\n const dataLength = web3_eth_abi.encodeParameter('uint256', (data.length - 2) / 2).toString('hex')\n\n return script + address.slice(26) + dataLength.slice(58) + data.slice(2)\n }, CALLSCRIPT_ID)\n}\n\nfunction test() {\n // call newImmediatePayment on finance abi to encode data with 4 parms \n let iface = new ethers.utils.Interface(abi_finance);\n // ETH/TOKEN address, receiver's address, amount (001000000000000000), optional data \"\"\n // let args = [tokenAddress, receiverAddress, amount, optionalData];\n let args = ['0x0000000000000000000000000000000000000000', '0x7772b73FC7ceec54f150A50c2e8a8237b0cB2280', '001000000000000000', ''];\n let encodedData = iface.functions['newImmediatePayment'].encode(args);\n node.warn({'[ Abi Encoded Data (newImmediatePayment) ]': encodedData})\n\n const dataToEncode = [\n { from: from, to: aragonFinanceContractAddress, data: encodedData }\n ];\n\n let firstEncodedData = encodeCallScript(dataToEncode);\n node.warn({'[ First Scrript Encoded Data ]': firstEncodedData});\n\n const forwardEncoded = encodeForward(firstEncodedData);\n node.warn({'[ Abi Encoded Data (forward) ]' : forwardEncoded });\n //encode script again\n const action = [{\n to: VOTING_APP_ID,\n data: forwardEncoded\n }]\n const result = encodeCallScript(action);\n node.warn({'[ Second Script Encoded Data ]' : result });\n \n}\n\nfunction encodeForward(data) {\n let iface = new ethers.utils.Interface(abi_voting);\n let args = [data];\n let encodedData = iface.functions['forward'].encode(args);\n return encodedData;\n}\n\ntest();\nreturn;","outputs":1,"noerr":0,"x":790,"y":1680,"wires":[["b481f9a9.da5cd8"]]},{"id":"f1a80e62.c2dc6","type":"inject","z":"e769bed0.7d2b7","name":"Aragon finance app abi","topic":"","payload":"{\"environments\":{\"default\":{\"registry\":\"0x5f6f7e8cc7346a11ca2def8f827b7a0b612c56a1\",\"appName\":\"finance.aragonpm.eth\",\"network\":\"rpc\"},\"mainnet\":{\"registry\":\"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e\",\"appName\":\"finance.aragonpm.eth\",\"network\":\"mainnet\"},\"rinkeby\":{\"registry\":\"0x98Df287B6C145399Aaa709692c8D308357bC085D\",\"appName\":\"finance.aragonpm.eth\",\"network\":\"rinkeby\"},\"ropsten\":{\"registry\":\"0x6afe2cacee211ea9179992f89dc61ff25c61e923\",\"appName\":\"finance.aragonpm.eth\",\"network\":\"ropsten\"},\"staging\":{\"registry\":\"0xfe03625ea880a8cba336f9b5ad6e15b0a3b5a939\",\"appName\":\"finance.aragonpm.eth\",\"network\":\"rinkeby\"},\"rinkeby-old\":{\"registry\":\"0xfbae32d1cde62858bc45f51efc8cc4fa1415447e\",\"appName\":\"finance.aragonpm.eth\",\"network\":\"rinkeby\"}},\"dependencies\":[{\"appName\":\"vault.aragonpm.eth\",\"version\":\"^4.0.0\",\"initParam\":\"_vault\",\"state\":\"vault\",\"requiredPermissions\":[{\"name\":\"TRANSFER_ROLE\",\"params\":\"*\"}]}],\"roles\":[{\"name\":\"Create new payments\",\"id\":\"CREATE_PAYMENTS_ROLE\",\"params\":[\"Token address\",\"Receiver address\",\"Token amount\",\"Payment interval\",\"Max repeats\",\"Initial payment time\"],\"bytes\":\"0x5de467a460382d13defdc02aacddc9c7d6605d6d4e0b8bd2f70732cae8ea17bc\"},{\"name\":\"Change period duration\",\"id\":\"CHANGE_PERIOD_ROLE\",\"params\":[\"New period duration\",\"Old period duration\"],\"bytes\":\"0xd35e458bacdd5343c2f050f574554b2f417a8ea38d6a9a65ce2225dbe8bb9a9d\"},{\"name\":\"Change budgets\",\"id\":\"CHANGE_BUDGETS_ROLE\",\"params\":[\"Token address\",\"New budget amount\",\"Old budget amount\",\"Has budget flag\"],\"bytes\":\"0xd79730e82bfef7d2f9639b9d10bf37ebb662b22ae2211502a00bdf7b2cc3a23a\"},{\"name\":\"Execute payments\",\"id\":\"EXECUTE_PAYMENTS_ROLE\",\"params\":[\"Payment ID\",\"Payment amount\"],\"bytes\":\"0x563165d3eae48bcb0a092543ca070d989169c98357e9a1b324ec5da44bab75fd\"},{\"name\":\"Manage payments\",\"id\":\"MANAGE_PAYMENTS_ROLE\",\"params\":[\"Payment ID\",\"Payment active\"],\"bytes\":\"0x30597dd103acfaef0649675953d9cb22faadab7e9d9ed57acc1c429d04b80777\"}],\"path\":\"contracts/Finance.sol\",\"appName\":\"finance.aragonpm.eth\",\"env\":{\"registry\":\"0x98Df287B6C145399Aaa709692c8D308357bC085D\",\"appName\":\"finance.aragonpm.eth\",\"network\":\"rinkeby\"},\"appId\":\"0xbf8491150dafc5dcaee5b861414dca922de09ccffa344964ae167212e8c673ae\",\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"hasInitialized\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"CREATE_PAYMENTS_ROLE\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_script\",\"type\":\"bytes\"}],\"name\":\"getEVMScriptExecutor\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getRecoveryVault\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"CHANGE_PERIOD_ROLE\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"CHANGE_BUDGETS_ROLE\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"periodsLength\",\"outputs\":[{\"name\":\"\",\"type\":\"uint64\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"appId\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getInitializationBlock\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"EXECUTE_PAYMENTS_ROLE\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"transferToVault\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_sender\",\"type\":\"address\"},{\"name\":\"_role\",\"type\":\"bytes32\"},{\"name\":\"_params\",\"type\":\"uint256[]\"}],\"name\":\"canPerform\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getEVMScriptRegistry\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"kernel\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"paymentsNextIndex\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"isPetrified\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"MANAGE_PAYMENTS_ROLE\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"transactionsNextIndex\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"vault\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"periodId\",\"type\":\"uint64\"},{\"indexed\":false,\"name\":\"periodStarts\",\"type\":\"uint64\"},{\"indexed\":false,\"name\":\"periodEnds\",\"type\":\"uint64\"}],\"name\":\"NewPeriod\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"hasBudget\",\"type\":\"bool\"}],\"name\":\"SetBudget\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"paymentId\",\"type\":\"uint256\"},{\"indexed\":true,\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"maxExecutions\",\"type\":\"uint64\"},{\"indexed\":false,\"name\":\"reference\",\"type\":\"string\"}],\"name\":\"NewPayment\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"transactionId\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"incoming\",\"type\":\"bool\"},{\"indexed\":true,\"name\":\"entity\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"reference\",\"type\":\"string\"}],\"name\":\"NewTransaction\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"paymentId\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"active\",\"type\":\"bool\"}],\"name\":\"ChangePaymentState\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"newDuration\",\"type\":\"uint64\"}],\"name\":\"ChangePeriodDuration\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"paymentId\",\"type\":\"uint256\"}],\"name\":\"PaymentFailure\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"executor\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"script\",\"type\":\"bytes\"},{\"indexed\":false,\"name\":\"input\",\"type\":\"bytes\"},{\"indexed\":false,\"name\":\"returnData\",\"type\":\"bytes\"}],\"name\":\"ScriptResult\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"vault\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"token\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RecoverToVault\",\"type\":\"event\"},{\"constant\":false,\"inputs\":[{\"name\":\"_vault\",\"type\":\"address\"},{\"name\":\"_periodDuration\",\"type\":\"uint64\"}],\"name\":\"initialize\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"},{\"name\":\"_reference\",\"type\":\"string\"}],\"name\":\"deposit\",\"outputs\":[],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"},{\"name\":\"_receiver\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"},{\"name\":\"_reference\",\"type\":\"string\"}],\"name\":\"newImmediatePayment\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"},{\"name\":\"_receiver\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"},{\"name\":\"_initialPaymentTime\",\"type\":\"uint64\"},{\"name\":\"_interval\",\"type\":\"uint64\"},{\"name\":\"_maxExecutions\",\"type\":\"uint64\"},{\"name\":\"_reference\",\"type\":\"string\"}],\"name\":\"newScheduledPayment\",\"outputs\":[{\"name\":\"paymentId\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_periodDuration\",\"type\":\"uint64\"}],\"name\":\"setPeriodDuration\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"setBudget\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"removeBudget\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_paymentId\",\"type\":\"uint256\"}],\"name\":\"executePayment\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_paymentId\",\"type\":\"uint256\"}],\"name\":\"receiverExecutePayment\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_paymentId\",\"type\":\"uint256\"},{\"name\":\"_active\",\"type\":\"bool\"}],\"name\":\"setPaymentStatus\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"recoverToVault\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_maxTransitions\",\"type\":\"uint64\"}],\"name\":\"tryTransitionAccountingPeriod\",\"outputs\":[{\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"}],\"name\":\"allowRecoverability\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_paymentId\",\"type\":\"uint256\"}],\"name\":\"getPayment\",\"outputs\":[{\"name\":\"token\",\"type\":\"address\"},{\"name\":\"receiver\",\"type\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\"},{\"name\":\"initialPaymentTime\",\"type\":\"uint64\"},{\"name\":\"interval\",\"type\":\"uint64\"},{\"name\":\"maxExecutions\",\"type\":\"uint64\"},{\"name\":\"inactive\",\"type\":\"bool\"},{\"name\":\"executions\",\"type\":\"uint64\"},{\"name\":\"createdBy\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_transactionId\",\"type\":\"uint256\"}],\"name\":\"getTransaction\",\"outputs\":[{\"name\":\"periodId\",\"type\":\"uint64\"},{\"name\":\"amount\",\"type\":\"uint256\"},{\"name\":\"paymentId\",\"type\":\"uint256\"},{\"name\":\"paymentExecutionNumber\",\"type\":\"uint64\"},{\"name\":\"token\",\"type\":\"address\"},{\"name\":\"entity\",\"type\":\"address\"},{\"name\":\"isIncoming\",\"type\":\"bool\"},{\"name\":\"date\",\"type\":\"uint64\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_periodId\",\"type\":\"uint64\"}],\"name\":\"getPeriod\",\"outputs\":[{\"name\":\"isCurrent\",\"type\":\"bool\"},{\"name\":\"startTime\",\"type\":\"uint64\"},{\"name\":\"endTime\",\"type\":\"uint64\"},{\"name\":\"firstTransactionId\",\"type\":\"uint256\"},{\"name\":\"lastTransactionId\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_periodId\",\"type\":\"uint64\"},{\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"getPeriodTokenStatement\",\"outputs\":[{\"name\":\"expenses\",\"type\":\"uint256\"},{\"name\":\"income\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"currentPeriodId\",\"outputs\":[{\"name\":\"\",\"type\":\"uint64\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getPeriodDuration\",\"outputs\":[{\"name\":\"\",\"type\":\"uint64\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"getBudget\",\"outputs\":[{\"name\":\"budget\",\"type\":\"uint256\"},{\"name\":\"hasBudget\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"getRemainingBudget\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"canMakePayment\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_paymentId\",\"type\":\"uint256\"}],\"name\":\"nextPaymentTime\",\"outputs\":[{\"name\":\"\",\"type\":\"uint64\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"functions\":[{\"sig\":\"fallback\",\"roles\":[],\"notice\":\"Deposit ETH to the Vault, to avoid locking them in this Finance app forever\"},{\"sig\":\"initialize(address,uint64)\",\"roles\":[],\"notice\":\"Initialize Finance app for Vault at `_vault` with period length of `@transformTime(_periodDuration)`\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_vault\",\"type\":\"address\"},{\"name\":\"_periodDuration\",\"type\":\"uint64\"}],\"name\":\"initialize\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"deposit(address,uint256,string)\",\"roles\":[],\"notice\":\"Deposit `@tokenAmount(_token, _amount)`\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"},{\"name\":\"_reference\",\"type\":\"string\"}],\"name\":\"deposit\",\"outputs\":[],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"}},{\"sig\":\"newImmediatePayment(address,address,uint256,string)\",\"roles\":[\"CREATE_PAYMENTS_ROLE\"],\"notice\":\"Create a new payment of `@tokenAmount(_token, _amount)` to `_receiver` for '`_reference`'\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"},{\"name\":\"_receiver\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"},{\"name\":\"_reference\",\"type\":\"string\"}],\"name\":\"newImmediatePayment\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"newScheduledPayment(address,address,uint256,uint64,uint64,uint64,string)\",\"roles\":[\"CREATE_PAYMENTS_ROLE\"],\"notice\":\"Create a new payment of `@tokenAmount(_token, _amount)` to `_receiver` for `_reference`, executing `_maxExecutions` times at intervals of `@transformTime(_interval)`\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"},{\"name\":\"_receiver\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"},{\"name\":\"_initialPaymentTime\",\"type\":\"uint64\"},{\"name\":\"_interval\",\"type\":\"uint64\"},{\"name\":\"_maxExecutions\",\"type\":\"uint64\"},{\"name\":\"_reference\",\"type\":\"string\"}],\"name\":\"newScheduledPayment\",\"outputs\":[{\"name\":\"paymentId\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"setPeriodDuration(uint64)\",\"roles\":[\"CHANGE_PERIOD_ROLE\"],\"notice\":\"Change period duration to `@transformTime(_periodDuration)`, effective for next accounting period\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_periodDuration\",\"type\":\"uint64\"}],\"name\":\"setPeriodDuration\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"setBudget(address,uint256)\",\"roles\":[\"CHANGE_BUDGETS_ROLE\"],\"notice\":\"Set budget for `_token.symbol(): string` to `@tokenAmount(_token, _amount, false)`, effective immediately\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"setBudget\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"removeBudget(address)\",\"roles\":[\"CHANGE_BUDGETS_ROLE\"],\"notice\":\"Remove spending limit for `_token.symbol(): string`, effective immediately\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"removeBudget\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"executePayment(uint256)\",\"roles\":[\"EXECUTE_PAYMENTS_ROLE\"],\"notice\":\"Execute pending payment #`_paymentId`\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_paymentId\",\"type\":\"uint256\"}],\"name\":\"executePayment\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"receiverExecutePayment(uint256)\",\"roles\":[],\"notice\":\"Execute pending payment #`_paymentId`\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_paymentId\",\"type\":\"uint256\"}],\"name\":\"receiverExecutePayment\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"setPaymentStatus(uint256,bool)\",\"roles\":[\"MANAGE_PAYMENTS_ROLE\"],\"notice\":\"`_active ? 'Activate' : 'Disable'` payment #`_paymentId`\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_paymentId\",\"type\":\"uint256\"},{\"name\":\"_active\",\"type\":\"bool\"}],\"name\":\"setPaymentStatus\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"recoverToVault(address)\",\"roles\":[],\"notice\":\"Send tokens held in this contract to the Vault\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"}],\"name\":\"recoverToVault\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}},{\"sig\":\"tryTransitionAccountingPeriod(uint64)\",\"roles\":[],\"notice\":\"Transition accounting period if needed\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_maxTransitions\",\"type\":\"uint64\"}],\"name\":\"tryTransitionAccountingPeriod\",\"outputs\":[{\"name\":\"success\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}}],\"deprecatedFunctions\":{\"1.0.0\":[{\"sig\":\"newPayment(address,address,uint256,uint64,uint64,uint64,string)\",\"roles\":[\"CREATE_PAYMENTS_ROLE\"],\"notice\":\"Create a new payment of `@tokenAmount(_token, _amount)` to `_receiver``_maxRepeats > 0 ? ', executing ' + _maxRepeats + ' times at intervals of ' + @transformTime(_interval) : ''`, for '`_reference`'\",\"abi\":{\"constant\":false,\"inputs\":[{\"name\":\"_token\",\"type\":\"address\"},{\"name\":\"_receiver\",\"type\":\"address\"},{\"name\":\"_amount\",\"type\":\"uint256\"},{\"name\":\"_initialPaymentTime\",\"type\":\"uint64\"},{\"name\":\"_interval\",\"type\":\"uint64\"},{\"name\":\"_maxRepeats\",\"type\":\"uint64\"},{\"name\":\"_reference\",\"type\":\"string\"}],\"name\":\"newPayment\",\"outputs\":[{\"name\":\"paymentId\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}}]}}","payloadType":"json","repeat":"","crontab":"","once":true,"onceDelay":"0.2","x":250,"y":960,"wires":[["7e7f0186.a5f83"]]},{"id":"7e7f0186.a5f83","type":"json","z":"e769bed0.7d2b7","name":"","property":"payload.data","action":"obj","pretty":false,"x":450,"y":960,"wires":[["5a8555ab.49b61c"]]},{"id":"5a8555ab.49b61c","type":"change","z":"e769bed0.7d2b7","name":"abi aragon app finance","rules":[{"t":"set","p":"abi_aragon_app_finance","pt":"global","to":"payload.abi","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":960,"wires":[[]]},{"id":"ad5d5b13.a0dd48","type":"subflow:8342788e.337c18","z":"3867c68b.1306da","name":"","env":[],"x":370,"y":1680,"wires":[["5e73c153.f8f49"],[]]},{"id":"5e73c153.f8f49","type":"node-airtable","z":"3867c68b.1306da","name":"Get Account","auth":"a65faee5.5fdcc","table":"accounts","tableType":"str","action":"get","filter":"","filterType":"msg","record":"payload.user.fields.account[0]","recordType":"msg","records":"payload.payload","recordsType":"msg","output":"payload.user.account","x":570,"y":1680,"wires":[["4cc56af6.b23894"],[]]},{"id":"a42782ae.6e9b5","type":"inject","z":"3867c68b.1306da","name":"","topic":"","payload":"{\"fundingProposalData\":{\"tokenAddress_dai\":\"0x6b175474e89094c44da98b954eedeac495271d0f\",\"tokenAddress_eth\":\"0x0000000000000000000000000000000000000000\",\"recipient\":\"0xa150A1DFf75035558b82171CF7804081205Ffbb2\",\"amount\":\"0.001\",\"optionalData\":\"\"}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":1500,"wires":[["c461247c.a5d3d8"]]},{"id":"c461247c.a5d3d8","type":"change","z":"3867c68b.1306da","name":"","rules":[{"t":"set","p":"payload.userId","pt":"msg","to":"345876247","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":1500,"wires":[["eb03b741.5ac678"]]},{"id":"b481f9a9.da5cd8","type":"debug","z":"3867c68b.1306da","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":410,"y":1740,"wires":[]},{"id":"cd270d7b.c2aad","type":"inject","z":"3867c68b.1306da","name":"","topic":"","payload":"{}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":290,"y":2020,"wires":[["3fdca28d.b4f8ce"]]},{"id":"3fdca28d.b4f8ce","type":"function","z":"3867c68b.1306da","name":"","func":"ethers = global.get(\"ethers\");\n\nconst amount = '0.001';\n//output\n// 001000000000000000\n\nconst output = ethers.utils.parseEther(amount);\nnode.warn({\"result\" : output});\n\nreturn msg;","outputs":1,"noerr":0,"x":490,"y":2040,"wires":[[]]},{"id":"129a21c1.b1545e","type":"debug","z":"3867c68b.1306da","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1790,"y":1260,"wires":[]},{"id":"4271b6df.2bd4a8","type":"inject","z":"2d3e2335.2a164c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":"1","x":330,"y":140,"wires":[["c53d832b.e73b2"]]},{"id":"c53d832b.e73b2","type":"change","z":"2d3e2335.2a164c","name":"","rules":[{"t":"delete","p":"cache_balance_listener","pt":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":140,"wires":[[]]},{"id":"609bc1d0.4ed39","type":"chatbot-message","z":"2d3e2335.2a164c","name":"/fund Coming Soon!","message":[{"message":"Coming Soon!\n/menu"}],"language":"","x":540,"y":3400,"wires":[["5343610c.af817"]]},{"id":"b5d9a821.499668","type":"link in","z":"2d3e2335.2a164c","name":"In: Fund","links":["9694a737.4e3408"],"x":195,"y":3400,"wires":[["5728f1c6.4650d"]]},{"id":"5343610c.af817","type":"link out","z":"2d3e2335.2a164c","name":"","links":["fde38021.ef774"],"x":755,"y":3400,"wires":[]},{"id":"52939168.bfc2a","type":"function","z":"170efd68.bfb693","name":"New Funding Proposal Message","func":"msg.payload.content = `Please enter recipient address (Must be a valid ethereum address) \n\nFind more information in the Creating Proposals post here: https://forum.collab19.live/t/proposal-guidelines/16 \n\nHit /menu to cancel.\n`\nmsg.payload.type = 'buttons';\nmsg.payload.buttons = [{\n\t\"type\": \"keyboardButton\",\n\t\"label\": \"Main Menu\"\n}]\n\nreturn msg;","outputs":1,"noerr":0,"x":370,"y":440,"wires":[["fb932df4.8c27a","a833e4b4.41b768"]]},{"id":"fb932df4.8c27a","type":"chatbot-telegram-send","z":"170efd68.bfb693","bot":"784f1d9a.2a3ad4","botProduction":"","track":true,"passThrough":false,"outputs":1,"x":670,"y":440,"wires":[["1f78336d.d23e5d","f5ba5622.acbb38"]]},{"id":"1f78336d.d23e5d","type":"debug","z":"170efd68.bfb693","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":870,"y":360,"wires":[]},{"id":"f5ba5622.acbb38","type":"switch","z":"170efd68.bfb693","name":"","property":"payload.content","propertyType":"msg","rules":[{"t":"eq","v":"/cancel","vt":"str"},{"t":"eq","v":"Main Menu","vt":"str"},{"t":"eq","v":"/menu","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":4,"x":910,"y":440,"wires":[["47d3fde.79e2504"],["47d3fde.79e2504"],["47d3fde.79e2504"],["df7383ed.80e9f"]]},{"id":"47d3fde.79e2504","type":"link out","z":"170efd68.bfb693","name":"Outt: Trf to input node","links":["746831b9.0fdea"],"x":1035,"y":380,"wires":[]},{"id":"a833e4b4.41b768","type":"debug","z":"170efd68.bfb693","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":410,"y":500,"wires":[]},{"id":"1dd5f364.19260d","type":"link in","z":"170efd68.bfb693","name":"","links":["7eeb4868.adf3f8"],"x":135,"y":440,"wires":[["52939168.bfc2a","35e9d7a6.58c978"]]},{"id":"5728f1c6.4650d","type":"switch","z":"2d3e2335.2a164c","name":"","property":"payload.user.fields.whitelisted","propertyType":"msg","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":310,"y":3400,"wires":[["7eeb4868.adf3f8"],["609bc1d0.4ed39"]]},{"id":"7eeb4868.adf3f8","type":"link out","z":"2d3e2335.2a164c","name":"","links":["1dd5f364.19260d"],"x":400,"y":3320,"wires":[]},{"id":"df7383ed.80e9f","type":"function","z":"170efd68.bfb693","name":"New Funding Proposal: Recipient Address","func":"temp = msg.payload.content;\n// check if valid address\n\nproposal = flow.get('proposal');//[msg.payload.userId.toString()];\nproposal[msg.payload.userId.toString()] = {\n \"recipient\" : temp\n}\nflow.set('proposal', proposal);\nreturn msg;","outputs":1,"noerr":0,"x":830,"y":520,"wires":[["762a75af.efb32c","b74a3b0.5caf3c8"]]},{"id":"762a75af.efb32c","type":"debug","z":"170efd68.bfb693","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1110,"y":500,"wires":[]},{"id":"d64e90fe.58158","type":"change","z":"170efd68.bfb693","name":"","rules":[{"t":"set","p":"proposal","pt":"flow","to":"{}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":890,"y":140,"wires":[[]]},{"id":"baf5ee35.67c0d","type":"inject","z":"170efd68.bfb693","name":"","topic":"","payload":"{}","payloadType":"json","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":630,"y":140,"wires":[["d64e90fe.58158"]]},{"id":"66353215.b6c01c","type":"chatbot-telegram-send","z":"170efd68.bfb693","bot":"784f1d9a.2a3ad4","botProduction":"","track":true,"passThrough":false,"outputs":1,"x":1050,"y":580,"wires":[["7901de29.07f08"]]},{"id":"b74a3b0.5caf3c8","type":"function","z":"170efd68.bfb693","name":"Amount in DAI","func":"msg.payload.content = `Please enter funding amount (in DAI) \nHit /menu to cancel.\n`\nmsg.payload.type = 'buttons';\nmsg.payload.buttons = [{\n\t\"type\": \"keyboardButton\",\n\t\"label\": \"Main Menu\"\n}]\n\nreturn msg;","outputs":1,"noerr":0,"x":820,"y":580,"wires":[["66353215.b6c01c"]]},{"id":"7901de29.07f08","type":"switch","z":"170efd68.bfb693","name":"","property":"payload.content","propertyType":"msg","rules":[{"t":"eq","v":"/cancel","vt":"str"},{"t":"eq","v":"Main Menu","vt":"str"},{"t":"eq","v":"/menu","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":4,"x":1230,"y":580,"wires":[["c31abf63.1cdcc"],["c31abf63.1cdcc"],["c31abf63.1cdcc"],["efd0f4ab.a7c0b8"]]},{"id":"c31abf63.1cdcc","type":"link out","z":"170efd68.bfb693","name":"Outt: Trf to input node","links":["746831b9.0fdea"],"x":1415,"y":520,"wires":[]},{"id":"efd0f4ab.a7c0b8","type":"function","z":"170efd68.bfb693","name":"New Funding Proposal: Amount","func":"temp = msg.payload.content;\n// check if valid amount\n\nproposal = flow.get('proposal');\n\nuserProposal = proposal[msg.payload.userId.toString()]\nuserProposal[\"amount\"] = temp;\nproposal[msg.payload.userId.toString()] = userProposal;\n\nflow.set('proposal', proposal);\nreturn msg;","outputs":1,"noerr":0,"x":1010,"y":660,"wires":[["d14ad5fb.2fc5f8"]]},{"id":"d14ad5fb.2fc5f8","type":"function","z":"170efd68.bfb693","name":"Amount in DAI","func":"msg.payload.content = `Please enter proposal data or forum link \nHit /menu to cancel.\n`\nmsg.payload.type = 'buttons';\nmsg.payload.buttons = [{\n\t\"type\": \"keyboardButton\",\n\t\"label\": \"Main Menu\"\n}]\n\nreturn msg;","outputs":1,"noerr":0,"x":1280,"y":660,"wires":[["16a26e51.59fe82"]]},{"id":"16a26e51.59fe82","type":"chatbot-telegram-send","z":"170efd68.bfb693","bot":"784f1d9a.2a3ad4","botProduction":"","track":true,"passThrough":false,"outputs":1,"x":1050,"y":740,"wires":[["53899b29.6efd44"]]},{"id":"53899b29.6efd44","type":"switch","z":"170efd68.bfb693","name":"","property":"payload.content","propertyType":"msg","rules":[{"t":"eq","v":"/cancel","vt":"str"},{"t":"eq","v":"Main Menu","vt":"str"},{"t":"eq","v":"/menu","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":4,"x":1230,"y":740,"wires":[["b9e389f9.d6d878"],["b9e389f9.d6d878"],["b9e389f9.d6d878"],["6af63901.cdc758"]]},{"id":"b9e389f9.d6d878","type":"link out","z":"170efd68.bfb693","name":"Outt: Trf to input node","links":["746831b9.0fdea"],"x":1375,"y":720,"wires":[]},{"id":"6af63901.cdc758","type":"function","z":"170efd68.bfb693","name":"New Funding Proposal: Descripttion","func":"temp = msg.payload.content;\n// check if valid amount\n\nproposal = flow.get('proposal');\n\nuserProposal = proposal[msg.payload.userId.toString()]\nuserProposal[\"optionalData\"] = temp;\nproposal[msg.payload.userId.toString()] = userProposal;\n\nflow.set('proposal', proposal);\nreturn msg;","outputs":1,"noerr":0,"x":1070,"y":820,"wires":[["c19d72f3.96de8"]]},{"id":"8dd8c4be.0c62d8","type":"debug","z":"170efd68.bfb693","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1470,"y":760,"wires":[]},{"id":"35e9d7a6.58c978","type":"debug","z":"170efd68.bfb693","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":310,"y":580,"wires":[]},{"id":"c19d72f3.96de8","type":"function","z":"170efd68.bfb693","name":"Confirmation","func":"proposal = flow.get('proposal');\nuserProposal = proposal[msg.payload.userId.toString()]\n\nmsg.payload.content = `Funding proposal summary:\n\nRecipient: ${userProposal.recipient}\nAmount: ${userProposal.amount} (DAI)\nProposalData: ${userProposal.optionalData}\n\n`\n\nbuttons = [];\n\nbuttons.push(button = {\n\t\"type\": \"postback\",\n\t\"label\": `Confirm 👍`,\n\t\"value\": `/confirm`,\n\t\"style\": \"\"\n});\n\nbuttons.push(button = {\n\t\"type\": \"postback\",\n\t\"label\": `Reject 👎`,\n\t\"value\": `/reject`,\n\t\"style\": \"\"\n});\n\nmsg.payload.type = \"inline-buttons\";\nmsg.payload.buttons = buttons;\n\nreturn msg;","outputs":1,"noerr":0,"x":1350,"y":820,"wires":[["c72f0266.f08b7"]]},{"id":"c72f0266.f08b7","type":"chatbot-telegram-send","z":"170efd68.bfb693","bot":"784f1d9a.2a3ad4","botProduction":"","track":true,"passThrough":false,"outputs":1,"x":1070,"y":900,"wires":[["1f944c33.2ceb44","44bb7554.6a97cc"]]},{"id":"1f944c33.2ceb44","type":"switch","z":"170efd68.bfb693","name":"","property":"payload.content","propertyType":"msg","rules":[{"t":"eq","v":"/confirm","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1270,"y":900,"wires":[["93550c31.360c"],["b7be0ade.529398"]]},{"id":"b7be0ade.529398","type":"link out","z":"170efd68.bfb693","name":"Outt: Trf to input node","links":["746831b9.0fdea"],"x":1275,"y":960,"wires":[]},{"id":"4b0eaa2.f229954","type":"debug","z":"170efd68.bfb693","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1650,"y":840,"wires":[]},{"id":"8f8113a4.711f","type":"link out","z":"170efd68.bfb693","name":"","links":["8c3746c7.34d508"],"x":1595,"y":900,"wires":[]},{"id":"93550c31.360c","type":"function","z":"170efd68.bfb693","name":"","func":"proposal = flow.get('proposal');\nuserProposal = proposal[msg.payload.userId.toString()]\n\nmsg.payload.fundingProposalData = userProposal;\nreturn msg;","outputs":1,"noerr":0,"x":1450,"y":900,"wires":[["8f8113a4.711f","4b0eaa2.f229954"]]},{"id":"3171a65c.19fd5a","type":"link out","z":"170efd68.bfb693","name":"Out: Delete Previous Message","links":["ce132d60.5c711","21fac98a.f11ad6"],"x":1155,"y":2680,"wires":[]},{"id":"4e9515da.15483c","type":"link out","z":"170efd68.bfb693","name":"Out: Delete Previous Message","links":["ce132d60.5c711","21fac98a.f11ad6"],"x":2055,"y":2860,"wires":[]},{"id":"fc202f07.8d269","type":"link out","z":"170efd68.bfb693","name":"Out: Delete Previous Message","links":["ce132d60.5c711","21fac98a.f11ad6"],"x":1535,"y":2120,"wires":[]},{"id":"114c8548.e2816b","type":"link out","z":"170efd68.bfb693","name":"Out: Delete Previous Message","links":["ce132d60.5c711","21fac98a.f11ad6"],"x":1055,"y":2020,"wires":[]},{"id":"44bb7554.6a97cc","type":"link out","z":"170efd68.bfb693","name":"Out: Delete Previous Message","links":["ce132d60.5c711","21fac98a.f11ad6"],"x":1175,"y":980,"wires":[]},{"id":"2c104af.6afb9b6","type":"debug","z":"3867c68b.1306da","name":"Not Enough Balance","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1340,"y":1400,"wires":[]},{"id":"9f45b5b2.e08928","type":"link out","z":"2d3e2335.2a164c","name":"","links":["67c28c8c.e55304"],"x":1035,"y":700,"wires":[]},{"id":"9c8a4e02.80d9a","type":"link out","z":"2d3e2335.2a164c","name":"Out: Trf New C19 Token","links":["4eb90528.73573c"],"x":1915,"y":2800,"wires":[]},{"id":"88d2b916.b1b408","type":"switch","z":"2d3e2335.2a164c","name":"isDonation?","property":"payload.isDonation","propertyType":"msg","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1730,"y":2800,"wires":[[],[]]},{"id":"b265e3f.f21fe2","type":"chatbot-inline-buttons","z":"2d3e2335.2a164c","name":"What is a DAO intro","buttons":[{"type":"postback","label":"Learn about the tech","value":"/learntech","answer":"","alert":false,"style":""},{"type":"newline"},{"type":"postback","label":"Learn about the System","value":"/learnsystem","answer":"","alert":false,"style":""},{"type":"newline"},{"type":"postback","label":"Go to the Main Menu!","value":"/menu","answer":"","alert":false,"style":""}],"message":"Hi there, I'm Collab19_bot.\n\nCollab19 was created to collect and distribute funds to people and communities in need. \n\nIn order to provide a transparent and international process, I was created to help others use a DAO (decentralized autonomous organization) built on a cryptocurrency protocol, Ethereum.","x":1650,"y":940,"wires":[["8944325b.d33b3"]]},{"id":"2299b943.b7a566","type":"link in","z":"2d3e2335.2a164c","name":"","links":["5c3d92eb.a884ec"],"x":1455,"y":540,"wires":[[]]},{"id":"5c3d92eb.a884ec","type":"link out","z":"2d3e2335.2a164c","name":"","links":["2299b943.b7a566"],"x":1375,"y":540,"wires":[]},{"id":"d479e355.e7759","type":"chatbot-inline-buttons","z":"2d3e2335.2a164c","name":"Aragon","buttons":[{"type":"postback","label":"Back","value":"/whatisadao","answer":"","alert":false,"style":""},{"type":"newline"},{"type":"postback","label":"OK, I get it. Menu please","value":"/menu","answer":"","alert":false,"style":""},{"type":"newline"},{"type":"url","label":"Learn More","url":"aragon.org","webViewHeightRatio":"tall","extensions":false,"answer":"","alert":false}],"message":"🦅\nDAOs allow people to organize using cryptocurrency. There are a handful of DAO frameworks built on top of the Ethereum protocol. \n\nYou can think of a DAO framework (Aragon in this case) like a car engine or an operating system. This does the heavy lifting behind the scenes by securing the funds in the DAO bank, facilitating the voting process, and providing a fully functioning interface to show the health of the community governed financial system.","x":1620,"y":1220,"wires":[["8944325b.d33b3"]]},{"id":"223c7555.ce457a","type":"chatbot-inline-buttons","z":"2d3e2335.2a164c","name":"Ethereum","buttons":[{"type":"postback","label":"Back","value":"/whatisadao","answer":"","alert":false,"style":""},{"type":"newline"},{"type":"postback","label":"OK, I get it. Menu please","value":"/menu","answer":"","alert":false,"style":""},{"type":"newline"},{"type":"url","label":"Learn More","url":"ethereum.org","webViewHeightRatio":"tall","extensions":false,"answer":"","alert":false}],"message":"♢\nEthereum is an open source blockchain for decentralized applications. Similar to Bitcoin, it allows for P2P value transfer between anyone in the world. The value token in Ethereum is Ether (ETH).\n\nEthereum is distinct in that it allows for decentralized, censorship resistant applications facilitated via smart contracts. People can create things like escrow contracts and conditional transactions. A DAO is made up of a number of these contracts pieced together.\n\nIf a DAO framework like Aragon is the engine of Collab19, ETH is the fuel. Every member of the DAO needs ETH to execute transactions for thiings like voting and submitting proposals to the system.","x":1620,"y":1260,"wires":[["8944325b.d33b3"]]},{"id":"f2dade09.4b8b6","type":"chatbot-inline-buttons","z":"2d3e2335.2a164c","name":"Abridged","buttons":[{"type":"postback","label":"Back","value":"/whatisadao","answer":"","alert":false,"style":""},{"type":"newline"},{"type":"postback","label":"OK, I get it. Menu please","value":"/menu","answer":"","alert":false,"style":""},{"type":"newline"},{"type":"url","label":"Learn More","url":"abridged.io","webViewHeightRatio":"tall","extensions":false,"answer":"","alert":false}],"message":"I was created by the team at Abridged to help facilitate the operations for this organization.\n\nThe core of my technology uses a contract account rather than a key based wallet typical for crypto practices today. You can learn more about this design philosophy on our website below.","x":1620,"y":1180,"wires":[["8944325b.d33b3"]]},{"id":"15e12f8a.f9f8","type":"function","z":"2d3e2335.2a164c","name":"Social Sub Menu","func":"\nnotificationObj = {\n\t\"type\": \"postback\",\n\t\"label\": \"🔊 Enable Notifications\",\n\t\"value\": \"notification_on\",\n\t\"answer\": \"\",\n\t\"alert\": false,\n\t\"style\": \"\"\n}\n\n\nif(msg.payload.user.fields.notification === true){\n notificationObj.label = '🔇 Disable Notifications'\n notificationObj.value = \"notification_off\"\n}else{\n \n}\n\nmsg.payload.type = 'inline-buttons'\nmsg.payload.name = 'Main Menu'\nmsg.payload.content = '🗣Chat - members only chat to discuss DAO proposals\\n\\n📜Community Forum - submit a project for funding and learn about the community guidelines!'\nmsg.payload.buttons = [{\n\t\t\"type\": \"url\",\n\t\t\"label\": \"🗣Chat️ (MO)\",\n\t\t\"url\": \"https://t.me/joinchat/Hgw0mVX9sEY5JgZ21Qvkjw\",\n\t\t\"webViewHeightRatio\": \"tall\",\n\t\t\"extensions\": false,\n\t\t\"answer\": \"\",\n\t\t\"alert\": false\n\t}, {\n\t\t\"type\": \"url\",\n\t\t\"label\": \"📜Community Forum\",\n\t\t\"url\": \"https://forum.collab19.live/t/collab19-orientation/15\",\n\t\t\"webViewHeightRatio\": \"tall\",\n\t\t\"extensions\": false,\n\t\t\"answer\": \"\",\n\t\t\"alert\": false\n\t}, {\n\t\t\"type\": \"newline\"\n\t}, {\n\t\t\"type\": \"url\",\n\t\t\"label\": \"🕸️Website \",\n\t\t\"url\": \"https://collab19.live/\",\n\t\t\"webViewHeightRatio\": \"tall\",\n\t\t\"extensions\": false,\n\t\t\"answer\": \"\",\n\t\t\"alert\": false\n\t}, {\n\t\t\"type\": \"url\",\n\t\t\"label\": \"🐦Twitter\",\n\t\t\"url\": \"https://twitter.com/Collab_19\",\n\t\t\"webViewHeightRatio\": \"tall\",\n\t\t\"extensions\": false,\n\t\t\"answer\": \"\",\n\t\t\"alert\": false\n\t}, {\n\t\t\"type\": \"newline\"\n\t}, {\n\t\t\"type\": \"postback\",\n\t\t\"label\": \"Menu\",\n\t\t\"value\": \"/Menu\",\n\t\t\"answer\": \"\",\n\t\t\"alert\": false,\n\t\t\"style\": \"\"\n\t}]\n\t\nreturn msg;","outputs":1,"noerr":0,"x":1650,"y":1340,"wires":[["8944325b.d33b3"]]},{"id":"be4d7eb3.2fabd","type":"function","z":"2d3e2335.2a164c","name":"Proposals Sub Menu","func":"\nnotificationObj = {\n\t\"type\": \"postback\",\n\t\"label\": \"🔊 Enable Notifications\",\n\t\"value\": \"notification_on\",\n\t\"answer\": \"\",\n\t\"alert\": false,\n\t\"style\": \"\"\n}\n\n\nif(msg.payload.user.fields.notification === true){\n notificationObj.label = '🔇 Disable Notifications'\n notificationObj.value = \"notification_off\"\n}else{\n \n}\n\nmsg.payload.type = 'inline-buttons'\nmsg.payload.name = 'Main Menu'\nmsg.payload.content = '📡Signal Proposal - first step in the proposal process, gather sentiment (submit a forum post to include in this submission)\\n\\n💸Funding Proposal - last step of the proposal process, submit for fundinng!'\nmsg.payload.buttons = [{\n\t\t\"type\": \"postback\",\n\t\t\"label\": \"📡Signal Proposal (MO)\",\n\t\t\"value\": \"/signal\",\n\t\t\"answer\": \"\",\n\t\t\"alert\": false,\n\t\t\"style\": \"\"\n\t}, {\n\t\t\"type\": \"newline\"\n\t},\n\t{\n\t\t\"type\": \"postback\",\n\t\t\"label\": \"💸Funding Proposal (MO)\",\n\t\t\"value\": \"/fund\",\n\t\t\"answer\": \"\",\n\t\t\"alert\": false,\n\t\t\"style\": \"\"\n\t}, {\n\t\t\"type\": \"newline\"\n\t},\n\t{\n\t\t\"type\": \"postback\",\n\t\t\"label\": \"Menu\",\n\t\t\"value\": \"/menu\",\n\t\t\"answer\": \"\",\n\t\t\"alert\": false,\n\t\t\"style\": \"\"\n\t}]\n\t\nreturn msg;","outputs":1,"noerr":0,"x":1660,"y":1300,"wires":[["8944325b.d33b3"]]},{"id":"16e10b7b.833e65","type":"chatbot-inline-buttons","z":"2d3e2335.2a164c","name":"Learn about the tech","buttons":[{"type":"postback","label":"⛑️Shiny Exterior (Collab19_bot)","value":"/abridged","answer":"","alert":false,"style":""},{"type":"newline"},{"type":"postback","label":"🦅Robust Engine (Aragon)","value":"/aragon","answer":"","alert":false,"style":""},{"type":"newline"},{"type":"postback","label":"⛽Jet Fuel and Monitor (Ethereum)","value":"/ethereum","answer":"","alert":false,"style":""},{"type":"newline"},{"type":"postback","label":"OK, I get it. Menu please","value":"/menu","answer":"","alert":false,"style":""}],"message":"There are three primary layers to my tech stack:\n\n⛑️Shiny Exterior - Collab19_bot (the interface)\n\n🦅Robust Engine - the DAO framework (Aragon)\n\n⛽Jet Fuel and Monitor - the blockchain protocol (Ethereum)\n\nAside from the tech there is also YOU! Your involvement and participation is critical for Collab19 to work.\n\nClick below to learn more about my stack, or continue to the main menu.","x":1660,"y":1140,"wires":[["8944325b.d33b3"]]},{"id":"20411512.ba27fa","type":"inject","z":"da8d4d9f.ceb7b","name":"","topic":"","payload":"{}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":290,"y":1340,"wires":[["cb79075.2272ef8"]]},{"id":"cb79075.2272ef8","type":"change","z":"da8d4d9f.ceb7b","name":"","rules":[{"t":"set","p":"payload.userId","pt":"msg","to":"897802142","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":1340,"wires":[["b3aece9e.45a0b"]]},{"id":"f1e587ba.3443b8","type":"function","z":"da8d4d9f.ceb7b","name":"Cast vote","func":"\nbuttons = [];\n\nvoteId = 1\nvoteText = \"voteing text\"\nbuttons.push({\n\t\"type\": \"postback\",\n\t\"label\": \"Yes 👍\",\n\t\"value\": `{\"d\":\"ar\", \"ac\":\"vote_y\", \"id\":\"${voteId}\"}`,\n\t\"alert\": false,\n\t\"style\": \"\"\n});\n\nbuttons.push({\n\t\t\"type\": \"postback\",\n\t\t\"label\": \"No 👎\",\n\t\t\"value\": `{\"d\":\"ar\", \"ac\":\"vote_n\", \"id\":\"${voteId}\"}`,\n\t\t\"alert\": false,\n\t\t\"style\": \"\"\n\t});\n\nbuttons.push({\n\t \"type\": \"newline\"\n});\n\n\nbuttons.push({\n\t\"type\": \"url\",\n\t\"label\": \"🔊 View Vote\",\n\t\"url\": `${global.get('c19_app_url')}/${global.get('address_c19_voting_app')}/vote/${voteId}`,\n\t\"alert\": false,\n\t\"style\": \"\"\n});\n\t\nbuttons.push(button = {\n\t\"type\": \"postback\",\n\t\"label\": `Menu`,\n\t\"value\": `/menu`,\n\t\"style\": \"\"\n});\n\nmsg.payload.type = \"inline-buttons\";\nmsg.payload.content = `New voting proposal \"${voteText}\" created. Vote# ${voteId}.\n\nVote using below buttons`;\nmsg.payload.buttons = buttons;\nmsg.payload.chatId = msg.payload.userId;\n\nreturn msg;","outputs":1,"noerr":0,"x":440,"y":1400,"wires":[["dc49893c.297898"]]},{"id":"b3aece9e.45a0b","type":"chatbot-conversation","z":"da8d4d9f.ceb7b","name":"","botDevelopment":"24145e37.52cb02","botProduction":"","chatId":"1111","userId":"","transport":"telegram","store":"","x":730,"y":1340,"wires":[["f1e587ba.3443b8"]]},{"id":"dc49893c.297898","type":"chatbot-telegram-send","z":"da8d4d9f.ceb7b","bot":"784f1d9a.2a3ad4","botProduction":"","track":false,"passThrough":false,"outputs":0,"x":670,"y":1400,"wires":[]},{"id":"e4b9ec4.4b91a1","type":"switch","z":"5338f0fd.b175f","name":"","property":"records","propertyType":"msg","rules":[{"t":"empty"},{"t":"nempty"}],"checkall":"true","repair":false,"outputs":2,"x":1090,"y":520,"wires":[[],["efc58478.e2c1f8"]]},{"id":"24bafdee.4c4b22","type":"debug","z":"5338f0fd.b175f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1090,"y":460,"wires":[]},{"id":"f71653bb.d7357","type":"delay","z":"5338f0fd.b175f","name":"","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1250,"y":600,"wires":[["a70e2980.14d7a8"]]},{"id":"efc58478.e2c1f8","type":"array-loop","z":"5338f0fd.b175f","name":"","key":"123","keyType":"msg","reset":false,"resetValue":"value-null","array":"records","arrayType":"msg","x":1330,"y":540,"wires":[[],["f71653bb.d7357"]]},{"id":"a70e2980.14d7a8","type":"function","z":"5338f0fd.b175f","name":"","func":"chatId = msg.payload.fields.chat_id;\nmsg.payload = msg.notification;\nmsg.payload.chatId = chatId;\nreturn msg;","outputs":1,"noerr":0,"x":1450,"y":600,"wires":[["efc58478.e2c1f8","543c67e0.808258"]]},{"id":"82f6af94.f757","type":"node-airtable","z":"5338f0fd.b175f","name":"Get All Users","auth":"a65faee5.5fdcc","table":"user","tableType":"str","action":"list","filter":"","filterType":"str","record":"","recordType":"msg","records":"","recordsType":"msg","output":"payload.records","x":650,"y":520,"wires":[["3930d83a.576738"],[]]},{"id":"3930d83a.576738","type":"function","z":"5338f0fd.b175f","name":"Notificattion enabled?","func":"\nlet whiteListed = msg.payload.records.filter(record => record.fields.notification === true);\nmsg.records = whiteListed;\n\nreturn msg;","outputs":1,"noerr":0,"x":880,"y":520,"wires":[["e4b9ec4.4b91a1"]]},{"id":"66a7cbbb.5d1c24","type":"debug","z":"5338f0fd.b175f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":890,"y":480,"wires":[]},{"id":"1a723c8c.af8f73","type":"debug","z":"5338f0fd.b175f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1430,"y":700,"wires":[]},{"id":"2482b8b1.8a6118","type":"link out","z":"5338f0fd.b175f","name":"","links":["fde38021.ef774"],"x":1855,"y":600,"wires":[]},{"id":"ca7b6fe9.4d6dd","type":"link in","z":"5338f0fd.b175f","name":"In: Broadcast","links":["64822803.4f0828"],"x":195,"y":520,"wires":[["6cf5a5f4.50cfbc"]]},{"id":"4208cd5a.a0d1c4","type":"inject","z":"5338f0fd.b175f","name":"","topic":"","payload":"{}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":450,"y":720,"wires":[["d723c0be.c9288"]]},{"id":"d723c0be.c9288","type":"change","z":"5338f0fd.b175f","name":"","rules":[{"t":"set","p":"payload.userId","pt":"msg","to":"897802142","tot":"str"},{"t":"set","p":"notification.type","pt":"msg","to":"message","tot":"str"},{"t":"set","p":"notification.content","pt":"msg","to":"This is test broadcast message","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":720,"wires":[["6cf5a5f4.50cfbc"]]},{"id":"6cf5a5f4.50cfbc","type":"switch","z":"5338f0fd.b175f","name":"Only allowed users","property":"payload.userId","propertyType":"msg","rules":[{"t":"eq","v":"504116377","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":410,"y":520,"wires":[["82f6af94.f757"]]},{"id":"543c67e0.808258","type":"chatbot-conversation","z":"5338f0fd.b175f","name":"","botDevelopment":"24145e37.52cb02","botProduction":"","chatId":"1111","userId":"","transport":"telegram","store":"","x":1690,"y":600,"wires":[["2482b8b1.8a6118"]]},{"id":"31e7b813.2ae4d8","type":"switch","z":"2d3e2335.2a164c","name":"","property":"payload.content","propertyType":"msg","rules":[{"t":"cont","v":"/broadcast","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":530,"y":720,"wires":[["5a25721f.276bcc"],["40ee465e.9022c8"]]},{"id":"64822803.4f0828","type":"link out","z":"2d3e2335.2a164c","name":"","links":["ca7b6fe9.4d6dd"],"x":895,"y":680,"wires":[]},{"id":"5a25721f.276bcc","type":"function","z":"2d3e2335.2a164c","name":"Brroadcast Message","func":"content = msg.payload.content;\ncontent = content.substring(content.indexOf(' '));\nmsg.notification = {\n \"type\" : \"message\",\n \"content\" : content\n}\nreturn msg;","outputs":1,"noerr":0,"x":740,"y":680,"wires":[["64822803.4f0828"]]},{"id":"556d30d8.3f7de","type":"debug","z":"da8d4d9f.ceb7b","name":"Test","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":960,"y":500,"wires":[]},{"id":"26190053.7c715","type":"chatbot-inline-buttons","z":"2d3e2335.2a164c","name":"Learn about the system","buttons":[{"type":"postback","label":"🌀Social Sub Menu","value":"/socialinfo","answer":"","alert":false,"style":""},{"type":"newline"},{"type":"postback","label":"🏦Proposal Sub Menu","value":"/proposalinfo","answer":"","alert":false,"style":""},{"type":"newline"},{"type":"postback","label":"💰Account","value":"/accountinfo","answer":"","alert":false,"style":""},{"type":"newline"},{"type":"postback","label":"OK, I get it. Menu please","value":"/menu","answer":"","alert":false,"style":""}],"message":"*under development ; )*\n \nHere you can learn about the two primary ways Collab19 fosters coordination, the social submenu, and proposal submenu.\n\nAlso, get familiar with your account!","x":1670,"y":980,"wires":[["8944325b.d33b3"]]},{"id":"69b29436.23876c","type":"function","z":"2d3e2335.2a164c","name":"Account Info (Tutorial)","func":"\nbuttons = [];\n\n \nbuttons.push({\n\t\"type\": \"postback\",\n\t\"label\": \"⛑️Donate to the Relief Fund\",\n\t\"value\": `/donate`,\n\t\"alert\": false,\n\t\"style\": \"\"\n});\n\nbuttons.push({\n \"type\": \"newline\"\n});\n\nbuttons.push({\n\t\"type\": \"postback\",\n\t\"label\": \"Withdraw\",\n\t\"value\": `/transfereth`,\n\t\"alert\": false,\n\t\"style\": \"\"\n});\n\nbuttons.push({\n\t\"type\": \"postback\",\n\t\"label\": \"Deposit\",\n\t\"value\": `/addeth`,\n\t\"alert\": false,\n\t\"style\": \"\"\n});\n\n\nbuttons.push({\n\t \"type\": \"newline\"\n});\n\nbuttons.push({\n\t\t\"type\": \"newline\"\n\t},\n\t{\n\t\t\"type\": \"postback\",\n\t\t\"label\": \"Back\",\n\t\t\"value\": \"/learnsystem\",\n\t\t\"answer\": \"\",\n\t\t\"alert\": false,\n\t\t\"style\": \"\"\n\t});\n\t\nmsg.payload.type = \"inline-buttons\";\nmsg.payload.content = `This is your Ethereum /account. You can think of it like a virtual piggybank.\n\nFrom here you can withdraw funds, upload funds, and donate funds. The denomination for the system today is ETH. At times, you will need ETH to submit transactions (learn more at /ethereum), so if your account is too low, fill it up!\n\nIf you need a C19 token remember to donate to the relief fund!\n\n♢ETH balance: ${msg.payload.balance}\n🔆C19 Token: ${msg.payload.tokenBalance}\nAccount address: ${msg.payload.user.account.fields.account_address}\n\n`;\nmsg.payload.buttons = buttons;\nmsg.payload.chatId = msg.payload.user.fields.chat_id;\n\nreturn msg;","outputs":1,"noerr":0,"x":1660,"y":1020,"wires":[["8944325b.d33b3"]]},{"id":"df1dd321.8da34","type":"function","z":"2d3e2335.2a164c","name":"Social Sub Menu (tutorial)","func":"\nnotificationObj = {\n\t\"type\": \"postback\",\n\t\"label\": \"🔊 Enable Notifications\",\n\t\"value\": \"notification_on\",\n\t\"answer\": \"\",\n\t\"alert\": false,\n\t\"style\": \"\"\n}\n\n\nif(msg.payload.user.fields.notification === true){\n notificationObj.label = '🔇 Disable Notifications'\n notificationObj.value = \"notification_off\"\n}else{\n \n}\n\nmsg.payload.type = 'inline-buttons'\nmsg.payload.name = 'Main Menu'\nmsg.payload.content = 'This is your /socialmenu. Here you can submit propoosals in the forum, chat with members in the group chat, and find all externall facing links for Collab19.\\n\\n🗣Chat - members only chat to discuss DAO proposals\\n\\n📜Community Forum - submit a project for funding and learn about the community guidelines!'\nmsg.payload.buttons = [{\n\t\t\"type\": \"url\",\n\t\t\"label\": \"🗣Chat️ (MO)\",\n\t\t\"url\": \"https://t.me/joinchat/Hgw0mVX9sEY5JgZ21Qvkjw\",\n\t\t\"webViewHeightRatio\": \"tall\",\n\t\t\"extensions\": false,\n\t\t\"answer\": \"\",\n\t\t\"alert\": false\n\t}, {\n\t\t\"type\": \"url\",\n\t\t\"label\": \"📜Community Forum\",\n\t\t\"url\": \"https://forum.collab19.live/t/collab19-orientation/15\",\n\t\t\"webViewHeightRatio\": \"tall\",\n\t\t\"extensions\": false,\n\t\t\"answer\": \"\",\n\t\t\"alert\": false\n\t}, {\n\t\t\"type\": \"newline\"\n\t}, {\n\t\t\"type\": \"url\",\n\t\t\"label\": \"🕸️Website \",\n\t\t\"url\": \"https://collab19.live/\",\n\t\t\"webViewHeightRatio\": \"tall\",\n\t\t\"extensions\": false,\n\t\t\"answer\": \"\",\n\t\t\"alert\": false\n\t}, {\n\t\t\"type\": \"url\",\n\t\t\"label\": \"🐦Twitter\",\n\t\t\"url\": \"https://twitter.com/Collab_19\",\n\t\t\"webViewHeightRatio\": \"tall\",\n\t\t\"extensions\": false,\n\t\t\"answer\": \"\",\n\t\t\"alert\": false\n\t}, {\n\t\t\"type\": \"newline\"\n\t}, {\n\t\t\"type\": \"postback\",\n\t\t\"label\": \"Back\",\n\t\t\"value\": \"/learnsystem\",\n\t\t\"answer\": \"\",\n\t\t\"alert\": false,\n\t\t\"style\": \"\"\n\t}]\n\t\nreturn msg;","outputs":1,"noerr":0,"x":1670,"y":1100,"wires":[["8944325b.d33b3"]]},{"id":"ee9cc6b0.7918b8","type":"function","z":"2d3e2335.2a164c","name":"Proposals Sub Menu (tutorial)","func":"\nnotificationObj = {\n\t\"type\": \"postback\",\n\t\"label\": \"🔊 Enable Notifications\",\n\t\"value\": \"notification_on\",\n\t\"answer\": \"\",\n\t\"alert\": false,\n\t\"style\": \"\"\n}\n\n\nif(msg.payload.user.fields.notification === true){\n notificationObj.label = '🔇 Disable Notifications'\n notificationObj.value = \"notification_off\"\n}else{\n \n}\n\nmsg.payload.type = 'inline-buttons'\nmsg.payload.name = 'Main Menu'\nmsg.payload.content = 'This is your /proposalmenu where you can make official decisions on proposals. \\n\\nBefore landing on this page, a proposal must be submitted to the forum found in the Social Sub Menu\\n\\n📡Signal Proposal - first step in the proposal process, gather sentiment (submit a forum post to include in this submission)\\n\\n💸Funding Proposal - last step of the proposal process, submit for fundinng!'\nmsg.payload.buttons = [{\n\t\t\"type\": \"postback\",\n\t\t\"label\": \"📡Signal Proposal (MO)\",\n\t\t\"value\": \"/signal\",\n\t\t\"answer\": \"\",\n\t\t\"alert\": false,\n\t\t\"style\": \"\"\n\t}, {\n\t\t\"type\": \"newline\"\n\t},\n\t{\n\t\t\"type\": \"postback\",\n\t\t\"label\": \"💸Funding Proposal (MO)\",\n\t\t\"value\": \"/fund\",\n\t\t\"answer\": \"\",\n\t\t\"alert\": false,\n\t\t\"style\": \"\"\n\t}, {\n\t\t\"type\": \"newline\"\n\t}, {\n\t\t\"type\": \"postback\",\n\t\t\"label\": \"Back\",\n\t\t\"value\": \"/learnsystem\",\n\t\t\"answer\": \"\",\n\t\t\"alert\": false,\n\t\t\"style\": \"\"\n\t}]\n\t\nreturn msg;","outputs":1,"noerr":0,"x":1690,"y":1060,"wires":[["8944325b.d33b3"]]},{"id":"8c50b57c.171f68","type":"change","z":"e769bed0.7d2b7","name":"KMS KEYS AND PK (MAKE SURE TO REMOVE)","rules":[{"t":"set","p":"AWS_ACCESS_KEY_ID","pt":"global","to":"","tot":"str"},{"t":"set","p":"AWS_SECREAT_ACCESS_KEY","pt":"global","to":"","tot":"str"},{"t":"set","p":"KMS_GENERATOR_KEY_ID","pt":"global","to":"","tot":"str"},{"t":"set","p":"KMS_KEY_ID","pt":"global","to":"","tot":"str"},{"t":"set","p":"pk_c19_token_holder","pt":"global","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1540,"y":500,"wires":[[]]},{"id":"c6981548.e21768","type":"function","z":"fd7a3a71.e58138","name":"","func":"awsClientNode = global.get('aws_client_node');\nAWS = global.get('AWS');\nvar env = global.get('env');\n\nAWS.config.accessKeyId = env.AWS_ACCESS_KEY_ID\nAWS.config.secretAccessKey = env.AWS_SECREAT_ACCESS_KEY\n\nconst { KmsKeyringNode, encrypt, decrypt } = awsClientNode\n/* Start by constructing a keyring. We'll create a KMS keyring.\n * Specify an AWS Key Management Service (AWS KMS) customer master key (CMK) to be the\n * generator key in the keyring. This CMK generates a data key and encrypts it. \n * To use the keyring to encrypt data, you need kms:GenerateDataKey permission \n * on this CMK. To decrypt, you need kms:Decrypt permission. \n */\nconst generatorKeyId = env.KMS_GENERATOR_KEY_ID\n\n/* You can specify additional CMKs for the keyring. The data key that the generator key\n * creates is also encrypted by the additional CMKs you specify. To encrypt data, \n * you need kms:Encrypt permission on this CMK. To decrypt, you need kms:Decrypt permission.\n */\nconst keyIds = [env.KMS_KEY_ID]\n\n/* Create the KMS keyring */\nconst keyring = new KmsKeyringNode({ generatorKeyId, keyIds })\n\n/* Set an encryption context For more information: \n * https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/concepts.html#encryption-context\n */\nconst context = {\n stage: 'prod',\n purpose: 'encrypt pks',\n origin: 'us-east-2'\n}\n\n\nasync function encryptKey(cleartext) {\n try{\n const { result } = await encrypt(keyring, cleartext, { context })\n msg.payload.encryptedData = JSON.stringify(result)\n }catch(error){\n msg.payload.error = error;\n }\n node.send(msg);\n node.done();\n}\n\nasync function decryptKey(encryptedData) {\n try{\n const { plaintext, messageHeader } = await decrypt(keyring, encryptedData)\n msg.payload.decryptedData = String.fromCharCode.apply(null, plaintext);\n }catch(error){\n msg.payload.error = error;\n }\n node.send(msg);\n node.done();\n \n}\n\nif(msg.payload.action === 'ENCRYPT'){\n encryptKey(msg.payload.data);\n}else if(msg.payload.action === 'DECRYPT'){\n json = JSON.parse(msg.payload.data);\n var buf = Buffer.from(json.data);\n decryptKey(buf);\n}\n\nreturn;","outputs":1,"noerr":0,"x":370,"y":220,"wires":[[]]},{"id":"9b30f1a4.55b89","type":"link out","z":"2d3e2335.2a164c","name":"Out: Save PK","links":["f4e2f152.9f93a"],"x":1200,"y":1080,"wires":[]},{"id":"f4e2f152.9f93a","type":"link in","z":"2d3e2335.2a164c","name":"In: Save PK","links":["9b30f1a4.55b89"],"x":195,"y":3620,"wires":[["aa63c93b.5521c8"]]},{"id":"8793efd0.fc1df","type":"function","z":"2d3e2335.2a164c","name":"","func":"msg.payload.content = `\nBelow is your private key, please save it to safe place. This message will be deleted in 15 secs.\n\n${msg.payload.user.account.fields.pk}`\n\nreturn msg;","outputs":1,"noerr":0,"x":510,"y":3620,"wires":[["b08fff88.4d213","60fbe0f4.ceba4"]]},{"id":"b08fff88.4d213","type":"link out","z":"2d3e2335.2a164c","name":"","links":["fde38021.ef774"],"x":675,"y":3620,"wires":[]},{"id":"aa63c93b.5521c8","type":"subflow:6b23cad2.b43514","z":"2d3e2335.2a164c","name":"","env":[],"x":330,"y":3620,"wires":[["8793efd0.fc1df"]]},{"id":"60fbe0f4.ceba4","type":"delay","z":"2d3e2335.2a164c","name":"","pauseType":"delay","timeout":"15","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":360,"y":3680,"wires":[["c4ef6731.b55ca8"]]},{"id":"3ca98fed.26dd5","type":"subflow:5c764a0d.f85564","z":"2d3e2335.2a164c","name":"","env":[],"x":760,"y":3680,"wires":[]},{"id":"c4ef6731.b55ca8","type":"function","z":"2d3e2335.2a164c","name":"","func":"msg.payload.chat_id = msg.payload.chatId;\nmsg.payload.message_id = msg.originalMessage.message_id + 1;\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":3680,"wires":[["3ca98fed.26dd5"]]},{"id":"bd206e8b.10d41","type":"link in","z":"2d3e2335.2a164c","name":"In: Bank","links":["2e6e6d5b.129ad2"],"x":175,"y":3940,"wires":[["99942cd8.e89bd"]]},{"id":"613eb832.81dbc8","type":"subflow:9b059efc.f650b","z":"27eb9c12.0fb5c4","name":"","env":[],"x":640,"y":440,"wires":[["d2d33a3.59e8dc8"]]},{"id":"d2d33a3.59e8dc8","type":"change","z":"27eb9c12.0fb5c4","name":"","rules":[{"t":"set","p":"payload.abi","pt":"msg","to":"abi_erc20","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":900,"y":440,"wires":[["9ee2bbe6.432a38"]]},{"id":"9ee2bbe6.432a38","type":"subflow:9e5e594a.494868","z":"27eb9c12.0fb5c4","name":"","env":[],"x":1140,"y":440,"wires":[[]]},{"id":"ac857a7e.e8f278","type":"subflow:27eb9c12.0fb5c4","z":"2d3e2335.2a164c","name":"Community Bank ETH/DAI Balance","env":[],"x":640,"y":3940,"wires":[["a3e33889.dce408","ec3ea8fc.1f8e68"]]},{"id":"a3e33889.dce408","type":"debug","z":"2d3e2335.2a164c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":970,"y":3880,"wires":[]},{"id":"99942cd8.e89bd","type":"change","z":"2d3e2335.2a164c","name":"","rules":[{"t":"set","p":"payload.network","pt":"msg","to":"netwrok","tot":"global"},{"t":"set","p":"payload.queryProviderEndPoint","pt":"msg","to":"queryProviderEndPoint","tot":"global"},{"t":"set","p":"payload.address","pt":"msg","to":"0x66b6fd8097e078cb8e0f7916efb8be76849b3442","tot":"str"},{"t":"set","p":"payload.address_contract","pt":"msg","to":"0x6b175474e89094c44da98b954eedeac495271d0f","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":3940,"wires":[["ac857a7e.e8f278"]]},{"id":"1f0c244b.d74ddc","type":"function","z":"2d3e2335.2a164c","name":"Messagee","func":"msg.payload.content = `\nCommunity Bank Details:\n\nETH: ${msg.payload.balance}\nDAI: ${msg.payload.tokenBalance}\n# OF membrers: ${msg.payload.records.length}\n`\nreturn msg;","outputs":1,"noerr":0,"x":1110,"y":3960,"wires":[["9c428c36.194d4"]]},{"id":"9c428c36.194d4","type":"link out","z":"2d3e2335.2a164c","name":"","links":["fde38021.ef774"],"x":1275,"y":3960,"wires":[]},{"id":"2e6e6d5b.129ad2","type":"link out","z":"2d3e2335.2a164c","name":"Out: Bank","links":["bd206e8b.10d41"],"x":1275,"y":1080,"wires":[]},{"id":"bc556a1d.374f68","type":"link out","z":"2d3e2335.2a164c","name":"Out: Community Details","links":["d22042e3.6a1c3"],"x":1280,"y":1120,"wires":[]},{"id":"ec3ea8fc.1f8e68","type":"node-airtable","z":"2d3e2335.2a164c","name":"Get All Users","auth":"a65faee5.5fdcc","table":"user","tableType":"str","action":"list","filter":"({status} = 'active')","filterType":"str","record":"","recordType":"msg","records":"","recordsType":"msg","output":"payload.records","x":910,"y":3960,"wires":[["1f0c244b.d74ddc"],[]]},{"id":"1b997098.c99b7f","type":"debug","z":"507c6c45.0c62b4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1440,"y":420,"wires":[]}]