Contract Overview
My Name Tag:
Not Available, login to update
[ Download CSV Export ]
Contract Source Code Verified (Exact Match)
Contract Name:
Distributor
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.17; import "@openzeppelin/contracts/access/Ownable.sol"; interface PTP { function transfer(address dst, uint256 rawAmount) external returns (bool); function balanceOf(address account) external view returns (uint256); function mint(address dst, uint256 rawAmount) external; function minimumTimeBetweenMints() external view returns (uint256); } contract Distributor is Ownable{ mapping(address => uint256) public withdrawn; mapping(address => uint256) public allocations; uint256 totalPTPWithdrawn; PTP public PTPContract = PTP(0x22d4002028f537599bE9f666d1c4Fa138522f9c8); error Unauthorized(); constructor(address[5] memory _beneficiaries) { allocations[_beneficiaries[0]] = 36363; allocations[_beneficiaries[1]] = 36363; allocations[_beneficiaries[2]] = 10909; allocations[_beneficiaries[3]] = 10909; allocations[_beneficiaries[4]] = 5456; } function changeBeneficiary (address _newBeneficiary) external { if ( allocations[msg.sender] == 0 ) { revert Unauthorized();} uint256 allocation = allocations[msg.sender]; uint256 withdrawnBalance = withdrawn[msg.sender]; allocations[_newBeneficiary] = allocation; withdrawn[_newBeneficiary] = withdrawnBalance; delete allocations[msg.sender]; delete withdrawn[msg.sender]; } function withdrawBeneficiary() external { uint256 ptpBalance = PTPContract.balanceOf(address(this)); uint256 totalPTPBalance = totalPTPWithdrawn + ptpBalance ; uint256 withdrawable = ((totalPTPBalance * allocations[msg.sender]) / 100000) - withdrawn[msg.sender]; withdrawn[msg.sender] += withdrawable; totalPTPWithdrawn += withdrawable; PTPContract.transfer(msg.sender,withdrawable); } function withdrawEmergency() external onlyOwner { uint256 ptpBalance = PTPContract.balanceOf(address(this)); PTPContract.transfer(msg.sender,ptpBalance); } function claimable(address _beneficiary) view external returns (uint256) { uint256 ptpBalance = PTPContract.balanceOf(address(this)); uint256 totalPTPBalance = totalPTPWithdrawn + ptpBalance ; return (((totalPTPBalance * allocations[_beneficiary]) / 100000) - withdrawn[_beneficiary]); } }
{ "remappings": [ "@openzeppelin/=node_modules/@openzeppelin/", "ds-test/=lib/forge-std/lib/ds-test/src/", "forge-std/=lib/forge-std/src/" ], "optimizer": { "enabled": true, "runs": 1000000 }, "metadata": { "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
[{"inputs":[{"internalType":"address[5]","name":"_beneficiaries","type":"address[5]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"PTPContract","outputs":[{"internalType":"contract PTP","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"allocations","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newBeneficiary","type":"address"}],"name":"changeBeneficiary","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_beneficiary","type":"address"}],"name":"claimable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawBeneficiary","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawEmergency","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"withdrawn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
6080604052600480546001600160a01b0319167322d4002028f537599be9f666d1c4fa138522f9c817905534801561003657600080fd5b50604051610b80380380610b8083398101604081905261005591610133565b61005e336100c7565b80516001600160a01b039081166000908152600260209081526040808320618e0b908190559185015184168352808320919091558084015183168252808220612a9d908190556060850151841683528183205560809093015190911681522061155090556101c5565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b038116811461012e57600080fd5b919050565b600060a0828403121561014557600080fd5b82601f83011261015457600080fd5b60405160a081016001600160401b038111828210171561018457634e487b7160e01b600052604160045260246000fd5b6040528060a084018581111561019957600080fd5b845b818110156101ba576101ac81610117565b83526020928301920161019b565b509195945050505050565b6109ac806101d46000396000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c80637fa863cb1161007657806398a34fef1161005b57806398a34fef1461019e578063dc070657146101a6578063f2fde38b146101b957600080fd5b80637fa863cb1461013b5780638da5cb5b1461018057600080fd5b806352a9039c116100a757806352a9039c146100f35780636ef6109214610113578063715018a61461013357600080fd5b8063402914f5146100c35780634146a073146100e9575b600080fd5b6100d66100d1366004610851565b6101cc565b6040519081526020015b60405180910390f35b6100f16102d7565b005b6100d6610101366004610851565b60026020526000908152604090205481565b6100d6610121366004610851565b60016020526000908152604090205481565b6100f161041c565b60045461015b9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100e0565b60005473ffffffffffffffffffffffffffffffffffffffff1661015b565b6100f1610430565b6100f16101b4366004610851565b610601565b6100f16101c7366004610851565b61069f565b600480546040517f70a082310000000000000000000000000000000000000000000000000000000081523092810192909252600091829173ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015610240573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610264919061088e565b905060008160035461027691906108d6565b73ffffffffffffffffffffffffffffffffffffffff851660009081526001602090815260408083205460029092529091205491925090620186a0906102bb90846108ef565b6102c59190610906565b6102cf9190610941565b949350505050565b6102df61075b565b600480546040517f70a08231000000000000000000000000000000000000000000000000000000008152309281019290925260009173ffffffffffffffffffffffffffffffffffffffff909116906370a0823190602401602060405180830381865afa158015610353573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610377919061088e565b600480546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815233928101929092526024820183905291925073ffffffffffffffffffffffffffffffffffffffff9091169063a9059cbb906044016020604051808303816000875af11580156103f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104189190610954565b5050565b61042461075b565b61042e60006107dc565b565b600480546040517f70a08231000000000000000000000000000000000000000000000000000000008152309281019290925260009173ffffffffffffffffffffffffffffffffffffffff909116906370a0823190602401602060405180830381865afa1580156104a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c8919061088e565b90506000816003546104da91906108d6565b3360009081526001602090815260408083205460029092528220549293509091620186a09061050990856108ef565b6105139190610906565b61051d9190610941565b336000908152600160205260408120805492935083929091906105419084906108d6565b92505081905550806003600082825461055a91906108d6565b9091555050600480546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815233928101929092526024820183905273ffffffffffffffffffffffffffffffffffffffff169063a9059cbb906044016020604051808303816000875af11580156105d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105fb9190610954565b50505050565b336000908152600260205260408120549003610649576040517f82b4290000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b33600081815260026020818152604080842080546001808552838720805473ffffffffffffffffffffffffffffffffffffffff9a909a168852958552838720919091559092528320949094559181529182905555565b6106a761075b565b73ffffffffffffffffffffffffffffffffffffffff811661074f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610758816107dc565b50565b60005473ffffffffffffffffffffffffffffffffffffffff16331461042e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610746565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561086357600080fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461088757600080fd5b9392505050565b6000602082840312156108a057600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156108e9576108e96108a7565b92915050565b80820281158282048414176108e9576108e96108a7565b60008261093c577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b818103818111156108e9576108e96108a7565b60006020828403121561096657600080fd5b8151801515811461088757600080fdfea264697066735822122074d604abafe9f25ff193499942c22c095d3fa22beaa01835a0eb1d4ffcad752564736f6c6343000811003300000000000000000000000083afa388d49ed481c12be7d2c11aeab7c084c2a80000000000000000000000000e1e482af12f84fbcea5806f61059ccde32308130000000000000000000000000971b2d7874a2987b66c65442a2926ff802892050000000000000000000000005b34932f643a143bdc9801064ea06526ba9476af000000000000000000000000c135009c21291d72564737f276f41ee653f5c7c0
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000083afa388d49ed481c12be7d2c11aeab7c084c2a80000000000000000000000000e1e482af12f84fbcea5806f61059ccde32308130000000000000000000000000971b2d7874a2987b66c65442a2926ff802892050000000000000000000000005b34932f643a143bdc9801064ea06526ba9476af000000000000000000000000c135009c21291d72564737f276f41ee653f5c7c0
-----Decoded View---------------
Arg [0] : _beneficiaries (address[5]): 0x83afa388d49ed481c12be7d2c11aeab7c084c2a8,0x0e1e482af12f84fbcea5806f61059ccde3230813,0x0971b2d7874a2987b66c65442a2926ff80289205,0x5b34932f643a143bdc9801064ea06526ba9476af,0xc135009c21291d72564737f276f41ee653f5c7c0
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 00000000000000000000000083afa388d49ed481c12be7d2c11aeab7c084c2a8
Arg [1] : 0000000000000000000000000e1e482af12f84fbcea5806f61059ccde3230813
Arg [2] : 0000000000000000000000000971b2d7874a2987b66c65442a2926ff80289205
Arg [3] : 0000000000000000000000005b34932f643a143bdc9801064ea06526ba9476af
Arg [4] : 000000000000000000000000c135009c21291d72564737f276f41ee653f5c7c0
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.