Created
July 18, 2023 10:29
-
-
Save TehilaFavourite/e891d92e719ea44fa324816061e1bfa6 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.8.0; | |
contract OutOfGasExample { | |
uint256[] public largeArray; | |
function addElements(uint256 numElements) public { | |
// Simulate an expensive operation that consumes a lot of gas | |
for (uint256 i = 0; i < numElements; i++) { | |
largeArray.push(i); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment