Skip to content

Commit b4c8649

Browse files
chore: fixed a few warnings
1 parent 04ec15d commit b4c8649

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

Sources/web3swift/EthereumABI/ABIParsing.swift

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,15 @@ fileprivate func parseFunction(abiRecord:ABI.Record) throws -> ABI.Element.Funct
8282
})
8383
let abiOutputs = outputs ?? [ABI.Element.InOut]()
8484
let name = abiRecord.name ?? ""
85-
let payable = abiRecord.stateMutability == "payable" || abiRecord.payable ?? false
86-
let constant = (abiRecord.constant == true || abiRecord.stateMutability == "view" || abiRecord.stateMutability == "pure")
85+
let payable = abiRecord.stateMutability == "payable" || abiRecord.payable == true
86+
let constant = abiRecord.constant == true || abiRecord.stateMutability == "view" || abiRecord.stateMutability == "pure"
8787
let functionElement = ABI.Element.Function(name: name, inputs: abiInputs, outputs: abiOutputs, constant: constant, payable: payable)
8888
return functionElement
8989
}
9090

9191
fileprivate func parseFallback(abiRecord:ABI.Record) throws -> ABI.Element.Fallback {
9292
let payable = (abiRecord.stateMutability == "payable" || abiRecord.payable == true)
93-
var constant = abiRecord.constant == true
94-
if (abiRecord.stateMutability == "view" || abiRecord.stateMutability == "pure") {
95-
constant = true
96-
}
93+
let constant = abiRecord.constant == true || abiRecord.stateMutability == "view" || abiRecord.stateMutability == "pure"
9794
let functionElement = ABI.Element.Fallback(constant: constant, payable: payable)
9895
return functionElement
9996
}
@@ -104,7 +101,7 @@ fileprivate func parseConstructor(abiRecord:ABI.Record) throws -> ABI.Element.Co
104101
return nativeInput
105102
})
106103
let abiInputs = inputs ?? [ABI.Element.InOut]()
107-
var payable = abiRecord.stateMutability == "payable" || abiRecord.payable ?? false
104+
let payable = abiRecord.stateMutability == "payable" || abiRecord.payable == true
108105
let functionElement = ABI.Element.Constructor(inputs: abiInputs, constant: false, payable: payable)
109106
return functionElement
110107
}
@@ -127,7 +124,7 @@ fileprivate func parseReceive(abiRecord:ABI.Record) throws -> ABI.Element.Receiv
127124
return nativeInput
128125
})
129126
let abiInputs = inputs ?? [ABI.Element.InOut]()
130-
var payable = abiRecord.stateMutability == "payable" || abiRecord.payable ?? false
127+
let payable = abiRecord.stateMutability == "payable" || abiRecord.payable == true
131128
let functionElement = ABI.Element.Receive(inputs: abiInputs, payable: payable)
132129
return functionElement
133130
}

0 commit comments

Comments
 (0)