Giter Site home page Giter Site logo

Comments (2)

jbaylina avatar jbaylina commented on August 18, 2024

The idea of the smart contracts is to do programs that no body controls, even the creator of the contract. Loosing the ownership of a contract is part of the magic of the decentralisation.

Said that, you can always add a method in the controller that transfer back the ownership.

from minime.

d416 avatar d416 commented on August 18, 2024

I see the rationale now... in fact it appears this is what Aragon did for their token launch - ie. auto-reassign control to a placeholder contract after a sale.

That said, if it's a once-and-done campaign, I'm not seeing a lot of value in keeping the controller in a separate contract.. it may even save gas to integrate it?

I would propose an alternative Controlled.sol which takes into account the Owner of the Controlled contract, so only the Owner can set the Controller. The Owner can do this for as many times as there are Campaigns - eg. Seed Round, Pre-sale, Final Sale - then on the last and final Campaign, the Campaign contract can set both the Owner and Controller to a neutral Contract or even the Token itself to keep things 'decentralized'. This might be a better option for smaller DACs who need something to work out of the box.

Here is an example (unaudited) of how this might be achieved in Controlled.sol in case anyone is looking to support the use case above... it uses the Owned contract code from the sample campaign so that only the Owner can change the controller, change owners, or step down as Owner...

pragma solidity ^0.4.18;

contract Owned {
    /// @dev `owner` is the only address that can call a function with this
    /// modifier
    modifier onlyOwner { require (msg.sender == owner); _; }

    address public owner;

    /// @notice The Constructor assigns the message sender to be `owner`
    function Owned() { owner = msg.sender;}

    /// @notice `owner` can step down and assign some other address to this role
    /// @param _newOwner The address of the new owner. 0x0 can be used to create
    ///  an unowned neutral vault, however that cannot be undone
    function changeOwner(address _newOwner) onlyOwner {
        owner = _newOwner;
    }
}

contract Controlled is Owned {
    /// @notice The address of the controller is the only address that can call
    ///  a function with this modifier
    modifier onlyController { require(msg.sender == controller); _; }

    address public controller;

    function Controlled() public { controller = msg.sender;}

    /// @notice Changes the controller of the contract - ony the Owner can execute this operation
    /// @param _newController The new controller of the contract
    function changeController(address _newController) public onlyOwner {
        controller = _newController;
    }
}

from minime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.