diff --git a/controllers/external.controller.js b/controllers/external.controller.js index 08aca2d4..41ced700 100644 --- a/controllers/external.controller.js +++ b/controllers/external.controller.js @@ -68,6 +68,7 @@ const { getLinkedinLinkInfo, influencersLinks, getTransactionAmountExternal, + updateBounty, } = require('../web3/campaigns') const { create } = require('ipfs-http-client') @@ -1150,12 +1151,12 @@ module.exports.externalAnswer = async (req, res) => { } 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 @@ -1166,15 +1167,15 @@ module.exports.externalAnswer = async (req, res) => { } await Request.updateOne( - { id: idProm }, + { id: req.body.idProm }, { $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, }, }, @@ -1189,7 +1190,7 @@ module.exports.externalAnswer = async (req, res) => { campaignContract: (!!tronWeb && TronConstant.campaign.address) || ctr.options.address, - idProm: idProm, + idProm: req.body.idProm, nbAbos: stats, }) } finally { @@ -1254,14 +1255,6 @@ module.exports.externalAnswer = async (req, res) => { 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] diff --git a/manager/oracles.js b/manager/oracles.js index 16a16aff..b131266b 100644 --- a/manager/oracles.js +++ b/manager/oracles.js @@ -9,6 +9,7 @@ const { web3PolygonUrl, CampaignConstants, OracleConstants, + web3UrlArthera, } = require('../conf/const') const child_process = require('child_process') const { @@ -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 @@ -1549,7 +1555,7 @@ exports.answerCallExternal = async (opts) => { ) .send({ from: process.env.CAMPAIGN_OWNER, - gas: 500000, + gas: 800000, gasPrice: gasPrice, }) .once('transactionHash', function (hash) {}) diff --git a/web3/campaigns.js b/web3/campaigns.js index 5207234d..0e0c44b0 100644 --- a/web3/campaigns.js +++ b/web3/campaigns.js @@ -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')