Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
83259899
Unverified
Commit
83259899
authored
Oct 21, 2021
by
ben-chain
Committed by
Kelvin Fichter
Nov 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(contracts): update getLiveContract to use optional iface override
parent
e93ee9ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
hardhat-deploy-ethers.ts
packages/contracts/src/hardhat-deploy-ethers.ts
+8
-8
No files found.
packages/contracts/src/hardhat-deploy-ethers.ts
View file @
83259899
...
...
@@ -151,24 +151,24 @@ export const getLiveContract = async (
signerOrProvider
?:
Signer
|
Provider
|
string
}
=
{}
):
Promise
<
Contract
>
=>
{
let
factory
=
await
hre
.
ethers
.
getContractFactory
(
name
)
let
iface
=
factory
.
interface
// First check to see if the contract is being reused in an upgrade, rather than freshly deployed.
// If so, then a valid address would have been provided for one of the 3 contracts in configNames.
const
addr
=
(
hre
as
any
).
deployConfig
[
configNames
[
name
]]
if
(
hre
.
ethers
.
utils
.
isAddress
(
addr
))
{
return
new
Contract
(
addr
,
iface
)
// Get the interface by name, unless an override was requested via the iface option
const
factory
=
await
hre
.
ethers
.
getContractFactory
(
options
.
iface
||
name
)
return
new
Contract
(
addr
,
factory
.
interface
)
}
// Otherwise, look for a previously deployed contract
// Otherwise, look for a previously deployed contract
.
const
deployed
=
await
hre
.
deployments
.
get
(
name
)
await
hre
.
ethers
.
provider
.
waitForTransaction
(
deployed
.
receipt
.
transactionHash
)
// Get the correct interface.
iface
=
new
hre
.
ethers
.
utils
.
Interface
(
deployed
.
abi
)
// Get the deployed contract's interface.
let
iface
=
new
hre
.
ethers
.
utils
.
Interface
(
deployed
.
abi
)
// Override with optional iface name if requested.
if
(
options
.
iface
)
{
factory
=
await
hre
.
ethers
.
getContractFactory
(
options
.
iface
)
const
factory
=
await
hre
.
ethers
.
getContractFactory
(
options
.
iface
)
iface
=
factory
.
interface
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment