polymath.js-deprecated icon indicating copy to clipboard operation
polymath.js-deprecated copied to clipboard

KYC Verification EOA Check

Open everhusk opened this issue 7 years ago • 7 comments

Allow an easy way for KYC providers to verify if an address being requested for verification is a EOA/contract address or not.

everhusk avatar Jan 22 '18 17:01 everhusk

FYI - function to do this from web3 is: web3.eth.getCode

adamdossa avatar Jan 22 '18 17:01 adamdossa

@adamdossa right. @Everhusk for checking so within Solidity it can be done like this:

function isContract(address _addr) private returns (bool is_contract) {
      uint length;
      assembly {
            //retrieve the size of the code on target address, this needs assembly
            length := extcodesize(_addr)
      }
      return (length>0);
    }

pabloruiz55 avatar Jan 22 '18 17:01 pabloruiz55

@GregTheGreek please take a look at this when you have a chance.

ChainSafeSystems avatar Jan 28 '18 19:01 ChainSafeSystems

@adamdossa @pabloruiz55 @ChainSafe Thoughts on adding this into template.js (wrapper)? That way we can just call web3.eth.getCode and all the contracts will have access?

Edit: Template.js, since there is no reason to add a constant or anything on solidity

GregTheGreek avatar Jan 28 '18 20:01 GregTheGreek

What would be the logic if it is a contract address? There are some cases where I could imagine a KYC provider wanting to be able to whitelist an address (many current ICOs do allow this), although perhaps it may require some extra diligence, and possibly a higher fee (or this may not be feasible for current KYC approaches). Either way, I think if we do this check we could either just display it as information to the KYC provider, but I don't think we want to hardcode disallowing contract addresses at the Solidity end.

adamdossa avatar Jan 29 '18 17:01 adamdossa

I guess that the idea is to at least give the KYC provider some quick info about the address. It would be up to them to decide if they don't want to approve a contract address.

We can't ban it from the get-go as an address containing code could be a multsig wallet. There's also the case of forbidding a contract address, as it could be an investment pool contract trying to get into an STO.

I see no problem in adding that function to the wrapper, but we have to be very careful in how we allow people to use it.

pabloruiz55 avatar Jan 29 '18 17:01 pabloruiz55

It's gonna be a v1 stretch goal - 100% for v2.

ChainSafeSystems avatar Jan 29 '18 22:01 ChainSafeSystems