aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJimmy Hu <jimmy.hu@dexon.org>2019-01-25 17:33:39 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-06-12 17:27:21 +0800
commit4685e38fc95b7f0ac3c0ecaec56e7efab3eb4607 (patch)
tree509140f9b28da6676a1da53e7dcb727c5fad3ae2 /core
parentef3bd319b0eb42d4d00cf9536b1e7264be097784 (diff)
downloadgo-tangerine-4685e38fc95b7f0ac3c0ecaec56e7efab3eb4607.tar
go-tangerine-4685e38fc95b7f0ac3c0ecaec56e7efab3eb4607.tar.gz
go-tangerine-4685e38fc95b7f0ac3c0ecaec56e7efab3eb4607.tar.bz2
go-tangerine-4685e38fc95b7f0ac3c0ecaec56e7efab3eb4607.tar.lz
go-tangerine-4685e38fc95b7f0ac3c0ecaec56e7efab3eb4607.tar.xz
go-tangerine-4685e38fc95b7f0ac3c0ecaec56e7efab3eb4607.tar.zst
go-tangerine-4685e38fc95b7f0ac3c0ecaec56e7efab3eb4607.zip
core: vm: Add amount to undelegate event (#176)
Diffstat (limited to 'core')
-rw-r--r--core/vm/governance.go8
-rw-r--r--core/vm/governance_abi.go5
2 files changed, 9 insertions, 4 deletions
diff --git a/core/vm/governance.go b/core/vm/governance.go
index b400ba61b..684e22104 100644
--- a/core/vm/governance.go
+++ b/core/vm/governance.go
@@ -1442,12 +1442,12 @@ func (s *GovernanceStateHelper) emitDelegated(nodeAddr, delegatorAddr common.Add
})
}
-// event Undelegated(address indexed NodeAddress, address indexed DelegatorAddress);
-func (s *GovernanceStateHelper) emitUndelegated(nodeAddr, delegatorAddr common.Address) {
+// event Undelegated(address indexed NodeAddress, address indexed DelegatorAddress, uint256 Amount);
+func (s *GovernanceStateHelper) emitUndelegated(nodeAddr, delegatorAddr common.Address, amount *big.Int) {
s.StateDB.AddLog(&types.Log{
Address: GovernanceContractAddress,
Topics: []common.Hash{events["Undelegated"].Id(), nodeAddr.Hash(), delegatorAddr.Hash()},
- Data: []byte{},
+ Data: common.BigToHash(amount).Bytes(),
})
}
@@ -1883,7 +1883,7 @@ func (g *GovernanceContract) undelegateHelper(nodeAddr, caller common.Address) (
// Subtract to network total staked.
g.state.DecTotalStaked(delegator.Value)
- g.state.emitUndelegated(nodeAddr, caller)
+ g.state.emitUndelegated(nodeAddr, caller, delegator.Value)
return g.useGas(100000)
}
diff --git a/core/vm/governance_abi.go b/core/vm/governance_abi.go
index 4627050dc..c3ad691b6 100644
--- a/core/vm/governance_abi.go
+++ b/core/vm/governance_abi.go
@@ -700,6 +700,11 @@ const GovernanceABIJSON = `
"indexed": true,
"name": "DelegatorAddress",
"type": "address"
+ },
+ {
+ "indexed": false,
+ "name": "Amount",
+ "type": "uint256"
}
],
"name": "Undelegated",