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
86dc7054
Commit
86dc7054
authored
Nov 12, 2020
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ensure payable and stateMutability have correct value is constant is true in the abi
parent
c871925c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
compiler.ts
libs/remix-solidity/src/compiler/compiler.ts
+14
-3
types.ts
libs/remix-solidity/src/compiler/types.ts
+6
-0
No files found.
libs/remix-solidity/src/compiler/compiler.ts
View file @
86dc7054
...
@@ -7,7 +7,8 @@ import EventManager from '../lib/eventManager'
...
@@ -7,7 +7,8 @@ import EventManager from '../lib/eventManager'
import
{
default
as
txHelper
}
from
'./txHelper'
;
import
{
default
as
txHelper
}
from
'./txHelper'
;
import
{
Source
,
SourceWithTarget
,
MessageFromWorker
,
CompilerState
,
CompilationResult
,
import
{
Source
,
SourceWithTarget
,
MessageFromWorker
,
CompilerState
,
CompilationResult
,
visitContractsCallbackParam
,
visitContractsCallbackInterface
,
CompilationError
,
visitContractsCallbackParam
,
visitContractsCallbackInterface
,
CompilationError
,
gatherImportsCallbackInterface
}
from
'./types'
gatherImportsCallbackInterface
,
isFunctionDescription
}
from
'./types'
/*
/*
trigger compilationFinished, compilerLoaded, compilationStarted, compilationDuration
trigger compilationFinished, compilerLoaded, compilationStarted, compilationDuration
...
@@ -335,8 +336,18 @@ export class Compiler {
...
@@ -335,8 +336,18 @@ export class Compiler {
'type'
:
'fallback'
'type'
:
'fallback'
})
})
}
}
if
(
data
&&
data
.
contracts
&&
this
.
state
.
currentVersion
)
if
(
data
&&
data
.
contracts
&&
this
.
state
.
currentVersion
)
{
data
.
contracts
[
contract
.
file
][
contract
.
name
].
abi
=
update
(
this
.
truncateVersion
(
this
.
state
.
currentVersion
),
contract
.
object
.
abi
)
const
version
=
this
.
truncateVersion
(
this
.
state
.
currentVersion
)
data
.
contracts
[
contract
.
file
][
contract
.
name
].
abi
=
update
(
version
,
contract
.
object
.
abi
)
// if "constant" , payable must not be true and stateMutability must be view.
// see https://github.com/ethereum/solc-js/issues/500
for
(
const
item
of
data
.
contracts
[
contract
.
file
][
contract
.
name
].
abi
)
{
if
(
isFunctionDescription
(
item
)
&&
item
.
constant
)
{
item
.
payable
=
false
item
.
stateMutability
=
'view'
;
}
}
}
})
})
return
data
return
data
}
}
...
...
libs/remix-solidity/src/compiler/types.ts
View file @
86dc7054
...
@@ -354,6 +354,12 @@ export interface CompilationResult {
...
@@ -354,6 +354,12 @@ export interface CompilationResult {
/////////
/////////
export
type
ABIDescription
=
FunctionDescription
|
EventDescription
export
type
ABIDescription
=
FunctionDescription
|
EventDescription
export
const
isFunctionDescription
=
(
item
:
ABIDescription
):
item
is
FunctionDescription
=>
(
item
as
FunctionDescription
).
stateMutability
!==
undefined
;
export
const
isEventDescription
=
(
item
:
ABIDescription
):
item
is
EventDescription
=>
(
item
as
EventDescription
).
type
===
'event'
;
export
interface
FunctionDescription
{
export
interface
FunctionDescription
{
/** Type of the method. default is 'function' */
/** Type of the method. default is 'function' */
type
?:
'function'
|
'constructor'
|
'fallback'
|
'receive'
type
?:
'function'
|
'constructor'
|
'fallback'
|
'receive'
...
...
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