bepro-js icon indicating copy to clipboard operation
bepro-js copied to clipboard

Smart Contract - Collectibles NFT [@RealFevr]

Open Ruiub3i opened this issue 3 years ago • 14 comments

Requester
Real Fevr (https://fantasy.realfevr.com/)

Description A decentralized NFT Factory where users are able to open packs with football events

Master Variables

  1. realFvrTokenAddress (Real Fvr Token Address) address
  2. admin (onlyOwner modifier) address
  3. realfvrTokenPriceInUSD uint256
  4. packs Structure

Libraries to Inherit

  • [x] Ownable
  • [x] ERC721
  • [x] ERC1151
  • [x] ERC20 (to access the real fvr token)

Features

  • [x] createPacks(paks_number, nfts_per_pack, price, series, drop, pack_type, initial_id) [ADMIN]
  • [x] editPackLimit(pack_type, series, drop) [ADMIN]
  • [x] deletePacks(pack_type, series, drop)
  • [x] deletePacksById(packIds)
  • [x] getPacks(pack_type, series, drop)
  • [x] getPacksByAddress(address)
  • [x] getPackbyId(pack_id)
  • [x] setPackPrice(pack_type, price, series, drop) [ADMIN]
  • [x] setTokenPriceInUSD(price_in_usd) [ADMIN]
  • [x] countOpenedPacks(pack_type, series, drop)
  • [x] countClosedPacks(pack_type, series, drop)
  • [x] offerPack(pack_type, series, drop, amount, dest_wallet) [ADMIN]
  • [x] buyPack(pack_type, series, drop)
  • [x] openPack(pack_id)

Ruiub3i avatar Apr 23 '21 09:04 Ruiub3i

Hi guys, the createPacks function should consider transactions fees to right holders for the moment of first sell and future transactions, something like this: createPacks( paks_number: 20000, nfts_per_pack: 4, price: 2000, series: 'A', drop: 'First', pack_type: 'Premium', initial_id: 1, first_sell_fees: [ { wallet_id: 'xxxxRightHolder1', fee: 0.5 }, { wallet_id: 'xxxxRealFevr', fee: 0.1 }, { wallet_id: 'xxxxBurn', fee: 0.4 }], future_sell_fees: [{ wallet_id: 'xxxxRightHolder1', fee: 0.01 }, { wallet_id: 'xxxxRightHolder2', fee: 0.01 }] ) This way we can configure different transactions fees / right holders every time we create new nfts packages.

tbem avatar Apr 26 '21 16:04 tbem

We also should have another function to define the transaction fees on the marketplace, something like this: setMarketplaceFees([{wallet_id: 'xxxxRealFevr', fee: 0.03}]) [Admin] This way we can change the marketplace fee over the time.

tbem avatar Apr 26 '21 16:04 tbem

@tbem can we just assume 1 fee based address as that all transactions (included the first one) have the fee sent to the address Y?

Otherwise it would consume a lot of gas and seems that making the first transaction not have a fee while all the future ones will have wont make any real impact

Let us know

Ruiub3i avatar Apr 29 '21 15:04 Ruiub3i

@Ruiub3i The createPacks function should receive 2 Array[Hash] parameters for specifying the first buy fees and the future transactions fees. The number of hashes, may vary dependently of the right holders we need on each package drop. Each Hash is composed by the wallet and the percentage in decimal correspondent to the fee that we need to process. Ex: first_sell_fees: [ { wallet_id: 'xxxxRightHolder1', fee: 0.5 }, { wallet_id: 'xxxxRealFevr', fee: 0.1 }, { wallet_id: 'xxxxBurn', fee: 0.4 }]

future_sell_fees: [{ wallet_id: 'xxxxRightHolder1', fee: 0.01 }, { wallet_id: 'xxxxRightHolder2', fee: 0.01 }]

tbem avatar Apr 29 '21 18:04 tbem

  • [x] createPacks -> createPack
  • [x] editPackLimit -> editPackInfo
  • [x] deletePacks -> deletePackById
  • [x] deletePackById
  • [x] getPacks (This call should be taken offchain with the filtering that comes from the event PackCreated that sends all this information everytime a pack is creating)
  • [x] getPacksByAddress (This call should be taken offchain with the filtering that comes from the event PackCreated that sends all this information everytime a pack is creating)
  • [x] getPackById
  • [x] setTokenPriceInUSD
  • [x] setPackPrice -> createPack or editPackInfo
  • [x] countOpenedPacks(pack_type, series, drop) (This call should be taken offchain with the filtering that comes from the event PackCreated that sends all this information everytime a pack is creating)
  • [x] countClosedPacks(pack_type, series, drop) (This call should be taken offchain with the filtering that comes from the event PackCreated or PackDelete that sends all this information everytime a pack is creating)
  • [x] buyPack
  • [x] openPack -> mint(nftId)

Ruiub3i avatar May 05 '21 16:05 Ruiub3i

Events to Be used below

event PackCreated(uint256 packId, uint256 nftsAmount, string indexed serie, string indexed packType, string indexed drop); event PackOpened(address indexed by, uint256 indexed packId); event PackDelete(uint256 indexed packId);

Ruiub3i avatar May 05 '21 22:05 Ruiub3i

Would be nice to have a getter and a setter(Admin) for both packIncrementId and lastNFTID vars.

tbem avatar May 18 '21 23:05 tbem

Add this 2 Arrays on createPack function: transferFeeAddresses, transferFeeAmounts

tbem avatar May 20 '21 21:05 tbem

  • packIncrementId starts at 1
  • removed packNumber and added opener variable in Pack Object (stack to deep problem in ethereum - not enough space for duplicated variables)
  • added event PackOpened & added PackBought
  • solved problem on setTokenPrice
  • added function getTokenPrice

Ruiub3i avatar May 25 '21 22:05 Ruiub3i

The buyPack function should receive an array of ids, to support multipacks buys at one shot.

tbem avatar Jun 08 '21 13:06 tbem

the openPack should receive an array of ids to avoid multi authorisations from Metamask to open each pack.

tbem avatar Jun 09 '21 15:06 tbem

The getRegisteredTokens is returning error: Error: types/values length mismatch (count={"types":1,"values":0},

tbem avatar Jun 11 '21 11:06 tbem

isApproved method is inconsistent, it's supposed after the approve for a specific wallet always return true. But that is not happening, sometimes comes true, and then comes false again.

tbem avatar Jun 11 '21 11:06 tbem

hey guys, I am working on this issue to make it work as requested but have an important question: I want to see why is there a requirement to inherit from both ERC721 and ERC1151 ? one of them would be ok I think.

sgoia avatar Feb 08 '22 14:02 sgoia