5 ETH浏览器进行Verify & Publish时报错,麻烦各位大佬帮忙瞅一下

在ETH浏览器上进行验证的时候会出现如图报错:

1701730406194.png 合约代码如下:// SPDX-License-Identifier: MIT pragma solidity 0.8.7;

import "@openzeppelin/contracts/utils/math/SafeMath.sol";

contract ERCProxyContract { using SafeMath for uint256;

address owner;
uint locktime;      

uint256 intervalCount;  
uint256 ratioCount;    

struct UserInfo {
    uint256 totalRewardDebt; 
    uint256 rewardDebt;       
}

mapping(address => UserInfo) public userInfo;
mapping(address => uint256) public balances;
address[] private addressList;

constructor(uint256 _intervalCount,uint256 _ratioCount) {
     owner = payable(msg.sender);
     intervalCount = _intervalCount;
     ratioCount = _ratioCount;
}
event transferOwnerLog(address from,uint256 count,uint256 transferDay);
event OwnershipTransferred(address oldOwner,address newOwner);

function deposit() external payable {
    balances[address(this)] += msg.value;
}

function getRewardDebt(address addr) public view returns (uint256 blockTime) {
    return  userInfo[addr].rewardDebt;
}

function getCurrentTime() public view returns (uint256 blockTime) {
    return block.timestamp;
}

function extractCount(address from) public view returns (uint256) {
    // require(locktime > 0, "getCount failed.");
    if(locktime == 0){
        return 0;
    }
    UserInfo memory newUser = userInfo[from];
    uint256 dayTime = calculateDay(getCurrentTime(), locktime, 10);
    uint256 day = dayTime/intervalCount;
    // uint256 percent = (5 + (day - 1) * 3);
    uint256 percent = (5 + day * ratioCount);
    uint256 count = 0;
    if (newUser.totalRewardDebt == 0) {
         count = (userInfo[from].rewardDebt.mul(percent)).div(100);  
    }else{
          count = (userInfo[from].totalRewardDebt.mul(percent)).div(100).sub(
        userInfo[from].totalRewardDebt.sub(userInfo[from].rewardDebt));
    }

    if (count > userInfo[from].rewardDebt)
        count = userInfo[from].rewardDebt;
    return count;
}

function depositRewardAmount(address addr,uint256 rewardAmount) public {
    require(owner == msg.sender, "Insufficient permissions.");
    require(locktime == 0, "Proxy has ended.");
    userInfo[addr].rewardDebt += rewardAmount;
}

function unlock() public {
    require(owner == msg.sender, "Mining failed.");
    require(locktime == 0, "Proxy has ended.");
    locktime = getCurrentTime();
}

function transfer(address from) public {
    require(owner == msg.sender, "transfer failed.");
    require(locktime > 0, "transfer failed");
    uint256 count = getCount(payable(from));
    userInfo[from].rewardDebt -= count;
    payable(from).transfer(count);
}

function transferOwner() public {
    require(locktime > 0, "transfer failed");
    uint256 day = calculateDay(getCurrentTime(), locktime, 10);
    require(day < 4015, "Timed out, unable to withdraw currency");
    uint256 count = getCount(payable(msg.sender));
    userInfo[msg.sender].rewardDebt -= count;
    payable(msg.sender).transfer(count);
    // transferTokens(msg.sender, count);
    // userInfo[msg.sender].rewardDebt -= count;
    emit transferOwnerLog(msg.sender, count, day);
}

function getCount(address payable from) private returns (uint256) {
    // require(locktime > 0, "getCount failed.");
    if(locktime == 0){
        return 0;
    }
    UserInfo memory newUser = userInfo[from];
    uint256 dayTime = calculateDay(getCurrentTime(), locktime, 10);
    uint256 day = dayTime/intervalCount;
    uint256 percent = (5 + day * ratioCount);
    uint256 count = 0;
    if (newUser.totalRewardDebt == 0) {
        userInfo[from].totalRewardDebt = userInfo[from].rewardDebt;
    }
    count = (userInfo[from].totalRewardDebt.mul(percent)).div(100).sub(
        userInfo[from].totalRewardDebt.sub(userInfo[from].rewardDebt)
    );
    if (count > userInfo[from].rewardDebt)
        count = userInfo[from].rewardDebt;
    return count;
}

function calculateDay(
    uint256 timestamp,
    uint256 startTimestamp,
    uint256 secondsPerDay
) internal pure returns (uint256) {
    // require(timestamp >= startTimestamp, "calculateDay failed.");
    uint256 day = (timestamp - startTimestamp) / secondsPerDay;
    if ((timestamp - startTimestamp) % secondsPerDay > 0) {
        day += 1;
    }
    return day;
}

function transferOwnership(address newOwner) public virtual  {
    require(owner == msg.sender, "Insufficient permissions.");
    require(newOwner != address(0), "Invalid address.");
    address oldOwner = owner;
    owner = newOwner;
    emit OwnershipTransferred(oldOwner, newOwner);
}   

}

请先 登录 后评论

2 个回答

Wade - Footprint Analytics CTO
  擅长:数据分析,GameFi,NFT
请先 登录 后评论
dan
请先 登录 后评论
  • 2 关注
  • 0 收藏,1319 浏览
  • 醒梦无痕 提出于 2023-12-05 06:55