mirror of
				https://github.com/Instadapp/compound-dsa-managers.git
				synced 2024-07-29 21:48:19 +00:00 
			
		
		
		
	Initial commit
This commit is contained in:
		
						commit
						fd68056446
					
				
							
								
								
									
										116
									
								
								abis/cUSDCv3.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										116
									
								
								abis/cUSDCv3.json
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,116 @@ | ||||||
|  | [ | ||||||
|  |   { | ||||||
|  |     "inputs": [ | ||||||
|  |       { "internalType": "address", "name": "_logic", "type": "address" }, | ||||||
|  |       { "internalType": "address", "name": "admin_", "type": "address" }, | ||||||
|  |       { "internalType": "bytes", "name": "_data", "type": "bytes" } | ||||||
|  |     ], | ||||||
|  |     "stateMutability": "payable", | ||||||
|  |     "type": "constructor" | ||||||
|  |   }, | ||||||
|  |   { | ||||||
|  |     "anonymous": false, | ||||||
|  |     "inputs": [ | ||||||
|  |       { | ||||||
|  |         "indexed": false, | ||||||
|  |         "internalType": "address", | ||||||
|  |         "name": "previousAdmin", | ||||||
|  |         "type": "address" | ||||||
|  |       }, | ||||||
|  |       { | ||||||
|  |         "indexed": false, | ||||||
|  |         "internalType": "address", | ||||||
|  |         "name": "newAdmin", | ||||||
|  |         "type": "address" | ||||||
|  |       } | ||||||
|  |     ], | ||||||
|  |     "name": "AdminChanged", | ||||||
|  |     "type": "event" | ||||||
|  |   }, | ||||||
|  |   { | ||||||
|  |     "anonymous": false, | ||||||
|  |     "inputs": [ | ||||||
|  |       { | ||||||
|  |         "indexed": true, | ||||||
|  |         "internalType": "address", | ||||||
|  |         "name": "beacon", | ||||||
|  |         "type": "address" | ||||||
|  |       } | ||||||
|  |     ], | ||||||
|  |     "name": "BeaconUpgraded", | ||||||
|  |     "type": "event" | ||||||
|  |   }, | ||||||
|  |   { | ||||||
|  |     "anonymous": false, | ||||||
|  |     "inputs": [ | ||||||
|  |       { | ||||||
|  |         "indexed": true, | ||||||
|  |         "internalType": "address", | ||||||
|  |         "name": "implementation", | ||||||
|  |         "type": "address" | ||||||
|  |       } | ||||||
|  |     ], | ||||||
|  |     "name": "Upgraded", | ||||||
|  |     "type": "event" | ||||||
|  |   }, | ||||||
|  |   { "stateMutability": "payable", "type": "fallback" }, | ||||||
|  |   { | ||||||
|  |     "inputs": [], | ||||||
|  |     "name": "admin", | ||||||
|  |     "outputs": [ | ||||||
|  |       { "internalType": "address", "name": "admin_", "type": "address" } | ||||||
|  |     ], | ||||||
|  |     "stateMutability": "nonpayable", | ||||||
|  |     "type": "function" | ||||||
|  |   }, | ||||||
|  |   { | ||||||
|  |     "inputs": [ | ||||||
|  |       { "internalType": "address", "name": "newAdmin", "type": "address" } | ||||||
|  |     ], | ||||||
|  |     "name": "changeAdmin", | ||||||
|  |     "outputs": [], | ||||||
|  |     "stateMutability": "nonpayable", | ||||||
|  |     "type": "function" | ||||||
|  |   }, | ||||||
|  |   { | ||||||
|  |     "inputs": [], | ||||||
|  |     "name": "implementation", | ||||||
|  |     "outputs": [ | ||||||
|  |       { | ||||||
|  |         "internalType": "address", | ||||||
|  |         "name": "implementation_", | ||||||
|  |         "type": "address" | ||||||
|  |       } | ||||||
|  |     ], | ||||||
|  |     "stateMutability": "nonpayable", | ||||||
|  |     "type": "function" | ||||||
|  |   }, | ||||||
|  |   { | ||||||
|  |     "inputs": [ | ||||||
|  |       { | ||||||
|  |         "internalType": "address", | ||||||
|  |         "name": "newImplementation", | ||||||
|  |         "type": "address" | ||||||
|  |       } | ||||||
|  |     ], | ||||||
|  |     "name": "upgradeTo", | ||||||
|  |     "outputs": [], | ||||||
|  |     "stateMutability": "nonpayable", | ||||||
|  |     "type": "function" | ||||||
|  |   }, | ||||||
|  |   { | ||||||
|  |     "inputs": [ | ||||||
|  |       { | ||||||
|  |         "internalType": "address", | ||||||
|  |         "name": "newImplementation", | ||||||
|  |         "type": "address" | ||||||
|  |       }, | ||||||
|  |       { "internalType": "bytes", "name": "data", "type": "bytes" } | ||||||
|  |     ], | ||||||
|  |     "name": "upgradeToAndCall", | ||||||
|  |     "outputs": [], | ||||||
|  |     "stateMutability": "payable", | ||||||
|  |     "type": "function" | ||||||
|  |   }, | ||||||
|  |   { "stateMutability": "payable", "type": "receive" } | ||||||
|  | ] | ||||||
							
								
								
									
										7
									
								
								networks.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								networks.json
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,7 @@ | ||||||
|  | { | ||||||
|  |   "mainnet": { | ||||||
|  |     "undefined": { | ||||||
|  |       "address": "0xc3d688B66703497DAA19211EEdff47f25384cdc3" | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										16
									
								
								package.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								package.json
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,16 @@ | ||||||
|  | { | ||||||
|  |   "name": "dsa-compound-v3-managers", | ||||||
|  |   "license": "UNLICENSED", | ||||||
|  |   "scripts": { | ||||||
|  |     "codegen": "graph codegen", | ||||||
|  |     "build": "graph build", | ||||||
|  |     "deploy": "graph deploy --node https://api.thegraph.com/deploy/ richa-iitr/dsa-compound-v3-managers", | ||||||
|  |     "create-local": "graph create --node http://localhost:8020/ richa-iitr/dsa-compound-v3-managers", | ||||||
|  |     "remove-local": "graph remove --node http://localhost:8020/ richa-iitr/dsa-compound-v3-managers", | ||||||
|  |     "deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 richa-iitr/dsa-compound-v3-managers" | ||||||
|  |   }, | ||||||
|  |   "dependencies": { | ||||||
|  |     "@graphprotocol/graph-cli": "0.30.0", | ||||||
|  |     "@graphprotocol/graph-ts": "0.27.0" | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										6
									
								
								schema.graphql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								schema.graphql
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,6 @@ | ||||||
|  | type ExampleEntity @entity { | ||||||
|  |   id: ID! | ||||||
|  |   count: BigInt! | ||||||
|  |   previousAdmin: Bytes! # address | ||||||
|  |   newAdmin: Bytes! # address | ||||||
|  | } | ||||||
							
								
								
									
										55
									
								
								src/c-usd-cv-3.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								src/c-usd-cv-3.ts
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,55 @@ | ||||||
|  | import { BigInt } from "@graphprotocol/graph-ts" | ||||||
|  | import { | ||||||
|  |   cUSDCv3, | ||||||
|  |   AdminChanged, | ||||||
|  |   BeaconUpgraded, | ||||||
|  |   Upgraded | ||||||
|  | } from "../generated/cUSDCv3/cUSDCv3" | ||||||
|  | import { ExampleEntity } from "../generated/schema" | ||||||
|  | 
 | ||||||
|  | export function handleAdminChanged(event: AdminChanged): 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()) | ||||||
|  | 
 | ||||||
|  |   // 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()) | ||||||
|  | 
 | ||||||
|  |     // Entity fields can be set using simple assignments
 | ||||||
|  |     entity.count = BigInt.fromI32(0) | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   // BigInt and BigDecimal math are supported
 | ||||||
|  |   entity.count = entity.count + BigInt.fromI32(1) | ||||||
|  | 
 | ||||||
|  |   // Entity fields can be set based on event parameters
 | ||||||
|  |   entity.previousAdmin = event.params.previousAdmin | ||||||
|  |   entity.newAdmin = event.params.newAdmin | ||||||
|  | 
 | ||||||
|  |   // 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.admin(...)
 | ||||||
|  |   // - contract.implementation(...)
 | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | export function handleBeaconUpgraded(event: BeaconUpgraded): void {} | ||||||
|  | 
 | ||||||
|  | export function handleUpgraded(event: Upgraded): void {} | ||||||
							
								
								
									
										29
									
								
								subgraph.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								subgraph.yaml
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,29 @@ | ||||||
|  | specVersion: 0.0.1 | ||||||
|  | schema: | ||||||
|  |   file: ./schema.graphql | ||||||
|  | dataSources: | ||||||
|  |   - kind: ethereum | ||||||
|  |     name: undefined | ||||||
|  |     network: mainnet | ||||||
|  |     source: | ||||||
|  |       address: "0xc3d688B66703497DAA19211EEdff47f25384cdc3" | ||||||
|  |       abi: cUSDCv3 | ||||||
|  |     mapping: | ||||||
|  |       kind: ethereum/events | ||||||
|  |       apiVersion: 0.0.5 | ||||||
|  |       language: wasm/assemblyscript | ||||||
|  |       entities: | ||||||
|  |         - AdminChanged | ||||||
|  |         - BeaconUpgraded | ||||||
|  |         - Upgraded | ||||||
|  |       abis: | ||||||
|  |         - name: cUSDCv3 | ||||||
|  |           file: ./abis/cUSDCv3.json | ||||||
|  |       eventHandlers: | ||||||
|  |         - event: AdminChanged(address,address) | ||||||
|  |           handler: handleAdminChanged | ||||||
|  |         - event: BeaconUpgraded(indexed address) | ||||||
|  |           handler: handleBeaconUpgraded | ||||||
|  |         - event: Upgraded(indexed address) | ||||||
|  |           handler: handleUpgraded | ||||||
|  |       file: ./src/c-usd-cv-3.ts | ||||||
							
								
								
									
										4
									
								
								tsconfig.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								tsconfig.json
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,4 @@ | ||||||
|  | { | ||||||
|  |   "extends": "@graphprotocol/graph-ts/types/tsconfig.base.json", | ||||||
|  |   "include": ["src"] | ||||||
|  | } | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user