Skip to content

Commit

Permalink
Fix failed test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
10gic committed Sep 30, 2024
1 parent 355c345 commit 57eee39
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions swift/Tests/BarzTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ class BarzTests: XCTestCase {
// https://testnet.bscscan.com/tx/0x872f709815a9f79623a349f2f16d93b52c4d5136967bab53a586f045edbe9203
func testSignR1BatchedTransferAccountDeployed() {
let approveFunc = EthereumAbiFunction(name: "approve")
approveFunc.addParamAddress(val: Data(hexString: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789")!, isOutput: false)
approveFunc.addParamUInt256(val: Data(hexString: "8AC7230489E80000")!, isOutput: false)
approveFunc.addParamAddress(value: Data(hexString: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789")!, isOutput: false)
approveFunc.addParamUInt256(value: Data(hexString: "8AC7230489E80000")!, isOutput: false)
let approveCall = EthereumAbi.encode(fn: approveFunc)

let transferFunc = EthereumAbiFunction(name: "transfer")
transferFunc.addParamAddress(val: Data(hexString: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789")!, isOutput: false)
transferFunc.addParamUInt256(val: Data(hexString: "8AC7230489E80000")!, isOutput: false)
transferFunc.addParamAddress(value: Data(hexString: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789")!, isOutput: false)
transferFunc.addParamUInt256(value: Data(hexString: "8AC7230489E80000")!, isOutput: false)
let transferCall = EthereumAbi.encode(fn: transferFunc)

let input = EthereumSigningInput.with {
Expand Down
12 changes: 6 additions & 6 deletions swift/Tests/Blockchains/EthereumAbiTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ class EthereumAbiTests: XCTestCase {
func testAbiEncoder() {
let function = EthereumAbiFunction(name: "sam")
// add params
XCTAssertEqual(0, function.addParamBytes(val: Data(hexString: "0x64617665")!, isOutput: false))
XCTAssertEqual(1, function.addParamBool(val: true, isOutput: false))
XCTAssertEqual(0, function.addParamBytes(value: Data(hexString: "0x64617665")!, isOutput: false))
XCTAssertEqual(1, function.addParamBool(value: true, isOutput: false))
let idx = function.addParamArray(isOutput: false)
XCTAssertEqual(2, idx)
XCTAssertEqual(0, function.addInArrayParamUInt256(arrayIdx: idx, val: Data(hexString: "0x01")!))
XCTAssertEqual(1, function.addInArrayParamUInt256(arrayIdx: idx, val: Data(hexString: "0x02")!))
XCTAssertEqual(2, function.addInArrayParamUInt256(arrayIdx: idx, val: Data(hexString: "0x03")!))
XCTAssertEqual(0, function.addParamUInt64(val: 0, isOutput: true))
XCTAssertEqual(0, function.addInArrayParamUInt256(arrayIdx: idx, value: Data(hexString: "0x01")!))
XCTAssertEqual(1, function.addInArrayParamUInt256(arrayIdx: idx, value: Data(hexString: "0x02")!))
XCTAssertEqual(2, function.addInArrayParamUInt256(arrayIdx: idx, value: Data(hexString: "0x03")!))
XCTAssertEqual(0, function.addParamUInt64(value: 0, isOutput: true))

// check signature
XCTAssertEqual(function.getType(), "sam(bytes,bool,uint256[])")
Expand Down
2 changes: 1 addition & 1 deletion swift/Tests/Blockchains/EthereumTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class EthereumTests: XCTestCase {

func testSignUnstakeRocketPool() {
let function = EthereumAbiFunction(name: "burn")
function.addParamUInt256(val: Data(hexString: "0x21faa32ab2502b")!, isOutput: false)
function.addParamUInt256(value: Data(hexString: "0x21faa32ab2502b")!, isOutput: false)

let input = EthereumSigningInput.with {
$0.chainID = Data(hexString: "01")!
Expand Down

0 comments on commit 57eee39

Please sign in to comment.