Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: avax fuji and base sepolia testnets #714

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
358 changes: 358 additions & 0 deletions scripts/abi/umbrella.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,358 @@
export const IUmbrella_ABI = [
{
inputs: [
{internalType: 'contract IPool', name: 'pool', type: 'address'},
{internalType: 'address', name: 'collector', type: 'address'},
{internalType: 'contract ITransparentProxyFactory', name: 'proxyFactory', type: 'address'},
{internalType: 'address', name: 'stakeTokenImpl', type: 'address'},
{internalType: 'address', name: 'proxyAdmin', type: 'address'},
],
stateMutability: 'nonpayable',
type: 'constructor',
},
{inputs: [], name: 'CannotSlashReserve', type: 'error'},
{
inputs: [{internalType: 'bytes32', name: 'key', type: 'bytes32'}],
name: 'EnumerableMapNonexistentKey',
type: 'error',
},
{inputs: [], name: 'InvalidInitialization', type: 'error'},
{inputs: [], name: 'InvalidLiquidationBonus', type: 'error'},
{inputs: [], name: 'MathOverflowedMulDiv', type: 'error'},
{inputs: [], name: 'NoDeficitToCover', type: 'error'},
{inputs: [], name: 'NoDeficitToSlash', type: 'error'},
{inputs: [], name: 'NotInitializing', type: 'error'},
{
inputs: [{internalType: 'address', name: 'owner', type: 'address'}],
name: 'OwnableInvalidOwner',
type: 'error',
},
{
inputs: [{internalType: 'address', name: 'account', type: 'address'}],
name: 'OwnableUnauthorizedAccount',
type: 'error',
},
{inputs: [], name: 'StataAssetMustMatchReserve', type: 'error'},
{
inputs: [{internalType: 'address', name: 'target', type: 'address'}],
name: 'UmbrellaNotInControl',
type: 'error',
},
{
anonymous: false,
inputs: [{indexed: false, internalType: 'uint64', name: 'version', type: 'uint64'}],
name: 'Initialized',
type: 'event',
},
{
anonymous: false,
inputs: [
{indexed: true, internalType: 'address', name: 'previousOwner', type: 'address'},
{indexed: true, internalType: 'address', name: 'newOwner', type: 'address'},
],
name: 'OwnershipTransferred',
type: 'event',
},
{
anonymous: false,
inputs: [
{indexed: true, internalType: 'address', name: 'reserve', type: 'address'},
{indexed: false, internalType: 'uint256', name: 'amount', type: 'uint256'},
],
name: 'RecordedReserveDeficitChanged',
type: 'event',
},
{
anonymous: false,
inputs: [
{indexed: true, internalType: 'address', name: 'reserve', type: 'address'},
{indexed: false, internalType: 'address', name: 'stakeToken', type: 'address'},
{indexed: false, internalType: 'uint256', name: 'liquidationBonus', type: 'uint256'},
{indexed: false, internalType: 'address', name: 'oracle', type: 'address'},
{indexed: false, internalType: 'bool', name: 'isReserveStataToken', type: 'bool'},
],
name: 'SlashingConfigurationChanged',
type: 'event',
},
{
anonymous: false,
inputs: [
{indexed: true, internalType: 'address', name: 'reserve', type: 'address'},
{indexed: false, internalType: 'address', name: 'stakeToken', type: 'address'},
],
name: 'SlashingConfigurationRemoved',
type: 'event',
},
{
anonymous: false,
inputs: [
{indexed: false, internalType: 'address', name: 'stakeToken', type: 'address'},
{indexed: false, internalType: 'address', name: 'underlying', type: 'address'},
{indexed: false, internalType: 'string', name: 'name', type: 'string'},
{indexed: false, internalType: 'string', name: 'symbol', type: 'string'},
],
name: 'StakeTokenCreated',
type: 'event',
},
{
inputs: [],
name: 'COLLECTOR',
outputs: [{internalType: 'address', name: '', type: 'address'}],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'POOL',
outputs: [{internalType: 'contract IPool', name: '', type: 'address'}],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'POOL_ADDRESSES_PROVIDER',
outputs: [{internalType: 'contract IPoolAddressesProvider', name: '', type: 'address'}],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'PROXY_ADMIN',
outputs: [{internalType: 'address', name: '', type: 'address'}],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'STAKE_TOKEN_IMPL',
outputs: [{internalType: 'address', name: '', type: 'address'}],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'TRANSPARENT_PROXY_FACTORY',
outputs: [{internalType: 'contract ITransparentProxyFactory', name: '', type: 'address'}],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{internalType: 'address', name: 'reserve', type: 'address'},
{internalType: 'uint256', name: 'amount', type: 'uint256'},
],
name: 'coverReserveDeficit',
outputs: [{internalType: 'uint256', name: '', type: 'uint256'}],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{internalType: 'address', name: 'underlying', type: 'address'},
{internalType: 'uint256', name: 'defaultCooldown', type: 'uint256'},
{internalType: 'uint256', name: 'defaultUnstakeWindow', type: 'uint256'},
],
name: 'createStakeToken',
outputs: [{internalType: 'address', name: '', type: 'address'}],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{internalType: 'address', name: 'stakeToken', type: 'address'},
{internalType: 'address', name: 'to', type: 'address'},
{internalType: 'uint256', name: 'amount', type: 'uint256'},
],
name: 'emergencyEtherTransferStk',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{internalType: 'address', name: 'stakeToken', type: 'address'},
{internalType: 'address', name: 'erc20Token', type: 'address'},
{internalType: 'address', name: 'to', type: 'address'},
{internalType: 'uint256', name: 'amount', type: 'uint256'},
],
name: 'emergencyTokenTransferStk',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [{internalType: 'address', name: 'reserve', type: 'address'}],
name: 'getPendingDeficitResolution',
outputs: [{internalType: 'uint256', name: '', type: 'uint256'}],
stateMutability: 'view',
type: 'function',
},
{
inputs: [
{internalType: 'address', name: 'reserve', type: 'address'},
{internalType: 'address', name: 'stakeToken', type: 'address'},
],
name: 'getReserveSlashingConfig',
outputs: [
{
components: [
{internalType: 'address', name: 'stakeToken', type: 'address'},
{internalType: 'contract AggregatorInterface', name: 'oracle', type: 'address'},
{internalType: 'uint256', name: 'liquidationBonus', type: 'uint256'},
{internalType: 'bool', name: 'isReserveStataToken', type: 'bool'},
],
internalType: 'struct IUmbrellaConfiguration.SlashingConfig',
name: '',
type: 'tuple',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [{internalType: 'address', name: 'reserve', type: 'address'}],
name: 'getReserveSlashingConfigs',
outputs: [
{
components: [
{internalType: 'address', name: 'stakeToken', type: 'address'},
{internalType: 'contract AggregatorInterface', name: 'oracle', type: 'address'},
{internalType: 'uint256', name: 'liquidationBonus', type: 'uint256'},
{internalType: 'bool', name: 'isReserveStataToken', type: 'bool'},
],
internalType: 'struct IUmbrellaConfiguration.SlashingConfig[]',
name: '',
type: 'tuple[]',
},
],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'getStkTokens',
outputs: [{internalType: 'address[]', name: '', type: 'address[]'}],
stateMutability: 'view',
type: 'function',
},
{
inputs: [{internalType: 'address', name: 'owner', type: 'address'}],
name: 'initialize',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [{internalType: 'address', name: 'reserve', type: 'address'}],
name: 'isReserveSlashable',
outputs: [{internalType: 'bool', name: '', type: 'bool'}],
stateMutability: 'view',
type: 'function',
},
{
inputs: [{internalType: 'address', name: 'stakeToken', type: 'address'}],
name: 'isUmbrellaStkToken',
outputs: [{internalType: 'bool', name: '', type: 'bool'}],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'owner',
outputs: [{internalType: 'address', name: '', type: 'address'}],
stateMutability: 'view',
type: 'function',
},
{
inputs: [{internalType: 'address', name: 'stakeToken', type: 'address'}],
name: 'pauseStk',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{
components: [
{internalType: 'address', name: 'reserve', type: 'address'},
{internalType: 'address', name: 'stakeToken', type: 'address'},
],
internalType: 'struct IUmbrellaConfiguration.SlashingConfigRemoval[]',
name: 'removalPairs',
type: 'tuple[]',
},
],
name: 'removeSlashingConfigs',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [],
name: 'renounceOwnership',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{internalType: 'address', name: 'stakeToken', type: 'address'},
{internalType: 'uint256', name: 'newCooldown', type: 'uint256'},
],
name: 'setCooldownStk',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{internalType: 'address', name: 'stakeToken', type: 'address'},
{internalType: 'uint256', name: 'newUnstakeWindow', type: 'uint256'},
],
name: 'setUnstakeWindowStk',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [{internalType: 'address', name: 'reserve', type: 'address'}],
name: 'slashReserveDeficit',
outputs: [{internalType: 'uint256', name: '', type: 'uint256'}],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [{internalType: 'address', name: 'newOwner', type: 'address'}],
name: 'transferOwnership',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [{internalType: 'address', name: 'stakeToken', type: 'address'}],
name: 'unpauseStk',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
{
inputs: [
{
components: [
{internalType: 'address', name: 'reserve', type: 'address'},
{internalType: 'address', name: 'stakeToken', type: 'address'},
{internalType: 'uint256', name: 'liquidationBonus', type: 'uint256'},
{internalType: 'bool', name: 'isReserveStataToken', type: 'bool'},
{internalType: 'address', name: 'stakeTokenOracle', type: 'address'},
],
internalType: 'struct IUmbrellaConfiguration.SlashingConfigUpdate[]',
name: 'coverageConfig',
type: 'tuple[]',
},
],
name: 'updateSlashingConfigs',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
] as const;
11 changes: 6 additions & 5 deletions scripts/clients.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {HttpTransportConfig, createClient, http} from 'viem';
import {Client} from 'viem';
import {HttpTransportConfig, createClient, Client, http} from 'viem';
import {ChainList, getRPCUrl} from '@bgd-labs/rpc-env';

