Skip to content

Redeem tokens not always working #11

@wiadran

Description

@wiadran

I have an issue redeeming tokens:
it works smoothly on some markets (e.g., BTC 15 Minutes),
but it doesn’t work at all on football markets.
I’m using the same code in both cases:

    const ctfAddress = "0x4d97dcd97ec945f40cf65f87097ace5ea0476045"; 
    const collateralToken = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"; 

    const parentCollectionId = "0x0000000000000000000000000000000000000000000000000000000000000000"; 
    const indexSets: number[] = [1, 2]; //any combination here was used - restricted to owned tokens, and generic 1 and 2 as well

    const redeemTx: SafeTransaction = {
        to: ctfAddress,
        operation: OperationType.Call,
        data: ctfInterface.encodeFunctionData("redeemPositions", [
            collateralToken,
            parentCollectionId,
            conditionId,
            indexSets
        ]),
        value: "0"
    };


    const response = await client.execute(
        [redeemTx],
        "Simple redeem test"
    );

In both cases the transactions are created and appear on Polygonscan as successful, but for football markets the positions remain unredeemed.
There is a difference on the logs on polygonscan; for football there seem to be 4 "steps":

  1. SafeMultiSigTransaction (address to, uint256 value, bytes data, uint8 operation, uint256 safeTxGas, uint256 baseGas, uint256 gasPrice, address gasToken, address refundReceiver, bytes signatures, bytes additionalInfo)[View Source]
  2. PayoutRedemption (index_topic_1 address redeemer, index_topic_2 address collateralToken, index_topic_3 bytes32 parentCollectionId, bytes32 conditionId, uint256[] indexSets, uint256 payout)[View Source]
  3. ExecutionSuccess (bytes32 txHash, uint256 payment)[View Source]
  4. LogFeeTransfer (index_topic_1 address token, index_topic_2 address from, index_topic_3 address to, uint256 amount, uint256 input1, uint256 input2, uint256 output1, uint256 output2)[View Source]

while bitcoin market (the working one) is like:

  1. SafeMultiSigTransaction (address to, uint256 value, bytes data, uint8 operation, uint256 safeTxGas, uint256 baseGas, uint256 gasPrice, address gasToken, address refundReceiver, bytes signatures, bytes additionalInfo)[View Source]
  2. TransferSingle (index_topic_1 address operator, index_topic_2 address from, index_topic_3 address to, uint256 id, uint256 value)[View Source]
  3. TransferSingle (index_topic_1 address operator, index_topic_2 address from, index_topic_3 address to, uint256 id, uint256 value)[View Source]
  4. Transfer (index_topic_1 address from, index_topic_2 address to, uint256 value)
  5. PayoutRedemption (index_topic_1 address redeemer, index_topic_2 address collateralToken, index_topic_3 bytes32 parentCollectionId, bytes32 conditionId, uint256[] indexSets, uint256 payout)
  6. ExecutionSuccess (bytes32 txHash, uint256 payment)
  7. LogFeeTransfer (index_topic_1 address token, index_topic_2 address from, index_topic_3 address to, uint256 amount, uint256 input1, uint256 input2, uint256 output1, uint256 output2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions