> For the complete documentation index, see [llms.txt](https://reports.immunefi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://reports.immunefi.com/swaylend_iop/36065-sc-insight-market.update_market_configuration-should-reuse-old-configurations-base_token.decim.md).

# #36065 \[SC-Insight] \`Market.update\_market\_configuration\` should reuse old configuration's \`base\_toke

**Submitted on Oct 17th 2024 at 16:05:55 UTC by @jasonxiale for** [**IOP | Swaylend**](https://immunefi.com/audit-competition/iop-swaylend)

* **Report ID:** #36065
* **Report Type:** Smart Contract
* **Report severity:** Insight
* **Target:** <https://github.com/Swaylend/swaylend-monorepo/blob/main/contracts/market/src/main.sw>
* **Impacts:**

## Description

## Brief/Intro

In [Market.update\_market\_configuration](https://github.com/Swaylend/swaylend-monorepo/blob/569fb4b2ccee8a4e089167c65cde8184b04c61c8/contracts/market/src/main.sw#L973-L990), while updating the \`MarketConfiguration\`, orignal \`configuration.base\_token\` can't be changed in [main.sw#L980](https://github.com/Swaylend/swaylend-monorepo/blob/569fb4b2ccee8a4e089167c65cde8184b04c61c8/contracts/market/src/main.sw#L980), \`MarketConfiguration.base\_token\_decimals\` shouldn't be changed too.

## Vulnerability Details

\`\`\`Rust 971 // # 11. Changing market configuration 972 #\[storage(write)] 973 fn update\_market\_configuration(configuration: MarketConfiguration) { 974 // Only owner can update the market configuration 975 only\_owner(); 976 977 let mut configuration = configuration; 978 979 // Cannot change base token and tracking index scale 980 configuration.base\_token = storage.market\_configuration.read().base\_token; <<<--- \`MarketConfiguration.base\_token\_decimals\` should be reused here too 981 configuration.base\_tracking\_index\_scale = storage.market\_configuration.read().base\_tracking\_index\_scale; 982 983 // Update the market configuration 984 storage.market\_configuration.write(configuration); 985 986 // Emit market configuration event\
987 log(MarketConfigurationEvent { 988 market\_config: configuration, 989 }); 990 } \`\`\`

## Impact Details

To avoid the mistake

## References

Add any relevant links to documentation or code

## Link to Proof of Concept

<https://gist.github.com/crazy4linux/382b80b244a219346a827755a3ea594e>

## Proof of Concept

## Proof of Concept


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://reports.immunefi.com/swaylend_iop/36065-sc-insight-market.update_market_configuration-should-reuse-old-configurations-base_token.decim.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
