SKIP TO CONTENT

Demo build — mock protocol data. No chain, no ABIs yet.

  • SYNCING: ……

IK401Interfaces.sol

Shared interfaces every module codes against.

190 lines7.5 KBSolidity
Source of src/interfaces/IK401Interfaces.sol, 190 lines of Solidity
1// SPDX-License-Identifier: MIT
2pragma solidity ^0.8.24;
3 
4/*//////////////////////////////////////////////////////////////
5 SHARED TYPES
6//////////////////////////////////////////////////////////////*/
7 
8/// @dev A Seat is either VESTED (earns tokenized equity from the StockDesk)
9/// or ON_THE_CLOCK (earns 401K emission from the Distributor). Never both.
10enum SeatMode {
11 VESTED,
12 ON_THE_CLOCK
13}
14 
15/// @dev Supported tokenized-equity symbols. `USDG` is the settlement asset and is
16/// intentionally the last member so `uint8(Symbol.USDG)` can act as a sentinel.
17enum Symbol {
18 NVDA,
19 AAPL,
20 TSLA,
21 MSFT,
22 PLTR,
23 AMZN,
24 GOOGL,
25 META,
26 AMD,
27 GME,
28 SPACEX,
29 USDG
30}
31 
32/*//////////////////////////////////////////////////////////////
33 INTERFACES
34//////////////////////////////////////////////////////////////*/
35 
36interface IERC20Like {
37 function totalSupply() external view returns (uint256);
38 function balanceOf(address) external view returns (uint256);
39 function decimals() external view returns (uint8);
40 function transfer(address, uint256) external returns (bool);
41 function transferFrom(address, address, uint256) external returns (bool);
42 function approve(address, uint256) external returns (bool);
43 function allowance(address, address) external view returns (uint256);
44}
45 
46interface IK401 {
47 function totalSupply() external view returns (uint256);
48 function balanceOf(address) external view returns (uint256);
49 function transfer(address, uint256) external returns (bool);
50 function transferFrom(address, address, uint256) external returns (bool);
51 function approve(address, uint256) external returns (bool);
52 function mirrorERC721() external view returns (address);
53 
54 function mint(address to, uint256 amount) external;
55 function burnFrom(address from, uint256 amount) external;
56 function burnFromKeeping(address from, uint256 amount, uint256 keepId) external;
57 function burnSeats(address from, uint256[] memory ids) external;
58 
59 function lockSeat(address owner, uint256 id) external;
60 function unlockSeat(address owner, uint256 id) external;
61 function isSeatLocked(uint256 id) external view returns (bool);
62 function lockedSeats(address owner) external view returns (uint256);
63 
64 function ownerOfSeat(uint256 id) external view returns (address);
65 function seatExists(uint256 id) external view returns (bool);
66 function totalSeats() external view returns (uint256);
67 function seatsOf(address owner) external view returns (uint256[] memory);
68 function isPair(address) external view returns (bool);
69 function isWhitelisted(address) external view returns (bool);
70}
71 
72interface IK401Oracle {
73 /// @notice USDG (18-dec normalised) per 1e18 of 401K, time-weighted.
74 function consult() external view returns (uint256 priceWad);
75 /// @notice Same as `consult` but returns (0,false) instead of reverting.
76 function peek() external view returns (uint256 priceWad, bool ok);
77 function isValid() external view returns (bool);
78 function checkpoint() external;
79 function lastCheckpointTs() external view returns (uint256);
80 function twapPeriod() external view returns (uint256);
81}
82 
83interface IK401Treasury {
84 function nav() external view returns (uint256);
85 function rfv() external view returns (uint256);
86 function rfvPerToken() external view returns (uint256);
87 function reserveValueWad() external view returns (uint256);
88 function equityValueWad() external view returns (uint256);
89 function maxMintable() external view returns (uint256);
90 function valueOf(address token, uint256 amount) external view returns (uint256);
91 function deposit(address token, uint256 amount, uint256 profitWad) external returns (uint256);
92 function manage(address token, uint256 amount, address to) external;
93 function mintForModule(address to, uint256 amount) external;
94}
95 
96interface IK401Staking {
97 function totalStaked() external view returns (uint256);
98 function index() external view returns (uint256);
99 function notifyEmission(uint256 amount) external;
100 function pending(address user) external view returns (uint256);
101}
102 
103interface IK401SeatRegistry {
104 function tierOf(uint256 tokenId) external view returns (uint8);
105 function multiplierOf(uint256 tokenId) external view returns (uint256);
106 function modeOf(uint256 tokenId) external view returns (SeatMode);
107 function totalVestedMultiplier() external view returns (uint256);
108 function weightedMultiplier(uint8 symbolId) external view returns (uint256);
109 function seatWeightedMultiplier(uint256 tokenId, uint8 symbolId) external view returns (uint256);
110 function stocksOf(uint256 tokenId) external view returns (uint8[3] memory, uint16[3] memory);
111 function generationOf(uint256 tokenId) external view returns (uint32);
112 function startSeqOf(uint256 tokenId) external view returns (uint256);
113 function tierMultiplier(uint8 tier) external pure returns (uint256);
114 function onSeatTransfer(address from, address to, uint256 id) external;
115 function setMode(uint256 tokenId, SeatMode newMode) external;
116 function creditStockUsd(uint256 tokenId, uint256 usdWad) external;
117 function lifetimeStockUsd(uint256 tokenId) external view returns (uint256);
118}
119 
120interface IK401StockDesk {
121 function settleSeat(uint256 tokenId) external;
122 function claimable(uint256 tokenId, uint8 symbolId) external view returns (uint256);
123 function batchSeq() external view returns (uint256);
124}
125 
126interface IK401Seat6551 {
127 function tbaOf(uint256 tokenId) external view returns (address);
128 function tbaFor(uint256 tokenId) external returns (address);
129 function isDeployed(uint256 tokenId) external view returns (bool);
130}
131 
132interface IPriceFeed {
133 function decimals() external view returns (uint8);
134 function latestRoundData()
135 external
136 view
137 returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
138}
139 
140interface IUniswapV2Pair {
141 function token0() external view returns (address);
142 function token1() external view returns (address);
143 function totalSupply() external view returns (uint256);
144 function balanceOf(address) external view returns (uint256);
145 function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
146 function price0CumulativeLast() external view returns (uint256);
147 function price1CumulativeLast() external view returns (uint256);
148}
149 
150interface IUniswapV2Router {
151 function swapExactTokensForTokens(
152 uint256 amountIn,
153 uint256 amountOutMin,
154 address[] calldata path,
155 address to,
156 uint256 deadline
157 ) external returns (uint256[] memory amounts);
158 
159 function getAmountsOut(uint256 amountIn, address[] calldata path)
160 external
161 view
162 returns (uint256[] memory amounts);
163}
164 
165interface IERC6551Registry {
166 event ERC6551AccountCreated(
167 address account,
168 address indexed implementation,
169 bytes32 salt,
170 uint256 chainId,
171 address indexed tokenContract,
172 uint256 indexed tokenId
173 );
174 
175 error AccountCreationFailed();
176 
177 function createAccount(
178 address implementation,
179 bytes32 salt,
180 uint256 chainId,
181 address tokenContract,
182 uint256 tokenId
183 ) external returns (address account);
184 
185 function account(address implementation, bytes32 salt, uint256 chainId, address tokenContract, uint256 tokenId)
186 external
187 view
188 returns (address account);
189}
190 

Click any line number to deep-link to it — the target line highlights on load.