PolymathNetwork / polymath-core-deprecated

Core Ethereum Smart Contracts for Polymath - The Securities Token Platform
MIT License
66 stars 19 forks source link

SecurityToken is missing a function to change owner #38

Closed pabloruiz55 closed 6 years ago

pabloruiz55 commented 6 years ago

Picture the following scenario.

  1. Issuer deploys SecurityToken.sol (He is the owner), the Total supply gets assigned to his balance mapping.
  2. Issuer deploys an STO (He is the owner of the STO) passing the SecurityToken contract he created before to connect the ST with the STO.
  3. Now there's ST and STO contracts, both with Issuer as owner.

The problem here is that in reality, as with 99% of crowdsales, you want the STO to be the owner of the Security Token contract and have it posses the total supply of tokens in their control.

Ideally, The STO should be deployed first and it should handle the creation of the SecurityToken contract, but in my tests, doing that is not possible do to gas running out.

The problem here is that issueSecurityTokens function needs the SecurityToken total supply to be assigned to its owner (the Issuer) and even if the tokens were first transferred to the STO, this function will try to move them from the owner balance which is still the Issuer and there's no way to modify that.

satyamakgec commented 6 years ago

As per my understanding, you want to change the owner of the total supply (replace issuer -> STO contract address). If My understanding is correct then we can transfer total supply to STO contract in selectOfferingProposal(). and for ownership do you think it will be safer to provide the ownership to the offering contract to call other functions as well.

everhusk commented 6 years ago

Yes this is a bug, need to fix. It should transfer Security Tokens from the STO balance to the contributor.

pabloruiz55 commented 6 years ago

We ended up not allowing a change of owner, but the ST must first be sent to the STO.