false
false
0

Contract Address Details

0xC049e0951dC66e5aF49Bf27F0AD305ED2EAb2CbC

Contract Name
PenaltyFee
Creator
0xfd0a18–e4e16a at 0xbbfc90–08c909
Balance
0 EMC ( )
Tokens
Fetching tokens...
Transactions
0 Transactions
Transfers
0 Transfers
Gas Used
Fetching gas used...
Last Balance Update
7332872
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
PenaltyFee




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




Optimization runs
800
EVM Version
paris




Verified at
2024-01-10T19:32:21.288479Z

Constructor Arguments

0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000000000000000000000000000003e800000000000000000000000000000000000000000000000000000000000005dc00000000000000000000000000000000000000000000000000000000000007d0

Arg [0] (uint256[]) : [500, 1000, 1500, 2000]

              

contracts/staking/penalty/PenaltyFee.sol

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

import { IMultiplier } from "../interfaces/IMultiplier.sol";
import { IPenaltyFee } from "../interfaces/IPenaltyFee.sol";
import { IStakingPool } from "../interfaces/IStakingPool.sol";

contract PenaltyFee is IPenaltyFee {
    uint256 public constant MULTIPLIER_BASIS = 1e4;
    uint256[] public penaltyFeePerGroup;

    constructor(uint256[] memory _penaltyFeePerGroup) {
        for (uint256 i = 0; i < _penaltyFeePerGroup.length; i++) {
            require(_penaltyFeePerGroup[i] < MULTIPLIER_BASIS, "PenaltyFee::constructor: penaltyBasis >= MAX_ALLOWED_PENALTY");
        }
        penaltyFeePerGroup = _penaltyFeePerGroup;
    }

    function calculate(uint256 _amount, uint256 _duration, address _pool) external view override returns (uint256) {
        IMultiplier rewardsMultiplier = IStakingPool(_pool).rewardsMultiplier();
        uint256 group = rewardsMultiplier.getDurationGroup(_duration);
        return (_amount * penaltyFeePerGroup[group]) / MULTIPLIER_BASIS;
    }
}
        

contracts/staking/interfaces/IMultiplier.sol

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

interface IMultiplier {
    /**
     * Applies a multiplier on the _amount, based on the _pool and _beneficiary.
     * The multiplier is not necessarily a constant number, it can be a more complex factor.
     */
    function applyMultiplier(uint256 _amount, uint256 _duration) external view returns (uint256);

    function getMultiplier(uint256 _amount, uint256 _duration) external view returns (uint256);

    function getDurationGroup(uint256 _duration) external view returns (uint256);

    function getDurationMultiplier(uint256 _duration) external view returns (uint256);
}
          

contracts/staking/interfaces/IPenaltyFee.sol

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

interface IPenaltyFee {
    /**
     * Calculates the penalty fee for the given _amount for a specific _beneficiary.
     */
    function calculate(uint256 _amount, uint256 _duration, address _pool) external view returns (uint256);
}
          

contracts/staking/interfaces/IStakingPool.sol

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

import { IMultiplier } from "../interfaces/IMultiplier.sol";
import { IPenaltyFee } from "../interfaces/IPenaltyFee.sol";

interface IStakingPool {
    struct StakingInfo {
        uint256 stakedAmount; // amount of the stake
        uint256 minimumStakeTimestamp; // timestamp of the minimum stake
        uint256 duration; // in seconds
        uint256 rewardPerTokenPaid; // Reward per token paid
        uint256 rewards; // rewards to be claimed
    }

    function rewardsMultiplier() external view returns (IMultiplier);

    function penaltyFeeCalculator() external view returns (IPenaltyFee);

    event Staked(address indexed user, uint256 stakeNumber, uint256 amount);
    event Unstaked(address indexed user, uint256 stakeNumber, uint256 amount);
    event RewardPaid(address indexed user, uint256 stakeNumber, uint256 reward);
}
          

Compiler Settings

{"outputSelection":{"*":{"*":["*"],"":["*"]}},"optimizer":{"runs":800,"enabled":true},"metadata":{"useLiteralContent":true,"bytecodeHash":"none"},"libraries":{},"evmVersion":"paris"}
              

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"uint256[]","name":"_penaltyFeePerGroup","internalType":"uint256[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MULTIPLIER_BASIS","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"calculate","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"},{"type":"uint256","name":"_duration","internalType":"uint256"},{"type":"address","name":"_pool","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"penaltyFeePerGroup","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]}]
              

Contract Creation Code

0x608060405234801561001057600080fd5b5060405161057738038061057783398101604081905261002f91610172565b60005b81518110156100e1576127108282815181106100505761005061022f565b6020026020010151106100cf5760405162461bcd60e51b815260206004820152603c60248201527f50656e616c74794665653a3a636f6e7374727563746f723a2070656e616c747960448201527f4261736973203e3d204d41585f414c4c4f5745445f50454e414c545900000000606482015260840160405180910390fd5b806100d981610245565b915050610032565b5080516100f59060009060208401906100fc565b505061026c565b828054828255906000526020600020908101928215610137579160200282015b8281111561013757825182559160200191906001019061011c565b50610143929150610147565b5090565b5b808211156101435760008155600101610148565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561018557600080fd5b82516001600160401b038082111561019c57600080fd5b818501915085601f8301126101b057600080fd5b8151818111156101c2576101c261015c565b8060051b604051601f19603f830116810181811085821117156101e7576101e761015c565b60405291825284820192508381018501918883111561020557600080fd5b938501935b828510156102235784518452938501939285019261020a565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b60006001820161026557634e487b7160e01b600052601160045260246000fd5b5060010190565b6102fc8061027b6000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806340a8d39f146100465780638498d00a14610061578063b2c0f3cb14610074575b600080fd5b61004f61271081565b60405190815260200160405180910390f35b61004f61006f3660046101d8565b610087565b61004f610082366004610216565b6100a8565b6000818154811061009757600080fd5b600091825260209091200154905081565b6000808273ffffffffffffffffffffffffffffffffffffffff1663b6d7dc5c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061011a919061024f565b6040516328749e3760e21b81526004810186905290915060009073ffffffffffffffffffffffffffffffffffffffff83169063a1d278dc90602401602060405180830381865afa158015610172573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101969190610273565b9050612710600082815481106101ae576101ae61028c565b9060005260206000200154876101c491906102a2565b6101ce91906102cd565b9695505050505050565b6000602082840312156101ea57600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461021357600080fd5b50565b60008060006060848603121561022b57600080fd5b83359250602084013591506040840135610244816101f1565b809150509250925092565b60006020828403121561026157600080fd5b815161026c816101f1565b9392505050565b60006020828403121561028557600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b80820281158282048414176102c757634e487b7160e01b600052601160045260246000fd5b92915050565b6000826102ea57634e487b7160e01b600052601260045260246000fd5b50049056fea164736f6c6343000812000a0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000001f400000000000000000000000000000000000000000000000000000000000003e800000000000000000000000000000000000000000000000000000000000005dc00000000000000000000000000000000000000000000000000000000000007d0

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106100415760003560e01c806340a8d39f146100465780638498d00a14610061578063b2c0f3cb14610074575b600080fd5b61004f61271081565b60405190815260200160405180910390f35b61004f61006f3660046101d8565b610087565b61004f610082366004610216565b6100a8565b6000818154811061009757600080fd5b600091825260209091200154905081565b6000808273ffffffffffffffffffffffffffffffffffffffff1663b6d7dc5c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061011a919061024f565b6040516328749e3760e21b81526004810186905290915060009073ffffffffffffffffffffffffffffffffffffffff83169063a1d278dc90602401602060405180830381865afa158015610172573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101969190610273565b9050612710600082815481106101ae576101ae61028c565b9060005260206000200154876101c491906102a2565b6101ce91906102cd565b9695505050505050565b6000602082840312156101ea57600080fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff8116811461021357600080fd5b50565b60008060006060848603121561022b57600080fd5b83359250602084013591506040840135610244816101f1565b809150509250925092565b60006020828403121561026157600080fd5b815161026c816101f1565b9392505050565b60006020828403121561028557600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b80820281158282048414176102c757634e487b7160e01b600052601160045260246000fd5b92915050565b6000826102ea57634e487b7160e01b600052601260045260246000fd5b50049056fea164736f6c6343000812000a