Skip to content
Verified contractExactMIT

TransparentUpgradeableProxy

Address0xd75ab4b69f2edfb072fdfd7e2d15a875f95ae5ae
Balance

0 ETH

 

Transactions

33

 

Compiler

solc 0.8.20

 

Same code

1,298 more contracts

 

Details

Compiler
solc 0.8.20+commit.a1b79de6
Language
solidity
Optimization
Yes, 200 runs
EVM version
paris
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
21,853,673
Creation transaction
0xb37e190e08…3bcb276f48
Proxy implementation
0xe1f4c214…ca1e5076source code not verified
Main copy (most transactions)
0xda5e1988…847cbef6

112 files

The source code is large: one file is shown at a time. Choose a file in the list.

contracts/treasury/TreasuryV1.sol

// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.20;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {VaultV1} from "../vault/VaultV1.sol";

contract TreasuryV1 is OwnableUpgradeable {
  using SafeERC20 for IERC20;

  error TreasuryInvalidAmount(uint256 amount);
  error TreasuryInvalidRecipient(address recipient);
  error TreasuryTransferFailed(address recipient, uint256 amount);

  constructor() {
    _disableInitializers();
  }

  function initialize() public initializer {
    __Ownable_init(_msgSender());
  }

  receive() external payable {}

  fallback() external payable {}

  /**
   * @notice Transfer ETH to recipient.
   * @param recipient Recipient.
   * @param amount Transfer amount.
   */
  function transferETH(address payable recipient, uint256 amount) external onlyOwner returns (bool) {
    if (amount == 0) revert TreasuryInvalidAmount(amount);
    if (recipient == address(0)) revert TreasuryInvalidRecipient(recipient);

    (bool sent, ) = recipient.call{value: amount}("");
    if (!sent) revert TreasuryTransferFailed(recipient, amount);

    return true;
  }

  /**
   * @notice Transfer target token to recipient.
   * @param token Target token.
   * @param recipient Recipient.
   * @param amount Transfer amount.
   */
  function transfer(address token, address recipient, uint256 amount) external onlyOwner returns (bool) {
    if (amount == 0) revert TreasuryInvalidAmount(amount);
    if (recipient == address(0)) revert TreasuryInvalidRecipient(recipient);

    IERC20(token).safeTransfer(recipient, amount);

    return true;
  }

  /**
   * @notice Approve target token to recipient.
   * @param token Target token.
   * @param recipient Recipient.
   * @param amount Approve amount.
   */
  function approve(address token, address recipient, uint256 amount) external onlyOwner returns (bool) {
    IERC20(token).forceApprove(recipient, amount);

    return true;
  }

  /**
   * @notice Call withdraw from spender.
   * @param spender Target contract.
   */
  function withdrawFrom(address payable spender) external onlyOwner {
    VaultV1(spender).withdraw();
  }
}
Compiler settingsShow
{
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "paris",
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.