> For the complete documentation index, see [llms.txt](https://docs.shadeprotocol.io/shade-protocol/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.shadeprotocol.io/shade-protocol/advanced-topics-apps/silk/peg-migration.md).

# Peg Migration

### Initialization

In order to initialize the target basket composition of SILK for the minting contract, a computation must be performed based on a list of currencies, their current prices, their assigned weights, and the nominal starting price of SILK. This is done by computing the respective currency amounts in relation to their desired proportion of the target peg price.&#x20;

*P = (price of currency A, price of currency B...price of currency N)*

*W = (weight of currency A, weight of currency B...weight of currency N)*

*T = starting target peg*

![Compute starting currency amounts based on list of weights, prices, and desired target peg.](/files/XqQ6iKK00JUKAFaxCx9r)

![Compute each a(n) for their respective portion of T](/files/tOR6tGigK2LzgB5JTmf2)

![Compute new target peg based on updated oracle information based on price changes of currencies. Price is what is constantly getting updated, thus shifting new target price (C). ](/files/A2BvFdf4hvsE98jTdfgL)

### Peg Migration

![CP = current price, W = updated list of weights via governance update. Recompute using same above formulas in "Initialization" section.](/files/LXq7WOHUhKD1Oz0RwJg4)

### Reference Migration

In the event that USD is not longer used in oracles, it is important that there is an ability to migrate the underlying reference currency that the code uses. The following is the underlying formula:

&#x20;

![R is the new reference currency trading ratio with the outdated reference currency](/files/KHMkwLU2rRG3CLfucE11)


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.shadeprotocol.io/shade-protocol/advanced-topics-apps/silk/peg-migration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
