bepro-js
bepro-js copied to clipboard
Smart Contract - Collectibles NFT [@RealFevr]
Requester
Real Fevr (https://fantasy.realfevr.com/)
Description A decentralized NFT Factory where users are able to open packs with football events
Master Variables
- realFvrTokenAddress (Real Fvr Token Address)
address
- admin (
onlyOwner
modifier)address
- realfvrTokenPriceInUSD
uint256
- 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)
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.
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 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 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 }]
- [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)
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);
Would be nice to have a getter and a setter(Admin) for both packIncrementId
and lastNFTID
vars.
Add this 2 Arrays on createPack function:
transferFeeAddresses
, transferFeeAmounts
- 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
The buyPack
function should receive an array of ids, to support multipacks buys at one shot.
the openPack
should receive an array of ids to avoid multi authorisations from Metamask to open each pack.
The getRegisteredTokens
is returning error: Error: types/values length mismatch (count={"types":1,"values":0},
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.
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.