Source repo: https://github.com/calvbore/dittoV0
This is the smart contract development and testing repo for Ditto Protocol.
https://github.com/gakonst/foundry/
curl -L https://foundry.paradigm.xyz | bash
Open a new terminal to load the latest PATH
, and then run:
foundryup
Use the above command to update foundry as well.
After cloning, run the tests:
forge test
Buyer1
makes an initial bid on thier desired NFT,NFT1
.
- Funds are transferred to the smart contract, a small fee taken and set asside to whomever will eventually sell
NFT1
. - A derivative of
NFT1
,Ditto1
, is minted and transferred toBuyer1
.Ditto1
gives its owner the claim onNFT1
if it's sold to the smart contract. - The minimum bid is set to some multiple of the price
Buyer1
paid forDitto1
. It will decrease over time until it reaches some value slightly above theBuyer1
's bid price.
Buyer2
makes a second bid forNFT1
- the bid satisfies the minimum bid defined in the smart contract.
Buyer1
's bid is refunded toBuyer1
, minus the fee paid. - A fee is taken from
Buyer2
's bid. Half is sent toBuyer1
, and half is set aside for the sale ofNFT1
. Ditto1
is transferred formBuyer1
toBuyer2
.- The minimum bid is set to some multiple of
Buyer2
's bid price. It will decrease over time again.
Seller1
sellsNFT1
Seller1
transfersNFT1
to the smart contract.Ditto1
is burned.NFT1
is transferred toBuyer2
.Buyer2
's bid is transferred toSeller1
, along with fees collected from previous bids.