Skip to content

Instantly share code, notes, and snippets.

View Aboudjem's full-sized avatar

Adam Boudj Aboudjem

View GitHub Profile
@Aboudjem
Aboudjem / Entrypoint.md
Last active January 27, 2024 13:56
Entrypoint Data

to: 0x4e59b44847b379578588920ca78fbf26c0b4956c,

value: 0,

data: `0x000000000000000000000000000000000000000000000000000000000000000060a080604052346200008957600160025561022c8181016001600160401b038111838210176200007357829162005d18833903906000f080156200006757608052604051615c8990816200008f82396080518181816113df01528181613e9501526141b60152f35b6040513d6000823e3d90fd5b634e487b7160e01b600052604160045260246000fd5b600080fdfe60806040526004361015610023575b361561001957600080fd5b610021615531565b005b60003560e01c80630396cb60146101b35780630bd28e3b146101aa5780631b2e01b8146101a15780631d732756146101985780631fad948c1461018f578063205c28781461018657806335567e1a1461017d5780634b1d7cf5146101745780635287ce121461016b57806370a08231146101625780638f41ec5a14610159578063957122ab146101505780639b249f6914610147578063a61935311461013e578063b760faf914610135578063bb9fe6bf1461012c578063c23a5cea14610123578063d6383f941461011a578063ee219423146101115763fc7e286d0361000e5761010c611bcd565b61000e565b5061010c6119b5565b5061010c61184d565b5061010c6116b4565b5

@Aboudjem
Aboudjem / Create.sol
Last active March 25, 2024 19:29
Create, Create2, Create3
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract Template {
uint256 variable1;
}
contract Create {
@Aboudjem
Aboudjem / extract-address-from-tx.js
Created March 22, 2023 15:31
Function to extract the public key and address associated to a transaction
const { ethers } = require("ethers");
// Function to extract the address associated with to a transaction
async function getPublicKeyFromTransactionHash(provider, txHash) {
// Fetch the transaction using the transaction hash and provier
const tx = await provider.getTransaction(txHash);
// Extract the all the relevant fields from the transaction (We need all of them)
const unsignedTx = {
gasLimit: tx.gasLimit,
// SPDX-License-Identifier: GPL-2.0-or-later
// File @uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol@v1.0.0
pragma solidity >=0.5.0;
/// @title Pool state that never changes
/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values
interface IUniswapV3PoolImmutables {
@Aboudjem
Aboudjem / TestERC1155.sol
Created March 16, 2022 22:06
Test ERC1155
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC1155/ERC1155.sol";
contract TestERC1155 is ERC1155 {
constructor() ERC1155 ("test") {
@Aboudjem
Aboudjem / testKeccak.sol
Created March 16, 2022 15:31
Test Keccak256 with string and bytes32
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.12;
contract Test {
function getBytes32() external pure returns (bytes32, bytes32) {
bytes32 withString = keccak256(abi.encode("0x0000000000000000000000000000000000000000000000000000000000000001"));
bytes32 withBytes32 = keccak256(abi.encode(0x0000000000000000000000000000000000000000000000000000000000000001));
return (withString, withBytes32);
}
}
/**
*Submitted for verification at Etherscan.io on 2021-10-19
*/
// SPDX-License-Identifier: MIT
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.3.2
pragma solidity ^0.8.0;
@Aboudjem
Aboudjem / TestContract.sol
Created March 8, 2022 19:14
TestContract
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.12;
contract TestContract {
uint public myUint = 111222333444555;
string private myString;
address public myAddress;
constructor(string memory _newString) {
@Aboudjem
Aboudjem / FatherSonContract.sol
Created March 8, 2022 16:33
FatherSonContract
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.12;
import "https://raw.githubusercontent.com/OpenZeppelin/openzeppelin-contracts/master/contracts/token/ERC20/IERC20.sol";
contract TestContract {
address mySonAddress;
uint amountToSend;
uint expirationDate;
@Aboudjem
Aboudjem / Token.sol
Created November 29, 2021 10:43
ERC20 Token
// Sources flattened with hardhat v2.7.0 https://hardhat.org
// File @openzeppelin/contracts/utils/Context.sol@v4.4.0
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Context.sol)
pragma solidity ^0.8.0;
/**