Created
January 4, 2018 20:30
-
-
Save azamsharp/9562fd8ad2d50d239cb3f5b1d0337aec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct BrokenRule : Codable { | |
var contractName :String | |
var message :String | |
} | |
class Transaction : Codable { | |
var from :String | |
var to :String | |
var amount :Double | |
var fees :Double = 0.0 | |
var transactionType :TranslationType = .domestic | |
var brokenRules :[BrokenRule] = [BrokenRule]() | |
var isValid :Bool { | |
get { | |
return self.brokenRules.count == 0 | |
} | |
} | |
init(from :String, to:String, amount :Double, transactionType :TranslationType = .domestic) { | |
self.from = from | |
self.to = to | |
self.amount = amount | |
self.transactionType = transactionType | |
} | |
func addBrokenRule(_ brokenRule :BrokenRule) { | |
self.brokenRules.append(brokenRule) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment