Skip to content

Instantly share code, notes, and snippets.

@fassko
Created September 21, 2023 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fassko/6f1c75f9c78766f73272cbb8930a0b5f to your computer and use it in GitHub Desktop.
Save fassko/6f1c75f9c78766f73272cbb8930a0b5f to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.21+commit.d9974bed.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;
contract Employees {
struct Employee {
string name;
uint256 salary;
}
mapping(address => Employee) employees;
function addEmployee(address _address, string memory name, uint256 salary) external {
// Employee memory employee = Employee({name: name, salary: salary});
// Employee memory employee;
// employee.name = name;
// employee.salary = salary;
Employee memory employee = Employee(name, salary);
employees[_address] = employee;
}
function getEmployee(address _address) external view returns (Employee memory) {
return employees[_address];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment