starcoin-framework

Module 0x1::TransactionTimeoutConfig

Onchain configuration for timeout setting of transaction.

use 0x1::Config;
use 0x1::CoreAddresses;
use 0x1::Timestamp;

Struct TransactionTimeoutConfig

config structs.

struct TransactionTimeoutConfig has copy, drop, store
Fields
duration_seconds: u64
timeout in second.

Function initialize

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::GENESIS_ADDRESS();
include Config::PublishNewConfigAbortsIf<TransactionTimeoutConfig>;
include Config::PublishNewConfigEnsures<TransactionTimeoutConfig>;

Function new_transaction_timeout_config

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;

Function get_transaction_timeout_config

Get current timeout config.

public fun get_transaction_timeout_config(): TransactionTimeoutConfig::TransactionTimeoutConfig
Implementation
public fun get_transaction_timeout_config(): TransactionTimeoutConfig {
    Config::get_by_address<TransactionTimeoutConfig>(CoreAddresses::GENESIS_ADDRESS())
}
Specification
include Config::AbortsIfConfigNotExist<TransactionTimeoutConfig>{
    addr: CoreAddresses::GENESIS_ADDRESS()
};

Function duration_seconds

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()
    };
}

Module Specification

pragma verify = false;
pragma aborts_if_is_strict = true;