Skip to content

Commit

Permalink
correct seismic fork-base to aave-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruv-chauhan committed Jun 13, 2024
1 parent 0481098 commit f3b3d51
Show file tree
Hide file tree
Showing 4 changed files with 357 additions and 453 deletions.
2 changes: 1 addition & 1 deletion subgraphs/aave-forks/protocols/seismic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ Contracts for:
- [StableDebtToken](https://blastscan.io/address/0x226033e18e87852C5C8721C6a62D7cEdD55D810d#code)
- [VariableDebtToken](https://blastscan.io/address/0xe7A8225eB6F923482972fFC53851D3aC053c7e98#code)

are not verified on blastscan, hence using Aave-V3's abis for them instead.
are not verified on blastscan, hence using Aave-V2's abis for them instead.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dataSources:
- name: LendingPoolAddressesProvider
file: ./abis/seismic/LendingPoolAddressesProvider.json
eventHandlers:
- event: PriceOracleUpdated(indexed address,indexed address)
- event: PriceOracleUpdated(indexed address)
handler: handlePriceOracleUpdated
file: ./protocols/seismic/src/mapping.ts
- kind: ethereum/contract
Expand All @@ -46,39 +46,33 @@ dataSources:
entities:
- Market
abis:
- name: AToken
file: ./abis/aave-v2/AToken.json
- name: LendingPoolConfigurator
file: ./abis/seismic/LendingPoolConfigurator.json
- name: LendingPool
file: ./abis/seismic/LendingPool.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)
- event: CollateralConfigurationChanged(indexed address,uint256,uint256,uint256)
handler: handleCollateralConfigurationChanged
- event: BorrowingEnabledOnReserve(indexed address,bool)
handler: handleBorrowingEnabledOnReserve
- event: BorrowingDisabledOnReserve(indexed address)
handler: handleBorrowingDisabledOnReserve
- event: ReserveActivated(indexed address)
handler: handleReserveActivated
- event: ReserveDeactivated(indexed address)
handler: handleReserveDeactivated
- event: ReserveFactorChanged(indexed address,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/seismic/src/mapping.ts
- kind: ethereum/contract
name: LendingPool
Expand All @@ -99,6 +93,16 @@ dataSources:
- Borrow
- Liquidate
abis:
- name: AaveIncentivesController
file: ./abis/aave-v2/AaveIncentivesController.json
- name: StakedAave
file: ./abis/aave-v2/StakedAave.json
- name: AToken
file: ./abis/aave-v2/AToken.json
- name: VariableDebtToken
file: ./abis/VariableDebtToken.json
- name: StableDebtToken
file: ./abis/StableDebtToken.json
- name: LendingPool
file: ./abis/seismic/LendingPool.json
- name: ERC20
Expand All @@ -107,44 +111,34 @@ dataSources:
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)
- event: Deposit(indexed address,address,indexed address,uint256,indexed uint16)
handler: handleDeposit
- event: Withdraw(indexed address,indexed address,indexed address,uint256)
handler: handleWithdraw
- event: Borrow(indexed address,address,indexed address,uint256,uint256,uint256,indexed uint16)
handler: handleBorrow
- event: Repay(indexed address,indexed address,indexed address,uint256)
handler: handleRepay
receipt: true
- event: Swap(indexed address,indexed address,uint256)
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: SwapBorrowRateMode(indexed address,indexed address,uint8)
handler: handleSwapBorrowRateMode
- event: ReserveDataUpdated(indexed address,uint256,uint256,uint256,uint256,uint256)
handler: handleReserveDataUpdated
- 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)
- event: Paused()
handler: handlePaused
- event: Unpaused()
handler: handleUnpaused
- event: FlashLoan(indexed address,indexed address,indexed address,uint256,uint256,uint16)
handler: handleFlashloan
- event: UserEModeSet(indexed address,uint8)
handler: handleUserEModeSet
- event: MintedToTreasury(indexed address,uint256)
handler: handleMintedToTreasury
file: ./protocols/seismic/src/mapping.ts
templates:
- kind: ethereum
Expand All @@ -159,13 +153,12 @@ templates:
entities: []
abis:
- name: AToken
file: ./abis/aave-v3/AToken.json
file: ./abis/aave-v2/AToken.json
- name: ERC20
file: ./abis/ERC20.json
eventHandlers:
- event: Transfer(indexed address,indexed address,uint256)
- event: BalanceTransfer(indexed address,indexed address,uint256,uint256)
handler: handleCollateralTransfer
receipt: true
file: ./protocols/seismic/src/mapping.ts
- kind: ethereum
name: StableDebtToken
Expand All @@ -179,7 +172,7 @@ templates:
entities: []
abis:
- name: StableDebtToken
file: ./abis/aave-v3/StableDebtToken.json
file: ./abis/StableDebtToken.json
- name: ERC20
file: ./abis/ERC20.json
eventHandlers:
Expand All @@ -198,7 +191,7 @@ templates:
entities: []
abis:
- name: VariableDebtToken
file: ./abis/aave-v3/VariableDebtToken.json
file: ./abis/VariableDebtToken.json
- name: ERC20
file: ./abis/ERC20.json
eventHandlers:
Expand Down
39 changes: 13 additions & 26 deletions subgraphs/aave-forks/protocols/seismic/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import {
Address,
ByteArray,
crypto,
dataSource,
log,
} from "@graphprotocol/graph-ts";
import { Address, BigDecimal, dataSource, log } from "@graphprotocol/graph-ts";
import { Network, ZERO_ADDRESS } from "../../../src/constants";

//////////////////////////////
///// Ethereum Addresses /////
//////////////////////////////

export const USDC_TOKEN_ADDRESS = "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; // ETH
export const USDC_POS_TOKEN_ADDRESS =
"0x2791bca1f2de4661ed88a30c99a7a9449aa84174"; // Polygon

/////////////////////////////
///// Protocol Specific /////
/////////////////////////////
Expand All @@ -16,29 +18,19 @@ export namespace Protocol {
export const NAME = "Seismic Protocol";
export const SLUG = "seismic";
}

export namespace IavsTokenType {
export const ATOKEN = "ATOKEN";
export const INPUTTOKEN = "INPUTTOKEN";
export const VTOKEN = "VTOKEN";
export const STOKEN = "STOKEN";
}

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;
}
// This is hardcoded and can not be changed, so it is set as a constant here
// https://etherscan.io/address/0x05bfa9157e92690b179033ca2f6dd1e86b25ea4d#code#F96#L89
export const FLASHLOAN_PREMIUM_TOTAL = BigDecimal.fromString("0.0009"); // = 9/10000

////////////////////////////
///// Network Specific /////
////////////////////////////

export class NetworkSpecificConstant {
constructor(
public readonly protocolAddress: Address, // aka, PoolAddressesProviderRegistry
public readonly protocolAddress: Address, // aka, LendingPoolAddressesProvider
public readonly network: string
) {}
}
Expand All @@ -61,8 +53,3 @@ export function getNetworkSpecificConstant(): NetworkSpecificConstant {
export function equalsIgnoreCase(a: string, b: string): boolean {
return a.replace("-", "_").toLowerCase() == b.replace("-", "_").toLowerCase();
}

export const BALANCE_TRANSFER_SIGNATURE = crypto.keccak256(
ByteArray.fromUTF8("BalanceTransfer(address,address,uint256,uint256)")
);
export const BALANCE_TRANSFER_DATA_TYPE = "(uint256,uint256)";
Loading

0 comments on commit f3b3d51

Please sign in to comment.