Skip to content

Commit

Permalink
track doge balances
Browse files Browse the repository at this point in the history
  • Loading branch information
g1nt0ki committed May 6, 2024
1 parent 6c9ee71 commit dafd067
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 12 deletions.
3 changes: 1 addition & 2 deletions projects/21-co/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ const config = {
'addr1q976xcl3r2vt6he4q3rq6lyq8832v5mgpdds0e84z7vn0hma5d3lzx5ch40n2pzxp47gqw0z5efksz6mqlj029uexl0snqdsul'
],
},
/*
doge: {
owners: [
'DMbNFKqJpr9B9XPfZL5zbgMTvzpN7h7sfz'
],
}, */
},
bep2: {
owners: [
'bnb1k3ulpgw4wzl0e8qx80u87aq9w7ekfygruzs4dg'
Expand Down
7 changes: 4 additions & 3 deletions projects/binance/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ const assetList = [
['DOGE', 'BEP20', '0xd3a22590f8243f8e83ac230d1842c9af0404c4a1'],
['DOGE', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'],
['DOGE', 'BEP20', '0xf977814e90da44bfa03b6295a0616a897441acec'],
/*
['DOGE', 'DOGE', 'D73RQLGWW9TBT2AKspEP24wLiXFrXvnTqX'],
['DOGE', 'DOGE', 'D7BrtudMAdwz2U7vSGumVDuxZsZNibJuzw'],
['DOGE', 'DOGE', 'D7D2f2WuEkwhTWqBkisZ5sM3JagaBcNWBs'],
Expand Down Expand Up @@ -211,7 +210,6 @@ const assetList = [
['DOGE', 'DOGE', 'DTGrjpvJXQU2zSpUDsnk9b4PAQW5Pwtg4K'],
['DOGE', 'DOGE', 'DTSop4ycWkpmDqpncVZ3jwKp3z7B4kW4T3'],
['DOGE', 'DOGE', 'DU8gPC5mh4KxWJARQRxoESFark2jAguBr5'],
*/
['DOT', 'BEP2', 'bnb17jky4rwhu9rzgrx7exrfc3pcd5z290ga8qfm0j'],
['DOT', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'],
['DOT', 'BEP2', 'bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t'],
Expand Down Expand Up @@ -619,7 +617,7 @@ function getAddresses(chain) {
return assetList.filter(i => i[1] === chain).map(i => i[2])
}
function getOwners(chain) {
const isCaseSensitive = ['BTC', 'TRX', 'SOL', 'XRP', 'LTC', 'DOT', 'ALGO'].includes(chain)
const isCaseSensitive = ['BTC', 'TRX', 'SOL', 'XRP', 'LTC', 'DOT', 'ALGO', 'DOGE'].includes(chain)
return getUniqueAddresses(assetList.filter(i => i[1] === chain).map(i => i[2]), isCaseSensitive)
}

Expand Down Expand Up @@ -699,4 +697,7 @@ module.exports = {
near: {
owners: getOwners('NEAR')
},
doge: {
owners: getOwners('DOGE')
},
}
2 changes: 0 additions & 2 deletions projects/bitfinex/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,9 @@ const config = {
'zil184u2al6n0nrks06xjgq080hc95f77ttd7rkqvn', // Zilliqa cold wallet
]
},
/*
doge: {
owners: ['DQQckuSMsiFjaAdGiNjvDyswcz9RWQU2xe']
}
*/
}

module.exports = cexExports(config)
2 changes: 0 additions & 2 deletions projects/coinsquare/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ const config = {

]
},
/*
doge: {
owners: [
'D9uH999MANKyNkzfb8XwRmQhHEBNLBh9sA',
Expand All @@ -81,7 +80,6 @@ const config = {
'DAd1JWwtwx1paUuWG71ePNLU3WJUFaMJoh'
]
}
*/
}

module.exports = cexExports(config)
30 changes: 30 additions & 0 deletions projects/helper/chain/doge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const sdk = require('@defillama/sdk')
const { get } = require('../http')
const plimit = require('p-limit')
const { sleep } = require('../utils')

const url = addr => 'https://doge1.trezor.io/api/v2/address/' + addr
const _rateLimited = plimit(1)
const rateLimited = fn => (...args) => _rateLimited(() => fn(...args))
const getBalance = rateLimited(_getBalance)

async function _getBalance(addr) {
const { balance } = await get(url(addr), {
headers: {
'User-Agent': 'Thunder Client (https://www.thunderclient.com)',
}
})
await sleep(2000)
return +balance
}

async function sumTokens({ api, owners = [] }) {
for (const owner of owners) {
const balance = await getBalance(owner)
api.addCGToken('dogecoin', balance / 1e8)
}
}

module.exports = {
sumTokens
}
1 change: 1 addition & 0 deletions projects/helper/sumTokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const helpers = {
"stacks": require("./chain/stacks"),
"starknet": require("./chain/starknet"),
"brc20": require("./chain/brc20"),
"doge": require("./chain/doge"),
}

const geckoMapping = {
Expand Down
2 changes: 1 addition & 1 deletion projects/helper/tokenMapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets))
// orbit brige: https://bridge.orbitchain.io/open/v1/api/monitor/rawTokenList

const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei', 'archway', 'migaloo', 'secret', 'aura', 'xpla', 'bostrom']
const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', 'mvc', 'renec',]
const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', 'mvc', 'renec', 'doge']

const transformTokens = {
// Sample Code
Expand Down
4 changes: 2 additions & 2 deletions projects/solidly-v3/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ module.exports = uniV3Export({
ethereum: { factory: "0x70fe4a44ea505cfa3a57b95cf2862d4fd5f0f687", fromBlock: 18044650, },
optimism: { factory: "0x70fe4a44ea505cfa3a57b95cf2862d4fd5f0f687", fromBlock: 115235065, },
base: { factory: "0x70fe4a44ea505cfa3a57b95cf2862d4fd5f0f687", fromBlock: 9672720, },
arbitrum: { factory: "0x70fe4a44ea505cfa3a57b95cf2862d4fd5f0f687", fromBlock: 173576189, },
arbitrum: { factory: "0x70fe4a44ea505cfa3a57b95cf2862d4fd5f0f687", fromBlock: 173576189, permitFailure: true, },
fantom: { factory: "0x70fe4a44ea505cfa3a57b95cf2862d4fd5f0f687", fromBlock: 73057898, permitFailure: true, },
});
module.exports.hallmarks=[
module.exports.hallmarks = [
[1693699200, "Solidly V3 launch"],
]

0 comments on commit dafd067

Please sign in to comment.