Skip to content

Instantly share code, notes, and snippets.

@KardanovIR
Created June 9, 2020 13:41
Show Gist options
  • Select an option

  • Save KardanovIR/ee1f3af6f43ea3ebfeca6d1ed7366c76 to your computer and use it in GitHub Desktop.

Select an option

Save KardanovIR/ee1f3af6f43ea3ebfeca6d1ed7366c76 to your computer and use it in GitHub Desktop.
{-# 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