# xWin Pricemaster

### xWinPriceMaster

#### SourceMap

```solidity
struct SourceMap {
  uint8 source;
  address chainLinkAddr;
}
```

#### onlyExecutor

```solidity
modifier onlyExecutor()
```

#### stratInteractor

```solidity
contract IxWinStrategyInteractor stratInteractor
```

#### \_TWAPOracle

```solidity
address _TWAPOracle
```

#### chainLinkUSDpair

```solidity
mapping(address => address) chainLinkUSDpair
```

#### priceSourceMap

```solidity
mapping(address => mapping(address => struct xWinPriceMaster.SourceMap)) priceSourceMap
```

#### executors

```solidity
mapping(address => bool) executors
```

#### initialize

```solidity
function initialize(address _stratInteractor, address _twapAddress) external
```

#### getPrice

```solidity
function getPrice(address _from, address _to) public view returns (uint256 rate)
```

Get token price from xWinPriceMaster in the form of from/to, e.g ETH/USDC, BTC/ETH

**Parameters**

| Name   | Type    | Description        |
| ------ | ------- | ------------------ |
| \_from | address | from Token address |
| \_to   | address | to Token address   |

#### \_getTWAPPrice

```solidity
function _getTWAPPrice(address _from, address _to) internal view returns (uint256 amountOut)
```

#### \_getLPPrice

```solidity
function _getLPPrice(address _from, address _to) internal view returns (uint256 rate)
```

#### addPrice

```solidity
function addPrice(address _from, address _to, uint8 _source, address _chainLinkAddr) external
```

#### addChainlinkUSDPrice

```solidity
function addChainlinkUSDPrice(address _token, address _chainLinkAddr) external
```

#### setExecutor

```solidity
function setExecutor(address _address, bool _allow) external
```

#### setTWAPOracle

```solidity
function setTWAPOracle(address _address) external
```

#### updateStratInteractor

```solidity
function updateStratInteractor(address _stratInteractor) public
```

#### \_convertFrom18

```solidity
function _convertFrom18(uint256 value, address token) internal view returns (uint256)
```
