diff --git a/flow.json b/flow.json index 98adb74..d816fca 100644 --- a/flow.json +++ b/flow.json @@ -132,6 +132,13 @@ "testing": "0000000000000001", "testnet": "631e88ae7f1d7c20" } + }, + "USDCFlow": { + "aliases": { + "mainnet": "f1ab99c82dee3526", + "testing": "0000000000000007", + "testnet": "64adf39cbc354fcb" + } } }, "networks": { @@ -169,10 +176,6 @@ "deployments": { "emulator": { "emulator-account": [ - "Burner", - "ViewResolver", - "MetadataViews", - "NonFungibleToken", "NFTStorefront", "NFTCatalog", "NFTRetrieval", diff --git a/lib/go/iinft/internal/assets/assets.go b/lib/go/iinft/internal/assets/assets.go index 520a512..2f449e5 100644 --- a/lib/go/iinft/internal/assets/assets.go +++ b/lib/go/iinft/internal/assets/assets.go @@ -2,7 +2,7 @@ // sources: // contracts/DigitalArt.cdc (20.781kB) // contracts/Evergreen.cdc (5.401kB) -// contracts/SOURCES.md (1.474kB) +// contracts/SOURCES.md (1.569kB) // contracts/SequelMarketplace.cdc (10.012kB) // contracts/standard/Burner.cdc (1.998kB) // contracts/standard/FlowToken.cdc (13.194kB) @@ -19,7 +19,7 @@ // contracts/thirdparty/nft_catalog/NFTRetrieval.cdc (8.973kB) // contracts/thirdparty/versus/Art.cdc (17.353kB) // contracts/thirdparty/versus/Content.cdc (2.981kB) -// flow.json (4.939kB) +// flow.json (5.006kB) package assets @@ -128,7 +128,7 @@ func contractsEvergreenCdc() (*asset, error) { return a, nil } -var _contractsSourcesMd = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\xd4\xcf\x8e\xda\x30\x10\x06\xf0\x3b\x4f\x81\xd4\x4b\x39\x04\xf3\xa7\x44\xa1\xc7\x96\x72\x6b\x0f\x04\x7a\xa9\xaa\x6a\x6c\x4f\x12\xab\xc6\x46\xf6\x84\x2c\x6f\xbf\x8a\x10\xac\x03\x81\x2c\x5a\x2e\x88\x43\xf2\xfd\x3c\x9f\x26\xfe\xd4\x4f\x6d\xe9\x04\xfa\x5e\x2f\xea\xff\xf1\x04\x46\x82\x93\xec\x5b\xe9\x0c\xba\xa1\x90\xe2\xef\xe7\x82\x68\xe7\xbf\x32\x96\x2b\x2a\x4a\x3e\x14\x76\xcb\xac\xc9\xb4\xad\x58\xfd\x13\x65\xc4\xb8\xb6\x9c\x6d\xc1\x13\x3a\x26\xac\x21\x07\x82\x3c\x2b\x49\x69\x45\x87\x20\x6b\xd0\x30\x96\xda\x56\x6b\xfb\x1f\x4d\x27\x21\xac\xc3\xe8\x2d\xb8\x9d\x3b\xc7\xb5\x48\xa5\xc9\x15\xd7\xf8\x3e\xed\xe6\x40\x8d\x98\x0e\xe5\x27\x12\x48\x20\xf8\xad\xb0\xf2\x4f\x22\x1b\x99\x1d\x7e\x5a\x29\x12\x05\xb7\xe0\xe4\x93\xf4\x20\xb1\xc5\xde\xa4\x8b\xbb\x4e\xe9\xe5\x09\x51\x26\x24\x36\xe9\xe2\x3a\xee\xb1\xf6\xcc\xcd\x01\x3a\x1a\xfb\xb5\x5c\xa7\x64\x1d\x66\xce\x1a\xba\xc7\x98\x8c\x22\x7f\x7e\xf2\x88\xcd\x92\x78\x22\xb8\x88\x31\x9e\xe2\x97\x11\x8e\x93\x39\x9f\xc9\x44\x4c\x81\x4f\xe3\xf1\x1c\x12\x90\x93\x78\x06\x23\x19\x1c\xa7\xe1\xb5\x1c\xc7\x9a\xc7\x36\xf5\xf6\xe0\x97\x51\xd7\x58\x5d\xc9\x0a\xbd\xd5\x7b\x74\x1f\x80\xc2\x98\x33\x42\x85\x72\x72\x07\x8e\x0e\x75\x73\xff\x04\x10\x68\x9b\xd7\xe3\x7f\x3f\xfe\xed\xba\x58\xea\xbe\x4f\x6f\x05\x5b\x03\x12\x8d\xc0\x66\xa1\x41\x62\x87\xbd\x42\x72\x0a\xf7\xa0\x9f\xa8\x37\x32\x8f\x3e\x7a\x52\x26\x67\x3f\x5e\x60\xbb\x0b\xda\x7f\x74\xbd\x2e\xbe\x93\xd3\x65\x7a\x19\x3b\xe8\xbd\x06\x00\x00\xff\xff\xbc\xa4\x82\x05\xc2\x05\x00\x00" +var _contractsSourcesMd = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\xd4\xbf\xee\xda\x30\x10\xc0\xf1\x9d\xa7\xf8\x49\x5d\xca\x10\xcc\x9f\x12\x85\x8e\x85\xb2\xb5\x03\x81\x2e\x55\x55\x9d\xed\x4b\x62\xd5\xd8\xc8\xbe\x90\xf2\xf6\x55\x84\x42\x1d\x08\xa4\xa8\x2c\x88\x01\xbe\x9f\xf8\xec\xf8\xdd\x5b\x6a\x4b\x27\xd0\x0f\x06\xd1\xdb\x77\x4f\x60\x24\x38\xc9\x3e\x95\xce\xa0\x1b\x09\x29\x7e\xbc\x2f\x88\x0e\xfe\x23\x63\xb9\xa2\xa2\xe4\x23\x61\xf7\xcc\x9a\x4c\xdb\x8a\xd5\x1f\x51\x46\x8c\x6b\xcb\xd9\x1e\x3c\xa1\x63\xc2\x1a\x72\x20\xc8\xb3\x92\x94\x56\x74\x0a\x5a\xc3\x96\xb1\xd6\xb6\xda\xda\x5f\x68\x7a\x09\x61\x1d\x46\x7f\xc3\xdd\xdc\x25\xd7\x21\x95\x26\x57\x5c\xe3\xbf\x69\x77\x17\xd4\xca\xf4\x28\x5f\x90\x40\x02\xc1\x37\x85\x95\x7f\x11\xd9\x6a\xf6\xf8\x69\xa5\x48\x14\xdc\x82\x93\x2f\xd2\x83\x62\x87\xbd\x4b\x57\x0f\x9d\xd2\xcb\x06\x51\x26\x24\x76\xe9\xea\x36\xf7\xdc\xf4\xcc\xdd\x05\xf4\x4c\xec\xeb\x7a\x9b\x92\x75\x98\x39\x6b\xe8\x11\x63\x32\x8a\xfc\xe5\x97\x67\x6c\x9e\xc4\x53\xc1\x45\x8c\xf1\x0c\x3f\x8c\x71\x92\x2c\xf8\x5c\x26\x62\x06\x7c\x16\x4f\x16\x90\x80\x9c\xc6\x73\x18\xcb\xe0\x71\x5a\x5e\xc7\xe3\x58\xf3\xdc\x49\xbd\xbf\xf0\xeb\xd4\x2d\x56\x8f\x64\x83\xde\xea\x23\xba\xff\x80\xc2\xcc\x2d\xb2\x4b\x57\xcb\xfa\xbd\x7c\x04\x70\xa7\x64\x8e\x32\x2a\xbd\x14\x9d\x47\xa4\x89\x5c\xf2\x54\x28\x27\x0f\xe0\xe8\x54\x6f\xcc\x4f\x01\x04\xda\xe6\xf5\x74\x97\xe7\xaf\x7d\xf7\x56\xbd\x9d\xcd\xbf\x02\x11\x24\x1a\x81\xed\xfd\x0a\x8a\x3d\xf6\x06\xc9\x29\x3c\x82\x7e\xa1\xde\x6a\x9e\x7d\xf4\xa4\x4c\xce\x3e\xff\x86\xfd\x21\xd8\xdc\x67\x4f\xef\xd5\x8c\x9b\xbb\xfa\x3a\x3b\x1c\xfc\x09\x00\x00\xff\xff\x12\x3c\xeb\xcc\x21\x06\x00\x00" func contractsSourcesMdBytes() ([]byte, error) { return bindataRead( @@ -144,7 +144,7 @@ func contractsSourcesMd() (*asset, error) { } info := bindataFileInfo{name: "contracts/SOURCES.md", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x5, 0x13, 0xa9, 0x90, 0xd5, 0xd4, 0xbd, 0x52, 0x4, 0xad, 0x11, 0x2c, 0x52, 0xc6, 0xdb, 0xc, 0xe8, 0x34, 0xa9, 0x97, 0x93, 0x77, 0x2e, 0xe5, 0x6f, 0xab, 0xaf, 0x33, 0xf0, 0x26, 0x3f, 0x31}} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xa5, 0xe9, 0x83, 0xc2, 0xac, 0x6, 0x8c, 0x4c, 0xdc, 0x79, 0x9d, 0xaa, 0xd9, 0x43, 0xec, 0x52, 0x8b, 0x24, 0xce, 0x62, 0x46, 0xd6, 0xac, 0x2b, 0x88, 0x8, 0x4c, 0x6b, 0xc0, 0xb8, 0xe8, 0xc7}} return a, nil } @@ -468,7 +468,7 @@ func contractsThirdpartyVersusContentCdc() (*asset, error) { return a, nil } -var _flowJson = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xd4\x98\xcd\x72\xdb\x46\x0c\x80\xcf\xf2\x53\x64\x78\x4e\x64\xec\xff\xae\x6f\x69\xda\xdc\xd2\x43\x92\xe9\x25\xd3\xe9\x60\x01\xac\xa3\xb1\x4c\xba\x24\x65\x37\x93\xc9\xbb\x77\x24\xd1\xfa\x33\x1d\xa9\x3e\xb8\x63\x9f\x68\x10\x80\x3e\x60\x01\xec\x2e\xbf\x9f\x4d\x2a\x6a\xea\xbe\x45\xea\xbb\xea\xe2\xd5\xf7\xb3\xc9\xa4\x7a\xdb\xf6\xc3\xe3\xa4\xea\x9a\x45\x4b\x52\x5d\xbc\xaa\xa6\xe7\x1b\xc5\xf3\xfe\xeb\xac\xe5\x1b\x6c\xfb\x6f\xe7\xb7\xd2\x76\x8b\xee\xfc\x6d\xdb\x4f\x89\xa9\x7a\xbd\xb2\xc2\xf9\x0c\x3b\xb9\x77\x38\x99\x54\xd7\x38\xab\x6b\x59\xba\xad\x38\x24\x5f\x8a\x0a\x0a\x42\xce\xa5\xf8\xb5\xc9\xa4\xea\xa5\xeb\x07\x95\x94\x08\xc1\xea\xa8\x20\xc5\x6c\x0c\x57\x4b\x8d\x1f\x67\x93\xc9\x8f\xa5\x6e\xf5\xcb\xa2\xad\xa5\x3d\x82\xd8\xf5\x58\x33\xb6\x7c\xbe\xd6\xfe\x19\x9c\x5c\x2f\xe6\xd8\x37\x4b\x8f\x55\x89\xec\x05\x5c\xf4\x19\x50\x03\x85\x7b\xba\x9d\x00\x8a\x36\x86\x49\x24\xc6\x22\x80\x59\x76\x03\x98\xd5\x97\x4b\x15\xd8\xff\x0b\x63\x31\x22\x04\xef\x39\x99\xec\x3d\xc4\x1c\x0e\x62\x7c\xd7\xd4\xbd\xd4\xff\x7d\x1d\x06\xbb\x67\x5b\x8b\x5f\x67\x97\xb3\x1e\xe7\xc7\x4b\x66\xab\x78\x22\x9b\xa1\x1c\x48\x24\x7b\xed\xd0\x03\xe0\x08\x5b\xb0\x2e\x43\x74\x8c\x85\xd9\x16\x82\x03\xb6\xdf\x6e\xa5\xbd\x6c\x45\xea\x23\x68\x1b\xbd\xe7\x23\xfb\x07\xaf\x6f\xe6\xf2\xb9\xb9\x3a\x0a\x37\x54\xd5\xf9\xae\xc9\xe3\x9c\xdb\x9f\x78\x3f\x6f\xee\x4e\xf1\xbf\xe9\x93\x8d\xc1\xa9\xad\x02\x28\xce\x50\xf6\x62\x8a\xd5\x18\xd2\x48\xab\x28\xef\xac\x77\xc6\xa4\x04\x16\xd0\xab\xe3\xad\x62\xc6\x92\x29\x1e\xb8\x80\xd5\x98\x08\xa2\x8f\x07\xc9\x7c\xbf\xa8\x2f\x67\xf9\xb4\x6c\x6e\xa3\xdd\x35\x3a\x35\x62\x91\xa8\xa3\xf3\xb9\x68\x10\x8d\xe8\xff\xaf\xe1\xb0\x07\xff\x41\x7a\x64\xec\xf1\x8f\x99\xdc\x75\x4f\x0a\x7f\xcf\xc3\x8b\xce\xc5\xa7\xbb\x59\x4f\x5f\x73\x83\x2d\x3f\x29\x13\x3b\xf6\x2f\x2d\x0f\x4f\x2a\x83\x27\xad\xfc\x09\x5b\xa4\xe2\x20\x2e\x20\x3a\x17\x55\xb0\x36\x1e\x8f\x58\x8d\x44\xec\x8d\x92\x18\x51\x42\x51\x1c\x48\x1f\x0e\xd1\xdf\xdf\x7f\x7e\x87\x3d\xce\x9b\xcb\xd3\x77\xc9\xba\xf4\x7f\xd1\xda\xe8\x7c\x6b\x7f\xe2\xdc\xb7\x09\x03\x31\x1a\x54\x22\x44\x3a\x8d\x20\x1b\x6d\xc9\x58\x51\xe4\x54\x10\xcb\xf9\x21\xf2\x47\xe9\xdb\x99\xdc\xe2\xfc\xc9\xd0\x1b\x0f\xcf\x89\xfd\xa9\x6f\x5a\x29\x6d\x73\xf4\x48\xb2\xa9\xad\x3d\xa3\x53\x51\x25\x47\x54\x40\x39\x95\x18\x8c\x1b\x6d\x03\x9b\xc1\x53\x21\x54\x1c\xd1\x06\x7f\x88\xda\xd4\x4f\xda\x0f\x0e\xed\x5e\x5a\x33\x7c\x92\xbf\x17\x32\xff\x80\xed\x95\xf4\x37\x73\x5c\x45\xfa\xb3\xc0\x1f\xe8\x3f\xdb\xd9\x67\x39\x6b\x3e\x4a\xd7\xcc\x6f\x4f\x3f\xc3\xef\xda\xbc\xa0\x95\x39\x5b\x85\x5c\xd5\xd2\xdf\x35\xed\xd5\xe6\x7e\xb5\x4b\xa9\x74\x98\xc2\x14\xa6\xea\xc2\x38\xbf\x6e\xcd\x5d\x42\x24\x92\xae\x9b\x0e\x92\x69\xdd\xb0\x74\xd3\xa6\x2e\xf3\xe6\x6e\xda\xb4\x97\x17\x09\x00\xd6\x46\x3b\xcc\x63\x3e\x77\x78\x07\x9f\x2c\xb7\x8f\xbb\x1c\xc8\x91\xa8\x59\xd4\xfd\x03\xf2\x37\xc3\x8b\xcd\xfa\x21\x73\x2b\x5d\xf7\x78\xde\xab\x2b\xf9\xb6\x2a\x0e\x22\x83\xca\x87\x04\x21\x80\x0e\x11\x9c\xd3\xc2\x92\x25\x05\xcf\x16\x39\x3a\xad\x0c\x87\xc2\x5a\x59\x09\x25\x53\x4c\xd9\xc5\x00\xd6\x08\x29\x15\x56\x93\x69\x5d\x47\x1b\x96\x6e\x55\xca\x6f\x90\xaf\x67\xf5\x18\x90\x0a\x29\xfb\xac\x28\xfb\xe0\x9c\x18\xb5\x0f\x44\x01\xa2\xf3\xe2\x6c\xd6\x59\xbb\x18\x23\x92\x32\xc8\x29\xb8\x8c\xde\x69\x06\x4a\x4e\x41\x64\x0f\x1c\xb8\xb8\xe0\x96\x25\xed\x6d\xf2\xca\xa7\xe0\x58\x1e\x07\xba\x99\x63\x5f\x9a\xf6\x7a\x34\x49\xa6\x10\x6b\x52\x18\x62\x71\x22\xb2\xcf\x14\x01\xb4\x2b\xc0\xaa\xe8\xc2\x2a\x23\x88\x8a\xc5\xda\xe0\xa3\x2a\xcc\x1e\x7d\x44\xaf\x05\xa3\x27\x4d\xba\x48\xc1\xa8\x14\x17\x88\x9e\x2d\x70\x36\x34\xc2\xb4\xe8\xa4\x55\x63\x24\x02\x86\x51\xb2\x70\x24\x04\xaf\xdc\xc1\x72\x79\xd1\x5e\x47\xcd\x58\xb2\xb6\x9e\x5d\x0c\x21\xaa\x18\xd8\x04\x0e\x5a\x0a\xb2\x18\x1f\x12\x81\xcf\x68\xb5\x89\xce\x99\x65\x06\xb9\xc4\x9c\x95\xac\x6f\x8b\x23\x24\x7a\x8c\x04\xac\x43\x15\xbc\xa1\x64\x00\x3c\xe1\x3e\x89\x22\x5f\x92\x8f\x9a\x28\x4a\x00\xa5\xa3\x18\xe7\x4b\x72\xac\x4c\xb1\x8a\x75\x21\x4f\xc9\x26\x63\x52\xc8\x3e\x09\x94\x02\x59\x15\x5f\x74\x01\x21\xd0\x63\x85\xb3\x24\x31\xa3\x15\xa3\x41\x82\x76\xe0\xc0\x58\x20\xcc\xfb\x24\xc9\x64\x65\xb3\x71\xa2\x33\x6b\x31\x9c\x3c\x03\x0b\x92\xf3\x39\xaa\x94\x72\x44\xd0\x2c\x2c\xc5\x69\xd2\x4b\x40\xf6\x8a\xb4\x2e\x36\x59\x96\xa8\xd6\x24\x43\x83\xb1\xdc\xcc\x9b\x6f\xd7\x32\xd2\x63\x1b\xb0\x91\xa6\xfb\xb2\x1e\x42\xc3\x87\x90\x61\x24\xed\x0d\xd6\x41\xb6\x7f\x2a\x1c\x84\x0f\xf6\xc8\x7b\xf9\xde\x36\xbf\x15\xde\x9f\xb2\xb6\x92\xed\x21\x66\x90\x2d\xef\xff\xc3\xe3\xfd\x97\x8b\xe1\xdf\xbd\xab\xee\x52\xf4\xe7\xeb\xfd\xa8\x0e\xda\x77\x08\x6d\x7b\x77\x1f\xfc\xec\x7c\x68\x18\x24\x0f\xb7\xbc\x9f\xb8\xdf\x69\xc6\x2f\x87\x2a\xf7\xbd\x31\xfa\x42\x3f\xf6\xc2\xac\x5e\x0c\x6b\x79\xf6\xe3\xec\xdf\x00\x00\x00\xff\xff\x3b\xae\x68\x39\x4b\x13\x00\x00" +var _flowJson = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xd4\x98\x4b\x53\x1c\x49\x0e\xc7\xcf\xcd\xa7\x70\xd4\xd9\x6e\x94\xef\x4c\x6e\x5e\x7b\x7d\xf3\x1e\x8c\x77\x2e\x8e\x89\x09\xa5\xa4\xc4\x1d\x34\x55\x4c\x55\x35\x8c\xc3\xe1\xef\x3e\xd1\x74\xd1\x2f\x0a\xe8\xe9\x03\x13\x70\x82\x4c\xfd\xc5\x4f\x4a\x29\x1f\xf5\xf3\x64\x52\x51\x53\xf7\x2d\x52\xdf\x55\x67\x6f\x7e\x9e\x4c\x26\xd5\xfb\xb6\x1f\x7e\x9d\x54\x5d\xb3\x68\x49\xaa\xb3\x37\xd5\xf4\x74\x6d\x78\xda\x7f\x9f\xb5\x7c\x8d\x6d\xff\xe3\xf4\x46\xda\x6e\xd1\x9d\xbe\x6f\xfb\x29\x31\x55\x6f\xef\x54\x38\x9f\x61\x27\xf7\x0e\x27\x93\xea\x0a\x67\x75\x2d\x4b\xb7\x15\x87\xe4\x4b\x51\x41\x41\xc8\xb9\x14\xbf\x92\x4c\xaa\x5e\xba\x7e\x30\x49\x89\x10\xac\x8e\x0a\x52\xcc\xc6\x70\xb5\xb4\xf8\x75\x32\x99\xfc\x5a\xda\x56\xff\x59\xb4\xb5\xb4\xcf\x20\x76\x3d\xd6\x8c\x2d\x9f\xae\xac\x9f\x82\x93\xab\xc5\x1c\xfb\x66\xe9\xb1\x2a\x91\xbd\x80\x8b\x3e\x03\x6a\xa0\x70\x4f\xb7\x15\x40\xd1\xc6\x30\x89\xc4\x58\x04\x30\xcb\x76\x00\xb3\xfa\x62\x69\x02\xbb\x3f\x61\x2c\x46\x84\xe0\x3d\x27\x93\xbd\x87\x98\xc3\x5e\x8c\x1f\x9a\xba\x97\xfa\x9f\xaf\xc3\xa0\x7b\xb1\xb5\xf8\x38\xbb\x98\xf5\x38\x7f\xbe\x64\x36\x86\x07\xb2\x19\xca\x81\x44\xb2\xd7\x0e\x3d\x00\x8e\xb0\x05\xeb\x32\x44\xc7\x58\x98\x6d\x21\xd8\x63\xfb\xef\x8d\xb4\x17\xad\x48\xfd\x0c\xda\xda\xee\xe5\xc8\xfe\xc2\xab\xeb\xb9\x7c\x6d\x2e\x9f\x85\x1b\xaa\xea\x74\x5b\xf2\x38\xe7\xe6\x5f\x7c\x9a\x37\xb7\x87\xf8\x5f\xf7\xc9\x5a\x70\x68\xab\x00\x8a\x33\x94\xbd\x98\x62\x35\x86\x34\xd2\x2a\xca\x3b\xeb\x9d\x31\x29\x81\x05\xf4\xea\xf9\x56\x31\x63\xc9\x14\x0f\x5c\xc0\x6a\x4c\x04\xd1\xc7\xbd\x64\x7e\x5a\xd4\x17\xb3\x7c\x58\x36\x37\xd1\x6e\x8b\x0e\x8d\x58\x24\xea\xe8\x7c\x2e\x1a\x44\x23\xfa\x7f\x6b\x73\xd8\x81\xff\x2c\x3d\x32\xf6\xf8\xdb\x4c\x6e\xbb\xa3\xc2\xdf\xf1\xf0\xaa\x73\x71\x7e\x3b\xeb\xe9\x7b\x6e\xb0\xe5\xa3\x32\xb1\xa5\x7f\x6d\x79\x38\xaa\x0c\x8e\x5a\xf9\x03\x8e\x48\xc5\x41\x5c\x40\x74\x2e\xaa\x60\x6d\x7c\x3e\x62\x35\x12\xb1\x37\x4a\x62\x44\x09\x45\x71\x20\xbd\xbf\x89\xfe\xef\xd3\xd7\x0f\xd8\xe3\xbc\xb9\x38\xfc\x94\xac\x4b\xff\x07\xad\x44\xa7\x1b\xfd\x81\xfb\xbe\x4d\x18\x88\xd1\xa0\x12\x21\xd2\x69\x04\xd9\x68\x4b\xc6\x8a\x22\xa7\x82\x58\xce\x0f\x91\xbf\x48\xdf\xce\xe4\x06\xe7\x47\x43\xaf\x3d\xbc\x24\xf6\x79\xdf\xb4\x52\xda\xe6\xd9\x2b\xc9\xba\xb6\x76\x44\x87\xa2\x4a\x8e\xa8\x80\x72\x2a\x31\x18\x37\xda\x06\x36\x83\xa7\x42\xa8\x38\xa2\x0d\x7e\x1f\xb5\xa9\x8f\x3a\x0f\xf6\x75\xaf\xad\x19\xce\xe5\xcf\x85\xcc\x3f\x63\x7b\x29\xfd\xf5\x1c\xef\x22\x7d\x2a\xf0\x07\xf6\x2f\x76\xf7\x59\xee\x35\x5f\xa4\x6b\xe6\x37\x87\xdf\xe1\xb7\x35\xaf\x6d\x65\xfe\x7f\xfe\xf1\xc3\xf2\x6e\xb5\x8e\xf5\xa9\xf4\x16\x85\x39\x25\x8a\x9a\x45\x8c\xd3\xfe\xb8\xa3\xc2\x5b\xe4\x62\x12\x65\x32\xce\x16\xda\x6a\xe7\x93\x3b\xa8\xaa\x96\xfe\xb6\x69\x2f\xd7\x2f\xbe\xed\xbc\x29\x1d\xa6\x30\x85\xa9\x3a\x33\xce\xaf\x36\x8b\x6d\x42\x24\x92\xae\x9b\x0e\x23\xd3\xba\x61\xe9\xa6\x4d\x5d\xe6\xcd\xed\xb4\x69\x2f\xce\x12\x00\xac\x44\x5b\xcc\x63\x3e\xb7\x78\x07\x9f\x2c\x37\x8f\xbb\x1c\xc8\x91\xa8\x59\xd4\xfd\x03\xf2\x77\xc3\xc4\x26\xcb\xcc\xad\x74\xdd\xe3\x95\x50\x5d\xca\x8f\xbb\x72\x25\x32\xa8\x7c\x48\x10\x02\xe8\x10\xc1\x39\x2d\x2c\x59\x52\xf0\x6c\x91\xa3\xd3\xca\x70\x28\xac\x95\x95\x50\x32\xc5\x94\x5d\x0c\x60\x8d\x90\x52\xe1\x2e\xb9\xab\x95\x5e\xb3\x74\x77\xcd\xf5\x0e\xf9\x6a\x56\x8f\x01\xa9\x90\xb2\xcf\x8a\xb2\x0f\xce\x89\x51\xbb\x40\x14\x20\x3a\x2f\xce\x66\x9d\xb5\x8b\x31\x22\x29\x83\x9c\x82\xcb\xe8\x9d\x66\xa0\xe4\x14\x44\xf6\xc0\x81\x8b\x0b\xcb\x25\x06\x6f\x93\x57\x3e\x05\xc7\xf2\x38\xd0\xf5\x1c\xfb\xd2\xb4\x57\xa3\x49\x32\x85\x58\x93\xc2\x10\x8b\x13\x91\x5d\xa6\x08\xa0\x5d\x01\x56\x45\x17\x56\x19\x41\x54\x2c\xd6\x06\x1f\x55\x61\xf6\xe8\x23\x7a\x2d\x18\x3d\x69\xd2\x45\x0a\x46\xa5\xb8\x40\xf4\x6c\x81\xb3\xa1\x11\xa6\x45\x27\xad\x1a\x23\x11\x30\x8c\x92\x85\x23\x21\x78\xe5\xf6\x96\xcb\x8b\xf6\x3a\x6a\xc6\x92\xb5\xf5\xec\x62\x08\x51\xc5\xc0\x26\x70\xd0\x52\x90\xc5\xf8\x90\x08\x7c\x46\xab\x4d\x74\xce\x2c\x33\xc8\x25\xe6\xac\x64\xf5\x7e\x1d\x21\xd1\x63\x24\x60\x1d\xaa\xe0\x0d\x25\x03\xe0\x09\x77\x49\x14\xf9\x92\x7c\xd4\x44\x51\x02\x28\x1d\xc5\x38\x5f\x92\x63\x65\x8a\x55\xac\x0b\x79\x4a\x36\x19\x93\x42\xf6\x49\xa0\x14\xc8\xaa\xf8\xa2\x0b\x08\x81\x1e\x2b\x9c\x25\x89\x19\xad\x18\x0d\x12\xb4\x03\x07\xc6\x02\x61\xde\x25\x49\x26\x2b\x9b\x8d\x13\x9d\x59\x8b\xe1\xe4\x19\x58\x90\x9c\xcf\x51\xa5\x94\x23\x82\x66\x61\x29\x4e\x93\x5e\x02\xb2\x57\xa4\x75\xb1\xc9\xb2\x44\xb5\x22\x19\x1a\x8c\xe5\x7a\xde\xfc\xb8\x92\x91\x1e\x5b\x83\x8d\x34\xdd\xb7\xd5\x26\xb4\x7b\x53\x78\xbb\x1e\xbc\xbf\xa8\x6d\x46\x36\xf7\xa0\x61\xec\x7d\xbb\x16\xdc\x7f\xfc\x18\xfe\xdc\x79\x2d\x2f\x87\x7e\x7f\xbb\x8b\xb1\xd7\x6f\x03\xcb\xe6\xf9\x3f\xf8\xd9\xfa\x56\x31\x8c\x3c\x3c\x35\x9f\x70\xbf\xd5\x3d\xdf\xf6\x4d\xee\x8b\x79\x74\x42\x3f\x36\x61\xee\x26\x86\xe4\x9f\xfc\x3a\xf9\x3b\x00\x00\xff\xff\x43\xcf\xa9\x27\x8e\x13\x00\x00" func flowJsonBytes() ([]byte, error) { return bindataRead( @@ -484,7 +484,7 @@ func flowJson() (*asset, error) { } info := bindataFileInfo{name: "flow.json", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xae, 0x7c, 0xd5, 0x2a, 0xde, 0x1a, 0x3f, 0x48, 0x5c, 0x16, 0xb8, 0x30, 0x8c, 0x4f, 0xd5, 0x47, 0xbe, 0x26, 0xad, 0x46, 0x30, 0x52, 0x8d, 0x41, 0x28, 0xd9, 0x81, 0xa8, 0x54, 0xae, 0x1d, 0x96}} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x69, 0xf7, 0x17, 0xe, 0xb7, 0x4e, 0x77, 0x3a, 0xaf, 0x1a, 0x4f, 0x3, 0x6c, 0xd5, 0x27, 0xa6, 0xdc, 0x85, 0x39, 0x3c, 0x83, 0x28, 0x55, 0x5a, 0x3a, 0x8d, 0x34, 0xad, 0x95, 0x46, 0xf9, 0x94}} return a, nil } diff --git a/lib/go/iinft/scripts/templates/scripts/nft_catalog/get_collection_tokens.cdc b/lib/go/iinft/scripts/templates/scripts/nft_catalog/get_collection_tokens.cdc index ccd8093..1df82e0 100644 --- a/lib/go/iinft/scripts/templates/scripts/nft_catalog/get_collection_tokens.cdc +++ b/lib/go/iinft/scripts/templates/scripts/nft_catalog/get_collection_tokens.cdc @@ -1,14 +1,13 @@ {{ define "catalog_get_collection_tokens" }} import MetadataViews from {{.MetadataViews}} import NFTCatalog from {{.NFTCatalog}} -import NFTRetrieval from {{.NFTRetrieval}} -pub struct NFT { - pub let id: UInt64 - pub let name: String - pub let description: String - pub let thumbnail: String - pub let externalURL: String +access(all) struct NFT { + access(all) let id: UInt64 + access(all) let name: String + access(all) let description: String + access(all) let thumbnail: String + access(all) let externalURL: String init( id: UInt64, @@ -25,7 +24,7 @@ pub struct NFT { } } -pub fun main(ownerAddress: Address, collectionIdentifier: String): [NFT] { +access(all) fun main(ownerAddress: Address, collectionIdentifier: String): [NFT] { let account = getAuthAccount(ownerAddress) let value = NFTCatalog.getCatalogEntry(collectionIdentifier: collectionIdentifier)! @@ -33,18 +32,45 @@ pub fun main(ownerAddress: Address, collectionIdentifier: String): [NFT] { let tempPathStr = "catalog".concat(keyHash) let tempPublicPath = PublicPath(identifier: tempPathStr)! - account.link<&{MetadataViews.ResolverCollection}>( - tempPublicPath, - target: value.collectionData.storagePath - ) - let collectionCap = account.getCapability<&AnyResource{MetadataViews.ResolverCollection}>(tempPublicPath) if !collectionCap.check() { return [] } - let views = NFTRetrieval.getNFTViewsFromCap(collectionIdentifier: collectionIdentifier, collectionCap: collectionCap) + fun hasMultipleCollectionsFn(nftTypeIdentifier : String): Bool { + let typeCollections = NFTCatalog.getCollectionsForType(nftTypeIdentifier: nftTypeIdentifier)! + var numberOfCollections = 0 + for identifier in typeCollections.keys { + let existence = typeCollections[identifier]! + if existence { + numberOfCollections = numberOfCollections + 1 + } + if numberOfCollections > 1 { + return true + } + } + return false + } + + let views : [MetadataViews.NFTView] = [] + + // Check if we have multiple collections for the NFT type... + let hasMultipleCollections = self.hasMultipleCollections(nftTypeIdentifier : value.nftType.identifier) + + if collectionCap.check() { + let collectionRef = collectionCap.borrow()! + for id in collectionRef.getIDs() { + let nftResolver = collectionRef.borrowViewResolver(id: id) + let nftViews = MetadataViews.getNFTView(id: id, viewResolver: nftResolver!) + if !hasMultipleCollections { + views.append(nftViews) + } else if nftViews.display!.name == value.collectionDisplay.name { + views.append(nftViews) + } + + } + } let items: [NFT] = [] @@ -70,4 +96,4 @@ pub fun main(ownerAddress: Address, collectionIdentifier: String): [NFT] { return items } -{{ end }} \ No newline at end of file +{{ end }} diff --git a/lib/go/iinft/scripts/templates/scripts/nft_catalog/get_collections.cdc b/lib/go/iinft/scripts/templates/scripts/nft_catalog/get_collections.cdc index b3ff026..368bfa7 100644 --- a/lib/go/iinft/scripts/templates/scripts/nft_catalog/get_collections.cdc +++ b/lib/go/iinft/scripts/templates/scripts/nft_catalog/get_collections.cdc @@ -1,16 +1,16 @@ {{ define "catalog_get_collections" }} import MetadataViews from {{.MetadataViews}} import NFTCatalog from {{.NFTCatalog}} -import NFTRetrieval from {{.NFTRetrieval}} +import ViewResolver from {{.ViewResolver}} -pub struct NFTCollection { - pub let id: String - pub let name: String - pub let description: String - pub let squareImage: String - pub let bannerImage: String - pub let externalURL: String - pub let count: Number +access(all) struct NFTCollection { + access(all) let id: String + access(all) let name: String + access(all) let description: String + access(all) let squareImage: String + access(all) let bannerImage: String + access(all) let externalURL: String + access(all) let count: Number init( id: String, @@ -31,28 +31,50 @@ pub struct NFTCollection { } } -pub fun main(ownerAddress: Address): {String: NFTCollection} { - let account = getAuthAccount(ownerAddress) +access(all) fun main(ownerAddress: Address): {String: NFTCollection} { + let account = getAccount(ownerAddress) let collections: {String: NFTCollection} = {} + fun hasMultipleCollectionsFn(nftTypeIdentifier : String): Bool { + let typeCollections = NFTCatalog.getCollectionsForType(nftTypeIdentifier: nftTypeIdentifier)! + var numberOfCollections = 0 + for identifier in typeCollections.keys { + let existence = typeCollections[identifier]! + if existence { + numberOfCollections = numberOfCollections + 1 + } + if numberOfCollections > 1 { + return true + } + } + return false + } + NFTCatalog.forEachCatalogKey(fun (collectionIdentifier: String):Bool { let value = NFTCatalog.getCatalogEntry(collectionIdentifier: collectionIdentifier)! - let keyHash = String.encodeHex(HashAlgorithm.SHA3_256.hash(collectionIdentifier.utf8)) - let tempPathStr = "catalog".concat(keyHash) - let tempPublicPath = PublicPath(identifier: tempPathStr)! - account.link<&{MetadataViews.ResolverCollection}>( - tempPublicPath, - target: value.collectionData.storagePath - ) - - let collectionCap = account.getCapability<&AnyResource{MetadataViews.ResolverCollection}>(tempPublicPath) + let collectionCap = account.capabilities.get<&{ViewResolver.ResolverCollection}>(value.collectionData.publicPath) if !collectionCap.check() { return true } - let count = NFTRetrieval.getNFTCountFromCap(collectionIdentifier: collectionIdentifier, collectionCap: collectionCap) + // Check if we have multiple collections for the NFT type... + let hasMultipleCollections = hasMultipleCollectionsFn(nftTypeIdentifier : value.nftType.identifier) + + var count : UInt64 = 0 + let collectionRef = collectionCap.borrow()! + if !hasMultipleCollections { + count = UInt64(collectionRef.getIDs().length) + } else { + for id in collectionRef.getIDs() { + let nftResolver = collectionRef.borrowViewResolver(id: id) + let nftViews = MetadataViews.getNFTView(id: id, viewResolver: nftResolver!) + if nftViews.display!.name == value.collectionDisplay.name { + count = count + 1 + } + } + } if count != 0 { collections[collectionIdentifier] = NFTCollection( @@ -70,4 +92,4 @@ pub fun main(ownerAddress: Address): {String: NFTCollection} { return collections } -{{ end }} \ No newline at end of file +{{ end }} diff --git a/scripts/get_fusd_balance.cdc b/scripts/get_fusd_balance.cdc deleted file mode 100644 index 538696b..0000000 --- a/scripts/get_fusd_balance.cdc +++ /dev/null @@ -1,13 +0,0 @@ -import FungibleToken from "../contracts/standard/FungibleToken.cdc" -import FUSD from "../contracts/standard/FUSD.cdc" - -pub fun main(address: Address): UFix64 { - let account = getAccount(address) - - let vaultRef = account - .getCapability(/public/fusdBalance) - .borrow<&FUSD.Vault{FungibleToken.Balance}>() - ?? panic("Could not borrow Balance capability") - - return vaultRef.balance -} diff --git a/scripts/get_switchboard_vault_types.cdc b/scripts/get_switchboard_vault_types.cdc new file mode 100644 index 0000000..650045a --- /dev/null +++ b/scripts/get_switchboard_vault_types.cdc @@ -0,0 +1,14 @@ +import FungibleTokenSwitchboard from "../contracts/standard/FungibleTokenSwitchboard.cdc" +import FungibleToken from "../contracts/standard/FungibleToken.cdc" + +access(all) fun main(account: Address): [Type] { + let acct = getAccount(account) + // Get a reference to the switchboard conforming to FungibleToken.Receiver + let switchboardRef = acct.capabilities.borrow<&{FungibleToken.Receiver}>(FungibleTokenSwitchboard.ReceiverPublicPath) + + if switchboardRef == nil { + return [] + } + + return switchboardRef!.getSupportedVaultTypes().keys +} diff --git a/transactions/account_royalty_receiver_setup.cdc b/transactions/account_royalty_receiver_setup.cdc index 636bc17..ffe6153 100644 --- a/transactions/account_royalty_receiver_setup.cdc +++ b/transactions/account_royalty_receiver_setup.cdc @@ -1,93 +1,112 @@ import FungibleTokenSwitchboard from "../contracts/standard/FungibleTokenSwitchboard.cdc" import FungibleToken from "../contracts/standard/FungibleToken.cdc" +import FungibleTokenMetadataViews from "../contracts/standard/FungibleTokenMetadataViews.cdc" import FlowToken from "../contracts/standard/FlowToken.cdc" -import FUSD from "../contracts/standard/FUSD.cdc" import MetadataViews from "../contracts/standard/MetadataViews.cdc" -transaction { +transaction(extraTokenContractAddresses: [Address], extraTokenContractNames: [String]) { - let flowTokenVaultCapabilty: Capability<&{FungibleToken.Receiver}> - let fusdTokenVaultCapabilty: Capability<&{FungibleToken.Receiver}> - let switchboardRef: &FungibleTokenSwitchboard.Switchboard + let tokenVaultCapabilities: [Capability<&{FungibleToken.Receiver}>] + let switchboardRef: auth(FungibleTokenSwitchboard.Owner) &FungibleTokenSwitchboard.Switchboard - prepare(acct: AuthAccount) { - // Check if the account already has a Switchboard resource - if acct.borrow<&FungibleTokenSwitchboard.Switchboard> - (from: FungibleTokenSwitchboard.StoragePath) == nil { - - // Create a new Switchboard resource and put it into storage - acct.save( - <- FungibleTokenSwitchboard.createSwitchboard(), - to: FungibleTokenSwitchboard.StoragePath) - - // Create a public capability to the Switchboard exposing the deposit - // function through the {FungibleToken.Receiver} interface - acct.link<&FungibleTokenSwitchboard.Switchboard{FungibleToken.Receiver}>( - FungibleTokenSwitchboard.ReceiverPublicPath, - target: FungibleTokenSwitchboard.StoragePath - ) + prepare(signer: auth(BorrowValue, SaveValue, IssueStorageCapabilityController, PublishCapability, UnpublishCapability) &Account) { + assert(extraTokenContractAddresses.length == extraTokenContractNames.length, message: "lengths of extraTokenContractAddresses and extraTokenContractNames should be equal") - // Create a public capability to the Switchboard exposing both the - // deposit function and the getVaultCapabilities function through the - // {FungibleTokenSwitchboard.SwitchboardPublic} interface - acct.link<&FungibleTokenSwitchboard.Switchboard{FungibleTokenSwitchboard.SwitchboardPublic}>( - FungibleTokenSwitchboard.PublicPath, - target: FungibleTokenSwitchboard.StoragePath - ) + // Check if the account already has a Switchboard resource + if signer.storage.borrow<&FungibleTokenSwitchboard.Switchboard>(from: FungibleTokenSwitchboard.StoragePath) == nil { + // Create a new Switchboard and save it in storage + signer.storage.save(<-FungibleTokenSwitchboard.createSwitchboard(), to: FungibleTokenSwitchboard.StoragePath) + // Clear existing Capabilities at canonical paths + signer.capabilities.unpublish(FungibleTokenSwitchboard.ReceiverPublicPath) + signer.capabilities.unpublish(FungibleTokenSwitchboard.PublicPath) + // Issue Receiver & Switchboard Capabilities + let receiverCap = signer.capabilities.storage.issue<&{FungibleToken.Receiver}>( + FungibleTokenSwitchboard.StoragePath + ) + let switchboardPublicCap = signer.capabilities.storage.issue<&{FungibleTokenSwitchboard.SwitchboardPublic, FungibleToken.Receiver}>( + FungibleTokenSwitchboard.StoragePath + ) + // Publish Capabilities + signer.capabilities.publish(receiverCap, at: FungibleTokenSwitchboard.ReceiverPublicPath) + signer.capabilities.publish(switchboardPublicCap, at: FungibleTokenSwitchboard.PublicPath) } - // Get a reference to the signers switchboard - self.switchboardRef = acct.borrow<&FungibleTokenSwitchboard.Switchboard> - (from: FungibleTokenSwitchboard.StoragePath) + // Get a reference to the account's switchboard + self.switchboardRef = signer.storage.borrow( + from: FungibleTokenSwitchboard.StoragePath) ?? panic("Could not borrow reference to switchboard") - if acct.borrow<&FlowToken.Vault>(from: /storage/flowTokenVault) == nil { + if signer.storage.borrow<&FlowToken.Vault>(from: /storage/flowTokenVault) == nil { // Create a new flowToken Vault and put it in storage - acct.save(<-FlowToken.createEmptyVault(), to: /storage/flowTokenVault) + signer.storage.save(<-FlowToken.createEmptyVault(vaultType: Type<@FlowToken.Vault>()), to: /storage/flowTokenVault) // Create a public capability to the Vault that only exposes // the deposit function through the Receiver interface - acct.link<&FlowToken.Vault{FungibleToken.Receiver}>( - /public/flowTokenReceiver, - target: /storage/flowTokenVault + let vaultCap = signer.capabilities.storage.issue<&FlowToken.Vault>( + /storage/flowTokenVault + ) + + signer.capabilities.publish( + vaultCap, + at: /public/flowTokenReceiver ) // Create a public capability to the Vault that only exposes // the balance field through the Balance interface - acct.link<&FlowToken.Vault{FungibleToken.Balance}>( - /public/flowTokenBalance, - target: /storage/flowTokenVault + let balanceCap = signer.capabilities.storage.issue<&FlowToken.Vault>( + /storage/flowTokenVault + ) + + signer.capabilities.publish( + balanceCap, + at: /public/flowTokenBalance ) } - self.flowTokenVaultCapabilty = - acct.getCapability<&{FungibleToken.Receiver}>(/public/flowTokenReceiver) + self.tokenVaultCapabilities = [signer.capabilities.get<&{FungibleToken.Receiver}>(/public/flowTokenReceiver)] - if(acct.borrow<&FUSD.Vault>(from: /storage/fusdVault) == nil) { - // Create a new FUSD Vault and put it in storage - acct.save(<-FUSD.createEmptyVault(), to: /storage/fusdVault) + var i = 0 + for contractAddress in extraTokenContractAddresses { + let contractName = extraTokenContractNames[i] - // Create a public capability to the Vault that only exposes - // the deposit function through the Receiver interface - acct.link<&FUSD.Vault{FungibleToken.Receiver}>( - /public/fusdReceiver, - target: /storage/fusdVault - ) + // Borrow a reference to the vault stored on the passed account at the passed publicPath + let resolverRef = getAccount(contractAddress) + .contracts.borrow<&{FungibleToken}>(name: contractName) + ?? panic("Could not borrow FungibleToken reference to the contract. Make sure the provided contract name (" + .concat(contractName).concat(") and address (").concat(contractAddress.toString()).concat(") are correct!")) - // Create a public capability to the Vault that only exposes - // the balance field through the Balance interface - acct.link<&FUSD.Vault{FungibleToken.Balance}>( - /public/fusdBalance, - target: /storage/fusdVault - ) - } + // Use that reference to retrieve the FTView + let ftVaultData = resolverRef.resolveContractView(resourceType: nil, viewType: Type()) as! FungibleTokenMetadataViews.FTVaultData? + ?? panic("Could not resolve FTVaultData view. The ".concat(contractName) + .concat(" contract needs to implement the FTVaultData Metadata view in order to execute this transaction.")) + + if signer.storage.borrow<&{FungibleToken.Vault}>(from: ftVaultData.storagePath) == nil { + // Create a new empty vault using the createEmptyVault function inside the FTVaultData + let emptyVault <-ftVaultData.createEmptyVault() + + // Save it to the account + signer.storage.save(<-emptyVault, to: ftVaultData.storagePath) + + // Create a public capability for the vault which includes the .Resolver interface + let vaultCap = signer.capabilities.storage.issue<&{FungibleToken.Vault}>(ftVaultData.storagePath) + signer.capabilities.publish(vaultCap, at: ftVaultData.metadataPath) - self.fusdTokenVaultCapabilty = - acct.getCapability<&{FungibleToken.Receiver}>(/public/fusdReceiver) + // Create a public capability for the vault exposing the receiver interface + let receiverCap = signer.capabilities.storage.issue<&{FungibleToken.Receiver}>(ftVaultData.storagePath) + signer.capabilities.publish(receiverCap, at: ftVaultData.receiverPath) + } + + let cap = signer.capabilities.get<&{FungibleToken.Receiver}>(ftVaultData.receiverPath) + self.tokenVaultCapabilities.append(cap) + + i = i + 1 + } } execute { - self.switchboardRef.addNewVault(capability: self.flowTokenVaultCapabilty) - self.switchboardRef.addNewVault(capability: self.fusdTokenVaultCapabilty) + for cap in self.tokenVaultCapabilities { + self.switchboardRef.addNewVault(capability: cap) + } + } } diff --git a/transactions/account_setup_fusd.cdc b/transactions/account_setup_fusd.cdc deleted file mode 100644 index 08c2a38..0000000 --- a/transactions/account_setup_fusd.cdc +++ /dev/null @@ -1,32 +0,0 @@ -// This transaction configures the signer's account with an empty FUSD vault. - -import FungibleToken from "../contracts/standard/FungibleToken.cdc" -import FUSD from "../contracts/standard/FUSD.cdc" - -transaction { - - prepare(signer: AuthAccount) { - - // It's OK if the account already has a Vault, but we don't want to replace it - if(signer.borrow<&FUSD.Vault>(from: /storage/fusdVault) != nil) { - return - } - - // Create a new FUSD Vault and put it in storage - signer.save(<-FUSD.createEmptyVault(), to: /storage/fusdVault) - - // Create a public capability to the Vault that only exposes - // the deposit function through the Receiver interface - signer.link<&FUSD.Vault{FungibleToken.Receiver}>( - /public/fusdReceiver, - target: /storage/fusdVault - ) - - // Create a public capability to the Vault that only exposes - // the balance field through the Balance interface - signer.link<&FUSD.Vault{FungibleToken.Balance}>( - /public/fusdBalance, - target: /storage/fusdVault - ) - } -} diff --git a/transactions/account_switchboard_setup.cdc b/transactions/account_switchboard_setup.cdc index e326eb8..9c2890e 100644 --- a/transactions/account_switchboard_setup.cdc +++ b/transactions/account_switchboard_setup.cdc @@ -4,31 +4,24 @@ import MetadataViews from "../contracts/standard/MetadataViews.cdc" transaction { - prepare(acct: AuthAccount) { + prepare(signer: auth(BorrowValue, SaveValue, IssueStorageCapabilityController, PublishCapability, UnpublishCapability) &Account) { // Check if the account already has a Switchboard resource - if acct.borrow<&FungibleTokenSwitchboard.Switchboard> - (from: FungibleTokenSwitchboard.StoragePath) == nil { - - // Create a new Switchboard resource and put it into storage - acct.save( - <- FungibleTokenSwitchboard.createSwitchboard(), - to: FungibleTokenSwitchboard.StoragePath) - - // Create a public capability to the Switchboard exposing the deposit - // function through the {FungibleToken.Receiver} interface - acct.link<&FungibleTokenSwitchboard.Switchboard{FungibleToken.Receiver}>( - FungibleTokenSwitchboard.ReceiverPublicPath, - target: FungibleTokenSwitchboard.StoragePath - ) - - // Create a public capability to the Switchboard exposing both the - // deposit function and the getVaultCapabilities function through the - // {FungibleTokenSwitchboard.SwitchboardPublic} interface - acct.link<&FungibleTokenSwitchboard.Switchboard{FungibleTokenSwitchboard.SwitchboardPublic}>( - FungibleTokenSwitchboard.PublicPath, - target: FungibleTokenSwitchboard.StoragePath - ) + if signer.storage.borrow<&FungibleTokenSwitchboard.Switchboard>(from: FungibleTokenSwitchboard.StoragePath) == nil { + // Create a new Switchboard and save it in storage + signer.storage.save(<-FungibleTokenSwitchboard.createSwitchboard(), to: FungibleTokenSwitchboard.StoragePath) + // Clear existing Capabilities at canonical paths + signer.capabilities.unpublish(FungibleTokenSwitchboard.ReceiverPublicPath) + signer.capabilities.unpublish(FungibleTokenSwitchboard.PublicPath) + // Issue Receiver & Switchboard Capabilities + let receiverCap = signer.capabilities.storage.issue<&{FungibleToken.Receiver}>( + FungibleTokenSwitchboard.StoragePath + ) + let switchboardPublicCap = signer.capabilities.storage.issue<&{FungibleTokenSwitchboard.SwitchboardPublic, FungibleToken.Receiver}>( + FungibleTokenSwitchboard.StoragePath + ) + // Publish Capabilities + signer.capabilities.publish(receiverCap, at: FungibleTokenSwitchboard.ReceiverPublicPath) + signer.capabilities.publish(switchboardPublicCap, at: FungibleTokenSwitchboard.PublicPath) } - } } diff --git a/transactions/transfer_flow_tokens.cdc b/transactions/transfer_flow_tokens.cdc index 06a5df8..e9850ed 100644 --- a/transactions/transfer_flow_tokens.cdc +++ b/transactions/transfer_flow_tokens.cdc @@ -1,16 +1,18 @@ -import "../contracts/standard/FungibleToken.cdc" -import "../contracts/standard/FlowToken.cdc" +import FungibleToken from "../contracts/standard/FungibleToken.cdc" +import FlowToken from "../contracts/standard/FlowToken.cdc" transaction(amount: UFix64, to: Address) { // The Vault resource that holds the tokens that are being transferred - let sentVault: @FungibleToken.Vault + let sentVault: @{FungibleToken.Vault} - prepare(signer: AuthAccount) { + prepare(signer: auth(BorrowValue) &Account) { // Get a reference to the signer's stored vault - let vaultRef = signer.borrow<&FlowToken.Vault>(from: /storage/flowTokenVault) - ?? panic("Could not borrow reference to the owner's Vault!") + let vaultRef = signer.storage.borrow(from: /storage/flowTokenVault) + ?? panic("The signer does not store a FlowToken Vault object at the path " + .concat("/storage/flowTokenVault. ") + .concat("The signer must initialize their account with this vault first!")) // Withdraw tokens from the signer's stored vault self.sentVault <- vaultRef.withdraw(amount: amount) @@ -20,11 +22,13 @@ transaction(amount: UFix64, to: Address) { // Get a reference to the recipient's Receiver let receiverRef = getAccount(to) - .getCapability(/public/flowTokenReceiver) - .borrow<&{FungibleToken.Receiver}>() - ?? panic("Could not borrow receiver reference to the recipient's Vault") + .capabilities.borrow<&{FungibleToken.Receiver}>(/public/flowTokenReceiver) + ?? panic("Could not borrow a Receiver reference to the FlowToken Vault in account " + .concat(to.toString()).concat(" at path /public/flowTokenReceiver") + .concat(". Make sure you are sending to an address that has ") + .concat("a FlowToken Vault set up properly at the specified path.")) // Deposit the withdrawn tokens in the recipient's receiver receiverRef.deposit(from: <-self.sentVault) } -} \ No newline at end of file +}