From b0607c717cd72f988acaaa44f76e20f83008f385 Mon Sep 17 00:00:00 2001 From: geovla Date: Sun, 2 Nov 2025 11:01:33 +0200 Subject: [PATCH 1/2] feat: add Utopia Miner contract ABI and TVL calculation --- projects/utopia/abi.js | 11 +++++++++++ projects/utopia/index.js | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 projects/utopia/abi.js create mode 100644 projects/utopia/index.js diff --git a/projects/utopia/abi.js b/projects/utopia/abi.js new file mode 100644 index 0000000000..a4ee1f5eff --- /dev/null +++ b/projects/utopia/abi.js @@ -0,0 +1,11 @@ +const abi = Object.freeze({ + getBalance: { + name: 'getBalance', + type: 'function', + stateMutability: 'view', + inputs: [], + outputs: [{ type: 'uint256', name: '' }], + }, +}); + +module.exports = { abi }; diff --git a/projects/utopia/index.js b/projects/utopia/index.js new file mode 100644 index 0000000000..734d50a35b --- /dev/null +++ b/projects/utopia/index.js @@ -0,0 +1,19 @@ +const { abi } = require('./abi'); + +const UTOPIA_MINER_CONTRACT = '0x61ea85A817344789d836fbC18B9099bB280b383D'; + +async function tvl(api) { + const contractBalance = await api.call({ + abi: abi.getBalance, + target: UTOPIA_MINER_CONTRACT, + }); + + api.addGasToken(contractBalance); +} + +module.exports = { + methodology: 'TVL is calculated as the total BNB balance locked in the Utopia Miner contract.', + bsc: { + tvl, + }, +}; From 6b86efee1ae5dc857f326f8882c7895fd6f00f05 Mon Sep 17 00:00:00 2001 From: geovla Date: Thu, 6 Nov 2025 11:43:01 +0200 Subject: [PATCH 2/2] refactor: remove unused ABI file and update TVL calculation to use sdk directly --- projects/utopia/abi.js | 11 ----------- projects/utopia/index.js | 11 ++++++----- 2 files changed, 6 insertions(+), 16 deletions(-) delete mode 100644 projects/utopia/abi.js diff --git a/projects/utopia/abi.js b/projects/utopia/abi.js deleted file mode 100644 index a4ee1f5eff..0000000000 --- a/projects/utopia/abi.js +++ /dev/null @@ -1,11 +0,0 @@ -const abi = Object.freeze({ - getBalance: { - name: 'getBalance', - type: 'function', - stateMutability: 'view', - inputs: [], - outputs: [{ type: 'uint256', name: '' }], - }, -}); - -module.exports = { abi }; diff --git a/projects/utopia/index.js b/projects/utopia/index.js index 734d50a35b..1e998e140a 100644 --- a/projects/utopia/index.js +++ b/projects/utopia/index.js @@ -1,18 +1,19 @@ -const { abi } = require('./abi'); +const sdk = require('@defillama/sdk'); const UTOPIA_MINER_CONTRACT = '0x61ea85A817344789d836fbC18B9099bB280b383D'; async function tvl(api) { - const contractBalance = await api.call({ - abi: abi.getBalance, + const contractBalance = await sdk.api.eth.getBalance({ target: UTOPIA_MINER_CONTRACT, + chain: 'bsc', }); - api.addGasToken(contractBalance); + api.addGasToken(contractBalance.output); } module.exports = { - methodology: 'TVL is calculated as the total BNB balance locked in the Utopia Miner contract.', + methodology: + 'TVL is calculated as the total BNB balance locked in the Utopia Miner contract.', bsc: { tvl, },