---
# System prepended metadata

title: Oracle Integration

---

# RD/USD Oracle Integration

## Keeper Functions

### drip
function on TroveManager

`function drip() external`

function is also called during protocol operations

check if stale
`function dripIsStale() returns (bool)`

```
// On TroveManager
DRIP_STALENESS_THRESHOLD = 1 hours;
```

Gas Optimization
hook can store last drip time from hook and not check `dripIsStale()` until `block.timestamp - last > DRIP_STALENESS_THRESHOLD` if you think it can save gas vs always checking `dripIsStale()`



### rate update

function on Relayer

`function updateRateWithMarket(uint256 marketPrice) external returns (uint256)`

rate is also updated during protocol operations

check if stale
`relayer.rateIsStale() returns (bool)`

```
// On Relayer
RATE_STALENESS_THRESHOLD = 2 hours;
```

### par update

function on Relayer

`function updateParWithMarket(uint256 marketPrice) external returns (uint256)`

par is also updated during protocol operations

check if stale
`relayer.parIsStale() returns (bool)`

```
// On Relayer
PAR_STALENESS_THRESHOLD = 3 hours;
```

Can use same check logic as above

### update both rate and par 

function on relayer 
`function updateRateAndParWithMarket(uint256 rateMarketPrice, uint256 parMarketPrice) external returns (uint256)`








