Skip to content

Instantly share code, notes, and snippets.

@0xdeepmehta
Created December 3, 2022 10:56
Show Gist options
  • Save 0xdeepmehta/51e252edcd1aa2d263a0b514c74c5a0f to your computer and use it in GitHub Desktop.
Save 0xdeepmehta/51e252edcd1aa2d263a0b514c74c5a0f to your computer and use it in GitHub Desktop.
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract AMM is ReentrancyGuard{
using Counters for Counters.Counter;
Counters.Counter private caseID;
struct SomeXYZData {
uint256 caseID;
address from;
}
mapping(uint256 => SomeXYZData) public xyzData;
function createData() public nonReentrant
{
caseID.increment();
SomeXYZData storage currData = xyzData[caseID.current()];
currData.caseID = caseID.current();
currData.from = msg.sender;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment