false
false
0

Contract Address Details

0x81b1e1005Ad9F552C1aCd85D8746Ac1E1B1024FB

Contract Name
Buyout
Creator
0xc7d98c–7f3521 at 0x5ed138–640c6e
Balance
0 CLO
Tokens
Fetching tokens...
Transactions
0 Transactions
Transfers
0 Transfers
Gas Used
Fetching gas used...
Last Balance Update
18639125
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
Buyout




Optimization enabled
true
Compiler version
v0.8.18+commit.87f61d96




Optimization runs
200
EVM Version
default




Verified at
2024-09-26T15:24:46.190454Z

Contract source code

// SPDX-License-Identifier: No License (None)
pragma solidity ^0.8.0;

/**
 * @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 {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () {
        _owner = msg.sender;
        emit OwnershipTransferred(address(0), msg.sender);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == msg.sender, "Ownable: caller is not the owner");
        _;
    }

    /**
     * @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");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

interface IERC20 {
    function balanceOf(address account) external view returns (uint256);
    function transfer(address recipient, uint256 amount) external;
}

contract Buyout is Ownable {
    address public constant token = 0x83736D58F496afab4cF7D8453575ab59279810ec; //CHOAM token
    uint256 public rate;    // buyout price of 1 CHOAM token in CLO (with 18 decimals)

    event Rescue(address _token, uint256 _amount);
    event BuyoutToken(address _from, uint256 _tokenAmount, uint256 _CLO);

    // buyout "token" with CLO by "rate"
    function tokenReceived(address _from, uint _value, bytes calldata _data) external {
        require(msg.sender == token, "wrong token");
        require(rate != 0, "wrong rate");
        uint256 amount = _value * rate / 1e18;
        (bool success,) = _from.call{value:amount}(new bytes(0));
        require(success, "CLO_TRANSFER_FAILED");
        emit BuyoutToken(_from, _value, amount);
    }

    // receive CLO from company
    receive() external payable {}

    // set buyout price of 1 CHOAM token in CLO
    function setRate(uint256 _rate) external onlyOwner {
        rate = _rate;
    }

    function withdraw(address to, uint256 value) external onlyOwner {
        (bool success,) = to.call{value:value}(new bytes(0));
        require(success, "CLO_TRANSFER_FAILED");
    }

    function rescueTokens(address _token) onlyOwner external {
        uint256 amount;
        amount = IERC20(_token).balanceOf(address(this));
        IERC20(_token).transfer(msg.sender, amount);
        emit Rescue(_token, amount);
    }
}
        

Contract ABI

[{"type":"event","name":"BuyoutToken","inputs":[{"type":"address","name":"_from","internalType":"address","indexed":false},{"type":"uint256","name":"_tokenAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"_CLO","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Rescue","inputs":[{"type":"address","name":"_token","internalType":"address","indexed":false},{"type":"uint256","name":"_amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"rate","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"rescueTokens","inputs":[{"type":"address","name":"_token","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setRate","inputs":[{"type":"uint256","name":"_rate","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"token","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"tokenReceived","inputs":[{"type":"address","name":"_from","internalType":"address"},{"type":"uint256","name":"_value","internalType":"uint256"},{"type":"bytes","name":"_data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"value","internalType":"uint256"}]},{"type":"receive","stateMutability":"payable"}]
              

Contract Creation Code

Verify & Publish
0x608060405234801561001057600080fd5b50600080546001600160a01b0319163390811782556040519091907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a36108ee8061005f6000396000f3fe60806040526004361061007e5760003560e01c80638da5cb5b1161004e5780638da5cb5b14610115578063f2fde38b14610147578063f3fef3a314610167578063fc0c546a1461018757600080fd5b8062ae3bf81461008a5780632c4e722e146100ac57806334fcf437146100d55780638943ec02146100f557600080fd5b3661008557005b600080fd5b34801561009657600080fd5b506100aa6100a5366004610702565b6101af565b005b3480156100b857600080fd5b506100c260015481565b6040519081526020015b60405180910390f35b3480156100e157600080fd5b506100aa6100f0366004610724565b610306565b34801561010157600080fd5b506100aa61011036600461073d565b610344565b34801561012157600080fd5b506000546001600160a01b03165b6040516001600160a01b0390911681526020016100cc565b34801561015357600080fd5b506100aa610162366004610702565b6104fc565b34801561017357600080fd5b506100aa6101823660046107c4565b6105f5565b34801561019357600080fd5b5061012f7383736d58f496afab4cf7d8453575ab59279810ec81565b336101c26000546001600160a01b031690565b6001600160a01b0316146101f15760405162461bcd60e51b81526004016101e8906107ee565b60405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610238573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025c9190610823565b60405163a9059cbb60e01b8152336004820152602481018290529091506001600160a01b0383169063a9059cbb90604401600060405180830381600087803b1580156102a757600080fd5b505af11580156102bb573d6000803e3d6000fd5b5050604080516001600160a01b0386168152602081018590527f542fa6bfee3b4746210fbdd1d83f9e49b65adde3639f8d8f165dd18347938af2935001905060405180910390a15050565b336103196000546001600160a01b031690565b6001600160a01b03161461033f5760405162461bcd60e51b81526004016101e8906107ee565b600155565b337383736d58f496afab4cf7d8453575ab59279810ec146103955760405162461bcd60e51b815260206004820152600b60248201526a3bb937b733903a37b5b2b760a91b60448201526064016101e8565b6001546000036103d45760405162461bcd60e51b815260206004820152600a60248201526977726f6e67207261746560b01b60448201526064016101e8565b6000670de0b6b3a7640000600154856103ed919061083c565b6103f79190610867565b60408051600080825260208201928390529293506001600160a01b03881691849161042191610889565b60006040518083038185875af1925050503d806000811461045e576040519150601f19603f3d011682016040523d82523d6000602084013e610463565b606091505b50509050806104aa5760405162461bcd60e51b815260206004820152601360248201527210d313d7d514905394d1915497d19052531151606a1b60448201526064016101e8565b604080516001600160a01b0388168152602081018790529081018390527fde7864f808dcfe6f23737b3248019eace37183cbe1007b0be587fa697e7485369060600160405180910390a1505050505050565b3361050f6000546001600160a01b031690565b6001600160a01b0316146105355760405162461bcd60e51b81526004016101e8906107ee565b6001600160a01b03811661059a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101e8565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b336106086000546001600160a01b031690565b6001600160a01b03161461062e5760405162461bcd60e51b81526004016101e8906107ee565b604080516000808252602082019092526001600160a01b0384169083906040516106589190610889565b60006040518083038185875af1925050503d8060008114610695576040519150601f19603f3d011682016040523d82523d6000602084013e61069a565b606091505b50509050806106e15760405162461bcd60e51b815260206004820152601360248201527210d313d7d514905394d1915497d19052531151606a1b60448201526064016101e8565b505050565b80356001600160a01b03811681146106fd57600080fd5b919050565b60006020828403121561071457600080fd5b61071d826106e6565b9392505050565b60006020828403121561073657600080fd5b5035919050565b6000806000806060858703121561075357600080fd5b61075c856106e6565b935060208501359250604085013567ffffffffffffffff8082111561078057600080fd5b818701915087601f83011261079457600080fd5b8135818111156107a357600080fd5b8860208285010111156107b557600080fd5b95989497505060200194505050565b600080604083850312156107d757600080fd5b6107e0836106e6565b946020939093013593505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561083557600080fd5b5051919050565b808202811582820484141761086157634e487b7160e01b600052601160045260246000fd5b92915050565b60008261088457634e487b7160e01b600052601260045260246000fd5b500490565b6000825160005b818110156108aa5760208186018101518583015201610890565b50600092019182525091905056fea2646970667358221220f2951993fd7522efcd19cd04479472d8a9263deecd4dd22ab29a9767750dab8b64736f6c63430008120033

Deployed ByteCode

0x60806040526004361061007e5760003560e01c80638da5cb5b1161004e5780638da5cb5b14610115578063f2fde38b14610147578063f3fef3a314610167578063fc0c546a1461018757600080fd5b8062ae3bf81461008a5780632c4e722e146100ac57806334fcf437146100d55780638943ec02146100f557600080fd5b3661008557005b600080fd5b34801561009657600080fd5b506100aa6100a5366004610702565b6101af565b005b3480156100b857600080fd5b506100c260015481565b6040519081526020015b60405180910390f35b3480156100e157600080fd5b506100aa6100f0366004610724565b610306565b34801561010157600080fd5b506100aa61011036600461073d565b610344565b34801561012157600080fd5b506000546001600160a01b03165b6040516001600160a01b0390911681526020016100cc565b34801561015357600080fd5b506100aa610162366004610702565b6104fc565b34801561017357600080fd5b506100aa6101823660046107c4565b6105f5565b34801561019357600080fd5b5061012f7383736d58f496afab4cf7d8453575ab59279810ec81565b336101c26000546001600160a01b031690565b6001600160a01b0316146101f15760405162461bcd60e51b81526004016101e8906107ee565b60405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610238573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025c9190610823565b60405163a9059cbb60e01b8152336004820152602481018290529091506001600160a01b0383169063a9059cbb90604401600060405180830381600087803b1580156102a757600080fd5b505af11580156102bb573d6000803e3d6000fd5b5050604080516001600160a01b0386168152602081018590527f542fa6bfee3b4746210fbdd1d83f9e49b65adde3639f8d8f165dd18347938af2935001905060405180910390a15050565b336103196000546001600160a01b031690565b6001600160a01b03161461033f5760405162461bcd60e51b81526004016101e8906107ee565b600155565b337383736d58f496afab4cf7d8453575ab59279810ec146103955760405162461bcd60e51b815260206004820152600b60248201526a3bb937b733903a37b5b2b760a91b60448201526064016101e8565b6001546000036103d45760405162461bcd60e51b815260206004820152600a60248201526977726f6e67207261746560b01b60448201526064016101e8565b6000670de0b6b3a7640000600154856103ed919061083c565b6103f79190610867565b60408051600080825260208201928390529293506001600160a01b03881691849161042191610889565b60006040518083038185875af1925050503d806000811461045e576040519150601f19603f3d011682016040523d82523d6000602084013e610463565b606091505b50509050806104aa5760405162461bcd60e51b815260206004820152601360248201527210d313d7d514905394d1915497d19052531151606a1b60448201526064016101e8565b604080516001600160a01b0388168152602081018790529081018390527fde7864f808dcfe6f23737b3248019eace37183cbe1007b0be587fa697e7485369060600160405180910390a1505050505050565b3361050f6000546001600160a01b031690565b6001600160a01b0316146105355760405162461bcd60e51b81526004016101e8906107ee565b6001600160a01b03811661059a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101e8565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b336106086000546001600160a01b031690565b6001600160a01b03161461062e5760405162461bcd60e51b81526004016101e8906107ee565b604080516000808252602082019092526001600160a01b0384169083906040516106589190610889565b60006040518083038185875af1925050503d8060008114610695576040519150601f19603f3d011682016040523d82523d6000602084013e61069a565b606091505b50509050806106e15760405162461bcd60e51b815260206004820152601360248201527210d313d7d514905394d1915497d19052531151606a1b60448201526064016101e8565b505050565b80356001600160a01b03811681146106fd57600080fd5b919050565b60006020828403121561071457600080fd5b61071d826106e6565b9392505050565b60006020828403121561073657600080fd5b5035919050565b6000806000806060858703121561075357600080fd5b61075c856106e6565b935060208501359250604085013567ffffffffffffffff8082111561078057600080fd5b818701915087601f83011261079457600080fd5b8135818111156107a357600080fd5b8860208285010111156107b557600080fd5b95989497505060200194505050565b600080604083850312156107d757600080fd5b6107e0836106e6565b946020939093013593505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561083557600080fd5b5051919050565b808202811582820484141761086157634e487b7160e01b600052601160045260246000fd5b92915050565b60008261088457634e487b7160e01b600052601260045260246000fd5b500490565b6000825160005b818110156108aa5760208186018101518583015201610890565b50600092019182525091905056fea2646970667358221220f2951993fd7522efcd19cd04479472d8a9263deecd4dd22ab29a9767750dab8b64736f6c63430008120033