-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget-contract-factory.js
31 lines (26 loc) · 1.08 KB
/
get-contract-factory.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const {
getFeeContractAbi,
getRouterContractAbi,
getFeeContractBytecode,
getSafeVaultContractAbi,
getRouterContractBytecode,
getSafeVaultContractBytecode,
} = require('./get-contract-artifacts')
/* eslint-disable-next-line no-shadow */
const ethers = require('ethers')
const getContractFactory = (_abi, _bytecode, _wallet) =>
Promise.resolve(new ethers.ContractFactory(_abi, _bytecode, _wallet))
const getPTokenContractFactory = _wallet =>
Promise.all([ getRouterContractAbi(), getRouterContractBytecode() ])
.then(([ _abi, _bytecode ]) => getContractFactory(_abi, _bytecode, _wallet))
const getFeeContractFactory = _wallet =>
Promise.all([ getFeeContractAbi(), getFeeContractBytecode() ])
.then(([ _abi, _bytecode ]) => getContractFactory(_abi, _bytecode, _wallet))
const getSafeVaultContractFactory = _wallet =>
Promise.all([ getSafeVaultContractAbi(), getSafeVaultContractBytecode() ])
.then(([ _abi, _bytecode ]) => getContractFactory(_abi, _bytecode, _wallet))
module.exports = {
getSafeVaultContractFactory,
getPTokenContractFactory,
getFeeContractFactory,
}