Skip to content

Commit

Permalink
Merge pull request #4284 from Superalgos/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
julian-molina authored Aug 22, 2022
2 parents 45802a6 + 6c68817 commit 3e30580
Show file tree
Hide file tree
Showing 139 changed files with 38,658 additions and 984 deletions.
5 changes: 4 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run unitTest
if [ "$UNITTESTS" != "false" ]
then
npm run unitTest
fi

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
1,461 changes: 1,461 additions & 0 deletions Bitcoin-Factory/Reports/Testnet-01hs-2022-07-08-07-24-00-DJ05GaZ.CSV

Large diffs are not rendered by default.

1,488 changes: 1,488 additions & 0 deletions Bitcoin-Factory/Reports/Testnet-01hs-2022-07-14-20-50-00-DJ05GaZ.CSV

Large diffs are not rendered by default.

2,049 changes: 2,049 additions & 0 deletions Bitcoin-Factory/Reports/Testnet-2022-07-08-07-24-00-DJ05GaZ.CSV

Large diffs are not rendered by default.

2,074 changes: 2,074 additions & 0 deletions Bitcoin-Factory/Reports/Testnet-2022-07-14-20-50-00-DJ05GaZ.CSV

Large diffs are not rendered by default.

2,075 changes: 2,075 additions & 0 deletions Bitcoin-Factory/Reports/Testnet-2022-07-14-22-22-00-DJ05GaZ.CSV

Large diffs are not rendered by default.

62 changes: 62 additions & 0 deletions Bitcoin-Factory/Reports/Testnet-2022-07-16-08-24-00-DJ05GaZ.CSV

Large diffs are not rendered by default.

127 changes: 127 additions & 0 deletions Bitcoin-Factory/Reports/Testnet-2022-07-16-08-45-00-DJ05GaZ.CSV

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions Bitcoin-Factory/Reports/Testnet-2022-07-17-15-47-00-DJ05GaZ.CSV

Large diffs are not rendered by default.

2,041 changes: 2,041 additions & 0 deletions Bitcoin-Factory/Reports/Testnet-2022-07-17-21-06-00-DJ05GaZ.CSV

Large diffs are not rendered by default.

2,037 changes: 2,037 additions & 0 deletions Bitcoin-Factory/Reports/Testnet-2022-07-21-08-35-00-DJ05GaZ.CSV

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2,045 changes: 2,045 additions & 0 deletions Bitcoin-Factory/Reports/Testnet-2022-07-24-10-24-00-DJ05GaZ.CSV

Large diffs are not rendered by default.

62 changes: 62 additions & 0 deletions Bitcoin-Factory/Reports/Testnet-2022-07-24-10-42-00-DJ05GaZ.CSV

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions Bitcoin-Factory/Reports/Testnet-2022-08-04-01-19-00.CSV

Large diffs are not rendered by default.

1,341 changes: 1,341 additions & 0 deletions Bitcoin-Factory/Reports/Testnet-2022-08-04-14-08-00.CSV

Large diffs are not rendered by default.

1,620 changes: 1,620 additions & 0 deletions Bitcoin-Factory/Reports/Testnet-2022-08-07-17-05-00.CSV

Large diffs are not rendered by default.

5,111 changes: 5,111 additions & 0 deletions Bitcoin-Factory/Reports/Testnet-2022-08-08-18-39-00.CSV

Large diffs are not rendered by default.

8,701 changes: 8,701 additions & 0 deletions Bitcoin-Factory/Reports/Testnet-2022-08-13-23-24-00.CSV

Large diffs are not rendered by default.

2,037 changes: 2,037 additions & 0 deletions Bitcoin-Factory/Reports/Testnet-Heikin-2022-07-21-08-35-00-DJ05GaZ.CSV

Large diffs are not rendered by default.

2,045 changes: 2,045 additions & 0 deletions Bitcoin-Factory/Reports/Testnet-Heikin-2022-07-24-10-24-00-DJ05GaZ.CSV

Large diffs are not rendered by default.

227 changes: 227 additions & 0 deletions Bitcoin-Factory/Reports/Testnet_Masters-2022-08-19-21-07-00.CSV

Large diffs are not rendered by default.

255 changes: 255 additions & 0 deletions Bitcoin-Factory/Reports/Testnet_Turtles-2022-08-18-18-03-00.CSV

Large diffs are not rendered by default.

