mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-14 12:05:18 +00:00
36 lines
904 B
Markdown
36 lines
904 B
Markdown
|
<!--
|
||
|
order: 2
|
||
|
-->
|
||
|
|
||
|
# State
|
||
|
|
||
|
## Parameters and Genesis State
|
||
|
|
||
|
`Parameters` define the governance parameters and default behavior of the swap module.
|
||
|
|
||
|
```go
|
||
|
// Params are governance parameters for the swap module
|
||
|
type Params struct {
|
||
|
AllowedPools AllowedPools `json:"allowed_pools" yaml:"allowed_pools"`
|
||
|
SwapFee sdk.Dec `json:"swap_fee" yaml:"swap_fee"`
|
||
|
}
|
||
|
|
||
|
// AllowedPool defines a tradable pool
|
||
|
type AllowedPool struct {
|
||
|
TokenA string `json:"token_a" yaml:"token_a"`
|
||
|
TokenB string `json:"token_b" yaml:"token_b"`
|
||
|
}
|
||
|
|
||
|
// AllowedPools is a slice of AllowedPool
|
||
|
type AllowedPools []AllowedPool
|
||
|
```
|
||
|
|
||
|
`GenesisState` defines the state that must be persisted when the blockchain stops/restarts in order for the normal function of the swap module to resume.
|
||
|
|
||
|
```go
|
||
|
// GenesisState is the state that must be provided at genesis.
|
||
|
type GenesisState struct {
|
||
|
Params Params `json:"params" yaml:"params"`
|
||
|
}
|
||
|
```
|