good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
66b51325
Unverified
Commit
66b51325
authored
5 years ago
by
Jaynti Kanani
Browse files
Options
Downloads
Patches
Plain Diff
add transfer and fee log
parent
4433db35
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/state_transition.go
+65
-15
65 additions, 15 deletions
core/state_transition.go
with
65 additions
and
15 deletions
core/state_transition.go
+
65
−
15
View file @
66b51325
...
...
@@ -32,6 +32,10 @@ var (
errInsufficientBalanceForGas
=
errors
.
New
(
"insufficient balance to pay for gas"
)
)
var
transferLogSig
=
common
.
HexToHash
(
"0xe6497e3ee548a3372136af2fcb0696db31fc6cf20260707645068bd3fe97f3c4"
)
var
transferFeeLogSig
=
common
.
HexToHash
(
"0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63"
)
var
feeAddress
=
common
.
HexToAddress
(
"0x0000000000000000000000000000000000001010"
)
/*
The State Transitioning Model
...
...
@@ -229,11 +233,11 @@ func (st *StateTransition) TransitionDb() (ret []byte, usedGas uint64, failed bo
st
.
state
.
AddBalance
(
st
.
evm
.
Coinbase
,
new
(
big
.
Int
)
.
Mul
(
new
(
big
.
Int
)
.
SetUint64
(
st
.
gasUsed
()),
st
.
gasPrice
))
amount
:=
new
(
big
.
Int
)
.
Mul
(
new
(
big
.
Int
)
.
SetUint64
(
st
.
gasUsed
()),
st
.
gasPrice
)
output1
:=
new
(
big
.
Int
)
.
Set
Uint64
(
input1
.
Uint64
())
output2
:=
new
(
big
.
Int
)
.
Set
Uint64
(
input2
.
Uint64
())
output1
:=
new
(
big
.
Int
)
.
Set
Bytes
(
input1
.
Bytes
())
output2
:=
new
(
big
.
Int
)
.
Set
Bytes
(
input2
.
Bytes
())
// add transfer log
AddTransferLog
(
Add
Fee
TransferLog
(
st
.
state
,
msg
.
From
(),
...
...
@@ -284,18 +288,63 @@ func AddTransferLog(
output1
,
output2
*
big
.
Int
,
)
{
addTransferLog
(
state
,
transferLogSig
,
sender
,
recipient
,
// // add tranfer
// db.AddLog(&types.Log{
// Address: common.HexToAddress("0x0000000000000000000000000000000000001010"),
// Topics: []common.Hash{
// common.HexToHash("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"),
// sender.Hash(),
// recipient.Hash(),
// },
// Data: common.BytesToHash(amount.Bytes()).Bytes(),
// })
amount
,
input1
,
input2
,
output1
,
output2
,
)
}
// AddFeeTransferLog adds transfer log into state
func
AddFeeTransferLog
(
state
vm
.
StateDB
,
sender
,
recipient
common
.
Address
,
amount
,
input1
,
input2
,
output1
,
output2
*
big
.
Int
,
)
{
addTransferLog
(
state
,
transferFeeLogSig
,
sender
,
recipient
,
amount
,
input1
,
input2
,
output1
,
output2
,
)
}
// addTransferLog adds transfer log into state
func
addTransferLog
(
state
vm
.
StateDB
,
eventSig
common
.
Hash
,
sender
,
recipient
common
.
Address
,
amount
,
input1
,
input2
,
output1
,
output2
*
big
.
Int
,
)
{
dataInputs
:=
[]
*
big
.
Int
{
amount
,
input1
,
...
...
@@ -311,9 +360,10 @@ func AddTransferLog(
// add transfer log
state
.
AddLog
(
&
types
.
Log
{
Address
:
common
.
HexToAddress
(
"0x0000000000000000000000000000000000001010"
)
,
Address
:
feeAddress
,
Topics
:
[]
common
.
Hash
{
common
.
HexToHash
(
"0xe6497e3ee548a3372136af2fcb0696db31fc6cf20260707645068bd3fe97f3c4"
),
eventSig
,
feeAddress
.
Hash
(),
sender
.
Hash
(),
recipient
.
Hash
(),
},
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment