Skip to content
Discussion options

You must be logged in to vote

There are no specific libraries for access control, but you can take a look at a couple possible access control paths:

Hardcoded and / or modifiable allow list

module 0x1::mod {
  
  const ALLOWED_ADDRESSES: vector<address> = [@0x1, @0x2, @0x3];

  /// No allowlist found at address
  const E_NO_ALLOWLIST: u64 = 1;
  /// Address is not on allow list
  const E_NOT_ALLOWED: u64 = 2;
  
  /// A modifiable allowlist
  struct AccessControlList has key {
    allowed: vector<address>
  }
  
  /// Add addresses to ACL
  entry fun add_addresses(caller: &signer, addresses: vector<address>) {
    let caller_address = signer::address_of(caller);
    
    // If the ACL doesn't exist, create one
    if (!

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gregnazario
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant