How to implement clock auction

Hi community

I am Ali and I am since 2 months in this community actually I came here from Moralis and I start to learn how I can create dapp with Moralis but I have seen very good courses on Ivan tech and I instantly jumped in.I enjoy with the courses here but I am stuck now a little bit on what I want to create. My problem is, I cloned rariable and it works very good, I deployed also a contract with Binance smart chain test net , there is no problem but I wanna add also clock auction in my dapp , I wrote some contracts and tried with ether remix but I could not implement that to marketplace contract. I don’t know now exactly how I should go on with that, I appreciate any help, Thank you so much.

you can find the project here

Hey @aliekber1976 Sounds like a great project! I think its better for you if you open a topic on moralis forum

Thank you so much :slight_smile: I did that already actually I wrote a simple auction contract and It works with ether remix but I could not implement with javascript.

here is my contract.

pragma solidity >=0.7.0 <0.9.0;

contract SimpleAuction{
    address payable public beneficiary;
    uint public auctionEndTime;
    address public highestBidder;
    uint public highestBid;
    mapping(address => uint) public pendingReturns;
    bool ended = false;
    event HighestBidIncrease(address bidder, uint amount);
    event AuctionEnded(address winner, uint amount);
    constructor(uint _biddingTime, address payable _beneficiary){
        beneficiary = _beneficiary;
        auctionEndTime = block.timestamp + _biddingTime;
    function bid() public payable{
        if (block.timestamp > auctionEndTime){
            revert("The auction has already ended");
        if (msg.value <= highestBid){
            revert("There is alreay a higher or equal bid");
        if (highestBid != 0){
            pendingReturns[highestBidder] += highestBid;
        highestBidder = msg.sender;
        highestBid = msg.value;
        emit HighestBidIncrease(msg.sender, msg.value);
    function withdraw() public returns (bool){
        uint amount = pendingReturns[msg.sender];
        if(amount > 0){
            pendingReturns[msg.sender] = 0;
                pendingReturns[msg.sender] = amount;
                return false;
        return true;
    function auctionEnd() public{
        if (block.timestamp < auctionEndTime){
            revert ("The auction has not ended yet");
        if (ended){
            revert("the function auctionEnded has already been called");
        ended = true;
        emit AuctionEnded(highestBidder, highestBid);
1 Like