Contract 0xc7332D9AbEF755C42b4dF9d9db09BEEf15F8f9Fb

Txn Hash Method
Block
From
To
Value [Txn Fee]
0xde6e022b5b4b185220bb29103b254448c53199a9865446c3ab52227d7681edd80x6106e061163283392022-06-21 14:01:5397 days 2 hrs agoYield Yak: Deployer IN  Create: DataStoreUtils0 AVAX0.01429860333
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DataStoreUtils

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 1 : DataStoreLib.sol
// SPDX-License-Identifier: MIT

pragma solidity =0.8.7;

/**
 * @title Storage Management library for dynamic structs based on data types
 *
 * DataStoreUtils is a storage management tool designed to create a safe and scalable
 * storage layout with the help of ids and keys.
 * Mainly focusing on upgradable contracts with multiple user types to create a
 * sustainable development environment.
 *
 * In summary, extra gas cost that would be saved with Storage packing are
 * ignored to create upgradable structs.
 *
 * IDs are the representation of a user with any given key as properties.
 * Type for ID is not mandatory, not all IDs should have an explicit type.
 * Thus there is no checks of types or keys.
 *
 * @notice distinct id and key pairs return different storage slots
 *
 */
library DataStoreUtils {
  /**
   * @notice Main Struct for reading and writing data to storage for given id+key pairs
   * @param allIdsByType optional categorization for given ID, requires direct access, type => id[]
   * @param uintData keccak(id, key) =>  returns uint256
   * @param bytesData keccak(id, key) => returns bytes
   * @param addressData keccak(id, key) =>  returns address
   * NOTE any other storage type can be expressed as bytes
   */
  struct DataStore {
    mapping(uint256 => uint256[]) allIdsByType;
    mapping(bytes32 => uint256) uintData;
    mapping(bytes32 => bytes) bytesData;
    mapping(bytes32 => address) addressData;
  }

  /**
   * **DATA GETTERS **
   **/
  function readUintForId(
    DataStore storage self,
    uint256 _id,
    bytes32 _key
  ) public view returns (uint256 data) {
    data = self.uintData[keccak256(abi.encodePacked(_id, _key))];
  }

  function readBytesForId(
    DataStore storage self,
    uint256 _id,
    bytes32 _key
  ) public view returns (bytes memory data) {
    data = self.bytesData[keccak256(abi.encodePacked(_id, _key))];
  }

  function readAddressForId(
    DataStore storage self,
    uint256 _id,
    bytes32 _key
  ) public view returns (address data) {
    data = self.addressData[keccak256(abi.encodePacked(_id, _key))];
  }

  /**
   * **DATA SETTERS **
   **/
  function writeUintForId(
    DataStore storage self,
    uint256 _id,
    bytes32 _key,
    uint256 data
  ) public {
    self.uintData[keccak256(abi.encodePacked(_id, _key))] = data;
  }

  function writeBytesForId(
    DataStore storage self,
    uint256 _id,
    bytes32 _key,
    bytes memory data
  ) public {
    self.bytesData[keccak256(abi.encodePacked(_id, _key))] = data;
  }

  function writeAddressForId(
    DataStore storage self,
    uint256 _id,
    bytes32 _key,
    address data
  ) public {
    self.addressData[keccak256(abi.encodePacked(_id, _key))] = data;
  }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract ABI

[]

6106e061003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361061006c5760003560e01c8063035ca116146100715780638efea4001461009a578063a1e48580146100bc578063dff34ff1146100e7578063eee4dd9014610107578063f237bab314610127575b600080fd5b61008461007f36600461048b565b610148565b6040516100919190610604565b60405180910390f35b8180156100a657600080fd5b506100ba6100b53660046105d2565b610222565b005b6100cf6100ca36600461048b565b610273565b6040516001600160a01b039091168152602001610091565b8180156100f357600080fd5b506100ba6101023660046104b7565b6102ce565b81801561011357600080fd5b506100ba610122366004610504565b61033f565b61013a61013536600461048b565b6103a0565b604051908152602001610091565b6060836002016000848460405160200161016c929190918252602082015260400190565b604051602081830303815290604052805190602001208152602001908152602001600020805461019b90610659565b80601f01602080910402602001604051908101604052809291908181526020018280546101c790610659565b80156102145780601f106101e957610100808354040283529160200191610214565b820191906000526020600020905b8154815290600101906020018083116101f757829003601f168201915b505050505090509392505050565b808460010160008585604051602001610245929190918252602082015260400190565b6040516020818303038152906040528051906020012081526020019081526020016000208190555050505050565b60008360030160008484604051602001610297929190918252602082015260400190565b60408051601f19818403018152918152815160209283012083529082019290925201600020546001600160a01b0316949350505050565b8084600301600085856040516020016102f1929190918252602082015260400190565b60405160208183030381529060405280519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b0316021790555050505050565b808460020160008585604051602001610362929190918252602082015260400190565b60405160208183030381529060405280519060200120815260200190815260200160002090805190602001906103999291906103f2565b5050505050565b600083600101600084846040516020016103c4929190918252602082015260400190565b6040516020818303038152906040528051906020012081526020019081526020016000205490509392505050565b8280546103fe90610659565b90600052602060002090601f0160209004810192826104205760008555610466565b82601f1061043957805160ff1916838001178555610466565b82800160010185558215610466579182015b8281111561046657825182559160200191906001019061044b565b50610472929150610476565b5090565b5b808211156104725760008155600101610477565b6000806000606084860312156104a057600080fd5b505081359360208301359350604090920135919050565b600080600080608085870312156104cd57600080fd5b84359350602085013592506040850135915060608501356001600160a01b03811681146104f957600080fd5b939692955090935050565b6000806000806080858703121561051a57600080fd5b843593506020850135925060408501359150606085013567ffffffffffffffff8082111561054757600080fd5b818701915087601f83011261055b57600080fd5b81358181111561056d5761056d610694565b604051601f8201601f19908116603f0116810190838211818310171561059557610595610694565b816040528281528a60208487010111156105ae57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b600080600080608085870312156105e857600080fd5b5050823594602084013594506040840135936060013592509050565b600060208083528351808285015260005b8181101561063157858101830151858201604001528201610615565b81811115610643576000604083870101525b50601f01601f1916929092016040019392505050565b600181811c9082168061066d57607f821691505b6020821081141561068e57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fdfea2646970667358221220f9a841662e1f4b2e5176fba167154338080573963dbd7196eeeb109889edce3064736f6c63430008070033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.