Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add arthera network in campaign file manager #440

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions controllers/external.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
getLinkedinLinkInfo,
influencersLinks,
getTransactionAmountExternal,
updateBounty,
} = require('../web3/campaigns')

const { create } = require('ipfs-http-client')
Expand Down Expand Up @@ -1150,12 +1151,12 @@
}

let bountie = campaignData.bounties.find(
(b) => b.oracle == findBountyOracle(prom.typeSN)
(b) => b.oracle == findBountyOracle(link.typeSN)
)
let maxBountieFollowers =
bountie.categories[bountie.categories.length - 1].maxFollowers
var evts = await updateBounty(
idProm,
req.body.idProm,
credentials,
tronWeb,
campaignData.token.type
Expand All @@ -1166,15 +1167,15 @@
}

await Request.updateOne(
{ id: idProm },
{ id: req.body.idProm },

Check failure

Code scanning / CodeQL

Database query built from user-controlled sources High

This query object depends on a
user-provided value
.
{
$set: {
nbAbos: stats,
isBounty: true,
new: false,
date: Date.now(),
typeSN: prom.typeSN,
idPost: prom.idPost,
typeSN: link.typeSN,
idPost: link.idPost,
idUser: externalWallet.idUser,
},
},
Expand All @@ -1189,7 +1190,7 @@
campaignContract:
(!!tronWeb && TronConstant.campaign.address) ||
ctr.options.address,
idProm: idProm,
idProm: req.body.idProm,
nbAbos: stats,
})
} finally {
Expand Down Expand Up @@ -1254,14 +1255,6 @@
stats?.shares != prevstat[0]?.shares ||
stats?.views != prevstat[0]?.views
) {
requests = await Request.find({
new: true,
isBounty: false,
typeSN: link.typeSN,
idPost: link.idPost,
idUser: externalWallet.UserId,
})
var tronWeb
var idRequest = req.body.tx[0].topics[1]

// var idRequest = (!!tronWeb && evt.result.idRequest) || evt.raw.topics[1]
Expand Down
10 changes: 8 additions & 2 deletions manager/oracles.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const {
web3PolygonUrl,
CampaignConstants,
OracleConstants,
web3UrlArthera,
} = require('../conf/const')
const child_process = require('child_process')
const {
Expand Down Expand Up @@ -1514,7 +1515,12 @@ exports.answerCallExternal = async (opts) => {
campaignWallet = JSON.parse(campaignKeystore)

const web3 = new Web3(
new Web3.providers.HttpProvider(web3UrlBep20, options)
new Web3.providers.HttpProvider(
opts.credentials.network.toUpperCase() === 'ARTHERA'
? web3UrlArthera
: web3UrlBep20,
options
)
)

// Decrypt the campaign wallet using the owner's password
Expand Down Expand Up @@ -1549,7 +1555,7 @@ exports.answerCallExternal = async (opts) => {
)
.send({
from: process.env.CAMPAIGN_OWNER,
gas: 500000,
gas: 800000,
gasPrice: gasPrice,
})
.once('transactionHash', function (hash) {})
Expand Down
1 change: 1 addition & 0 deletions web3/campaigns.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const networks = [
{ name: 'BEP20', providerUrl: process.env.WEB3_URL_BEP20 },
{ name: 'POLYGON', providerUrl: process.env.WEB3_URL_POLYGON },
{ name: 'BTTC', providerUrl: process.env.WEB3_URL_BTT },
{ name: 'ARTHERA', providerUrl: process.env.WEB3_URL_ARTHERA },
]

const { getHttpProvider, networkProviders } = require('../web3/web3-connection')
Expand Down
Loading