# Base Learn Roles - 4 > Base Learn Prefect Role Contract Codes **Published by:** [timurlenk](https://paragraph.com/@timurlenk/) **Published on:** 2025-09-20 **Categories:** base **URL:** https://paragraph.com/@timurlenk/base-learn-roles-4 ## Content Error Triage Pin NFT Contract Code:// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.23; interface ISubmission { function diffWithNeighbor( uint _a, uint _b, uint _c, uint _d ) external pure returns (uint[] memory); function applyModifier( uint _base, int _modifier ) external pure returns (uint); function popWithReturn() external returns (uint); function addToArr(uint _num) external; function getArr() external view returns (uint[] memory); function resetArr() external; } contract Submission is ISubmission { uint[] private numbers; function diffWithNeighbor( uint _a, uint _b, uint _c, uint _d ) external pure override returns (uint[] memory) { uint[] memory differences = new uint[](3); differences[0] = _a > _b ? _a - _b : _b - _a; differences[1] = _b > _c ? _b - _c : _c - _b; differences[2] = _c > _d ? _c - _d : _d - _c; return differences; } function applyModifier( uint _base, int _modifier ) external pure override returns (uint) { return uint(int256(_base) + _modifier); } function popWithReturn() external override returns (uint) { require(numbers.length > 0, "Cannot pop from an empty array"); uint lastElement = numbers[numbers.length - 1]; numbers.pop(); return lastElement; } function addToArr(uint _num) external override { numbers.push(_num); } function getArr() external view override returns (uint[] memory) { return numbers; } function resetArr() external override { delete numbers; } }New Keyword Pin NFT Contract Code:// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.23; import "@openzeppelin/contracts/access/Ownable.sol"; interface IAddressBook { struct Contact { uint id; string firstName; string lastName; uint[] phoneNumbers; } function addContact( string memory _firstName, string memory _lastName, uint[] memory _phoneNumbers ) external; function deleteContact(uint _id) external; function getContact(uint _id) external view returns (Contact memory); function getAllContacts() external view returns (Contact[] memory); } contract AddressBook is IAddressBook, Ownable { mapping(uint => Contact) private contacts; uint[] private contactIds; mapping(uint => uint) private idToIndex; uint private nextContactId; constructor() Ownable(msg.sender) {} function addContact( string memory _firstName, string memory _lastName, uint[] memory _phoneNumbers ) external override onlyOwner { uint currentId = nextContactId; contacts[currentId] = Contact({ id: currentId, firstName: _firstName, lastName: _lastName, phoneNumbers: _phoneNumbers }); idToIndex[currentId] = contactIds.length; contactIds.push(currentId); nextContactId++; } function deleteContact(uint _id) external override onlyOwner { require(idToIndex[_id] != 0 || contactIds[0] == _id, "Contact not found"); uint index = idToIndex[_id]; uint lastId = contactIds[contactIds.length - 1]; contactIds[index] = lastId; idToIndex[lastId] = index; contactIds.pop(); delete contacts[_id]; delete idToIndex[_id]; } function getContact(uint _id) external view override returns (Contact memory) { return contacts[_id]; } function getAllContacts() external view override returns (Contact[] memory) { Contact[] memory allContacts = new Contact[](contactIds.length); for (uint i = 0; i < contactIds.length; i++) { allContacts[i] = contacts[contactIds[i]]; } return allContacts; } } interface ISubmission { function deploy() external returns (address); } contract Submission is ISubmission { function deploy() external override returns (address) { AddressBook newAddressBook = new AddressBook(); return address(newAddressBook); } }Imports Pin NFT Contract Code:// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.23; interface ISubmission { struct Haiku { string line1; string line2; string line3; } function getHaiku() external view returns (Haiku memory); function saveHaiku( string memory _line1, string memory _line2, string memory _line3 ) external; function shruggieHaiku() external view returns (Haiku memory); } contract Submission is ISubmission { Haiku private storedHaiku; function saveHaiku( string memory _line1, string memory _line2, string memory _line3 ) external override { storedHaiku.line1 = _line1; storedHaiku.line2 = _line2; storedHaiku.line3 = _line3; } function getHaiku() external view override returns (Haiku memory) { return storedHaiku; } function shruggieHaiku() external view override returns (Haiku memory) { Haiku memory tempHaiku; tempHaiku.line1 = storedHaiku.line1; tempHaiku.line2 = storedHaiku.line2; tempHaiku.line3 = string.concat(storedHaiku.line3, unicode" 🤷"); return tempHaiku; } } ## 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