-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmployeeStorage.sol
More file actions
41 lines (32 loc) · 877 Bytes
/
EmployeeStorage.sol
File metadata and controls
41 lines (32 loc) · 877 Bytes
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
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.23;
contract EmployeeStorage {
string public name;
uint public idNumber;
uint24 private salary;
uint16 private shares;
constructor() {
name = "Pat";
idNumber = 112358132134;
salary = 50000;
shares = 1000;
}
function grantShares(uint16 _newShares) external {
require(_newShares <= 5000, "Too many shares");
shares += _newShares;
}
function checkForPacking(uint _slot) external view returns (uint result) {
assembly {
result := sload(_slot)
}
}
function viewShares() external view returns (uint16) {
return shares;
}
function viewSalary() external view returns (uint24) {
return salary;
}
function debugResetShares() external {
shares = 1000;
}
}