CORIONplatform / solidity

GNU General Public License v3.0
12 stars 9 forks source link

Contract fallback fix #137

Closed iFA88 closed 7 years ago

Dexaran commented 7 years ago

I mean that thirdPartyContract.sol might have the following implementation:


pragma solidity ^0.4.11;

contract TPCToken {
    function CORAddress() constant public returns (address) {}
    function CORPAddress() constant public returns (address) {}
    function receiveToken(address, uint256, bytes) external returns (bool, uint256) {
        if(msg.sender == CORAddress()) { 
            // We have received COR.
        }
        if(msg.sender == CORPAddress()) {
            // We have received CORP.
        }
        else {
            // We have received strange token
            // that is not related to CORION platform
            // but uses the same fallback function names.
            throw;
        }
    }
    function approvedToken(address, uint256, bytes) external returns (bool) {
        if(msg.sender == CORAddress()) { 
            // We have received approval of COR.
        }
        if(msg.sender == CORPAddress()) {
            // We have received approval of CORP.
        }
        else {
            // We have received approval of strange token
            // that is not related to CORION platform
            // but uses the same fallback function names.
            throw;
        }
    }
}
iFA88 commented 7 years ago

You mean this?