mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
fix deployment and tests
This commit is contained in:
parent
43c8ef02db
commit
84cf68e58e
|
@ -32,8 +32,8 @@ import {Ierc20Detailed} from '../types/Ierc20Detailed';
|
|||
import {StableDebtToken} from '../types/StableDebtToken';
|
||||
import {VariableDebtToken} from '../types/VariableDebtToken';
|
||||
import {MockSwapAdapter} from '../types/MockSwapAdapter';
|
||||
import { signTypedData_v4, TypedData } from "eth-sig-util";
|
||||
import { fromRpcSig, ECDSASignature } from "ethereumjs-util";
|
||||
import {signTypedData_v4, TypedData} from 'eth-sig-util';
|
||||
import {fromRpcSig, ECDSASignature} from 'ethereumjs-util';
|
||||
|
||||
export const registerContractInJsonDb = async (contractId: string, contractInstance: Contract) => {
|
||||
const currentNetwork = BRE.network.name;
|
||||
|
@ -251,49 +251,55 @@ export const deployDefaultReserveInterestRateStrategy = async ([
|
|||
]
|
||||
);
|
||||
|
||||
export const deployStableDebtToken = async ([name, symbol, underlyingAsset, poolAddress]: [
|
||||
string,
|
||||
string,
|
||||
tEthereumAddress,
|
||||
tEthereumAddress
|
||||
]) => {
|
||||
export const deployStableDebtToken = async ([
|
||||
name,
|
||||
symbol,
|
||||
underlyingAsset,
|
||||
poolAddress,
|
||||
incentivesController,
|
||||
]: [string, string, tEthereumAddress, tEthereumAddress, tEthereumAddress]) => {
|
||||
const token = await deployContract<StableDebtToken>(eContractid.StableDebtToken, [
|
||||
poolAddress,
|
||||
underlyingAsset,
|
||||
name,
|
||||
symbol,
|
||||
incentivesController,
|
||||
]);
|
||||
|
||||
return token;
|
||||
};
|
||||
|
||||
export const deployVariableDebtToken = async ([name, symbol, underlyingAsset, poolAddress]: [
|
||||
string,
|
||||
string,
|
||||
tEthereumAddress,
|
||||
tEthereumAddress
|
||||
]) => {
|
||||
export const deployVariableDebtToken = async ([
|
||||
name,
|
||||
symbol,
|
||||
underlyingAsset,
|
||||
poolAddress,
|
||||
incentivesController,
|
||||
]: [string, string, tEthereumAddress, tEthereumAddress, tEthereumAddress]) => {
|
||||
const token = await deployContract<VariableDebtToken>(eContractid.VariableDebtToken, [
|
||||
poolAddress,
|
||||
underlyingAsset,
|
||||
name,
|
||||
symbol,
|
||||
incentivesController,
|
||||
]);
|
||||
|
||||
return token;
|
||||
};
|
||||
|
||||
export const deployGenericAToken = async ([poolAddress, underlyingAssetAddress, name, symbol]: [
|
||||
tEthereumAddress,
|
||||
tEthereumAddress,
|
||||
string,
|
||||
string
|
||||
]) => {
|
||||
export const deployGenericAToken = async ([
|
||||
poolAddress,
|
||||
underlyingAssetAddress,
|
||||
name,
|
||||
symbol,
|
||||
incentivesController,
|
||||
]: [tEthereumAddress, tEthereumAddress, string, string, tEthereumAddress]) => {
|
||||
const token = await deployContract<AToken>(eContractid.AToken, [
|
||||
poolAddress,
|
||||
underlyingAssetAddress,
|
||||
name,
|
||||
symbol,
|
||||
incentivesController,
|
||||
]);
|
||||
|
||||
return token;
|
||||
|
@ -491,20 +497,20 @@ export const buildPermitParams = (
|
|||
) => ({
|
||||
types: {
|
||||
EIP712Domain: [
|
||||
{ name: "name", type: "string" },
|
||||
{ name: "version", type: "string" },
|
||||
{ name: "chainId", type: "uint256" },
|
||||
{ name: "verifyingContract", type: "address" },
|
||||
{name: 'name', type: 'string'},
|
||||
{name: 'version', type: 'string'},
|
||||
{name: 'chainId', type: 'uint256'},
|
||||
{name: 'verifyingContract', type: 'address'},
|
||||
],
|
||||
Permit: [
|
||||
{ name: "owner", type: "address" },
|
||||
{ name: "spender", type: "address" },
|
||||
{ name: "value", type: "uint256" },
|
||||
{ name: "nonce", type: "uint256" },
|
||||
{ name: "deadline", type: "uint256" },
|
||||
{name: 'owner', type: 'address'},
|
||||
{name: 'spender', type: 'address'},
|
||||
{name: 'value', type: 'uint256'},
|
||||
{name: 'nonce', type: 'uint256'},
|
||||
{name: 'deadline', type: 'uint256'},
|
||||
],
|
||||
},
|
||||
primaryType: "Permit" as const,
|
||||
primaryType: 'Permit' as const,
|
||||
domain: {
|
||||
name: tokenName,
|
||||
version: revision,
|
||||
|
@ -520,16 +526,12 @@ export const buildPermitParams = (
|
|||
},
|
||||
});
|
||||
|
||||
|
||||
export const getSignatureFromTypedData = (
|
||||
privateKey: string,
|
||||
typedData: any // TODO: should be TypedData, from eth-sig-utils, but TS doesn't accept it
|
||||
): ECDSASignature => {
|
||||
const signature = signTypedData_v4(
|
||||
Buffer.from(privateKey.substring(2, 66), "hex"),
|
||||
{
|
||||
data: typedData,
|
||||
}
|
||||
);
|
||||
const signature = signTypedData_v4(Buffer.from(privateKey.substring(2, 66), 'hex'), {
|
||||
data: typedData,
|
||||
});
|
||||
return fromRpcSig(signature);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -175,7 +175,8 @@ const initReserves = async (
|
|||
lendingPoolAddressesProvider: LendingPoolAddressesProvider,
|
||||
lendingPool: LendingPool,
|
||||
lendingPoolConfigurator: LendingPoolConfigurator,
|
||||
aavePool: AavePools
|
||||
aavePool: AavePools,
|
||||
incentivesController: tEthereumAddress
|
||||
) => {
|
||||
if (aavePool !== AavePools.proto && aavePool !== AavePools.secondary) {
|
||||
console.log(`Invalid Aave pool ${aavePool}`);
|
||||
|
@ -230,6 +231,7 @@ const initReserves = async (
|
|||
`stableDebt${assetSymbol === 'WETH' ? 'ETH' : assetSymbol}`,
|
||||
tokenAddress,
|
||||
lendingPool.address,
|
||||
incentivesController,
|
||||
]);
|
||||
|
||||
const variableDebtToken = await deployVariableDebtToken([
|
||||
|
@ -237,6 +239,7 @@ const initReserves = async (
|
|||
`variableDebt${assetSymbol === 'WETH' ? 'ETH' : assetSymbol}`,
|
||||
tokenAddress,
|
||||
lendingPool.address,
|
||||
incentivesController,
|
||||
]);
|
||||
|
||||
const aToken = await deployGenericAToken([
|
||||
|
@ -244,6 +247,7 @@ const initReserves = async (
|
|||
tokenAddress,
|
||||
`Aave interest bearing ${assetSymbol === 'WETH' ? 'ETH' : assetSymbol}`,
|
||||
`a${assetSymbol === 'WETH' ? 'ETH' : assetSymbol}`,
|
||||
incentivesController,
|
||||
]);
|
||||
|
||||
if (process.env.POOL === AavePools.secondary) {
|
||||
|
@ -481,7 +485,8 @@ const buildTestEnv = async (deployer: Signer, secondaryWallet: Signer) => {
|
|||
addressesProvider,
|
||||
lendingPoolProxy,
|
||||
lendingPoolConfiguratorProxy,
|
||||
AavePools.proto
|
||||
AavePools.proto,
|
||||
ZERO_ADDRESS
|
||||
);
|
||||
await enableReservesToBorrow(
|
||||
reservesParams,
|
||||
|
|
Loading…
Reference in New Issue
Block a user