0

I know Golem Network Token is not implementing the approve() allowance() and transferFrom() functions. Thus, GNT is partially compliant to ERC20 standard.

I would like to go futher, and implement the transfer() function as private().

This way, it would be impossible for the token holders to freely trade it (it would only be possible using a custom mechanism -- see below), but still possible to see the token in wallets.

Sample code would look like this:

contract CustomToken is ERC20 {

    public symbol = “TEST”
    public totalSupply = X;
    public balanceOf...

    //function approve() -- not implemented
    //function transferFrom() -- not implemented

    // first step: check that the caller is KYC
    function placeOrderBuy(int _amountToken, int _maxPrice ) external payable 
            returns(bool success); 

    // first step: check that the caller is KYC
    function placeOrderSell(int _amountToken, int _minPrice ) external 
            payable returns(bool success); 

    //run automatically every month, and transfer the tokens function 
    executeOrders() private returns(float newPrice);

    // triggers Transfer event 
    transfer(address _to, uint _value) private returns(bool success);
}
  1. Would this be accepted as a partially compliant ERC20, like GNT is? Would wallets accept it?

  2. I believe the above contract is working, but maybe there are some problems I didn't think of? What do you think?

  3. if ERC20 is out of the table, I could just remove the transfer() function too, and implement the token transfer within the executeOrders() functions, right?

Thanks!

1

The tools that handle / interact with a smart contract do so by using the encoded signature of the function interfaces. The signature is built from the canonical interface for the function, so

transfer(address,uint)

becomes canonical as

transfer(address,uint256)

and encoded as

0xa9059cbb

Adding private doesn't change the interface, so the encoding is the same, so the tools will be ignorant of the change. It should work fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.