As part of the Scrypto Developer Incentives Program, developers may receive monthly rewards for their contributions. Builders who "Impress the CTO" will receive a prize of $1500 in XRD.
Read more below to learn about the latest winning submission for this reward.
Building an Escrow Pool with Scrypto
Congratulations to Scryptonight!
In a recent video, Piers and Matt discussed the concept of an NFT Warehouse. In this model, instead of physically handing over the control of the NFT to the marketplace, it is deposited to a component (representing a warehouse) controlled by the lister. The lister would then be able to determine the price they’d like to sell it for and produce a badge that can be handed to multiple NFT marketplaces.
This allows multiple NFT marketplaces to compete for the sale of the NFT. When a sale is completed, the NFT marketplace can use the same badge, which grants them permission to withdraw the NFT from the warehouse component and satisfy the lister’s asking price for the NFT.
Scryptonight took inspiration from this concept to build what he calls an Escrow Pool blueprint. This blueprint allows a user to instantiate a component they control, deposit resources, and mint “allowance” NFTs to distribute. These allowance NFTs can be handed out to anyone, allowing them to redeem the allowance NFT to withdraw an allowable amount of resources determined by the user.
Specifically, for each allowance NFT the user mints, the user can determine whether the allowance NFT can be used once or multiple times, what and how many resources can be withdrawn, and how long the NFT is valid.
The general pattern allows for multiple use cases:
- Fund Management: Create escrow pools where you or others can deposit and retrieve funds.
- Allowances: Issue Allowance NFTs to enable others to access and utilize funds in your escrow pools.
- Transaction Subsidies: Use escrowed XRD to pay for transaction costs or allow others to use your escrow funds for their transaction
Scenarios:
- Distributing Tokens: Seamlessly distribute tokens across multiple exchanges without manual transfers.
- Buying on Multiple DEXs: Back limit buys on multiple DEXes using a single escrow fund to optimize trading strategy.
Scryptonight’s approach provided a generalized design which doesn’t fully satisfy the requirements of an NFT warehouse. While some concepts are similar, such as the ability for a user to create a component they control, deposit resources inside, and hand out badges to allow third parties to withdraw resources under certain conditions, a specific NFT warehouse requires a component to know a user’s asking price and facilitate the handoff of the NFT to the third party when sufficient payment has been provided. Nevertheless, because of the generalized design, anyone can take this example and modify it to fit their specific needs. As such, the blueprint provides a novel idea to reimagine marketplaces in Web3 and is deserving of the Dev Incentive award.
Scryptonight mentions:
“It had long bothered me that in order to buy NFTs on the ledger I need to actually bind up enough XRD to buy ALL the NFTs I express an interest in, when I would like it to be more of a very long wishlist that would get filled until I run out of cash. It occurred to me that this shouldn't be a particularly hard problem to solve given the tool chest we have with Scrypto, and so last year I developed the Escrow component to address this problem in a general manner, for fungibles and non-fungibles alike, ending up with a component that has far broader applicability than I had originally envisioned. Then recently I saw Piers and Matt discussing warehousing components which as it turns out was exactly the sort of thing I had already made—so I decided to publish what I had in order to provide an example and help push the debate forwards. This component showcases a capability which, if widely supported, can allow you to link together your various trading activities to make the different markets dance for you in unison rather than each act like a strange little island with its own idiosyncratic idea how your funds should be getting handled. I believe this is the future we should be headed towards, and I invite the market operators out there to participate in the debate so we can hammer out this standard together! - Scryptonight”
Explore these features and more by diving into the Escrow component and see how it can streamline your on-ledger activities. For detailed scenarios and usage, refer to the source file and test suite provided.
Recognition for Exceptional Community Contributors
A significant factor in Radix's ongoing success is its dedicated community members who continuously promote the Radix mission across Web3 and DeFi. To show appreciation for their contributions, a reward of $500 will be given to the following community members:
Get Involved and Win XRD
- Enroll in Scrypto 101, complete the course, and earn $200 in XRD with an exclusive NFT certificate. Enroll here.
- 250m XRD ($10M) to Power the Next Web3 Breakthrough: If you refer a friend, and they receive a grant you will receive $500 in XRD for your referral.