ESGLock

Description:

ERC20 token contract with Factory capabilities. Standard implementation for fungible tokens on Ethereum.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "contracts/EIP20Interface.sol": {
      "content": "pragma solidity >=0.5.16;

/**
 * @title ERC 20 Token Standard Interface
 *  https://eips.ethereum.org/EIPS/eip-20
 */
interface EIP20Interface {
    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function decimals() external view returns (uint8);

    /**
      * @notice Get the total number of tokens in circulation
      * @return The supply of tokens
      */
    function totalSupply() external view returns (uint256);

    /**
     * @notice Gets the balance of the specified address
     * @param owner The address from which the balance will be retrieved
     * @return The balance
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
      * @notice Transfer `amount` tokens from `msg.sender` to `dst`
      * @param dst The address of the destination account
      * @param amount The number of tokens to transfer
      * @return Whether or not the transfer succeeded
      */
    function transfer(address dst, uint256 amount) external returns (bool success);

    /**
      * @notice Transfer `amount` tokens from `src` to `dst`
      * @param src The address of the source account
      * @param dst The address of the destination account
      * @param amount The number of tokens to transfer
      * @return Whether or not the transfer succeeded
      */
    function transferFrom(address src, address dst, uint256 amount) external returns (bool success);

    /**
      * @notice Approve `spender` to transfer up to `amount` from `src`
      * @dev This will overwrite the approval amount for `spender`
      *  and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)
      * @param spender The address of the account which may transfer tokens
      * @param amount The number of tokens that are approved (-1 means infinite)
      * @return Whether or not the approval succeeded
      */
    function approve(address spender, uint256 amount) external returns (bool success);

    /**
      * @notice Get the current allowance from `owner` for `spender`
      * @param owner The address of the account which owns the tokens to be spent
      * @param spender The address of the account which may transfer tokens
      * @return The number of tokens allowed to be spent (-1 means infinite)
      */
    function allowance(address owner, address spender) external view returns (uint256 remaining);

    event Transfer(address indexed from, address indexed to, uint256 amount);
    event Approval(address indexed owner, address indexed spender, uint256 amount);
}
"
    },
    "contracts/ESGLock.sol": {
      "content": "pragma solidity >=0.5.16;
pragma experimental ABIEncoderV2;

import "./EIP20Interface.sol";

contract ESGLock {
    /// @notice ESG token
    EIP20Interface public esg;

    /// @notice Emitted when ESG is claimed 
    event EsgClaimed(address account, uint userAmount);

    // @notice ESG list of every account
    mapping (address => uint256) public esglist;

    // @notice contract admin
    address public owner;

    constructor(address _esgToken) public {
        owner = msg.sender;
        esg = EIP20Interface(_esgToken);
    }

    modifier onlyOwner() {
        require(msg.sender == owner, "Only owner can call this function.");
        _;
    }

    function setEsgAmountAdd(address[] memory _to, uint256[] memory _amount) onlyOwner public returns (bool) {
        require(_to.length == _amount.length, "The length of the two arrays must be the same");
        for (uint256 i = 0; i < _to.length; i++) {
            esglist[_to[i]] += _amount[i];
        }
        return true;
    }

    function setEsgAmountSub(address[] memory _to, uint256[] memory _amount) onlyOwner public returns (bool) {
        require(_to.length == _amount.length, "The length of the two arrays must be the same");
        for (uint256 i = 0; i < _to.length; i++) {
            esglist[_to[i]] -= _amount[i];
        }
        return true;
    }

    function esgClaim() public returns (bool) {
        require(esglist[msg.sender] > 0, "No locked ESG.");
        uint256 totalAmount = esglist[msg.sender];
        esglist[msg.sender] = 0;

        esg.transfer(msg.sender, totalAmount);

        emit EsgClaimed(msg.sender, totalAmount);
        return true;
    }

    function transferOwnership(address newOwner) onlyOwner public {
        require(newOwner != address(0), "New owner is the zero address");
        owner = newOwner;
    }
}
"
    }
  },
  "settings": {
    "optimizer": {
      "enabled": true,
      "runs": 300
    },
    "evmVersion": "istanbul",
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    }
  }
}}

Tags:
ERC20, Token, Factory|addr:0xb5267c3466df6bf8e373c68a0486e9c2d2514e97|verified:true|block:23732625|tx:0xfcd37f0558976641b064db5d9a51b09eff94f7042950c3d39612ffcf69a00072|first_check:1762349534

Submitted on: 2025-11-05 14:32:16

Comments

Log in to comment.

No comments yet.