mirror of
https://github.com/alexgo-io/DefiLlama-Adapters.git
synced 2026-04-30 13:52:23 +08:00
refactor flashstake
This commit is contained in:
@@ -59,7 +59,7 @@ function transform(obj, file) {
|
||||
for (const [key, value] of Object.entries(obj)) {
|
||||
if (!value.inputs) console.log('inputs missing', file)
|
||||
const iLen = value.inputs.length === 0
|
||||
const oLen = value.outputs.length === 1
|
||||
const oLen = value.outputs?.length === 1
|
||||
const oType = oLen && value.outputs[0].type
|
||||
if (iLen && oLen && knownTypes.has(oType)) {
|
||||
res[key] = `${oType}:${value.name}`
|
||||
@@ -77,7 +77,7 @@ function print() {
|
||||
if (Array.isArray(data)) {
|
||||
res = {}
|
||||
data
|
||||
.filter(i => i.type === 'function')
|
||||
.filter(i => i.type === 'function' || i.type === 'event')
|
||||
// .filter(i => isTransformable({ test: i}))
|
||||
// .filter(i => i.stateMutability === 'view' || i.stateMutability === 'pure')
|
||||
.forEach(i => res[i.name ?? 'ignore'] = i)
|
||||
@@ -89,86 +89,7 @@ function print() {
|
||||
}
|
||||
|
||||
|
||||
const data = {
|
||||
"get_registry": {
|
||||
"name": "get_registry",
|
||||
"outputs": [
|
||||
{
|
||||
"type": "address",
|
||||
"name": ""
|
||||
}
|
||||
],
|
||||
"inputs": [],
|
||||
"stateMutability": "view",
|
||||
"type": "function",
|
||||
"gas": 1061
|
||||
},
|
||||
"pool_list": {
|
||||
"stateMutability": "view",
|
||||
"type": "function",
|
||||
"name": "pool_list",
|
||||
"inputs": [
|
||||
{
|
||||
"name": "arg0",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"gas": 2217
|
||||
},
|
||||
"pool_count": {
|
||||
"stateMutability": "view",
|
||||
"type": "function",
|
||||
"name": "pool_count",
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"gas": 2138
|
||||
},
|
||||
"get_id_info": {
|
||||
"name": "get_id_info",
|
||||
"outputs": [
|
||||
{
|
||||
"type": "address",
|
||||
"name": "addr"
|
||||
},
|
||||
{
|
||||
"type": "bool",
|
||||
"name": "is_active"
|
||||
},
|
||||
{
|
||||
"type": "uint256",
|
||||
"name": "version"
|
||||
},
|
||||
{
|
||||
"type": "uint256",
|
||||
"name": "last_modified"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "description"
|
||||
}
|
||||
],
|
||||
"inputs": [
|
||||
{
|
||||
"type": "uint256",
|
||||
"name": "arg0"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function",
|
||||
"gas": 12168
|
||||
},
|
||||
}
|
||||
const data =
|
||||
|
||||
print()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user