Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tron-explore
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
张建华@五瓣科技
tron-explore
Commits
7c2ae58c
Commit
7c2ae58c
authored
Dec 02, 2020
by
jianhua.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合约验证接口调整
parent
ea59170d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
6 deletions
+42
-6
ContractController.java
...com/wuban/tron/explore/controller/ContractController.java
+27
-3
ContractModel.java
.../com/wuban/tron/explore/param/response/ContractModel.java
+14
-2
application-dev.yml
src/main/resources/application-dev.yml
+1
-1
No files found.
src/main/java/com/wuban/tron/explore/controller/ContractController.java
View file @
7c2ae58c
...
...
@@ -86,6 +86,7 @@ public class ContractController {
if
(
con
!=
null
)
{
BeanUtils
.
copyProperties
(
con
,
model
,
"id"
);
model
.
setId
(
con
.
getContractAddress
());
model
.
setAddress
(
con
.
getContractAddress
());
model
.
setCode
(
con
.
getBytecode
());
}
...
...
@@ -96,11 +97,34 @@ public class ContractController {
public
ApiResponse
compileSolidityOne
(
@RequestBody
@Valid
ContractModel
reqParam
)
{
boolean
flag
=
false
;
Contract
con
=
this
.
tronService
.
getContract
(
reqParam
.
getId
());
if
(
con
!=
null
)
{
if
(
con
.
getBytecode
().
equals
(
reqParam
.
getCode
()))
{
// 编译合约、获取code
String
code
=
this
.
contractCompilerService
.
compiler
(
reqParam
.
getName
(),
reqParam
.
getValue
(),
reqParam
.
getCompiler
());
// 根据合约地址获取合约内容
Contract
con
=
this
.
tronService
.
getContract
(
reqParam
.
getAddress
());
// 验证合约code,如果一致,持久化到数据库中
if
(
con
!=
null
&&
!
StringUtils
.
isEmpty
(
con
.
getBytecode
()))
{
/* if (con.getBytecode().equals(code)) {
Contract contract = new Contract();
BeanUtils.copyProperties(reqParam, contract);
if (contract != null) {
this.contractService.insert(contract);
}
flag = true;
}*/
con
.
setName
(
reqParam
.
getName
());
con
.
setContractAddress
(
reqParam
.
getAddress
());
con
.
setVersion
(
reqParam
.
getCompiler
());
con
.
setOptimization
(
reqParam
.
getOptimization
());
con
.
setSource
(
reqParam
.
getValue
());
con
.
setRuns
(
reqParam
.
getRuns
());
con
.
setLicenseType
(
reqParam
.
getLicense_type
());
con
.
setEvmVersion
(
reqParam
.
getEvm_version
());
if
(
con
!=
null
)
{
this
.
contractService
.
insert
(
con
);
}
flag
=
true
;
}
return
ResponseKit
.
success
(
flag
);
...
...
src/main/java/com/wuban/tron/explore/param/response/ContractModel.java
View file @
7c2ae58c
...
...
@@ -16,6 +16,11 @@ public class ContractModel {
*/
private
String
id
;
/**
* 合约地址
*/
private
String
address
;
/**
* 合约名称
*/
...
...
@@ -26,11 +31,18 @@ public class ContractModel {
*/
private
String
version
;
/**
* solidity版本号
*/
private
String
compiler
;
/**
* 合约代码
*/
private
String
source
;
private
String
value
;
/**
* 合约ABI
*/
...
...
@@ -56,11 +68,11 @@ public class ContractModel {
/**
*
*/
private
String
evm
V
ersion
;
private
String
evm
_v
ersion
;
/**
*
*/
private
String
license
T
ype
;
private
String
license
_t
ype
;
/**
*
*/
...
...
src/main/resources/application-dev.yml
View file @
7c2ae58c
...
...
@@ -5,7 +5,7 @@ tron:
contract
:
complier
:
site
:
http://47.115.200.174:
808
0/api/explorer/v1/compileSolidity
site
:
http://47.115.200.174:
909
0/api/explorer/v1/compileSolidity
spring
:
datasource
:
...
...
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