Skip to content

Commit

Permalink
fix crash abi parsing
Browse files Browse the repository at this point in the history
key payable is nil and not defined for any functions
  • Loading branch information
nerzh authored Dec 29, 2020
1 parent c6f072e commit 54dcc0b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/web3swift/EthereumABI/ABIParsing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fileprivate func parseFunction(abiRecord:ABI.Record) throws -> ABI.Element.Funct
let abiOutputs = outputs != nil ? outputs! : [ABI.Element.InOut]()
let name = abiRecord.name != nil ? abiRecord.name! : ""
let payable = abiRecord.stateMutability != nil ?
(abiRecord.stateMutability == "payable" || abiRecord.payable!) : false
(abiRecord.stateMutability == "payable" || abiRecord.payable ?? false) : false
let constant = (abiRecord.constant == true || abiRecord.stateMutability == "view" || abiRecord.stateMutability == "pure")
let functionElement = ABI.Element.Function(name: name, inputs: abiInputs, outputs: abiOutputs, constant: constant, payable: payable)
return functionElement
Expand Down

0 comments on commit 54dcc0b

Please sign in to comment.