Implement method for storage based access in subgraph mapping code (#162)

* Implement storage call in subgraph mapping code

* Add test for mapping type variable storage call

* Use vulcanize graph-ts

* Revert to graph-ts version 0.22.1
This commit is contained in:
2022-08-17 16:25:49 +05:30
committed by GitHub
parent 80682e2755
commit ec56de057f
21 changed files with 503 additions and 17 deletions
@@ -159,6 +159,27 @@ export function testStructEthCall (): void {
}
}
export function testGetStorageValue (): void {
log.debug('In test get storage value', []);
// Bind the contract to the address.
const contractAddress = dataSource.address();
const contract = Example1.bind(contractAddress);
const res = contract.getStorageValue('_test', []);
log.debug('Storage call result: {}', [res!.toBigInt().toString()]);
}
export function testMapStorageValue (): void {
log.debug('In test map storage value', []);
// Bind the contract to the address.
const contractAddress = dataSource.address();
const contract = Example1.bind(contractAddress);
const addressValue = ethereum.Value.fromAddress(Address.zero());
const res = contract.getStorageValue('addressUintMap', [addressValue]);
log.debug('Storage call result: {}', [res!.toBigInt().toString()]);
}
export function testBytesToHex (): string {
log.debug('In test bytesToHex', []);