Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
c0331038
Commit
c0331038
authored
May 15, 2020
by
aniket-engg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iterate imported files too
parent
e889cf7b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
18 deletions
+20
-18
gasCosts.ts
remix-analyzer/src/solidity-analyzer/modules/gasCosts.ts
+20
-18
No files found.
remix-analyzer/src/solidity-analyzer/modules/gasCosts.ts
View file @
c0331038
...
...
@@ -39,24 +39,26 @@ export default class gasCosts implements AnalyzerModule {
}
})
for
(
const
method
of
methodsWithSignature
)
{
for
(
const
contractName
in
compilationResults
.
contracts
[
filename
])
{
const
contract
=
compilationResults
.
contracts
[
filename
][
contractName
]
const
methodGas
:
any
=
this
.
checkMethodGas
(
contract
,
method
.
signature
)
if
(
methodGas
&&
methodGas
.
isInfinite
)
{
if
(
methodGas
.
isFallback
)
{
report
.
push
({
warning
:
`Fallback function of contract
${
contractName
}
requires too much gas (
${
methodGas
.
msg
}
).
If the fallback function requires more than 2300 gas, the contract cannot receive Ether.`
})
}
else
{
report
.
push
({
warning
:
`Gas requirement of function
${
contractName
}
.
${
method
.
name
}
${
methodGas
.
msg
}
.
If the gas requirement of a function is higher than the block gas limit, it cannot be executed.
Please avoid loops in your functions or actions that modify large areas of storage
(this includes clearing or copying arrays in storage)`
})
}
}
else
continue
for
(
const
filename
in
compilationResults
.
contracts
)
{
for
(
const
contractName
in
compilationResults
.
contracts
[
filename
])
{
const
contract
=
compilationResults
.
contracts
[
filename
][
contractName
]
const
methodGas
:
any
=
this
.
checkMethodGas
(
contract
,
method
.
signature
)
if
(
methodGas
&&
methodGas
.
isInfinite
)
{
if
(
methodGas
.
isFallback
)
{
report
.
push
({
warning
:
`Fallback function of contract
${
contractName
}
requires too much gas (
${
methodGas
.
msg
}
).
If the fallback function requires more than 2300 gas, the contract cannot receive Ether.`
})
}
else
{
report
.
push
({
warning
:
`Gas requirement of function
${
contractName
}
.
${
method
.
name
}
${
methodGas
.
msg
}
.
If the gas requirement of a function is higher than the block gas limit, it cannot be executed.
Please avoid loops in your functions or actions that modify large areas of storage
(this includes clearing or copying arrays in storage)`
})
}
}
else
continue
}
}
}
return
report
...
...
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