Skip to content

Instantly share code, notes, and snippets.

@eth-jashan
Created March 15, 2024 19:40
Show Gist options
  • Save eth-jashan/8b0c469edc9ea092b5fa00f9b2691130 to your computer and use it in GitHub Desktop.
Save eth-jashan/8b0c469edc9ea092b5fa00f9b2691130 to your computer and use it in GitHub Desktop.
Simple contract to relay TXN of DLN
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract DLNFunctionExecutor {
address public dlnSource;
constructor() {
}
// Modifier to restrict access to the owner of the contract
// modifier onlyOwner() {
// require(msg.sender == owner, "Only owner can call this function");
// _;
// }
// Function to execute a transaction
function executeTransaction(address _to, uint256 _value, bytes memory _data) external {
// Get the current contract balance
uint256 balance = address(this).balance;
// Check if the contract balance is sufficient
require(balance >= _value, "Insufficient contract balance");
// Execute the transaction
(bool success, ) = _to.call{value: _value}(_data);
// Revert if the transaction fails
require(success, "Transaction execution failed");
}
// Function to transfer ownership of the contract
// function transferOwnership(address _newOwner) external {
// owner = _newOwner;
// }
// Fallback function to receive Ether
receive() external payable {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment