I am having some trouble using Aion's scheduling service. I am trying to use it for an auction style service and the transactions do not seem to be getting completed from their end. I can view them being tried and going to pending here but they ultimately fail and get retried. This has been happening for a couple days now and I cannot figure out how to resolve it.

abstract contract Aion {
    uint256 public serviceFee;
    function ScheduleCall(uint256 blocknumber, address to, uint256 value, uint256 gaslimit, uint256 gasprice, bytes memory data, bool schedType) virtual public payable returns (uint,address);

contract CardAuction is CardOwnership {

    Aion aion;

    function createCardAuction(uint _cardId, uint _startingBid, uint _duration) external checkAuctionDuration(_duration) onlyCardOwner(_cardId) {
        require(!cardIsForSale[_cardId], 'CARD ALREADY UP FOR AUCTION');
        aion = Aion(0xFcFB45679539667f7ed55FA59A15c8Cad73d9a4E);
        bytes memory data = abi.encodeWithSelector(bytes4(keccak256('endAuction(uint)')), _cardId);
        uint callCost = 500000*1e9 + aion.serviceFee();
        aion.ScheduleCall{value: callCost}(block.timestamp + _duration, address(this), 0, 500000, 1e9, data, true);        

        cardIsForSale[_cardId] = true;
        cardToCurrentBid[_cardId] = _startingBid;
        auctionExpireDate[_cardId] = block.timestamp + _duration;
        // emit AuctionOpened(_cardId, _startingBid, block.timestamp + _duration);
        AuctionOpened(auctionId, _cardId, _startingBid, block.timestamp + _duration, msg.sender);

And here is the function being called

    function endAuction(uint _cardId) public {
        require(auctionExpireDate[_cardId] <= block.timestamp);

        if(leadingBidder[_cardId] != address(0)) {
        AuctionClosed(cardToAuctionId[_cardId], _cardId, cardToCurrentBid[_cardId], leadingBidder[_cardId], leadingBidder[_cardId] != address(0));
        cardIsForSale[_cardId] = false;
        cardToCurrentBid[_cardId] = 0;
        leadingBidder[_cardId] = address(0);
        auctionExpireDate[_cardId] = 0;
        cardToAuctionId[_cardId] = 0;

Please let me know if anybody can spot any errors or mistakes I have made as this has been quite the headache to troubleshoot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.