const commonConfig: HttpTransportConfig = {timeout: 30_000, batch: true};
Expand All @@ -10,12 +9,14 @@ const clientCache: Record<number, Client> = {};
export function getClient(chainId: number) {
if (!clientCache[chainId]) {
const rpcURL = getRPCUrl(chainId as any, {alchemyKey: process.env.ALCHEMY_API_KEY});

clientCache[chainId] = createClient({
const transport = http(rpcURL, commonConfig);
const client = createClient({
chain: ChainList[chainId],
transport: http(rpcURL, commonConfig),
transport: transport,
...batchConfig,
});

clientCache[chainId] = client;
}
return clientCache[chainId];
}
5 changes: 3 additions & 2 deletions scripts/configs/networks/avalanche.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export const avalancheFujiAddresses: NetworkAddresses = {
chainId: ChainId.avalanche_fuji,
addresses: {
GHO_TOKEN: '0x9c04928Cc678776eC1C1C0E46ecC03a5F47A7723',
TRANSPARENT_PROXY_FACTORY: '0x5f4d15d761528c57a5C30c43c1DAb26Fc5452731',
PROXY_ADMIN: '0x440F1b750Cbc7DDd2Bd9Af279Afe422EaeE58b41',
TRANSPARENT_PROXY_FACTORY: '0x421117D7319E96d831972b3F7e970bbfe29C4F21',
PROXY_ADMIN: '0xd6a6339c6C1B5a8792afA6e0E80b1908b8579f51',
FAUCET: '0x48b5bd96e36a9c0d0ea3f07d3b3da34bbd514fb3'
},
};
Loading
Loading