Bad Trait implementation error

function defination in NFT contract:
(define-public (buy-in-ustx (id uint) (staff principal) (comm ))
(let
(
(owner (unwrap! (nft-get-owner? nft-2d id) ERR-NOT-FOUND))
(listing (unwrap! (map-get? market id) ERR-LISTING))
(price (get price listing))
)
(asserts! (is-eq (contract-of comm) (get commission listing)) ERR-WRONG-COMMISSION)
(try! (stx-transfer? price tx-sender owner))
(try! (contract-call? comm pay id price staff))
(try! (trnsfr id owner tx-sender))
(map-delete market id)
(print {a: “buy-in-ustx”, id: id})
(ok true)
)
)

commission-trait.clar:
;; title: commission-trait
;; version:
;; summary:
;; description:

;; traits

(define-trait commission
((pay (uint uint principal) (response bool uint))))

test case:
const buy = simnet.callPublicFn(“nftcc-2d”, “buy-in-ustx”, [Cl.uint(1), Cl.address(wallet_1), Cl.address(deployer + “.commission-trait”)], wallet_1)
console.log(Cl.prettyPrint(buy.result));
expect(buy.result).toBeOk;

Error:
FAIL tests/market-listing.test.ts > Ensure that NFT can be listed and bought > List and Bought
Unknown Error: Call contract function error: nftcc-2d::buy-in-ustx(u1, 'ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5, 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.commission-trait) → Error calling contract function: Runtime error while interpreting ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.nftcc-2d: Unchecked(BadTraitImplementation(“commission”, “pay”))

Please provide me solution for above error:

1 Like