Skip to content
Verified contractExactGPLv3

DelegatedWithBalanceWeight

Address0x1ecfb5cd55dfd68a54f58f77b729b8a1c933f08a
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.26

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.26+commit.8a97fa7a
Language
solidity
Optimization
No
EVM version
cancun
License
GPLv3
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
22,261,087
Creation transaction
0x0cf8bf6d0a…29e8d50e53

DelegatedWithBalanceWeight.sol

// SPDX-License-Identifier: GPLv3

pragma solidity ^0.8;

interface IERC20WithVotes {
    function balanceOf(address) external view returns (uint256);
    function delegates(address) external view returns (address);
    function getVotes(address) external view returns (uint256);
}

contract DelegatedWithBalanceWeight {
    function getVotesWithBalance(address account) external view returns (uint256){
        IERC20WithVotes token = IERC20WithVotes(0xCdF7028ceAB81fA0C6971208e83fa7872994beE5);
        uint256 votes = token.getVotes(account);
        address delegate = token.delegates(account);
        if (delegate == address(0)){
            votes += token.balanceOf(account);
        }
        return votes;
    }
}
Compiler settingsShow
{
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "evmVersion": "cancun",
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.