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
075051e9
Unverified
Commit
075051e9
authored
May 12, 2020
by
yann300
Committed by
GitHub
May 12, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1484 from ethereum/erc-module-location
location added and two type of warnings for ERC20
parents
742b91bd
e56e5203
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
7 deletions
+25
-7
erc20Decimals.ts
...x-analyzer/src/solidity-analyzer/modules/erc20Decimals.ts
+16
-7
types.ts
remix-analyzer/src/types.ts
+9
-0
No files found.
remix-analyzer/src/solidity-analyzer/modules/erc20Decimals.ts
View file @
075051e9
...
...
@@ -29,13 +29,22 @@ export default class erc20Decimals implements AnalyzerModule {
(
f
.
returns
.
length
===
1
&&
(
f
.
returns
[
0
].
type
!==
'uint8'
||
f
.
node
.
visibility
!==
'public'
))
)
)
if
(
decimalsVar
.
length
>
0
||
decimalsFun
.
length
>
0
)
{
warnings
.
push
({
warning
:
'ERC20 Contracts decimals function should have uint8 as return type'
,
location
:
null
,
more
:
' https://eips.ethereum.org/EIPS/eip-20'
})
if
(
decimalsVar
.
length
>
0
)
{
for
(
const
node
of
decimalsVar
)
{
warnings
.
push
({
warning
:
`ERC20 contract's 'decimals' variable should be 'uint8' type`
,
location
:
node
.
src
,
more
:
' https://eips.ethereum.org/EIPS/eip-20'
})
}
}
else
if
(
decimalsFun
.
length
>
0
)
{
for
(
const
fn
of
decimalsFun
)
{
warnings
.
push
({
warning
:
`ERC20 contract's 'decimals' function should have 'uint8' as return type`
,
location
:
fn
.
node
.
src
,
more
:
' https://eips.ethereum.org/EIPS/eip-20'
})
}
}
}
})
...
...
remix-analyzer/src/types.ts
View file @
075051e9
...
...
@@ -24,6 +24,15 @@ export interface ReportObj {
more
?:
string
}
// Regarding location, she source mappings inside the AST use the following notation:
// s:l:f
// Where,
// s is the byte-offset to the start of the range in the source file,
// l is the length of the source range in bytes and
// f is the source index mentioned above.
export
interface
AnalysisReportObj
extends
ReportObj
{
error
?
:
string
}
...
...
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