
<a name="iota_config"></a>

# Module `iota::config`



-  [Struct `Config`](#iota_config_Config)
-  [Struct `Setting`](#iota_config_Setting)
-  [Struct `SettingData`](#iota_config_SettingData)
-  [Constants](#@Constants_0)
-  [Function `new`](#iota_config_new)
-  [Function `share`](#iota_config_share)
-  [Function `transfer`](#iota_config_transfer)
-  [Function `add_for_next_epoch`](#iota_config_add_for_next_epoch)
-  [Function `remove_for_next_epoch`](#iota_config_remove_for_next_epoch)
-  [Function `exists_with_type`](#iota_config_exists_with_type)
-  [Function `exists_with_type_for_next_epoch`](#iota_config_exists_with_type_for_next_epoch)
-  [Function `borrow_for_next_epoch_mut`](#iota_config_borrow_for_next_epoch_mut)
-  [Function `read_setting_for_next_epoch`](#iota_config_read_setting_for_next_epoch)
-  [Macro function `entry`](#iota_config_entry)
-  [Macro function `update`](#iota_config_update)
-  [Function `read_setting`](#iota_config_read_setting)
-  [Function `read_setting_impl`](#iota_config_read_setting_impl)


<pre><code><b>use</b> <a href="../../dependencies/iota/address.md#iota_address">iota::address</a>;
<b>use</b> <a href="../../dependencies/iota/dynamic_field.md#iota_dynamic_field">iota::dynamic_field</a>;
<b>use</b> <a href="../../dependencies/iota/hex.md#iota_hex">iota::hex</a>;
<b>use</b> <a href="../../dependencies/iota/object.md#iota_object">iota::object</a>;
<b>use</b> <a href="../../dependencies/iota/transfer.md#iota_transfer">iota::transfer</a>;
<b>use</b> <a href="../../dependencies/iota/tx_context.md#iota_tx_context">iota::tx_context</a>;
<b>use</b> <a href="../../dependencies/std/ascii.md#std_ascii">std::ascii</a>;
<b>use</b> <a href="../../dependencies/std/bcs.md#std_bcs">std::bcs</a>;
<b>use</b> <a href="../../dependencies/std/option.md#std_option">std::option</a>;
<b>use</b> <a href="../../dependencies/std/string.md#std_string">std::string</a>;
<b>use</b> <a href="../../dependencies/std/vector.md#std_vector">std::vector</a>;
</code></pre>



<a name="iota_config_Config"></a>

## Struct `Config`



<pre><code><b>public</b> <b>struct</b> <a href="../../dependencies/iota/config.md#iota_config_Config">Config</a>&lt;<b>phantom</b> WriteCap&gt; <b>has</b> key
</code></pre>



<details>
<summary>Fields</summary>


<dl>
<dt>
<code>id: <a href="../../dependencies/iota/object.md#iota_object_UID">iota::object::UID</a></code>
</dt>
<dd>
</dd>
</dl>


</details>

<a name="iota_config_Setting"></a>

## Struct `Setting`



<pre><code><b>public</b> <b>struct</b> <a href="../../dependencies/iota/config.md#iota_config_Setting">Setting</a>&lt;Value: <b>copy</b>, drop, store&gt; <b>has</b> drop, store
</code></pre>



<details>
<summary>Fields</summary>


<dl>
<dt>
<code>data: <a href="../../dependencies/std/option.md#std_option_Option">std::option::Option</a>&lt;<a href="../../dependencies/iota/config.md#iota_config_SettingData">iota::config::SettingData</a>&lt;Value&gt;&gt;</code>
</dt>
<dd>
</dd>
</dl>


</details>

<a name="iota_config_SettingData"></a>

## Struct `SettingData`



<pre><code><b>public</b> <b>struct</b> <a href="../../dependencies/iota/config.md#iota_config_SettingData">SettingData</a>&lt;Value: <b>copy</b>, drop, store&gt; <b>has</b> drop, store
</code></pre>



<details>
<summary>Fields</summary>


<dl>
<dt>
<code>newer_value_epoch: u64</code>
</dt>
<dd>
</dd>
<dt>
<code>newer_value: <a href="../../dependencies/std/option.md#std_option_Option">std::option::Option</a>&lt;Value&gt;</code>
</dt>
<dd>
</dd>
<dt>
<code>older_value_opt: <a href="../../dependencies/std/option.md#std_option_Option">std::option::Option</a>&lt;Value&gt;</code>
</dt>
<dd>
</dd>
</dl>


</details>

<a name="@Constants_0"></a>

## Constants


<a name="iota_config_EAlreadySetForEpoch"></a>



<pre><code><b>const</b> <a href="../../dependencies/iota/config.md#iota_config_EAlreadySetForEpoch">EAlreadySetForEpoch</a>: u64 = 0;
</code></pre>



<a name="iota_config_ENotSetForEpoch"></a>



<pre><code><b>const</b> <a href="../../dependencies/iota/config.md#iota_config_ENotSetForEpoch">ENotSetForEpoch</a>: u64 = 1;
</code></pre>



<a name="iota_config_EBCSSerializationFailure"></a>



<pre><code><b>const</b> <a href="../../dependencies/iota/config.md#iota_config_EBCSSerializationFailure">EBCSSerializationFailure</a>: u64 = 2;
</code></pre>



<a name="iota_config_new"></a>

## Function `new`



<pre><code><b>public</b>(package) <b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_new">new</a>&lt;WriteCap&gt;(_cap: &<b>mut</b> WriteCap, ctx: &<b>mut</b> <a href="../../dependencies/iota/tx_context.md#iota_tx_context_TxContext">iota::tx_context::TxContext</a>): <a href="../../dependencies/iota/config.md#iota_config_Config">iota::config::Config</a>&lt;WriteCap&gt;
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b>(package) <b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_new">new</a>&lt;WriteCap&gt;(_cap: &<b>mut</b> WriteCap, ctx: &<b>mut</b> TxContext): <a href="../../dependencies/iota/config.md#iota_config_Config">Config</a>&lt;WriteCap&gt; {
    <a href="../../dependencies/iota/config.md#iota_config_Config">Config</a>&lt;WriteCap&gt; { id: object::new(ctx) }
}
</code></pre>



</details>

<a name="iota_config_share"></a>

## Function `share`



<pre><code><b>public</b>(package) <b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_share">share</a>&lt;WriteCap&gt;(config: <a href="../../dependencies/iota/config.md#iota_config_Config">iota::config::Config</a>&lt;WriteCap&gt;)
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b>(package) <b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_share">share</a>&lt;WriteCap&gt;(config: <a href="../../dependencies/iota/config.md#iota_config_Config">Config</a>&lt;WriteCap&gt;) {
    transfer::share_object(config)
}
</code></pre>



</details>

<a name="iota_config_transfer"></a>

## Function `transfer`



<pre><code><b>public</b>(package) <b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_transfer">transfer</a>&lt;WriteCap&gt;(config: <a href="../../dependencies/iota/config.md#iota_config_Config">iota::config::Config</a>&lt;WriteCap&gt;, owner: <b>address</b>)
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b>(package) <b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_transfer">transfer</a>&lt;WriteCap&gt;(config: <a href="../../dependencies/iota/config.md#iota_config_Config">Config</a>&lt;WriteCap&gt;, owner: <b>address</b>) {
    transfer::transfer(config, owner)
}
</code></pre>



</details>

<a name="iota_config_add_for_next_epoch"></a>

## Function `add_for_next_epoch`



<pre><code><b>public</b>(package) <b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_add_for_next_epoch">add_for_next_epoch</a>&lt;WriteCap, Name: <b>copy</b>, drop, store, Value: <b>copy</b>, drop, store&gt;(config: &<b>mut</b> <a href="../../dependencies/iota/config.md#iota_config_Config">iota::config::Config</a>&lt;WriteCap&gt;, _cap: &<b>mut</b> WriteCap, name: Name, value: Value, ctx: &<b>mut</b> <a href="../../dependencies/iota/tx_context.md#iota_tx_context_TxContext">iota::tx_context::TxContext</a>): <a href="../../dependencies/std/option.md#std_option_Option">std::option::Option</a>&lt;Value&gt;
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b>(package) <b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_add_for_next_epoch">add_for_next_epoch</a>&lt;
    WriteCap,
    Name: <b>copy</b> + drop + store,
    Value: <b>copy</b> + drop + store,
&gt;(
    config: &<b>mut</b> <a href="../../dependencies/iota/config.md#iota_config_Config">Config</a>&lt;WriteCap&gt;,
    _cap: &<b>mut</b> WriteCap,
    name: Name,
    value: Value,
    ctx: &<b>mut</b> TxContext,
): Option&lt;Value&gt; {
    <b>let</b> epoch = ctx.epoch();
    <b>if</b> (!field::exists_(&config.id, name)) {
        <b>let</b> sobj = <a href="../../dependencies/iota/config.md#iota_config_Setting">Setting</a> {
            data: option::some(<a href="../../dependencies/iota/config.md#iota_config_SettingData">SettingData</a> {
                newer_value_epoch: epoch,
                newer_value: option::some(value),
                older_value_opt: option::none(),
            }),
        };
        field::add(&<b>mut</b> config.id, name, sobj);
        option::none()
    } <b>else</b> {
        <b>let</b> sobj: &<b>mut</b> <a href="../../dependencies/iota/config.md#iota_config_Setting">Setting</a>&lt;Value&gt; = field::borrow_mut(&<b>mut</b> config.id, name);
        <b>let</b> <a href="../../dependencies/iota/config.md#iota_config_SettingData">SettingData</a> {
            newer_value_epoch,
            newer_value,
            older_value_opt,
        } = sobj.data.extract();
        <b>let</b> (older_value_opt, removed_value) = <b>if</b> (epoch &gt; newer_value_epoch) {
            // <b>if</b> the `newer_value` is <b>for</b> a previous epoch, <b>move</b> it to `older_value_opt`
            (<b>move</b> newer_value, <b>move</b> older_value_opt)
        } <b>else</b> {
            // the current epoch cannot be less than the `newer_value_epoch`
            <b>assert</b>!(epoch == newer_value_epoch);
            // <b>if</b> the `newer_value` is <b>for</b> the current epoch, then the option must be `none`
            <b>assert</b>!(newer_value.is_none(), <a href="../../dependencies/iota/config.md#iota_config_EAlreadySetForEpoch">EAlreadySetForEpoch</a>);
            (<b>move</b> older_value_opt, option::none())
        };
        sobj
            .data
            .fill(<a href="../../dependencies/iota/config.md#iota_config_SettingData">SettingData</a> {
                newer_value_epoch: epoch,
                newer_value: option::some(value),
                older_value_opt,
            });
        removed_value
    }
}
</code></pre>



</details>

<a name="iota_config_remove_for_next_epoch"></a>

## Function `remove_for_next_epoch`



<pre><code><b>public</b>(package) <b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_remove_for_next_epoch">remove_for_next_epoch</a>&lt;WriteCap, Name: <b>copy</b>, drop, store, Value: <b>copy</b>, drop, store&gt;(config: &<b>mut</b> <a href="../../dependencies/iota/config.md#iota_config_Config">iota::config::Config</a>&lt;WriteCap&gt;, _cap: &<b>mut</b> WriteCap, name: Name, ctx: &<b>mut</b> <a href="../../dependencies/iota/tx_context.md#iota_tx_context_TxContext">iota::tx_context::TxContext</a>): <a href="../../dependencies/std/option.md#std_option_Option">std::option::Option</a>&lt;Value&gt;
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b>(package) <b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_remove_for_next_epoch">remove_for_next_epoch</a>&lt;
    WriteCap,
    Name: <b>copy</b> + drop + store,
    Value: <b>copy</b> + drop + store,
&gt;(
    config: &<b>mut</b> <a href="../../dependencies/iota/config.md#iota_config_Config">Config</a>&lt;WriteCap&gt;,
    _cap: &<b>mut</b> WriteCap,
    name: Name,
    ctx: &<b>mut</b> TxContext,
): Option&lt;Value&gt; {
    <b>let</b> epoch = ctx.epoch();
    <b>if</b> (!field::exists_(&config.id, name)) <b>return</b> option::none();
    <b>let</b> sobj: &<b>mut</b> <a href="../../dependencies/iota/config.md#iota_config_Setting">Setting</a>&lt;Value&gt; = field::borrow_mut(&<b>mut</b> config.id, name);
    <b>let</b> <a href="../../dependencies/iota/config.md#iota_config_SettingData">SettingData</a> {
        newer_value_epoch,
        newer_value,
        older_value_opt,
    } = sobj.data.extract();
    <b>let</b> (older_value_opt, removed_value) = <b>if</b> (epoch &gt; newer_value_epoch) {
        // <b>if</b> the `newer_value` is <b>for</b> a previous epoch, <b>move</b> it to `older_value_opt`
        (<b>move</b> newer_value, option::none())
    } <b>else</b> {
        // the current epoch cannot be less than the `newer_value_epoch`
        <b>assert</b>!(epoch == newer_value_epoch);
        (<b>move</b> older_value_opt, <b>move</b> newer_value)
    };
    <b>let</b> older_value_opt_is_none = older_value_opt.is_none();
    sobj
        .data
        .fill(<a href="../../dependencies/iota/config.md#iota_config_SettingData">SettingData</a> {
            newer_value_epoch: epoch,
            newer_value: option::none(),
            older_value_opt,
        });
    <b>if</b> (older_value_opt_is_none) {
        field::remove&lt;_, <a href="../../dependencies/iota/config.md#iota_config_Setting">Setting</a>&lt;Value&gt;&gt;(&<b>mut</b> config.id, name);
    };
    removed_value
}
</code></pre>



</details>

<a name="iota_config_exists_with_type"></a>

## Function `exists_with_type`



<pre><code><b>public</b>(package) <b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_exists_with_type">exists_with_type</a>&lt;WriteCap, Name: <b>copy</b>, drop, store, Value: <b>copy</b>, drop, store&gt;(config: &<a href="../../dependencies/iota/config.md#iota_config_Config">iota::config::Config</a>&lt;WriteCap&gt;, name: Name): bool
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b>(package) <b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_exists_with_type">exists_with_type</a>&lt;
    WriteCap,
    Name: <b>copy</b> + drop + store,
    Value: <b>copy</b> + drop + store,
&gt;(
    config: &<a href="../../dependencies/iota/config.md#iota_config_Config">Config</a>&lt;WriteCap&gt;,
    name: Name,
): bool {
    field::exists_with_type&lt;_, <a href="../../dependencies/iota/config.md#iota_config_Setting">Setting</a>&lt;Value&gt;&gt;(&config.id, name)
}
</code></pre>



</details>

<a name="iota_config_exists_with_type_for_next_epoch"></a>

## Function `exists_with_type_for_next_epoch`



<pre><code><b>public</b>(package) <b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_exists_with_type_for_next_epoch">exists_with_type_for_next_epoch</a>&lt;WriteCap, Name: <b>copy</b>, drop, store, Value: <b>copy</b>, drop, store&gt;(config: &<a href="../../dependencies/iota/config.md#iota_config_Config">iota::config::Config</a>&lt;WriteCap&gt;, name: Name, ctx: &<a href="../../dependencies/iota/tx_context.md#iota_tx_context_TxContext">iota::tx_context::TxContext</a>): bool
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b>(package) <b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_exists_with_type_for_next_epoch">exists_with_type_for_next_epoch</a>&lt;
    WriteCap,
    Name: <b>copy</b> + drop + store,
    Value: <b>copy</b> + drop + store,
&gt;(
    config: &<a href="../../dependencies/iota/config.md#iota_config_Config">Config</a>&lt;WriteCap&gt;,
    name: Name,
    ctx: &TxContext,
): bool {
    field::exists_with_type&lt;_, <a href="../../dependencies/iota/config.md#iota_config_Setting">Setting</a>&lt;Value&gt;&gt;(&config.id, name) && {
            <b>let</b> epoch = ctx.epoch();
            <b>let</b> sobj: &<a href="../../dependencies/iota/config.md#iota_config_Setting">Setting</a>&lt;Value&gt; = field::borrow(&config.id, name);
            epoch == sobj.data.borrow().newer_value_epoch &&
            sobj.data.borrow().newer_value.is_some()
        }
}
</code></pre>



</details>

<a name="iota_config_borrow_for_next_epoch_mut"></a>

## Function `borrow_for_next_epoch_mut`



<pre><code><b>public</b>(package) <b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_borrow_for_next_epoch_mut">borrow_for_next_epoch_mut</a>&lt;WriteCap, Name: <b>copy</b>, drop, store, Value: <b>copy</b>, drop, store&gt;(config: &<b>mut</b> <a href="../../dependencies/iota/config.md#iota_config_Config">iota::config::Config</a>&lt;WriteCap&gt;, _cap: &<b>mut</b> WriteCap, name: Name, ctx: &<b>mut</b> <a href="../../dependencies/iota/tx_context.md#iota_tx_context_TxContext">iota::tx_context::TxContext</a>): &<b>mut</b> Value
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b>(package) <b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_borrow_for_next_epoch_mut">borrow_for_next_epoch_mut</a>&lt;
    WriteCap,
    Name: <b>copy</b> + drop + store,
    Value: <b>copy</b> + drop + store,
&gt;(
    config: &<b>mut</b> <a href="../../dependencies/iota/config.md#iota_config_Config">Config</a>&lt;WriteCap&gt;,
    _cap: &<b>mut</b> WriteCap,
    name: Name,
    ctx: &<b>mut</b> TxContext,
): &<b>mut</b> Value {
    <b>let</b> epoch = ctx.epoch();
    <b>let</b> sobj: &<b>mut</b> <a href="../../dependencies/iota/config.md#iota_config_Setting">Setting</a>&lt;Value&gt; = field::borrow_mut(&<b>mut</b> config.id, name);
    <b>let</b> data = sobj.data.borrow_mut();
    <b>assert</b>!(data.newer_value_epoch == epoch, <a href="../../dependencies/iota/config.md#iota_config_ENotSetForEpoch">ENotSetForEpoch</a>);
    <b>assert</b>!(data.newer_value.is_some(), <a href="../../dependencies/iota/config.md#iota_config_ENotSetForEpoch">ENotSetForEpoch</a>);
    data.newer_value.borrow_mut()
}
</code></pre>



</details>

<a name="iota_config_read_setting_for_next_epoch"></a>

## Function `read_setting_for_next_epoch`



<pre><code><b>public</b>(package) <b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_read_setting_for_next_epoch">read_setting_for_next_epoch</a>&lt;WriteCap, Name: <b>copy</b>, drop, store, Value: <b>copy</b>, drop, store&gt;(config: &<a href="../../dependencies/iota/config.md#iota_config_Config">iota::config::Config</a>&lt;WriteCap&gt;, name: Name): <a href="../../dependencies/std/option.md#std_option_Option">std::option::Option</a>&lt;Value&gt;
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b>(package) <b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_read_setting_for_next_epoch">read_setting_for_next_epoch</a>&lt;
    WriteCap,
    Name: <b>copy</b> + drop + store,
    Value: <b>copy</b> + drop + store,
&gt;(
    config: &<a href="../../dependencies/iota/config.md#iota_config_Config">Config</a>&lt;WriteCap&gt;,
    name: Name,
): Option&lt;Value&gt; {
    <b>if</b> (!field::exists_with_type&lt;_, <a href="../../dependencies/iota/config.md#iota_config_Setting">Setting</a>&lt;Value&gt;&gt;(&config.id, name)) <b>return</b> option::none();
    <b>let</b> sobj: &<a href="../../dependencies/iota/config.md#iota_config_Setting">Setting</a>&lt;Value&gt; = field::borrow(&config.id, name);
    <b>let</b> data = sobj.data.borrow();
    data.newer_value
}
</code></pre>



</details>

<a name="iota_config_entry"></a>

## Macro function `entry`



<pre><code><b>public</b>(package) <b>macro</b> <b>fun</b> <b>entry</b>&lt;$WriteCap, $Name: <b>copy</b>, drop, store, $Value: <b>copy</b>, drop, store&gt;($config: &<b>mut</b> <a href="../../dependencies/iota/config.md#iota_config_Config">iota::config::Config</a>&lt;$WriteCap&gt;, $cap: &<b>mut</b> $WriteCap, $name: $Name, $initial_for_next_epoch: |&<b>mut</b> <a href="../../dependencies/iota/config.md#iota_config_Config">iota::config::Config</a>&lt;$WriteCap&gt;, &<b>mut</b> $WriteCap, &<b>mut</b> <a href="../../dependencies/iota/tx_context.md#iota_tx_context_TxContext">iota::tx_context::TxContext</a>| -&gt; $Value, $ctx: &<b>mut</b> <a href="../../dependencies/iota/tx_context.md#iota_tx_context_TxContext">iota::tx_context::TxContext</a>): &<b>mut</b> $Value
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b>(package) <b>macro</b> <b>fun</b> <b>entry</b>&lt;$WriteCap, $Name: <b>copy</b> + drop + store, $Value: <b>copy</b> + drop + store&gt;(
    $config: &<b>mut</b> <a href="../../dependencies/iota/config.md#iota_config_Config">Config</a>&lt;$WriteCap&gt;,
    $cap: &<b>mut</b> $WriteCap,
    $name: $Name,
    $initial_for_next_epoch: |&<b>mut</b> <a href="../../dependencies/iota/config.md#iota_config_Config">Config</a>&lt;$WriteCap&gt;, &<b>mut</b> $WriteCap, &<b>mut</b> TxContext| -&gt; $Value,
    $ctx: &<b>mut</b> TxContext,
): &<b>mut</b> $Value {
    <b>let</b> config = $config;
    <b>let</b> cap = $cap;
    <b>let</b> name = $name;
    <b>let</b> ctx = $ctx;
    <b>if</b> (!config.<a href="../../dependencies/iota/config.md#iota_config_exists_with_type_for_next_epoch">exists_with_type_for_next_epoch</a>&lt;_, _, $Value&gt;(name, ctx)) {
        <b>let</b> initial = $initial_for_next_epoch(config, cap, ctx);
        config.<a href="../../dependencies/iota/config.md#iota_config_add_for_next_epoch">add_for_next_epoch</a>(cap, name, initial, ctx);
    };
    config.<a href="../../dependencies/iota/config.md#iota_config_borrow_for_next_epoch_mut">borrow_for_next_epoch_mut</a>(cap, name, ctx)
}
</code></pre>



</details>

<a name="iota_config_update"></a>

## Macro function `update`



<pre><code><b>public</b>(package) <b>macro</b> <b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_update">update</a>&lt;$WriteCap, $Name: <b>copy</b>, drop, store, $Value: <b>copy</b>, drop, store&gt;($config: &<b>mut</b> <a href="../../dependencies/iota/config.md#iota_config_Config">iota::config::Config</a>&lt;$WriteCap&gt;, $cap: &<b>mut</b> $WriteCap, $name: $Name, $initial_for_next_epoch: |&<b>mut</b> <a href="../../dependencies/iota/config.md#iota_config_Config">iota::config::Config</a>&lt;$WriteCap&gt;, &<b>mut</b> $WriteCap, &<b>mut</b> <a href="../../dependencies/iota/tx_context.md#iota_tx_context_TxContext">iota::tx_context::TxContext</a>| -&gt; $Value, $update_for_next_epoch: |<a href="../../dependencies/std/option.md#std_option_Option">std::option::Option</a>&lt;$Value&gt;, &<b>mut</b> $Value| -&gt; (), $ctx: &<b>mut</b> <a href="../../dependencies/iota/tx_context.md#iota_tx_context_TxContext">iota::tx_context::TxContext</a>)
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b>(package) <b>macro</b> <b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_update">update</a>&lt;
    $WriteCap,
    $Name: <b>copy</b> + drop + store,
    $Value: <b>copy</b> + drop + store,
&gt;(
    $config: &<b>mut</b> <a href="../../dependencies/iota/config.md#iota_config_Config">Config</a>&lt;$WriteCap&gt;,
    $cap: &<b>mut</b> $WriteCap,
    $name: $Name,
    $initial_for_next_epoch: |&<b>mut</b> <a href="../../dependencies/iota/config.md#iota_config_Config">Config</a>&lt;$WriteCap&gt;, &<b>mut</b> $WriteCap, &<b>mut</b> TxContext| -&gt; $Value,
    $update_for_next_epoch: |Option&lt;$Value&gt;, &<b>mut</b> $Value|,
    $ctx: &<b>mut</b> TxContext,
) {
    <b>let</b> config = $config;
    <b>let</b> cap = $cap;
    <b>let</b> name = $name;
    <b>let</b> ctx = $ctx;
    <b>let</b> old_value_opt = <b>if</b> (!config.<a href="../../dependencies/iota/config.md#iota_config_exists_with_type_for_next_epoch">exists_with_type_for_next_epoch</a>&lt;_, _, $Value&gt;(name, ctx)) {
        <b>let</b> initial = $initial_for_next_epoch(config, cap, ctx);
        config.<a href="../../dependencies/iota/config.md#iota_config_add_for_next_epoch">add_for_next_epoch</a>(cap, name, initial, ctx)
    } <b>else</b> {
        option::none()
    };
    $update_for_next_epoch(old_value_opt, config.<a href="../../dependencies/iota/config.md#iota_config_borrow_for_next_epoch_mut">borrow_for_next_epoch_mut</a>(cap, name, ctx));
}
</code></pre>



</details>

<a name="iota_config_read_setting"></a>

## Function `read_setting`



<pre><code><b>public</b>(package) <b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_read_setting">read_setting</a>&lt;Name: <b>copy</b>, drop, store, Value: <b>copy</b>, drop, store&gt;(config: <a href="../../dependencies/iota/object.md#iota_object_ID">iota::object::ID</a>, name: Name, ctx: &<a href="../../dependencies/iota/tx_context.md#iota_tx_context_TxContext">iota::tx_context::TxContext</a>): <a href="../../dependencies/std/option.md#std_option_Option">std::option::Option</a>&lt;Value&gt;
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b>(package) <b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_read_setting">read_setting</a>&lt;Name: <b>copy</b> + drop + store, Value: <b>copy</b> + drop + store&gt;(
    config: ID,
    name: Name,
    ctx: &TxContext,
): Option&lt;Value&gt; {
    <b>use</b> <a href="../../dependencies/iota/dynamic_field.md#iota_dynamic_field_Field">iota::dynamic_field::Field</a>;
    <b>let</b> config_id = config.to_address();
    <b>let</b> setting_df = field::hash_type_and_key(config_id, name);
    <a href="../../dependencies/iota/config.md#iota_config_read_setting_impl">read_setting_impl</a>&lt;Field&lt;Name, <a href="../../dependencies/iota/config.md#iota_config_Setting">Setting</a>&lt;Value&gt;&gt;, <a href="../../dependencies/iota/config.md#iota_config_Setting">Setting</a>&lt;Value&gt;, <a href="../../dependencies/iota/config.md#iota_config_SettingData">SettingData</a>&lt;Value&gt;, Value&gt;(
        config_id,
        setting_df,
        ctx.epoch(),
    )
}
</code></pre>



</details>

<a name="iota_config_read_setting_impl"></a>

## Function `read_setting_impl`



<pre><code><b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_read_setting_impl">read_setting_impl</a>&lt;FieldSettingValue: key, SettingValue: store, SettingDataValue: store, Value: <b>copy</b>, drop, store&gt;(config: <b>address</b>, name: <b>address</b>, current_epoch: u64): <a href="../../dependencies/std/option.md#std_option_Option">std::option::Option</a>&lt;Value&gt;
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>native</b> <b>fun</b> <a href="../../dependencies/iota/config.md#iota_config_read_setting_impl">read_setting_impl</a>&lt;
    FieldSettingValue: key,
    SettingValue: store,
    SettingDataValue: store,
    Value: <b>copy</b> + drop + store,
&gt;(
    config: <b>address</b>,
    name: <b>address</b>,
    current_epoch: u64,
): Option&lt;Value&gt;;
</code></pre>



</details>
