-
Notifications
You must be signed in to change notification settings - Fork 4
/
Registry.sol
39 lines (32 loc) · 1.48 KB
/
Registry.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/*//////////////////////////////////////////////////////////////
Registry
//////////////////////////////////////////////////////////////*/
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
/// @title Registry
contract Registry is Ownable {
/// @notice Registry address for a given key hash updated
event AddressSet(bytes32 indexed key, address addr);
/// @notice Rate model address for a given key hash updated
event RateModelSet(bytes32 indexed key, address addr);
/// @notice Fetch module address for a given key hash
mapping(bytes32 key => address addr) public addressFor;
/// @notice Fetch rate model address for a given key hash
mapping(bytes32 key => address rateModel) public rateModelFor;
constructor() Ownable() { }
/// @notice Update module address for a given key hash
/// @param key Registry key hash
/// @param addr Updated module address for the key hash
function setAddress(bytes32 key, address addr) external onlyOwner {
addressFor[key] = addr;
emit AddressSet(key, addr);
}
/// @notice Update rate model address for a given key hash
/// @param key Registry key hash
/// @param rateModel Updated rate model address for the key hash
function setRateModel(bytes32 key, address rateModel) external onlyOwner {
rateModelFor[key] = rateModel;
emit RateModelSet(key, rateModel);
}
}