# Base Learn Roles -2 **Published by:** [timurlenk](https://paragraph.com/@timurlenk/) **Published on:** 2025-09-17 **Categories:** base **URL:** https://paragraph.com/@timurlenk/base-learn-roles-2 ## Content Storage Pin NFT Contract Codes // 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; } }Control Structures Pin NFT Contract Codes // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.23; contract ControlStructures { error AfterHours(uint256 time); function fizzBuzz(uint256 _number) external pure returns (string memory) { if (_number % 15 == 0) { return "FizzBuzz"; } else if (_number % 3 == 0) { return "Fizz"; } else if (_number % 5 == 0) { return "Buzz"; } else { return "Splat"; } } function doNotDisturb(uint256 _time) external pure returns (string memory) { assert(_time <= 2400); if (_time <= 800 || _time > 2200) { revert AfterHours(_time); } if (_time > 800 && _time <= 1200) { return "Morning!"; } else if (_time > 1200 && _time <= 1800) { return "Afternoon!"; } else { return "Evening!"; } } }Arrays Pin NFT Contract Codes // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.23; contract Submission { uint[] private numbers; uint[] private timestamps; address[] private senders; constructor() { resetNumbers(); } function resetNumbers() public { delete numbers; for (uint i = 1; i <= 10; i++) { numbers.push(i); } } function appendToNumbers(uint[] calldata _toAppend) external { for (uint i = 0; i < _toAppend.length; i++) { numbers.push(_toAppend[i]); } } function getNumbers() external view returns (uint[] memory) { return numbers; } function saveTimestamp(uint _unixTimestamp) external { timestamps.push(_unixTimestamp); senders.push(msg.sender); } function resetTimestamps() external { delete timestamps; } function resetSenders() external { delete senders; } function afterY2K() external view returns (uint[] memory, address[] memory) { uint count = 0; for (uint i = 0; i < timestamps.length; i++) { if (timestamps[i] >= 946702900) { count++; } } uint[] memory filteredTimestamps = new uint[](count); address[] memory filteredAddresses = new address[](count); uint counter = 0; for (uint i = 0; i < timestamps.length; i++) { if (timestamps[i] >= 946702900) { filteredTimestamps[counter] = timestamps[i]; filteredAddresses[counter] = senders[i]; counter++; } } return (filteredTimestamps, filteredAddresses); } } ## Publication Information - [timurlenk](https://paragraph.com/@timurlenk/): Publication homepage - [All Posts](https://paragraph.com/@timurlenk/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@timurlenk): Subscribe to updates - [Twitter](https://twitter.com/timurwp1): Follow on Twitter - [Farcaster](https://farcaster.xyz/timurlenk): Follow on Farcaster