Skip to content
This repository was archived by the owner on Sep 13, 2024. It is now read-only.

Commit fe9b655

Browse files
committed
Fixed SolidityFunction encoding for dynamic arrays #276
1 parent 0e1c730 commit fe9b655

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Sources/web3swift/Transactions/SolidityTypes.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public class SolidityType: Equatable, CustomStringConvertible {
176176
public class SDynamicArray: SolidityType {
177177
public override var description: String { return "\(type)[]" }
178178
public override var memoryUsage: Int { return 0 }
179-
public override var isStatic: Bool { return type.isStatic }
179+
public override var isStatic: Bool { return false }
180180
public override var isArray: Bool { return true }
181181
public override var subtype: SolidityType? { return type }
182182
public override var arraySize: ArraySize { return .dynamic }

Tests/web3swiftTests/BetterABI/SolidityFunctionTests.swift

+6
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,10 @@ class SolidityFunctionTests: XCTestCase {
138138
XCTAssertEqual(message, bigString)
139139
XCTAssertEqual(b, 800)
140140
}
141+
142+
func testEncode() throws {
143+
let function = try SolidityFunction(function: "send(uint256,uint256[],string)")
144+
let data = function.encode(150000,[65535,8191],"abc")
145+
XCTAssertEqual(data.hex, "602c15e100000000000000000000000000000000000000000000000000000000000249f0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000ffff0000000000000000000000000000000000000000000000000000000000001fff00000000000000000000000000000000000000000000000000000000000000036162630000000000000000000000000000000000000000000000000000000000")
146+
}
141147
}

0 commit comments

Comments
 (0)