mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
feat: add deploy scripts for StaticATokenLM
This commit is contained in:
parent
238e5af2a9
commit
ac58fea62b
|
@ -1,5 +1,5 @@
|
|||
import { Contract } from 'ethers';
|
||||
import { DRE } from './misc-utils';
|
||||
import { DRE, waitForTx } from './misc-utils';
|
||||
import {
|
||||
tEthereumAddress,
|
||||
eContractid,
|
||||
|
@ -49,6 +49,8 @@ import {
|
|||
WETH9MockedFactory,
|
||||
WETHGatewayFactory,
|
||||
FlashLiquidationAdapterFactory,
|
||||
StaticATokenFactory,
|
||||
StaticATokenLMFactory,
|
||||
} from '../types';
|
||||
import {
|
||||
withSaveAndVerify,
|
||||
|
@ -637,3 +639,58 @@ export const deployFlashLiquidationAdapter = async (
|
|||
args,
|
||||
verify
|
||||
);
|
||||
|
||||
export const deployStaticAToken = async (
|
||||
[pool, aTokenAddress, symbol]: [tEthereumAddress, tEthereumAddress, string],
|
||||
verify?: boolean
|
||||
) => {
|
||||
const args: [string, string, string, string] = [pool, aTokenAddress, `Wrapped ${symbol}`, symbol];
|
||||
|
||||
withSaveAndVerify(
|
||||
await new StaticATokenFactory(await getFirstSigner()).deploy(...args),
|
||||
eContractid.StaticAToken,
|
||||
args,
|
||||
verify
|
||||
);
|
||||
};
|
||||
|
||||
export const deployStaticATokenLM = async (
|
||||
[pool, aTokenAddress, symbol, proxyAdmin]: [
|
||||
tEthereumAddress,
|
||||
tEthereumAddress,
|
||||
string,
|
||||
tEthereumAddress
|
||||
],
|
||||
verify?: boolean
|
||||
) => {
|
||||
const args: [string, string, string, string] = [pool, aTokenAddress, `Wrapped ${symbol}`, symbol];
|
||||
|
||||
const staticATokenImplementation = await withSaveAndVerify(
|
||||
await new StaticATokenLMFactory(await getFirstSigner()).deploy(),
|
||||
eContractid.StaticATokenLM,
|
||||
args,
|
||||
verify
|
||||
);
|
||||
|
||||
const proxy = await deployInitializableAdminUpgradeabilityProxy(verify);
|
||||
|
||||
await registerContractInJsonDb(eContractid.StaticATokenLMProxy, proxy);
|
||||
const encodedInitializedParams = staticATokenImplementation.interface.encodeFunctionData(
|
||||
'initialize',
|
||||
[...args]
|
||||
);
|
||||
|
||||
// Initialize implementation to prevent others to do it
|
||||
await staticATokenImplementation.initialize(...args);
|
||||
|
||||
// Initialize proxy
|
||||
await waitForTx(
|
||||
await proxy['initialize(address,address,bytes)'](
|
||||
staticATokenImplementation.address,
|
||||
proxyAdmin,
|
||||
encodedInitializedParams
|
||||
)
|
||||
);
|
||||
|
||||
return { proxy: proxy.address, implementation: staticATokenImplementation.address };
|
||||
};
|
||||
|
|
|
@ -87,6 +87,9 @@ export enum eContractid {
|
|||
UniswapLiquiditySwapAdapter = 'UniswapLiquiditySwapAdapter',
|
||||
UniswapRepayAdapter = 'UniswapRepayAdapter',
|
||||
FlashLiquidationAdapter = 'FlashLiquidationAdapter',
|
||||
StaticAToken = 'StaticAToken',
|
||||
StaticATokenLM = 'StaticATokenLM',
|
||||
StaticATokenLMProxy = 'StaticATokenLMProxy',
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
27568
package-lock.json
generated
27568
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
47
tasks/deployments/deploy-atoken-wrapper.ts
Normal file
47
tasks/deployments/deploy-atoken-wrapper.ts
Normal file
|
@ -0,0 +1,47 @@
|
|||
import { task } from 'hardhat/config';
|
||||
import { deployStaticAToken, deployStaticATokenLM } from '../../helpers/contracts-deployments';
|
||||
import { getFirstSigner } from '../../helpers/contracts-getters';
|
||||
import { IERC20Detailed } from '../../types/IERC20Detailed';
|
||||
import { IERC20DetailedFactory } from '../../types/IERC20DetailedFactory';
|
||||
|
||||
task(
|
||||
`deploy-atoken-wrapper`,
|
||||
`Deploy AToken Wrapper proxied with InitializableImmutableAdminUpgradeabilityProxy`
|
||||
)
|
||||
.addParam('pool', 'Lending Pool address')
|
||||
.addParam('aTokenAddress', 'AToken proxy address')
|
||||
.addParam('proxyAdmin', 'Ethereum address of the proxy admin')
|
||||
.addFlag('verify', 'Verify UiPoolDataProvider contract via Etherscan API.')
|
||||
.setAction(
|
||||
async (
|
||||
{
|
||||
pool,
|
||||
aTokenAddress,
|
||||
proxyAdmin,
|
||||
verify,
|
||||
}: {
|
||||
pool: string;
|
||||
aTokenAddress: string;
|
||||
verify: boolean;
|
||||
proxyAdmin: string;
|
||||
},
|
||||
localBRE
|
||||
) => {
|
||||
await localBRE.run('set-DRE');
|
||||
|
||||
// Load symbol from AToken proxy contract
|
||||
const symbol = await IERC20DetailedFactory.connect(
|
||||
aTokenAddress,
|
||||
await getFirstSigner()
|
||||
).symbol();
|
||||
|
||||
const { proxy, implementation } = await deployStaticATokenLM(
|
||||
[pool, aTokenAddress, symbol, proxyAdmin],
|
||||
verify
|
||||
);
|
||||
|
||||
console.log('- Deployed Static Wrapper for', symbol);
|
||||
console.log(' - Proxy: ', proxy);
|
||||
console.log(' - Impl : ', implementation);
|
||||
}
|
||||
);
|
Loading…
Reference in New Issue
Block a user