Closed usamacs95 closed 2 years ago
Agoric Dapp Design - Dev link: https://xd.adobe.com/view/d825c6e4-887c-4432-9c98-5fce91a25cb2-8d76/
Web socket
connections in dappsERTP
.Zoe framework
and the rest of the Agoric components.dapp-card-store
from github link provided in agoric documentation.dapp-card-store
to run succesfully dapp-fungible-faucet
was required to be setup first.header
component for the dapp-card-store
as provided in the design files
.Hussain-branch
in agoric-card-store repo.Tried integrating tailwind both v2 and v3 but was facing some ES module issues.
When tried to integrate the tailwind v2, similar to the agoric-amm dapp, faced ES module issues in craco.config.js, found two solutions for this:
With v3, I faced the same issue, i.e. the app crashed and was unable to import Asset Kind from @agoric/erp
I will try to solve this problem tomorrow but if it still persists, then we will have to create a new UI from scratch.
TODO:
Moreover, today research on agoric card store API and learn how they store the player names. The question that needs to be answered:
Basically help me understand how the existing contract and it's API works and how will we implement a full scale marketplace through it.
Read up on Agoric documentation to familiarize yourself with how their smart contract works because we'll be drilling down deeply into their framework for this task.
I will catch up with you later tonight.
Explored the documentation further to understand different functionalities related to contract.
Explored ipfs and tried to understand how it works.
Went through the card-store dapp contract and api to make things clear.
Tried modifying the card store dapp API to send the meta in the form of a name and a URI but was unsuccessful.
Your tasks @haseebasim
Your tasks @Hussain-7:
For storage read up on board and how we can use it to store different entities on the chain. I will further explore agoric/store to figure out how it can be useful to us.
Explored offers in detail and learned how one can escrow their assets in the offer and how payouts work.
Also learned about the exit strategy and user seat and how it can be used to exit the offers.
JavaScript framework
used in agoric which includes concept of:
Ertp
function related to creating and using non-fungible assets.use case.
contracts
like:
use case
.agoric white
paper and the deep dive into agoric js smart contract
article. Which were very helpful as these type of details were not available in the agoric official documentation. cosmos
.
current contracts
in the app are currently doing and what changes are required in them if we want to use them. user wallet
do not have any nfts ,this is for sure that nfts are not from user wallet.mint some Nfts
and add them to user wallet
.myCards section
.context
to store all wallets on new socket connect
. The obj to be stored will contain walletPromise
through which we can call wallet api
calls on that specific wallet. wallet access token
which is unique for every user wallet as the key value
.That we can get to differentiate wallets obj what we store on connection of a socket. But still have to figure how to get that.secondary marketplace
section, Just filtering out the user NFTs from the ui.My Cards
pagenft cards
in My Cards
pageSecondary Marketplace
pageSecondary Marketplace
pagePrimary Marketplace
pageQuestions to be answered:
marketplace contract
, study how we can limit the mint functionality to the creator of the contract. We have the special creator faucet that is only visible to the contract creator, it might be that we limit the mint function to the creator faucet. @haseebasim your task:
{ name:"", image:"", description:"" }
api endpoint
in the backend for handling minting of Nfts.nft
function in the contract.createFaucet
was able to call the mint function.Rpc
(remote procedure call).handler
for api end point using which I was able to send an offer to the backend.mint function
on the contract
just to mint fungible token and I was successfully able to do that.mint and sell contract
for Nfts using the data provided.public Faucet
from the frontend was able to get all the current Nfts for sale in the primary market place.Primary Marketplace
.@haseebasim store the whole json string of the meta data in the contract instead of just the ipfs hash. We will retrieve this string in the UI and parse the image IPFS hash from it. This will also need an attribute by the name of id, which has to be unique and will be used for tracking offers as pointed out by @Hussain-7. These ids can be created via nanoid
user
wants to sell some of the nfts
he owns.atomic swap contract
to be used in our dapp.public faucet
and creator faucet
of the contract on the board from where we it is easily accessible by the frontend.offer
to use the atomic swap contract. Which required us to get certain things at the frontend:
minter
, issuer
and brand
from the main card minting contract to create a payment.wallet promise
which then allows us to get zoe
at the frontend.contract instance
and using that we get the Sellers invitation
.Seller's Invitation
, Proposal
and the Payment
we create a offer
which return a user seat (Seller Seat).seller seat
at the frontend which can be used to make the buyers matching offer.secondary-market-place
branch.
- For that we needed the same
minter
,issuer
andbrand
from the main card minting contract to create a payment.
For what purpose do we require minter
and issuer
? We cannot create new asset types on the front end. Whenever a new asset needs to be minted, this should be handled through the contract methods.
- For that we needed the same
minter
,issuer
andbrand
from the main card minting contract to create a payment.For what purpose do we require
minter
andissuer
? We cannot create new asset types on the front end. Whenever a new asset needs to be minted, this should be handled through the contract methods.
notifiers
to find out how they can be utilized for the exchange of information between the contract and front-end.updates
about the state of an offer or other objects. offers
and invitation
details.Place in Marketplace button
is clicked. GetSwapObject
function run that gets all the relevant information from the board using the ids that are acquired when contracts are installed and deployed over the chain. getSellerSeat
present in the contract. seller seat
which is basically an invitation for the buyer
. notifiers
to send offer information to the front-end after storing it in the contract instance. card Amount
in the contract instance and when the offer has been successfully created the notifiers are used to send that card Amount to the front-end so that it can be cross-referenced and the particular card for which the offer is created, can be listed in the market place.seller seats along with the card Amounts
.buyers
, when the card is displayed in the marketplace, buyers can buy that card and on clicking the buy button, a contract function will be called using the public facet of the contract, which will take in all the relevant information of the buyer to create a matching offer
. swap
the assets and will provide both the users with the assets they desired. minters
and issuer
to the contract to improve security.issuer
, minter
and brand
throughout all the contracts , so changed the contract so that this is done.getSellerSeat()
and getBuyerSeat()
.
getSellerSeat()
is on the contract and is called using the public faucet.
payment object
using the selling price and the card details.sellersInvitation
.sellersInvitation
has a handler matchingSeatInvitation()
which will be called later in the buyers flow.Invitation
, proposal
and payment
object which returns the seller Seat
.offerResult()
function on the seller seat we get an invitation that is stored and later used by the buyer of this card to make a matching offer.
getBuyerSeat()
is on the frontend. This function does not require any minters so its safe to use here.
matchingSeatInvitation()
function which I mentioned above.matchingSeatInvitation()
creates another invitation with the offer handler that matches the offers in zoe by comparing both the seller seat and buyers seat .And if the offers match.payout's
.seat allocation
on offer match we are using a built in function for seat allocation swap.buyers seat
from the offer function called from the frontend which is than used to get offer status and notifers.Questions:
card amount
containing card info in the contract? We use agoric maps I assume but how do we map these card amounts to the sellerSeats? The old NFT marketplace already had the functionality of the primary marketplace. It is kept as is for now and we have not made changes to that contract.
To add in the functionality of the secondary marketplace where users can place their items on sale and carry out transactions with each other, we have created a new smart contract called secondaryStore
.
The new contract is based off of the atomicSwap
contract. This is because we required the swap functionality already being employed in this contract. Now I am going to explain how we are achieving the main functionalities of the secondary marketplace:
availableOffers
which is an Amount
object that stores the array of all sell offers on the marketplace. matchingSeatInvitation()
method will be called that will be retrieved using the seat details available in the react app through the method described in the selling an NFT
section above. AtomicSwap
contract to trade the assets and transfer value between the buyer and the seller. @rowgraus
notifiers
at the front-end. The notifier wasn't working correctly and was unable to fetch the updates
dispatched from the backend.abstraction
over the contract swapAssets
, by the name of swapWrapper
to implement notifiers again and make them work correctly. Optimized the getSellerSeat function
to receive all the required issuers, brands, installations, and minter when its instance is created on running the API deploy script. availableOffers
amount to store the amounts of all the offers. mint
the provided NFTs.wallet promise
to send an offer
to the wallet when the buyer click on buy on the card from secondary market place.Seat Invitation
which was returned from getSellerSeat()
which will be stored in the contract along with the offers which are being maintained in the new wrapper contract.amm
and the addOffer() in the auction contract
, using those was able to figure out the correct format.main logic
in contracts.successfully
sending , have testing out its working from a single user perspective.
seller seat invitation
in contract where the offer for same seat exist in the contract.merge all the code
with @haseeb part (notifiers) so that we can integrate functions at the ui as well.multi user
perspective today.seller seat Invitation
along with the offers.multi users
. There was some progress:
cosmic-swingset
in agoric -sdk
.local chain
.api ag-solos
wallets
connected to separate client browsers
ag-solo
.offer
was rejected by wallet
then both the seats were exiting which resulted in error when we made an offer again. Came up with a solution for that.available offers array
in the contract also required us to know whether wallet accepted or rejected offer.available offers array
in the contract
ui fixes
for modal.removing nft from sale
. Frontend part is done already just need to create a simple function and connect them.testing
of app for tomorrow.loader logic
for each section .loaders
on each functions performed when in modal.bought
from primary
should be stored as well as it changes when sold
and bought
from secondaryMarket
.
sale
and purchase
.bugs
fixed.secondary-marketplace
branch.Gracefully handle error when contract is not deployed:
Please add url parameters according to tabs to make it easier to open to a specific tab:
@haseebasim please fix the designing of the marketplace, the cards are not stackable and are not responsive. Please check for design inconsistencies throughout the dapp:
@Hussain-7 please add comments in contracts and api code, explain the thought process behind each variable. Also write tests for all the contracts.
Comments should match the following patterns:
// CMT (hussain@robor.systems): comment text
@haseebasim please take note as well and do the same for minting contract
@haseebasim please complete the following task. Before moving to any next task. These were some of the issues @danishyasin33 pointed out during the code review.
review
and the rest you can easily resolve yourself.
secondarystore
contract that why we needed to create a separate contract for the matching invitation function. Moreover why this task cannot be performed in the same secondaryStore wrapper function.Clean up app.js
by creating a separate Application context
and then use that context inside app.js. Refer to the agoric-amm application context file. Mainly have to move all activateWebSocket
code to a context and then use that context inside app.js. Reference : https://github.com/robor-systems/agoric-amm/blob/main/ui/src/context/Application.jsx. purchase history
. Try to shift
this logic to the contract. You may need to handle communication
between contracts
.amount arrays
mainly) and explain the use case these variables are required for.
Description
Modify Agoric’s dapp-card-store to allow users to list their own cards for sale. Make the following modifications to the UI:
User should be able to list their card for sale. User flow:
Context
Agoric has an example dapp which allows users to purchase Baseball card NFTs directly from the application for a fixed price. The dapp instantiates a separate contract to sell these items and includes a basic front end.
For this project, we’d like you to extend the Dapp card store to allow holders of baseball cards to offer theirs for sale at a fixed price.
Current Implementation:
https://github.com/Agoric/dapp-card-store
Additional Notes