ENS's HashRegistrarSimplified has a line I'm having trouble understanding. Inlined:

function newBid(bytes32 sealedBid) payable {
  if (address(sealedBids[msg.sender][sealedBid]) > 0) throw;
  if (msg.value < minPrice) throw;

  // Creates a new hash contract with the owner
  Deed newBid = (new Deed).value(msg.value)(msg.sender);
  sealedBids[msg.sender][sealedBid] = newBid;
  NewBid(sealedBid, msg.sender, msg.value);

It targets v0.4.0, if that makes a difference. The best I've been able to figure is:

(new Deed) // calls the constructor but with no arguments?
          .value(msg.value) // calls the accessor for value?
                           (msg.sender) // I'm pretty confused

1 Answer 1


It's equivalent to:

var constructor = (new Deed);
var constructorWithValue = constructor.value(msg.value);
Deed newBid = constructorWithValue(msg.sender);

It calls the constructor with msg.sender argument and forwards msg.value value with the call.

Without the value it would look like this

Deed newBid = new Deed(msg.sender)

and would forward 0 value as the default.

  • 1
    I was trying to decipher it but what confused me the most was the parenthesis in (new Deed) - I think in most other languages having parenthesis around it already creates the instance and you can't add values to constructor after that Feb 21, 2018 at 8:18
  • You're missing msg.sender from the last line Feb 21, 2018 at 8:57
  • I also forgot to assign the constructor with value. I don't know why this doesn't work: constructor = constructor.value(msg.value); Feb 21, 2018 at 9:03
  • Thanks for the detailed response! What do you mean by "forwards msg.value value with the call"? Where can I find documentation on which methods are defined on constructors?
    – num1
    Feb 21, 2018 at 18:46
  • I've found an example in the docs: solidity.readthedocs.io/en/latest/… but I'm not sure how this works. Does the parser special-case this? Do all functions have a .value() member?
    – num1
    Feb 21, 2018 at 19:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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