diff options
author | Jimmy Hu <jimmy.hu@dexon.org> | 2019-01-25 17:33:39 +0800 |
---|---|---|
committer | Wei-Ning Huang <w@dexon.org> | 2019-01-25 17:33:39 +0800 |
commit | 5c706ccb99698ba6c166429aaebfca590cf36755 (patch) | |
tree | 1a6d4f1271add1223e6b18a6981ce5e278d8e7f0 | |
parent | 67aecb871a0ca9ffeefdfd8561bf44b3d047fcd6 (diff) | |
download | dexon-5c706ccb99698ba6c166429aaebfca590cf36755.tar dexon-5c706ccb99698ba6c166429aaebfca590cf36755.tar.gz dexon-5c706ccb99698ba6c166429aaebfca590cf36755.tar.bz2 dexon-5c706ccb99698ba6c166429aaebfca590cf36755.tar.lz dexon-5c706ccb99698ba6c166429aaebfca590cf36755.tar.xz dexon-5c706ccb99698ba6c166429aaebfca590cf36755.tar.zst dexon-5c706ccb99698ba6c166429aaebfca590cf36755.zip |
core: vm: Add amount to undelegate event (#176)
-rw-r--r-- | core/vm/governance.go | 8 | ||||
-rw-r--r-- | core/vm/governance_abi.go | 5 |
2 files changed, 9 insertions, 4 deletions
diff --git a/core/vm/governance.go b/core/vm/governance.go index 8935356fb..1e55c4045 100644 --- a/core/vm/governance.go +++ b/core/vm/governance.go @@ -1444,12 +1444,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(), }) } @@ -1885,7 +1885,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 e42f2cad7..86d3a59b2 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", |