Smart Contract

D3SKFillProxy

A.5ec90e3dcf0067c4.D3SKFillProxy

Valid From

142,135,756

Deployed

2w ago
Feb 12, 2026, 02:14:57 AM UTC

Dependents

18 imports
1// D3SKFillProxy.cdc — Workaround for Cadence entitlement regression
2// Wraps an auth(Fill) capability inside a resource with access(all) methods,
3// allowing takers to fill offers via a non-auth public capability.
4// Deploy once per account. Can be removed after Cadence HCU fixes the issue.
5
6import FungibleToken from 0xf233dcee88fe0abe
7import D3SKOfferNFT from 0x5ec90e3dcf0067c4
8
9access(all) contract D3SKFillProxy {
10
11    access(all) let ProxyStoragePath: StoragePath
12    access(all) let ProxyPublicPath: PublicPath
13
14    access(all) resource Proxy {
15        // Stored privately — never exposed on a public path
16        access(self) let cap: Capability<auth(D3SKOfferNFT.Fill) &D3SKOfferNFT.Collection>
17
18        // Anyone can call this via a non-auth &Proxy reference
19        access(all) fun fillOffer(
20            id: UInt64,
21            payment: @{FungibleToken.Vault},
22            holderAddress: Address,
23            takerAddress: Address,
24            askReceiverPath: PublicPath,
25            askStoragePath: StoragePath
26        ): @{FungibleToken.Vault} {
27            let collectionRef = self.cap.borrow()
28                ?? panic("Cannot borrow collection from stored capability")
29
30            return <-collectionRef.fillOffer(
31                id: id,
32                payment: <-payment,
33                holderAddress: holderAddress,
34                takerAddress: takerAddress,
35                askReceiverPath: askReceiverPath,
36                askStoragePath: askStoragePath
37            )
38        }
39
40        init(cap: Capability<auth(D3SKOfferNFT.Fill) &D3SKOfferNFT.Collection>) {
41            self.cap = cap
42        }
43    }
44
45    access(all) fun createProxy(
46        cap: Capability<auth(D3SKOfferNFT.Fill) &D3SKOfferNFT.Collection>
47    ): @Proxy {
48        return <-create Proxy(cap: cap)
49    }
50
51    init() {
52        self.ProxyStoragePath = /storage/D3SKFillProxy
53        self.ProxyPublicPath = /public/D3SKFillProxy
54    }
55}
56