0x1::TransactionTimeoutConfig
Onchain configuration for timeout setting of transaction.
TransactionTimeoutConfig
initialize
new_transaction_timeout_config
get_transaction_timeout_config
duration_seconds
use 0x1::Config;
use 0x1::CoreAddresses;
use 0x1::Timestamp;
TransactionTimeoutConfig
config structs.
struct TransactionTimeoutConfig has copy, drop, store
duration_seconds: u64
initialize
Initialize function. Should only be called in genesis.
public fun initialize(account: &signer, duration_seconds: u64)
public fun initialize(account: &signer, duration_seconds: u64) {
Timestamp::assert_genesis();
CoreAddresses::assert_genesis_address(account);
Config::publish_new_config<Self::TransactionTimeoutConfig>(
account,
new_transaction_timeout_config(duration_seconds)
);
}
aborts_if !Timestamp::is_genesis();
aborts_if Signer::address_of(account) != CoreAddresses::GENESIS_ADDRESS();
include Config::PublishNewConfigAbortsIf<TransactionTimeoutConfig>;
include Config::PublishNewConfigEnsures<TransactionTimeoutConfig>;
new_transaction_timeout_config
Create a new timeout config used in dao proposal.
public fun new_transaction_timeout_config(duration_seconds: u64): TransactionTimeoutConfig::TransactionTimeoutConfig
public fun new_transaction_timeout_config(duration_seconds: u64) : TransactionTimeoutConfig {
TransactionTimeoutConfig {duration_seconds: duration_seconds}
}
aborts_if false;
get_transaction_timeout_config
Get current timeout config.
public fun get_transaction_timeout_config(): TransactionTimeoutConfig::TransactionTimeoutConfig
public fun get_transaction_timeout_config(): TransactionTimeoutConfig {
Config::get_by_address<TransactionTimeoutConfig>(CoreAddresses::GENESIS_ADDRESS())
}
include Config::AbortsIfConfigNotExist<TransactionTimeoutConfig>{
addr: CoreAddresses::GENESIS_ADDRESS()
};
duration_seconds
Get current txn timeout in seconds.
public fun duration_seconds(): u64
public fun duration_seconds() :u64 {
let config = get_transaction_timeout_config();
config.duration_seconds
}
include Config::AbortsIfConfigNotExist<TransactionTimeoutConfig>{
addr: CoreAddresses::GENESIS_ADDRESS()
};
schema AbortsIfTxnTimeoutConfigNotExist {
include Config::AbortsIfConfigNotExist<TransactionTimeoutConfig>{
addr: CoreAddresses::GENESIS_ADDRESS()
};
}
pragma verify = false;
pragma aborts_if_is_strict = true;