All about On-Chain Profit Calculator
January 5th, 2023

On-Chain Profit Calculator

Smart contract:

Opensea:

Attention! When you buy from secondary, please set gas limit to 400000 per NFT. Otherwise chance to get “out of gas” error.

If you don't do so it's out of gas in 80% of cases. Can't help you that.

Why I made this collection:

First of all, I did see a lots of degens using profit calculator on discord. Then I asked to myself why don’t I make it on chain? Especially, most of them are not elegant at all. So making a good one could already be something.

I also remarked that no NFT collection has ever kept track to its floor price (uhhh those “if you list under a certain price then I will burn it” don’t count). Not to mention doing this on-chain.

So, why not make it on chain?

How to follow the floor price on-chain?

It’s easy in our case. There is no difference between profit calculators so last sale price is already a good approximation to it. In solidity, you can make a smart contract reacting to ETH receipt by using

  • receive external payable {}

  • fallback external payable {}

So the idea is to make the contract the royalty receiver, then calculate the last sale price from the royalty it got. However, this is also the part that causes the Out Of Gas error. But that is because we not only follow the last sale price but also the profit/cost of buyer/seller with our profit calculator.

In daily use case, you can simply register the last sale price. It can already be a good way for the floor price. Otherwise there is still another method requiring an array with 50 elements, registering them by date and give the approximation with different quantiles. I didn’t try it though, but if you want to do it, watch out to the gas limit even for “view” functions.

Some functionalities:

  1. setWallets

    addresses

    0x7674c3…334d,0x4fa44d…a1bf,0x000000…e581

    (comma seperated addresses)

    tokenId

    the token Id you want to set the wallet. You need to be the owner.

  2. setGenArtAddressArtist

    As an artist, you can deploy other drawing contract and receive money with your work if people want to use your profit calculator.

  3. setGenArtAddressHolder

    If any artist uploaded their art work, you can change the display of your work. Attention supply limited!

Should be good. Happy trading!

Subscribe to pinner
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.
More from pinner

Skeleton

Skeleton

Skeleton