DeFi Smart Accounts (DSA) aim to make the DeFi ecosystem much more accessible to end users, by simplifying processes and unifying multiple DeFi platforms with a single account.
The goal of this subgraph is to make developers get an easier access to the DSA data, such as Smart Accounts, Account Modules, Connectors and more.
Below is a general description of the entities we store. We tried to make it as similar to the underlying structures of the DSA contracts, but also making it easier for GraphQL queries to link entities together so that some query optimizations could be done.
The SmartAccount entity holds the address and ID of the SmartAccount, the owner and creator address for that SmartAccount, as well as the AccountModule used as a template for the account (which also holds the connectors that the account has, since it was cloned from that module), the shield status, whether the current owner is enabled for authentication or not, and all the events both withing the account scope (modifications to the shield status, disabling and enabling of the owner, and casts), and events within the scope of connectors that the account interacted using casts.
The InstaIndex is the main contract of the DSA ecosystem. It allows us to track AccountModule creation, SmartAccount creation, as well as changes to the master of said contract. We currently track an InstaIndex entity since we wanted to keep track of the InstaList contract address and the current master for the contract, as well as the AccountModules currently listed on the index.
The AccountModule is basically a template used to clone SmartAccounts from. It has links to an InstaConnectors contract, which holds the connectors list for said account, as well as some other underlying data such as the check.
InstaConnector entity tracks the InstaConnectors contract (name change was required, since a single entity should not be plural). We decided to keep this entity instead of just using a list of connectors on the AccountModule entity, so that we could still keep track of the chief/admin of the InstaConnectors contract.
```graphql
type InstaConnector @entity {
"Address of the InstaConnector contract. This contract has a list of connectors tracked."
Connectors are the part of the DSA ecosystem that allows SmartAccounts to interact with external DeFi platforms in a seamless manner. They are contracts specific for each platform but they all have some basic interface in common. We currently track as much generic data as possible, including the specific events for each connector, but stored as raw bytes in the ConnectorEvent entity.
This entity represents a single connector-specific event, as emitted on the InstaEvents contract (raw bytes). It has an eventCode (keccak256 hash of the event signature), as well as the eventData bytes and links to both the SmartAccount that casted it and the Connector that triggered the event.