Created
May 4, 2023 00:51
-
-
Save Drblessing/ae555152cbe3abe6bcc9db90efe1a9a6 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
This file contains hidden or 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: GPL-2.0 | |
pragma solidity >=0.8.9; | |
contract PayableForward { | |
Forwardee forwardee; | |
constructor(Forwardee forwardee_) { | |
forwardee = forwardee_; | |
} | |
function payableFunction() public payable { | |
forwardee.payableForwardee{value: msg.value}(msg.value); | |
} | |
} | |
contract Forwardee { | |
uint public balance; | |
function payableForwardee(uint msgValue) public payable { | |
balance = msg.value; | |
require(msg.value != 0, "Error: msg.value is empty."); | |
require(balance == msg.value,"Error: balance does not equal msg.value."); | |
require(msgValue == msg.value, "Error: msg.value does not equal forwarded value."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment