hicetnunc2000 / objkt-swap

Hic et Nunc smart contracts. FA2 multiassets: hDAO, OBJKTs, Marketplace, SUBJKTs and Unregistry.
79 stars 48 forks source link

royalty issue with swaps #7

Open benjamin-wilson opened 3 years ago

benjamin-wilson commented 3 years ago

I was reviewing objkt-swap_v2_1.py and noticed that by specifying the swap royalties and creator via input parameters could result in either stiffing the creator fees or redirecting the fees to the address of the swappers choosing.

def swap(self, params):
...
self.data.swaps[self.data.counter] = ... royalties=params.royalties, creator=params.creator)
def collect(self, params):
...
self.royalties = self.data.swaps[params.swap_id].royalties * self.fee / (self.data.swaps[params.swap_id].royalties + self.data.fee)

# send royalties to NFT creator
sp.send(self.data.swaps[params.swap_id].creator, sp.utils.nat_to_mutez(self.royalties))

This should instead reference the royalty fees and creator address set on the minter (Hic et Nunc Minter (OBJKT Swap v1): KT1Hkg5qeNhfwpKW4fXvq7HGZB9z2EnmCCA9)

crzypatchwork commented 3 years ago

the dApp UI enforces that the input (royalties/creator) must be valid for us to support/endorse/display such swap. if one doesn't follows parameters specified during minting the swap won't be supported. there is no way to access the royalty info from the minter as there were no on-chain views at the time on Tezos). Practically it would still be the same thing from the objkt swap v1.