Skip to content

Commit 8454fc7

Browse files
authored
CIP 55: Remove Tobin Tax (#2029)
* Don't apply tobin tax after g-hardfork * Fix debug setting in tobin tax code
1 parent 7521f9d commit 8454fc7

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

core/vm/vmcontext/context.go

+18-13
Original file line numberDiff line numberDiff line change
@@ -154,19 +154,24 @@ func TobinTransfer(evm *vm.EVM, sender, recipient common.Address, amount *big.In
154154
defer func() { evm.SetDebug(true) }()
155155
}
156156

157-
if amount.Cmp(big.NewInt(0)) != 0 {
158-
caller := &SharedEVMRunner{evm}
159-
tax, taxRecipient, err := reserve.ComputeTobinTax(caller, sender, amount)
160-
if err == nil {
161-
Transfer(evm.StateDB, sender, recipient, new(big.Int).Sub(amount, tax))
162-
Transfer(evm.StateDB, sender, taxRecipient, tax)
163-
return
164-
} else {
165-
log.Error("Failed to get tobin tax", "error", err)
157+
// Only deduct tobin tax before the g hardfork
158+
if evm.ChainConfig().IsGFork(evm.Context.BlockNumber) {
159+
Transfer(evm.StateDB, sender, recipient, amount)
160+
} else {
161+
if amount.Cmp(big.NewInt(0)) != 0 {
162+
caller := &SharedEVMRunner{evm}
163+
tax, taxRecipient, err := reserve.ComputeTobinTax(caller, sender, amount)
164+
if err == nil {
165+
Transfer(evm.StateDB, sender, recipient, new(big.Int).Sub(amount, tax))
166+
Transfer(evm.StateDB, sender, taxRecipient, tax)
167+
return
168+
} else {
169+
log.Error("Failed to get tobin tax", "error", err)
170+
}
166171
}
167-
}
168172

169-
// Complete a normal transfer if the amount is 0 or the tobin tax value is unable to be fetched and parsed.
170-
// We transfer even when the amount is 0 because state trie clearing [EIP161] is necessary at the end of a transaction
171-
Transfer(evm.StateDB, sender, recipient, amount)
173+
// Complete a normal transfer if the amount is 0 or the tobin tax value is unable to be fetched and parsed.
174+
// We transfer even when the amount is 0 because state trie clearing [EIP161] is necessary at the end of a transaction
175+
Transfer(evm.StateDB, sender, recipient, amount)
176+
}
172177
}

0 commit comments

Comments
 (0)