subgraph added

This commit is contained in:
Richa-iitr 2022-08-04 18:29:39 +05:30
parent cb11e9b6a4
commit 9ab3491e47
17 changed files with 10516 additions and 137 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
build
/node_modules

View File

@ -1,9 +1,12 @@
[
{
"inputs": [
{ "internalType": "address", "name": "_logic", "type": "address" },
{ "internalType": "address", "name": "admin_", "type": "address" },
{ "internalType": "bytes", "name": "_data", "type": "bytes" }
{
"internalType": "address",
"name": "aavePoolAddressesProvider_",
"type": "address"
},
{ "internalType": "address", "name": "instaList_", "type": "address" }
],
"stateMutability": "nonpayable",
"type": "constructor"
@ -12,19 +15,25 @@
"anonymous": false,
"inputs": [
{
"indexed": false,
"indexed": true,
"internalType": "address",
"name": "previousAdmin",
"name": "user",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "newAdmin",
"type": "address"
"indexed": true,
"internalType": "uint32",
"name": "id",
"type": "uint32"
},
{
"indexed": true,
"internalType": "uint32",
"name": "nonce",
"type": "uint32"
}
],
"name": "AdminChanged",
"name": "LogCancelledAutomation",
"type": "event"
},
{
@ -33,11 +42,35 @@
{
"indexed": true,
"internalType": "address",
"name": "beacon",
"name": "user",
"type": "address"
},
{
"indexed": true,
"internalType": "uint32",
"name": "id",
"type": "uint32"
},
{
"indexed": true,
"internalType": "uint32",
"name": "nonce",
"type": "uint32"
},
{
"indexed": false,
"internalType": "bool",
"name": "isSafe",
"type": "bool"
},
{
"indexed": false,
"internalType": "bytes",
"name": "metadata",
"type": "bytes"
}
],
"name": "BeaconUpgraded",
"name": "LogExecutedAutomation",
"type": "event"
},
{
@ -46,71 +79,587 @@
{
"indexed": true,
"internalType": "address",
"name": "implementation",
"type": "address"
}
],
"name": "Upgraded",
"type": "event"
},
{ "stateMutability": "payable", "type": "fallback" },
{
"inputs": [],
"name": "admin",
"outputs": [
{ "internalType": "address", "name": "admin_", "type": "address" }
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "newAdmin", "type": "address" }
],
"name": "changeAdmin",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "implementation",
"outputs": [
{
"internalType": "address",
"name": "implementation_",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newImplementation",
"type": "address"
}
],
"name": "upgradeTo",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newImplementation",
"name": "user",
"type": "address"
},
{ "internalType": "bytes", "name": "data", "type": "bytes" }
{
"indexed": true,
"internalType": "uint32",
"name": "id",
"type": "uint32"
},
{
"indexed": true,
"internalType": "uint32",
"name": "nonce",
"type": "uint32"
},
{
"indexed": false,
"internalType": "uint128",
"name": "finalHf",
"type": "uint128"
},
{
"indexed": false,
"internalType": "uint128",
"name": "initialHf",
"type": "uint128"
},
{
"indexed": false,
"internalType": "uint16",
"name": "automationFee",
"type": "uint16"
},
{
"components": [
{
"internalType": "address",
"name": "collateralToken",
"type": "address"
},
{ "internalType": "address", "name": "debtToken", "type": "address" },
{
"internalType": "uint256",
"name": "collateralAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "debtAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "collateralAmountWithTotalFee",
"type": "uint256"
},
{
"components": [
{
"internalType": "address",
"name": "buyToken",
"type": "address"
},
{
"internalType": "address",
"name": "sellToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "sellAmt",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "unitAmt",
"type": "uint256"
},
{ "internalType": "bytes", "name": "callData", "type": "bytes" }
],
"internalType": "struct Structs.Swap",
"name": "swap",
"type": "tuple"
},
{ "internalType": "uint256", "name": "route", "type": "uint256" },
{ "internalType": "uint256", "name": "rateMode", "type": "uint256" }
],
"indexed": false,
"internalType": "struct Structs.ExecutionParams",
"name": "params",
"type": "tuple"
},
{
"components": [
{
"internalType": "string[]",
"name": "_targets",
"type": "string[]"
},
{ "internalType": "bytes[]", "name": "_datas", "type": "bytes[]" }
],
"indexed": false,
"internalType": "struct Structs.Spell",
"name": "spells",
"type": "tuple"
}
],
"name": "upgradeToAndCall",
"name": "LogExecutedAutomationParams",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "recipient_",
"type": "address"
},
{
"indexed": false,
"internalType": "address[]",
"name": "tokens",
"type": "address[]"
},
{
"indexed": false,
"internalType": "uint256[]",
"name": "amount",
"type": "uint256[]"
}
],
"name": "LogFeeTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address[]",
"name": "executors",
"type": "address[]"
},
{
"indexed": false,
"internalType": "bool[]",
"name": "status",
"type": "bool[]"
}
],
"name": "LogFlippedExecutors",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": true,
"internalType": "uint32",
"name": "id",
"type": "uint32"
},
{
"indexed": false,
"internalType": "uint128",
"name": "safeHF",
"type": "uint128"
},
{
"indexed": false,
"internalType": "uint128",
"name": "thresholdHF",
"type": "uint128"
},
{
"indexed": false,
"internalType": "uint128",
"name": "currentHf",
"type": "uint128"
}
],
"name": "LogSubmittedAutomation",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
},
{
"indexed": true,
"internalType": "uint32",
"name": "id",
"type": "uint32"
},
{
"indexed": true,
"internalType": "uint32",
"name": "nonce",
"type": "uint32"
},
{
"indexed": false,
"internalType": "uint8",
"name": "errorCode",
"type": "uint8"
}
],
"name": "LogSystemCancelledAutomation",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint16",
"name": "oldAutomationFee",
"type": "uint16"
},
{
"indexed": false,
"internalType": "uint16",
"name": "newAutomationFee",
"type": "uint16"
}
],
"name": "LogUpdatedAutomationFee",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint128",
"name": "oldBufferHf",
"type": "uint128"
},
{
"indexed": false,
"internalType": "uint128",
"name": "newBufferHf",
"type": "uint128"
}
],
"name": "LogUpdatedBufferHf",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint128",
"name": "oldMinHf",
"type": "uint128"
},
{
"indexed": false,
"internalType": "uint128",
"name": "newMinHf",
"type": "uint128"
}
],
"name": "LogUpdatedMinHf",
"type": "event"
},
{
"inputs": [],
"name": "_automationFee",
"outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_bufferHf",
"outputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
"name": "_executors",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_id",
"outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_minimumThresholdHf",
"outputs": [{ "internalType": "uint128", "name": "", "type": "uint128" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_owner",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "_status",
"outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }],
"name": "_userAutomationConfigs",
"outputs": [
{ "internalType": "address", "name": "user", "type": "address" },
{
"internalType": "enum Structs.Status",
"name": "status",
"type": "uint8"
},
{ "internalType": "uint32", "name": "nonce", "type": "uint32" },
{ "internalType": "uint128", "name": "safeHF", "type": "uint128" },
{ "internalType": "uint128", "name": "thresholdHF", "type": "uint128" }
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
"name": "_userLatestId",
"outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "cancelAutomationRequest",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract AccountInterface",
"name": "dsa",
"type": "address"
},
{
"components": [
{
"internalType": "string[]",
"name": "_targets",
"type": "string[]"
},
{ "internalType": "bytes[]", "name": "_datas", "type": "bytes[]" }
],
"internalType": "struct Structs.Spell",
"name": "spells",
"type": "tuple"
}
],
"name": "cast",
"outputs": [{ "internalType": "bool", "name": "success", "type": "bool" }],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "user_", "type": "address" },
{ "internalType": "uint32", "name": "id_", "type": "uint32" },
{ "internalType": "uint32", "name": "nonce_", "type": "uint32" },
{
"components": [
{
"internalType": "address",
"name": "collateralToken",
"type": "address"
},
{ "internalType": "address", "name": "debtToken", "type": "address" },
{
"internalType": "uint256",
"name": "collateralAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "debtAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "collateralAmountWithTotalFee",
"type": "uint256"
},
{
"components": [
{
"internalType": "address",
"name": "buyToken",
"type": "address"
},
{
"internalType": "address",
"name": "sellToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "sellAmt",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "unitAmt",
"type": "uint256"
},
{ "internalType": "bytes", "name": "callData", "type": "bytes" }
],
"internalType": "struct Structs.Swap",
"name": "swap",
"type": "tuple"
},
{ "internalType": "uint256", "name": "route", "type": "uint256" },
{ "internalType": "uint256", "name": "rateMode", "type": "uint256" }
],
"internalType": "struct Structs.ExecutionParams",
"name": "params",
"type": "tuple"
},
{ "internalType": "bytes", "name": "metadata_", "type": "bytes" }
],
"name": "executeAutomation",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address[]", "name": "executor_", "type": "address[]" },
{ "internalType": "bool[]", "name": "status_", "type": "bool[]" }
],
"name": "flipExecutor",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "user", "type": "address" }
],
"name": "getHealthFactor",
"outputs": [
{ "internalType": "uint256", "name": "healthFactor", "type": "uint256" }
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "owner_", "type": "address" },
{ "internalType": "uint16", "name": "automationFee_", "type": "uint16" },
{
"internalType": "uint128",
"name": "minimumThresholdHf_",
"type": "uint128"
},
{ "internalType": "uint128", "name": "bufferHf_", "type": "uint128" }
],
"name": "initialize",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "safeHealthFactor_",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "thresholdHealthFactor_",
"type": "uint256"
}
],
"name": "submitAutomationRequest",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "user_", "type": "address" },
{ "internalType": "uint32", "name": "id_", "type": "uint32" },
{ "internalType": "uint8", "name": "errorCode_", "type": "uint8" }
],
"name": "systemCancel",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address[]", "name": "tokens_", "type": "address[]" },
{ "internalType": "address", "name": "recipient_", "type": "address" }
],
"name": "transferFee",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint16",
"name": "newAutomationFee_",
"type": "uint16"
}
],
"name": "updateAutomationFee",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint128", "name": "newBufferHf_", "type": "uint128" }
],
"name": "updateBufferHf",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint128",
"name": "newMinimumThresholdHf_",
"type": "uint128"
}
],
"name": "updateMinimunHf",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "version",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"stateMutability": "payable",
"type": "function"
},
{ "stateMutability": "payable", "type": "receive" }
"type": "receive"
}
]

244
abis/InstaIndex.json Normal file
View File

@ -0,0 +1,244 @@
[
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "origin",
"type": "address"
}
],
"name": "LogAccountCreated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "_newAccount",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "_connectors",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "_check",
"type": "address"
}
],
"name": "LogNewAccount",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "accountVersion",
"type": "uint256"
},
{
"indexed": true,
"internalType": "address",
"name": "check",
"type": "address"
}
],
"name": "LogNewCheck",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "master",
"type": "address"
}
],
"name": "LogNewMaster",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "master",
"type": "address"
}
],
"name": "LogUpdateMaster",
"type": "event"
},
{
"inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"name": "account",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "_newAccount", "type": "address" },
{ "internalType": "address", "name": "_connectors", "type": "address" },
{ "internalType": "address", "name": "_check", "type": "address" }
],
"name": "addNewAccount",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "_owner", "type": "address" },
{
"internalType": "uint256",
"name": "accountVersion",
"type": "uint256"
},
{ "internalType": "address", "name": "_origin", "type": "address" }
],
"name": "build",
"outputs": [
{ "internalType": "address", "name": "_account", "type": "address" }
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "_owner", "type": "address" },
{
"internalType": "uint256",
"name": "accountVersion",
"type": "uint256"
},
{ "internalType": "address[]", "name": "_targets", "type": "address[]" },
{ "internalType": "bytes[]", "name": "_datas", "type": "bytes[]" },
{ "internalType": "address", "name": "_origin", "type": "address" }
],
"name": "buildWithCast",
"outputs": [
{ "internalType": "address", "name": "_account", "type": "address" }
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "accountVersion",
"type": "uint256"
},
{ "internalType": "address", "name": "_newCheck", "type": "address" }
],
"name": "changeCheck",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "_newMaster", "type": "address" }
],
"name": "changeMaster",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"name": "check",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"name": "connectors",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint256", "name": "version", "type": "uint256" },
{ "internalType": "address", "name": "query", "type": "address" }
],
"name": "isClone",
"outputs": [{ "internalType": "bool", "name": "result", "type": "bool" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "list",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "master",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "_master", "type": "address" },
{ "internalType": "address", "name": "_list", "type": "address" },
{ "internalType": "address", "name": "_account", "type": "address" },
{ "internalType": "address", "name": "_connectors", "type": "address" }
],
"name": "setBasics",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "updateMaster",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "versionCount",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
}
]

112
abis/InstaList.json Normal file
View File

@ -0,0 +1,112 @@
[
{
"inputs": [
{ "internalType": "address", "name": "_instaIndex", "type": "address" }
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }],
"name": "accountAddr",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
"name": "accountID",
"outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }],
"name": "accountLink",
"outputs": [
{ "internalType": "address", "name": "first", "type": "address" },
{ "internalType": "address", "name": "last", "type": "address" },
{ "internalType": "uint64", "name": "count", "type": "uint64" }
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "uint64", "name": "", "type": "uint64" },
{ "internalType": "address", "name": "", "type": "address" }
],
"name": "accountList",
"outputs": [
{ "internalType": "address", "name": "prev", "type": "address" },
{ "internalType": "address", "name": "next", "type": "address" }
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "accounts",
"outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "_owner", "type": "address" }
],
"name": "addAuth",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "_account", "type": "address" }
],
"name": "init",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "instaIndex",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "_owner", "type": "address" }
],
"name": "removeAuth",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [{ "internalType": "address", "name": "", "type": "address" }],
"name": "userLink",
"outputs": [
{ "internalType": "uint64", "name": "first", "type": "uint64" },
{ "internalType": "uint64", "name": "last", "type": "uint64" },
{ "internalType": "uint64", "name": "count", "type": "uint64" }
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "", "type": "address" },
{ "internalType": "uint64", "name": "", "type": "uint64" }
],
"name": "userList",
"outputs": [
{ "internalType": "uint64", "name": "prev", "type": "uint64" },
{ "internalType": "uint64", "name": "next", "type": "uint64" }
],
"stateMutability": "view",
"type": "function"
}
]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,551 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
import {
ethereum,
JSONValue,
TypedMap,
Entity,
Bytes,
Address,
BigInt
} from "@graphprotocol/graph-ts";
export class LogAccountCreated extends ethereum.Event {
get params(): LogAccountCreated__Params {
return new LogAccountCreated__Params(this);
}
}
export class LogAccountCreated__Params {
_event: LogAccountCreated;
constructor(event: LogAccountCreated) {
this._event = event;
}
get sender(): Address {
return this._event.parameters[0].value.toAddress();
}
get owner(): Address {
return this._event.parameters[1].value.toAddress();
}
get account(): Address {
return this._event.parameters[2].value.toAddress();
}
get origin(): Address {
return this._event.parameters[3].value.toAddress();
}
}
export class LogNewAccount extends ethereum.Event {
get params(): LogNewAccount__Params {
return new LogNewAccount__Params(this);
}
}
export class LogNewAccount__Params {
_event: LogNewAccount;
constructor(event: LogNewAccount) {
this._event = event;
}
get _newAccount(): Address {
return this._event.parameters[0].value.toAddress();
}
get _connectors(): Address {
return this._event.parameters[1].value.toAddress();
}
get _check(): Address {
return this._event.parameters[2].value.toAddress();
}
}
export class LogNewCheck extends ethereum.Event {
get params(): LogNewCheck__Params {
return new LogNewCheck__Params(this);
}
}
export class LogNewCheck__Params {
_event: LogNewCheck;
constructor(event: LogNewCheck) {
this._event = event;
}
get accountVersion(): BigInt {
return this._event.parameters[0].value.toBigInt();
}
get check(): Address {
return this._event.parameters[1].value.toAddress();
}
}
export class LogNewMaster extends ethereum.Event {
get params(): LogNewMaster__Params {
return new LogNewMaster__Params(this);
}
}
export class LogNewMaster__Params {
_event: LogNewMaster;
constructor(event: LogNewMaster) {
this._event = event;
}
get master(): Address {
return this._event.parameters[0].value.toAddress();
}
}
export class LogUpdateMaster extends ethereum.Event {
get params(): LogUpdateMaster__Params {
return new LogUpdateMaster__Params(this);
}
}
export class LogUpdateMaster__Params {
_event: LogUpdateMaster;
constructor(event: LogUpdateMaster) {
this._event = event;
}
get master(): Address {
return this._event.parameters[0].value.toAddress();
}
}
export class InstaIndex extends ethereum.SmartContract {
static bind(address: Address): InstaIndex {
return new InstaIndex("InstaIndex", address);
}
account(param0: BigInt): Address {
let result = super.call("account", "account(uint256):(address)", [
ethereum.Value.fromUnsignedBigInt(param0)
]);
return result[0].toAddress();
}
try_account(param0: BigInt): ethereum.CallResult<Address> {
let result = super.tryCall("account", "account(uint256):(address)", [
ethereum.Value.fromUnsignedBigInt(param0)
]);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toAddress());
}
build(_owner: Address, accountVersion: BigInt, _origin: Address): Address {
let result = super.call(
"build",
"build(address,uint256,address):(address)",
[
ethereum.Value.fromAddress(_owner),
ethereum.Value.fromUnsignedBigInt(accountVersion),
ethereum.Value.fromAddress(_origin)
]
);
return result[0].toAddress();
}
try_build(
_owner: Address,
accountVersion: BigInt,
_origin: Address
): ethereum.CallResult<Address> {
let result = super.tryCall(
"build",
"build(address,uint256,address):(address)",
[
ethereum.Value.fromAddress(_owner),
ethereum.Value.fromUnsignedBigInt(accountVersion),
ethereum.Value.fromAddress(_origin)
]
);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toAddress());
}
check(param0: BigInt): Address {
let result = super.call("check", "check(uint256):(address)", [
ethereum.Value.fromUnsignedBigInt(param0)
]);
return result[0].toAddress();
}
try_check(param0: BigInt): ethereum.CallResult<Address> {
let result = super.tryCall("check", "check(uint256):(address)", [
ethereum.Value.fromUnsignedBigInt(param0)
]);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toAddress());
}
connectors(param0: BigInt): Address {
let result = super.call("connectors", "connectors(uint256):(address)", [
ethereum.Value.fromUnsignedBigInt(param0)
]);
return result[0].toAddress();
}
try_connectors(param0: BigInt): ethereum.CallResult<Address> {
let result = super.tryCall("connectors", "connectors(uint256):(address)", [
ethereum.Value.fromUnsignedBigInt(param0)
]);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toAddress());
}
isClone(version: BigInt, query: Address): boolean {
let result = super.call("isClone", "isClone(uint256,address):(bool)", [
ethereum.Value.fromUnsignedBigInt(version),
ethereum.Value.fromAddress(query)
]);
return result[0].toBoolean();
}
try_isClone(version: BigInt, query: Address): ethereum.CallResult<boolean> {
let result = super.tryCall("isClone", "isClone(uint256,address):(bool)", [
ethereum.Value.fromUnsignedBigInt(version),
ethereum.Value.fromAddress(query)
]);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toBoolean());
}
list(): Address {
let result = super.call("list", "list():(address)", []);
return result[0].toAddress();
}
try_list(): ethereum.CallResult<Address> {
let result = super.tryCall("list", "list():(address)", []);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toAddress());
}
master(): Address {
let result = super.call("master", "master():(address)", []);
return result[0].toAddress();
}
try_master(): ethereum.CallResult<Address> {
let result = super.tryCall("master", "master():(address)", []);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toAddress());
}
versionCount(): BigInt {
let result = super.call("versionCount", "versionCount():(uint256)", []);
return result[0].toBigInt();
}
try_versionCount(): ethereum.CallResult<BigInt> {
let result = super.tryCall("versionCount", "versionCount():(uint256)", []);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toBigInt());
}
}
export class AddNewAccountCall extends ethereum.Call {
get inputs(): AddNewAccountCall__Inputs {
return new AddNewAccountCall__Inputs(this);
}
get outputs(): AddNewAccountCall__Outputs {
return new AddNewAccountCall__Outputs(this);
}
}
export class AddNewAccountCall__Inputs {
_call: AddNewAccountCall;
constructor(call: AddNewAccountCall) {
this._call = call;
}
get _newAccount(): Address {
return this._call.inputValues[0].value.toAddress();
}
get _connectors(): Address {
return this._call.inputValues[1].value.toAddress();
}
get _check(): Address {
return this._call.inputValues[2].value.toAddress();
}
}
export class AddNewAccountCall__Outputs {
_call: AddNewAccountCall;
constructor(call: AddNewAccountCall) {
this._call = call;
}
}
export class BuildCall extends ethereum.Call {
get inputs(): BuildCall__Inputs {
return new BuildCall__Inputs(this);
}
get outputs(): BuildCall__Outputs {
return new BuildCall__Outputs(this);
}
}
export class BuildCall__Inputs {
_call: BuildCall;
constructor(call: BuildCall) {
this._call = call;
}
get _owner(): Address {
return this._call.inputValues[0].value.toAddress();
}
get accountVersion(): BigInt {
return this._call.inputValues[1].value.toBigInt();
}
get _origin(): Address {
return this._call.inputValues[2].value.toAddress();
}
}
export class BuildCall__Outputs {
_call: BuildCall;
constructor(call: BuildCall) {
this._call = call;
}
get _account(): Address {
return this._call.outputValues[0].value.toAddress();
}
}
export class BuildWithCastCall extends ethereum.Call {
get inputs(): BuildWithCastCall__Inputs {
return new BuildWithCastCall__Inputs(this);
}
get outputs(): BuildWithCastCall__Outputs {
return new BuildWithCastCall__Outputs(this);
}
}
export class BuildWithCastCall__Inputs {
_call: BuildWithCastCall;
constructor(call: BuildWithCastCall) {
this._call = call;
}
get _owner(): Address {
return this._call.inputValues[0].value.toAddress();
}
get accountVersion(): BigInt {
return this._call.inputValues[1].value.toBigInt();
}
get _targets(): Array<Address> {
return this._call.inputValues[2].value.toAddressArray();
}
get _datas(): Array<Bytes> {
return this._call.inputValues[3].value.toBytesArray();
}
get _origin(): Address {
return this._call.inputValues[4].value.toAddress();
}
}
export class BuildWithCastCall__Outputs {
_call: BuildWithCastCall;
constructor(call: BuildWithCastCall) {
this._call = call;
}
get _account(): Address {
return this._call.outputValues[0].value.toAddress();
}
}
export class ChangeCheckCall extends ethereum.Call {
get inputs(): ChangeCheckCall__Inputs {
return new ChangeCheckCall__Inputs(this);
}
get outputs(): ChangeCheckCall__Outputs {
return new ChangeCheckCall__Outputs(this);
}
}
export class ChangeCheckCall__Inputs {
_call: ChangeCheckCall;
constructor(call: ChangeCheckCall) {
this._call = call;
}
get accountVersion(): BigInt {
return this._call.inputValues[0].value.toBigInt();
}
get _newCheck(): Address {
return this._call.inputValues[1].value.toAddress();
}
}
export class ChangeCheckCall__Outputs {
_call: ChangeCheckCall;
constructor(call: ChangeCheckCall) {
this._call = call;
}
}
export class ChangeMasterCall extends ethereum.Call {
get inputs(): ChangeMasterCall__Inputs {
return new ChangeMasterCall__Inputs(this);
}
get outputs(): ChangeMasterCall__Outputs {
return new ChangeMasterCall__Outputs(this);
}
}
export class ChangeMasterCall__Inputs {
_call: ChangeMasterCall;
constructor(call: ChangeMasterCall) {
this._call = call;
}
get _newMaster(): Address {
return this._call.inputValues[0].value.toAddress();
}
}
export class ChangeMasterCall__Outputs {
_call: ChangeMasterCall;
constructor(call: ChangeMasterCall) {
this._call = call;
}
}
export class SetBasicsCall extends ethereum.Call {
get inputs(): SetBasicsCall__Inputs {
return new SetBasicsCall__Inputs(this);
}
get outputs(): SetBasicsCall__Outputs {
return new SetBasicsCall__Outputs(this);
}
}
export class SetBasicsCall__Inputs {
_call: SetBasicsCall;
constructor(call: SetBasicsCall) {
this._call = call;
}
get _master(): Address {
return this._call.inputValues[0].value.toAddress();
}
get _list(): Address {
return this._call.inputValues[1].value.toAddress();
}
get _account(): Address {
return this._call.inputValues[2].value.toAddress();
}
get _connectors(): Address {
return this._call.inputValues[3].value.toAddress();
}
}
export class SetBasicsCall__Outputs {
_call: SetBasicsCall;
constructor(call: SetBasicsCall) {
this._call = call;
}
}
export class UpdateMasterCall extends ethereum.Call {
get inputs(): UpdateMasterCall__Inputs {
return new UpdateMasterCall__Inputs(this);
}
get outputs(): UpdateMasterCall__Outputs {
return new UpdateMasterCall__Outputs(this);
}
}
export class UpdateMasterCall__Inputs {
_call: UpdateMasterCall;
constructor(call: UpdateMasterCall) {
this._call = call;
}
}
export class UpdateMasterCall__Outputs {
_call: UpdateMasterCall;
constructor(call: UpdateMasterCall) {
this._call = call;
}
}

View File

@ -0,0 +1,466 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
import {
ethereum,
JSONValue,
TypedMap,
Entity,
Bytes,
Address,
BigInt
} from "@graphprotocol/graph-ts";
export class InstaList__accountLinkResult {
value0: Address;
value1: Address;
value2: BigInt;
constructor(value0: Address, value1: Address, value2: BigInt) {
this.value0 = value0;
this.value1 = value1;
this.value2 = value2;
}
toMap(): TypedMap<string, ethereum.Value> {
let map = new TypedMap<string, ethereum.Value>();
map.set("value0", ethereum.Value.fromAddress(this.value0));
map.set("value1", ethereum.Value.fromAddress(this.value1));
map.set("value2", ethereum.Value.fromUnsignedBigInt(this.value2));
return map;
}
getFirst(): Address {
return this.value0;
}
getLast(): Address {
return this.value1;
}
getCount(): BigInt {
return this.value2;
}
}
export class InstaList__accountListResult {
value0: Address;
value1: Address;
constructor(value0: Address, value1: Address) {
this.value0 = value0;
this.value1 = value1;
}
toMap(): TypedMap<string, ethereum.Value> {
let map = new TypedMap<string, ethereum.Value>();
map.set("value0", ethereum.Value.fromAddress(this.value0));
map.set("value1", ethereum.Value.fromAddress(this.value1));
return map;
}
getPrev(): Address {
return this.value0;
}
getNext(): Address {
return this.value1;
}
}
export class InstaList__userLinkResult {
value0: BigInt;
value1: BigInt;
value2: BigInt;
constructor(value0: BigInt, value1: BigInt, value2: BigInt) {
this.value0 = value0;
this.value1 = value1;
this.value2 = value2;
}
toMap(): TypedMap<string, ethereum.Value> {
let map = new TypedMap<string, ethereum.Value>();
map.set("value0", ethereum.Value.fromUnsignedBigInt(this.value0));
map.set("value1", ethereum.Value.fromUnsignedBigInt(this.value1));
map.set("value2", ethereum.Value.fromUnsignedBigInt(this.value2));
return map;
}
getFirst(): BigInt {
return this.value0;
}
getLast(): BigInt {
return this.value1;
}
getCount(): BigInt {
return this.value2;
}
}
export class InstaList__userListResult {
value0: BigInt;
value1: BigInt;
constructor(value0: BigInt, value1: BigInt) {
this.value0 = value0;
this.value1 = value1;
}
toMap(): TypedMap<string, ethereum.Value> {
let map = new TypedMap<string, ethereum.Value>();
map.set("value0", ethereum.Value.fromUnsignedBigInt(this.value0));
map.set("value1", ethereum.Value.fromUnsignedBigInt(this.value1));
return map;
}
getPrev(): BigInt {
return this.value0;
}
getNext(): BigInt {
return this.value1;
}
}
export class InstaList extends ethereum.SmartContract {
static bind(address: Address): InstaList {
return new InstaList("InstaList", address);
}
accountAddr(param0: BigInt): Address {
let result = super.call("accountAddr", "accountAddr(uint64):(address)", [
ethereum.Value.fromUnsignedBigInt(param0)
]);
return result[0].toAddress();
}
try_accountAddr(param0: BigInt): ethereum.CallResult<Address> {
let result = super.tryCall("accountAddr", "accountAddr(uint64):(address)", [
ethereum.Value.fromUnsignedBigInt(param0)
]);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toAddress());
}
accountID(param0: Address): BigInt {
let result = super.call("accountID", "accountID(address):(uint64)", [
ethereum.Value.fromAddress(param0)
]);
return result[0].toBigInt();
}
try_accountID(param0: Address): ethereum.CallResult<BigInt> {
let result = super.tryCall("accountID", "accountID(address):(uint64)", [
ethereum.Value.fromAddress(param0)
]);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toBigInt());
}
accountLink(param0: BigInt): InstaList__accountLinkResult {
let result = super.call(
"accountLink",
"accountLink(uint64):(address,address,uint64)",
[ethereum.Value.fromUnsignedBigInt(param0)]
);
return new InstaList__accountLinkResult(
result[0].toAddress(),
result[1].toAddress(),
result[2].toBigInt()
);
}
try_accountLink(
param0: BigInt
): ethereum.CallResult<InstaList__accountLinkResult> {
let result = super.tryCall(
"accountLink",
"accountLink(uint64):(address,address,uint64)",
[ethereum.Value.fromUnsignedBigInt(param0)]
);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(
new InstaList__accountLinkResult(
value[0].toAddress(),
value[1].toAddress(),
value[2].toBigInt()
)
);
}
accountList(param0: BigInt, param1: Address): InstaList__accountListResult {
let result = super.call(
"accountList",
"accountList(uint64,address):(address,address)",
[
ethereum.Value.fromUnsignedBigInt(param0),
ethereum.Value.fromAddress(param1)
]
);
return new InstaList__accountListResult(
result[0].toAddress(),
result[1].toAddress()
);
}
try_accountList(
param0: BigInt,
param1: Address
): ethereum.CallResult<InstaList__accountListResult> {
let result = super.tryCall(
"accountList",
"accountList(uint64,address):(address,address)",
[
ethereum.Value.fromUnsignedBigInt(param0),
ethereum.Value.fromAddress(param1)
]
);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(
new InstaList__accountListResult(
value[0].toAddress(),
value[1].toAddress()
)
);
}
accounts(): BigInt {
let result = super.call("accounts", "accounts():(uint64)", []);
return result[0].toBigInt();
}
try_accounts(): ethereum.CallResult<BigInt> {
let result = super.tryCall("accounts", "accounts():(uint64)", []);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toBigInt());
}
instaIndex(): Address {
let result = super.call("instaIndex", "instaIndex():(address)", []);
return result[0].toAddress();
}
try_instaIndex(): ethereum.CallResult<Address> {
let result = super.tryCall("instaIndex", "instaIndex():(address)", []);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toAddress());
}
userLink(param0: Address): InstaList__userLinkResult {
let result = super.call(
"userLink",
"userLink(address):(uint64,uint64,uint64)",
[ethereum.Value.fromAddress(param0)]
);
return new InstaList__userLinkResult(
result[0].toBigInt(),
result[1].toBigInt(),
result[2].toBigInt()
);
}
try_userLink(
param0: Address
): ethereum.CallResult<InstaList__userLinkResult> {
let result = super.tryCall(
"userLink",
"userLink(address):(uint64,uint64,uint64)",
[ethereum.Value.fromAddress(param0)]
);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(
new InstaList__userLinkResult(
value[0].toBigInt(),
value[1].toBigInt(),
value[2].toBigInt()
)
);
}
userList(param0: Address, param1: BigInt): InstaList__userListResult {
let result = super.call(
"userList",
"userList(address,uint64):(uint64,uint64)",
[
ethereum.Value.fromAddress(param0),
ethereum.Value.fromUnsignedBigInt(param1)
]
);
return new InstaList__userListResult(
result[0].toBigInt(),
result[1].toBigInt()
);
}
try_userList(
param0: Address,
param1: BigInt
): ethereum.CallResult<InstaList__userListResult> {
let result = super.tryCall(
"userList",
"userList(address,uint64):(uint64,uint64)",
[
ethereum.Value.fromAddress(param0),
ethereum.Value.fromUnsignedBigInt(param1)
]
);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(
new InstaList__userListResult(value[0].toBigInt(), value[1].toBigInt())
);
}
}
export class ConstructorCall extends ethereum.Call {
get inputs(): ConstructorCall__Inputs {
return new ConstructorCall__Inputs(this);
}
get outputs(): ConstructorCall__Outputs {
return new ConstructorCall__Outputs(this);
}
}
export class ConstructorCall__Inputs {
_call: ConstructorCall;
constructor(call: ConstructorCall) {
this._call = call;
}
get _instaIndex(): Address {
return this._call.inputValues[0].value.toAddress();
}
}
export class ConstructorCall__Outputs {
_call: ConstructorCall;
constructor(call: ConstructorCall) {
this._call = call;
}
}
export class AddAuthCall extends ethereum.Call {
get inputs(): AddAuthCall__Inputs {
return new AddAuthCall__Inputs(this);
}
get outputs(): AddAuthCall__Outputs {
return new AddAuthCall__Outputs(this);
}
}
export class AddAuthCall__Inputs {
_call: AddAuthCall;
constructor(call: AddAuthCall) {
this._call = call;
}
get _owner(): Address {
return this._call.inputValues[0].value.toAddress();
}
}
export class AddAuthCall__Outputs {
_call: AddAuthCall;
constructor(call: AddAuthCall) {
this._call = call;
}
}
export class InitCall extends ethereum.Call {
get inputs(): InitCall__Inputs {
return new InitCall__Inputs(this);
}
get outputs(): InitCall__Outputs {
return new InitCall__Outputs(this);
}
}
export class InitCall__Inputs {
_call: InitCall;
constructor(call: InitCall) {
this._call = call;
}
get _account(): Address {
return this._call.inputValues[0].value.toAddress();
}
}
export class InitCall__Outputs {
_call: InitCall;
constructor(call: InitCall) {
this._call = call;
}
}
export class RemoveAuthCall extends ethereum.Call {
get inputs(): RemoveAuthCall__Inputs {
return new RemoveAuthCall__Inputs(this);
}
get outputs(): RemoveAuthCall__Outputs {
return new RemoveAuthCall__Outputs(this);
}
}
export class RemoveAuthCall__Inputs {
_call: RemoveAuthCall;
constructor(call: RemoveAuthCall) {
this._call = call;
}
get _owner(): Address {
return this._call.inputValues[0].value.toAddress();
}
}
export class RemoveAuthCall__Outputs {
_call: RemoveAuthCall;
constructor(call: RemoveAuthCall) {
this._call = call;
}
}

802
generated/schema.ts Normal file
View File

