NFT Collections and Supply - ERC721 vs ERC 1155 - solidity

I'm building an NFT marketplace, say a copycat of OpenSea.
I need to make my users able to mint their own tokens. That's ok, that would be an ERC721 contract. But I want to allow my users to mint different collections (as OpenSea does) with different supplies as follows:
(1) Have a single collection
(2) Have multiple collections
(A) Mint 1/1 NFTs
(B) Mint 1/N NFTs (say, for instance, 100 in total of the same NFT)
That makes a set of combinations:
Single collections (1) of 1/1 NFTs (A)
Single collections (1) of 1/N NFTs (B)
Multiple collections (2) of 1/1 NFTs (A)
Multiple collections (2) of 1/N NFTs (B)
Single or multiple collections (1 or 2) of both 1/1 and 1/N NFTS (A and B)
When using ERC721 I would be able to make (A) and (B), yet for every collection I would have to deploy a new contract. I want to avoid this.
Is this covered by ERC1155?

(A) Mint 1/1 NFTs
(B) Mint 1/N NFTs (say, for instance, 100 in total of the same NFT)
Both options are in accordance with the ERC-1155 standard.
The ERC-1155 defines a collection of tokens, where each token has an ID and an amount (specified as a value in the standard). Which means, you can have for example:
Token ID 1 that has amount of 1. At any point in time, it's always owned by just one address. (Case A)
Token ID 2 that has amount of 10. Five of these tokens ID 2 is owned by Alice, and other five tokens ID 2 is owned by Bob. (Case B)

Related

NFT drop marketplace Smart Contract and show collections by type

New to NFT and solidity, and want to know how we can get NFTs grouped by collection type.
e.g.
collections =>
[
art => [nft1, nft2, ...],
music => [nft1, nft2, ...]
]
So that users can see collections and buy a random NFT from it.
My question is, where to put that logic ?
in smart contract or we have to save nfts in other database (MySql, MongoDb) where can query and categorise them on the basis of collection type ?
If I have to do this in other database e.g. MySql, MongoDb then I will listen to transfer event when an NFT is minted and save all details on database and then query to list collections on the basis of types.
Or If I add that logic in Smart Contract then I can create Collection struct and add functions to add/remove/move NFT to that collection.
What do you think one is better option to do this ?
If smart contract is better then, how I can get collections along with NFTs added in them ?
should I create mapping of collections and then each Collection struct will have mapping of NFT struct ?

Is auth numbers field guaranteed to be there if the product supports auth

If I check that the institution supports auth as a product, would account number and routing number be guaranteed to be there in the numbers field in the auth response?
Sort of.
If the account is from a US bank account, AND if the call doesn't result in an error, you're guaranteed to get account number and routing number. However, that doesn't mean that all Auth calls will return account + routing number.
For example, Auth if you call Auth on an Item that just has a credit card account, you'll get an error response back [this prevents you from getting billed for calls that don't return anything useful]. Or, if you call Auth on a bank account that is from outside the US, you'll get the numbers associated with the transfer system used by that bank (account number + routing number is a US-only system).

Optaplanner CVRPPDTW with different capacity types

we have a vehicle routing problem with some additional requirements (different capacities, time windows, pickup/delivery).
While looking for a tool to solve this we found OptaPlanner. But after reading the documentation (and some forum entries), we are still not sure whether the problem can be modeled with it.
What we need:
customers order pickup and delivery
with different capacities (e.g. 2 x type A, 1 x type B, 1 x type C))
and with time windows (pickup after a certain time, delivery before a certain time).
there are different vehicles with certain capacities (e.g. one vehicle has 8 places for type A, 5 places for type B, 2 places for type C, another one 10 places for type A, 2 places for type B, none for type C,...)
the pickups and deliveries should now be distributed to the vehicles in such a way that capacities and time windows are of course maintained and
every pickup / delivery of a customer is carried out by the same vehicle (for all different capacity types)
pickups and / or deliveries of other customers can take place between the pickup / delivery of a customer (as long as the capacities are maintained)
Can this problem be mapped and solved with Optaplanner?
Thanks for any help or advice!

Challenge with multiple B2BUnit

We have come across a situation while working on a implementation, below is the sequence of requirement
Some of the users (B2BCustomer), have access to more than one SoldTo (B2BUnit) in the system
Before starting of the commerce journey, user has to choose a SoldTo
Selected SoldTo then marked as ‘DefaultB2BUnit’
Rest of the commerce journey (PLP, Cart, Checkout and Order) is based on selected SoldTo
The challenge here is due to ‘branch’ restriction, user has access to only SoldTo set as ‘DefaultB2BUnit’ and none of the OOTB service let us get the list of all B2BUnit assigned and change the user’s selected one as default.
Is there any service available through which we can retrieve all SoldTo’s (B2BUnit) assigned to the user and set one as default after login
You need to create B2Bunit and assigned it to the B2BCustomer group then all you can read all the groups.
Please try following method:
/**
* Assigns a default unit for a customer who may be a member of multiple units. and modifies a branch for this
* customers session based on the unit
*
* #param customer
* The current customer
* #param unit
* A {#link B2BUnitModel} to be assigned as the default for a customer
*/
void setCurrentUnit(B2BCustomerModel customer, B2BUnitModel unit);
As per your requirement, you need to remove the branch restriction.
branch restriction allows customers to access data of their b2b unit and its descendants within one organization hierarchy.
If you don't have a hierarchical structure of b2b units then the branch restriction shouldn't be relevant and can be disabled.
Once you will disable the restriction, then I think your requirement can be implemented easily.

Empty all accounts in a smartcontract for a banking application

I am working on a sample banking code in solidity. I wanted to use a so called "TakeAllTheMoney" and run function (just to give you an idea about the role of the function).
This function should only be executable by the deployer of the contract and should give him the possibility to take all the money on the bank and transfer it to his account.
Problem: How can I empty also the account of the other user of the bank? Meaning that when a different user - not the deployer of the contract and of the function - uses the contract after the "TakeAllTheMoney" function is employed, he also sees 0 on his account.
Many thanks in advance
function TakeTheMoneyAndRun() public{
require (msg.sender==Owner);
balance[msg.sender] -= balance[msg.sender];
(msg.sender).transfer( address(this).balance );
Expected results after employing this function:
Balance Bank = 0
Balance person that employed contract and function = 0 (since it went on his metamask account or similar)
Balance of every other user = 0
Again, thanks!
You are mixing two things. User's amount in metamask and user sent amount to Bank in your case is Smart Contract and stored in some variable. So the amount you see in the metamask is the amount User own and has no link with the Smart Contract until and unless you send the money to the Smart Contract.
The Smart Contract in your case "Bank" the money sent by the user is store in the Smart Contract and the tracking of money recieve is stored in the array. Smart Contract itself does not holds the record of the previous transaction. So if you want to delete the Smart contract balance tracks of the User you have to empty that particular array. Although it sounds fishy if you want to implement it and wants to make the user accounts to zero in the Smart Contract.