windranger-io / bit-token-contract

The BitDAO BIT token contract as deployed on Mainnet
https://etherscan.io/address/0x1A4b46696b2bB4794Eb3D4c26f1c55F9170fa4C5
Apache License 2.0
2 stars 1 forks source link

BitDAO uses msg.sender rather than _msgSender() #18

Open CjHare opened 3 years ago

CjHare commented 3 years ago

The BitDAO contract extends ERC20 contract uses the Context (supporting Ethereum Gas Station Network v1) contract.

To accommodate the GSN contracts need to replace msg.sender with _msgSender(), as when using the GSN themsg.sender` is not the actual sender but the GSN contract.

The BitDAO only uses msg.sender, which may cause issues if BITs are ever used with the GSN


    modifier onlyAdmin {
        require(msg.sender == admin, 'Caller is not a admin');
        _;
    }```

``` line 836 – BitDAO.sol
    function setPendingAdmin(address newPendingAdmin) external returns (bool) {
        if (msg.sender != admin) {
            revert('BitDAO:setPendingAdmin:illegal address');
        }
...
    function acceptAdmin() external returns (bool) {
        if (msg.sender != pendingAdmin || msg.sender == address(0)) {
            revert('BitDAO:acceptAdmin:illegal address');
        }
...
    function delegate(address delegatee) external {
        return _delegate(msg.sender, delegatee);
    }

There could be a case for these operations to require direct calls (excluding all intermediary/proxy contracts, such as GSN), however was that the intention?