Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
contract_backend
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
Odysseus
contract_backend
Commits
53370b76
Commit
53370b76
authored
Jan 08, 2025
by
贾浩@五瓣科技
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
88ad20bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
26 deletions
+9
-26
contract.go
dao/contract.go
+7
-24
eth.go
dao/eth.go
+2
-2
No files found.
dao/contract.go
View file @
53370b76
...
...
@@ -25,7 +25,8 @@ func (d *Dao) LoginByServer(byteKey []byte, userAddress, userId string) (txHash
if
err
!=
nil
{
return
common
.
Hash
{},
err
}
auth
.
GasPrice
=
d
.
gasPrice
auth
.
GasFeeCap
=
d
.
gasPrice
auth
.
GasTipCap
=
big
.
NewInt
(
1000000
)
auth
.
GasLimit
=
700000
tx
,
err
:=
instance
.
LoginByServer
(
auth
,
common
.
HexToAddress
(
userAddress
),
userId
,
""
)
if
err
!=
nil
{
...
...
@@ -35,26 +36,6 @@ func (d *Dao) LoginByServer(byteKey []byte, userAddress, userId string) (txHash
return
tx
.
Hash
(),
err
}
func
(
d
*
Dao
)
Login
(
byteKey
[]
byte
,
userId
string
,
inviter
string
)
(
txHash
common
.
Hash
,
err
error
)
{
instance
,
err
:=
aon_user
.
NewAonUser
(
common
.
HexToAddress
(
d
.
c
.
Chain
.
UserContract
),
d
.
ethClient
)
if
err
!=
nil
{
return
common
.
Hash
{},
err
}
privateKey
:=
crypto
.
ToECDSAUnsafe
(
byteKey
)
auth
,
err
:=
bind
.
NewKeyedTransactorWithChainID
(
privateKey
,
d
.
chainId
)
if
err
!=
nil
{
return
common
.
Hash
{},
err
}
auth
.
GasPrice
=
d
.
gasPrice
auth
.
GasLimit
=
700000
tx
,
err
:=
instance
.
Login
(
auth
,
userId
,
inviter
)
if
err
!=
nil
{
return
common
.
Hash
{},
err
}
return
tx
.
Hash
(),
nil
}
func
(
d
*
Dao
)
CheckPermit
(
userByteKey
[]
byte
)
(
txHash
common
.
Hash
,
err
error
)
{
instance
,
err
:=
erc20
.
NewErc20
(
common
.
HexToAddress
(
d
.
c
.
Chain
.
AppPointContract
),
d
.
ethClient
)
if
err
!=
nil
{
...
...
@@ -76,8 +57,9 @@ func (d *Dao) CheckPermit(userByteKey []byte) (txHash common.Hash, err error) {
if
err
!=
nil
{
return
}
auth
.
GasPrice
=
d
.
gasPrice
auth
.
GasLimit
=
100000
auth
.
GasFeeCap
=
d
.
gasPrice
auth
.
GasTipCap
=
big
.
NewInt
(
1000000
)
auth
.
GasLimit
=
150000
nextNonce
,
err
:=
instance
.
Nonces
(
&
bind
.
CallOpts
{},
userAddress
)
if
err
!=
nil
{
...
...
@@ -121,7 +103,8 @@ func (d *Dao) ExecuteTask(privateKey *ecdsa.PrivateKey, executeId, userId, appId
if
err
!=
nil
{
return
common
.
Hash
{},
err
}
auth
.
GasPrice
=
d
.
gasPrice
auth
.
GasFeeCap
=
d
.
gasPrice
auth
.
GasTipCap
=
big
.
NewInt
(
1000000
)
auth
.
GasLimit
=
1500000
tx
,
err
:=
instance
.
ExecuteByUserId
(
auth
,
executeId
,
userId
,
appId
,
modelIds
,
price
)
...
...
dao/eth.go
View file @
53370b76
...
...
@@ -18,7 +18,7 @@ func (d *Dao) LoopGasPrice() {
panic
(
err
)
}
d
.
gasPrice
=
big
.
NewInt
(
0
)
.
Div
(
big
.
NewInt
(
0
)
.
Mul
(
gasPrice
,
big
.
NewInt
(
1
1
)),
big
.
NewInt
(
0
)
.
Mul
(
gasPrice
,
big
.
NewInt
(
1
5
)),
big
.
NewInt
(
10
),
)
...
...
@@ -33,7 +33,7 @@ func (d *Dao) LoopGasPrice() {
continue
}
d
.
gasPrice
=
big
.
NewInt
(
0
)
.
Div
(
big
.
NewInt
(
0
)
.
Mul
(
gasPrice
,
big
.
NewInt
(
1
1
)),
big
.
NewInt
(
0
)
.
Mul
(
gasPrice
,
big
.
NewInt
(
1
5
)),
big
.
NewInt
(
10
),
)
}
...
...
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