25 changes: 17 additions & 8 deletions Platform/Client/bitcoinFactoryServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ exports.newBitcoinFactoryServer = function newBitcoinFactoryServer() {

/* Parse CSV file, convert to JSON objects */
const csvToJsonResult = []
let parsingError = 0
let cleanResult = rewardsFile.toString().replace(/\r/g, "")
let array = cleanResult.split("\n")
const headers = array[0].split(",")
Expand All @@ -273,20 +274,28 @@ exports.newBitcoinFactoryServer = function newBitcoinFactoryServer() {
if (character !== '"') string += character
}
let jsonProperties = string.split("|")
for (let j in headers) {
if (jsonProperties[j].includes(",")) {
jsonObject[headers[j]] = jsonProperties[j]
.split(",").map(item => item.trim())
try {
for (let j in headers) {
if (jsonProperties[j].includes(",")) {
jsonObject[headers[j]] = jsonProperties[j]
.split(",").map(item => item.trim())
}
else jsonObject[headers[j]] = jsonProperties[j]
}
else jsonObject[headers[j]] = jsonProperties[j]
} catch(err) {
if (parsingError === 0) { parsingError = i + 1 }
}
/* Push the genearted JSON object to result array */
csvToJsonResult.push(jsonObject)
}

/* Check if file contains mandatory columns */
/* Check if file contained any malformed lines */
if (parsingError > 0) {
console.log((new Date()).toISOString(), "[WARN] Bitcoin Factory Rewards File", reportsDirectory[f], "contains malformed records - e.g. line", parsingError, ", discarding")
continue
}
/* Check if file contains mandatory columns */
if (!headers.includes("assignedTimestamp") || !headers.includes("testedByProfile") || !headers.includes("status")) {
console.log((new Date()).toISOString(), "[WARN] Governance Rewards File", reportsDirectory[f], "with unexpected syntax, discarding")
console.log((new Date()).toISOString(), "[WARN] Bitcoin Factory Rewards File", reportsDirectory[f], "with unexpected syntax, discarding")
continue
}

Expand Down
50 changes: 32 additions & 18 deletions Platform/Client/httpInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ exports.newHttpInterface = function newHttpInterface() {
case 'getUserWalletBalance': {

let serverResponse = await PL.servers.WEB3_SERVER.getUserWalletBalance(
params.chain,
params.walletAddress,
params.contractAddress
)
Expand Down Expand Up @@ -1107,11 +1108,11 @@ exports.newHttpInterface = function newHttpInterface() {
case 'Contribute': {
try {
// We create a pull request of all active changes
let commitMessage = unescape(requestPath[3])
const username = unescape(requestPath[4])
const token = unescape(requestPath[5])
const currentBranch = unescape(requestPath[6])
const contributionsBranch = unescape(requestPath[7])
let commitMessage = decodeURIComponent(requestPath[3])
const username = decodeURIComponent(requestPath[4])
const token = decodeURIComponent(requestPath[5])
const currentBranch = decodeURIComponent(requestPath[6])
const contributionsBranch = decodeURIComponent(requestPath[7])
let error

// rebuild array of commit messages if committing from contribturions space
Expand Down Expand Up @@ -1213,9 +1214,6 @@ exports.newHttpInterface = function newHttpInterface() {

async function pushFiles(git) {
try {
await git.pull('origin', currentBranch)
await git.add('./*')

// If contributing from contributrions space gather the correct commit message
let messageToSend
if (commitMessage instanceof Array) {
Expand All @@ -1225,7 +1223,17 @@ exports.newHttpInterface = function newHttpInterface() {
messageToSend = commitMessage

}
await git.commit(messageToSend)
if (messageToSend === undefined || messageToSend === '') {
messageToSend = 'No commit message defined'
}
await git.pull('origin', currentBranch)
await git.add('./*')

/* Deactivate Unit Tests for the Contributions Space by setting UNITTESTS environment variable within the commit call. */
const UNITTESTS = 'false'
await git
.env({...process.env, UNITTESTS})
.commit(messageToSend)

await git.push('origin', currentBranch)
} catch (err) {
Expand Down Expand Up @@ -1355,12 +1363,12 @@ exports.newHttpInterface = function newHttpInterface() {
case 'ContributeSingleRepo': {
try {
// We create a pull request for the active changes of a particular repo
let commitMessage = unescape(requestPath[3])
const username = unescape(requestPath[4])
const token = unescape(requestPath[5])
const currentBranch = unescape(requestPath[6])
const contributionsBranch = unescape(requestPath[7])
const repoName = unescape(requestPath[8])
let commitMessage = decodeURIComponent(requestPath[3])
const username = decodeURIComponent(requestPath[4])
const token = decodeURIComponent(requestPath[5])
const currentBranch = decodeURIComponent(requestPath[6])
const contributionsBranch = decodeURIComponent(requestPath[7])
const repoName = decodeURIComponent(requestPath[8])
let error

/* Unsaving # */
Expand Down Expand Up @@ -1447,7 +1455,11 @@ exports.newHttpInterface = function newHttpInterface() {
try {
await git.pull('origin', currentBranch)
await git.add('./*')
await git.commit(commitMessage)
/* Deactivate Unit Tests for the Contribution Space by setting UNITTESTS environment variable within the commit call. */
const UNITTESTS = 'false'
await git
.env({...process.env, UNITTESTS})
.commit(commitMessage)
await git.push('origin', currentBranch)
} catch (err) {
console.log((new Date()).toISOString(), '[ERROR] httpInterface -> App -> Contribute -> doGit -> Method call produced an error.')
Expand Down Expand Up @@ -2649,8 +2661,10 @@ exports.newHttpInterface = function newHttpInterface() {


await PL.servers.WEB3_SERVER.payContributors(
params.contractAddress,
params.contractAbi,
params.contractAddressDict,
params.treasuryAccountDict,
params.contractABIDict,
params.decimalFactorDict,
params.paymentsArray,
params.mnemonic
)
Expand Down
Loading

0 comments on commit 3e30580

Please sign in to comment.