Module 0x2::deny_list
Defines the DenyList type. The DenyList shared object is used to restrict access to instances of certain core types from being used as inputs by specified addresses in the deny list.
- Resource
DenyList
- Struct
ConfigWriteCap
- Struct
ConfigKey
- Struct
AddressKey
- Struct
GlobalPauseKey
- Struct
PerTypeConfigCreated
- Resource
PerTypeList
- Constants
- Function
v2_add
- Function
v2_remove
- Function
v2_contains_current_epoch
- Function
v2_contains_next_epoch
- Function
v2_enable_global_pause
- Function
v2_disable_global_pause
- Function
v2_is_global_pause_enabled_current_epoch
- Function
v2_is_global_pause_enabled_next_epoch
- Function
migrate_v1_to_v2
- Function
add_per_type_config
- Function
borrow_per_type_config_mut
- Function
borrow_per_type_config
- Function
per_type_exists
- Function
v1_add
- Function
v1_per_type_list_add
- Function
v1_remove
- Function
v1_per_type_list_remove
- Function
v1_contains
- Function
v1_per_type_list_contains
- Function
create
- Function
per_type_list
use 0x1::option;
use 0x1::vector;
use 0x2::bag;
use 0x2::config;
use 0x2::dynamic_object_field;
use 0x2::event;
use 0x2::object;
use 0x2::table;
use 0x2::transfer;
use 0x2::tx_context;
use 0x2::vec_set;
Resource DenyList
A shared object that stores the addresses that are blocked for a given core type.
struct DenyList has key
Fields
Struct ConfigWriteCap
The capability used to write to the deny list config. Ensures that the Configs for the DenyList are modified only by this module.
struct ConfigWriteCap has drop
Fields
Struct ConfigKey
The dynamic object field key used to store the Config for a given type, essentially a (per_type_index, per_type_key) pair.
struct ConfigKey has copy, drop, store
Fields
Struct AddressKey
The setting key used to store the deny list for a given address in the Config.
struct AddressKey has copy, drop, store
Fields
Struct GlobalPauseKey
The setting key used to store the global pause setting in the Config.
struct GlobalPauseKey has copy, drop, store
Fields
Struct PerTypeConfigCreated
The event emitted when a new Config is created for a given type. This can be useful for tracking the ID of a type's Config object.
struct PerTypeConfigCreated has copy, drop, store
Fields
Resource PerTypeList
Stores the addresses that are denied for a given core type.
struct PerTypeList has store, key
Fields
Constants
Trying to create a deny list object when not called by the system address.
const ENotSystemAddress: u64 = 0;
The index into the deny list vector for the sui::coin::Coin type.
const COIN_INDEX: u64 = 0;
The specified address cannot be added to the deny list.
const EInvalidAddress: u64 = 1;
The specified address to be removed is not already in the deny list.
const ENotDenied: u64 = 1;
These addresses are reserved and cannot be added to the deny list. The addresses listed are well known package and object addresses. So it would be meaningless to add them to the deny list.
const RESERVED: vector<address> = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1027, 57065];
Function v2_add
public(friend) fun v2_add(deny_list: &mut deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>, addr: address, ctx: &mut tx_context::TxContext)
Implementation
Function v2_remove
public(friend) fun v2_remove(deny_list: &mut deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>, addr: address, ctx: &mut tx_context::TxContext)
Implementation
Function v2_contains_current_epoch
public(friend) fun v2_contains_current_epoch(deny_list: &deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>, addr: address, ctx: &tx_context::TxContext): bool
Implementation
Function v2_contains_next_epoch
public(friend) fun v2_contains_next_epoch(deny_list: &deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>, addr: address): bool
Implementation
Function v2_enable_global_pause
public(friend) fun v2_enable_global_pause(deny_list: &mut deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>, ctx: &mut tx_context::TxContext)
Implementation
Function v2_disable_global_pause
public(friend) fun v2_disable_global_pause(deny_list: &mut deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>, ctx: &mut tx_context::TxContext)
Implementation
Function v2_is_global_pause_enabled_current_epoch
public(friend) fun v2_is_global_pause_enabled_current_epoch(deny_list: &deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>, ctx: &tx_context::TxContext): bool
Implementation
Function v2_is_global_pause_enabled_next_epoch
public(friend) fun v2_is_global_pause_enabled_next_epoch(deny_list: &deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>): bool
Implementation
Function migrate_v1_to_v2
public(friend) fun migrate_v1_to_v2(deny_list: &mut deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>, ctx: &mut tx_context::TxContext)
Implementation
Function add_per_type_config
fun add_per_type_config(deny_list: &mut deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>, ctx: &mut tx_context::TxContext)
Implementation
Function borrow_per_type_config_mut
fun borrow_per_type_config_mut(deny_list: &mut deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>): &mut config::Config<deny_list::ConfigWriteCap>
Implementation
Function borrow_per_type_config
fun borrow_per_type_config(deny_list: &deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>): &config::Config<deny_list::ConfigWriteCap>
Implementation
Function per_type_exists
fun per_type_exists(deny_list: &deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>): bool
Implementation
Function v1_add
Adds the given address to the deny list of the specified type, preventing it from interacting with instances of that type as an input to a transaction. For coins, the type specified is the type of the coin, not the coin type itself. For example, "00...0123::my_coin::MY_COIN" would be the type, not "00...02::coin::Coin".
public(friend) fun v1_add(deny_list: &mut deny_list::DenyList, per_type_index: u64, type: vector<u8>, addr: address)
Implementation
Function v1_per_type_list_add
fun v1_per_type_list_add(list: &mut deny_list::PerTypeList, type: vector<u8>, addr: address)
Implementation
Function v1_remove
Removes a previously denied address from the list. Aborts with ENotDenied if the address is not on the list.
public(friend) fun v1_remove(deny_list: &mut deny_list::DenyList, per_type_index: u64, type: vector<u8>, addr: address)
Implementation
Function v1_per_type_list_remove
fun v1_per_type_list_remove(list: &mut deny_list::PerTypeList, type: vector<u8>, addr: address)
Implementation
Function v1_contains
Returns true iff the given address is denied for the given type.
public(friend) fun v1_contains(deny_list: &deny_list::DenyList, per_type_index: u64, type: vector<u8>, addr: address): bool
Implementation
Function v1_per_type_list_contains
fun v1_per_type_list_contains(list: &deny_list::PerTypeList, type: vector<u8>, addr: address): bool
Implementation
Function create
Creation of the deny list object is restricted to the system address via a system transaction.
fun create(ctx: &mut tx_context::TxContext)
Implementation
Function per_type_list
fun per_type_list(ctx: &mut tx_context::TxContext): deny_list::PerTypeList