mirror of
https://github.com/Instadapp/aave-automation-subgraph.git
synced 2024-07-29 22:28:08 +00:00
failed execuion event track
This commit is contained in:
parent
d746f5b2b7
commit
5855300d08
|
|
@ -169,6 +169,102 @@
|
||||||
"name": "LogExecutedAutomation",
|
"name": "LogExecutedAutomation",
|
||||||
"type": "event"
|
"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"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"indexed": false,
|
||||||
|
"internalType": "bytes",
|
||||||
|
"name": "metadata",
|
||||||
|
"type": "bytes"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"indexed": false,
|
||||||
|
"internalType": "uint128",
|
||||||
|
"name": "initialHf",
|
||||||
|
"type": "uint128"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "LogExecutionFailedAutomation",
|
||||||
|
"type": "event"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"anonymous": false,
|
"anonymous": false,
|
||||||
"inputs": [
|
"inputs": [
|
||||||
|
|
|
||||||
|
|
@ -166,6 +166,104 @@ export class LogExecutedAutomationParamsSwapStruct extends ethereum.Tuple {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class LogExecutionFailedAutomation extends ethereum.Event {
|
||||||
|
get params(): LogExecutionFailedAutomation__Params {
|
||||||
|
return new LogExecutionFailedAutomation__Params(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class LogExecutionFailedAutomation__Params {
|
||||||
|
_event: LogExecutionFailedAutomation;
|
||||||
|
|
||||||
|
constructor(event: LogExecutionFailedAutomation) {
|
||||||
|
this._event = event;
|
||||||
|
}
|
||||||
|
|
||||||
|
get user(): Address {
|
||||||
|
return this._event.parameters[0].value.toAddress();
|
||||||
|
}
|
||||||
|
|
||||||
|
get id(): BigInt {
|
||||||
|
return this._event.parameters[1].value.toBigInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
get nonce(): BigInt {
|
||||||
|
return this._event.parameters[2].value.toBigInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
get params(): LogExecutionFailedAutomationParamsStruct {
|
||||||
|
return changetype<LogExecutionFailedAutomationParamsStruct>(
|
||||||
|
this._event.parameters[3].value.toTuple()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
get metadata(): Bytes {
|
||||||
|
return this._event.parameters[4].value.toBytes();
|
||||||
|
}
|
||||||
|
|
||||||
|
get initialHf(): BigInt {
|
||||||
|
return this._event.parameters[5].value.toBigInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class LogExecutionFailedAutomationParamsStruct extends ethereum.Tuple {
|
||||||
|
get collateralToken(): Address {
|
||||||
|
return this[0].toAddress();
|
||||||
|
}
|
||||||
|
|
||||||
|
get debtToken(): Address {
|
||||||
|
return this[1].toAddress();
|
||||||
|
}
|
||||||
|
|
||||||
|
get collateralAmount(): BigInt {
|
||||||
|
return this[2].toBigInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
get debtAmount(): BigInt {
|
||||||
|
return this[3].toBigInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
get collateralAmountWithTotalFee(): BigInt {
|
||||||
|
return this[4].toBigInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
get swap(): LogExecutionFailedAutomationParamsSwapStruct {
|
||||||
|
return changetype<LogExecutionFailedAutomationParamsSwapStruct>(
|
||||||
|
this[5].toTuple()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
get route(): BigInt {
|
||||||
|
return this[6].toBigInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
get rateMode(): BigInt {
|
||||||
|
return this[7].toBigInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class LogExecutionFailedAutomationParamsSwapStruct extends ethereum.Tuple {
|
||||||
|
get buyToken(): Address {
|
||||||
|
return this[0].toAddress();
|
||||||
|
}
|
||||||
|
|
||||||
|
get sellToken(): Address {
|
||||||
|
return this[1].toAddress();
|
||||||
|
}
|
||||||
|
|
||||||
|
get sellAmt(): BigInt {
|
||||||
|
return this[2].toBigInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
get unitAmt(): BigInt {
|
||||||
|
return this[3].toBigInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
get callData(): Bytes {
|
||||||
|
return this[4].toBytes();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class LogFeeTransferred extends ethereum.Event {
|
export class LogFeeTransferred extends ethereum.Event {
|
||||||
get params(): LogFeeTransferred__Params {
|
get params(): LogFeeTransferred__Params {
|
||||||
return new LogFeeTransferred__Params(this);
|
return new LogFeeTransferred__Params(this);
|
||||||
|
|
|
||||||
|
|
@ -394,6 +394,15 @@ export class Account extends Entity {
|
||||||
set systemCancelData(value: Array<string>) {
|
set systemCancelData(value: Array<string>) {
|
||||||
this.set("systemCancelData", Value.fromStringArray(value));
|
this.set("systemCancelData", Value.fromStringArray(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get failedExecutionData(): Array<string> {
|
||||||
|
let value = this.get("failedExecutionData");
|
||||||
|
return value!.toStringArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
set failedExecutionData(value: Array<string>) {
|
||||||
|
this.set("failedExecutionData", Value.fromStringArray(value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SubmitData extends Entity {
|
export class SubmitData extends Entity {
|
||||||
|
|
@ -1215,3 +1224,107 @@ export class Executor extends Entity {
|
||||||
this.set("executors", Value.fromBytesArray(value));
|
this.set("executors", Value.fromBytesArray(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class FailedExecution extends Entity {
|
||||||
|
constructor(id: string) {
|
||||||
|
super();
|
||||||
|
this.set("id", Value.fromString(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
save(): void {
|
||||||
|
let id = this.get("id");
|
||||||
|
assert(id != null, "Cannot save FailedExecution entity without an ID");
|
||||||
|
if (id) {
|
||||||
|
assert(
|
||||||
|
id.kind == ValueKind.STRING,
|
||||||
|
`Entities of type FailedExecution must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`
|
||||||
|
);
|
||||||
|
store.set("FailedExecution", id.toString(), this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static load(id: string): FailedExecution | null {
|
||||||
|
return changetype<FailedExecution | null>(store.get("FailedExecution", 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 account(): string {
|
||||||
|
let value = this.get("account");
|
||||||
|
return value!.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
set account(value: string) {
|
||||||
|
this.set("account", Value.fromString(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 params(): string {
|
||||||
|
let value = this.get("params");
|
||||||
|
return value!.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
set params(value: string) {
|
||||||
|
this.set("params", Value.fromString(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
get metadata(): Bytes {
|
||||||
|
let value = this.get("metadata");
|
||||||
|
return value!.toBytes();
|
||||||
|
}
|
||||||
|
|
||||||
|
set metadata(value: Bytes) {
|
||||||
|
this.set("metadata", Value.fromBytes(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
get initialHf(): BigInt {
|
||||||
|
let value = this.get("initialHf");
|
||||||
|
return value!.toBigInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
set initialHf(value: BigInt) {
|
||||||
|
this.set("initialHf", Value.fromBigInt(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
get transactionDetail(): string {
|
||||||
|
let value = this.get("transactionDetail");
|
||||||
|
return value!.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
set transactionDetail(value: string) {
|
||||||
|
this.set("transactionDetail", Value.fromString(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,5 +10,11 @@
|
||||||
"address": "0x08c1c01be430C9381AD2794412C3E940254CD97c",
|
"address": "0x08c1c01be430C9381AD2794412C3E940254CD97c",
|
||||||
"startBlock": 18160000
|
"startBlock": 18160000
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"mainnet": {
|
||||||
|
"InstaAutomation": {
|
||||||
|
"address": "0x08c1c01be430C9381AD2794412C3E940254CD97c",
|
||||||
|
"startBlock": 15435700
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
type ExecutionParams @entity{
|
type ExecutionParams @entity {
|
||||||
id: ID!
|
id: ID!
|
||||||
collateralToken: Bytes!
|
collateralToken: Bytes!
|
||||||
debtToken: Bytes!
|
debtToken: Bytes!
|
||||||
|
|
@ -37,10 +37,11 @@ type TransactionData @entity {
|
||||||
type Account @entity {
|
type Account @entity {
|
||||||
id: ID!
|
id: ID!
|
||||||
user: Bytes!
|
user: Bytes!
|
||||||
submitAutomation: [SubmitData!]! @derivedFrom (field: "account")
|
submitAutomation: [SubmitData!]! @derivedFrom(field: "account")
|
||||||
executeAutomation: [ExecuteData!]! @derivedFrom (field: "account")
|
executeAutomation: [ExecuteData!]! @derivedFrom(field: "account")
|
||||||
cancelData: [CancelData!]! @derivedFrom (field: "account")
|
cancelData: [CancelData!]! @derivedFrom(field: "account")
|
||||||
systemCancelData: [SystemCancelData!]! @derivedFrom (field: "account")
|
systemCancelData: [SystemCancelData!]! @derivedFrom(field: "account")
|
||||||
|
failedExecutionData: [FailedExecution!]! @derivedFrom(field: "account")
|
||||||
}
|
}
|
||||||
|
|
||||||
type SubmitData @entity {
|
type SubmitData @entity {
|
||||||
|
|
@ -51,7 +52,7 @@ type SubmitData @entity {
|
||||||
thresholdHF: BigInt!
|
thresholdHF: BigInt!
|
||||||
currentHf: BigInt!
|
currentHf: BigInt!
|
||||||
account: Account!
|
account: Account!
|
||||||
transactionDetail: TransactionData!
|
transactionDetail: TransactionData!
|
||||||
}
|
}
|
||||||
|
|
||||||
type ExecuteData @entity {
|
type ExecuteData @entity {
|
||||||
|
|
@ -75,7 +76,7 @@ type CancelData @entity {
|
||||||
userId: BigInt!
|
userId: BigInt!
|
||||||
nonce: BigInt!
|
nonce: BigInt!
|
||||||
account: Account!
|
account: Account!
|
||||||
transactionDetail: TransactionData!
|
transactionDetail: TransactionData!
|
||||||
}
|
}
|
||||||
|
|
||||||
type SystemCancelData @entity {
|
type SystemCancelData @entity {
|
||||||
|
|
@ -85,14 +86,14 @@ type SystemCancelData @entity {
|
||||||
nonce: BigInt!
|
nonce: BigInt!
|
||||||
errorCode: Int!
|
errorCode: Int!
|
||||||
account: Account!
|
account: Account!
|
||||||
transactionDetail: TransactionData!
|
transactionDetail: TransactionData!
|
||||||
}
|
}
|
||||||
|
|
||||||
type ChangedOwner @entity {
|
type ChangedOwner @entity {
|
||||||
id: ID!
|
id: ID!
|
||||||
oldOwner: Bytes!
|
oldOwner: Bytes!
|
||||||
newOwner: Bytes!
|
newOwner: Bytes!
|
||||||
transactionDetail: TransactionData!
|
transactionDetail: TransactionData!
|
||||||
}
|
}
|
||||||
|
|
||||||
type FeeTransferData @entity {
|
type FeeTransferData @entity {
|
||||||
|
|
@ -101,7 +102,7 @@ type FeeTransferData @entity {
|
||||||
tokens: [Bytes!]!
|
tokens: [Bytes!]!
|
||||||
amount: [BigInt!]!
|
amount: [BigInt!]!
|
||||||
from: Bytes!
|
from: Bytes!
|
||||||
transactionDetail: TransactionData!
|
transactionDetail: TransactionData!
|
||||||
}
|
}
|
||||||
|
|
||||||
type SystemCallData @entity {
|
type SystemCallData @entity {
|
||||||
|
|
@ -109,14 +110,14 @@ type SystemCallData @entity {
|
||||||
sender: Bytes!
|
sender: Bytes!
|
||||||
actionId: String!
|
actionId: String!
|
||||||
metaData: Bytes!
|
metaData: Bytes!
|
||||||
transactionDetail: TransactionData!
|
transactionDetail: TransactionData!
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateAutomationFeeData @entity {
|
type UpdateAutomationFeeData @entity {
|
||||||
id: ID!
|
id: ID!
|
||||||
oldAutomationFee: Int!
|
oldAutomationFee: Int!
|
||||||
newAutomationFee: Int!
|
newAutomationFee: Int!
|
||||||
transactionDetail: TransactionData!
|
transactionDetail: TransactionData!
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateBufferHfData @entity {
|
type UpdateBufferHfData @entity {
|
||||||
|
|
@ -130,10 +131,22 @@ type UpdateMinHfData @entity {
|
||||||
id: ID!
|
id: ID!
|
||||||
oldMinHf: BigInt!
|
oldMinHf: BigInt!
|
||||||
newMinHf: BigInt!
|
newMinHf: BigInt!
|
||||||
transactionDetail: TransactionData!
|
transactionDetail: TransactionData!
|
||||||
}
|
}
|
||||||
|
|
||||||
type Executor @entity {
|
type Executor @entity {
|
||||||
id: ID!
|
id: ID!
|
||||||
executors: [Bytes!]!
|
executors: [Bytes!]!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FailedExecution @entity {
|
||||||
|
id: ID!
|
||||||
|
user: Bytes!
|
||||||
|
account: Account!
|
||||||
|
userId: BigInt!
|
||||||
|
nonce: BigInt!
|
||||||
|
params: ExecutionParams!
|
||||||
|
metadata: Bytes!
|
||||||
|
initialHf: BigInt!
|
||||||
|
transactionDetail: TransactionData!
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import {
|
||||||
LogCancelledAutomation,
|
LogCancelledAutomation,
|
||||||
LogChangedOwner,
|
LogChangedOwner,
|
||||||
LogExecutedAutomation,
|
LogExecutedAutomation,
|
||||||
|
LogExecutionFailedAutomation,
|
||||||
LogFeeTransferred,
|
LogFeeTransferred,
|
||||||
LogFlippedExecutors,
|
LogFlippedExecutors,
|
||||||
LogSubmittedAutomation,
|
LogSubmittedAutomation,
|
||||||
|
|
@ -36,6 +37,7 @@ import {
|
||||||
createOrLoadDsa,
|
createOrLoadDsa,
|
||||||
createOrLoadExecute,
|
createOrLoadExecute,
|
||||||
createOrLoadExecutionParams,
|
createOrLoadExecutionParams,
|
||||||
|
createOrLoadFailedExecution,
|
||||||
createOrLoadFeeTransferData,
|
createOrLoadFeeTransferData,
|
||||||
createOrLoadSubmit,
|
createOrLoadSubmit,
|
||||||
createOrLoadSwap,
|
createOrLoadSwap,
|
||||||
|
|
@ -108,7 +110,7 @@ export function handleLogCancelAutomation(event: LogCancelledAutomation): void {
|
||||||
transaction.transactionHash = event.transaction.hash;
|
transaction.transactionHash = event.transaction.hash;
|
||||||
transaction.transactionLogIndex = event.transactionLogIndex;
|
transaction.transactionLogIndex = event.transactionLogIndex;
|
||||||
cancelData.transactionDetail = transaction.id;
|
cancelData.transactionDetail = transaction.id;
|
||||||
|
|
||||||
transaction.save();
|
transaction.save();
|
||||||
cancelData.save();
|
cancelData.save();
|
||||||
dsa.save();
|
dsa.save();
|
||||||
|
|
@ -144,15 +146,13 @@ export function handleSystemCancelledAutomation(
|
||||||
transaction.transactionHash = event.transaction.hash;
|
transaction.transactionHash = event.transaction.hash;
|
||||||
transaction.transactionLogIndex = event.transactionLogIndex;
|
transaction.transactionLogIndex = event.transactionLogIndex;
|
||||||
cancelData.transactionDetail = transaction.id;
|
cancelData.transactionDetail = transaction.id;
|
||||||
|
|
||||||
transaction.save();
|
transaction.save();
|
||||||
cancelData.save();
|
cancelData.save();
|
||||||
dsa.save();
|
dsa.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function handleLogExecuteAutomation(
|
export function handleLogExecuteAutomation(event: LogExecutedAutomation): void {
|
||||||
event: LogExecutedAutomation
|
|
||||||
): void {
|
|
||||||
let dsaId =
|
let dsaId =
|
||||||
event.params.user.toHexString() + "#" + event.params.id.toString();
|
event.params.user.toHexString() + "#" + event.params.id.toString();
|
||||||
let eventId =
|
let eventId =
|
||||||
|
|
@ -199,7 +199,7 @@ export function handleLogExecuteAutomation(
|
||||||
transaction.transactionHash = event.transaction.hash;
|
transaction.transactionHash = event.transaction.hash;
|
||||||
transaction.transactionLogIndex = event.transactionLogIndex;
|
transaction.transactionLogIndex = event.transactionLogIndex;
|
||||||
executeData.transactionDetail = transaction.id;
|
executeData.transactionDetail = transaction.id;
|
||||||
|
|
||||||
transaction.save();
|
transaction.save();
|
||||||
params.save();
|
params.save();
|
||||||
swaps.save();
|
swaps.save();
|
||||||
|
|
@ -221,10 +221,10 @@ export function handleLogChangedOwner(event: LogChangedOwner): void {
|
||||||
transaction.transactionHash = event.transaction.hash;
|
transaction.transactionHash = event.transaction.hash;
|
||||||
transaction.transactionLogIndex = event.transactionLogIndex;
|
transaction.transactionLogIndex = event.transactionLogIndex;
|
||||||
changeOwnerData.transactionDetail = transaction.id;
|
changeOwnerData.transactionDetail = transaction.id;
|
||||||
|
|
||||||
transaction.save();
|
transaction.save();
|
||||||
changeOwnerData.save();
|
changeOwnerData.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function handleLogFeeTransferred(event: LogFeeTransferred): void {
|
export function handleLogFeeTransferred(event: LogFeeTransferred): void {
|
||||||
let eventId =
|
let eventId =
|
||||||
|
|
@ -238,7 +238,7 @@ export function handleLogFeeTransferred(event: LogFeeTransferred): void {
|
||||||
let dataTokens = data.tokens;
|
let dataTokens = data.tokens;
|
||||||
let dataAmounts = data.amount;
|
let dataAmounts = data.amount;
|
||||||
|
|
||||||
for(let i = 0; i<tokens.length; i++) {
|
for (let i = 0; i < tokens.length; i++) {
|
||||||
dataTokens.push(tokens[i]);
|
dataTokens.push(tokens[i]);
|
||||||
dataAmounts.push(amounts[i]);
|
dataAmounts.push(amounts[i]);
|
||||||
}
|
}
|
||||||
|
|
@ -252,10 +252,10 @@ export function handleLogFeeTransferred(event: LogFeeTransferred): void {
|
||||||
transaction.transactionHash = event.transaction.hash;
|
transaction.transactionHash = event.transaction.hash;
|
||||||
transaction.transactionLogIndex = event.transactionLogIndex;
|
transaction.transactionLogIndex = event.transactionLogIndex;
|
||||||
data.transactionDetail = transaction.id;
|
data.transactionDetail = transaction.id;
|
||||||
|
|
||||||
transaction.save();
|
transaction.save();
|
||||||
data.save();
|
data.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function handleLogSystemCall(event: LogSystemCall): void {
|
export function handleLogSystemCall(event: LogSystemCall): void {
|
||||||
let eventId =
|
let eventId =
|
||||||
|
|
@ -272,12 +272,14 @@ export function handleLogSystemCall(event: LogSystemCall): void {
|
||||||
transaction.transactionHash = event.transaction.hash;
|
transaction.transactionHash = event.transaction.hash;
|
||||||
transaction.transactionLogIndex = event.transactionLogIndex;
|
transaction.transactionLogIndex = event.transactionLogIndex;
|
||||||
data.transactionDetail = transaction.id;
|
data.transactionDetail = transaction.id;
|
||||||
|
|
||||||
transaction.save();
|
transaction.save();
|
||||||
data.save();
|
data.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function handleLogUpdateAutomationFee(event: LogUpdatedAutomationFee): void {
|
export function handleLogUpdateAutomationFee(
|
||||||
|
event: LogUpdatedAutomationFee
|
||||||
|
): void {
|
||||||
let eventId =
|
let eventId =
|
||||||
event.transaction.hash.toHexString() + event.logIndex.toString();
|
event.transaction.hash.toHexString() + event.logIndex.toString();
|
||||||
|
|
||||||
|
|
@ -291,10 +293,10 @@ export function handleLogUpdateAutomationFee(event: LogUpdatedAutomationFee): vo
|
||||||
transaction.transactionHash = event.transaction.hash;
|
transaction.transactionHash = event.transaction.hash;
|
||||||
transaction.transactionLogIndex = event.transactionLogIndex;
|
transaction.transactionLogIndex = event.transactionLogIndex;
|
||||||
data.transactionDetail = transaction.id;
|
data.transactionDetail = transaction.id;
|
||||||
|
|
||||||
transaction.save();
|
transaction.save();
|
||||||
data.save();
|
data.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function handleUpdatedBufferHf(event: LogUpdatedBufferHf): void {
|
export function handleUpdatedBufferHf(event: LogUpdatedBufferHf): void {
|
||||||
let eventId =
|
let eventId =
|
||||||
|
|
@ -310,7 +312,7 @@ export function handleUpdatedBufferHf(event: LogUpdatedBufferHf): void {
|
||||||
transaction.transactionHash = event.transaction.hash;
|
transaction.transactionHash = event.transaction.hash;
|
||||||
transaction.transactionLogIndex = event.transactionLogIndex;
|
transaction.transactionLogIndex = event.transactionLogIndex;
|
||||||
data.transactionDetail = transaction.id;
|
data.transactionDetail = transaction.id;
|
||||||
|
|
||||||
transaction.save();
|
transaction.save();
|
||||||
data.save();
|
data.save();
|
||||||
}
|
}
|
||||||
|
|
@ -329,7 +331,7 @@ export function handleLogUpdatedMinHf(event: LogUpdatedMinHf): void {
|
||||||
transaction.transactionHash = event.transaction.hash;
|
transaction.transactionHash = event.transaction.hash;
|
||||||
transaction.transactionLogIndex = event.transactionLogIndex;
|
transaction.transactionLogIndex = event.transactionLogIndex;
|
||||||
data.transactionDetail = transaction.id;
|
data.transactionDetail = transaction.id;
|
||||||
|
|
||||||
transaction.save();
|
transaction.save();
|
||||||
data.save();
|
data.save();
|
||||||
}
|
}
|
||||||
|
|
@ -358,3 +360,57 @@ export function handleExecutors(event: LogFlippedExecutors): void {
|
||||||
executors_.executors = execArr;
|
executors_.executors = execArr;
|
||||||
executors_.save();
|
executors_.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function handleLogFailedExecution(
|
||||||
|
event: LogExecutionFailedAutomation
|
||||||
|
): 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);
|
||||||
|
dsa.user = event.params.user;
|
||||||
|
let failedExecuteData = createOrLoadFailedExecution(eventId);
|
||||||
|
let params = createOrLoadExecutionParams(eventId);
|
||||||
|
|
||||||
|
failedExecuteData.user = event.params.user;
|
||||||
|
failedExecuteData.userId = event.params.id;
|
||||||
|
failedExecuteData.nonce = event.params.nonce;
|
||||||
|
failedExecuteData.initialHf = event.params.initialHf;
|
||||||
|
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;
|
||||||
|
failedExecuteData.metadata = event.params.metadata;
|
||||||
|
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;
|
||||||
|
params.swap = swaps.id;
|
||||||
|
failedExecuteData.params = params.id;
|
||||||
|
failedExecuteData.account = dsaId;
|
||||||
|
let transaction = createOrLoadTransaction(eventId);
|
||||||
|
transaction.blockNumber = event.block.number;
|
||||||
|
transaction.timeStamp = event.block.timestamp;
|
||||||
|
transaction.logIndex = event.logIndex;
|
||||||
|
transaction.transactionHash = event.transaction.hash;
|
||||||
|
transaction.transactionLogIndex = event.transactionLogIndex;
|
||||||
|
failedExecuteData.transactionDetail = transaction.id;
|
||||||
|
|
||||||
|
transaction.save();
|
||||||
|
params.save();
|
||||||
|
swaps.save();
|
||||||
|
failedExecuteData.save();
|
||||||
|
dsa.save();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import {
|
||||||
Bytes,
|
Bytes,
|
||||||
DataSourceContext,
|
DataSourceContext,
|
||||||
} from "@graphprotocol/graph-ts";
|
} from "@graphprotocol/graph-ts";
|
||||||
import { Account, ExecutionParams, SubmitData, Swap, Spell, ExecuteData, CancelData, SystemCancelData, TransactionData, ChangedOwner, FeeTransferData, SystemCallData, UpdateAutomationFeeData, UpdateBufferHfData, UpdateMinHfData } from "../generated/schema";
|
import { Account, ExecutionParams, SubmitData, Swap, Spell, ExecuteData, CancelData, SystemCancelData, TransactionData, ChangedOwner, FeeTransferData, SystemCallData, UpdateAutomationFeeData, UpdateBufferHfData, UpdateMinHfData, FailedExecution } from "../generated/schema";
|
||||||
import { InstaAutomation } from "../generated/InstaAutomation/InstaAutomation";
|
import { InstaAutomation } from "../generated/InstaAutomation/InstaAutomation";
|
||||||
import { InstaAutomation as InstaAutomationABI } from "../generated/templates";
|
import { InstaAutomation as InstaAutomationABI } from "../generated/templates";
|
||||||
|
|
||||||
|
|
@ -107,6 +107,21 @@ export function createOrLoadExecute(id: string): ExecuteData {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function createOrLoadFailedExecution(id: string): FailedExecution {
|
||||||
|
let data = FailedExecution.load(id);
|
||||||
|
if(data == null) {
|
||||||
|
data = new FailedExecution(id);
|
||||||
|
data.user = ADDR_ZERO;
|
||||||
|
data.userId = ZERO;
|
||||||
|
data.nonce = ZERO;
|
||||||
|
data.initialHf = ZERO;
|
||||||
|
data.params = createOrLoadExecutionParams(id).id;
|
||||||
|
data.transactionDetail = createOrLoadTransaction(id).id;
|
||||||
|
data.metadata = new Bytes(0);
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
export function createOrLoadCancelData(id: string): CancelData {
|
export function createOrLoadCancelData(id: string): CancelData {
|
||||||
let data = CancelData.load(id);
|
let data = CancelData.load(id);
|
||||||
if(data == null) {
|
if(data == null) {
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@ schema:
|
||||||
dataSources:
|
dataSources:
|
||||||
- kind: ethereum
|
- kind: ethereum
|
||||||
name: InstaAutomation
|
name: InstaAutomation
|
||||||
network: matic
|
network: mainnet
|
||||||
source:
|
source:
|
||||||
abi: InstaAutomation
|
abi: InstaAutomation
|
||||||
address: "0x3cF499Dbd2aBB6505f48Db27a9871523A38e6e2C"
|
address: "0x08c1c01be430C9381AD2794412C3E940254CD97c"
|
||||||
startBlock: 31471200
|
startBlock: 15435700
|
||||||
mapping:
|
mapping:
|
||||||
kind: ethereum/events
|
kind: ethereum/events
|
||||||
apiVersion: 0.0.5
|
apiVersion: 0.0.5
|
||||||
|
|
@ -30,6 +30,7 @@ dataSources:
|
||||||
- UpdateAutomationFeeData
|
- UpdateAutomationFeeData
|
||||||
- UpdateBufferHfData
|
- UpdateBufferHfData
|
||||||
- UpdateMinHfData
|
- UpdateMinHfData
|
||||||
|
- FailedExecution
|
||||||
eventHandlers:
|
eventHandlers:
|
||||||
- event: LogCancelledAutomation(indexed address,indexed uint32,indexed uint32)
|
- event: LogCancelledAutomation(indexed address,indexed uint32,indexed uint32)
|
||||||
handler: handleLogCancelAutomation
|
handler: handleLogCancelAutomation
|
||||||
|
|
@ -56,4 +57,7 @@ dataSources:
|
||||||
handler: handleLogSubmitAutomation
|
handler: handleLogSubmitAutomation
|
||||||
- event: LogChangedOwner(indexed address,indexed address)
|
- event: LogChangedOwner(indexed address,indexed address)
|
||||||
handler: handleLogChangedOwner
|
handler: handleLogChangedOwner
|
||||||
|
- event: LogExecutionFailedAutomation(indexed address,indexed uint32,indexed
|
||||||
|
uint32,(address,address,uint256,uint256,uint256,(address,address,uint256,uint256,bytes),uint256,uint256),bytes,uint128)
|
||||||
|
handler: handleLogFailedExecution
|
||||||
file: ./src/insta-automation.ts
|
file: ./src/insta-automation.ts
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user