@@ -172,7 +172,7 @@ func (abi *ABI) UnmarshalJSON(data []byte) error {
172172 case "fallback" :
173173 // New introduced function type in v0.6.0, check more detail
174174 // here https://solidity.readthedocs.io/en/v0.6.0/contracts.html#fallback-function
175- if abi .Fallback . Fallback {
175+ if abi .HasFallback () {
176176 return errors .New ("only single fallback is allowed" )
177177 }
178178 abi .Fallback = Method {
@@ -182,7 +182,7 @@ func (abi *ABI) UnmarshalJSON(data []byte) error {
182182 // The `StateMutability` can only be payable or nonpayable,
183183 // so the constant is always false.
184184 StateMutability : field .StateMutability ,
185- Fallback : true ,
185+ IsFallback : true ,
186186
187187 // Fallback doesn't have any input or output
188188 Inputs : nil ,
@@ -195,7 +195,7 @@ func (abi *ABI) UnmarshalJSON(data []byte) error {
195195 case "receive" :
196196 // New introduced function type in v0.6.0, check more detail
197197 // here https://solidity.readthedocs.io/en/v0.6.0/contracts.html#fallback-function
198- if abi .Receive . Receive {
198+ if abi .HasReceive () {
199199 return errors .New ("only single receive is allowed" )
200200 }
201201 if field .StateMutability != "payable" {
@@ -208,7 +208,7 @@ func (abi *ABI) UnmarshalJSON(data []byte) error {
208208 // The `StateMutability` can only be payable, so constant
209209 // is always true while payable is always false.
210210 StateMutability : field .StateMutability ,
211- Receive : true ,
211+ IsReceive : true ,
212212
213213 // Receive doesn't have any input or output
214214 Inputs : nil ,
@@ -260,3 +260,13 @@ func (abi *ABI) EventByID(topic common.Hash) (*Event, error) {
260260 }
261261 return nil , fmt .Errorf ("no event with id: %#x" , topic .Hex ())
262262}
263+
264+ // HasFallback returns an indicator whether a fallback function is included.
265+ func (abi * ABI ) HasFallback () bool {
266+ return abi .Fallback .IsFallback
267+ }
268+
269+ // HasReceive returns an indicator whether a receive function is included.
270+ func (abi * ABI ) HasReceive () bool {
271+ return abi .Receive .IsReceive
272+ }
0 commit comments