stacks-archive / stacks-transactions-js

The JavaScript library for generating Stacks 2.0 transactions
19 stars 17 forks source link

2nd PostCondition not recognized by testnet #39

Closed friedger closed 4 years ago

friedger commented 4 years ago

In the hodl token contract (https://github.com/friedger/clarity-smart-contracts/blob/master/contracts/tokens/hodl-token.clar) two assets are transferred in one hodl transaction.

There are two post conditions defined in a makeContractCall:

    postConditions: [
          makeStandardFungiblePostCondition(
            contractAddress,
            FungibleConditionCode.Equal,
            new BigNum(0),
            new AssetInfo(contractAddress, "hodl-token", "hodl-token")
          ),
          makeStandardFungiblePostCondition(
            contractAddress,
            FungibleConditionCode.Equal,
            new BigNum(5),
            new AssetInfo(contractAddress, "hodl-token", "spendable-token")
          ),
        ],

The testnet complains about a missing post condition for hodl-token asset:

Post-condition check failure: No checks for fungible token type AssetIdentifier { contract_identifier: QualifiedContractIdentifier { issuer: StandardPrincipalData(26, [210, 137, 135, 159, 210, 247, 227, 61, 194, 243, 163, 67, 70, 194, 6, 243, 93, 231, 54, 150]), name: ContractName("hodl-token") }, asset_name: ClarityName("hodl-token") } moved by Standard(StandardPrincipalData(26, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]))

If I remove one post condition, the testnet complains about the other missing asset condition. It looks like one one condition is recognized.

To test:

friedger commented 4 years ago

I understand that I have used the wrong address for hold-token, the sender is the bank-account