-
Notifications
You must be signed in to change notification settings - Fork 5
/
Valuation.sol
50 lines (40 loc) · 1.26 KB
/
Valuation.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
40
41
42
43
44
45
46
47
48
49
50
// contracts/token/modules/Valuation.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.12;
import "./interfaces/IValuation.sol";
abstract contract Valuation is IValuation {
//////////////////////////////
/// State
//////////////////////////////
/// @notice Mapping from token ID to token valuation in Wei.
mapping(uint256 => uint256) internal _valuations;
//////////////////////////////
/// Events
//////////////////////////////
/// @notice Alert of new valuation.
/// @param tokenId ID of token.
/// @param newValuation in Wei.
event LogValuation(uint256 indexed tokenId, uint256 indexed newValuation);
//////////////////////////////
/// Public Getters
//////////////////////////////
/// @dev See {IValuation.valuationOf}
function valuationOf(uint256 tokenId_)
public
view
override
returns (uint256)
{
return _valuations[tokenId_];
}
//////////////////////////////
/// Private Setters
//////////////////////////////
/// @notice Sets valuation for a given token.
/// @param tokenId_ ID of token to set.
/// @param valuation_ New valuation.
function _setValuation(uint256 tokenId_, uint256 valuation_) internal {
_valuations[tokenId_] = valuation_;
emit LogValuation(tokenId_, valuation_);
}
}