|
| 1 | +# Chainlink Oracle |
| 2 | + |
| 3 | +## Introduction |
| 4 | + |
| 5 | +This oracle fetchs prices of assets from Chainlink oracle. |
| 6 | + |
| 7 | +## Solidity API |
| 8 | + |
| 9 | +### initialize |
| 10 | + |
| 11 | +```solidity |
| 12 | +function initialize() public |
| 13 | +``` |
| 14 | + |
| 15 | +Initializes the owner of the contract |
| 16 | + |
| 17 | +### getUnderlyingPrice |
| 18 | + |
| 19 | +```solidity |
| 20 | +function getUnderlyingPrice(address vToken) public view returns (uint256) |
| 21 | +``` |
| 22 | + |
| 23 | +Get the Chainlink price of underlying asset of input vToken, revert when vToken is zero address |
| 24 | + |
| 25 | +#### Parameters |
| 26 | + |
| 27 | +| Name | Type | Description | |
| 28 | +| ---- | ---- | ----------- | |
| 29 | +| vToken | address | vToken address | |
| 30 | + |
| 31 | +#### Return Values |
| 32 | + |
| 33 | +| Name | Type | Description | |
| 34 | +| ---- | ---- | ----------- | |
| 35 | +| [0] | uint256 | price in USD | |
| 36 | + |
| 37 | + |
| 38 | +### setUnderlyingPrice |
| 39 | + |
| 40 | +```solidity |
| 41 | +function setUnderlyingPrice(contract VBep20Interface vToken, uint256 underlyingPriceMantissa) external |
| 42 | +``` |
| 43 | + |
| 44 | +Set the forced prices of the underlying token of input vToken |
| 45 | + |
| 46 | +#### Parameters |
| 47 | + |
| 48 | +| Name | Type | Description | |
| 49 | +| ---- | ---- | ----------- | |
| 50 | +| vToken | contract VBep20Interface | vToken address | |
| 51 | +| underlyingPriceMantissa | uint256 | price in 18 decimals | |
| 52 | + |
| 53 | +### setDirectPrice |
| 54 | + |
| 55 | +```solidity |
| 56 | +function setDirectPrice(address asset, uint256 price) external |
| 57 | +``` |
| 58 | + |
| 59 | +Set the forced prices of the input token |
| 60 | + |
| 61 | +#### Parameters |
| 62 | + |
| 63 | +| Name | Type | Description | |
| 64 | +| ---- | ---- | ----------- | |
| 65 | +| asset | address | asset address | |
| 66 | +| price | uint256 | price in 18 decimals | |
| 67 | + |
| 68 | +### setTokenConfigs |
| 69 | + |
| 70 | +```solidity |
| 71 | +function setTokenConfigs(struct TokenConfig[] tokenConfigs_) external |
| 72 | +``` |
| 73 | + |
| 74 | +Add multiple token configs at the same time |
| 75 | + |
| 76 | +#### Parameters |
| 77 | + |
| 78 | +| Name | Type | Description | |
| 79 | +| ---- | ---- | ----------- | |
| 80 | +| tokenConfigs_ | struct TokenConfig[] | config array | |
| 81 | + |
| 82 | +### setTokenConfig |
| 83 | + |
| 84 | +```solidity |
| 85 | +function setTokenConfig(struct TokenConfig tokenConfig) public |
| 86 | +``` |
| 87 | + |
| 88 | +Add single token config, vToken & feed cannot be zero address, and maxStalePeriod must be positive |
| 89 | + |
| 90 | +#### Parameters |
| 91 | + |
| 92 | +| Name | Type | Description | |
| 93 | +| ---- | ---- | ----------- | |
| 94 | +| tokenConfig | struct TokenConfig | token config struct | |
0 commit comments