Merge branch 'develop' of https://github.com/Gallymojo/Superalgos into develop

This commit is contained in:
Gallymojo committed 2021-08-20 22:10:14 +08:00
commit 951632f453
18 files changed
+1337 -436

No files matched your search

+1 -1
View File
@@ -18,7 +18,7 @@ process.on('uncaughtException', function (err) {
process.on('unhandledRejection', (reason, p) => {
// Signal user that a necissary node module is missing
if (reason.code == 'MODULE_NOT_FOUND') {
console.log("[ERROR] Node Modules not found. Running the node setup command and then restart")
console.log("[ERROR] Dependency library not found. Please try running the 'node setup' command and then restart the Client.")
console.log('[ERROR] Client -> client-> reason = ' + JSON.stringify(reason))
process.exit(1)
}
+4 -1
View File
@@ -1102,7 +1102,10 @@ exports.newHttpInterface = function newHttpInterface(
case 'payContributors': {
let serverResponse = await WEB3_SERVER.payContributors(
params.signature
params.contractAddress,
params.contractAbi,
params.paymentsArray,
params.mnemonic
)
respondWithContent(JSON.stringify(serverResponse), httpResponse)
+30
View File
@@ -1397,6 +1397,36 @@
"setimmediate": "^1.0.5"
}
},
"ethereumjs-common": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/ethereumjs-common/-/ethereumjs-common-1.5.2.tgz",
"integrity": "sha512-hTfZjwGX52GS2jcVO6E2sx4YuFnf0Fhp5ylo4pEPhEffNln7vS59Hr5sLnp3/QCazFLluuBZ+FZ6J5HTp0EqCA=="
},
"ethereumjs-tx": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ethereumjs-tx/-/ethereumjs-tx-2.1.2.tgz",
"integrity": "sha512-zZEK1onCeiORb0wyCXUvg94Ve5It/K6GD1K+26KfFKodiBiS6d9lfCXlUKGBBdQ+bv7Day+JK0tj1K+BeNFRAw==",
"requires": {
"ethereumjs-common": "^1.5.0",
"ethereumjs-util": "^6.0.0"
},
"dependencies": {
"ethereumjs-util": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz",
"integrity": "sha512-W2Ktez4L01Vexijrm5EB6w7dg4n/TgpoYU4avuT5T3Vmnw/eCRtiBrJfQYS/DCSvDIOLn2k57GcHdeBcgVxAqw==",
"requires": {
"@types/bn.js": "^4.11.3",
"bn.js": "^4.11.0",
"create-hash": "^1.1.2",
"elliptic": "^6.5.2",
"ethereum-cryptography": "^0.1.3",
"ethjs-util": "0.1.6",
"rlp": "^2.2.3"
}
}
}
},
"ethereumjs-util": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.0.tgz",
+2
View File
@@ -10,6 +10,8 @@
"@octokit/rest": "^18.9.0",
"ccxt": "^1.51.98",
"child_process": "^1.0.2",
"ethereumjs-common": "^1.5.2",
"ethereumjs-tx": "^2.1.2",
"ethers": "^5.4.4",
"lookpath": "^1.2.2",
"node-fetch": "2.6.1",
+81 -3
View File
@@ -8,7 +8,8 @@ exports.newWeb3Server = function newWeb3Server() {
getWalletBalances: getWalletBalances,
signData: signData,
recoverAddress: recoverAddress,
mnemonicToPrivateKey: mnemonicToPrivateKey,
mnemonicToPrivateKey: mnemonicToPrivateKey,
payContributors: payContributors,
initialize: initialize,
finalize: finalize,
run: run
@@ -245,13 +246,13 @@ exports.newWeb3Server = function newWeb3Server() {
if (wallet.privateKey !== undefined) {
return {
address: wallet.address,
address: wallet.address,
privateKey: wallet.privateKey,
result: 'Ok'
}
} else {
return {
address: undefined,
address: undefined,
privateKey: undefined,
result: 'Fail'
}
@@ -260,6 +261,83 @@ exports.newWeb3Server = function newWeb3Server() {
} catch (err) {
return { error: 'Could not convert to Private Key. ' + err.stack }
}
}
async function payContributors(contractAddress, contractAbi, paymentsArray, mnemonic) {
try {
let response = await mnemonicToPrivateKey(mnemonic)
let privateKey = response.privateKey
for (let i = 0; i < paymentsArray.length; i++) {
await CL.projects.foundations.utilities.asyncFunctions.sleep(10000)
let payment = paymentsArray[i]
sendTokens(
i + 1,
payment.userProfile,
payment.from,
payment.to,
payment.amount
)
}
async function sendTokens(number, userProfile, fromAddress, toAddress, tokenAmount) {
try {
console.log('')
console.log('---------------------------------------------------------------------------------------------------------------------------------------------------')
console.log(' Payment # ' + number + ' - User Profile: ' + userProfile + ' - SA Tokens Amount: ' + tokenAmount / 1000000000000000000 + ' - Address: ' + toAddress)
console.log('---------------------------------------------------------------------------------------------------------------------------------------------------')
console.log('')
const Tx = require('ethereumjs-tx').Transaction;
const web3 = new Web3(new Web3.providers.HttpProvider('https://bsc-dataseed.binance.org/'))
const amount = web3.utils.toHex(tokenAmount)
privateKey = privateKey.replace('0x', '')
const privateKeyBuffer = Buffer.from(privateKey, 'hex')
const contractAbiObject = JSON.parse(contractAbi)
const contract = new web3.eth.Contract(contractAbiObject, contractAddress, { from: fromAddress })
const Common = require('ethereumjs-common').default
const BSC_FORK = Common.forCustomChain(
'mainnet',
{
name: 'Binance Smart Chain Mainnet',
networkId: 56,
chainId: 56,
url: 'https://bsc-dataseed.binance.org/'
},
'istanbul',
);
const nonce = await web3.eth.getTransactionCount(fromAddress);
const rawTransaction = {
"from": fromAddress,
"gasPrice": web3.utils.toHex(5000000000),
"gasLimit": web3.utils.toHex(210000),
"to": contractAddress, "value": "0x0",
"data": contract.methods.transfer(toAddress, amount).encodeABI(),
"nonce": web3.utils.toHex(nonce)
};
const transaction = new Tx(rawTransaction, { 'common': BSC_FORK })
transaction.sign(privateKeyBuffer)
console.log('Transaction:', rawTransaction)
const result = await web3.eth.sendSignedTransaction('0x' + transaction.serialize().toString('hex'))
console.log('Result:', result)
return result
} catch (err) {
console.log('[ERROR] web3Server -> sendTokens -> err.stack = ' + err.stack)
}
}
return {
address: wallet.address,
privateKey: wallet.privateKey,
result: 'Ok'
}
} catch (err) {
return { error: 'Could not convert to Private Key. ' + err.stack }
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

@@ -9,6 +9,14 @@
"propertyToCheckFor": "githubAPI",
"actionFunction": "payload.executeAction"
},
{
"action": "Add UI Object",
"label": "Add Web3 API",
"relatedUiObject": "Web3 API",
"disableIfPropertyIsDefined": true,
"propertyToCheckFor": "web3API",
"actionFunction": "payload.executeAction"
},
{
"action": "Delete UI Object",
"askConfirmation": true,
@@ -27,6 +35,11 @@
"name": "githubAPI",
"type": "node",
"childType": "Github API"
},
{
"name": "web3API",
"type": "node",
"childType": "Web3 API"
}
],
"isPersonalData": true
@@ -0,0 +1,35 @@
{
"type": "Web3 API",
"menuItems": [
{
"action": "Configure",
"label": "Configure",
"iconPathOn": "configuration",
"iconPathOff": "configuration",
"dontShowAtFullscreen": true,
"actionFunction": "uiObject.configEditor.activate"
},
{
"action": "Delete UI Object",
"askConfirmation": true,
"confirmationLabel": "Confirm to Delete",
"label": "Delete",
"iconPathOn": "delete-entity",
"iconPathOff": "delete-entity",
"actionFunction": "payload.executeAction"
}
],
"editors": {
"config": true
},
"initialValues": {
"config": "{ \n\"token\": \"\", \n\"mnemonic\": \"\"\n}"
},
"addLeftIcons": true,
"level": 1,
"attachingRules": {
"compatibleTypes": "->APIs->"
},
"propertyNameAtParent": "web3API",
"isPersonalData": true
}
@@ -146,12 +146,22 @@
},
{
"style": "Text",
"text": "The Masters Data Mine features the definition of the Webhooks sensor bot used to monitor incoming notifications. You need to run an instance of this bot in the data mining section of the exchange and market of your choice.",
"updated": 1615370092995
"text": "The Webhooks Data Mine features the definition of the Webhooks sensor bot used to monitor incoming notifications. You need to run an instance of this bot in the data mining section of the exchange and market of your choice.",
"updated": 1629361373616
},
{
"style": "Text",
"text": "The default workspace does not feature these tasks. To create a task for the Webhooks sensor bot, you need to uninstall and re-install the corresponding market."
"text": "The Getting-Started-Tutorials workspace does not have this Data Mine as a plugin so you will need to add it first. To do that locate the Plugins node, expand it and at the Plugins Data Mines add a New Plugin File. You can setup it's configuration like this:"
},
{
"style": "Json",
"text": "{\n \"project\": \"Foundations\",\n \"fileName\": \"Webhooks\",\n \"folderName\": \"Data-Mines\",\n \"nodeType\": \"Data Mine\",\n \"saveWithWorkspace\": false\n}",
"updated": 1629361560976
},
{
"style": "Text",
"text": "The default workspace does not feature these tasks. To create a task for the Webhooks sensor bot, you need to uninstall and re-install the corresponding market. The prcess of installing a market adds all the tasks needed to run all the bots defined at all Data Mines present at the workspace.",
"updated": 1629361603647
},
{
"style": "Success",
@@ -38,7 +38,7 @@ exports.newFoundationsBotModulesCheckWebhook = function (processIndex) {
function getContextVariables(callBack) {
try {
let reportKey = "Masters" + "-" + "Webhooks" + "-" + "Check-Webhook"
let reportKey = "Webhooks" + "-" + "Webhooks" + "-" + "Check-Webhook"
TS.projects.foundations.globals.loggerVariables.VARIABLES_BY_PROCESS_INDEX_MAP.get(processIndex).BOT_MAIN_LOOP_LOGGER_MODULE_OBJECT.write(MODULE_NAME,
"[INFO] start -> getContextVariables -> reportKey = " + reportKey)
@@ -12,87 +12,119 @@
"assetClasses": [
{
"type": "Asset Class",
"name": "Open Negotiations",
"name": "DEXs",
"config": "{\n\"folderPath\": \"\"\n}",
"project": "Governance",
"assetClasses": [],
"assets": [
"assetClasses": [
{
"type": "Asset",
"name": "Bittrex",
"config": "{\n \"docs\": {\n \"project\": \"Governance\",\n \"category\": \"Topic\",\n \"type\": \"Exchange Asset - Bittrex\"\n }\n}",
"type": "Asset Class",
"name": "First Listing",
"config": "{\n\"folderPath\": \"\"\n}",
"project": "Governance",
"assetClasses": [],
"assets": [],
"id": "548dd163-9991-4de3-9e68-9e8a9a051a2f",
"savedPayload": {
"position": {
"x": 9806.132034355964,
"y": 38608.632034355964
},
"targetPosition": {
"x": 9594,
"y": 38396.5
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
"assetClasses": [
{
"type": "Asset Class",
"name": " Pancakeswap SA/WBTC",
"config": "{\n\"folderPath\": \"\"\n}",
"project": "Governance",
"assetClasses": [],
"assets": [
{
"type": "Asset",
"name": "SA Liquidity",
"config": "{}",
"project": "Governance",
"assetClasses": [],
"assets": [],
"id": "2e59edc7-7e37-40e3-808f-9ab3c7c5f0b3",
"savedPayload": {
"position": {
"x": 10303.807621135331,
"y": 39025.922863406
},
"targetPosition": {
"x": 10044,
"y": 38875.922863406
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
{
"type": "Asset",
"name": "WBTC Liquidity",
"config": "{}",
"project": "Governance",
"assetClasses": [],
"assets": [],
"id": "117afaed-83bd-4b0c-be12-40b8c8dd3a34",
"savedPayload": {
"position": {
"x": 10044,
"y": 39175.922863406
},
"targetPosition": {
"x": 10044,
"y": 38875.922863406
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
}
],
"id": "cc6e34d9-d58a-4aa7-9049-250ea90a8430",
"savedPayload": {
"position": {
"x": 10044,
"y": 38875.922863406
},
"targetPosition": {
"x": 9894,
"y": 38616.115242270665
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false,
"shortcutKey": "w"
}
}
}
}
},
{
"type": "Asset",
"name": "LBank",
"config": "{\n \"docs\": {\n \"project\": \"Governance\",\n \"category\": \"Topic\",\n \"type\": \"Exchange Asset - LBank\"\n }\n}",
"project": "Governance",
"assetClasses": [],
],
"assets": [],
"id": "e4e7addb-a840-4ce9-9e01-74c7e57c24ad",
"id": "54f70f64-029a-4f2f-8847-5208c2fa94a1",
"savedPayload": {
"position": {
"x": 9594,
"y": 38696.5
"x": 9894,
"y": 38616.115242270665
},
"targetPosition": {
"x": 9594,
"y": 38396.5
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
{
"type": "Asset",
"name": "Probit",
"config": "{\n \"docs\": {\n \"project\": \"Governance\",\n \"category\": \"Topic\",\n \"type\": \"Exchange Asset - Probit\"\n }\n}",
"project": "Governance",
"assetClasses": [],
"assets": [],
"id": "6b27f708-c243-42e9-874b-ceceea7db21f",
"savedPayload": {
"position": {
"x": 9381.867965644036,
"y": 38608.632034355964
},
"targetPosition": {
"x": 9594,
"y": 38396.5
"x": 9744,
"y": 38356.30762113533
},
"floatingObject": {
"isPinned": false,
@@ -108,11 +140,164 @@
}
}
],
"id": "144ad412-94fc-4b80-8dd9-2520f64edfcc",
"assets": [],
"id": "90e0c410-b1e7-4f0a-9dec-99c597a7956d",
"savedPayload": {
"position": {
"x": 9744,
"y": 38356.30762113533
},
"targetPosition": {
"x": 9594,
"y": 38396.5
"y": 38096.5
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
{
"type": "Asset Class",
"name": "CEXs",
"config": "{\n\"folderPath\": \"\"\n}",
"project": "Governance",
"assetClasses": [
{
"type": "Asset Class",
"name": "Open Negotiations",
"config": "{\n\"folderPath\": \"\"\n}",
"project": "Governance",
"assetClasses": [],
"assets": [
{
"type": "Asset",
"name": "Bittrex",
"config": "{\n \"docs\": {\n \"project\": \"Governance\",\n \"category\": \"Topic\",\n \"type\": \"Exchange Asset - Bittrex\"\n }\n}",
"project": "Governance",
"assetClasses": [],
"assets": [],
"id": "548dd163-9991-4de3-9e68-9e8a9a051a2f",
"savedPayload": {
"position": {
"x": 9371.645713530756,
"y": 38905.89299015739
},
"targetPosition": {
"x": 9294,
"y": 38616.115242270665
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
{
"type": "Asset",
"name": "LBank",
"config": "{\n \"docs\": {\n \"project\": \"Governance\",\n \"category\": \"Topic\",\n \"type\": \"Exchange Asset - LBank\"\n }\n}",
"project": "Governance",
"assetClasses": [],
"assets": [],
"id": "e4e7addb-a840-4ce9-9e01-74c7e57c24ad",
"savedPayload": {
"position": {
"x": 9144,
"y": 38875.922863406
},
"targetPosition": {
"x": 9294,
"y": 38616.115242270665
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
},
{
"type": "Asset",
"name": "Probit",
"config": "{\n \"docs\": {\n \"project\": \"Governance\",\n \"category\": \"Topic\",\n \"type\": \"Exchange Asset - Probit\"\n }\n}",
"project": "Governance",
"assetClasses": [],
"assets": [],
"id": "6b27f708-c243-42e9-874b-ceceea7db21f",
"savedPayload": {
"position": {
"x": 9004.222252113279,
"y": 38693.76095580142
},
"targetPosition": {
"x": 9294,
"y": 38616.115242270665
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
}
],
"id": "144ad412-94fc-4b80-8dd9-2520f64edfcc",
"savedPayload": {
"position": {
"x": 9294,
"y": 38616.115242270665
},
"targetPosition": {
"x": 9444,
"y": 38356.30762113533
},
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
}
}
}
],
"assets": [],
"id": "ec0ab4b8-e3cc-47e6-94e7-6d181e1008f4",
"savedPayload": {
"position": {
"x": 9444,
"y": 38356.30762113533
},
"targetPosition": {
"x": 9594,
@@ -1,7 +1,7 @@
{
"type": "Pools",
"name": "Superalgos",
"config": "{\"tokens\":\"40960000\",\"codeName\":\"Superalgos\"}",
"config": "{\"tokens\":\"60000000\",\"codeName\":\"Superalgos\"}",
"project": "Governance",
"poolClasses": [
{
@@ -548,7 +548,7 @@
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"isCollapsed": true,
"angleToParent": 2,
"distanceToParent": 3,
"arrangementStyle": 0
@@ -844,12 +844,12 @@
"id": "2207c69c-ee9d-4453-8bf4-582d79b4b635",
"savedPayload": {
"position": {
"x": 25452.076448909353,
"y": 30999.297863215397
"x": 25433.862855091826,
"y": 31054.64830727775
},
"targetPosition": {
"x": 25162.29870102263,
"y": 31076.943576746155
"x": 25137.213607224287,
"y": 31099.3609871306
},
"floatingObject": {
"isPinned": false,
@@ -879,12 +879,12 @@
"id": "ea854cf8-47cd-43f0-b58a-13e61ae3106d",
"savedPayload": {
"position": {
"x": 25452.076448909353,
"y": 31154.589290276912
"x": 25416.475731817547,
"y": 31208.963294440517
},
"targetPosition": {
"x": 25162.29870102263,
"y": 31076.943576746155
"x": 25137.213607224287,
"y": 31099.3609871306
},
"floatingObject": {
"isPinned": false,
@@ -909,12 +909,12 @@
"id": "3c80032c-51a8-4fd8-ab65-cf219c03ce95",
"savedPayload": {
"position": {
"x": 25374.430735378595,
"y": 31289.07561110212
"x": 25324.260547781905,
"y": 31333.91043187101
},
"targetPosition": {
"x": 25162.29870102263,
"y": 31076.943576746155
"x": 25137.213607224287,
"y": 31099.3609871306
},
"floatingObject": {
"isPinned": false,
@@ -939,12 +939,12 @@
"id": "0a79ec65-6f67-4c18-823f-48a6d0494a81",
"savedPayload": {
"position": {
"x": 25239.94441455339,
"y": 31366.721324632876
"x": 25181.926287077138,
"y": 31396.01023499814
},
"targetPosition": {
"x": 25162.29870102263,
"y": 31076.943576746155
"x": 25137.213607224287,
"y": 31099.3609871306
},
"floatingObject": {
"isPinned": false,
@@ -969,12 +969,12 @@
"id": "f51d23aa-742c-40d4-b000-2b90c3ae197c",
"savedPayload": {
"position": {
"x": 25084.652987491874,
"y": 31366.721324632876
"x": 25027.61129991437,
"y": 31378.62311172386
},
"targetPosition": {
"x": 25162.29870102263,
"y": 31076.943576746155
"x": 25137.213607224287,
"y": 31099.3609871306
},
"floatingObject": {
"isPinned": false,
@@ -1030,12 +1030,12 @@
"id": "7f18003d-f622-46d4-b243-e681d78b0503",
"savedPayload": {
"position": {
"x": 25162.29870102263,
"y": 31376.943576746155
"x": 25043.020009434375,
"y": 31411.307175813225
},
"targetPosition": {
"x": 24950.166666666668,
"y": 31164.81154239019
"x": 24883.410386479773,
"y": 31157.289916044738
},
"floatingObject": {
"isPinned": false,
@@ -1065,12 +1065,12 @@
"id": "34acbd28-6ae0-494c-ac26-5b253ac758c6",
"savedPayload": {
"position": {
"x": 24950.166666666668,
"y": 31464.81154239019
"x": 24816.654106292877,
"y": 31449.768289699285
},
"targetPosition": {
"x": 24950.166666666668,
"y": 31164.81154239019
"x": 24883.410386479773,
"y": 31157.289916044738
},
"floatingObject": {
"isPinned": false,
@@ -1100,12 +1100,12 @@
"id": "8f7ad8cf-2c10-4d53-8c3b-baa729ea8292",
"savedPayload": {
"position": {
"x": 24738.034632310704,
"y": 31376.943576746155
"x": 24629.393126711286,
"y": 31316.89953899934
},
"targetPosition": {
"x": 24950.166666666668,
"y": 31164.81154239019
"x": 24883.410386479773,
"y": 31157.289916044738
},
"floatingObject": {
"isPinned": false,
@@ -1351,7 +1351,8 @@
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
"isRunning": false,
"shortcutKey": "a"
}
}
},
@@ -1372,12 +1373,12 @@
"id": "c1b99af4-d8ab-446e-b8c4-76d01c2f2766",
"savedPayload": {
"position": {
"x": 24390.359045531335,
"y": 31014.81154239019
"x": 24380.714867141585,
"y": 30757.065448730853
},
"targetPosition": {
"x": 24650.166666666668,
"y": 30864.81154239019
"x": 24679.87600629594,
"y": 30734.646420654924
},
"floatingObject": {
"isPinned": false,
@@ -1415,12 +1416,12 @@
"id": "ffc5e688-d2d6-4747-ab6e-79d62a4e391b",
"savedPayload": {
"position": {
"x": 24390.359045531335,
"y": 30714.81154239019
"x": 24510.879988876855,
"y": 30486.774788360126
},
"targetPosition": {
"x": 24650.166666666668,
"y": 30864.81154239019
"x": 24679.87600629594,
"y": 30734.646420654924
},
"floatingObject": {
"isPinned": false,
@@ -1505,7 +1506,8 @@
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
"isRunning": false,
"shortcutKey": ""
},
"referenceParent": {
"type": "Assets",
@@ -1789,7 +1791,7 @@
"floatingObject": {
"isPinned": false,
"isFrozen": false,
"isCollapsed": false,
"isCollapsed": true,
"angleToParent": 1,
"distanceToParent": 3,
"arrangementStyle": 0
@@ -1820,7 +1822,8 @@
"arrangementStyle": 0
},
"uiObject": {
"isRunning": false
"isRunning": false,
"shortcutKey": ""
}
}
}
File diff suppressed because it is too large. Load diff
+3 -1
View File
@@ -1,7 +1,9 @@
function newGovernanceGlobalsSaToken() {
let thisObject = {
SA_TOKEN_BSC_CONTRACT_ADDRESS: '0xfb981ed9a92377ca4d75d924b9ca06df163924fd',
SA_TOKEN_BSC_TREASURY_ACCOUNT_ADDRESS: '0x8d4d2557ce99f83f658adf61eef3e61e04c2ac2c'
SA_TOKEN_BSC_CONTRACT_ABI: '[{"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":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"account","type":"address"},{"name":"amount","type":"uint256"}],"name":"mint","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_value","type":"uint256"}],"name":"burn","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseApproval","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"listAddress","type":"address"},{"name":"isBlackListed","type":"bool"}],"name":"blackListAddress","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"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":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseApproval","outputs":[{"name":"success","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"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_decimals","type":"uint256"},{"name":"_supply","type":"uint256"},{"name":"tokenOwner","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"burner","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"blackListed","type":"address"},{"indexed":false,"name":"value","type":"bool"}],"name":"Blacklist","type":"event"},{"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",Line truncated
SA_TOKEN_BSC_TREASURY_ACCOUNT_ADDRESS: '0x8d4d2557ce99f83f658adf61eef3e61e04c2ac2c',
SA_TOKEN_BSC_DECIMAL_FACTOR: 1000000000000000000
}
return thisObject
}
@@ -33,7 +33,7 @@ function newGovernanceReportsCommmandInterface() {
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov PRs Command')
return
}
if (command.indexOf('gov.prs') !== 0 ) { return 'Not PRs Commands' }
if (command.indexOf('gov.prs') !== 0) { return 'Not PRs Commands' }
/* Set up the commit message */
let message = command.trim().substring(command.indexOf(' ') + 1, command.length)
@@ -127,28 +127,83 @@ function newGovernanceReportsCommmandInterface() {
}
if (command.indexOf('gov.pay') !== 0) { return 'Not Pay Commands' }
httpRequest(undefined, 'Gov/Pay/' + UI.projects.education.spaces.docsSpace.currentBranch, onResponse)
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Message - Paying to Contributors')
return
/*
Let's create a list of payments to be made.
*/
let paymentsArray = []
/*
Here we get from the workspace all User Profiles.
*/
let userProfiles = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('User Profile')
/*
Transform the result array into table records.
*/
for (let j = 0; j < userProfiles.length; j++) {
let userProfile = userProfiles[j]
if (userProfile.payload === undefined) { continue }
if (userProfile.tokensMined === undefined) { continue }
if (userProfile.tokensMined.payload === undefined) { continue }
if (userProfile.tokensMined.payload.tokensMined === undefined) { continue }
let payment = {
"userProfile": userProfile.name,
"from": UI.projects.governance.globals.saToken.SA_TOKEN_BSC_TREASURY_ACCOUNT_ADDRESS,
"to": userProfile.payload.blockchainAccount,
"amount": 1 * UI.projects.governance.globals.saToken.SA_TOKEN_BSC_DECIMAL_FACTOR //(userProfile.tokensMined.payload.tokensMined.total | 0) * UI.projects.governance.globals.saToken.SA_TOKEN_BSC_DECIMAL_FACTOR
}
paymentsArray.push(payment)
}
/* Let's get the Mnemonic */
let web3API = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByNodeType('APIs')[0].web3API
let mnemonic = UI.projects.foundations.utilities.nodeConfig.loadConfigProperty(web3API.payload, 'mnemonic')
/* Lets execute this command against the Client */
let params = {
method: 'payContributors',
contractAddress: UI.projects.governance.globals.saToken.SA_TOKEN_BSC_CONTRACT_ADDRESS,
contractAbi: UI.projects.governance.globals.saToken.SA_TOKEN_BSC_CONTRACT_ABI,
paymentsArray: paymentsArray,
mnemonic: mnemonic
}
let url = 'GOV' // We will access the default Client GOV endpoint.
httpRequest(JSON.stringify(params), url, onResponse)
function onResponse(err, data) {
/* Lets check the result of the call through the http interface */
data = JSON.parse(data)
if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result && data.result === GLOBAL.CUSTOM_OK_RESPONSE.result) {
if (data.message.summary.changes + data.message.summary.deletions + data.message.summary.insertions > 0) {
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Message - Pay Done')
} else {
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Message - Pay Failed')
}
if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
console.log('[ERROR] Call via HTTP Interface failed.' + err.stack)
console.log('[ERROR] Params = ' + JSON.stringify(params))
return
}
let response = JSON.parse(data)
/* Lets check the result of the method call */
if (response.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
console.log('[ERROR] Call to Client Github Server failed.' + err.stack)
console.log('[ERROR] Params = ' + JSON.stringify(params))
}
/* Successful Call */
if (response.result === GLOBAL.DEFAULT_OK_RESPONSE.result) {
UI.projects.education.spaces.docsSpace.navigateTo('Governance', 'Topic', 'Gov Message - Contribution Payments Processed')
} else {
UI.projects.education.spaces.docsSpace.navigateTo(
data.docs.project,
data.docs.category,
data.docs.type,
data.docs.anchor,
response.docs.project,
response.docs.category,
response.docs.type,
response.docs.anchor,
undefined,
data.docs.placeholder
response.docs.placeholder
)
}
}
@@ -77,6 +77,7 @@ function newGovernanceReportsDelegation() {
if (program === undefined) { continue }
if (program.payload === undefined) { continue }
if (program.payload[programPropertyName] === undefined) { continue }
if (program.payload[programPropertyName].bonus === undefined) { continue }
let tableRecord = {
"name": userProfile.name,
@@ -88,7 +88,7 @@ function newGovernanceUserProfileSpace() {
if (transfer.contractAddress !== UI.projects.governance.globals.saToken.SA_TOKEN_BSC_CONTRACT_ADDRESS) { continue }
if (transfer.from !== UI.projects.governance.globals.saToken.SA_TOKEN_BSC_TREASURY_ACCOUNT_ADDRESS) { continue }
let currentReputation = Number(transfer.value) / 1000000000000000000
let currentReputation = Number(transfer.value) / UI.projects.governance.globals.saToken.SA_TOKEN_BSC_DECIMAL_FACTOR
let previousReputation = reputationByAddress.get(transfer.to)
let newReputation = previousReputation | 0 + currentReputation
reputationByAddress.set(transfer.to, newReputation)
@@ -91,6 +91,7 @@ function newGovernanceUtilitiesDecendentTables() {
if (program === undefined) { continue }
if (program.payload === undefined) { continue }
if (program.payload[programPropertyName] === undefined) { continue }
if (program.payload[programPropertyName].bonus === undefined) { continue }
let tableRecord = {
"name": userProfile.name,