Module sui::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.
- Struct
DenyList
- Struct
ConfigWriteCap
- Struct
ConfigKey
- Struct
AddressKey
- Struct
GlobalPauseKey
- Struct
PerTypeConfigCreated
- Struct
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 std::ascii;
use std::bcs;
use std::option;
use std::string;
use std::vector;
use sui::address;
use sui::bag;
use sui::config;
use sui::dynamic_field;
use sui::dynamic_object_field;
use sui::event;
use sui::hex;
use sui::object;
use sui::table;
use sui::transfer;
use sui::tx_context;
use sui::vec_set;
Struct DenyList
A shared object that stores the addresses that are blocked for a given core type.
public 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.
public 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.
public 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.
public struct AddressKey has copy, drop, store
Fields
Struct GlobalPauseKey
The setting key used to store the global pause setting in the Config.
public 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.
public struct PerTypeConfigCreated has copy, drop, store
Fields
Struct PerTypeList
Stores the addresses that are denied for a given core type.
public struct PerTypeList has key, store
Fields
Constants
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;
Trying to create a deny list object when not called by the system address.
const ENotSystemAddress: u64 = 0;
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> = vector[0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x403, 0xdee9];
Function v2_add
public(package) fun v2_add(deny_list: &mut sui::deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>, addr: address, ctx: &mut sui::tx_context::TxContext)
Implementation
Function v2_remove
public(package) fun v2_remove(deny_list: &mut sui::deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>, addr: address, ctx: &mut sui::tx_context::TxContext)
Implementation
Function v2_contains_current_epoch
public(package) fun v2_contains_current_epoch(deny_list: &sui::deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>, addr: address, ctx: &sui::tx_context::TxContext): bool
Implementation
Function v2_contains_next_epoch
public(package) fun v2_contains_next_epoch(deny_list: &sui::deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>, addr: address): bool
Implementation
Function v2_enable_global_pause
public(package) fun v2_enable_global_pause(deny_list: &mut sui::deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>, ctx: &mut sui::tx_context::TxContext)
Implementation
Function v2_disable_global_pause
public(package) fun v2_disable_global_pause(deny_list: &mut sui::deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>, ctx: &mut sui::tx_context::TxContext)
Implementation
Function v2_is_global_pause_enabled_current_epoch
public(package) fun v2_is_global_pause_enabled_current_epoch(deny_list: &sui::deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>, ctx: &sui::tx_context::TxContext): bool
Implementation
Function v2_is_global_pause_enabled_next_epoch
public(package) fun v2_is_global_pause_enabled_next_epoch(deny_list: &sui::deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>): bool
Implementation
Function migrate_v1_to_v2
public(package) fun migrate_v1_to_v2(deny_list: &mut sui::deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>, ctx: &mut sui::tx_context::TxContext)
Implementation
Function add_per_type_config
fun add_per_type_config(deny_list: &mut sui::deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>, ctx: &mut sui::tx_context::TxContext)
Implementation
Function borrow_per_type_config_mut
fun borrow_per_type_config_mut(deny_list: &mut sui::deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>): &mut sui::config::Config<sui::deny_list::ConfigWriteCap>
Implementation
Function borrow_per_type_config
fun borrow_per_type_config(deny_list: &sui::deny_list::DenyList, per_type_index: u64, per_type_key: vector<u8>): &sui::config::Config<sui::deny_list::ConfigWriteCap>
Implementation
Function per_type_exists
fun per_type_exists(deny_list: &sui::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(package) fun v1_add(deny_list: &mut sui::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 sui::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(package) fun v1_remove(deny_list: &mut sui::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 sui::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(package) fun v1_contains(deny_list: &sui::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: &sui::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 sui::tx_context::TxContext)
Implementation
Function per_type_list
fun per_type_list(ctx: &mut sui::tx_context::TxContext): sui::deny_list::PerTypeList