Mid and Final term discussion

Auctioneer role

Auctioneer role

di LORENZO BELLOMO -
Numero di risposte: 7

Hello,

I have an issue concerning the way in which I switch from a phase to another (mainly regarding the Vikrey one).
Let's say a person tries to make a commitment after the commitment phase is over. At this point I notice that the phase has switched, so I have to emit and event to notify everyone. Since emitting an event costs a lot of gas, is it fair that this unlucky bidder has to pay the price of this event, or should I emit an event only at the expense of an auctioneer? Should I model this entity (the auctioneer), and in case I should, how should I take his address? Is this entity different from the owner of the good?


Thanks in advance,

Lorenzo

In riposta a LORENZO BELLOMO

Re: Auctioneer role

di ANDREA BONGIORNO -

I add another question to those of Lorenzo.

Since I think it's not fair to emit an event at expense of the bidder and assuming that this cost is duty of the seller/auctioneer, how can we 1) refund the bidder (and count the gas used) or 2) charge the event to the auctioneer/seller ?

In riposta a ANDREA BONGIORNO

Re: Auctioneer role

di ANDREA LISI -
(@Andrea)


Unfortunately, if A is calling a function you can't say "B is paying for its execution".
But here is where "estimate the gas cost" comes handy, in my opinion. If you know that user U executes a function which does extra work once in while, and thus charges him additional fees, you may keep a "refund deposit" proportional to the gas you estimate U spends, and that U can ask back. 

But I guess a solution like this is out of the scope of the assignment. But if you have such considerations, you may provide a justification / suggestion in the report . 

Hope it helps. It does not, let me know.

In riposta a ANDREA LISI

Re: Auctioneer role

di ANDREA BONGIORNO -

Yes it helps. I’ve just read in solidity doc that there is a way to do what you are suggesting, but it brings to another problem: if I keep a refund deposit I’ve to be sure (or assume) that the contract has enough funds other the ones sent for the auction (let’s say a “fondo-cassa”).


In any case thank you for your hint!

In riposta a ANDREA BONGIORNO

Re: Auctioneer role

di ANDREA LISI -

Yes, exactly

You may provide initial funds to your auctioneer contract, or may use the reserve the contract collects at the end of the auction, i.e. the deposits not refunded (in case a bidder did not open its bid) and partially refunded (in case a bidder gave up during the withdrawal phase).

You are welcome!

In riposta a LORENZO BELLOMO

Re: Auctioneer role

di ANDREA LISI -

(@Lorenzo)
Hi,

since in Solidity there not exist triggers / timers, if you want to fire an event to say "Switch from phase A to phase B" you need to invoke (let's say) a switchPhase() function "by hand". By means of a front-end (let's say Python) you can set up the timer there and call the smart contract function automatically. 
Otherwise, for the purposes of the simulation in Remix, you may:

  • simply refuse commitments outside the commitment phase (you may emit an event commitmentRefused() if you wish);
  • simulate the switching phase with a switchPhase() function, called "by hand" by the auctioneer, to do some operations and emit a commitmentPhaseIsOver() event at the expenses of the auctioneer.

Hope it helps, if you do not understand something ask without problems!

In riposta a ANDREA LISI

Re: Auctioneer role

di LORENZO BELLOMO -

Thanks a lot for the answer, but I feel like I am still missing one point.

What I understood is that I have to choose to implement one of this two "patterns":

  • choose to let the owner of the auction change phase of the auction manually checking that it respects the times passed as parameter, implying that every phase lasts for at least the amount of time passed as parameter, but potentially more, even an infinite time if the owner never calls it.
  • choose to check every time a user interacts with the contract (for example when anyone calls a method of the contract), making the auction respect the times specified in the parameters, but where events of a phase switch may be raised very late in case of an auction with few participants.
Did I understand correctly?

Thanks again, Lorenzo
In riposta a LORENZO BELLOMO

Re: Auctioneer role

di ANDREA LISI -

Since the assignment text does not specify such details, you may choose a method you think it's better. I proposed two ideas, but they may be more. 

The switchPhase() function I have used as example may simply notify the new phase (this should reflect your second point), or it can start / unlock it (it should reflect your first point). As you wish.

I do not remember if it is asked to notify the switching between phases, but if you think it is an important event to be acknowledged, then think about the pros / cons of each solution.

Hope it helps.