Skip to content

Instantly share code, notes, and snippets.

@TehilaFavourite
Created July 18, 2023 10:29
Show Gist options
  • Save TehilaFavourite/e891d92e719ea44fa324816061e1bfa6 to your computer and use it in GitHub Desktop.
Save TehilaFavourite/e891d92e719ea44fa324816061e1bfa6 to your computer and use it in GitHub Desktop.
// 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