Created
June 9, 2020 13:41
-
-
Save KardanovIR/ee1f3af6f43ea3ebfeca6d1ed7366c76 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
| {-# STDLIB_VERSION 4 #-} | |
| {-# CONTENT_TYPE DAPP #-} | |
| {-# SCRIPT_TYPE ACCOUNT #-} | |
| let adminPublicKey = base58'...' | |
| func addToWhiteList(address: String) = { | |
| let userInTheList = getBoolean(this, address) | |
| let newValue = match userInTheList { | |
| case b: Boolean => { | |
| if b then throw("User is already in the list and enabled") | |
| else true | |
| } | |
| case _ => true | |
| } | |
| if i.callerPublicKey != adminPublicKey then throw("Only admin can call this function") else | |
| [ | |
| [BooleanEntry(address, newValue)] | |
| ] | |
| } | |
| @Callable(i) | |
| func removeFromWhiteList(address: String) = { | |
| if i.callerPublicKey != adminPublicKey then throw("Only admin can call this function") | |
| else [BooleanEntry(address, false)] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment