@ubk-labs/ubk-oracle 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -0
  3. package/artifacts/contracts/constants/Constants.sol/Constants.dbg.json +4 -0
  4. package/artifacts/contracts/constants/Constants.sol/Constants.json +141 -0
  5. package/artifacts/contracts/core/UBKOracle.sol/UBKOracle.dbg.json +4 -0
  6. package/artifacts/contracts/core/UBKOracle.sol/UBKOracle.json +1028 -0
  7. package/artifacts/contracts/mocks/MockAggregatorV3.sol/MockAggregatorV3.dbg.json +4 -0
  8. package/artifacts/contracts/mocks/MockAggregatorV3.sol/MockAggregatorV3.json +177 -0
  9. package/artifacts/contracts/mocks/MockERC20.sol/MockERC20.dbg.json +4 -0
  10. package/artifacts/contracts/mocks/MockERC20.sol/MockERC20.json +381 -0
  11. package/artifacts/contracts/mocks/MockERC4626.sol/Mock4626.dbg.json +4 -0
  12. package/artifacts/contracts/mocks/MockERC4626.sol/Mock4626.json +500 -0
  13. package/artifacts/contracts/mocks/MockIERC4626.sol/MockIERC4626.dbg.json +4 -0
  14. package/artifacts/contracts/mocks/MockIERC4626.sol/MockIERC4626.json +99 -0
  15. package/artifacts/interfaces/IUBKOracle.sol/IUBKOracle.dbg.json +4 -0
  16. package/artifacts/interfaces/IUBKOracle.sol/IUBKOracle.json +264 -0
  17. package/contracts/constants/Constants.sol +34 -0
  18. package/contracts/core/UBKOracle.sol +560 -0
  19. package/contracts/errors/Errors.sol +17 -0
  20. package/contracts/mocks/MockAggregatorV3.sol +56 -0
  21. package/contracts/mocks/MockERC20.sol +28 -0
  22. package/contracts/mocks/MockERC4626.sol +74 -0
  23. package/contracts/mocks/MockIERC4626.sol +13 -0
  24. package/interfaces/IUBKOracle.sol +54 -0
  25. package/package.json +41 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Nischinth Murari
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # UBKOracle
2
+
3
+ The **UBKOracle** contract provides a unified, gas-efficient, and reliable pricing mechanism for decentralized financial applications. It aggregates on-chain data from three primary sources — **manual governance overrides**, **ERC-4626 vault conversions**, and **Chainlink price feeds** — to produce normalized `1e18` asset prices for both ERC-20 tokens and yield-bearing vaults (e.g., sDAI, sFRAX, sUSDe).
4
+
5
+ The UBKOracle enforces strict safety guarantees, including staleness thresholds, recursion depth limits, vault rate bounds, and fallback logic. It is designed to operate safely in production environments under a capped-V1 model while remaining modular and extensible for future integrations.
6
+
7
+ ---
8
+
9
+ ## Build Instructions
10
+
11
+ 1. **Install dependencies**
12
+ ```
13
+ npm install
14
+ ```
15
+
16
+ 2. **Compile contracts**
17
+ ```
18
+ npx hardhat compile
19
+ ```
20
+
21
+ 3. **Run tests**
22
+ ```
23
+ npx hardhat test
24
+ ```
25
+
26
+ ---
27
+
28
+ ## Learn More
29
+
30
+ For detailed documentation, including architecture, configuration parameters, and integration examples, see the **[Wiki](../../wiki)**.
31
+
32
+ ---
33
+
34
+ **License:** MIT
@@ -0,0 +1,4 @@
1
+ {
2
+ "_format": "hh-sol-dbg-1",
3
+ "buildInfo": "../../../build-info/59a7a86e788a7471c2e99b922236c2bf.json"
4
+ }
@@ -0,0 +1,141 @@
1
+ {
2
+ "_format": "hh-sol-artifact-1",
3
+ "contractName": "Constants",
4
+ "sourceName": "contracts/constants/Constants.sol",
5
+ "abi": [
6
+ {
7
+ "inputs": [],
8
+ "name": "MAX_RECURSION_DEPTH",
9
+ "outputs": [
10
+ {
11
+ "internalType": "uint256",
12
+ "name": "",
13
+ "type": "uint256"
14
+ }
15
+ ],
16
+ "stateMutability": "view",
17
+ "type": "function"
18
+ },
19
+ {
20
+ "inputs": [],
21
+ "name": "ORACLE_DEFAULT_STALE_PERIOD",
22
+ "outputs": [
23
+ {
24
+ "internalType": "uint256",
25
+ "name": "",
26
+ "type": "uint256"
27
+ }
28
+ ],
29
+ "stateMutability": "view",
30
+ "type": "function"
31
+ },
32
+ {
33
+ "inputs": [],
34
+ "name": "ORACLE_MANUAL_PRICE_MAX_DELTA_WAD",
35
+ "outputs": [
36
+ {
37
+ "internalType": "uint256",
38
+ "name": "",
39
+ "type": "uint256"
40
+ }
41
+ ],
42
+ "stateMutability": "view",
43
+ "type": "function"
44
+ },
45
+ {
46
+ "inputs": [],
47
+ "name": "ORACLE_MAX_ABSOLUTE_PRICE_WAD",
48
+ "outputs": [
49
+ {
50
+ "internalType": "uint256",
51
+ "name": "",
52
+ "type": "uint256"
53
+ }
54
+ ],
55
+ "stateMutability": "view",
56
+ "type": "function"
57
+ },
58
+ {
59
+ "inputs": [],
60
+ "name": "ORACLE_MAX_STALE_PERIOD",
61
+ "outputs": [
62
+ {
63
+ "internalType": "uint256",
64
+ "name": "",
65
+ "type": "uint256"
66
+ }
67
+ ],
68
+ "stateMutability": "view",
69
+ "type": "function"
70
+ },
71
+ {
72
+ "inputs": [],
73
+ "name": "ORACLE_MAX_VAULT_RATE_WAD",
74
+ "outputs": [
75
+ {
76
+ "internalType": "uint256",
77
+ "name": "",
78
+ "type": "uint256"
79
+ }
80
+ ],
81
+ "stateMutability": "view",
82
+ "type": "function"
83
+ },
84
+ {
85
+ "inputs": [],
86
+ "name": "ORACLE_MIN_ABSOLUTE_PRICE_WAD",
87
+ "outputs": [
88
+ {
89
+ "internalType": "uint256",
90
+ "name": "",
91
+ "type": "uint256"
92
+ }
93
+ ],
94
+ "stateMutability": "view",
95
+ "type": "function"
96
+ },
97
+ {
98
+ "inputs": [],
99
+ "name": "ORACLE_MIN_STALE_PERIOD",
100
+ "outputs": [
101
+ {
102
+ "internalType": "uint256",
103
+ "name": "",
104
+ "type": "uint256"
105
+ }
106
+ ],
107
+ "stateMutability": "view",
108
+ "type": "function"
109
+ },
110
+ {
111
+ "inputs": [],
112
+ "name": "ORACLE_MIN_VAULT_RATE_WAD",
113
+ "outputs": [
114
+ {
115
+ "internalType": "uint256",
116
+ "name": "",
117
+ "type": "uint256"
118
+ }
119
+ ],
120
+ "stateMutability": "view",
121
+ "type": "function"
122
+ },
123
+ {
124
+ "inputs": [],
125
+ "name": "WAD",
126
+ "outputs": [
127
+ {
128
+ "internalType": "uint256",
129
+ "name": "",
130
+ "type": "uint256"
131
+ }
132
+ ],
133
+ "stateMutability": "view",
134
+ "type": "function"
135
+ }
136
+ ],
137
+ "bytecode": "0x61016861003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100a85760003560e01c8063730513511161007057806373051351146101015780639a1b2c43146100ad578063afb9888514610112578063d160ed4d14610121578063f3f7de781461012957600080fd5b80634e9331ef146100ad5780635c94d0f9146100c85780636a146024146100d75780636bae86bb146100e65780636c0d5b36146100f2575b600080fd5b6100b6610e1081565b60405190815260200160405180910390f35b6100b667016345785d8a000081565b6100b6670de0b6b3a764000081565b6100b66402540be40081565b6100b66729a2241af62c000081565b6100b669d3c21bcecceda100000081565b6100b66702c68af0bb14000081565b6100b6600581565b6100b6612a308156fea2646970667358221220d6f647b3c28297edebdcc6db110e61679c0f7edfa1fac62ab3ee1dd2d29c106c64736f6c63430008150033",
138
+ "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100a85760003560e01c8063730513511161007057806373051351146101015780639a1b2c43146100ad578063afb9888514610112578063d160ed4d14610121578063f3f7de781461012957600080fd5b80634e9331ef146100ad5780635c94d0f9146100c85780636a146024146100d75780636bae86bb146100e65780636c0d5b36146100f2575b600080fd5b6100b6610e1081565b60405190815260200160405180910390f35b6100b667016345785d8a000081565b6100b6670de0b6b3a764000081565b6100b66402540be40081565b6100b66729a2241af62c000081565b6100b669d3c21bcecceda100000081565b6100b66702c68af0bb14000081565b6100b6600581565b6100b6612a308156fea2646970667358221220d6f647b3c28297edebdcc6db110e61679c0f7edfa1fac62ab3ee1dd2d29c106c64736f6c63430008150033",
139
+ "linkReferences": {},
140
+ "deployedLinkReferences": {}
141
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "_format": "hh-sol-dbg-1",
3
+ "buildInfo": "../../../build-info/59a7a86e788a7471c2e99b922236c2bf.json"
4
+ }