Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Withdraw | 20103006 | 214 days ago | IN | 0 ETH | 0.0002266 |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
PaymentSplitter
Compiler Version
v0.8.26+commit.8a97fa7a
Optimization Enabled:
Yes with 600 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; contract PaymentSplitter is ReentrancyGuard { address payable public addressA; address payable public addressB; address payable public addressC; uint256 public totalDeposited; uint256 public paidToA; uint256 public paidToB; uint256 public paidToC; constructor(address payable _addressA, address payable _addressB, address payable _addressC) { require(_addressA != address(0), "Address A cannot be the zero address"); require(_addressB != address(0), "Address B cannot be the zero address"); require(_addressC != address(0), "Address C cannot be the zero address"); addressA = _addressA; addressB = _addressB; addressC = _addressC; } // Function to receive Ether. msg.data must be empty receive() external payable { totalDeposited += msg.value; } // Fallback function is called when msg.data is not empty fallback() external payable { totalDeposited += msg.value; } //modifier to check if the caller is one of the addresses modifier onlyBeneficiaries() { require(msg.sender == addressA || msg.sender == addressB || msg.sender == addressC, "Caller is not one of the addresses"); _; } function withdraw() external nonReentrant onlyBeneficiaries{ uint256 balance = address(this).balance; require(balance > 0, "No funds to withdraw"); uint256 payoutA; uint256 payoutB; uint256 payoutC; if (paidToA < 2 ether) { uint256 remainingToA = 2 ether - paidToA; if (balance <= remainingToA) { payoutA = balance; paidToA += balance; } else { payoutA = remainingToA; uint256 remainingBalance = balance - remainingToA; payoutA += (remainingBalance * 80) / 100; payoutB = (remainingBalance * 10) / 100; payoutC = (remainingBalance * 10) / 100; paidToA += payoutA; paidToB += payoutB; paidToC += payoutC; } } else { payoutA = (balance * 80) / 100; payoutB = (balance * 10) / 100; payoutC = (balance * 10) / 100; paidToA += payoutA; paidToB += payoutB; paidToC += payoutC; } if (payoutA > 0) { (bool successA, ) = addressA.call{value: payoutA}(""); require(successA, "Transfer to addressA failed"); } if (payoutB > 0) { (bool successB, ) = addressB.call{value: payoutB}(""); require(successB, "Transfer to addressB failed"); } if (payoutC > 0) { (bool successC, ) = addressC.call{value: payoutC}(""); require(successC, "Transfer to addressC failed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; uint256 private _status; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); constructor() { _status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be NOT_ENTERED if (_status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail _status = ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == ENTERED; } }
{ "optimizer": { "enabled": true, "runs": 600 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address payable","name":"_addressA","type":"address"},{"internalType":"address payable","name":"_addressB","type":"address"},{"internalType":"address payable","name":"_addressC","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"addressA","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"addressB","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"addressC","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paidToA","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paidToB","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paidToC","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDeposited","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
608060405234801561001057600080fd5b5060405161093338038061093383398101604081905261002f916101bd565b60016000556001600160a01b03831661009b5760405162461bcd60e51b8152602060048201526024808201527f4164647265737320412063616e6e6f7420626520746865207a65726f206164646044820152637265737360e01b60648201526084015b60405180910390fd5b6001600160a01b0382166100fd5760405162461bcd60e51b8152602060048201526024808201527f4164647265737320422063616e6e6f7420626520746865207a65726f206164646044820152637265737360e01b6064820152608401610092565b6001600160a01b03811661015f5760405162461bcd60e51b8152602060048201526024808201527f4164647265737320432063616e6e6f7420626520746865207a65726f206164646044820152637265737360e01b6064820152608401610092565b600180546001600160a01b039485166001600160a01b031991821617909155600280549385169382169390931790925560038054919093169116179055610200565b80516001600160a01b03811681146101b857600080fd5b919050565b6000806000606084860312156101d257600080fd5b6101db846101a1565b92506101e9602085016101a1565b91506101f7604085016101a1565b90509250925092565b6107248061020f6000396000f3fe60806040526004361061007f5760003560e01c8063b71502421161004e578063b71502421461013e578063c79fc60914610154578063fd4e4d7514610174578063ff50abdc146101945761009e565b806308b7c79c146100b057806335cb9f15146100d95780633ccfd60b146100ef5780634526196e146101065761009e565b3661009e5734600460008282546100969190610689565b925050819055005b34600460008282546100969190610689565b3480156100bc57600080fd5b506100c660065481565b6040519081526020015b60405180910390f35b3480156100e557600080fd5b506100c660075481565b3480156100fb57600080fd5b506101046101aa565b005b34801561011257600080fd5b50600254610126906001600160a01b031681565b6040516001600160a01b0390911681526020016100d0565b34801561014a57600080fd5b506100c660055481565b34801561016057600080fd5b50600354610126906001600160a01b031681565b34801561018057600080fd5b50600154610126906001600160a01b031681565b3480156101a057600080fd5b506100c660045481565b6101b2610649565b6001546001600160a01b03163314806101d557506002546001600160a01b031633145b806101ea57506003546001600160a01b031633145b6102465760405162461bcd60e51b815260206004820152602260248201527f43616c6c6572206973206e6f74206f6e65206f66207468652061646472657373604482015261657360f01b60648201526084015b60405180910390fd5b47806102945760405162461bcd60e51b815260206004820152601460248201527f4e6f2066756e647320746f207769746864726177000000000000000000000000604482015260640161023d565b6000806000671bc16d674ec8000060055410156103a3576000600554671bc16d674ec800006102c391906106a2565b90508085116102ec5784935084600560008282546102e19190610689565b9091555061039d9050565b92508260006102fb82876106a2565b9050606461030a8260506106b5565b61031491906106cc565b61031e9086610689565b9450606461032d82600a6106b5565b61033791906106cc565b9350606461034682600a6106b5565b61035091906106cc565b925084600560008282546103649190610689565b92505081905550836006600082825461037d9190610689565b9250508190555082600760008282546103969190610689565b9091555050505b50610438565b60646103b08560506106b5565b6103ba91906106cc565b925060646103c985600a6106b5565b6103d391906106cc565b915060646103e285600a6106b5565b6103ec91906106cc565b905082600560008282546104009190610689565b9250508190555081600660008282546104199190610689565b9250508190555080600760008282546104329190610689565b90915550505b82156104e3576001546040516000916001600160a01b03169085908381818185875af1925050503d806000811461048b576040519150601f19603f3d011682016040523d82523d6000602084013e610490565b606091505b50509050806104e15760405162461bcd60e51b815260206004820152601b60248201527f5472616e7366657220746f206164647265737341206661696c65640000000000604482015260640161023d565b505b811561058e576002546040516000916001600160a01b03169084908381818185875af1925050503d8060008114610536576040519150601f19603f3d011682016040523d82523d6000602084013e61053b565b606091505b505090508061058c5760405162461bcd60e51b815260206004820152601b60248201527f5472616e7366657220746f206164647265737342206661696c65640000000000604482015260640161023d565b505b8015610639576003546040516000916001600160a01b03169083908381818185875af1925050503d80600081146105e1576040519150601f19603f3d011682016040523d82523d6000602084013e6105e6565b606091505b50509050806106375760405162461bcd60e51b815260206004820152601b60248201527f5472616e7366657220746f206164647265737343206661696c65640000000000604482015260640161023d565b505b505050506106476001600055565b565b60026000540361066c57604051633ee5aeb560e01b815260040160405180910390fd5b6002600055565b634e487b7160e01b600052601160045260246000fd5b8082018082111561069c5761069c610673565b92915050565b8181038181111561069c5761069c610673565b808202811582820484141761069c5761069c610673565b6000826106e957634e487b7160e01b600052601260045260246000fd5b50049056fea264697066735822122027c7b062459f8b9070e5df9f3ad42da55cf81ab8e8f98932181b435a24cd2d7e64736f6c634300081a0033000000000000000000000000247db348044753073d6764db503945148b1be5540000000000000000000000005caac40301f5d4060cabd43e0ab10ff6f90e6f120000000000000000000000009c89e45724b31f6bcaba3e166e39c53695230fe6
Deployed Bytecode
0x60806040526004361061007f5760003560e01c8063b71502421161004e578063b71502421461013e578063c79fc60914610154578063fd4e4d7514610174578063ff50abdc146101945761009e565b806308b7c79c146100b057806335cb9f15146100d95780633ccfd60b146100ef5780634526196e146101065761009e565b3661009e5734600460008282546100969190610689565b925050819055005b34600460008282546100969190610689565b3480156100bc57600080fd5b506100c660065481565b6040519081526020015b60405180910390f35b3480156100e557600080fd5b506100c660075481565b3480156100fb57600080fd5b506101046101aa565b005b34801561011257600080fd5b50600254610126906001600160a01b031681565b6040516001600160a01b0390911681526020016100d0565b34801561014a57600080fd5b506100c660055481565b34801561016057600080fd5b50600354610126906001600160a01b031681565b34801561018057600080fd5b50600154610126906001600160a01b031681565b3480156101a057600080fd5b506100c660045481565b6101b2610649565b6001546001600160a01b03163314806101d557506002546001600160a01b031633145b806101ea57506003546001600160a01b031633145b6102465760405162461bcd60e51b815260206004820152602260248201527f43616c6c6572206973206e6f74206f6e65206f66207468652061646472657373604482015261657360f01b60648201526084015b60405180910390fd5b47806102945760405162461bcd60e51b815260206004820152601460248201527f4e6f2066756e647320746f207769746864726177000000000000000000000000604482015260640161023d565b6000806000671bc16d674ec8000060055410156103a3576000600554671bc16d674ec800006102c391906106a2565b90508085116102ec5784935084600560008282546102e19190610689565b9091555061039d9050565b92508260006102fb82876106a2565b9050606461030a8260506106b5565b61031491906106cc565b61031e9086610689565b9450606461032d82600a6106b5565b61033791906106cc565b9350606461034682600a6106b5565b61035091906106cc565b925084600560008282546103649190610689565b92505081905550836006600082825461037d9190610689565b9250508190555082600760008282546103969190610689565b9091555050505b50610438565b60646103b08560506106b5565b6103ba91906106cc565b925060646103c985600a6106b5565b6103d391906106cc565b915060646103e285600a6106b5565b6103ec91906106cc565b905082600560008282546104009190610689565b9250508190555081600660008282546104199190610689565b9250508190555080600760008282546104329190610689565b90915550505b82156104e3576001546040516000916001600160a01b03169085908381818185875af1925050503d806000811461048b576040519150601f19603f3d011682016040523d82523d6000602084013e610490565b606091505b50509050806104e15760405162461bcd60e51b815260206004820152601b60248201527f5472616e7366657220746f206164647265737341206661696c65640000000000604482015260640161023d565b505b811561058e576002546040516000916001600160a01b03169084908381818185875af1925050503d8060008114610536576040519150601f19603f3d011682016040523d82523d6000602084013e61053b565b606091505b505090508061058c5760405162461bcd60e51b815260206004820152601b60248201527f5472616e7366657220746f206164647265737342206661696c65640000000000604482015260640161023d565b505b8015610639576003546040516000916001600160a01b03169083908381818185875af1925050503d80600081146105e1576040519150601f19603f3d011682016040523d82523d6000602084013e6105e6565b606091505b50509050806106375760405162461bcd60e51b815260206004820152601b60248201527f5472616e7366657220746f206164647265737343206661696c65640000000000604482015260640161023d565b505b505050506106476001600055565b565b60026000540361066c57604051633ee5aeb560e01b815260040160405180910390fd5b6002600055565b634e487b7160e01b600052601160045260246000fd5b8082018082111561069c5761069c610673565b92915050565b8181038181111561069c5761069c610673565b808202811582820484141761069c5761069c610673565b6000826106e957634e487b7160e01b600052601260045260246000fd5b50049056fea264697066735822122027c7b062459f8b9070e5df9f3ad42da55cf81ab8e8f98932181b435a24cd2d7e64736f6c634300081a0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000247db348044753073d6764db503945148b1be5540000000000000000000000005caac40301f5d4060cabd43e0ab10ff6f90e6f120000000000000000000000009c89e45724b31f6bcaba3e166e39c53695230fe6
-----Decoded View---------------
Arg [0] : _addressA (address): 0x247Db348044753073d6764Db503945148b1Be554
Arg [1] : _addressB (address): 0x5cAac40301f5D4060CaBd43e0Ab10FF6f90e6F12
Arg [2] : _addressC (address): 0x9C89e45724B31f6BcaBa3e166e39C53695230fE6
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000247db348044753073d6764db503945148b1be554
Arg [1] : 0000000000000000000000005caac40301f5d4060cabd43e0ab10ff6f90e6f12
Arg [2] : 0000000000000000000000009c89e45724b31f6bcaba3e166e39c53695230fe6
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.