-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fd25a9b
commit 8257a9b
Showing
8 changed files
with
1,090 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
...ks/protocols/superlend/config/deployments/superlend-etherlink-mainnet/configurations.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"network": "etherlink-mainnet", | ||
"factory": { | ||
"address": "0x5ccf60c7e10547c5389e9cbff543e5d0db9f4fec", | ||
"startBlock": 3283856 | ||
}, | ||
"lendingPoolConfigurator": { | ||
"address": "0x30f6880bb1cf780a49eb4ef64e64585780aae060", | ||
"startBlock": 3283856 | ||
}, | ||
"LendingPool": { | ||
"address": "0x3bd16d195786fb2f509f2e2d7f69920262ef114d", | ||
"startBlock": 3283856 | ||
}, | ||
"graftEnabled": false, | ||
"subgraphId": "", | ||
"graftStartBlock": 0 | ||
} |
199 changes: 199 additions & 0 deletions
199
subgraphs/aave-forks/protocols/superlend/config/templates/superlend.template.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
specVersion: 1.0.0 | ||
schema: | ||
file: ./schema.graphql | ||
indexerHints: | ||
prune: auto | ||
{{#graftEnabled}} | ||
description: ... | ||
features: | ||
- grafting | ||
graft: | ||
base: {{subgraphId}} # Subgraph ID of base subgraph | ||
block: {{graftStartBlock}} # Block number | ||
{{/graftEnabled}} | ||
dataSources: | ||
- kind: ethereum | ||
name: LendingPoolAddressesProvider | ||
network: {{ network }} | ||
source: | ||
abi: LendingPoolAddressesProvider | ||
address: "{{ factory.address }}" | ||
startBlock: {{ factory.startBlock }} | ||
mapping: | ||
kind: ethereum/events | ||
apiVersion: 0.0.7 | ||
language: wasm/assemblyscript | ||
entities: [] | ||
abis: | ||
- name: LendingPoolAddressesProvider | ||
file: ./abis/aave-v3/LendingPoolAddressesProvider.json | ||
eventHandlers: | ||
- event: PriceOracleUpdated(indexed address,indexed address) | ||
handler: handlePriceOracleUpdated | ||
file: ./protocols/superlend/src/mapping.ts | ||
- kind: ethereum | ||
name: LendingPoolConfigurator | ||
network: {{ network }} | ||
source: | ||
abi: LendingPoolConfigurator | ||
address: "{{ lendingPoolConfigurator.address }}" | ||
startBlock: {{ lendingPoolConfigurator.startBlock }} | ||
mapping: | ||
kind: ethereum/events | ||
apiVersion: 0.0.7 | ||
language: wasm/assemblyscript | ||
entities: [] | ||
abis: | ||
- name: LendingPoolConfigurator | ||
file: ./abis/aave-v3/LendingPoolConfigurator.json | ||
- name: ERC20 | ||
file: ./abis/ERC20.json | ||
- name: ERC20NameBytes | ||
file: ./abis/ERC20NameBytes.json | ||
- name: ERC20SymbolBytes | ||
file: ./abis/ERC20SymbolBytes.json | ||
- name: AToken | ||
file: ./abis/aave-v3/AToken.json | ||
eventHandlers: | ||
- event: CollateralConfigurationChanged(indexed address,uint256,uint256,uint256) | ||
handler: handleCollateralConfigurationChanged | ||
- event: ReserveActive(indexed address,bool) | ||
handler: handleReserveActive | ||
- event: ReserveBorrowing(indexed address,bool) | ||
handler: handleReserveBorrowing | ||
- event: ReserveFrozen(indexed address,bool) | ||
handler: handleReserveFrozen | ||
- event: ReserveInitialized(indexed address,indexed address,address,address,address) | ||
handler: handleReserveInitialized | ||
- event: ReservePaused(indexed address,bool) | ||
handler: handleReservePaused | ||
- event: ReserveFactorChanged(indexed address,uint256,uint256) | ||
handler: handleReserveFactorChanged | ||
- event: LiquidationProtocolFeeChanged(indexed address,uint256,uint256) | ||
handler: handleLiquidationProtocolFeeChanged | ||
- event: FlashloanPremiumTotalUpdated(uint128,uint128) | ||
handler: handleFlashloanPremiumTotalUpdated | ||
- event: FlashloanPremiumToProtocolUpdated(uint128,uint128) | ||
handler: handleFlashloanPremiumToProtocolUpdated | ||
- event: SiloedBorrowingChanged(indexed address,bool,bool) | ||
handler: handleSiloedBorrowingChanged | ||
file: ./protocols/superlend/src/mapping.ts | ||
- kind: ethereum | ||
name: LendingPool | ||
network: {{ network }} | ||
source: | ||
abi: LendingPool | ||
address: "{{ LendingPool.address }}" | ||
startBlock: {{ LendingPool.startBlock }} | ||
mapping: | ||
kind: ethereum/events | ||
apiVersion: 0.0.7 | ||
language: wasm/assemblyscript | ||
entities: [] | ||
abis: | ||
- name: LendingPool | ||
file: ./abis/aave-v3/LendingPool.json | ||
- name: ERC20 | ||
file: ./abis/ERC20.json | ||
- name: ERC20NameBytes | ||
file: ./abis/ERC20NameBytes.json | ||
- name: ERC20SymbolBytes | ||
file: ./abis/ERC20SymbolBytes.json | ||
- name: AaveOracle | ||
file: ./abis/aave-v3/AaveOracle.json | ||
- name: IPriceOracleGetter | ||
file: ./abis/IPriceOracleGetter.json | ||
- name: AToken | ||
file: ./abis/aave-v3/AToken.json | ||
- name: StableDebtToken | ||
file: ./abis/aave-v3/StableDebtToken.json | ||
- name: VariableDebtToken | ||
file: ./abis/aave-v3/VariableDebtToken.json | ||
eventHandlers: | ||
- event: Borrow(indexed address,address,indexed address,uint256,uint8,uint256,indexed uint16) | ||
handler: handleBorrow | ||
- event: SwapBorrowRateMode(indexed address,indexed address,uint8) | ||
handler: handleSwapBorrowRateMode | ||
- event: LiquidationCall(indexed address,indexed address,indexed address,uint256,uint256,address,bool) | ||
handler: handleLiquidationCall | ||
receipt: true | ||
- event: Repay(indexed address,indexed address,indexed address,uint256,bool) | ||
handler: handleRepay | ||
receipt: true | ||
- event: ReserveDataUpdated(indexed address,uint256,uint256,uint256,uint256,uint256) | ||
handler: handleReserveDataUpdated | ||
receipt: true | ||
- event: Supply(indexed address,address,indexed address,uint256,indexed uint16) | ||
handler: handleDeposit | ||
- event: Withdraw(indexed address,indexed address,indexed address,uint256) | ||
handler: handleWithdraw | ||
- event: ReserveUsedAsCollateralEnabled(indexed address,indexed address) | ||
handler: handleReserveUsedAsCollateralEnabled | ||
- event: ReserveUsedAsCollateralDisabled(indexed address,indexed address) | ||
handler: handleReserveUsedAsCollateralDisabled | ||
- event: FlashLoan(indexed address,address,indexed address,uint256,uint8,uint256,indexed uint16) | ||
handler: handleFlashloan | ||
- event: UserEModeSet(indexed address,uint8) | ||
handler: handleUserEModeSet | ||
- event: MintedToTreasury(indexed address,uint256) | ||
handler: handleMintedToTreasury | ||
file: ./protocols/superlend/src/mapping.ts | ||
templates: | ||
- kind: ethereum | ||
name: AToken | ||
network: {{ network }} | ||
source: | ||
abi: AToken | ||
mapping: | ||
kind: ethereum/events | ||
apiVersion: 0.0.7 | ||
language: wasm/assemblyscript | ||
entities: [] | ||
abis: | ||
- name: AToken | ||
file: ./abis/aave-v3/AToken.json | ||
- name: ERC20 | ||
file: ./abis/ERC20.json | ||
eventHandlers: | ||
- event: Transfer(indexed address,indexed address,uint256) | ||
handler: handleCollateralTransfer | ||
receipt: true | ||
file: ./protocols/superlend/src/mapping.ts | ||
- kind: ethereum | ||
name: StableDebtToken | ||
network: {{ network }} | ||
source: | ||
abi: StableDebtToken | ||
mapping: | ||
kind: ethereum/events | ||
apiVersion: 0.0.7 | ||
language: wasm/assemblyscript | ||
entities: [] | ||
abis: | ||
- name: StableDebtToken | ||
file: ./abis/aave-v3/StableDebtToken.json | ||
- name: ERC20 | ||
file: ./abis/ERC20.json | ||
eventHandlers: | ||
- event: Transfer(indexed address,indexed address,uint256) | ||
handler: handleStableTransfer | ||
file: ./protocols/superlend/src/mapping.ts | ||
- kind: ethereum | ||
name: VariableDebtToken | ||
network: {{ network }} | ||
source: | ||
abi: VariableDebtToken | ||
mapping: | ||
kind: ethereum/events | ||
apiVersion: 0.0.7 | ||
language: wasm/assemblyscript | ||
entities: [] | ||
abis: | ||
- name: VariableDebtToken | ||
file: ./abis/aave-v3/VariableDebtToken.json | ||
- name: ERC20 | ||
file: ./abis/ERC20.json | ||
eventHandlers: | ||
- event: Transfer(indexed address,indexed address,uint256) | ||
handler: handleVariableTransfer | ||
file: ./protocols/superlend/src/mapping.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { | ||
Address, | ||
ByteArray, | ||
crypto, | ||
dataSource, | ||
log, | ||
} from "@graphprotocol/graph-ts"; | ||
import { Network, ZERO_ADDRESS } from "../../../src/constants"; | ||
|
||
/////////////////////////////// | ||
///// Etherlink Addresses ///// | ||
/////////////////////////////// | ||
|
||
export const USDC_TOKEN_ADDRESS = "0x796ea11fa2dd751ed01b53c372ffdb4aaa8f00f9"; | ||
|
||
///////////////////////////// | ||
///// Protocol Specific ///// | ||
///////////////////////////// | ||
|
||
export namespace Protocol { | ||
export const PROTOCOL = "Superlend"; | ||
export const NAME = "Superlend v3"; | ||
export const SLUG = "superlend-v3"; | ||
} | ||
|
||
export const AAVE_DECIMALS = 8; | ||
|
||
export namespace InterestRateMode { | ||
export const NONE = 0 as i32; | ||
export const STABLE = 1 as i32; | ||
export const VARIABLE = 2 as i32; | ||
} | ||
|
||
//////////////////////////// | ||
///// Network Specific ///// | ||
//////////////////////////// | ||
|
||
export class NetworkSpecificConstant { | ||
constructor( | ||
public readonly protocolAddress: Address, // aka, PoolAddressesProviderRegistry | ||
public readonly network: string | ||
) {} | ||
} | ||
|
||
export function getNetworkSpecificConstant(): NetworkSpecificConstant { | ||
const network = dataSource.network(); | ||
if (equalsIgnoreCase(network, Network.ETHERLINK_MAINNET)) { | ||
return new NetworkSpecificConstant( | ||
Address.fromString("0xa5cf001755d54e5e84a45757e1637f29f0a19f2f"), | ||
Network.ETHERLINK_MAINNET | ||
); | ||
} else { | ||
log.error("[getNetworkSpecificConstant] Unsupported network: {}", [ | ||
network, | ||
]); | ||
return new NetworkSpecificConstant(Address.fromString(ZERO_ADDRESS), ""); | ||
} | ||
} | ||
|
||
export function equalsIgnoreCase(a: string, b: string): boolean { | ||
return a.replace("-", "_").toLowerCase() == b.replace("-", "_").toLowerCase(); | ||
} | ||
|
||
// Context keys | ||
export const PROTOCOL_ID_KEY = "protocolId"; | ||
export const POOL_ADDRESSES_PROVIDER_ID_KEY = "poolAddressesProviderId"; | ||
|
||
export const BALANCE_TRANSFER_SIGNATURE = crypto.keccak256( | ||
ByteArray.fromUTF8("BalanceTransfer(address,address,uint256,uint256)") | ||
); | ||
export const BALANCE_TRANSFER_DATA_TYPE = "(uint256,uint256)"; |
Oops, something went wrong.