This contract is based on the OpenZeppelin template. We have optimized it to use gas more efficiently. The efficiency reaches 45-75% compared to the basic implementation. We partially retain support for the Enumerable interface, so that third-party applications, such as marketplaces, could easily interact with the contract.
Below is a table of how gas is used for token minting. Let's imagine that the price of gas is 60 Gwei and the price of Ethereum is 4000 USD.
Number of tokens | Gas used | Transaction fee in USD |
---|---|---|
1 | 75123 | 18.02952 |
2 | 99935 | 23.9844 |
5 | 174371 | 41.84904 |
10 | 298432 | 71.62368 |
20 | 546554 | 131.17296 |
Note: The MainNet consumes slightly more gas (~6%) than the test environment.
Smart contract address in MainNet - 0xf8c0acb14328aa09398f1cfd949fa2bdfeaa1cd7
Our contract interacts with OpenSea's ProxyRegistry
.
This allows users to avoid paying gas for SetApprovalForAll
when trading.
This is a safe feature that is recommended to be installed in smart contracts in the official OpenSea technical documentation.
Read more here - OpenSea Whitelisting.
In our contract, this is implemented in the file CyberGirlsCafe.sol (line 133).
In the template from OpenSea this is implemented here - ERC721Tradable.sol
We use Provenance Hash technology (more details here - Provenance Hash solution), to prove to the community that each Cyber Girl is created in a certain order before the smart contract is published. This order and images cannot be changed afterwards.
Each image is hashed using the SHA-256 algorithm.
Then all the hashes are combined in the proper order into a single hash string CONCATENATED HASH STRING
.
This string is hashed using the SHA-256 algorithm and results in a FINAL PROOF HASH
.
CONCATENATED HASH STRING = sha256('Token 1 Hash' + 'Token 2 Hash' + ... + 'Token 10010 Hash')
FINAL PROOF HASH = sha256(CONCATENATED HASH STRING)
Our contract stores the FINAL PROOF HASH
in the file CyberGirlsCafe.sol on line 22.
string public constant PROVENANCE = "8fef626f47a65408f131274eefff04588dbd9a2eee69460efe986e72ae3c119c";
You can see the full list of hashes here - CyberGirlsCafe Provenance.
We have implemented the whitelist in the contract, which allows users from that list to mint a token for 0.045 ETH (the discount is 0.025 ETH). One user from the whitelist can mint a maximum of 4 tokens.
The project is made using Truffle, so you need Node.js and this package to work with it.
npm install -g truffle
We have completely tested the contract using OpenZeppelin tests as a basis. Running the tests takes a long time.
cd path/to/CyberGirlsCafe
truffle test
To deploy the contract you need:
- Install the
truffle-hdwallet-provider
package. - Specify the
mnemonic
andproviderUrl
arguments intruffle-config.js
. - Specify the contract constructor arguments in
migrations/1_initial_migration.js
.
npm install truffle-hdwallet-provider
truffle compile
truffle migrate --network rinkeby