with new redeem encoding

pull/255/head
James Sangalli 7 years ago
parent f4d76c8d7f
commit 5e0d1e4a6d
  1. 4
      Trust/Redeem/Helpers/CreateRedeem.swift
  2. 2
      Trust/Settings/Types/Constants.swift
  3. 5
      Trust/Tokens/Coordinators/TokensCoordinator.swift
  4. 5
      Trust/Tokens/ViewModels/TokensViewModel.swift
  5. 4
      Trust/Transactions/Coordinators/TicketsCoordinator.swift
  6. 2
      TrustTests/Market/UniversalLinkHandlerTests.swift

@ -16,7 +16,9 @@ class CreateRedeem {
} }
func redeemMessage(ticketIndices: [UInt16]) -> (message: String, qrCode: String) { func redeemMessage(ticketIndices: [UInt16]) -> (message: String, qrCode: String) {
let messageForSigning = formIndicesSelection(indices: ticketIndices) + "," + generateTimeStamp() let messageForSigning = formIndicesSelection(indices: ticketIndices)
+ "," + generateTimeStamp() + "," +
Constants.ticketContractAddress.lowercased()
let qrCodeData = formIndicesSelection(indices: ticketIndices) let qrCodeData = formIndicesSelection(indices: ticketIndices)
return (messageForSigning, qrCodeData) return (messageForSigning, qrCodeData)
} }

@ -29,7 +29,7 @@ public struct Constants {
public static let dappsBrowserURL = "https://dapps.trustwalletapp.com" public static let dappsBrowserURL = "https://dapps.trustwalletapp.com"
// FIFA hardcoded FIFA token address. Look for "//FIFA" for relevant changes // FIFA hardcoded FIFA token address. Look for "//FIFA" for relevant changes
public static let fifaContractAddress = "0x4eBacaE9E9901f0E50026AD021ea5Bab82402bf7" public static let ticketContractAddress = "0x277b1318965030C62E1dAc9671a6F8dF77F855Cf"
public static let nullTicket = "0x0000000000000000000000000000000000000000000000000000000000000000" public static let nullTicket = "0x0000000000000000000000000000000000000000000000000000000000000000"
public static let event = "FIFA WC 2018" public static let event = "FIFA WC 2018"
} }

@ -84,12 +84,13 @@ class TokensCoordinator: Coordinator {
//FIFA add the FIFA token with a hardcoded address if not already present //FIFA add the FIFA token with a hardcoded address if not already present
private func addFIFAToken() { private func addFIFAToken() {
let fifaTokenPresent = storage.enabledObject.contains{ $0.address.eip55String == Constants.fifaContractAddress } let fifaTokenPresent = storage.enabledObject.contains{ $0.address.eip55String == Constants.ticketContractAddress
}
if fifaTokenPresent { if fifaTokenPresent {
return return
} }
let token = ERC20Token( let token = ERC20Token(
contract: Address(string: Constants.fifaContractAddress)!, contract: Address(string: Constants.ticketContractAddress)!,
name: "AlphaWallet Test Tickets", name: "AlphaWallet Test Tickets",
symbol: "AWTT", symbol: "AWTT",
decimals: 0, decimals: 0,

@ -88,7 +88,7 @@ class TokensViewModel {
func canDelete(for row: Int, section: Int) -> Bool { func canDelete(for row: Int, section: Int) -> Bool {
let token = item(for: row, section: section) let token = item(for: row, section: section)
return token.isCustom && token.contract.lowercased() != Constants.fifaContractAddress.lowercased() return token.isCustom && token.contract.lowercased() != Constants.ticketContractAddress.lowercased()
} }
var footerTextColor: UIColor { var footerTextColor: UIColor {
@ -109,7 +109,8 @@ class TokensViewModel {
//FIFA make the FIFA token be index 1. Can remove the function and replace with the argument when we no longer need this //FIFA make the FIFA token be index 1. Can remove the function and replace with the argument when we no longer need this
private func reorderTokensSoFIFAAtIndex1(tokens: [TokenObject]) -> [TokenObject] { private func reorderTokensSoFIFAAtIndex1(tokens: [TokenObject]) -> [TokenObject] {
let index = tokens.index { $0.address.eip55String == Constants.fifaContractAddress } let index = tokens.index { $0.address.eip55String == Constants.ticketContractAddress
}
if let index = index, tokens.count >= 2 { if let index = index, tokens.count >= 2 {
var reorderedTokens = tokens var reorderedTokens = tokens
let target = reorderedTokens[index] let target = reorderedTokens[index]

@ -270,7 +270,7 @@ class TicketsCoordinator: NSObject, Coordinator {
price: BigUInt("0")!, price: BigUInt("0")!,
indices: ticketHolder.indices, indices: ticketHolder.indices,
expiry: BigUInt(timestamp.description)!, expiry: BigUInt(timestamp.description)!,
contractAddress: Constants.fifaContractAddress, contractAddress: Constants.ticketContractAddress,
start: BigUInt("0")!, start: BigUInt("0")!,
count: ticketHolder.indices.count count: ticketHolder.indices.count
) )
@ -292,7 +292,7 @@ class TicketsCoordinator: NSObject, Coordinator {
price: wei, price: wei,
indices: ticketHolder.indices, indices: ticketHolder.indices,
expiry: BigUInt(Int(linkExpiryDate.timeIntervalSince1970)), expiry: BigUInt(Int(linkExpiryDate.timeIntervalSince1970)),
contractAddress: Constants.fifaContractAddress, contractAddress: Constants.ticketContractAddress,
start: BigUInt("0")!, start: BigUInt("0")!,
count: ticketHolder.indices.count count: ticketHolder.indices.count
) )

@ -25,7 +25,7 @@ class UniversalLinkHandlerTests: XCTestCase {
let testOrder1 = Order(price: BigUInt("1000000000")!, let testOrder1 = Order(price: BigUInt("1000000000")!,
indices: indices, indices: indices,
expiry: BigUInt("0")!, expiry: BigUInt("0")!,
contractAddress: Constants.fifaContractAddress, contractAddress: Constants.ticketContractAddress,
start: BigUInt("91239231313")!, start: BigUInt("91239231313")!,
count: 3 count: 3
) )

Loading…
Cancel
Save