I created a multisig wallet using Mist, but don't know how to deploy a contract from the wallet address. Is it even possible? If so, how to do this?
It would be possible to use a multisig wallet with a little slight of hand, provided only that the multisig contract can invoke arbitrary functions in other contracts.
Since most multisigs cannot, themselves, create a contract, it will need a helping hand. A "Factory" contract could be manually deployed (by anyone/anything) first. It would include the template of the contract to create and a function, e.g.
function deployInstance() .... A multisig would be able to call that function. That would typically result in the multisig acquiring owner privileges.
This would double the cost of a one-time deployment but it would get it done.
It's worth mentioning that if the end-state objective is for the multisig to have ownership, it might be practical to deploy from a normal EOA and then transfer ownership to the multisig. Transferability is a property of the contract to deploy, but not unusual or unreasonable.
Hope it helps.
It depends on the multisig wallet you are using, but most likely no.
There are 2 cases:
- Case 1: You know the smart contract B to deploy from smart contract A, BEFORE deploying A
- Case 2: You only know the smart contract B to deploy A, AFTER deploying A
This is the most common case, and the only case where you can use Solidity only. When you write your smart contract A, you need to import B or define B in the same file. In a function, you can create an instance of B like this:
B b = new B()
In this case, Solidity alone is not enough. You need to use
assembly, which is a sort of escape hatch provided by Solidity to allow you to specify which EVM opcode you want to execute. This is the most flexible way to use the EVM from Solidity, but it is also risky because you can hang yourself.
This would be the procedure:
- Compile the smart contract into bytecode
- Pass this bytecode to the smart contract as argument of a function
- In this function, use
assemblyto invoke the
CREATEopcode, and pass it the bytecode
This is possible in theory, though not all implementations of multisig wallet allow doing this. Contract creation is performed by opcodes, that are different from opcodes used to execute normal transactions, that's why contract creation cannot be structured as an ordinary transaction. ABDK Multisig Wallet is an example of multisig wallet with contract creation ability.
It is possible by calling this function with the correct parameters:
// Outside-visible transact entry point. Executes transaction immediately if below daily spend limit. // If not, goes into multisig process. We provide a hash on return to allow the sender to provide // shortcuts for the other confirmations (allowing them to avoid replicating the _to, _value // and _data arguments). They still get the option of using them if they want, anyways. function execute(address _to, uint _value, bytes _data) external onlyowner returns (bytes32 _r)
_to parameter you input a new address (normally its computed deterministically from a set of parameter, but I don't know if its mandatory) for the contract and in the
_data field you need to encode the ABI of your contract.