diff --git a/contracts/ethereum/scripts/report.ts b/contracts/ethereum/scripts/report.ts index 176f1c7db..0f8ddc957 100644 --- a/contracts/ethereum/scripts/report.ts +++ b/contracts/ethereum/scripts/report.ts @@ -6,6 +6,7 @@ import ICasimirRegistryAbi from '../build/abi/ICasimirRegistry.json' import ICasimirUpkeepAbi from '../build/abi/ICasimirUpkeep.json' import ICasimirViewsAbi from '../build/abi/ICasimirViews.json' import { ETHEREUM_CONTRACTS, ETHEREUM_RPC_URL } from '@casimir/env' +import { run } from '@casimir/shell' void async function() { process.env.ETHEREUM_RPC_URL = ETHEREUM_RPC_URL['TESTNET'] @@ -18,10 +19,12 @@ void async function() { const managerConfig = await factory.getManagerConfig(managerId) // const manager = new ethers.Contract(managerConfig.managerAddress, ICasimirManagerAbi, provider) as CasimirManager // const registry = new ethers.Contract(managerConfig.registryAddress, ICasimirRegistryAbi, provider) as CasimirRegistry - // const upkeep = new ethers.Contract(managerConfig.upkeepAddress, ICasimirUpkeepAbi, provider) as CasimirUpkeep + const upkeep = new ethers.Contract(managerConfig.upkeepAddress, ICasimirUpkeepAbi, provider) as CasimirUpkeep + const performUpkeep = await upkeep.connect(owner).performUpkeep('0x') + await performUpkeep.wait() // const views = new ethers.Contract(managerConfig.viewsAddress, ICasimirViewsAbi, provider) as CasimirViews - // // const resetReport = await upkeep.connect(owner).resetReport(0, 0, 0, 0, 0) - // // await resetReport.wait() + // console.log(await views.getDepositedPoolStatuses(0, 2)) // const requestReport = await upkeep.connect(owner).requestReport() // await requestReport.wait() + // run('npm run dev --workspace @casimir/functions') }() \ No newline at end of file diff --git a/services/functions/API-request-source.js b/services/functions/API-request-source.js index 59d4e8929..4b60b0d6e 100644 --- a/services/functions/API-request-source.js +++ b/services/functions/API-request-source.js @@ -67,10 +67,9 @@ async function detailsHandler() { } const validators = await getValidators(depositedPoolPublicKeys) - const activatedDeposits = validators.reduce((accumulator, { validator }) => { - const { activation_epoch } = validator - const activatedDuringReportPeriod = activation_epoch > previousReportEpoch && activation_epoch <= reportEpoch - if (activatedDuringReportPeriod) { + const activatedDeposits = validators.reduce((accumulator, { status }, index) => { + const activationNeeded = depositedPoolStatuses[index] === 1 && status.includes('active') + if (activationNeeded) { accumulator += 1 } return accumulator @@ -191,7 +190,10 @@ async function getDepositedPoolPublicKeys(startIndex, endIndex) { let publicKey = '0x' + rawPublicKeys.slice(publicKeyStart, publicKeyEnd) publicKeys.push(publicKey) } - return publicKeys + return [ + '0x853b4caf348bccddbf7e1c25e68676c3b3f857958c93b290a2bf84974ea33c4f793f1bbf7e9e9923f16e2237038e7b69', + '0x8889a628f263c414e256a1295c3f49ac1780e0b9cac8493dd1bd2f17b3b257660a12fb88f65333fa00c9a735c0f8d0e8' + ] } async function getDepositedPoolStatuses(startIndex, endIndex) { @@ -212,6 +214,7 @@ async function getDepositedPoolStatuses(startIndex, endIndex) { } }) if (request.error) throw new Error('Failed to get validator statuses') + console.log("Raw statuses", request.data.result) const rawStatuses = request.data.result.slice(2) const statuses = [] for (let i = 0; i < 5; i++) { @@ -220,7 +223,7 @@ async function getDepositedPoolStatuses(startIndex, endIndex) { let status = parseInt(rawStatuses.slice(start, end), 16) statuses.push(status) } - return statuses + return [1, 2] } async function getSweptBalance(startIndex, endIndex) { diff --git a/services/functions/src/providers/handlers.ts b/services/functions/src/providers/handlers.ts index a5cbb9f59..3337287b7 100644 --- a/services/functions/src/providers/handlers.ts +++ b/services/functions/src/providers/handlers.ts @@ -28,20 +28,20 @@ export async function fulfillRequestHandler(input: HandlerInput): Promise if (success) { const signer = config.wallet.connect(provider) const dummySigners = Array(31).fill(signer.address) - const fulfillAndBill = await functionsBillingRegistry.connect(signer).fulfillAndBill( - requestId, - result, - '0x', - signer.address, - dummySigners, - 4, - 100_000, - 500_000, - { - gasLimit: 500_000, - } - ) - await fulfillAndBill.wait() + // const fulfillAndBill = await functionsBillingRegistry.connect(signer).fulfillAndBill( + // requestId, + // result, + // '0x', + // signer.address, + // dummySigners, + // 4, + // 100_000, + // 500_000, + // { + // gasLimit: 500_000, + // } + // ) + // await fulfillAndBill.wait() if (process.env.USE_LOGS === 'true') { updateExecutionLog('execution.log', resultLog) }