0

i have A claim Function , when highest bidder call the function After auction times end , but i want this auto , when auction times end nft automatically transfer to the highest bidder : kindly help me How to do ? or give a reference of a smart contract where this step is being used ;

1 Answer 1

0

Smart contracts can never execute by themselves. Some entity always has to call them and pay for the gas fees.

That entity can either be a user of your marketplace or some backend service of yours. The easiest approach is that you simply add a function like terminateAuction which anyone can call, and which takes the auction ID (or however you identify them) as parameter, terminates that auction and settles the result (the sale). So probably the same as what you already have.

You can also configure your backend to call the termination. Then you simply need a bit more infrastructure: some way to call it right after an auction ends, way to manage the backend's wallet (since it needs Ether to pay for gas fees), connectivity and where&how to run this system.

2
  • can You give me a code of this function , so that i will understand more or any reference link .
    – user103592
    Commented Jun 28, 2022 at 6:54
  • Sorry, I don't have code available for this. But the function has basically just the following steps: 1) check that the auction has ended 2) check if there is a winner 3) perform the sale 4) close/terminate the auction Commented Jun 28, 2022 at 8:03

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.