Created
March 4, 2020 07:28
-
-
Save ayende/2d7f0c3bf743db663cf974aa726b4ccf to your computer and use it in GitHub Desktop.
This file contains 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
declare function SourceAccountIsValid(src, dst, req){ | |
} | |
declare function SourceAccountHasFunds(src, dst, req){ | |
} | |
declare function validate_transfer(src, dst, req){ | |
var rules = [SourceAccountIsValid, SourceAccountHasFunds, | |
SourceAccountDailyLimitNotExceed, DestinationAccountHasNoLiens, | |
DestinationAccountMaxAmountNotExceeded, MoneyTransferIsNotFromDirtyBitcoins | |
]; | |
var errors = rules.map(rule=> rule(src, dst, req).filter(x=>x!= null); | |
return { Errors: errors, Valid: errores.length == 0 }; | |
} | |
from Accounts as src | |
where id(src) == $source | |
load $destination as dst | |
select { | |
Source: src, | |
Destination: dst, | |
Valid: validate_transfer(src, dst, $req) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment