Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Fix abi parsing #1

Merged
merged 2 commits into from
Oct 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/web3swift/EthereumABI/ABIParsing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ 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
}

fileprivate func parseFallback(abiRecord:ABI.Record) throws -> ABI.Element.Fallback {
let payable = (abiRecord.stateMutability == "payable" || abiRecord.payable!)
let payable = (abiRecord.stateMutability == "payable" || (abiRecord.payable ?? false))
var constant = abiRecord.constant == true
if (abiRecord.stateMutability == "view" || abiRecord.stateMutability == "pure") {
constant = true
Expand Down