-
Notifications
You must be signed in to change notification settings - Fork 45
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
Showing
4 changed files
with
83 additions
and
2 deletions.
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
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
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,32 @@ | ||
import {CHAIN_ID_CLIENT_MAP} from '@bgd-labs/js-utils'; | ||
import {getContract} from 'viem'; | ||
import {IStaticATokenFactory_ABI} from '../../src/ts/AaveAddressBook'; | ||
|
||
export async function check(addresses: Record<string, any>) { | ||
if (addresses.STATIC_A_TOKEN_FACTORY) { | ||
const client = CHAIN_ID_CLIENT_MAP[addresses.CHAIN_ID]; | ||
const factory = getContract({ | ||
abi: [ | ||
{ | ||
type: 'function', | ||
name: 'POOL', | ||
inputs: [], | ||
outputs: [ | ||
{ | ||
name: '', | ||
type: 'address', | ||
internalType: 'address', | ||
}, | ||
], | ||
stateMutability: 'view', | ||
}, | ||
] as const, | ||
address: addresses['STATIC_A_TOKEN_FACTORY'], | ||
client, | ||
}); | ||
const factoryPool = await factory.read.POOL(); | ||
if (factoryPool !== addresses.POOL) | ||
throw new Error(`SANITY_STATA: POOL MISMATCH ${addresses.POOL}:${factoryPool}`); | ||
console.log('SANITY_STATA: PASSED'); | ||
} | ||
} |
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,16 @@ | ||
/** | ||
* Runs sanity checks over the given set of addresses | ||
*/ | ||
import * as addressBook from '../src/ts/AaveAddressBook'; | ||
import {check as stataCheck} from './checks/stataFactory'; | ||
|
||
async function sanity() { | ||
const sanitySuites = [stataCheck]; | ||
for (const key of Object.keys(addressBook)) { | ||
for (const suite of sanitySuites) { | ||
await suite(addressBook[key]); | ||
} | ||
} | ||
} | ||
|
||
sanity(); |