subgraph added

This commit is contained in:
Richa-iitr 2022-08-15 23:03:06 +05:30
parent de97b161b1
commit f60a9c002b
16 changed files with 6482 additions and 81 deletions

2
.gitignore vendored Normal file
View File

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

88
abis/ERC20.json Normal file
View File

@ -0,0 +1,88 @@
[
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "from",
"type": "address"
},
{
"indexed": true,
"name": "to",
"type": "address"
},
{
"indexed": false,
"name": "value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "owner",
"type": "address"
},
{
"indexed": true,
"name": "spender",
"type": "address"
},
{
"indexed": false,
"name": "value",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "decimals",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
]

282
abis/InstaAccount.json Normal file
View File

@ -0,0 +1,282 @@
[
{
"inputs": [
{ "internalType": "address", "name": "_instaIndex", "type": "address" },
{ "internalType": "address", "name": "_connectors", "type": "address" }
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "origin",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string[]",
"name": "targetsNames",
"type": "string[]"
},
{
"indexed": false,
"internalType": "address[]",
"name": "targets",
"type": "address[]"
},
{
"indexed": false,
"internalType": "string[]",
"name": "eventNames",
"type": "string[]"
},
{
"indexed": false,
"internalType": "bytes[]",
"name": "eventParams",
"type": "bytes[]"
}
],
"name": "LogCast",
"type": "event"
},
{
"inputs": [
{
"internalType": "string[]",
"name": "_targetNames",
"type": "string[]"
},
{ "internalType": "bytes[]", "name": "_datas", "type": "bytes[]" },
{ "internalType": "address", "name": "_origin", "type": "address" }
],
"name": "cast",
"outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "connectorsM1",
"outputs": [{ "internalType": "address", "name": "", "type": "address" }],
"stateMutability": "view",
"type": "function"
},
{ "stateMutability": "payable", "type": "receive" },
{
"inputs": [
{
"internalType": "address",
"name": "_instaIndex",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "origin",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "LogCast",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
}
],
"name": "LogDisable",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "user",
"type": "address"
}
],
"name": "LogEnable",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "bool",
"name": "_shield",
"type": "bool"
}
],
"name": "LogSwitchShield",
"type": "event"
},
{
"inputs": [
{
"internalType": "address[]",
"name": "_targets",
"type": "address[]"
},
{
"internalType": "bytes[]",
"name": "_datas",
"type": "bytes[]"
},
{
"internalType": "address",
"name": "_origin",
"type": "address"
}
],
"name": "cast",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "user",
"type": "address"
}
],
"name": "disable",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "user",
"type": "address"
}
],
"name": "enable",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "instaIndex",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "user",
"type": "address"
}
],
"name": "isAuth",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "shield",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bool",
"name": "_shield",
"type": "bool"
}
],
"name": "switchShield",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "version",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
}
]

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"
}
]

114
generated/ERC20/ERC20.ts Normal file
View File

@ -0,0 +1,114 @@
// 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 Transfer extends ethereum.Event {
get params(): Transfer__Params {
return new Transfer__Params(this);
}
}
export class Transfer__Params {
_event: Transfer;
constructor(event: Transfer) {
this._event = event;
}
get from(): Address {
return this._event.parameters[0].value.toAddress();
}
get to(): Address {
return this._event.parameters[1].value.toAddress();
}
get value(): BigInt {
return this._event.parameters[2].value.toBigInt();
}
}
export class Approval extends ethereum.Event {
get params(): Approval__Params {
return new Approval__Params(this);
}
}
export class Approval__Params {
_event: Approval;
constructor(event: Approval) {
this._event = event;
}
get owner(): Address {
return this._event.parameters[0].value.toAddress();
}
get spender(): Address {
return this._event.parameters[1].value.toAddress();
}
get value(): BigInt {
return this._event.parameters[2].value.toBigInt();
}
}
export class ERC20 extends ethereum.SmartContract {
static bind(address: Address): ERC20 {
return new ERC20("ERC20", address);
}
name(): string {
let result = super.call("name", "name():(string)", []);
return result[0].toString();
}
try_name(): ethereum.CallResult<string> {
let result = super.tryCall("name", "name():(string)", []);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toString());
}
decimals(): BigInt {
let result = super.call("decimals", "decimals():(uint256)", []);
return result[0].toBigInt();
}
try_decimals(): ethereum.CallResult<BigInt> {
let result = super.tryCall("decimals", "decimals():(uint256)", []);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toBigInt());
}
symbol(): string {
let result = super.call("symbol", "symbol():(string)", []);
return result[0].toString();
}
try_symbol(): ethereum.CallResult<string> {
let result = super.tryCall("symbol", "symbol():(string)", []);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toString());
}
}

View File

@ -0,0 +1,452 @@
// 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 LogCast extends ethereum.Event {
get params(): LogCast__Params {
return new LogCast__Params(this);
}
}
export class LogCast__Params {
_event: LogCast;
constructor(event: LogCast) {
this._event = event;
}
get origin(): Address {
return this._event.parameters[0].value.toAddress();
}
get sender(): Address {
return this._event.parameters[1].value.toAddress();
}
get value(): BigInt {
return this._event.parameters[2].value.toBigInt();
}
get targetsNames(): Array<string> {
return this._event.parameters[3].value.toStringArray();
}
get targets(): Array<Address> {
return this._event.parameters[4].value.toAddressArray();
}
get eventNames(): Array<string> {
return this._event.parameters[5].value.toStringArray();
}
get eventParams(): Array<Bytes> {
return this._event.parameters[6].value.toBytesArray();
}
}
export class LogCast1 extends ethereum.Event {
get params(): LogCast1__Params {
return new LogCast1__Params(this);
}
}
export class LogCast1__Params {
_event: LogCast1;
constructor(event: LogCast1) {
this._event = event;
}
get origin(): Address {
return this._event.parameters[0].value.toAddress();
}
get sender(): Address {
return this._event.parameters[1].value.toAddress();
}
get value(): BigInt {
return this._event.parameters[2].value.toBigInt();
}
}
export class LogDisable extends ethereum.Event {
get params(): LogDisable__Params {
return new LogDisable__Params(this);
}
}
export class LogDisable__Params {
_event: LogDisable;
constructor(event: LogDisable) {
this._event = event;
}
get user(): Address {
return this._event.parameters[0].value.toAddress();
}
}
export class LogEnable extends ethereum.Event {
get params(): LogEnable__Params {
return new LogEnable__Params(this);
}
}
export class LogEnable__Params {
_event: LogEnable;
constructor(event: LogEnable) {
this._event = event;
}
get user(): Address {
return this._event.parameters[0].value.toAddress();
}
}
export class LogSwitchShield extends ethereum.Event {
get params(): LogSwitchShield__Params {
return new LogSwitchShield__Params(this);
}
}
export class LogSwitchShield__Params {
_event: LogSwitchShield;
constructor(event: LogSwitchShield) {
this._event = event;
}
get _shield(): boolean {
return this._event.parameters[0].value.toBoolean();
}
}
export class InstaAccount extends ethereum.SmartContract {
static bind(address: Address): InstaAccount {
return new InstaAccount("InstaAccount", address);
}
connectorsM1(): Address {
let result = super.call("connectorsM1", "connectorsM1():(address)", []);
return result[0].toAddress();
}
try_connectorsM1(): ethereum.CallResult<Address> {
let result = super.tryCall("connectorsM1", "connectorsM1():(address)", []);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toAddress());
}
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());
}
isAuth(user: Address): boolean {
let result = super.call("isAuth", "isAuth(address):(bool)", [
ethereum.Value.fromAddress(user)
]);
return result[0].toBoolean();
}
try_isAuth(user: Address): ethereum.CallResult<boolean> {
let result = super.tryCall("isAuth", "isAuth(address):(bool)", [
ethereum.Value.fromAddress(user)
]);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toBoolean());
}
shield(): boolean {
let result = super.call("shield", "shield():(bool)", []);
return result[0].toBoolean();
}
try_shield(): ethereum.CallResult<boolean> {
let result = super.tryCall("shield", "shield():(bool)", []);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toBoolean());
}
version(): BigInt {
let result = super.call("version", "version():(uint256)", []);
return result[0].toBigInt();
}
try_version(): ethereum.CallResult<BigInt> {
let result = super.tryCall("version", "version():(uint256)", []);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].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();
}
get _connectors(): Address {
return this._call.inputValues[1].value.toAddress();
}
}
export class ConstructorCall__Outputs {
_call: ConstructorCall;
constructor(call: ConstructorCall) {
this._call = call;
}
}
export class CastCall extends ethereum.Call {
get inputs(): CastCall__Inputs {
return new CastCall__Inputs(this);
}
get outputs(): CastCall__Outputs {
return new CastCall__Outputs(this);
}
}
export class CastCall__Inputs {
_call: CastCall;
constructor(call: CastCall) {
this._call = call;
}
get _targetNames(): Array<string> {
return this._call.inputValues[0].value.toStringArray();
}
get _datas(): Array<Bytes> {
return this._call.inputValues[1].value.toBytesArray();
}
get _origin(): Address {
return this._call.inputValues[2].value.toAddress();
}
}
export class CastCall__Outputs {
_call: CastCall;
constructor(call: CastCall) {
this._call = call;
}
get value0(): Bytes {
return this._call.outputValues[0].value.toBytes();
}
}
export class Constructor1Call extends ethereum.Call {
get inputs(): Constructor1Call__Inputs {
return new Constructor1Call__Inputs(this);
}
get outputs(): Constructor1Call__Outputs {
return new Constructor1Call__Outputs(this);
}
}
export class Constructor1Call__Inputs {
_call: Constructor1Call;
constructor(call: Constructor1Call) {
this._call = call;
}
get _instaIndex(): Address {
return this._call.inputValues[0].value.toAddress();
}
}
export class Constructor1Call__Outputs {
_call: Constructor1Call;
constructor(call: Constructor1Call) {
this._call = call;
}
}
export class Cast1Call extends ethereum.Call {
get inputs(): Cast1Call__Inputs {
return new Cast1Call__Inputs(this);
}
get outputs(): Cast1Call__Outputs {
return new Cast1Call__Outputs(this);
}
}
export class Cast1Call__Inputs {
_call: Cast1Call;
constructor(call: Cast1Call) {
this._call = call;
}
get _targets(): Array<Address> {
return this._call.inputValues[0].value.toAddressArray();
}
get _datas(): Array<Bytes> {
return this._call.inputValues[1].value.toBytesArray();
}
get _origin(): Address {
return this._call.inputValues[2].value.toAddress();
}
}
export class Cast1Call__Outputs {
_call: Cast1Call;
constructor(call: Cast1Call) {
this._call = call;
}
}
export class DisableCall extends ethereum.Call {
get inputs(): DisableCall__Inputs {
return new DisableCall__Inputs(this);
}
get outputs(): DisableCall__Outputs {
return new DisableCall__Outputs(this);
}
}
export class DisableCall__Inputs {
_call: DisableCall;
constructor(call: DisableCall) {
this._call = call;
}
get user(): Address {
return this._call.inputValues[0].value.toAddress();
}
}
export class DisableCall__Outputs {
_call: DisableCall;
constructor(call: DisableCall) {
this._call = call;
}
}
export class EnableCall extends ethereum.Call {
get inputs(): EnableCall__Inputs {
return new EnableCall__Inputs(this);
}
get outputs(): EnableCall__Outputs {
return new EnableCall__Outputs(this);
}
}
export class EnableCall__Inputs {
_call: EnableCall;
constructor(call: EnableCall) {
this._call = call;
}
get user(): Address {
return this._call.inputValues[0].value.toAddress();
}
}
export class EnableCall__Outputs {
_call: EnableCall;
constructor(call: EnableCall) {
this._call = call;
}
}
export class SwitchShieldCall extends ethereum.Call {
get inputs(): SwitchShieldCall__Inputs {
return new SwitchShieldCall__Inputs(this);
}
get outputs(): SwitchShieldCall__Outputs {
return new SwitchShieldCall__Outputs(this);
}
}
export class SwitchShieldCall__Inputs {
_call: SwitchShieldCall;
constructor(call: SwitchShieldCall) {
this._call = call;
}
get _shield(): boolean {
return this._call.inputValues[0].value.toBoolean();
}
}
export class SwitchShieldCall__Outputs {
_call: SwitchShieldCall;
constructor(call: SwitchShieldCall) {
this._call = call;
}
}

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;
}
}

249
generated/schema.ts Normal file
View File

@ -0,0 +1,249 @@
// 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 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 version(): BigInt {
let value = this.get("version");
return value!.toBigInt();
}
set version(value: BigInt) {
this.set("version", Value.fromBigInt(value));
}
get accountID(): BigInt {
let value = this.get("accountID");
return value!.toBigInt();
}
set accountID(value: BigInt) {
this.set("accountID", Value.fromBigInt(value));
}
get address(): Bytes {
let value = this.get("address");
return value!.toBytes();
}
set address(value: Bytes) {
this.set("address", Value.fromBytes(value));
}
get creator(): Bytes {
let value = this.get("creator");
return value!.toBytes();
}
set creator(value: Bytes) {
this.set("creator", Value.fromBytes(value));
}
get transactionsCount(): BigInt {
let value = this.get("transactionsCount");
return value!.toBigInt();
}
set transactionsCount(value: BigInt) {
this.set("transactionsCount", Value.fromBigInt(value));
}
get approvals(): Array<string> {
let value = this.get("approvals");
return value!.toStringArray();
}
set approvals(value: Array<string>) {
this.set("approvals", Value.fromStringArray(value));
}
}
export class ApprovalEvent extends Entity {
constructor(id: string) {
super();
this.set("id", Value.fromString(id));
}
save(): void {
let id = this.get("id");
assert(id != null, "Cannot save ApprovalEvent entity without an ID");
if (id) {
assert(
id.kind == ValueKind.STRING,
`Entities of type ApprovalEvent must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`
);
store.set("ApprovalEvent", id.toString(), this);
}
}
static load(id: string): ApprovalEvent | null {
return changetype<ApprovalEvent | null>(store.get("ApprovalEvent", id));
}
get id(): string {
let value = this.get("id");
return value!.toString();
}
set id(value: string) {
this.set("id", Value.fromString(value));
}
get token(): string {
let value = this.get("token");
return value!.toString();
}
set token(value: string) {
this.set("token", Value.fromString(value));
}
get from(): Bytes {
let value = this.get("from");
return value!.toBytes();
}
set from(value: Bytes) {
this.set("from", Value.fromBytes(value));
}
get to(): Bytes {
let value = this.get("to");
return value!.toBytes();
}
set to(value: Bytes) {
this.set("to", Value.fromBytes(value));
}
get value(): BigInt {
let value = this.get("value");
return value!.toBigInt();
}
set value(value: BigInt) {
this.set("value", Value.fromBigInt(value));
}
}
export class Token extends Entity {
constructor(id: string) {
super();
this.set("id", Value.fromString(id));
}
save(): void {
let id = this.get("id");
assert(id != null, "Cannot save Token entity without an ID");
if (id) {
assert(
id.kind == ValueKind.STRING,
`Entities of type Token must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`
);
store.set("Token", id.toString(), this);
}
}
static load(id: string): Token | null {
return changetype<Token | null>(store.get("Token", id));
}
get id(): string {
let value = this.get("id");
return value!.toString();
}
set id(value: string) {
this.set("id", Value.fromString(value));
}
get name(): string | null {
let value = this.get("name");
if (!value || value.kind == ValueKind.NULL) {
return null;
} else {
return value.toString();
}
}
set name(value: string | null) {
if (!value) {
this.unset("name");
} else {
this.set("name", Value.fromString(<string>value));
}
}
get symbol(): string | null {
let value = this.get("symbol");
if (!value || value.kind == ValueKind.NULL) {
return null;
} else {
return value.toString();
}
}
set symbol(value: string | null) {
if (!value) {
this.unset("symbol");
} else {
this.set("symbol", Value.fromString(<string>value));
}
}
get decimals(): BigInt | null {
let value = this.get("decimals");
if (!value || value.kind == ValueKind.NULL) {
return null;
} else {
return value.toBigInt();
}
}
set decimals(value: BigInt | null) {
if (!value) {
this.unset("decimals");
} else {
this.set("decimals", Value.fromBigInt(<BigInt>value));
}
}
}

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

@ -1,7 +1,56 @@
{
"mainnet": {
"undefined": {
"address": "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723"
"InstaIndex": {
"address": "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723",
"startBlock": 9747200
},
"ERC20": {
"startBlock": 9747200
}
},
"matic": {
"InstaIndex": {
"address": "0xA9B99766E6C676Cf1975c0D3166F96C0848fF5ad",
"startBlock": 12795200
},
"ERC20": {
"startBlock": 12795200
}
},
"avalanche": {
"InstaIndex": {
"address": "0x6CE3e607C808b4f4C26B7F6aDAeB619e49CAbb25",
"startBlock": 4872966
},
"ERC20": {
"startBlock": 4872966
}
},
"arbitrum-one": {
"InstaIndex": {
"address": "0x1eE00C305C51Ff3bE60162456A9B533C07cD9288",
"startBlock": 337405
},
"ERC20": {
"startBlock": 337405
}
},
"optimism": {
"InstaIndex": {
"address": "0x6CE3e607C808b4f4C26B7F6aDAeB619e49CAbb25",
"startBlock": 2283221
},
"ERC20": {
"startBlock": 2283221
}
},
"fantom": {
"InstaIndex": {
"address": "0x2fa042BEEB7A40A7078EaA5aC755e3842248292b",
"startBlock": 16816788
},
"ERC20": {
"startBlock": 16816788
}
}
}

View File

@ -1,6 +1,30 @@
type ExampleEntity @entity {
type Account @entity {
id: ID!
count: BigInt!
sender: Bytes! # address
owner: Bytes! # address
version: BigInt!
accountID: BigInt!
# Smart account address
address: Bytes!
# Address of the DSA creator
creator: Bytes!
# Total transactions of the DSA
transactionsCount: BigInt!
# Cast event data
approvals: [ApprovalEvent!]!
}
type ApprovalEvent @entity {
id: ID!
token: Token!
from: Bytes!
# to or the spender address
to: Bytes!
# value approved or transaferred
value: BigInt!
}
type Token @entity {
id: ID!
name: String
symbol: String
decimals: BigInt
}

90
src/erc20.ts Normal file
View File

@ -0,0 +1,90 @@
import {
Address,
BigInt,
Bytes,
dataSource,
ethereum,
log,
} from "@graphprotocol/graph-ts";
import { Approval, ERC20, Transfer } from "../generated/ERC20/ERC20";
import {
Account,
ApprovalEvent,
Token
} from "../generated/schema";
import {
createOrLoadDsa,
ZERO,
} from "./insta-index";
export function handleApproval(event: Approval): void {
let token = createOrLoadToken(event);
let accountFrom = Account.load(event.params.owner.toHexString());
let accountTo = Account.load(event.params.spender.toHexString());
if (accountFrom != null || accountTo != null) {
let approvalId =
event.transaction.hash.toHexString() +
event.logIndex.toString();
let approvals = createOrLoadApprovalEvent(approvalId);
approvals.token = token.id;
approvals.from = event.params.owner;
approvals.to = event.params.spender;
approvals.value = event.params.value;
if (accountFrom != null) {
let approvalEvents = accountFrom.approvals;
let index = approvalEvents.indexOf(approvals.id);
if (index == -1) {
approvalEvents.push(approvals.id);
accountFrom.transactionsCount = BigInt.fromI32(approvalEvents.length);
} else {
approvalEvents[index] = approvals.id;
}
accountFrom.approvals = approvalEvents;
accountFrom.save();
}
if (accountTo != null) {
let approvalEvents = accountTo.approvals;
let index = approvalEvents.indexOf(approvals.id);
if (index == -1) {
approvalEvents.push(approvals.id);
accountTo.transactionsCount = BigInt.fromI32(approvalEvents.length);
} else {
approvalEvents[index] = approvals.id;
}
accountTo.approvals = approvalEvents;
accountTo.save();
}
}
token.save();
}
export function createOrLoadToken(event: ethereum.Event): Token {
let token = Token.load(event.address.toHex());
if (token == null) {
let erc20 = ERC20.bind(event.address);
token = new Token(event.address.toHex());
let _name = erc20.try_name();
token.name = _name.reverted ? "" : erc20.name();
let _symbol = erc20.try_symbol();
token.symbol = _symbol.reverted ? "" : erc20.symbol();
let _decimal = erc20.try_decimals();
token.decimals = _decimal.reverted ? new BigInt(0) : erc20.decimals();
token.save();
}
return token;
}
export function createOrLoadApprovalEvent(id: string): ApprovalEvent {
let approvalEvent = ApprovalEvent.load(id);
if (approvalEvent == null) {
approvalEvent = new ApprovalEvent(id);
}
return approvalEvent;
}

View File

@ -1,67 +1,49 @@
import { BigInt } from "@graphprotocol/graph-ts"
import {
Address,
BigInt,
Bytes,
DataSourceContext,
} from "@graphprotocol/graph-ts";
import {
InstaIndex,
LogAccountCreated,
LogNewAccount,
LogNewCheck,
LogNewMaster,
LogUpdateMaster
} from "../generated/InstaIndex/InstaIndex"
import { ExampleEntity } from "../generated/schema"
LogNewAccount
} from "../generated/undefined/InstaIndex";
import { Account } from "../generated/schema";
import { InstaAccount } from "../generated/InstaIndex/InstaAccount";
import { InstaList } from "../generated/InstaIndex/InstaList";
export const COUNT_ID = "all";
export const ZERO = new BigInt(0);
export function handleLogAccountCreated(event: LogAccountCreated): 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())
// event LogAccountCreated(address sender, address indexed owner, address indexed account, address indexed origin);
let contract = InstaIndex.bind(event.address);
let instaAccount = InstaAccount.bind(event.params.account);
let instaList = InstaList.bind(contract.list());
let accountId = instaList.accountID(event.params.account);
if (instaAccount.version() == BigInt.fromI32(2)) {
let dsa = createOrLoadDsa(event.params.account.toHexString());
// 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())
dsa.creator = event.params.owner;
dsa.address = event.params.account;
dsa.version = instaAccount.version();
dsa.accountID = accountId;
// Entity fields can be set using simple assignments
entity.count = BigInt.fromI32(0)
dsa.save();
}
// BigInt and BigDecimal math are supported
entity.count = entity.count + BigInt.fromI32(1)
// Entity fields can be set based on event parameters
entity.sender = event.params.sender
entity.owner = event.params.owner
// 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.account(...)
// - contract.build(...)
// - contract.check(...)
// - contract.connectors(...)
// - contract.isClone(...)
// - contract.list(...)
// - contract.master(...)
// - contract.versionCount(...)
}
export function handleLogNewAccount(event: LogNewAccount): void {}
export function handleLogNewCheck(event: LogNewCheck): void {}
export function handleLogNewMaster(event: LogNewMaster): void {}
export function handleLogUpdateMaster(event: LogUpdateMaster): void {}
//loads or creates smart account
export function createOrLoadDsa(id: string): Account {
let account = Account.load(id);
if (account == null) {
account = new Account(id);
account.version = ZERO;
account.address = new Address(0);
account.creator = new Address(0);
account.transactionsCount = ZERO;
account.approvals = [];
}
return account;
}

View File

@ -1,35 +1,51 @@
specVersion: 0.0.1
specVersion: 0.0.5
schema:
file: ./schema.graphql
dataSources:
- kind: ethereum
name: undefined
network: mainnet
name: InstaIndex
network: arbitrum-one
source:
address: "0x2971AdFa57b20E5a416aE5a708A8655A9c74f723"
abi: InstaIndex
address: "0x1eE00C305C51Ff3bE60162456A9B533C07cD9288"
startBlock: 337405
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
entities:
- LogAccountCreated
- LogNewAccount
- LogNewCheck
- LogNewMaster
- LogUpdateMaster
- Account
- ApprovalEvent
- Token
abis:
- name: InstaIndex
file: ./abis/InstaIndex.json
- name: InstaList
file: ./abis/InstaList.json
- name: InstaAccount
file: ./abis/InstaAccount.json
eventHandlers:
- event: LogAccountCreated(address,indexed address,indexed address,indexed address)
- event: LogAccountCreated(address,indexed address,indexed address,indexed
address)
handler: handleLogAccountCreated
- event: LogNewAccount(indexed address,indexed address,indexed address)
handler: handleLogNewAccount
- event: LogNewCheck(indexed uint256,indexed address)
handler: handleLogNewCheck
- event: LogNewMaster(indexed address)
handler: handleLogNewMaster
- event: LogUpdateMaster(indexed address)
handler: handleLogUpdateMaster
file: ./src/insta-index.ts
- kind: ethereum/contract
name: ERC20
network: arbitrum-one
source:
abi: ERC20
startBlock: 337405
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
entities:
- ApprovalEvent
- Token
abis:
- name: ERC20
file: ./abis/ERC20.json
eventHandlers:
- event: Approval(indexed address,indexed address,uint256)
handler: handleApproval
file: ./src/erc20.ts

3373
yarn.lock Normal file

File diff suppressed because it is too large Load Diff