@ -0,0 +1,802 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
import {
TypedMap,
Entity,
Value,
ValueKind,
store,
Bytes,
BigInt,
BigDecimal
} from "@graphprotocol/graph-ts";
export class ExecutionParams extends Entity {
constructor(id: string) {
super();
this.set("id", Value.fromString(id));
}
save(): void {
let id = this.get("id");
assert(id != null, "Cannot save ExecutionParams entity without an ID");
if (id) {
assert(
id.kind == ValueKind.STRING,
`Entities of type ExecutionParams must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`
);
store.set("ExecutionParams", id.toString(), this);
}
}
static load(id: string): ExecutionParams | null {
return changetype<ExecutionParams | null>(store.get("ExecutionParams", id));
}
get id(): string {
let value = this.get("id");
return value!.toString();
}
set id(value: string) {
this.set("id", Value.fromString(value));
}
get collateralToken(): Bytes {
let value = this.get("collateralToken");
return value!.toBytes();
}
set collateralToken(value: Bytes) {
this.set("collateralToken", Value.fromBytes(value));
}
get debtToken(): Bytes {
let value = this.get("debtToken");
return value!.toBytes();
}
set debtToken(value: Bytes) {
this.set("debtToken", Value.fromBytes(value));
}
get collateralAmount(): BigInt {
let value = this.get("collateralAmount");
return value!.toBigInt();
}
set collateralAmount(value: BigInt) {
this.set("collateralAmount", Value.fromBigInt(value));
}
get debtAmount(): BigInt {
let value = this.get("debtAmount");
return value!.toBigInt();
}
set debtAmount(value: BigInt) {
this.set("debtAmount", Value.fromBigInt(value));
}
get collateralAmountWithTotalFee(): BigInt {
let value = this.get("collateralAmountWithTotalFee");
return value!.toBigInt();
}
set collateralAmountWithTotalFee(value: BigInt) {
this.set("collateralAmountWithTotalFee", Value.fromBigInt(value));
}
get swap(): string {
let value = this.get("swap");
return value!.toString();
}
set swap(value: string) {
this.set("swap", Value.fromString(value));
}
get route(): BigInt {
let value = this.get("route");
return value!.toBigInt();
}
set route(value: BigInt) {
this.set("route", Value.fromBigInt(value));
}
get rateMode(): BigInt {
let value = this.get("rateMode");
return value!.toBigInt();
}
set rateMode(value: BigInt) {
this.set("rateMode", Value.fromBigInt(value));
}
}
export class Swap extends Entity {
constructor(id: string) {
super();
this.set("id", Value.fromString(id));
}
save(): void {
let id = this.get("id");
assert(id != null, "Cannot save Swap entity without an ID");
if (id) {
assert(
id.kind == ValueKind.STRING,
`Entities of type Swap must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`
);
store.set("Swap", id.toString(), this);
}
}
static load(id: string): Swap | null {
return changetype<Swap | null>(store.get("Swap", id));
}
get id(): string {
let value = this.get("id");
return value!.toString();
}
set id(value: string) {
this.set("id", Value.fromString(value));
}
get buyToken(): Bytes {
let value = this.get("buyToken");
return value!.toBytes();
}
set buyToken(value: Bytes) {
this.set("buyToken", Value.fromBytes(value));
}
get sellToken(): Bytes {
let value = this.get("sellToken");
return value!.toBytes();
}
set sellToken(value: Bytes) {
this.set("sellToken", Value.fromBytes(value));
}
get sellAmt(): BigInt {
let value = this.get("sellAmt");
return value!.toBigInt();
}
set sellAmt(value: BigInt) {
this.set("sellAmt", Value.fromBigInt(value));
}
get unitAmt(): BigInt {
let value = this.get("unitAmt");
return value!.toBigInt();
}
set unitAmt(value: BigInt) {
this.set("unitAmt", Value.fromBigInt(value));
}
get callData(): Bytes {
let value = this.get("callData");
return value!.toBytes();
}
set callData(value: Bytes) {
this.set("callData", Value.fromBytes(value));
}
}
export class Spell extends Entity {
constructor(id: string) {
super();
this.set("id", Value.fromString(id));
}
save(): void {
let id = this.get("id");
assert(id != null, "Cannot save Spell entity without an ID");
if (id) {
assert(
id.kind == ValueKind.STRING,
`Entities of type Spell must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`
);
store.set("Spell", id.toString(), this);
}
}
static load(id: string): Spell | null {
return changetype<Spell | null>(store.get("Spell", id));
}
get id(): string {
let value = this.get("id");
return value!.toString();
}
set id(value: string) {
this.set("id", Value.fromString(value));
}
get _targets(): Array<string> {
let value = this.get("_targets");
return value!.toStringArray();
}
set _targets(value: Array<string>) {
this.set("_targets", Value.fromStringArray(value));
}
get _datas(): Array<Bytes> {
let value = this.get("_datas");
return value!.toBytesArray();
}
set _datas(value: Array<Bytes>) {
this.set("_datas", Value.fromBytesArray(value));
}
}
export class Account extends Entity {
constructor(id: string) {
super();
this.set("id", Value.fromString(id));
}
save(): void {
let id = this.get("id");
assert(id != null, "Cannot save Account entity without an ID");
if (id) {
assert(
id.kind == ValueKind.STRING,
`Entities of type Account must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`
);
store.set("Account", id.toString(), this);
}
}
static load(id: string): Account | null {
return changetype<Account | null>(store.get("Account", id));
}
get id(): string {
let value = this.get("id");
return value!.toString();
}
set id(value: string) {
this.set("id", Value.fromString(value));
}
get submitAutomation(): Array<string> {
let value = this.get("submitAutomation");
return value!.toStringArray();
}
set submitAutomation(value: Array<string>) {
this.set("submitAutomation", Value.fromStringArray(value));
}
get executeAutomation(): Array<string> {
let value = this.get("executeAutomation");
return value!.toStringArray();
}
set executeAutomation(value: Array<string>) {
this.set("executeAutomation", Value.fromStringArray(value));
}
get executeMetaData(): Array<string> {
let value = this.get("executeMetaData");
return value!.toStringArray();
}
set executeMetaData(value: Array<string>) {
this.set("executeMetaData", Value.fromStringArray(value));
}
get cancelData(): Array<string> {
let value = this.get("cancelData");
return value!.toStringArray();
}
set cancelData(value: Array<string>) {
this.set("cancelData", Value.fromStringArray(value));
}
get systemCancelData(): Array<string> {
let value = this.get("systemCancelData");
return value!.toStringArray();
}
set systemCancelData(value: Array<string>) {
this.set("systemCancelData", Value.fromStringArray(value));
}
}
export class SubmitData extends Entity {
constructor(id: string) {
super();
this.set("id", Value.fromString(id));
}
save(): void {
let id = this.get("id");
assert(id != null, "Cannot save SubmitData entity without an ID");
if (id) {
assert(
id.kind == ValueKind.STRING,
`Entities of type SubmitData must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`
);
store.set("SubmitData", id.toString(), this);
}
}
static load(id: string): SubmitData | null {
return changetype<SubmitData | null>(store.get("SubmitData", id));
}
get id(): string {
let value = this.get("id");
return value!.toString();
}
set id(value: string) {
this.set("id", Value.fromString(value));
}
get user(): Bytes {
let value = this.get("user");
return value!.toBytes();
}
set user(value: Bytes) {
this.set("user", Value.fromBytes(value));
}
get userId(): BigInt {
let value = this.get("userId");
return value!.toBigInt();
}
set userId(value: BigInt) {
this.set("userId", Value.fromBigInt(value));
}
get safeHF(): BigInt {
let value = this.get("safeHF");
return value!.toBigInt();
}
set safeHF(value: BigInt) {
this.set("safeHF", Value.fromBigInt(value));
}
get thresholdHF(): BigInt {
let value = this.get("thresholdHF");
return value!.toBigInt();
}
set thresholdHF(value: BigInt) {
this.set("thresholdHF", Value.fromBigInt(value));
}
get currentHf(): BigInt {
let value = this.get("currentHf");
return value!.toBigInt();
}
set currentHf(value: BigInt) {
this.set("currentHf", Value.fromBigInt(value));
}
get account(): string {
let value = this.get("account");
return value!.toString();
}
set account(value: string) {
this.set("account", Value.fromString(value));
}
}
export class ExecuteData extends Entity {
constructor(id: string) {
super();
this.set("id", Value.fromString(id));
}
save(): void {
let id = this.get("id");
assert(id != null, "Cannot save ExecuteData entity without an ID");
if (id) {
assert(
id.kind == ValueKind.STRING,
`Entities of type ExecuteData must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`
);
store.set("ExecuteData", id.toString(), this);
}
}
static load(id: string): ExecuteData | null {
return changetype<ExecuteData | null>(store.get("ExecuteData", id));
}
get id(): string {
let value = this.get("id");
return value!.toString();
}
set id(value: string) {
this.set("id", Value.fromString(value));
}
get user(): Bytes {
let value = this.get("user");
return value!.toBytes();
}
set user(value: Bytes) {
this.set("user", Value.fromBytes(value));
}
get userId(): BigInt {
let value = this.get("userId");
return value!.toBigInt();
}
set userId(value: BigInt) {
this.set("userId", Value.fromBigInt(value));
}
get nonce(): BigInt {
let value = this.get("nonce");
return value!.toBigInt();
}
set nonce(value: BigInt) {
this.set("nonce", Value.fromBigInt(value));
}
get finalHf(): BigInt {
let value = this.get("finalHf");
return value!.toBigInt();
}
set finalHf(value: BigInt) {
this.set("finalHf", Value.fromBigInt(value));
}
get initialHf(): BigInt {
let value = this.get("initialHf");
return value!.toBigInt();
}
set initialHf(value: BigInt) {
this.set("initialHf", Value.fromBigInt(value));
}
get automationFee(): i32 {
let value = this.get("automationFee");
return value!.toI32();
}
set automationFee(value: i32) {
this.set("automationFee", Value.fromI32(value));
}
get params(): string {
let value = this.get("params");
return value!.toString();
}
set params(value: string) {
this.set("params", Value.fromString(value));
}
get spells(): string {
let value = this.get("spells");
return value!.toString();
}
set spells(value: string) {
this.set("spells", Value.fromString(value));
}
get account(): string {
let value = this.get("account");
return value!.toString();
}
set account(value: string) {
this.set("account", Value.fromString(value));
}
}
export class ExecuteMetaData extends Entity {
constructor(id: string) {
super();
this.set("id", Value.fromString(id));
}
save(): void {
let id = this.get("id");
assert(id != null, "Cannot save ExecuteMetaData entity without an ID");
if (id) {
assert(
id.kind == ValueKind.STRING,
`Entities of type ExecuteMetaData must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`
);
store.set("ExecuteMetaData", id.toString(), this);
}
}
static load(id: string): ExecuteMetaData | null {
return changetype<ExecuteMetaData | null>(store.get("ExecuteMetaData", id));
}
get id(): string {
let value = this.get("id");
return value!.toString();
}
set id(value: string) {
this.set("id", Value.fromString(value));
}
get user(): Bytes {
let value = this.get("user");
return value!.toBytes();
}
set user(value: Bytes) {
this.set("user", Value.fromBytes(value));
}
get userId(): BigInt {
let value = this.get("userId");
return value!.toBigInt();
}
set userId(value: BigInt) {
this.set("userId", Value.fromBigInt(value));
}
get nonce(): BigInt {
let value = this.get("nonce");
return value!.toBigInt();
}
set nonce(value: BigInt) {
this.set("nonce", Value.fromBigInt(value));
}
get isSafe(): boolean {
let value = this.get("isSafe");
return value!.toBoolean();
}
set isSafe(value: boolean) {
this.set("isSafe", Value.fromBoolean(value));
}
get metadata(): Bytes {
let value = this.get("metadata");
return value!.toBytes();
}
set metadata(value: Bytes) {
this.set("metadata", Value.fromBytes(value));
}
get account(): string {
let value = this.get("account");
return value!.toString();
}
set account(value: string) {
this.set("account", Value.fromString(value));
}
}
export class CancelData extends Entity {
constructor(id: string) {
super();
this.set("id", Value.fromString(id));
}
save(): void {
let id = this.get("id");
assert(id != null, "Cannot save CancelData entity without an ID");
if (id) {
assert(
id.kind == ValueKind.STRING,
`Entities of type CancelData must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`
);
store.set("CancelData", id.toString(), this);
}
}
static load(id: string): CancelData | null {
return changetype<CancelData | null>(store.get("CancelData", id));
}
get id(): string {
let value = this.get("id");
return value!.toString();
}
set id(value: string) {
this.set("id", Value.fromString(value));
}
get user(): Bytes {
let value = this.get("user");
return value!.toBytes();
}
set user(value: Bytes) {
this.set("user", Value.fromBytes(value));
}
get userId(): BigInt {
let value = this.get("userId");
return value!.toBigInt();
}
set userId(value: BigInt) {
this.set("userId", Value.fromBigInt(value));
}
get nonce(): BigInt {
let value = this.get("nonce");
return value!.toBigInt();
}
set nonce(value: BigInt) {
this.set("nonce", Value.fromBigInt(value));
}
get account(): string {
let value = this.get("account");
return value!.toString();
}
set account(value: string) {
this.set("account", Value.fromString(value));
}
}
export class SystemCancelData extends Entity {
constructor(id: string) {
super();
this.set("id", Value.fromString(id));
}
save(): void {
let id = this.get("id");
assert(id != null, "Cannot save SystemCancelData entity without an ID");
if (id) {
assert(
id.kind == ValueKind.STRING,
`Entities of type SystemCancelData must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`
);
store.set("SystemCancelData", id.toString(), this);
}
}
static load(id: string): SystemCancelData | null {
return changetype<SystemCancelData | null>(
store.get("SystemCancelData", id)
);
}
get id(): string {
let value = this.get("id");
return value!.toString();
}
set id(value: string) {
this.set("id", Value.fromString(value));
}
get user(): Bytes {
let value = this.get("user");
return value!.toBytes();
}
set user(value: Bytes) {
this.set("user", Value.fromBytes(value));
}
get userId(): BigInt {
let value = this.get("userId");
return value!.toBigInt();
}
set userId(value: BigInt) {
this.set("userId", Value.fromBigInt(value));
}
get nonce(): BigInt {
let value = this.get("nonce");
return value!.toBigInt();
}
set nonce(value: BigInt) {
this.set("nonce", Value.fromBigInt(value));
}
get errorCode(): i32 {
let value = this.get("errorCode");
return value!.toI32();
}
set errorCode(value: i32) {
this.set("errorCode", Value.fromI32(value));
}
get account(): string {
let value = this.get("account");
return value!.toString();
}
set account(value: string) {
this.set("account", Value.fromString(value));
}
}
export class Executors extends Entity {
constructor(id: string) {
super();
this.set("id", Value.fromString(id));
}
save(): void {
let id = this.get("id");
assert(id != null, "Cannot save Executors entity without an ID");
if (id) {
assert(
id.kind == ValueKind.STRING,
`Entities of type Executors must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`
);
store.set("Executors", id.toString(), this);
}
}
static load(id: string): Executors | null {
return changetype<Executors | null>(store.get("Executors", id));
}
get id(): string {
let value = this.get("id");
return value!.toString();
}
set id(value: string) {
this.set("id", Value.fromString(value));
}
get executors(): Array<Bytes> {
let value = this.get("executors");
return value!.toBytesArray();
}
set executors(value: Array<Bytes>) {
this.set("executors", Value.fromBytesArray(value));
}
get status(): Array<boolean> {
let value = this.get("status");
return value!.toBooleanArray();
}
set status(value: Array<boolean>) {
this.set("status", Value.fromBooleanArray(value));
}
}

21
generated/templates.ts Normal file
View File

@ -0,0 +1,21 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
import {
Address,
DataSourceTemplate,
DataSourceContext
} from "@graphprotocol/graph-ts";
export class InstaAutomation extends DataSourceTemplate {
static create(address: Address): void {
DataSourceTemplate.create("InstaAutomation", [address.toHex()]);
}
static createWithContext(address: Address, context: DataSourceContext): void {
DataSourceTemplate.createWithContext(
"InstaAutomation",
[address.toHex()],
context
);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,327 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
import {
ethereum,
JSONValue,
TypedMap,
Entity,
Bytes,
Address,
BigInt
} from "@graphprotocol/graph-ts";
export class AdminChanged extends ethereum.Event {
get params(): AdminChanged__Params {
return new AdminChanged__Params(this);
}
}
export class AdminChanged__Params {
_event: AdminChanged;
constructor(event: AdminChanged) {
this._event = event;
}
get previousAdmin(): Address {
return this._event.parameters[0].value.toAddress();
}
get newAdmin(): Address {
return this._event.parameters[1].value.toAddress();
}
}
export class BeaconUpgraded extends ethereum.Event {
get params(): BeaconUpgraded__Params {
return new BeaconUpgraded__Params(this);
}
}
export class BeaconUpgraded__Params {
_event: BeaconUpgraded;
constructor(event: BeaconUpgraded) {
this._event = event;
}
get beacon(): Address {
return this._event.parameters[0].value.toAddress();
}
}
export class Upgraded extends ethereum.Event {
get params(): Upgraded__Params {
return new Upgraded__Params(this);
}
}
export class Upgraded__Params {
_event: Upgraded;
constructor(event: Upgraded) {
this._event = event;
}
get implementation(): Address {
return this._event.parameters[0].value.toAddress();
}
}
export class InstaAutomation extends ethereum.SmartContract {
static bind(address: Address): InstaAutomation {
return new InstaAutomation("InstaAutomation", address);
}
admin(): Address {
let result = super.call("admin", "admin():(address)", []);
return result[0].toAddress();
}
try_admin(): ethereum.CallResult<Address> {
let result = super.tryCall("admin", "admin():(address)", []);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toAddress());
}
implementation(): Address {
let result = super.call("implementation", "implementation():(address)", []);
return result[0].toAddress();
}
try_implementation(): ethereum.CallResult<Address> {
let result = super.tryCall(
"implementation",
"implementation():(address)",
[]
);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toAddress());
}
}
export class ConstructorCall extends ethereum.Call {
get inputs(): ConstructorCall__Inputs {
return new ConstructorCall__Inputs(this);
}
get outputs(): ConstructorCall__Outputs {
return new ConstructorCall__Outputs(this);
}
}
export class ConstructorCall__Inputs {
_call: ConstructorCall;
constructor(call: ConstructorCall) {
this._call = call;
}
get _logic(): Address {
return this._call.inputValues[0].value.toAddress();
}
get admin_(): Address {
return this._call.inputValues[1].value.toAddress();
}
get _data(): Bytes {
return this._call.inputValues[2].value.toBytes();
}
}
export class ConstructorCall__Outputs {
_call: ConstructorCall;
constructor(call: ConstructorCall) {
this._call = call;
}
}
export class DefaultCall extends ethereum.Call {
get inputs(): DefaultCall__Inputs {
return new DefaultCall__Inputs(this);
}
get outputs(): DefaultCall__Outputs {
return new DefaultCall__Outputs(this);
}
}
export class DefaultCall__Inputs {
_call: DefaultCall;
constructor(call: DefaultCall) {
this._call = call;
}
}
export class DefaultCall__Outputs {
_call: DefaultCall;
constructor(call: DefaultCall) {
this._call = call;
}
}
export class AdminCall extends ethereum.Call {
get inputs(): AdminCall__Inputs {
return new AdminCall__Inputs(this);
}
get outputs(): AdminCall__Outputs {
return new AdminCall__Outputs(this);
}
}
export class AdminCall__Inputs {
_call: AdminCall;
constructor(call: AdminCall) {
this._call = call;
}
}
export class AdminCall__Outputs {
_call: AdminCall;
constructor(call: AdminCall) {
this._call = call;
}
get admin_(): Address {
return this._call.outputValues[0].value.toAddress();
}
}
export class ChangeAdminCall extends ethereum.Call {
get inputs(): ChangeAdminCall__Inputs {
return new ChangeAdminCall__Inputs(this);
}
get outputs(): ChangeAdminCall__Outputs {
return new ChangeAdminCall__Outputs(this);
}
}
export class ChangeAdminCall__Inputs {
_call: ChangeAdminCall;
constructor(call: ChangeAdminCall) {
this._call = call;
}
get newAdmin(): Address {
return this._call.inputValues[0].value.toAddress();
}
}
export class ChangeAdminCall__Outputs {
_call: ChangeAdminCall;
constructor(call: ChangeAdminCall) {
this._call = call;
}
}
export class ImplementationCall extends ethereum.Call {
get inputs(): ImplementationCall__Inputs {
return new ImplementationCall__Inputs(this);
}
get outputs(): ImplementationCall__Outputs {
return new ImplementationCall__Outputs(this);
}
}
export class ImplementationCall__Inputs {
_call: ImplementationCall;
constructor(call: ImplementationCall) {
this._call = call;
}
}
export class ImplementationCall__Outputs {
_call: ImplementationCall;
constructor(call: ImplementationCall) {
this._call = call;
}
get implementation_(): Address {
return this._call.outputValues[0].value.toAddress();
}
}
export class UpgradeToCall extends ethereum.Call {
get inputs(): UpgradeToCall__Inputs {
return new UpgradeToCall__Inputs(this);
}
get outputs(): UpgradeToCall__Outputs {
return new UpgradeToCall__Outputs(this);
}
}
export class UpgradeToCall__Inputs {
_call: UpgradeToCall;
constructor(call: UpgradeToCall) {
this._call = call;
}
get newImplementation(): Address {
return this._call.inputValues[0].value.toAddress();
}
}
export class UpgradeToCall__Outputs {
_call: UpgradeToCall;
constructor(call: UpgradeToCall) {
this._call = call;
}
}
export class UpgradeToAndCallCall extends ethereum.Call {
get inputs(): UpgradeToAndCallCall__Inputs {
return new UpgradeToAndCallCall__Inputs(this);
}
get outputs(): UpgradeToAndCallCall__Outputs {
return new UpgradeToAndCallCall__Outputs(this);
}
}
export class UpgradeToAndCallCall__Inputs {
_call: UpgradeToAndCallCall;
constructor(call: UpgradeToAndCallCall) {
this._call = call;
}
get newImplementation(): Address {
return this._call.inputValues[0].value.toAddress();
}
get data(): Bytes {
return this._call.inputValues[1].value.toBytes();
}
}
export class UpgradeToAndCallCall__Outputs {
_call: UpgradeToAndCallCall;
constructor(call: UpgradeToAndCallCall) {
this._call = call;
}
}

View File

@ -1,6 +1,91 @@
type ExampleEntity @entity {
type ExecutionParams @entity{
id: ID!
count: BigInt!
previousAdmin: Bytes! # address
newAdmin: Bytes! # address
collateralToken: Bytes!
debtToken: Bytes!
collateralAmount: BigInt!
debtAmount: BigInt!
collateralAmountWithTotalFee: BigInt!
swap: Swap!
route: BigInt!
rateMode: BigInt!
}
type Swap @entity {
id: ID!
buyToken: Bytes!
sellToken: Bytes!
sellAmt: BigInt!
unitAmt: BigInt!
callData: Bytes!
}
type Spell @entity {
id: ID!
_targets: [String!]!
_datas: [Bytes!]!
}
type Account @entity {
id: ID!
submitAutomation: [SubmitData!]! @derivedFrom (field: "account")
executeAutomation: [ExecuteData!]! @derivedFrom (field: "account")
executeMetaData: [ExecuteMetaData!]! @derivedFrom (field: "account")
cancelData: [CancelData!]! @derivedFrom (field: "account")
systemCancelData: [SystemCancelData!]! @derivedFrom (field: "account")
}
type SubmitData @entity {
id: ID!
user: Bytes!
userId: BigInt!
safeHF: BigInt!
thresholdHF: BigInt!
currentHf: BigInt!
account: Account!
}
type ExecuteData @entity {
id: ID!
user: Bytes!
userId: BigInt!
nonce: BigInt!
finalHf: BigInt!
initialHf: BigInt!
automationFee: Int!
params: ExecutionParams!
spells: Spell!
account: Account!
}
type ExecuteMetaData @entity {
id: ID!
user: Bytes!
userId: BigInt!
nonce: BigInt!
isSafe: Boolean!
metadata: Bytes!
account: Account!
}
type CancelData @entity {
id: ID!
user: Bytes!
userId: BigInt!
nonce: BigInt!
account: Account!
}
type SystemCancelData @entity {
id: ID!
user: Bytes!
userId: BigInt!
nonce: BigInt!
errorCode: Int!
account: Account!
}
type Executors @entity {
id: ID!
executors: [Bytes!]!
status: [Boolean!]!
}

View File

@ -1,55 +1,202 @@
import { BigInt } from "@graphprotocol/graph-ts"
import { Address, BigInt, Bytes, dataSource, log } from "@graphprotocol/graph-ts";
import {
InstaAutomation,
AdminChanged,
BeaconUpgraded,
Upgraded
} from "../generated/InstaAutomation/InstaAutomation"
import { ExampleEntity } from "../generated/schema"
LogCancelledAutomation,
LogExecutedAutomation,
LogExecutedAutomationParams,
LogFlippedExecutors,
LogSubmittedAutomation,
LogSystemCancelledAutomation,
} from "../generated/InstaIndex/InstaAutomation";
import {
ExecuteData,
ExecuteMetaData,
ExecutionParams,
Spell,
Swap,
Account,
SubmitData,
CancelData,
SystemCancelData,
Executors
} from "../generated/schema";
import {
createOrLoadCancelData,
createOrLoadDsa,
createOrLoadExecute,
createOrLoadExecuteMetaData,
createOrLoadExecutionParams,
createOrLoadSpell,
createOrLoadSubmit,
createOrLoadSwap,
createOrLoadSystemCancelData,
} from "./insta-index";
export function handleAdminChanged(event: AdminChanged): void {
// Entities can be loaded from the store using a string ID; this ID
// needs to be unique across all entities of the same type
let entity = ExampleEntity.load(event.transaction.from.toHex())
export function handleLogSubmitAutomation(event: LogSubmittedAutomation): void {
let dsaId = event.params.user.toHexString() + "#" + event.params.id.toString();
let eventId =
event.transaction.hash.toHexString() + event.logIndex.toString();
// Entities only exist after they have been saved to the store;
// `null` checks allow to create entities on demand
if (!entity) {
entity = new ExampleEntity(event.transaction.from.toHex())
log.info("transaction hash: {} and from: {} ", [
event.transaction.hash.toHexString(),
event.transaction.from.toHexString(),
]);
log.info("ID: {}", [dsaId]);
// Entity fields can be set using simple assignments
entity.count = BigInt.fromI32(0)
}
let dsa = createOrLoadDsa(dsaId);
let submitData = createOrLoadSubmit(eventId);
submitData.user = event.params.user;
submitData.userId = event.params.id;
submitData.safeHF = event.params.safeHF;
submitData.thresholdHF = event.params.thresholdHF;
submitData.currentHf = event.params.currentHf;
submitData.account = dsaId;
// BigInt and BigDecimal math are supported
entity.count = entity.count + BigInt.fromI32(1)
// Entity fields can be set based on event parameters
entity.previousAdmin = event.params.previousAdmin
entity.newAdmin = event.params.newAdmin
// Entities can be written to the store with `.save()`
entity.save()
// Note: If a handler doesn't require existing field values, it is faster
// _not_ to load the entity from the store. Instead, create it fresh with
// `new Entity(...)`, set the fields that should be updated and save the
// entity back to the store. Fields that were not set or unset remain
// unchanged, allowing for partial updates to be applied.
// It is also possible to access smart contracts from mappings. For
// example, the contract that has emitted the event can be connected to
// with:
//
// let contract = Contract.bind(event.address)
//
// The following functions can then be called on this contract to access
// state variables and other data:
//
// - contract.admin(...)
// - contract.implementation(...)
submitData.save();
dsa.save();
}
export function handleBeaconUpgraded(event: BeaconUpgraded): void {}
export function handleLogCancelAutomation(event: LogCancelledAutomation): void {
let dsaId = event.params.user.toHexString() + "#" + event.params.id.toString();
let eventId =
event.transaction.hash.toHexString() + event.logIndex.toString();
export function handleUpgraded(event: Upgraded): void {}
log.info("transaction hash: {} and from: {} ", [
event.transaction.hash.toHexString(),
event.transaction.from.toHexString(),
]);
log.info("ID: {}", [dsaId]);
let dsa = createOrLoadDsa(dsaId);
let cancelData = createOrLoadCancelData(eventId);
cancelData.user = event.params.user;
cancelData.userId = event.params.id;
cancelData.nonce = event.params.nonce;
cancelData.account = dsaId;
cancelData.save();
dsa.save();
}
export function handleSystemCancelledAutomation(
event: LogSystemCancelledAutomation
): void {
let dsaId = event.params.user.toHexString() + "#" + event.params.id.toString();
let eventId =
event.transaction.hash.toHexString() + event.logIndex.toString();
log.info("transaction hash: {} and from: {} ", [
event.transaction.hash.toHexString(),
event.transaction.from.toHexString(),
]);
log.info("ID: {}", [dsaId]);
let dsa = createOrLoadDsa(dsaId);
let cancelData = createOrLoadSystemCancelData(eventId);
cancelData.user = event.params.user;
cancelData.userId = event.params.id;
cancelData.nonce = event.params.nonce;
cancelData.errorCode = event.params.errorCode;
cancelData.account = dsaId;
cancelData.save();
dsa.save();
}
export function handleLogExecuteAutomationMetadata(
event: LogExecutedAutomation
): void {
let dsaId = event.params.user.toHexString() + "#" + event.params.id.toString();
let eventId =
event.transaction.hash.toHexString() + event.logIndex.toString();
log.info("transaction hash: {} and from: {} ", [
event.transaction.hash.toHexString(),
event.transaction.from.toHexString(),
]);
log.info("ID: {}", [dsaId]);
let dsa = createOrLoadDsa(dsaId);
let executeData = createOrLoadExecuteMetaData(eventId);
executeData.user = event.params.user;
executeData.userId = event.params.id;
executeData.nonce = event.params.nonce;
executeData.isSafe = event.params.isSafe;
executeData.metadata = event.params.metadata;
executeData.account = dsaId;
executeData.save();
dsa.save();
}
export function handleLogExecuteAutomation(
event: LogExecutedAutomationParams
): void {
let dsaId = event.params.user.toHexString() + "#" + event.params.id.toString();
let eventId =
event.transaction.hash.toHexString() + event.logIndex.toString();
log.info("transaction hash: {} and from: {} ", [
event.transaction.hash.toHexString(),
event.transaction.from.toHexString(),
]);
log.info("ID: {}", [dsaId]);
let dsa = createOrLoadDsa(dsaId);
let executeData = createOrLoadExecute(eventId);
let params = createOrLoadExecutionParams(eventId);
executeData.user = event.params.user;
executeData.userId = event.params.id;
executeData.nonce = event.params.nonce;
executeData.finalHf = event.params.finalHf;
executeData.initialHf = event.params.initialHf;
executeData.automationFee = event.params.automationFee;
params.collateralToken = event.params.params.collateralToken;
params.debtToken = event.params.params.debtToken;
params.collateralAmount = event.params.params.collateralAmount;
params.debtAmount = event.params.params.debtAmount;
params.collateralAmountWithTotalFee = event.params.params.collateralAmountWithTotalFee;
let swaps = createOrLoadSwap(eventId);
swaps.buyToken = event.params.params.swap.buyToken;
swaps.sellToken = event.params.params.swap.sellToken;
swaps.sellAmt = event.params.params.swap.sellAmt;
swaps.unitAmt = event.params.params.swap.unitAmt;
swaps.callData = event.params.params.swap.callData;
let spells = createOrLoadSpell(eventId);
spells._datas = event.params.spells._datas;
spells._targets = event.params.spells._targets;
params.swap = swaps.id;
executeData.params = params.id;
executeData.spells = spells.id;
executeData.account = dsaId;
params.save();
swaps.save();
spells.save();
executeData.save();
dsa.save();
}
export function handleExecutors(event: LogFlippedExecutors): void {
let id = "ALL"
let executors_ = Executors.load(id);
if(executors_ == null){
executors_ = new Executors(id);
executors_.executors = [];
executors_.status = [];
}
let execArr = executors_.executors;
let statusArr = executors_.status;
for(let i=0;i<event.params.executors.length;i++){
execArr.push(event.params.executors[i]);
statusArr.push(event.params.status[i])
}
executors_.executors = execArr;
executors_.status = statusArr;
executors_.save();
}

136
src/insta-index.ts Normal file
View File

@ -0,0 +1,136 @@
import {
Address,
BigInt,
Bytes,
DataSourceContext,
} from "@graphprotocol/graph-ts";
import {
InstaIndex,
LogAccountCreated,
LogNewAccount,
LogNewCheck,
LogNewMaster,
LogUpdateMaster,
} from "../generated/InstaIndex/InstaIndex";
import { Account, ExecutionParams, SubmitData, Swap, Spell, ExecuteData, ExecuteMetaData, CancelData, SystemCancelData } from "../generated/schema";
import { InstaAutomation } from "../generated/InstaIndex/InstaAutomation";
import { InstaList } from "../generated/InstaIndex/InstaList";
import { InstaAutomation as InstaAutomationABI } from "../generated/templates";
export const ZERO = new BigInt(0);
export const ADDR_ZERO = new Address(0);
//loads or creates smart account
export function createOrLoadDsa(id: string): Account {
let account = Account.load(id);
if (account == null) {
account = new Account(id);
}
return account;
}
export function createOrLoadSubmit(id: string): SubmitData {
let submitData = SubmitData.load(id);
if(submitData == null) {
submitData = new SubmitData(id);
submitData.user = ADDR_ZERO;
submitData.userId = ZERO;
submitData.safeHF = ZERO;
submitData.thresholdHF = ZERO;
submitData.currentHf = ZERO;
}
return submitData;
}
export function createOrLoadExecutionParams(id: string): ExecutionParams {
let params = ExecutionParams.load(id);
if(params == null) {
params = new ExecutionParams(id);
params.collateralToken = ADDR_ZERO;
params.debtToken = ADDR_ZERO;
params.collateralAmount = ZERO;
params.debtAmount = ZERO;
params.collateralAmountWithTotalFee = ZERO;
params.swap = createOrLoadSwap(id).id;
params.route = ZERO;
params.rateMode = ZERO;
params.route = ZERO;
}
return params;
}
export function createOrLoadSwap(id: string): Swap {
let swap = Swap.load(id);
if(swap == null){
swap = new Swap(id);
swap.buyToken = ADDR_ZERO;
swap.sellToken = ADDR_ZERO;
swap.sellAmt = ZERO;
swap.unitAmt = ZERO;
swap.callData = new Bytes(0);
}
return swap;
}
export function createOrLoadSpell(id: string): Spell {
let spell = Spell.load(id);
if(spell == null){
spell = new Spell(id);
spell._datas = [];
spell._targets = [];
}
return spell;
}
export function createOrLoadExecute(id: string): ExecuteData {
let data = ExecuteData.load(id);
if(data == null) {
data = new ExecuteData(id);
data.user = ADDR_ZERO;
data.userId = ZERO;
data.nonce = ZERO;
data.finalHf = ZERO;
data.initialHf = ZERO;
data.automationFee = 0;
data.params = createOrLoadExecutionParams(id).id;
data.spells = createOrLoadSpell(id).id;
}
return data;
}
export function createOrLoadExecuteMetaData(id: string): ExecuteMetaData {
let data = ExecuteMetaData.load(id);
if(data == null) {
data = new ExecuteMetaData(id);
data.user = ADDR_ZERO;
data.userId = ZERO;
data.nonce = ZERO;
data.isSafe = false;
data.metadata = new Bytes(0);
}
return data;
}
export function createOrLoadCancelData(id: string): CancelData {
let data = CancelData.load(id);
if(data == null) {
data = new CancelData(id);
data.user = ADDR_ZERO;
data.userId = ZERO;
data.nonce = ZERO;
}
return data;
}
export function createOrLoadSystemCancelData(id: string): SystemCancelData {
let data = SystemCancelData.load(id);
if(data == null) {
data = new SystemCancelData(id);
data.user = ADDR_ZERO;
data.userId = ZERO;
data.nonce = ZERO;
data.errorCode = 0;
}
return data;
}

View File

@ -1,29 +1,77 @@
specVersion: 0.0.1
specVersion: 0.0.5
schema:
file: ./schema.graphql
dataSources:
- kind: ethereum
name: undefined
name: InstaAutomation
network: matic
source:
address: "0x6Bf41D02026b5B21F2a0bb0880b8545768a7151f"
abi: InstaAutomation
address: "0x3cF499Dbd2aBB6505f48Db27a9871523A38e6e2C"
startBlock: 31471200
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
entities:
- AdminChanged
- BeaconUpgraded
- Upgraded
abis:
- name: InstaAutomation
file: ./abis/InstaAutomation.json
entities:
- Account
- SubmitData
- ExecuteData
- ExecuteMetaData
- CancelData
- SystemCancelData
- Executors
- Spell
- Swap
- ExceutionParams
eventHandlers:
- event: AdminChanged(address,address)
handler: handleAdminChanged
- event: BeaconUpgraded(indexed address)
handler: handleBeaconUpgraded
- event: Upgraded(indexed address)
handler: handleUpgraded
- event: LogCancelledAutomation(indexed address,indexed uint32,indexed uint32)
handler: handleLogCancelAutomation
- event: LogSubmittedAutomation(indexed address,indexed uint32,uint128,uint128,uint128)
handler: handleLogSubmitAutomation
- event: LogExecutedAutomationParams(indexed address,indexed uint32,indexed uint32,uint128,uint128,uint16,(address,address,uint256,uint256,uint256,(address,address,uint256,uint256,bytes),uint256,uint256),(string[],bytes[]))
handler: handleLogExecuteAutomation
- event: LogExecutedAutomation(indexed address,indexed uint32,indexed uint32,bool,bytes)
handler: handleLogExecuteAutomationMetadata
- event: LogSystemCancelledAutomation(indexed address,indexed uint32,indexed uint32,uint8)
handler: handleSystemCancelledAutomation
- event: LogFlippedExecutors(address[],bool[])
handler: handleExecutors
file: ./src/insta-automation.ts
# templates:
# - kind: ethereum/contract
# name: InstaAutomation
# network: matic
# source:
# abi: InstaAutomation
# mapping:
# kind: ethereum/events
# apiVersion: 0.0.5
# language: wasm/assemblyscript
# entities:
# - Account
# - SubmitData
# - ExecuteData
# - ExecuteMetaData
# - CancelData
# - SystemCancelData
# abis:
# - name: InstaAutomation
# file: ./abis/InstaAutomation.json
# eventHandlers:
# - event: LogCancelledAutomation(indexed address,indexed uint32,indexed uint32)
# handler: handleLogCancelAutomation
# - event: LogSubmittedAutomation(indexed address,indexed uint32,uint128,uint128,uint128)
# handler: handleLogSubmitAutomation
# - event: LogExecutedAutomationParams(indexed address,indexed uint32,indexed uint32,uint128,uint128,uint16,(address,address,uint256,uint256,uint256,(address,address,uint256,uint256,bytes),uint256,uint256),(string[],bytes[]))
# handler: handleLogExecuteAutomation
# - event: LogExecutedAutomation(indexed address,indexed uint32,indexed uint32,bool,bytes)
# handler: handleLogExecuteAutomationMetadata
# - event: LogSystemCancelledAutomation(indexed address,indexed uint32,indexed uint32,uint8)
# handler: handleSystemCancelledAutomation
# - event: LogFlippedExecutors(address[],bool[])
# handler: handleExecutors
# file: ./src/insta-automation.ts

3373
yarn.lock Normal file

File diff suppressed because it is too large Load Diff