Skip to content

Commit 9c4251a

Browse files
authored
feat: Added rate model store from across v1 (#118)
Signed-off-by: chrismaree <christopher.maree@gmail.com>
1 parent 35d61d9 commit 9c4251a

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

contracts/RateModelStore.sol

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// SPDX-License-Identifier: AGPL-3.0-only
2+
pragma solidity ^0.8.0;
3+
4+
import "@uma/core/contracts/common/implementation/MultiCaller.sol";
5+
import "@openzeppelin/contracts/access/Ownable.sol";
6+
7+
/**
8+
* @title Maps rate model objects to L1 token.
9+
* @dev This contract is designed to be queried by off-chain relayers that need to compute realized LP fee %'s before
10+
* submitting relay transactions to a BridgePool contract. Therefore, this contract does not perform any validation on
11+
* the shape of the rate model, which is stored as a string to enable arbitrary data encoding via a stringified JSON
12+
* object. This leaves this contract unopionated on the parameters within the rate model, enabling governance to adjust
13+
* the structure in the future.
14+
*/
15+
contract RateModelStore is Ownable, MultiCaller {
16+
mapping(address => string) public l1TokenRateModels;
17+
18+
event UpdatedRateModel(address indexed l1Token, string rateModel);
19+
20+
/**
21+
* @notice Updates rate model string for L1 token.
22+
* @param l1Token the l1 token rate model to update.
23+
* @param rateModel the updated rate model.
24+
*/
25+
function updateRateModel(address l1Token, string memory rateModel) external onlyOwner {
26+
l1TokenRateModels[l1Token] = rateModel;
27+
emit UpdatedRateModel(l1Token, rateModel);
28+
}
29+
}

0 commit comments

Comments
 (0)