Created
December 3, 2022 10:56
-
-
Save 0xdeepmehta/51e252edcd1aa2d263a0b514c74c5a0f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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