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
56e48169
Commit
56e48169
authored
Apr 03, 2023
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lint: fix
parent
7746080f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
30 deletions
+29
-30
deploy-utils.ts
packages/contracts-bedrock/src/deploy-utils.ts
+29
-30
No files found.
packages/contracts-bedrock/src/deploy-utils.ts
View file @
56e48169
...
@@ -128,44 +128,43 @@ export const asAdvancedContract = (opts: {
...
@@ -128,44 +128,43 @@ export const asAdvancedContract = (opts: {
// Now reset Object.defineProperty
// Now reset Object.defineProperty
Object
.
defineProperty
=
def
Object
.
defineProperty
=
def
// Override each function call to also `.wait()` so as to simplify the deploy scripts' syntax.
for
(
const
fnName
of
Object
.
keys
(
contract
.
functions
))
{
for
(
const
fnName
of
Object
.
keys
(
contract
.
functions
))
{
const
fn
=
contract
[
fnName
].
bind
(
contract
)
const
fn
=
contract
[
fnName
].
bind
(
contract
)
;
(
contract
as
any
)[
fnName
]
=
async
(...
args
:
any
)
=>
{
;
(
contract
as
any
)[
fnName
]
=
async
(...
args
:
any
)
=>
{
// We want to use the configured gas price but we need to set the gas price to zero if we're
// We want to use the configured gas price but we need to set the gas price to zero if we're
// triggering a static function.
// triggering a static function.
let
gasPrice
=
opts
.
gasPrice
let
gasPrice
=
opts
.
gasPrice
if
(
contract
.
interface
.
getFunction
(
fnName
).
constant
)
{
if
(
contract
.
interface
.
getFunction
(
fnName
).
constant
)
{
gasPrice
=
0
gasPrice
=
0
}
}
// Now actually trigger the transaction (or call).
// Now actually trigger the transaction (or call).
const
tx
=
await
fn
(...
args
,
{
const
tx
=
await
fn
(...
args
,
{
gasPrice
,
gasPrice
,
})
})
// Meant for static calls, we don't need to wait for anything, we get the result right away.
// Meant for static calls, we don't need to wait for anything, we get the result right away.
if
(
typeof
tx
!==
'
object
'
||
typeof
tx
.
wait
!==
'
function
'
)
{
if
(
typeof
tx
!==
'
object
'
||
typeof
tx
.
wait
!==
'
function
'
)
{
return
tx
return
tx
}
}
// Wait for the transaction to be included in a block and wait for the specified number of
// Wait for the transaction to be included in a block and wait for the specified number of
// deployment confirmations.
// deployment confirmations.
const
maxTimeout
=
120
const
maxTimeout
=
120
let
timeout
=
0
let
timeout
=
0
while
(
true
)
{
while
(
true
)
{
await
sleep
(
1000
)
await
sleep
(
1000
)
const
receipt
=
await
contract
.
provider
.
getTransactionReceipt
(
tx
.
hash
)
const
receipt
=
await
contract
.
provider
.
getTransactionReceipt
(
tx
.
hash
)
if
(
receipt
===
null
)
{
if
(
receipt
===
null
)
{
timeout
++
timeout
++
if
(
timeout
>
maxTimeout
)
{
if
(
timeout
>
maxTimeout
)
{
throw
new
Error
(
'
timeout exceeded waiting for txn to be mined
'
)
throw
new
Error
(
'
timeout exceeded waiting for txn to be mined
'
)
}
}
else
if
(
receipt
.
confirmations
>=
(
opts
.
confirmations
||
0
))
{
return
tx
}
}
}
else
if
(
receipt
.
confirmations
>=
(
opts
.
confirmations
||
0
))
{
return
tx
}
}
}
}
}
}
}
return
contract
return
contract
...
...
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