Onchain configuration for timeout setting of transaction.
- Struct
TransactionTimeoutConfig
- Function
initialize
- Function
new_transaction_timeout_config
- Function
get_transaction_timeout_config
- Function
duration_seconds
- Module Specification
use 0x1::Config;
use 0x1::CoreAddresses;
use 0x1::Timestamp;
config structs.
struct TransactionTimeoutConfig has copy, drop, store
Fields
-
duration_seconds: u64
- timeout in second.
Initialize function. Should only be called in genesis.
public fun initialize(account: &signer, duration_seconds: u64)
Implementation
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)
);
}
Specification
aborts_if !Timestamp::is_genesis();
aborts_if Signer::address_of(account) != CoreAddresses::SPEC_GENESIS_ADDRESS();
include Config::PublishNewConfigAbortsIf<TransactionTimeoutConfig>;
include Config::PublishNewConfigEnsures<TransactionTimeoutConfig>;
Create a new timeout config used in dao proposal.
public fun new_transaction_timeout_config(duration_seconds: u64): TransactionTimeoutConfig::TransactionTimeoutConfig
Implementation
public fun new_transaction_timeout_config(duration_seconds: u64) : TransactionTimeoutConfig {
TransactionTimeoutConfig {duration_seconds: duration_seconds}
}
Specification
aborts_if false;
Get current timeout config.
Implementation
Specification
include Config::AbortsIfConfigNotExist<TransactionTimeoutConfig>{
addr: CoreAddresses::GENESIS_ADDRESS()
};
Get current txn timeout in seconds.
public fun duration_seconds(): u64
Implementation
public fun duration_seconds() :u64 {
let config = get_transaction_timeout_config();
config.duration_seconds
}
Specification
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;