mirror of
https://github.com/Instadapp/aave-automation-subgraph.git
synced 2024-07-29 22:28:08 +00:00
minor changes
This commit is contained in:
parent
ec7f191e98
commit
5937fba5ee
|
|
@ -751,7 +751,7 @@ export class SystemCancelData extends Entity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Executors extends Entity {
|
export class Executor extends Entity {
|
||||||
constructor(id: string) {
|
constructor(id: string) {
|
||||||
super();
|
super();
|
||||||
this.set("id", Value.fromString(id));
|
this.set("id", Value.fromString(id));
|
||||||
|
|
@ -759,18 +759,18 @@ export class Executors extends Entity {
|
||||||
|
|
||||||
save(): void {
|
save(): void {
|
||||||
let id = this.get("id");
|
let id = this.get("id");
|
||||||
assert(id != null, "Cannot save Executors entity without an ID");
|
assert(id != null, "Cannot save Executor entity without an ID");
|
||||||
if (id) {
|
if (id) {
|
||||||
assert(
|
assert(
|
||||||
id.kind == ValueKind.STRING,
|
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()}`
|
`Entities of type Executor must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`
|
||||||
);
|
);
|
||||||
store.set("Executors", id.toString(), this);
|
store.set("Executor", id.toString(), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static load(id: string): Executors | null {
|
static load(id: string): Executor | null {
|
||||||
return changetype<Executors | null>(store.get("Executors", id));
|
return changetype<Executor | null>(store.get("Executor", id));
|
||||||
}
|
}
|
||||||
|
|
||||||
get id(): string {
|
get id(): string {
|
||||||
|
|
@ -790,13 +790,4 @@ export class Executors extends Entity {
|
||||||
set executors(value: Array<Bytes>) {
|
set executors(value: Array<Bytes>) {
|
||||||
this.set("executors", Value.fromBytesArray(value));
|
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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,8 +84,7 @@ type SystemCancelData @entity {
|
||||||
account: Account!
|
account: Account!
|
||||||
}
|
}
|
||||||
|
|
||||||
type Executors @entity {
|
type Executor @entity {
|
||||||
id: ID!
|
id: ID!
|
||||||
executors: [Bytes!]!
|
executors: [Bytes!]!
|
||||||
status: [Boolean!]!
|
|
||||||
}
|
}
|
||||||
|
|
@ -18,7 +18,7 @@ import {
|
||||||
SubmitData,
|
SubmitData,
|
||||||
CancelData,
|
CancelData,
|
||||||
SystemCancelData,
|
SystemCancelData,
|
||||||
Executors
|
Executor
|
||||||
} from "../generated/schema";
|
} from "../generated/schema";
|
||||||
import {
|
import {
|
||||||
createOrLoadCancelData,
|
createOrLoadCancelData,
|
||||||
|
|
@ -184,19 +184,25 @@ export function handleLogExecuteAutomation(
|
||||||
|
|
||||||
export function handleExecutors(event: LogFlippedExecutors): void {
|
export function handleExecutors(event: LogFlippedExecutors): void {
|
||||||
let id = "ALL"
|
let id = "ALL"
|
||||||
let executors_ = Executors.load(id);
|
let executors_ = Executor.load(id);
|
||||||
if(executors_ == null){
|
if(executors_ == null){
|
||||||
executors_ = new Executors(id);
|
executors_ = new Executor(id);
|
||||||
executors_.executors = [];
|
executors_.executors = [];
|
||||||
executors_.status = [];
|
|
||||||
}
|
}
|
||||||
let execArr = executors_.executors;
|
let execArr = executors_.executors;
|
||||||
let statusArr = executors_.status;
|
let statusArr = event.params.status;
|
||||||
for(let i=0;i<event.params.executors.length;i++){
|
for(let i=0;i<event.params.executors.length;i++){
|
||||||
execArr.push(event.params.executors[i]);
|
let index = execArr.indexOf(event.params.executors[i]);
|
||||||
statusArr.push(event.params.status[i])
|
if(statusArr[i] === true){
|
||||||
|
if(index == -1){
|
||||||
|
execArr.push(event.params.executors[i]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(index != -1){
|
||||||
|
execArr.splice(index-1, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
executors_.executors = execArr;
|
executors_.executors = execArr;
|
||||||
executors_.status = statusArr;
|
|
||||||
executors_.save();
|
executors_.save();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user