Created
April 8, 2018 18:34
-
-
Save azamsharp/bec75507e921dddbe6e68ea5e2848225 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
class DrivingRecordSmartContract : Codable { | |
func apply(transaction :Transaction, allBlocks :[Block]) { | |
allBlocks.forEach { block in | |
block.transactions.forEach { trans in | |
if trans.driverLicenseNumber == transaction.driverLicenseNumber { | |
transaction.noOfVoilations += 1 | |
} | |
if transaction.noOfVoilations > 5 { | |
transaction.isDrivingLicenseSuspended = true | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment