diff --git a/contracts/utilityContracts/PrivateReceiverForwarder.cdc b/contracts/utilityContracts/PrivateReceiverForwarder.cdc new file mode 100644 index 00000000..a82c1de1 --- /dev/null +++ b/contracts/utilityContracts/PrivateReceiverForwarder.cdc @@ -0,0 +1,82 @@ +/* + +# Fungible Token Private Receiver Contract + +This contract implements a special resource and receiver interface +whose deposit function is only callable by an admin through a public capability. + +*/ + +import FungibleToken from 0xFUNGIBLETOKENADDRESS + +pub contract PrivateReceiverForwarder { + + // Event that is emitted when tokens are deposited to the target receiver + pub event PrivateDeposit(amount: UFix64, to: Address?) + + pub let SenderStoragePath: StoragePath + + pub let PrivateReceiverStoragePath: StoragePath + pub let PrivateReceiverPublicPath: PublicPath + + pub resource Forwarder { + + // This is where the deposited tokens will be sent. + // The type indicates that it is a reference to a receiver + // + access(self) var recipient: Capability<&{FungibleToken.Receiver}> + + // deposit + // + // Function that takes a Vault object as an argument and forwards + // it to the recipient's Vault using the stored reference + // + access(contract) fun deposit(from: @FungibleToken.Vault) { + let receiverRef = self.recipient.borrow()! + + let balance = from.balance + + receiverRef.deposit(from: <-from) + + emit PrivateDeposit(amount: balance, to: self.owner?.address) + } + + init(recipient: Capability<&{FungibleToken.Receiver}>) { + pre { + recipient.borrow() != nil: "Could not borrow Receiver reference from the Capability" + } + self.recipient = recipient + } + } + + // createNewForwarder creates a new Forwarder reference with the provided recipient + // + pub fun createNewForwarder(recipient: Capability<&{FungibleToken.Receiver}>): @Forwarder { + return <-create Forwarder(recipient: recipient) + } + + + pub resource Sender { + pub fun sendPrivateTokens(_ address: Address, tokens: @FungibleToken.Vault) { + + let account = getAccount(address) + + let privateReceiver = account.getCapability<&PrivateReceiverForwarder.Forwarder>(PrivateReceiverForwarder.PrivateReceiverPublicPath) + .borrow() ?? panic("Could not borrow reference to private forwarder") + + privateReceiver.deposit(from: <-tokens) + + } + } + + init(senderPath: StoragePath, storagePath: StoragePath, publicPath: PublicPath) { + + self.SenderStoragePath = senderPath + + self.PrivateReceiverStoragePath = storagePath + self.PrivateReceiverPublicPath = publicPath + + self.account.save(<-create Sender(), to: self.SenderStoragePath) + + } +} \ No newline at end of file diff --git a/contracts/TokenForwarding.cdc b/contracts/utilityContracts/TokenForwarding.cdc similarity index 100% rename from contracts/TokenForwarding.cdc rename to contracts/utilityContracts/TokenForwarding.cdc diff --git a/lib/go/contracts/contracts.go b/lib/go/contracts/contracts.go index f9f816ef..54d58935 100644 --- a/lib/go/contracts/contracts.go +++ b/lib/go/contracts/contracts.go @@ -1,6 +1,6 @@ package contracts -//go:generate go run github.com/kevinburke/go-bindata/go-bindata -prefix ../../../contracts -o internal/assets/assets.go -pkg assets -nometadata -nomemcopy ../../../contracts +//go:generate go run github.com/kevinburke/go-bindata/go-bindata -prefix ../../../contracts -o internal/assets/assets.go -pkg assets -nometadata -nomemcopy ../../../contracts/... import ( "strings" @@ -9,11 +9,12 @@ import ( ) const ( - fungibleTokenFilename = "FungibleToken.cdc" - flowTokenFilename = "FlowToken.cdc" - exampleTokenFilename = "ExampleToken.cdc" - defaultFungibleTokenAddress = "FUNGIBLETOKENADDRESS" - tokenForwardingFilename = "TokenForwarding.cdc" + fungibleTokenFilename = "FungibleToken.cdc" + flowTokenFilename = "FlowToken.cdc" + exampleTokenFilename = "ExampleToken.cdc" + defaultFungibleTokenAddress = "FUNGIBLETOKENADDRESS" + tokenForwardingFilename = "utilityContracts/TokenForwarding.cdc" + privateReceiverForwarderFilename = "utilityContracts/PrivateReceiverForwarder.cdc" ) // FungibleToken returns the FungibleToken contract interface. @@ -110,3 +111,15 @@ func CustomTokenForwarding(fungibleTokenAddr, tokenName, storageName string) []b return []byte(code) } + +func PrivateReceiverForwarder(fungibleTokenAddr string) []byte { + code := assets.MustAssetString(privateReceiverForwarderFilename) + + code = strings.ReplaceAll( + code, + "0x"+defaultFungibleTokenAddress, + "0x"+fungibleTokenAddr, + ) + + return []byte(code) +} diff --git a/lib/go/contracts/internal/assets/assets.go b/lib/go/contracts/internal/assets/assets.go index f1f4d032..d99d019e 100644 --- a/lib/go/contracts/internal/assets/assets.go +++ b/lib/go/contracts/internal/assets/assets.go @@ -2,7 +2,8 @@ // sources: // ../../../contracts/ExampleToken.cdc (7.43kB) // ../../../contracts/FungibleToken.cdc (6.984kB) -// ../../../contracts/TokenForwarding.cdc (2.351kB) +// ../../../contracts/utilityContracts/PrivateReceiverForwarder.cdc (2.599kB) +// ../../../contracts/utilityContracts/TokenForwarding.cdc (2.351kB) package assets @@ -112,22 +113,42 @@ func fungibletokenCdc() (*asset, error) { return a, nil } -var _tokenforwardingCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x55\x4d\x6f\xe3\x36\x14\xbc\xf3\x57\xcc\x6e\x81\xae\x1d\x64\xe5\x1e\x8a\x1e\x82\xa4\xdb\x6d\x3e\x8a\xa2\x45\x0a\x78\xb3\xed\xb1\xa0\xa9\x27\x8b\x1b\x99\x14\xc8\x27\x6b\x83\xc0\xff\xbd\x20\x25\xd1\x52\xa2\x14\xe9\xa5\xb9\xc4\x14\xf8\xe6\xcd\xbc\x19\x92\xab\x93\x13\x21\xbe\xc1\x4d\x63\xb6\x7a\x53\x11\xee\xec\x3d\x19\xdc\x58\xd7\x4a\x97\x6b\xb3\xc5\xa5\x35\xec\xa4\x62\x21\xee\x4a\xed\xa1\xfa\x25\x7c\x69\x5b\x8f\xd2\xb6\x90\x06\x52\x29\xdb\x18\x86\xb2\x4d\x95\xc3\x13\xa3\xa9\x21\xa1\x1a\xcf\x76\x97\xc0\x3b\xec\x35\x29\xd2\x7b\x72\x82\x2d\x64\x55\xd9\x16\x5c\xd2\x0e\x6c\x51\x74\x5d\xc1\x61\x9f\x0f\x5f\x24\x72\x5d\x14\xe4\xc8\x70\xea\xd1\x96\x64\x68\x4f\x2e\x94\x3d\xc0\x75\x68\x7d\x4d\x16\x58\xd2\x03\x94\x34\xa8\x9b\x4d\xa5\x7d\x09\x0e\xb4\x7b\x41\xe4\xe0\xc8\xdb\xc6\x29\x82\xf4\x90\x89\x0c\x94\xac\xe5\x46\x57\x9a\x1f\xf0\xa5\xf1\x8c\x4a\xdf\x13\x24\xfe\x94\x4d\xc5\xa7\x42\x9a\x3c\xb4\x83\x27\x13\x30\x72\x4b\xde\xbc\x63\xd0\x9e\x0c\x0c\x51\xa0\x8c\x7b\x63\x5b\x68\x86\xf6\x47\xd2\x99\x10\x7f\x95\x64\xc6\x23\x6a\xa5\xe1\xa8\x4d\x39\x92\x1c\x7a\x24\x6e\xa7\x9d\x24\x25\xab\x2a\x76\xeb\x76\xdc\x52\x9b\x76\x88\xa2\x31\x8a\xb5\x0d\x88\x39\x6a\x67\xf7\x3a\xa7\xd0\xb4\xd5\x5c\xc6\x9a\x24\xc8\x51\xa4\xa0\x08\x5c\x4a\xee\x90\x43\xef\xd1\xa0\x05\x97\xa4\xdd\x71\xdc\x99\x10\x27\x2b\x21\xf4\xae\xb6\x8e\x9f\xb8\x56\x38\xbb\xc3\x77\x5f\x6f\x3e\xdf\xfe\xf2\xeb\xcf\xbf\x5f\xdf\xfd\xf1\xdb\xf5\xed\xc7\xab\xab\xf5\xf5\xa7\x4f\x42\xd4\xcd\xe6\x18\x8c\xb8\x7f\x14\xa0\x47\x21\x00\x60\xb5\xc2\xf5\x3e\xf8\x18\xe9\x68\x0f\xda\x69\x66\xca\xa3\x9f\x03\x07\xe9\x08\x39\xd5\xd6\x6b\xee\x86\x1a\x24\xb1\x74\x5b\xe2\xc1\x69\x17\xd1\x42\x47\x8a\x70\xc3\x6c\xf2\xab\xae\x6e\x21\x77\x61\xce\x67\xf8\x7c\xa3\xbf\xfe\xf0\xfd\x69\x64\x7e\x86\x8f\x79\xee\xc8\xfb\x0f\x4b\x91\xea\x53\x12\xd2\x78\xcf\xa6\xa2\xb3\x34\xcc\x5e\x43\xaf\x23\x1e\x04\xed\x03\x73\x47\x91\xe2\x98\x73\x14\xd2\xea\xaa\xc2\x26\x06\x86\xb3\x69\x2d\x81\x1f\x6a\x82\x36\xb9\x56\x92\xc9\xf7\x03\x89\x33\x91\x63\xdb\x6c\x5c\x8e\x44\x77\x10\xe9\xa7\x54\x8a\xbc\x5f\x78\xaa\x8a\x25\xf6\x32\x58\xae\x74\xad\x29\x88\xbf\x4c\x71\x9e\x30\xef\x79\xce\xa1\xad\x56\x41\x7c\x17\xae\x2e\x31\xf2\x9e\xfc\x70\x04\x60\x37\x5f\x48\x71\x3c\x34\x06\xd2\x6d\x9b\x5d\x3c\x93\x26\x1f\xc2\xe4\xc7\x48\x9a\x07\xf3\x12\xa7\x77\xbe\x47\x6a\x7c\x48\x45\x3c\x4d\x6c\x1d\xe5\x47\xc9\x73\xb4\x82\x51\x45\x63\x06\xe6\x8b\xce\xcd\x9f\xa6\x3e\x45\xe0\x25\x1e\x53\x55\xf8\xab\x46\x99\x59\x53\x81\x0b\x84\x49\x65\x89\x50\xb6\xb1\xce\xd9\xf6\xfc\xdb\xc7\x79\xd3\x0f\x3f\x2e\x96\x6f\xc4\x33\xc8\x8d\xac\x64\xb0\xe7\x22\x06\x2b\xeb\x97\xd3\x7d\xa3\xb6\xd9\x94\xf8\xf9\xfb\xf0\x7f\x39\xdd\x1e\x4e\xc2\xcb\x39\xee\x3b\x0c\x41\x8e\x22\x6c\x6b\xc8\x7d\xc8\x64\x17\xea\x65\x42\x3b\x4c\xdc\x56\xa5\x34\x5b\x5a\x0f\x82\xfb\xb5\x9f\xfa\x02\x5b\xc4\x0f\x45\xba\x21\x7b\xe7\xfa\xdb\x25\x3f\x6e\xfd\x37\x7f\x9e\xf4\x5a\xfc\x0d\x43\xed\x7a\x2e\x90\x4f\x7d\xaa\x1d\x3d\xf9\x12\xfe\xc6\xd5\xaf\x71\x0a\x6f\x2e\x60\x74\x75\x86\xb7\x97\xf1\x0d\x32\x96\xd1\x95\xcd\x5d\x89\xf1\x36\x0b\x22\x8f\xb4\xde\x4e\x28\x1c\x26\xab\x69\x70\x70\x31\x61\x37\x37\x7c\x6d\x34\x2f\x66\x8f\xe3\xeb\xd4\xff\xa7\x90\xfe\xbf\xd2\x9f\xa7\xa1\x2b\x38\xa4\x6b\xfe\xf9\xb3\xd5\x7f\x0a\xb7\x89\xa1\x76\xf2\x18\x0f\xb4\xd2\x03\xf6\x42\xec\xfa\xc8\xa5\xb8\x3d\xeb\xf1\xc2\xb8\xc3\x5d\x91\xda\x1d\x07\xed\x88\x1b\x67\x70\xfe\xbe\x7f\x85\x67\x61\xd2\xcf\x65\xaf\xf0\x20\xfe\x09\x00\x00\xff\xff\x4f\xb2\xa7\xb0\x2f\x09\x00\x00" +var _utilitycontractsPrivatereceiverforwarderCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x94\x56\x4d\x6f\xe3\x36\x10\xbd\xeb\x57\xcc\xa6\x40\x2b\x2d\xb2\x72\x0f\x45\x0f\x46\xbc\x69\x9a\x8f\xa2\x68\x91\x06\x49\xb6\xd7\x62\x44\x8d\x2d\x76\x65\x52\x20\x47\xd6\x06\x81\xff\xfb\x82\xd4\x27\xa5\x78\x81\xcd\x25\x92\xcd\x99\x79\xef\xcd\x9b\xa1\x57\xef\xa3\xe8\x07\xb8\xab\xd5\x4e\x66\x25\xc1\xb3\xfe\x4c\x0a\x1e\x8c\x3c\x20\x13\x3c\x92\x20\x79\x20\x03\xd7\x5a\xb1\x41\xc1\x51\xf4\x5c\x48\x0b\xa2\x7b\x05\xb9\xaf\x4a\xda\x93\x62\x0b\x08\xb6\x22\x21\xb1\x04\x43\x56\xd7\x46\x10\xa0\xca\xc1\xf4\x29\xa4\x62\x32\x5b\x14\x04\x51\x53\x68\x4b\x90\x53\xa5\xad\x64\xd8\xd6\x4a\xb0\xd4\x0a\xa4\x05\xad\xca\x17\x10\x58\x96\xe8\xc0\x64\x2f\x80\x0a\x30\xdf\x4b\x05\x5c\x18\x5d\xef\x0a\x40\xa8\xea\xac\x94\x02\x04\x56\x98\xc9\x52\xf2\x4b\x1a\x45\xef\x57\x51\x24\xf7\x95\x36\x3c\x50\x69\x99\x6c\x8d\xde\xc3\xcf\x5f\xee\x3e\xdd\xff\xf1\xe7\xef\x7f\xdf\x3e\xff\xf3\xd7\xed\xfd\xd5\xcd\xcd\xe3\xed\xd3\x53\x14\x55\x75\x36\x52\xe9\x38\xf7\x94\xef\xb4\x69\xd0\xe4\x64\xe0\x35\x8a\x00\x00\x56\x2b\xb8\x3d\x90\x62\xe0\x02\xd9\x61\xa5\xbd\x64\xa6\x1c\x9a\x82\x14\xb0\xab\x66\x01\xcd\xc0\x8b\x72\x60\x0d\x5c\x10\x30\x9a\x1d\xf1\xa0\x84\xcf\xe6\x4a\x93\x4f\xd7\xd5\xbd\x69\xa3\x62\xdc\xeb\x5a\xf1\x1a\x3e\xdd\xc9\x2f\xbf\xfe\x72\x0e\xac\xd7\x70\x95\xe7\x86\xac\xbd\x4c\xa2\x21\xb6\x24\x86\x27\x52\x39\x99\x27\xd6\x06\x77\xf4\x80\x5c\xac\x61\xf2\x12\x9e\x9d\xb1\x3b\x19\xf4\x8d\x98\x07\xaf\x7b\x1b\x32\x3e\x8f\x65\x86\xb6\x2f\xa4\xeb\xe4\xf3\xd6\x91\xd6\x09\x66\xc8\x2b\x33\x95\xca\xeb\xd7\xc8\xb2\x84\x8c\xc0\x92\xe2\x34\x8c\x25\xe0\x97\x8a\x40\xaa\x5c\x0a\x64\xb2\x5d\x1f\x7c\x2b\x10\x0c\x6d\xc9\x90\x12\xe4\x44\xc7\x50\xeb\x36\xc5\xf0\x88\x42\x90\xb5\xb1\xa5\x72\x9b\xc0\x01\x8d\x3b\x2c\x2b\x49\x4e\xf5\xeb\xc1\x54\x17\x3f\xbe\x06\x4e\x4a\x7b\x19\x8e\x1f\x03\x52\x1d\x85\xb7\x0a\xad\x56\xce\x8c\xad\xb7\x3d\x58\xc6\xcf\xe4\xc0\xfe\x8b\x75\xc9\xa0\xb3\xff\x49\x30\xa0\xf5\x26\x37\xbb\xda\xcd\x91\x9f\x99\x6d\x2b\xa0\x9d\x66\x92\xdc\xdb\x69\x80\xfb\x93\xed\x32\xd5\x56\xaa\x9d\xff\xce\xb2\x36\x94\x8f\x6a\x7c\x83\x7f\x6f\xfc\xc4\x0d\x60\x4f\x23\x76\xf3\xb2\x86\xdf\x42\xea\xbe\x4a\x02\xaf\x43\x0a\xf7\x57\x4e\x2c\xfd\x48\x5b\xd8\x80\x53\x34\x1d\xd0\xa5\x99\x36\x46\x37\x71\xf2\x2e\x5a\xc4\x65\x58\xa2\xeb\xd5\xc6\xcf\x67\xda\xbd\x86\xe7\x26\xb9\xd3\x10\xdd\xc5\x07\xf7\x3f\x09\x8f\xbb\x69\x3c\x35\x4b\x5d\xfe\x76\x98\x3c\x4a\xdd\x28\x32\x97\x29\xb6\x83\x95\x0c\x99\x8e\x63\x52\xa9\x24\xc7\xdf\x6b\x8d\xb9\x48\x95\xa1\xd9\x27\x1d\xb5\x99\x46\xf0\x6e\x03\x4a\x96\x6b\x38\xbb\xd6\x75\x99\x83\xd2\x0c\xed\x77\xe3\x0e\x1e\x2d\xee\x97\x9a\x6b\xf7\x88\xe9\x2c\x28\x72\x0c\xde\xc2\xbe\xc0\x66\xac\x1f\x85\x01\xc7\x61\xd3\x09\x43\xc8\x74\x4f\xcd\x38\xcb\xed\x47\xce\xbe\x8a\x9a\xc9\x8c\x8f\xb0\x1a\xc9\x85\x87\x55\x19\x7d\x90\xb9\xf7\xe1\xb4\x50\xe7\x41\xb7\x2b\x9c\xe5\x96\x35\xbe\x5f\x6e\x67\xd5\xc9\xb6\x19\x05\xe6\xda\x28\xb8\xf8\xd0\xd6\x80\x37\x2b\x0c\x8f\x49\x4f\x7e\xb9\xca\xda\x15\x3b\xc9\xdc\x83\xb7\xa4\xf2\xce\x6d\x1e\x94\x8d\xff\x83\xce\x4d\xc3\xbe\x3e\xef\xb6\xda\xe9\x79\x5a\x0c\x06\x0a\xe1\x2c\x0b\x1b\xd8\x11\x5f\xb5\x2f\xf1\xe0\xd2\xc5\xf1\x2a\xdc\xd0\xb0\xe9\x13\xa4\x3b\xe2\xa9\x82\xa7\x2e\xb7\x74\x78\xfa\x18\x9f\x3c\x73\xf2\x1e\x48\x16\xce\x1e\x0d\x7d\x79\x09\x15\x2a\x29\xe2\xa5\xa3\x83\x5d\xdd\x51\xe8\x77\x1e\x99\xb3\x19\xcf\x19\xc7\xc5\x2e\x68\x35\x0e\xa1\xbc\xed\x6b\x3f\xd1\xd6\x77\x74\x71\xf1\x9d\xfb\xd5\xf9\xd6\x95\x78\xde\xfd\xe0\x98\x5f\x7c\x41\xff\xfc\x88\x2d\xee\x63\xbf\x13\xfb\x72\xb3\xc3\xa7\x2f\x64\x17\x35\xbb\x91\x4f\x45\x8d\x68\x60\x33\x81\x39\x2b\xd5\x7b\xc2\xe2\x81\xe2\x61\x26\x5a\xb4\x71\x32\xd9\x8a\x0b\x02\x5d\x2b\x8e\xd1\xf1\x6b\x00\x00\x00\xff\xff\xd3\xf5\x5a\x30\x27\x0a\x00\x00" -func tokenforwardingCdcBytes() ([]byte, error) { +func utilitycontractsPrivatereceiverforwarderCdcBytes() ([]byte, error) { return bindataRead( - _tokenforwardingCdc, - "TokenForwarding.cdc", + _utilitycontractsPrivatereceiverforwarderCdc, + "utilityContracts/PrivateReceiverForwarder.cdc", ) } -func tokenforwardingCdc() (*asset, error) { - bytes, err := tokenforwardingCdcBytes() +func utilitycontractsPrivatereceiverforwarderCdc() (*asset, error) { + bytes, err := utilitycontractsPrivatereceiverforwarderCdcBytes() if err != nil { return nil, err } - info := bindataFileInfo{name: "TokenForwarding.cdc", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + info := bindataFileInfo{name: "utilityContracts/PrivateReceiverForwarder.cdc", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x5a, 0xf6, 0x87, 0xb8, 0xb7, 0x62, 0xda, 0x3a, 0xb2, 0xce, 0xcb, 0x5a, 0xf4, 0x51, 0x72, 0x10, 0x1, 0x88, 0x20, 0x44, 0x82, 0xe7, 0x1, 0xd7, 0x39, 0xf4, 0xbe, 0x89, 0xff, 0x9a, 0xcf, 0x31}} + return a, nil +} + +var _utilitycontractsTokenforwardingCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x55\x4d\x6f\xe3\x36\x14\xbc\xf3\x57\xcc\x6e\x81\xae\x1d\x64\xe5\x1e\x8a\x1e\x82\xa4\xdb\x6d\x3e\x8a\xa2\x45\x0a\x78\xb3\xed\xb1\xa0\xa9\x27\x8b\x1b\x99\x14\xc8\x27\x6b\x83\xc0\xff\xbd\x20\x25\xd1\x52\xa2\x14\xe9\xa5\xb9\xc4\x14\xf8\xe6\xcd\xbc\x19\x92\xab\x93\x13\x21\xbe\xc1\x4d\x63\xb6\x7a\x53\x11\xee\xec\x3d\x19\xdc\x58\xd7\x4a\x97\x6b\xb3\xc5\xa5\x35\xec\xa4\x62\x21\xee\x4a\xed\xa1\xfa\x25\x7c\x69\x5b\x8f\xd2\xb6\x90\x06\x52\x29\xdb\x18\x86\xb2\x4d\x95\xc3\x13\xa3\xa9\x21\xa1\x1a\xcf\x76\x97\xc0\x3b\xec\x35\x29\xd2\x7b\x72\x82\x2d\x64\x55\xd9\x16\x5c\xd2\x0e\x6c\x51\x74\x5d\xc1\x61\x9f\x0f\x5f\x24\x72\x5d\x14\xe4\xc8\x70\xea\xd1\x96\x64\x68\x4f\x2e\x94\x3d\xc0\x75\x68\x7d\x4d\x16\x58\xd2\x03\x94\x34\xa8\x9b\x4d\xa5\x7d\x09\x0e\xb4\x7b\x41\xe4\xe0\xc8\xdb\xc6\x29\x82\xf4\x90\x89\x0c\x94\xac\xe5\x46\x57\x9a\x1f\xf0\xa5\xf1\x8c\x4a\xdf\x13\x24\xfe\x94\x4d\xc5\xa7\x42\x9a\x3c\xb4\x83\x27\x13\x30\x72\x4b\xde\xbc\x63\xd0\x9e\x0c\x0c\x51\xa0\x8c\x7b\x63\x5b\x68\x86\xf6\x47\xd2\x99\x10\x7f\x95\x64\xc6\x23\x6a\xa5\xe1\xa8\x4d\x39\x92\x1c\x7a\x24\x6e\xa7\x9d\x24\x25\xab\x2a\x76\xeb\x76\xdc\x52\x9b\x76\x88\xa2\x31\x8a\xb5\x0d\x88\x39\x6a\x67\xf7\x3a\xa7\xd0\xb4\xd5\x5c\xc6\x9a\x24\xc8\x51\xa4\xa0\x08\x5c\x4a\xee\x90\x43\xef\xd1\xa0\x05\x97\xa4\xdd\x71\xdc\x99\x10\x27\x2b\x21\xf4\xae\xb6\x8e\x9f\xb8\x56\x38\xbb\xc3\x77\x5f\x6f\x3e\xdf\xfe\xf2\xeb\xcf\xbf\x5f\xdf\xfd\xf1\xdb\xf5\xed\xc7\xab\xab\xf5\xf5\xa7\x4f\x42\xd4\xcd\xe6\x18\x8c\xb8\x7f\x14\xa0\x47\x21\x00\x60\xb5\xc2\xf5\x3e\xf8\x18\xe9\x68\x0f\xda\x69\x66\xca\xa3\x9f\x03\x07\xe9\x08\x39\xd5\xd6\x6b\xee\x86\x1a\x24\xb1\x74\x5b\xe2\xc1\x69\x17\xd1\x42\x47\x8a\x70\xc3\x6c\xf2\xab\xae\x6e\x21\x77\x61\xce\x67\xf8\x7c\xa3\xbf\xfe\xf0\xfd\x69\x64\x7e\x86\x8f\x79\xee\xc8\xfb\x0f\x4b\x91\xea\x53\x12\xd2\x78\xcf\xa6\xa2\xb3\x34\xcc\x5e\x43\xaf\x23\x1e\x04\xed\x03\x73\x47\x91\xe2\x98\x73\x14\xd2\xea\xaa\xc2\x26\x06\x86\xb3\x69\x2d\x81\x1f\x6a\x82\x36\xb9\x56\x92\xc9\xf7\x03\x89\x33\x91\x63\xdb\x6c\x5c\x8e\x44\x77\x10\xe9\xa7\x54\x8a\xbc\x5f\x78\xaa\x8a\x25\xf6\x32\x58\xae\x74\xad\x29\x88\xbf\x4c\x71\x9e\x30\xef\x79\xce\xa1\xad\x56\x41\x7c\x17\xae\x2e\x31\xf2\x9e\xfc\x70\x04\x60\x37\x5f\x48\x71\x3c\x34\x06\xd2\x6d\x9b\x5d\x3c\x93\x26\x1f\xc2\xe4\xc7\x48\x9a\x07\xf3\x12\xa7\x77\xbe\x47\x6a\x7c\x48\x45\x3c\x4d\x6c\x1d\xe5\x47\xc9\x73\xb4\x82\x51\x45\x63\x06\xe6\x8b\xce\xcd\x9f\xa6\x3e\x45\xe0\x25\x1e\x53\x55\xf8\xab\x46\x99\x59\x53\x81\x0b\x84\x49\x65\x89\x50\xb6\xb1\xce\xd9\xf6\xfc\xdb\xc7\x79\xd3\x0f\x3f\x2e\x96\x6f\xc4\x33\xc8\x8d\xac\x64\xb0\xe7\x22\x06\x2b\xeb\x97\xd3\x7d\xa3\xb6\xd9\x94\xf8\xf9\xfb\xf0\x7f\x39\xdd\x1e\x4e\xc2\xcb\x39\xee\x3b\x0c\x41\x8e\x22\x6c\x6b\xc8\x7d\xc8\x64\x17\xea\x65\x42\x3b\x4c\xdc\x56\xa5\x34\x5b\x5a\x0f\x82\xfb\xb5\x9f\xfa\x02\x5b\xc4\x0f\x45\xba\x21\x7b\xe7\xfa\xdb\x25\x3f\x6e\xfd\x37\x7f\x9e\xf4\x5a\xfc\x0d\x43\xed\x7a\x2e\x90\x4f\x7d\xaa\x1d\x3d\xf9\x12\xfe\xc6\xd5\xaf\x71\x0a\x6f\x2e\x60\x74\x75\x86\xb7\x97\xf1\x0d\x32\x96\xd1\x95\xcd\x5d\x89\xf1\x36\x0b\x22\x8f\xb4\xde\x4e\x28\x1c\x26\xab\x69\x70\x70\x31\x61\x37\x37\x7c\x6d\x34\x2f\x66\x8f\xe3\xeb\xd4\xff\xa7\x90\xfe\xbf\xd2\x9f\xa7\xa1\x2b\x38\xa4\x6b\xfe\xf9\xb3\xd5\x7f\x0a\xb7\x89\xa1\x76\xf2\x18\x0f\xb4\xd2\x03\xf6\x42\xec\xfa\xc8\xa5\xb8\x3d\xeb\xf1\xc2\xb8\xc3\x5d\x91\xda\x1d\x07\xed\x88\x1b\x67\x70\xfe\xbe\x7f\x85\x67\x61\xd2\xcf\x65\xaf\xf0\x20\xfe\x09\x00\x00\xff\xff\x4f\xb2\xa7\xb0\x2f\x09\x00\x00" + +func utilitycontractsTokenforwardingCdcBytes() ([]byte, error) { + return bindataRead( + _utilitycontractsTokenforwardingCdc, + "utilityContracts/TokenForwarding.cdc", + ) +} + +func utilitycontractsTokenforwardingCdc() (*asset, error) { + bytes, err := utilitycontractsTokenforwardingCdcBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "utilityContracts/TokenForwarding.cdc", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x7d, 0x3e, 0x44, 0xd9, 0xc0, 0x14, 0x91, 0xad, 0x34, 0x96, 0xca, 0x7d, 0xf8, 0x15, 0x91, 0x80, 0xe7, 0x6e, 0xed, 0x34, 0xf5, 0x3e, 0x81, 0x45, 0x65, 0x1e, 0x1f, 0x23, 0x36, 0x2d, 0x65, 0x62}} return a, nil } @@ -223,9 +244,10 @@ func AssetNames() []string { // _bindata is a table, holding each asset generator, mapped to its name. var _bindata = map[string]func() (*asset, error){ - "ExampleToken.cdc": exampletokenCdc, - "FungibleToken.cdc": fungibletokenCdc, - "TokenForwarding.cdc": tokenforwardingCdc, + "ExampleToken.cdc": exampletokenCdc, + "FungibleToken.cdc": fungibletokenCdc, + "utilityContracts/PrivateReceiverForwarder.cdc": utilitycontractsPrivatereceiverforwarderCdc, + "utilityContracts/TokenForwarding.cdc": utilitycontractsTokenforwardingCdc, } // AssetDebug is true if the assets were built with the debug flag enabled. @@ -274,7 +296,10 @@ type bintree struct { var _bintree = &bintree{nil, map[string]*bintree{ "ExampleToken.cdc": {exampletokenCdc, map[string]*bintree{}}, "FungibleToken.cdc": {fungibletokenCdc, map[string]*bintree{}}, - "TokenForwarding.cdc": {tokenforwardingCdc, map[string]*bintree{}}, + "utilityContracts": {nil, map[string]*bintree{ + "PrivateReceiverForwarder.cdc": {utilitycontractsPrivatereceiverforwarderCdc, map[string]*bintree{}}, + "TokenForwarding.cdc": {utilitycontractsTokenforwardingCdc, map[string]*bintree{}}, + }}, }} // RestoreAsset restores an asset under the given directory. diff --git a/lib/go/templates/forward_templates.go b/lib/go/templates/forward_templates.go new file mode 100644 index 00000000..a0e9da89 --- /dev/null +++ b/lib/go/templates/forward_templates.go @@ -0,0 +1,88 @@ +package templates + +//go:generate go run github.com/kevinburke/go-bindata/go-bindata -prefix ../../../transactions -o internal/assets/assets.go -pkg assets -nometadata -nomemcopy ../../../transactions/... + +import ( + "strings" + + "github.com/onflow/flow-go-sdk" + + "github.com/onflow/flow-ft/lib/go/templates/internal/assets" +) + +const ( + deployPrivateForwardingFilanems = "privateForwarder/deploy_forwarder_contract.cdc" + + createPrivateForwarderFilename = "privateForwarder/create_private_forwarder.cdc" + setupAccountPrivateForwarderFilename = "privateForwarder/setup_and_create_forwarder.cdc" + transferPrivateManyAccountsFilename = "privateForwarder/transfer_private_many_accounts.cdc" + createAccountPrivateForwarderFilename = "privateForwarder/create_account_private_forwarder.cdc" +) + +const ( + defaultPrivateForwardAddr = "PRIVATEFORWARDINGADDRESS" +) + +func GenerateDeployPrivateForwardingScript() []byte { + code := assets.MustAssetString(deployPrivateForwardingFilanems) + + return []byte(code) +} + +// GenerateCreateForwarderScript creates a script that instantiates +// a new forwarder instance in an account +func GenerateCreatePrivateForwarderScript(fungibleAddr, forwardingAddr, tokenAddr flow.Address, tokenName string) []byte { + code := assets.MustAssetString(createPrivateForwarderFilename) + + code = replaceAddresses(code, fungibleAddr.String(), tokenAddr.String(), tokenName) + + code = strings.ReplaceAll( + code, + "0x"+defaultPrivateForwardAddr, + "0x"+forwardingAddr.String(), + ) + + return []byte(code) +} + +func GenerateSetupAccountPrivateForwarderScript(fungibleAddr, forwardingAddr, tokenAddr flow.Address, tokenName string) []byte { + code := assets.MustAssetString(setupAccountPrivateForwarderFilename) + + code = replaceAddresses(code, fungibleAddr.String(), tokenAddr.String(), tokenName) + + code = strings.ReplaceAll( + code, + "0x"+defaultPrivateForwardAddr, + "0x"+forwardingAddr.String(), + ) + + return []byte(code) +} + +func GenerateTransferPrivateManyAccountsScript(fungibleAddr, forwardingAddr, tokenAddr flow.Address, tokenName string) []byte { + code := assets.MustAssetString(transferPrivateManyAccountsFilename) + + code = replaceAddresses(code, fungibleAddr.String(), tokenAddr.String(), tokenName) + + code = strings.ReplaceAll( + code, + "0x"+defaultPrivateForwardAddr, + "0x"+forwardingAddr.String(), + ) + + return []byte(code) +} + +func GenerateCreateAccountPrivateForwarderScript(fungibleAddr, forwardingAddr, tokenAddr flow.Address, tokenName string) []byte { + code := assets.MustAssetString(createAccountPrivateForwarderFilename) + + code = replaceAddresses(code, fungibleAddr.String(), tokenAddr.String(), tokenName) + + code = strings.ReplaceAll( + code, + "0x"+defaultPrivateForwardAddr, + "0x"+forwardingAddr.String(), + ) + + return []byte(code) +} diff --git a/lib/go/templates/internal/assets/assets.go b/lib/go/templates/internal/assets/assets.go index abb63529..096dde74 100644 --- a/lib/go/templates/internal/assets/assets.go +++ b/lib/go/templates/internal/assets/assets.go @@ -1,11 +1,17 @@ // Code generated by go-bindata. DO NOT EDIT. // sources: // ../../../transactions/burn_tokens.cdc (1.093kB) -// ../../../transactions/create_forwarder.cdc (1.837kB) +// ../../../transactions/create_forwarder.cdc (1.836kB) // ../../../transactions/mint_tokens.cdc (895B) +// ../../../transactions/privateForwarder/create_account_private_forwarder.cdc (1.247kB) +// ../../../transactions/privateForwarder/create_private_forwarder.cdc (961B) +// ../../../transactions/privateForwarder/deploy_forwarder_contract.cdc (278B) +// ../../../transactions/privateForwarder/setup_and_create_forwarder.cdc (1.6kB) +// ../../../transactions/privateForwarder/transfer_private_many_accounts.cdc (1.066kB) // ../../../transactions/scripts/get_balance.cdc (468B) // ../../../transactions/scripts/get_supply.cdc (229B) // ../../../transactions/setup_account.cdc (1.258kB) +// ../../../transactions/transfer_many_accounts.cdc (1.26kB) // ../../../transactions/transfer_tokens.cdc (1.387kB) package assets @@ -96,7 +102,7 @@ func burn_tokensCdc() (*asset, error) { return a, nil } -var _create_forwarderCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\x54\x4d\x6f\xe3\x36\x10\xbd\xf3\x57\xcc\xa9\xf5\x06\x8e\xdc\xcf\x8b\x91\x16\x70\x37\xc9\x22\x68\x91\x05\x9c\xb4\x3d\x76\xc7\xe4\xc8\x64\x23\x91\x02\x39\xb2\xd6\x58\xe4\xbf\x17\x24\x25\x46\x0a\x8a\xac\x4f\x96\x38\xf3\xe6\xbd\x37\x4f\xdc\x5c\x5c\x08\xf1\xa8\x4d\x00\xf6\x68\x03\x4a\x36\xce\x82\x09\x80\xc0\xd4\x76\x0d\x32\x41\xed\x7c\x7c\x9c\x9d\xb3\x46\x06\xe9\xfa\x46\xc1\x81\xa0\x0f\xa4\x04\x3b\x08\xc4\xd0\x77\x80\x16\x50\x4a\xd7\x5b\x06\x76\xb1\x79\x40\xaf\x40\x51\xe7\x82\x61\x52\xc0\xee\x89\x6c\x88\x67\x68\x1d\x6b\xf2\xe0\x49\x92\x39\x91\xaf\x84\xb8\xab\x01\xed\xd9\x59\x82\x40\x56\x85\x79\x71\x9c\xe3\xbf\x0d\x70\x9b\x11\xc9\xc3\x7e\xec\x5b\x0b\xd6\x54\x9e\x60\x30\x4d\x03\xff\xf6\x81\xcb\x70\xd6\x2e\xd0\x0c\x2b\x96\xff\x85\x7d\xc3\x59\x89\xc6\x00\x07\x22\x2b\xa2\x02\x0c\xe9\xd8\x93\x34\x9d\x21\xcb\x80\x56\x01\xb5\x26\xfe\x01\x3a\xc5\x37\xa9\xc9\x58\x65\x24\x32\x05\x31\x68\x23\x75\x62\x37\x0d\x8c\x2a\xf5\x34\xb0\x1a\x0d\x1e\xf0\xbc\x06\x13\xf5\x81\xab\xeb\x4b\xa9\xd1\x58\x08\xe4\x4f\x46\x12\x0c\x68\x39\x51\x6b\x9d\x35\xec\x3c\x0c\xda\xc5\x35\x8c\x80\xc6\x1e\xc5\x0b\x7d\xc3\x6b\x30\x0c\x12\x2d\x0c\xc8\x52\x67\x5a\xe9\x28\x10\xc1\xa0\xc9\xd3\x8c\x00\x48\x6c\x09\x6a\xef\xda\x4a\x88\x07\xa6\x6e\xac\xcc\xdb\xca\xab\x0a\x30\x18\xd6\xb9\xa1\xa8\xf0\x5b\x21\xbe\xaf\xe0\x51\x13\xdc\xf6\xf6\x68\x0e\x0d\xc1\x63\xaa\x90\xce\xb2\x47\x19\x5d\x60\xf2\x35\x4a\x82\xa0\x53\x1e\xb0\xf1\x84\xea\x1c\x73\xa1\xa8\x6b\xdc\x99\x14\x04\xd7\x52\x22\x25\x7e\xc8\x68\xd8\x75\x8d\x91\x18\xf1\x78\x89\x37\xa2\xcc\xba\x2b\xf1\x63\x6e\x9a\x6d\x64\x8c\xd7\x58\xac\xf1\x44\x80\xe3\x42\x63\x58\x39\xe5\x39\x03\x7b\x42\x26\x25\x00\x20\x2d\x32\xb0\xf3\xa4\xc0\x58\x30\x1c\xd2\x13\x1e\x29\x6b\x47\xe8\xfa\x43\x63\x82\x26\x55\xb2\x24\x7e\xaa\xe0\x3a\x11\x49\x7e\x7e\x4a\xea\x6f\xcb\x4e\x2a\xa9\xe4\xa7\x17\xf2\x29\xa5\xca\xd4\x35\xf9\x19\x4d\xf1\x73\x15\x33\x0b\x08\x96\x06\xd8\xe5\x97\x5b\x78\x9f\x98\x25\xd8\x49\x8f\x75\xbe\xc5\xa6\x39\xaf\x13\x5d\xd6\x64\xc1\xf7\x36\x4f\xce\x42\xfe\x29\xab\xc9\xa3\x67\x1f\x65\x6e\x3a\x12\xb3\xb1\x47\x58\x7c\x10\x71\xf5\x8b\x41\x39\xc0\xaf\x82\x5e\x89\x8b\x8d\x10\xa6\xed\x9c\xe7\xb2\xef\xbc\xee\x04\xf0\xdd\xe7\xdb\x3f\xef\x3f\xdc\xfd\xf6\xc7\xcd\xe3\xc7\xdf\x6f\xee\x77\xd7\xd7\xfb\x9b\x87\x87\xa9\xe1\xe6\x33\xb6\xdd\xab\xfa\xff\xab\x7b\xe5\x60\x81\xfe\xb8\xff\x7b\xb7\xbf\xbe\xbb\xff\x30\xd5\x8b\x99\xb6\xd5\x74\x43\x6c\x61\xa7\x94\xa7\x10\xde\xc1\x17\x91\x04\x77\x9e\x3a\xf4\xb4\x42\x29\x79\x0b\xbb\x9e\xf5\xe8\x70\xac\x80\xf1\xd7\x10\xcf\xe2\xf3\x4b\x74\x69\xac\x2a\xc8\xef\x4a\x71\xfc\x55\x47\xe2\xf7\xd8\xe1\xc1\x34\x86\xcf\x57\xdf\x7c\x59\xf8\x51\x4d\xce\x3e\xff\xba\xda\xa4\xd0\xc8\x0d\xcd\xf4\xef\x0b\xe6\x82\xc1\x29\x05\xf4\xea\xf2\xb5\x07\x55\xde\xed\x3d\x0d\xe5\x6a\x5b\x15\xb6\xdb\x17\xe2\x2f\x14\xa3\xd8\x2a\xe0\x89\x56\x57\x97\x09\x75\x0d\xec\xb6\xb0\x19\xf3\xbc\x20\x53\x30\x67\x6c\xe2\x2d\x14\x21\x16\x2a\xdf\x96\x52\x49\x4d\xf2\xe9\x2d\x27\xe6\x86\x17\x92\xbd\x6d\x8c\x7d\xfa\x8a\x4b\x53\xc7\xb3\x58\x2a\x8c\xad\x6f\x4d\x5c\x8c\x7b\x6b\xc4\x7a\x51\xc9\xe8\x8f\xc4\x5f\xb3\xab\xb4\x64\x7e\xcf\xe2\x59\xfc\x17\x00\x00\xff\xff\xe1\xd1\x21\x7a\x2d\x07\x00\x00" +var _create_forwarderCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\x54\x4d\x6f\xe3\x36\x10\xbd\xf3\x57\xcc\xa9\xf5\x06\x8e\xdc\xcf\x8b\x91\x16\x70\x37\xc9\x22\x68\x91\x05\x9c\xb4\x3d\x76\xc7\xe4\xc8\x64\x23\x91\x02\x39\xb2\xd6\x58\xe4\xbf\x17\x24\x25\x46\x0a\x8a\xac\x4f\x96\x38\xf3\xe6\xbd\x37\x4f\xdc\x5c\x5c\x08\xf1\xa8\x4d\x00\xf6\x68\x03\x4a\x36\xce\x82\x09\x80\xc0\xd4\x76\x0d\x32\x41\xed\x7c\x7c\x9c\x9d\xb3\x46\x06\xe9\xfa\x46\xc1\x81\xa0\x0f\xa4\x04\x3b\x08\xc4\xd0\x77\x80\x16\x50\x4a\xd7\x5b\x06\x76\xb1\x79\x40\xaf\x40\x51\xe7\x82\x61\x52\xc0\xee\x89\x6c\x88\x67\x68\x1d\x6b\xf2\xe0\x49\x92\x39\x91\xaf\x84\xb8\xab\x01\xed\xd9\x59\x82\x40\x56\x85\x79\x71\x9c\xe3\xbf\x0d\x70\x9b\x11\xc9\xc3\x7e\xec\x5b\x0b\xd6\x54\x9e\x60\x30\x4d\x03\xff\xf6\x81\xcb\x70\xd6\x2e\xd0\x0c\x2b\x96\xff\x85\x7d\xc3\x59\x89\xc6\x00\x07\x22\x2b\xa2\x02\x0c\xe9\xd8\x93\x34\x9d\x21\xcb\x80\x56\x01\xb5\x26\xfe\x01\x3a\xc5\x37\xa9\xc9\x58\x65\x24\x32\x05\x31\x68\x23\x75\x62\x37\x0d\x8c\x2a\xf5\x34\xb0\x1a\x0d\x1e\xf0\xbc\x06\x13\xf5\x81\xab\xeb\x4b\xa9\xd1\x58\x08\xe4\x4f\x46\x12\x0c\x68\x39\x51\x6b\x9d\x35\xec\x3c\x0c\xda\xc5\x35\x8c\x80\xc6\x1e\xc5\x0b\x7d\xc3\x6b\x30\x0c\x12\x2d\x0c\xc8\x52\x67\x5a\xe9\x28\x10\xc1\xa0\xc9\xd3\x8c\x00\x48\x6c\x09\x6a\xef\xda\x4a\x88\x07\xa6\x6e\xac\xcc\xdb\xca\xab\x0a\x30\x18\xd6\xb9\xa1\xa8\xf0\x5b\x21\xbe\xaf\xe0\x51\x13\xdc\xf6\xf6\x68\x0e\x0d\xc1\x63\xaa\x90\xce\xb2\x47\x19\x5d\x60\xf2\x35\x4a\x82\xa0\x53\x1e\xb0\xf1\x84\xea\x1c\x73\xa1\xa8\x6b\xdc\x99\x14\x04\xd7\x52\x22\x25\x7e\xc8\x68\xd8\x75\x8d\x91\x18\xf1\x78\x89\x37\xa2\xcc\xba\x2b\xf1\x63\x6e\x9a\x6d\x64\x8c\xd7\x58\xac\xf1\x44\x80\xe3\x42\x63\x58\x39\xe5\x39\x03\x7b\x42\x26\x25\x00\x20\x2d\x32\xb0\xf3\xa4\xc0\x58\x30\x1c\xd2\x13\x1e\x29\x6b\x47\xe8\xfa\x43\x63\x82\x26\x55\xb2\x24\x7e\xaa\xe0\x3a\x11\x49\x7e\x7e\x4a\xea\x6f\xcb\x4e\x2a\xa9\xe4\xa7\x17\xf2\x29\xa5\xca\xd4\x35\xf9\x19\x4d\xf1\x73\x15\x33\x0b\x08\x96\x06\xd8\xe5\x97\x5b\x78\x9f\x98\x25\xd8\x49\x8f\x75\xbe\xc5\xa6\x39\xaf\x13\x5d\xd6\x64\xc1\xf7\x36\x4f\xce\x42\xfe\x29\xab\xc9\xa3\x67\x1f\x65\x6e\x3a\x12\xb3\xb1\x47\x58\x7c\x10\x71\xf5\x8b\x41\x39\xc0\xaf\x82\x5e\x89\x8b\x8d\x10\xa6\xed\x9c\xe7\xb2\xef\xbc\xee\x04\xf0\xdd\xe7\xdb\x3f\xef\x3f\xdc\xfd\xf6\xc7\xcd\xe3\xc7\xdf\x6f\xee\x77\xd7\xd7\xfb\x9b\x87\x87\xa9\xe1\xe6\x33\xb6\xdd\xab\xfa\xff\xab\x7b\xe5\x60\x81\xfe\xb8\xff\x7b\xb7\xbf\xbe\xbb\xff\x30\xd5\x8b\x99\xb6\xd5\x74\x43\x6c\x61\xa7\x94\xa7\x10\xde\xc1\x17\x91\x04\x77\x9e\x3a\xf4\xb4\x42\x29\x79\x0b\xbb\x9e\xf5\xe8\x70\xac\x80\xf1\xd7\x10\xcf\xe2\xf3\x4b\x74\x69\xac\x2a\xc8\xef\x4a\x71\xfc\x55\x47\xe2\xf7\xd8\xe1\xc1\x34\x86\xcf\x57\xdf\x7c\x59\xf8\x51\x4d\xce\x3e\xff\xba\xda\xa4\xd0\xc8\x0d\xcd\xf4\xef\x0b\xe6\x82\xc1\x29\x05\xf4\xea\xf2\xb5\x07\x55\xde\xed\x3d\x0d\xe5\x6a\x5b\x15\xb6\xdb\x17\xe2\x2f\x14\xa3\xd8\x2a\xe0\x89\x56\x57\x97\x09\x75\x0d\xec\xb6\xb0\x19\xf3\xbc\x20\x53\x30\x67\x6c\xe2\x2d\x14\x21\x16\x2a\xdf\x96\x52\x49\x4d\xf2\xe9\x2d\x27\xe6\x86\x17\x92\xbd\x6d\x8c\x7d\xfa\x8a\x4b\x53\xc7\xb3\x58\x2a\x8c\xad\x6f\x4d\x5c\x8c\x7b\x6b\xc4\x7a\x51\xc9\xe8\x8f\xc4\x5f\xb3\xab\xb4\x64\x7e\xcf\xe2\xf9\xbf\x00\x00\x00\xff\xff\xa7\x39\xe1\x44\x2c\x07\x00\x00" func create_forwarderCdcBytes() ([]byte, error) { return bindataRead( @@ -112,7 +118,7 @@ func create_forwarderCdc() (*asset, error) { } info := bindataFileInfo{name: "create_forwarder.cdc", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xac, 0x6d, 0xe4, 0xe5, 0xa2, 0x9b, 0xef, 0x7d, 0x9d, 0x75, 0x24, 0xa4, 0x97, 0xaa, 0x8a, 0x6d, 0x53, 0x12, 0x39, 0xe7, 0x62, 0x96, 0x9f, 0x9c, 0xe7, 0xd6, 0x8e, 0x70, 0x17, 0x56, 0x11, 0x9c}} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6b, 0xff, 0x9c, 0x63, 0x34, 0x73, 0xfe, 0xcf, 0xa5, 0x23, 0x2c, 0x88, 0x99, 0xa5, 0x37, 0x84, 0xcc, 0x24, 0xbf, 0xdf, 0xe6, 0x7e, 0xc8, 0xe1, 0x94, 0x12, 0x19, 0xa4, 0x93, 0xdd, 0x7d, 0x53}} return a, nil } @@ -136,6 +142,106 @@ func mint_tokensCdc() (*asset, error) { return a, nil } +var _privateforwarderCreate_account_private_forwarderCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x93\x51\x6f\xa2\x40\x10\xc7\xdf\xf9\x14\xf3\x74\xa7\x49\x2b\xf7\x6c\xec\x25\x5c\x81\xc6\x5c\xa3\x04\x6d\xfb\x3c\xd2\x51\x36\x45\x76\xb3\x0c\x52\xd3\xf8\xdd\x2f\x2c\x2e\x07\x54\x2f\x97\xf2\x02\x99\x9d\xf9\xfd\x67\xfe\x3b\x88\xbd\x92\x9a\x21\x2c\xf3\x9d\xd8\x64\xb4\x96\x6f\x94\xc3\x56\xcb\x3d\xfc\x78\x0f\x9f\x16\x0f\xf3\x5f\x8f\xc1\x7a\xf9\x3b\x58\x78\xbe\x1f\x07\xab\x95\x73\x2e\x08\xde\x71\xaf\x06\xf9\x97\xf2\x22\x2d\x0e\xc8\x14\x53\x42\xe2\x40\x3a\x94\xba\x42\xfd\x4a\xda\xd6\x44\xf1\xfc\xd9\x5b\x07\xe1\x32\x7e\xf1\x62\x7f\xbe\x78\xb0\xf5\x8e\xeb\xc2\x3a\x15\x05\xb0\xc6\xbc\xc0\x84\x85\xcc\x41\x14\x50\x16\xf4\x0a\x2c\x21\xd1\x84\x4c\x80\x75\x40\x7f\x2f\x20\xcc\x64\x05\x98\x24\xb2\xcc\x19\x2a\xc1\x29\x20\xa8\x46\x1c\xb6\x56\xd5\x71\xba\xb4\x0f\x07\x00\x40\x69\x52\xa8\x69\xa4\xf0\x48\x7a\x0a\x5e\xc9\xa9\xd7\x60\xc6\xe7\x8c\xfa\x71\x5d\x88\xf0\x58\x93\x80\x53\x6a\x85\x4c\x17\x35\xcb\x28\xd6\x27\x3e\x2a\x45\x1a\x0c\xad\xad\xce\x88\xeb\x12\x86\xbb\x2e\xdf\x4a\x9a\xd7\xd8\xe9\x6a\xf9\x54\xb0\x96\x47\x4b\xb3\x33\x3e\x2e\x5f\x80\x8d\xe5\xfa\x6c\x68\x5b\x54\xe3\x27\x65\x9e\x89\xfc\x6d\xe4\xaa\x72\x93\x89\xc4\xdd\x66\xb2\x32\x37\x64\xed\xef\x8b\xdc\x5b\x0b\xad\x4f\x97\xa1\x35\x72\xf6\xed\xa3\xb7\x22\x13\x4b\x3c\xfd\x1c\xb5\xd9\x06\x7b\x66\x7d\xd6\xbe\xe9\xe5\x31\xea\x1d\xf1\x14\xdc\x82\xa5\xc6\x5d\x27\xff\x19\xcb\x8c\xdb\xdc\x71\xcf\x43\xdb\xe0\x3d\x2a\xdc\x88\x4c\xf0\x11\xee\x9a\x26\x77\xc4\x7f\x83\xff\xea\xf6\x7a\x83\x7d\x73\x9e\x0a\x32\xf7\x39\xf4\xa6\xb7\x7b\x9f\x17\xac\xdb\x6d\x1b\x85\xd9\xed\xd5\x1f\x61\xd2\xc0\x16\x54\xb5\xa1\x91\xa6\x44\x28\x41\x39\x4f\x2f\x4c\xdc\x69\xd3\x4c\x5e\xe0\x81\x46\xb3\xdb\x56\xec\x06\x58\x4e\xaf\xcb\x0d\x0e\x56\x8d\xfd\x11\x72\x3a\x04\x37\xf7\x7e\x15\xd4\x7e\x0d\x36\xe0\x7f\x95\x23\xb3\xa3\xb5\xf0\xe5\xcd\xf8\xc2\x04\x83\xad\x39\x39\xa7\x3f\x01\x00\x00\xff\xff\x12\xbd\x13\x2a\xdf\x04\x00\x00" + +func privateforwarderCreate_account_private_forwarderCdcBytes() ([]byte, error) { + return bindataRead( + _privateforwarderCreate_account_private_forwarderCdc, + "privateForwarder/create_account_private_forwarder.cdc", + ) +} + +func privateforwarderCreate_account_private_forwarderCdc() (*asset, error) { + bytes, err := privateforwarderCreate_account_private_forwarderCdcBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "privateForwarder/create_account_private_forwarder.cdc", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x26, 0x63, 0xc0, 0x27, 0xaa, 0x97, 0xf, 0xa, 0x39, 0x45, 0x8c, 0xd3, 0xc9, 0xdd, 0x9b, 0x18, 0x35, 0xf7, 0x38, 0xd, 0x66, 0xc6, 0x21, 0xc1, 0x8c, 0x9e, 0x9c, 0x5e, 0x75, 0x20, 0xf8, 0x12}} + return a, nil +} + +var _privateforwarderCreate_private_forwarderCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x52\x4d\x8f\xda\x30\x10\xbd\xfb\x57\xcc\xa9\x65\xa5\xdd\xa4\x67\x44\x2b\xa5\x25\xac\x50\x2b\x16\x05\xba\x3d\x0f\x66\x4a\xac\x0d\x76\x34\x99\x84\x45\x88\xff\x5e\x39\x21\x28\x49\x41\xaa\xea\x43\x64\xd9\xef\xc3\xef\x4d\xcc\x3e\x77\x2c\x30\x2b\xed\xce\x6c\x32\x5a\xbb\x37\xb2\xf0\x9b\xdd\x1e\x3e\xbd\xcf\x7e\x2e\x9e\xe7\x5f\x7f\xc4\xeb\x97\xef\xf1\x22\x9a\x4e\x93\x78\xb5\x52\x17\x42\xfc\x8e\xfb\x7c\x80\xbf\x85\x5b\xb2\xa9\x50\x28\x21\x4d\xa6\x22\x9e\x39\x3e\x20\x6f\x89\x5b\xce\x32\x99\xbf\x46\xeb\x78\xf6\x92\xfc\x8a\x92\xe9\x7c\xf1\xdc\xf2\x55\x18\xc2\x3a\x35\x05\x08\xa3\x2d\x50\x8b\x71\x16\x34\x13\x0a\x15\x80\x60\xe9\x00\x79\xa3\x0d\x7c\x11\x07\x63\x01\x2d\xa0\xd6\xae\xb4\x02\x92\xa2\x80\x97\xd9\x3a\x2a\xec\x47\x01\xcc\x98\x70\x7b\x84\x14\x2b\x02\xfc\x9b\xee\xd8\x9f\x96\x9b\xcc\x68\x90\x3a\x58\x7b\xe5\x55\x36\xa5\xd4\x4a\x43\x99\x57\x2c\x33\x51\xaa\xfb\xcc\x93\x52\x00\x00\x39\x53\x8e\x4c\x23\xd4\x5a\xc6\x10\x95\x92\x46\xcd\xd3\x1e\xe0\x54\x03\xfc\x6a\x2d\xbe\x61\x8e\x1b\x93\x19\x39\xc2\x67\x28\xcc\xce\x12\x07\x99\xb1\x6f\x93\x0f\xdd\xaa\x83\xda\xed\xd4\x1b\x57\xd0\x96\x7b\xfe\x32\xba\xca\xfa\x15\x5e\x12\x86\xd4\x51\x68\xc1\x8f\x3d\xa8\x20\xef\x48\xc6\x10\x16\xe2\x18\x77\x7d\x4a\x93\xb0\x85\x3e\xa8\xeb\x36\x23\x81\xca\x5f\xc2\xe4\xe9\xee\xa4\x83\x66\x68\x0b\x3a\x5c\x8f\x46\x4c\xda\xe4\x86\xac\x8c\x6f\xe4\xef\x18\xf8\xe6\x82\x02\x2b\x1a\x4d\x9e\x6a\xa3\x47\x10\x37\xbe\x6f\x35\xb8\x58\x35\x61\x96\x28\x69\x47\xb4\x57\xee\xe9\xae\xd6\x75\x37\xac\xf5\x5f\xdd\x97\xf5\x9f\xe4\xcd\x6f\x77\xfd\x1f\x29\x3a\x43\xf0\xdf\xb3\x3a\xab\x3f\x01\x00\x00\xff\xff\x32\x7d\x0f\x3e\xc1\x03\x00\x00" + +func privateforwarderCreate_private_forwarderCdcBytes() ([]byte, error) { + return bindataRead( + _privateforwarderCreate_private_forwarderCdc, + "privateForwarder/create_private_forwarder.cdc", + ) +} + +func privateforwarderCreate_private_forwarderCdc() (*asset, error) { + bytes, err := privateforwarderCreate_private_forwarderCdcBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "privateForwarder/create_private_forwarder.cdc", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xcc, 0xbb, 0xa3, 0x44, 0xe6, 0x7e, 0xf8, 0xc4, 0x3c, 0x8, 0xf, 0x2a, 0xdc, 0x33, 0x93, 0xe1, 0xe3, 0xab, 0x1c, 0x9c, 0x7b, 0xb8, 0xea, 0x9b, 0xb3, 0x8d, 0x50, 0x17, 0xa8, 0x74, 0x3d, 0xd1}} + return a, nil +} + +var _privateforwarderDeploy_forwarder_contractCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x74\xce\xb1\x0a\x83\x40\x0c\x06\xe0\xfd\x9e\x22\xa3\x82\x38\x17\x37\xc7\x2e\x45\x90\x4e\xa5\x43\x9a\x0b\x7a\xd0\xe6\x24\x17\xa7\xe2\xbb\x17\x6b\x15\x0b\xed\x12\x12\xfe\x1f\xf2\x99\xa2\x24\x24\x0b\x51\x32\x8a\x62\x8a\x64\x27\x7c\x70\x05\xad\x69\x90\xae\x00\x8a\x9e\x2b\xb8\x9c\x8f\x62\x87\x6b\x01\x89\xc5\xb3\xb6\x16\x15\x3b\x6e\xd0\xfa\xb9\xb9\x1d\x05\xa4\xbf\xc9\x30\xde\xee\x81\x96\xa0\xd9\xf6\x1c\x9e\xce\x01\x0c\xca\x03\x2a\x67\x29\x74\xc2\x5a\x41\x3d\x5a\x5f\x13\xc5\x51\xec\xd3\x00\x58\xb2\x72\x65\xa6\x12\xbd\xcf\xe4\x8d\xdd\xd3\x57\xf2\x3c\x7f\x78\xbf\x88\x7b\x55\x3e\x7f\x99\xdc\xe4\xc0\xbd\x02\x00\x00\xff\xff\x1f\xdb\x7f\x3e\x16\x01\x00\x00" + +func privateforwarderDeploy_forwarder_contractCdcBytes() ([]byte, error) { + return bindataRead( + _privateforwarderDeploy_forwarder_contractCdc, + "privateForwarder/deploy_forwarder_contract.cdc", + ) +} + +func privateforwarderDeploy_forwarder_contractCdc() (*asset, error) { + bytes, err := privateforwarderDeploy_forwarder_contractCdcBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "privateForwarder/deploy_forwarder_contract.cdc", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x6f, 0x1b, 0x6d, 0x82, 0x8e, 0xce, 0xb0, 0x1e, 0xa3, 0x72, 0xe3, 0x7, 0x68, 0x37, 0xba, 0x88, 0x1f, 0x2c, 0xbf, 0x92, 0x53, 0x24, 0x47, 0x4f, 0x9c, 0xd3, 0x48, 0x97, 0xbf, 0x94, 0x84, 0xb}} + return a, nil +} + +var _privateforwarderSetup_and_create_forwarderCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x54\x4d\x6f\xe2\x40\x0c\xbd\xe7\x57\xf8\x54\x11\x89\x92\x3d\x23\xa8\x44\x4b\xa8\xd0\xae\x28\x02\xb6\x7b\x36\xc1\x24\xa3\x86\x99\x68\xe2\xf0\x21\xc4\x7f\x5f\x65\x48\x42\x86\x00\xaa\x56\x3b\x27\x18\x3f\x3f\x3f\xdb\x6f\xe2\x88\x4d\xa2\x34\xc3\x28\x93\xa1\x58\xc6\xb4\x50\x5f\x24\x61\xad\xd5\x06\x7e\xec\x47\xbf\x27\xef\xe3\xd7\x5f\xfe\xe2\xe3\xa7\x3f\x19\x0c\x87\x33\x7f\x3e\x2f\x13\xfc\x3d\x6e\x92\x2b\xfc\x2d\xdc\x54\x8b\x2d\x32\xcd\x28\x20\xb1\x25\x3d\x52\x7a\x87\x7a\x45\xba\xcc\x99\xce\xc6\x9f\x83\x85\x3f\xfa\x98\xfd\x19\xcc\x86\xe3\xc9\x7b\x99\xef\x78\x1e\x2c\x22\x91\x02\x6b\x94\x29\x06\x2c\x94\x04\x5c\xad\x52\x40\xf8\xc4\x2c\xe6\x36\x20\x24\x67\x76\xd0\x05\x3d\xac\x4b\xfe\x3c\x1d\x61\x89\x31\xca\x80\x20\xc0\x04\x97\x22\x16\x7c\x68\x03\xca\x55\x9e\x99\x2d\x63\x11\xd4\x02\x79\x2a\x70\x74\xe1\x72\x9c\x7a\xe5\xa3\xe3\x00\x00\x24\x9a\x12\xd4\xd4\x4a\x45\x28\x49\x77\x61\x90\x71\x34\x08\x02\x95\x49\x76\x4b\x4c\x7e\xc4\x1a\xce\x90\xce\x52\x69\xad\x76\xbd\xa7\xfa\xc0\x3a\xa6\x81\x97\x56\x3e\x83\x2e\x78\x29\x2b\x8d\x21\x79\x54\x83\x18\x84\x0b\xfd\x3e\x48\x11\xc3\xb1\x22\xce\x8f\xe7\xc1\x9b\xa6\xbc\x6f\x04\x49\x3b\x7b\x17\x26\xd1\x34\x99\x64\x0c\x82\x41\x48\x28\x0a\x58\x24\x85\xbc\x14\xb7\xd4\xb2\x02\xf9\xe9\x3d\x5b\x72\x03\x53\xcd\xdf\x24\x7c\x30\xf4\x2d\xb7\xdd\x48\x61\xf5\xa8\x13\x0b\xee\x56\xff\x4e\x97\x89\x15\x7a\x62\x21\xbf\x7a\x4f\x47\xcb\x8f\x9d\xd2\x3d\xa7\x17\x5b\xaa\x57\xec\xdf\xaa\x57\x82\x6d\x89\x8c\x3a\x24\xfe\x96\x44\xf7\x22\x2a\x26\xae\xfc\xf0\x76\xb1\x4a\xbf\x54\x1b\x12\x5f\xae\x1f\xc9\x7e\xa8\xb4\x56\xb0\xbe\xda\xa6\x45\x59\x19\x87\x9e\x57\xcc\x11\x32\x28\x19\x1f\x80\xf6\x89\x4a\x29\xad\x93\xe4\xb0\xd2\xfc\x6b\x41\xf1\x0a\x38\xd2\x2a\x0b\x23\x13\x79\x2d\x22\x42\x32\xe9\x35\x06\x74\x7b\x0b\x4d\xcb\x5e\x35\x58\xf0\x34\xd7\x62\x94\x5b\xbd\x16\xd0\xff\xb5\x94\xea\x9d\x43\xef\xf9\xee\x37\xa6\xf0\xed\x84\x76\xd5\x55\x4b\x53\x20\x12\x41\x92\xbb\x37\x16\xeb\x36\xec\x68\x9e\x47\xef\xb9\x2a\xd7\x36\x3e\xbf\x5b\xf0\x2a\x30\x3f\xb7\x35\x45\x8e\x9a\xd4\xe7\x19\xdf\xa5\xaa\x7e\x5d\x0d\xf7\xbb\xb5\xa7\x66\x07\x79\xe9\xdb\x33\xff\x87\x1e\x1c\xfb\x01\x9f\x9c\x93\xf3\x37\x00\x00\xff\xff\x04\x98\x5e\x52\x40\x06\x00\x00" + +func privateforwarderSetup_and_create_forwarderCdcBytes() ([]byte, error) { + return bindataRead( + _privateforwarderSetup_and_create_forwarderCdc, + "privateForwarder/setup_and_create_forwarder.cdc", + ) +} + +func privateforwarderSetup_and_create_forwarderCdc() (*asset, error) { + bytes, err := privateforwarderSetup_and_create_forwarderCdcBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "privateForwarder/setup_and_create_forwarder.cdc", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xf1, 0xfa, 0xc8, 0x45, 0xbf, 0xbb, 0xd, 0x63, 0xc4, 0xbc, 0x54, 0xae, 0x90, 0xd7, 0xe7, 0x22, 0x3c, 0x72, 0x49, 0x69, 0xd3, 0xf1, 0x22, 0x3e, 0x56, 0x89, 0x75, 0x34, 0xbb, 0xb6, 0x41, 0x27}} + return a, nil +} + +var _privateforwarderTransfer_private_many_accountsCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x93\x41\x6f\x9b\x40\x10\x85\xcf\xe6\x57\x4c\x72\x48\xb1\xd4\xe2\x1e\xaa\x1e\x50\xda\x88\xd6\x60\x59\x6d\x1d\x0b\x3b\xe9\xa1\xea\x61\xcd\x0e\xb0\x0a\xde\x45\xb3\x8b\x71\x15\xf9\xbf\x57\xb0\x60\x91\x38\x91\x2f\x39\x21\xad\xde\x7b\xfb\xbe\x99\x45\x6c\x4b\x45\x06\xa2\x4a\x66\x62\x53\xe0\x5a\x3d\xa0\x84\x94\xd4\x16\x3e\xee\xa3\xbb\xc5\x6c\xfe\xed\x67\xb8\xbe\xfd\x11\x2e\x82\xe9\x34\x0e\x57\x2b\xa7\x33\x84\x7b\xb6\x2d\x9f\xe9\x5f\xd2\x2d\x49\xec\x98\xc1\x18\x13\x14\x3b\xa4\x48\x51\xcd\x88\x23\xf5\x9e\x65\x3c\xbf\x0f\xd6\x61\x74\x1b\xff\x0e\xe2\xe9\x7c\x31\xeb\xfd\x8e\x21\x26\x35\x4b\x8c\x50\xd2\x65\x9c\x13\x6a\x1d\x6c\x55\x25\xcd\x2f\x56\xfa\xf0\x18\xd8\x23\x1f\xee\x22\xb1\xff\xfc\xe9\x30\x86\x47\xc7\x01\x00\x98\x4c\x60\x9d\x23\xdc\xb3\xaa\x30\x40\xa8\x55\x45\x09\x82\xc9\x99\x81\x5c\x15\x5c\x83\xc9\x11\x4c\xd3\x5b\xdb\x53\x46\x08\x1b\x14\x32\x83\xf6\xca\x14\x89\x90\xb7\x51\x05\x1a\xd8\x35\x39\x31\xa6\x3e\x5c\x0d\x99\xbd\x36\xdf\x39\xca\x4a\xcb\xd9\xf1\x09\x99\xad\x50\x72\x24\x1f\xae\x5e\x9b\x80\x67\x15\x36\xa2\x24\x2c\x19\xa1\xab\x45\x26\x1b\x57\x50\x99\x3c\x48\x92\x06\xf7\x08\xd6\xc1\xcd\xd0\x00\x03\xc2\x14\x09\x65\x43\xa6\x5a\x22\xeb\x7c\xa7\x41\x1b\x45\xc8\x6d\xef\xa3\x4f\x63\x91\x7a\x3d\x0a\x7c\xe9\xd4\xde\x46\x11\xa9\xfa\xfa\x05\xb2\xaf\x6e\xb3\x20\x1f\x26\x4d\x1c\xcb\x70\x82\x03\x49\xab\x18\x3b\xa3\xd1\xe8\xe6\x06\x4a\x26\x45\xe2\x5e\x7e\x57\x55\xc1\x41\x2a\x03\x36\xf4\xb4\xa1\xaa\x6d\xc1\xd6\x7d\x71\x39\x76\x9e\xb6\x7b\x65\x82\xa7\x65\xcf\x0c\xb4\x6f\x7e\x46\xb6\xb2\x5c\x4b\x66\xf2\x37\x22\x39\xd8\x0f\xee\x31\xa9\x0c\x0e\xb7\x96\x2a\x82\xee\x09\x83\x90\xf0\xfc\x35\x7b\x0f\xf8\x4f\x0f\xf5\xe7\x66\xe2\x69\x94\xbc\xe3\x6b\x17\xa2\xfb\x3f\xe4\x7d\xf7\xb2\x7d\xb8\xfe\xf0\x64\xe7\x5e\x2d\x4c\xce\x89\xd5\x2e\x6b\xaf\xf5\x4f\x5a\xfc\xe9\x0e\xfe\x5e\x8c\x07\xab\x39\x74\x68\x07\xe7\x7f\x00\x00\x00\xff\xff\x67\x6c\x61\x5b\x2a\x04\x00\x00" + +func privateforwarderTransfer_private_many_accountsCdcBytes() ([]byte, error) { + return bindataRead( + _privateforwarderTransfer_private_many_accountsCdc, + "privateForwarder/transfer_private_many_accounts.cdc", + ) +} + +func privateforwarderTransfer_private_many_accountsCdc() (*asset, error) { + bytes, err := privateforwarderTransfer_private_many_accountsCdcBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "privateForwarder/transfer_private_many_accounts.cdc", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x80, 0x98, 0x8a, 0x55, 0x5a, 0x8c, 0xec, 0x5c, 0x65, 0x26, 0xe5, 0x92, 0xeb, 0x72, 0x28, 0x6b, 0x8e, 0x20, 0x1e, 0x8c, 0xeb, 0x96, 0x7, 0x7, 0x4c, 0x80, 0xf4, 0xb6, 0x88, 0x7b, 0x66, 0x57}} + return a, nil +} + var _scriptsGet_balanceCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\x91\xcb\x4e\xf3\x30\x14\x84\xf7\x7e\x8a\x51\x17\xff\x9f\x6e\x12\x16\x88\x45\x45\xa9\x7a\x49\x10\x02\x15\xa9\x17\xf6\x4e\x72\xd2\x5a\x38\xb6\xe5\xd8\xb4\xa8\xea\xbb\xa3\xdc\x4a\x8b\x57\x96\xce\x37\xa3\x99\x73\xa2\x08\x9b\xbd\xa8\x50\x65\x56\x18\x07\x4b\x3c\xaf\xe0\xf6\x84\x94\x4b\xae\x32\x42\x21\x48\xe6\xd0\x05\xb8\x02\xcf\x32\xed\x95\xfb\x5f\x21\x91\xfa\xb0\xd1\x9f\xa4\x30\x6b\x39\xc6\x44\x69\xb4\x75\x48\xbc\xda\x89\x54\x52\x3b\x2d\xac\x2e\x71\x77\x4c\xb6\xcb\xe7\x97\xd9\x5b\xbc\x79\x7f\x8d\x97\xd3\xc5\x62\x15\xaf\xd7\xbd\x20\x3e\xf2\xd2\xfc\xe1\x6f\x38\x66\x7c\x8a\xc2\x2b\x94\x5c\xa8\xa0\xcb\x30\xc2\x34\xcf\x2d\x55\xd5\x70\x84\x6d\x22\x8e\x0f\xf7\x38\x31\x00\x90\xe4\xea\x9c\x0e\x63\xec\xc8\x4d\x5b\xba\x57\x0d\x2f\xc8\x17\xf7\xd2\xad\xa8\xc0\xb8\xa1\xc3\x1d\xb9\x39\x37\x3c\x15\x52\xb8\xef\x20\x32\x3e\x95\x22\x8b\xe8\x2a\x5b\x57\xb4\xb5\xa8\x5f\x98\x6a\x6b\xf5\xe1\xf1\xdf\x75\x83\xf0\xa3\x36\x3e\xdd\x6c\x21\xec\xa4\xe7\xa7\xe0\x57\x3d\x99\xc0\x70\x25\xb2\x60\x30\xd7\x5e\xe6\x50\xda\xa1\x35\xec\x57\x0a\x4b\x05\x59\xaa\x7f\x4e\x37\x37\x69\xbc\x07\x43\xd6\x98\x58\x72\xde\xaa\x4b\x91\xb0\x3b\x18\x3b\xb3\x9f\x00\x00\x00\xff\xff\x61\x86\x36\x18\xd4\x01\x00\x00" func scriptsGet_balanceCdcBytes() ([]byte, error) { @@ -196,6 +302,26 @@ func setup_accountCdc() (*asset, error) { return a, nil } +var _transfer_many_accountsCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\x93\x41\x6f\x9b\x4e\x10\xc5\xcf\xe6\x53\x4c\x7c\xf8\x07\x1f\x82\xff\x87\xaa\x07\xe4\x24\x72\x63\x3b\xaa\xda\xa6\x92\xe3\xb4\x87\xaa\x87\x05\x06\xd8\x06\xef\xa2\xd9\x21\x76\x64\xf9\xbb\x57\xec\x02\xc2\xc1\x4a\x39\x2e\x33\x6f\x7e\x3b\xef\xad\xdc\x96\x9a\x18\x56\x95\xca\x64\x54\xe0\x46\x3f\xa3\x82\x94\xf4\x16\xfe\xdf\xaf\x9e\x1e\xee\x3f\x7f\xfa\xba\xdc\x7c\xff\xb2\x7c\x98\x2f\x16\xeb\xe5\xe3\xa3\xd7\x34\x2c\xf7\x62\x5b\xbe\xa9\x3f\xa9\xf3\x98\x84\x32\x22\x66\xa9\x95\x2f\x92\x84\xd0\x98\xf9\x56\x57\x8a\xbf\x89\x32\x84\xc3\xdc\x1d\x85\xf0\xb4\x92\xfb\x8f\x1f\x8e\x13\x38\x78\x1e\x00\xc0\x74\x0a\x9b\x1c\xe1\x87\xa8\x0a\x06\x42\xa3\x2b\x8a\x11\x38\x17\x0c\xb9\x2e\x12\x03\x9c\x23\x70\x3d\xd7\xb8\x53\x41\x08\x11\x4a\x95\x81\x1d\x99\x22\x11\x26\x56\xaa\x40\x86\x97\x5a\x67\x8d\x69\x08\xff\xf5\x99\x03\xab\xef\x26\x96\x84\xa5\x20\xf4\x8d\xcc\x14\x52\x08\xf3\x8a\xf3\x79\x1c\xd7\xac\x1d\x55\x43\x76\x8f\x0c\x02\x08\x53\x24\x54\x35\x96\xb6\x38\xae\xf3\xd2\x80\x61\x4d\x98\xb8\xa1\x5d\x9f\xc1\x22\x0d\x5a\x0e\xb8\x6e\xaa\x83\x48\x13\xe9\xdd\xec\x0c\xd6\x8d\x5f\x6f\x34\x84\x69\x2d\x27\x32\x9c\x62\xaf\xc4\x56\x4c\xbc\xd1\x68\x74\x7b\x0b\xa5\x50\x32\xf6\xc7\x77\xba\x2a\x12\x50\x9a\xc1\x89\x0e\x09\xf5\xce\x01\xda\xee\x8b\xf1\xc4\xc2\x1d\xdd\xdd\x70\x8f\x71\xc5\xd8\xbf\x6a\xaa\x09\x1a\xd3\x40\x2a\x78\xeb\x5f\xf0\x8c\xaf\xa6\x5f\xdf\xac\xe7\xa7\xe4\x3c\x21\xb1\x6b\xfd\xb1\xc1\xf8\xf7\x82\x5a\xaf\x0c\x2a\x76\xbe\xcf\xae\x4e\xb7\x16\xec\x1a\x65\x5f\x58\x86\x70\x80\xf4\xab\x39\xf8\x7d\x31\x19\x60\xd5\xae\xd5\x14\x84\xb1\x2c\x25\x2a\xbe\x34\x50\x56\x51\x21\x63\x10\xce\x67\xd0\xd1\x1f\x8c\x87\x44\x5d\x07\x5c\x43\x86\xdc\xa4\xa2\xcd\xf3\xf9\x49\x67\xf2\xd1\x1f\xbc\xc6\x18\xe5\x0b\xd2\xb9\x59\xf6\x87\x0b\x49\xd7\x12\x64\xc8\x77\xa2\x14\x91\x2c\x24\xbf\xfa\x53\x07\x7e\x12\x89\x56\x72\x72\xa2\x59\x7f\x5d\xc8\x0e\x27\x2f\x3c\x68\x3b\x8e\x37\xfe\xb0\xe9\xdd\x5c\xb9\xbe\xf7\xaf\x68\x3d\x1c\x0f\xb7\xb3\xc0\x52\x1b\xe9\xbc\x68\x0d\x55\x6d\x56\xa4\x1a\xe8\xd0\xb9\x55\xf5\xd6\x14\x24\x4e\xb0\x79\x2e\xb3\xab\x2e\x40\xbd\xd9\xc7\x26\xea\x47\xef\x6f\x00\x00\x00\xff\xff\xa3\x8d\x9b\xdc\xec\x04\x00\x00" + +func transfer_many_accountsCdcBytes() ([]byte, error) { + return bindataRead( + _transfer_many_accountsCdc, + "transfer_many_accounts.cdc", + ) +} + +func transfer_many_accountsCdc() (*asset, error) { + bytes, err := transfer_many_accountsCdcBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "transfer_many_accounts.cdc", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xed, 0x88, 0xd6, 0xa0, 0x5, 0xdb, 0x45, 0x34, 0xcb, 0x2c, 0xc4, 0xd3, 0x86, 0x69, 0x77, 0x3d, 0xe1, 0x69, 0x31, 0xaf, 0x35, 0x8f, 0x54, 0xa3, 0xd0, 0xf2, 0x70, 0xb0, 0xdd, 0x16, 0x7f, 0x1c}} + return a, nil +} + var _transfer_tokensCdc = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x53\xcd\x6e\xdb\x3c\x10\x3c\x47\x4f\xb1\x5f\x0e\x5f\x64\xa0\x91\x7a\x28\x7a\x30\xf2\x53\x37\x71\x82\xa2\x45\x0a\xe4\xa7\x3d\x53\xd2\xda\x62\x2b\x91\xc4\x72\x15\x3b\x08\xfc\xee\x05\x49\x51\x95\x9c\xa2\xa9\x2f\x86\x56\xb3\xb3\xb3\x33\xab\x3c\x87\xfb\x5a\x5a\x60\x12\xca\x8a\x92\xa5\x56\x20\x2d\x08\x60\x6c\x4d\x23\x18\x61\xa5\xc9\x3d\x8e\xde\x73\x2d\x38\xc9\x73\x28\x75\xd7\x54\x50\x20\x74\x16\x2b\x28\x9e\x40\xa8\x27\xad\x10\x58\x83\x45\x55\x01\xeb\x9f\xa8\xac\x7b\x14\x4a\x73\x8d\x04\xa2\x2c\x75\xa7\x7c\xb3\x23\x81\x5a\x58\x28\x10\x15\x58\x64\xe8\x8c\x83\x12\x96\x28\x1f\xb1\x6f\xce\x92\x3c\x4f\xbc\x46\x84\x8d\xe4\xba\x22\xb1\x01\xd1\x3a\x12\x10\x6e\x44\x8d\x91\x14\x56\xa4\x5b\x58\x23\x2f\x7e\x0f\xd9\x44\x85\x0e\x67\x04\x89\x16\x19\xc9\x4b\x72\x95\xd1\x52\x49\x22\x5b\xa3\x89\xe1\xaa\x53\x6b\x59\x34\x78\xef\xe6\x07\xce\xb7\xdb\xab\x87\x9b\xeb\x4f\x1f\xbf\x2c\xef\xbf\x7e\x5e\xde\x2c\x2e\x2f\x6f\x97\x77\x77\xb1\x61\xb9\x15\xad\xd9\xc3\x4f\x70\xc9\x68\x4c\x1a\xb4\xcf\xe1\xe1\x4a\x6e\xdf\xbf\x7b\x03\xac\xe7\xb0\xa8\x2a\x42\x6b\x67\xf0\x9c\x24\x00\x00\xfd\xbe\xdf\x44\xd7\x30\x10\x5a\xdd\x51\x89\xbd\x61\xba\xa9\x6c\xd0\xde\x9b\xeb\xaa\x82\x10\x0a\x94\x6a\x1d\x36\x5a\x21\x11\x56\x9e\xaa\x41\x76\x59\xb0\xe7\x9a\xc3\x87\xc9\x76\x99\xaf\x86\x99\x86\xd0\x08\xc2\xd4\xca\xb5\x42\x9a\xc3\xa2\xe3\xba\x37\x72\xd0\xd5\x6b\xbb\x46\x06\x01\x84\x2b\x24\x54\x25\x46\x33\x43\xe7\x91\x05\xcb\x9a\xb0\x82\x47\x4f\x1e\xfb\x9c\x10\x5f\xb9\xc5\x15\x9c\xf6\xe0\xac\xd0\x44\x7a\x73\xf2\xff\xd8\xc3\xa0\xea\x2c\x75\x56\xce\x21\x77\x6c\x62\x8d\x39\x8e\x20\x1e\x31\x4b\x0e\x0e\x0e\xce\xcf\xc1\x08\x25\xcb\xf4\xf0\xc2\x47\xad\x34\x43\x20\x7d\x29\x50\x6f\x82\x3e\xdf\xfd\xdf\xe1\x6c\xb2\xd4\xf7\x78\x5c\xbd\xaf\x3e\xc8\xd7\xd7\xb2\xd8\xac\xb2\xc1\x60\x38\x39\x1e\x96\xcc\xe2\xb9\x0e\x91\x87\xff\x99\xef\xdd\x85\xe1\xb8\xc5\xb2\x63\xfc\x83\xc1\x6e\x34\x61\x29\x8d\x44\xc5\x47\x16\x4c\x57\x34\xb2\x1c\x6e\x5d\x17\x3f\xb0\x9c\xba\x3b\xa0\xe1\x74\xf4\x15\xa4\xac\x67\xff\x92\xde\x78\xd6\x6d\xf8\x04\x69\x9f\xde\x17\x43\x7e\x03\x3c\x5b\x23\x5f\x08\x23\x0a\xd9\x48\x7e\x4a\xf3\xa0\x73\x92\x56\xa4\x9b\x0d\x7c\xee\x37\x64\xff\x3c\xbd\xc9\x88\xde\x9d\xa5\xaf\x27\x1c\xa0\x7f\xdf\xc6\x27\xb3\x97\xf6\x25\x1a\x6d\x65\x70\x39\xe6\xa4\x62\xf4\x52\xbd\xe0\xa0\x7d\x47\x46\x6e\x64\x55\x20\xeb\x0f\xf6\xe4\x78\x7a\x13\x31\xef\x5d\xf2\x2b\x00\x00\xff\xff\x28\xad\x7c\x0d\x6b\x05\x00\x00" func transfer_tokensCdcBytes() ([]byte, error) { @@ -307,13 +433,19 @@ func AssetNames() []string { // _bindata is a table, holding each asset generator, mapped to its name. var _bindata = map[string]func() (*asset, error){ - "burn_tokens.cdc": burn_tokensCdc, - "create_forwarder.cdc": create_forwarderCdc, - "mint_tokens.cdc": mint_tokensCdc, - "scripts/get_balance.cdc": scriptsGet_balanceCdc, - "scripts/get_supply.cdc": scriptsGet_supplyCdc, - "setup_account.cdc": setup_accountCdc, - "transfer_tokens.cdc": transfer_tokensCdc, + "burn_tokens.cdc": burn_tokensCdc, + "create_forwarder.cdc": create_forwarderCdc, + "mint_tokens.cdc": mint_tokensCdc, + "privateForwarder/create_account_private_forwarder.cdc": privateforwarderCreate_account_private_forwarderCdc, + "privateForwarder/create_private_forwarder.cdc": privateforwarderCreate_private_forwarderCdc, + "privateForwarder/deploy_forwarder_contract.cdc": privateforwarderDeploy_forwarder_contractCdc, + "privateForwarder/setup_and_create_forwarder.cdc": privateforwarderSetup_and_create_forwarderCdc, + "privateForwarder/transfer_private_many_accounts.cdc": privateforwarderTransfer_private_many_accountsCdc, + "scripts/get_balance.cdc": scriptsGet_balanceCdc, + "scripts/get_supply.cdc": scriptsGet_supplyCdc, + "setup_account.cdc": setup_accountCdc, + "transfer_many_accounts.cdc": transfer_many_accountsCdc, + "transfer_tokens.cdc": transfer_tokensCdc, } // AssetDebug is true if the assets were built with the debug flag enabled. @@ -363,11 +495,19 @@ var _bintree = &bintree{nil, map[string]*bintree{ "burn_tokens.cdc": {burn_tokensCdc, map[string]*bintree{}}, "create_forwarder.cdc": {create_forwarderCdc, map[string]*bintree{}}, "mint_tokens.cdc": {mint_tokensCdc, map[string]*bintree{}}, + "privateForwarder": {nil, map[string]*bintree{ + "create_account_private_forwarder.cdc": {privateforwarderCreate_account_private_forwarderCdc, map[string]*bintree{}}, + "create_private_forwarder.cdc": {privateforwarderCreate_private_forwarderCdc, map[string]*bintree{}}, + "deploy_forwarder_contract.cdc": {privateforwarderDeploy_forwarder_contractCdc, map[string]*bintree{}}, + "setup_and_create_forwarder.cdc": {privateforwarderSetup_and_create_forwarderCdc, map[string]*bintree{}}, + "transfer_private_many_accounts.cdc": {privateforwarderTransfer_private_many_accountsCdc, map[string]*bintree{}}, + }}, "scripts": {nil, map[string]*bintree{ "get_balance.cdc": {scriptsGet_balanceCdc, map[string]*bintree{}}, "get_supply.cdc": {scriptsGet_supplyCdc, map[string]*bintree{}}, }}, "setup_account.cdc": {setup_accountCdc, map[string]*bintree{}}, + "transfer_many_accounts.cdc": {transfer_many_accountsCdc, map[string]*bintree{}}, "transfer_tokens.cdc": {transfer_tokensCdc, map[string]*bintree{}}, }} diff --git a/lib/go/templates/transaction_templates.go b/lib/go/templates/transaction_templates.go index fdf0a22c..6236779b 100644 --- a/lib/go/templates/transaction_templates.go +++ b/lib/go/templates/transaction_templates.go @@ -19,11 +19,12 @@ const ( defaultTokenAddr = "TOKENADDRESS" defaultForwardingAddr = "FORWARDINGADDRESS" - transferTokensFilename = "transfer_tokens.cdc" - setupAccountFilename = "setup_account.cdc" - mintTokensFilename = "mint_tokens.cdc" - createForwarderFilename = "create_forwarder.cdc" - burnTokensFilename = "burn_tokens.cdc" + transferTokensFilename = "transfer_tokens.cdc" + transferManyAccountsFilename = "transfer_many_accounts.cdc" + setupAccountFilename = "setup_account.cdc" + mintTokensFilename = "mint_tokens.cdc" + createForwarderFilename = "create_forwarder.cdc" + burnTokensFilename = "burn_tokens.cdc" ) func replaceAddresses(code string, fungibleAddr, tokenAddr, tokenName string) string { @@ -89,6 +90,17 @@ func GenerateTransferVaultScript(fungibleAddr, tokenAddr flow.Address, tokenName return []byte(code) } +// GenerateTransferManyAccountsScript creates a script that transfers the same number of tokens +// to a list of accounts +func GenerateTransferManyAccountsScript(fungibleAddr, tokenAddr flow.Address, tokenName string) []byte { + + code := assets.MustAssetString(transferManyAccountsFilename) + + code = replaceAddresses(code, fungibleAddr.String(), tokenAddr.String(), tokenName) + + return []byte(code) +} + // GenerateMintTokensScript creates a script that uses the admin resource // to mint new tokens and deposit them in a Vault func GenerateMintTokensScript(fungibleAddr, tokenAddr flow.Address, tokenName string) []byte { diff --git a/lib/go/test/forwarding_test.go b/lib/go/test/forwarding_test.go new file mode 100644 index 00000000..3ff0ad2b --- /dev/null +++ b/lib/go/test/forwarding_test.go @@ -0,0 +1,186 @@ +package test + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/onflow/cadence" + jsoncdc "github.com/onflow/cadence/encoding/json" + "github.com/onflow/flow-go-sdk" + "github.com/onflow/flow-go-sdk/crypto" + "github.com/onflow/flow-go-sdk/test" + + "github.com/onflow/flow-ft/lib/go/contracts" + "github.com/onflow/flow-ft/lib/go/templates" +) + +func TestPrivateForwarder(t *testing.T) { + b := newBlockchain() + + accountKeys := test.AccountKeyGenerator() + + exampleTokenAccountKey, exampleTokenSigner := accountKeys.NewWithSigner() + fungibleAddr, exampleTokenAddr, _ := + DeployTokenContracts(b, t, []*flow.AccountKey{exampleTokenAccountKey}) + + forwardingCode := contracts.PrivateReceiverForwarder(fungibleAddr.String()) + cadenceCode := bytesToCadenceArray(forwardingCode) + + tx := flow.NewTransaction(). + SetScript(templates.GenerateDeployPrivateForwardingScript()). + SetGasLimit(100). + SetProposalKey(b.ServiceKey().Address, b.ServiceKey().Index, b.ServiceKey().SequenceNumber). + SetPayer(b.ServiceKey().Address). + AddAuthorizer(exampleTokenAddr). + AddRawArgument(jsoncdc.MustEncode(cadence.NewString("PrivateReceiverForwarder"))). + AddRawArgument(jsoncdc.MustEncode(cadenceCode)) + + _ = tx.AddArgument(cadence.Path{Domain: "storage", Identifier: "privateForwardingSender"}) + _ = tx.AddArgument(cadence.Path{Domain: "storage", Identifier: "privateForwardingStorage"}) + _ = tx.AddArgument(cadence.Path{Domain: "public", Identifier: "privateForwardingPublic"}) + + signAndSubmit( + t, b, tx, + []flow.Address{b.ServiceKey().Address, exampleTokenAddr}, + []crypto.Signer{b.ServiceKey().Signer(), exampleTokenSigner}, + false, + ) + + joshAccountKey, joshSigner := accountKeys.NewWithSigner() + joshAddress, _ := b.CreateAccount([]*flow.AccountKey{joshAccountKey}, nil) + + t.Run("Should be able to set up an account to accept private deposits", func(t *testing.T) { + + script := templates.GenerateSetupAccountPrivateForwarderScript( + fungibleAddr, + exampleTokenAddr, + exampleTokenAddr, + "ExampleToken", + ) + + tx := flow.NewTransaction(). + SetScript(script). + SetGasLimit(100). + SetProposalKey( + b.ServiceKey().Address, + b.ServiceKey().Index, + b.ServiceKey().SequenceNumber, + ). + SetPayer(b.ServiceKey().Address). + AddAuthorizer(joshAddress) + + signAndSubmit( + t, b, tx, + []flow.Address{ + b.ServiceKey().Address, + joshAddress, + }, + []crypto.Signer{ + b.ServiceKey().Signer(), + joshSigner, + }, + false, + ) + }) + + t.Run("Should be able to transfer private tokens to an account", func(t *testing.T) { + + recipient1Address := cadence.Address(joshAddress) + recipient1Amount := CadenceUFix64("300.0") + + pair := cadence.KeyValuePair{Key: recipient1Address, Value: recipient1Amount} + recipientPairs := make([]cadence.KeyValuePair, 1) + recipientPairs[0] = pair + + script := templates.GenerateTransferPrivateManyAccountsScript(fungibleAddr, exampleTokenAddr, exampleTokenAddr, "ExampleToken") + tx = flow.NewTransaction(). + SetScript(script). + SetGasLimit(100). + SetProposalKey( + b.ServiceKey().Address, + b.ServiceKey().Index, + b.ServiceKey().SequenceNumber, + ). + SetPayer(b.ServiceKey().Address). + AddAuthorizer(exampleTokenAddr) + + _ = tx.AddArgument(cadence.NewDictionary(recipientPairs)) + + signAndSubmit( + t, b, tx, + []flow.Address{ + b.ServiceKey().Address, + exampleTokenAddr, + }, + []crypto.Signer{ + b.ServiceKey().Signer(), + exampleTokenSigner, + }, + false, + ) + + // Assert that the vaults' balances are correct + script = templates.GenerateInspectVaultScript(fungibleAddr, exampleTokenAddr, "ExampleToken") + result, err := b.ExecuteScript( + script, + [][]byte{ + jsoncdc.MustEncode(cadence.Address(exampleTokenAddr)), + }, + ) + require.NoError(t, err) + if !assert.True(t, result.Succeeded()) { + t.Log(result.Error.Error()) + } + balance := result.Value + assertEqual(t, CadenceUFix64("700.0"), balance) + + script = templates.GenerateInspectVaultScript(fungibleAddr, exampleTokenAddr, "ExampleToken") + result, err = b.ExecuteScript( + script, + [][]byte{ + jsoncdc.MustEncode(cadence.Address(joshAddress)), + }, + ) + require.NoError(t, err) + if !assert.True(t, result.Succeeded()) { + t.Log(result.Error.Error()) + } + balance = result.Value + assertEqual(t, CadenceUFix64("300.0"), balance) + + script = templates.GenerateInspectSupplyScript(fungibleAddr, exampleTokenAddr, "ExampleToken") + supply := executeScriptAndCheck(t, b, script, nil) + assertEqual(t, CadenceUFix64("1000.0"), supply) + }) + + t.Run("Should be able to create a new account with private forwarder", func(t *testing.T) { + + script := templates.GenerateCreateAccountPrivateForwarderScript(fungibleAddr, exampleTokenAddr, flow.HexToAddress("0ae53cb6e3f42a79"), "FlowToken") + tx = flow.NewTransaction(). + SetScript(script). + SetGasLimit(100). + SetProposalKey( + b.ServiceKey().Address, + b.ServiceKey().Index, + b.ServiceKey().SequenceNumber, + ). + SetPayer(b.ServiceKey().Address). + AddAuthorizer(exampleTokenAddr) + + signAndSubmit( + t, b, tx, + []flow.Address{ + b.ServiceKey().Address, + exampleTokenAddr, + }, + []crypto.Signer{ + b.ServiceKey().Signer(), + exampleTokenSigner, + }, + false, + ) + + }) +} diff --git a/lib/go/test/go.sum b/lib/go/test/go.sum index 7b3ab229..cf4a37fb 100644 --- a/lib/go/test/go.sum +++ b/lib/go/test/go.sum @@ -699,38 +699,16 @@ github.com/onflow/cadence v0.12.1 h1:1XzcjUHPYMj1NrIrYddoj0aE6vegRoX/99+cy8/RDPc github.com/onflow/cadence v0.12.1/go.mod h1:8NwJGO535nnY/+QWEMDc2rhvOFChToWQ9Bg7fUIIc/I= github.com/onflow/cadence v0.12.3 h1:TLC34jmFJZgM7sBUIGjWAY5Tf6EeXVcUxCVFC9nb4cI= github.com/onflow/cadence v0.12.3/go.mod h1:8NwJGO535nnY/+QWEMDc2rhvOFChToWQ9Bg7fUIIc/I= -github.com/onflow/cadence v0.12.5 h1:C3n5Sa7j5h6Y1S+vALgTneqUgR6NCnwiG6q80MBruME= github.com/onflow/cadence v0.12.5/go.mod h1:8NwJGO535nnY/+QWEMDc2rhvOFChToWQ9Bg7fUIIc/I= github.com/onflow/cadence v0.12.6 h1:IvKSx5C84B4DGBf4DUAtLE2WtC24KAZR4z5XZyGGPYM= github.com/onflow/cadence v0.12.6/go.mod h1:CHQIgovf2fks/6kwrpBaatNarHxX5qJggynAbjEnSvQ= -github.com/onflow/flow-core-contracts/lib/go/contracts v0.3.1-0.20201122012505-4061d358b8db h1:iMuIiGtc9EIE8RVSXHH+qFf/yITMT1yXQtXjFK19OW4= -github.com/onflow/flow-core-contracts/lib/go/contracts v0.3.1-0.20201122012505-4061d358b8db/go.mod h1:yuFiT2+dZm42smG7XZQlMgZyb31hn5dvLrIDq0/PVc8= -github.com/onflow/flow-core-contracts/lib/go/contracts v0.6.1-0.20210118202839-f8f9d9a04bcb h1:nmPc011ksYL9cV9/tGm/4UdkLkQe7R7LV4wJx3KA5yk= -github.com/onflow/flow-core-contracts/lib/go/contracts v0.6.1-0.20210118202839-f8f9d9a04bcb/go.mod h1:XI1LdeW0fkbPF0NjSu8Bd8kG1wSNfw9tO/claEXVs3E= github.com/onflow/flow-core-contracts/lib/go/contracts v0.7.1 h1:nmIDPf94F9Ecx6ecGyd4uYBUl4LluntWLvtwAJYt4tw= github.com/onflow/flow-core-contracts/lib/go/contracts v0.7.1/go.mod h1:4zE/4A+5zyahxSFccQmcBqzp4ONXIwvGHaOKN8h8CRM= -github.com/onflow/flow-emulator v0.14.0-beta1 h1:RvyCd0OTYDTUI97cMPVbbxi0t8EYOeHWhaI3yMet9Wg= -github.com/onflow/flow-emulator v0.14.0-beta1/go.mod h1:b7FkKNWsVxgkZzujqd82L9IJeeYrScjwBXW6RAoYOl4= -github.com/onflow/flow-emulator v0.14.0-beta3 h1:HAxJQiExl1PpFx0o5xHW3nxTovfYTS+K0vnlUrR/tAg= -github.com/onflow/flow-emulator v0.14.0-beta3/go.mod h1:ogiNjzLEbteAa6qK2mgyFtuCr99Kgm5Su5xqugG1rSM= -github.com/onflow/flow-emulator v0.14.0 h1:WaMXyPoAqTdUzev+O88Uh/Un5fCfgIHDxKHzECe4hKE= -github.com/onflow/flow-emulator v0.14.0/go.mod h1:udW9SQCkrQKaTpdipsh0QnsnXuPCQDm5Tw9ig4ZU9ss= github.com/onflow/flow-emulator v0.14.2 h1:/kxGotqmmSL8wGAlFZ98pch2vZx3IjDJ45cXavDbleo= github.com/onflow/flow-emulator v0.14.2/go.mod h1:rrlVt1xxDKi7/WBw2RW4WAL9D8hDu4AUs+iJPPZgHIs= -github.com/onflow/flow-go v0.13.1-0.20210112001354-9c38eed130d0 h1:RxAlnghCVm99OiU3OYl7ZkxL3y+ks5qK2v3JoL2ZZfU= -github.com/onflow/flow-go v0.13.1-0.20210112001354-9c38eed130d0/go.mod h1:TvS6nfvNYNfa3L8871M42ruaOlVFsrXCjbSApRiaOKI= -github.com/onflow/flow-go v0.13.1-0.20210118203120-65db5351ec40 h1:uBxEs3Y1wVKofKpG4haadq8pIo35jG7Y7fEqEr44heY= -github.com/onflow/flow-go v0.13.1-0.20210118203120-65db5351ec40/go.mod h1:EczpTk0LnbpGLg0/V6u30qFOFGkkgTwpretNz89aJPw= -github.com/onflow/flow-go v0.13.1-0.20210119024156-79985711a957 h1:BXUM+7JGRcFTJNjLapLogZjeKV5QKZQ0+H2eOusozT8= -github.com/onflow/flow-go v0.13.1-0.20210119024156-79985711a957/go.mod h1:BvCggFUsveury2qXFBq+In7o3d4sJlbTdP/dSAKQVTY= github.com/onflow/flow-go v0.14.0 h1:vFFxg+gkWS6mhTCz5gdIeu7HedPlV7FIJiX4LSRi1ww= github.com/onflow/flow-go v0.14.0/go.mod h1:0Uf23S/xNZZSxtXqWy0vpCPBvkWzxxObd03Vc0MbKws= -github.com/onflow/flow-go-sdk v0.13.0 h1:gLAK4ZQtkw36qYmAOS5oQu9XhCYWHt/38le2QzQtYzM= github.com/onflow/flow-go-sdk v0.13.0/go.mod h1:yqnSajzJVFfrTg68F4WXRR1Yzs1akqAjyscEDyFudPE= -github.com/onflow/flow-go-sdk v0.14.0 h1:P83cCi7SkqPUvl87k+9CDG1TMGbFOGvtrwQY9M/tKb4= -github.com/onflow/flow-go-sdk v0.14.0/go.mod h1:h3FkeOdsmT+2t3dTvV0fhtw3Y2S2m4jvccZeHbg/i8Y= -github.com/onflow/flow-go-sdk v0.14.1 h1:EiZRx4jL5T8nwWcC/AzKAyiui44lxYPJsiGucF1U600= -github.com/onflow/flow-go-sdk v0.14.1/go.mod h1:h3FkeOdsmT+2t3dTvV0fhtw3Y2S2m4jvccZeHbg/i8Y= github.com/onflow/flow-go-sdk v0.14.2/go.mod h1:3+pZ5VjelRgzFyE9LBWei90bmKuY1szSGkNGgK/SxYY= github.com/onflow/flow-go-sdk v0.14.3 h1:6t1ycWJSPpgz7LeMDaZ3cIbiKa24JNxUEFyAu3Vvi2U= github.com/onflow/flow-go-sdk v0.14.3/go.mod h1:VAXKnZQlRRPfIkm8nw71B6bwhXNnmTfqV4wNrP3fK9I= @@ -751,7 +729,6 @@ github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWEr github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= @@ -769,7 +746,6 @@ github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssy github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -783,8 +759,6 @@ github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= -github.com/prometheus/client_golang v1.5.1 h1:bdHYieyGlH+6OLEk2YQha8THib30KP0/yD0YH9m6xcA= -github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1 h1:NTGy1Ja9pByO+xAeH/qiWnLrKtr3hJPNjaVUwnjpdpA= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= @@ -799,8 +773,6 @@ github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= -github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U= -github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.14.0 h1:RHRyE8UocrbjU+6UvRzwi6HjiDfxrrBU91TtbKzkGp4= github.com/prometheus/common v0.14.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= @@ -808,16 +780,13 @@ github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3 h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFBS8= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/tsdb v0.6.2-0.20190402121629-4f204dcbc150/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/psiemens/graceland v1.0.0/go.mod h1:1Tof+vt1LbmcZFE0lzgdwMN0QBymAChG3FRgDx8XisU= github.com/psiemens/sconfig v0.0.0-20190623041652-6e01eb1354fc/go.mod h1:+MLKqdledP/8G3rOBpknbLh0IclCf4WneJUtS26JB2U= -github.com/raviqqe/hamt v0.0.0-20190615202029-864fb7caef85 h1:FG/cFwuZM0j3eEBI5jkkYRn6RufVzcvtTXN+YFHWJjI= github.com/raviqqe/hamt v0.0.0-20190615202029-864fb7caef85/go.mod h1:I9elsTaXMhu41qARmzefHy7v2KmAV2TB1yH4E+nBSf0= github.com/raviqqe/hamt v0.0.0-20210114072021-37930cf9f7d8 h1:JyknRyD8lJLefdzQGSYuBNZPLeQU/jl3u8ed2aaDfLk= github.com/raviqqe/hamt v0.0.0-20210114072021-37930cf9f7d8/go.mod h1:0/epCjol3v+s4bEPHiO4Y2mTdFUSwycMMpX3rOfWQ0A= @@ -842,7 +811,6 @@ github.com/segmentio/fasthash v1.0.2 h1:86fGDl2hB+iSHYlccB/FP9qRGvLNuH/fhEEFn6gn github.com/segmentio/fasthash v1.0.2/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= @@ -854,7 +822,6 @@ github.com/spacemonkeygo/openssl v0.0.0-20181017203307-c2dcc5cca94a/go.mod h1:7A github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.0.1-0.20190317074736-539464a789e9/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= @@ -874,16 +841,12 @@ github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3 github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -939,7 +902,6 @@ go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/goleak v1.0.0 h1:qsup4IcBdlmsnGfqyLl4Ntn3C2XCCuKAE7DwHpScyUo= go.uber.org/goleak v1.0.0/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= @@ -965,11 +927,9 @@ golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190618222545-ea8f1a30c443/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200117160349-530e935923ad h1:Jh8cai0fqIK+f6nG0UgPW5wFk8wmiMhM3AyciDBdtQg= golang.org/x/crypto v0.0.0-20200117160349-530e935923ad/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200311171314-f7b00557c8c4/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200423211502-4bdfaf469ed5 h1:Q7tZBpemrlsc2I7IyODzhtallWRSm4Q0d09pL6XbQtU= golang.org/x/crypto v0.0.0-20200423211502-4bdfaf469ed5/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -985,7 +945,6 @@ golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6 h1:QE6XYQK6naiK1EPAe1g/ILLxN5RBoH5xkJk3CqlMI/Y= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= @@ -998,9 +957,7 @@ golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367 h1:0IiAsCRByjO2QjX7ZPkw5oU9x+n1YqRL802rjC0c3Aw= golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= @@ -1008,9 +965,7 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1032,7 +987,6 @@ golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7 h1:rTIdg5QFRR7XCaK4LCjBiPbx8j4DQRpdYMnGn/bJUEU= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -1042,7 +996,6 @@ golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a h1:GuSPYbZzB5/dcLNCwLQLsg3obCJtX9IJhpXkvY7kzk0= golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= @@ -1108,7 +1061,6 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1120,14 +1072,12 @@ golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200828194041-157a740278f4 h1:kCCpuwSAoYJPkNc6x0xT9yTtV4oKtARo4RGBQWOfg9E= golang.org/x/sys v0.0.0-20200828194041-157a740278f4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201008064518-c1f3e3309c71 h1:ZPX6UakxrJCxWiyGWpXtFY+fp86Esy7xJT/jJCG8bgU= golang.org/x/sys v0.0.0-20201008064518-c1f3e3309c71/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -1177,12 +1127,10 @@ golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2 h1:L/G4KZvrQn7FWLN/LlulBtBzrLUhqjiGfTWWDmrh+IQ= golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200323144430-8dcfad9e016e h1:ssd5ulOvVWlh4kDSUF2SqzmMeWfjmwDXM+uGw/aQjRE= golang.org/x/tools v0.0.0-20200323144430-8dcfad9e016e/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -1192,19 +1140,14 @@ golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200828161849-5deb26317202 h1:DrWbY9UUFi/sl/3HkNVoBjDbGfIPZZfgoGsGxOL1EU8= golang.org/x/tools v0.0.0-20200828161849-5deb26317202/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20201020161133-226fd2f889ca/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= -gonum.org/v1/gonum v0.6.1 h1:/LSrTrgZtpbXyAR6+0e152SROCkJJSh7goYWVmdPFGc= gonum.org/v1/gonum v0.6.1/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= -gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0 h1:OE9mWmgKkjJyEmDAAtGMPjXu+YNeGvK9VTSHY6+Qihc= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= @@ -1230,9 +1173,7 @@ google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5 h1:tycE03LOZYQNhDpS27tcQdAzLCVMaj7QT2SXxebnpCM= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= @@ -1242,7 +1183,6 @@ google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRn google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= @@ -1253,7 +1193,6 @@ google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvx google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63 h1:YzfoEYWbODU5Fbt37+h7X16BWQbad7Q4S6gclTKFXM8= google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= @@ -1282,7 +1221,6 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0 h1:bO/TA4OxCOummhSf10siHuG7vJOiwh7SpRpFZDkOgl4= google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.28.1/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= @@ -1294,10 +1232,8 @@ google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLY google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0 h1:qdOKuR/EIArgaWNjetjgTzgVTAZ+S/WXVrq9HW9zimw= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= @@ -1306,7 +1242,6 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= @@ -1325,17 +1260,12 @@ gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRN gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5 h1:ymVxjfMaHvXD8RqPRmzHHsB3VvucivSkIAvJFDI5O3c= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/lib/go/test/token_test.go b/lib/go/test/token_test.go index 8253f778..a0bb66a3 100644 --- a/lib/go/test/token_test.go +++ b/lib/go/test/token_test.go @@ -3,9 +3,10 @@ package test import ( "testing" - "github.com/onflow/flow-emulator" + emulator "github.com/onflow/flow-emulator" sdktemplates "github.com/onflow/flow-go-sdk/templates" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/onflow/cadence" jsoncdc "github.com/onflow/cadence/encoding/json" @@ -256,6 +257,77 @@ func TestExternalTransfers(t *testing.T) { assert.Equal(t, CadenceUFix64("1000.0"), supply) }) + t.Run("Should be able to transfer to multiple accounts ", func(t *testing.T) { + + recipient1Address := cadence.Address(joshAddress) + recipient1Amount := CadenceUFix64("300.0") + + pair := cadence.KeyValuePair{Key: recipient1Address, Value: recipient1Amount} + recipientPairs := make([]cadence.KeyValuePair, 1) + recipientPairs[0] = pair + + script := templates.GenerateTransferManyAccountsScript(fungibleAddr, exampleTokenAddr, "ExampleToken") + + tx := flow.NewTransaction(). + SetScript(script). + SetGasLimit(100). + SetProposalKey( + b.ServiceKey().Address, + b.ServiceKey().Index, + b.ServiceKey().SequenceNumber, + ). + SetPayer(b.ServiceKey().Address). + AddAuthorizer(exampleTokenAddr) + + _ = tx.AddArgument(cadence.NewDictionary(recipientPairs)) + + signAndSubmit( + t, b, tx, + []flow.Address{ + b.ServiceKey().Address, + exampleTokenAddr, + }, + []crypto.Signer{ + b.ServiceKey().Signer(), + exampleTokenSigner, + }, + false, + ) + + // Assert that the vaults' balances are correct + script = templates.GenerateInspectVaultScript(fungibleAddr, exampleTokenAddr, "ExampleToken") + result, err := b.ExecuteScript( + script, + [][]byte{ + jsoncdc.MustEncode(cadence.Address(exampleTokenAddr)), + }, + ) + require.NoError(t, err) + if !assert.True(t, result.Succeeded()) { + t.Log(result.Error.Error()) + } + balance := result.Value + assert.Equal(t, CadenceUFix64("400.0"), balance) + + script = templates.GenerateInspectVaultScript(fungibleAddr, exampleTokenAddr, "ExampleToken") + result, err = b.ExecuteScript( + script, + [][]byte{ + jsoncdc.MustEncode(cadence.Address(joshAddress)), + }, + ) + require.NoError(t, err) + if !assert.True(t, result.Succeeded()) { + t.Log(result.Error.Error()) + } + balance = result.Value + assert.Equal(t, CadenceUFix64("600.0"), balance) + + script = templates.GenerateInspectSupplyScript(fungibleAddr, exampleTokenAddr, "ExampleToken") + supply := executeScriptAndCheck(t, b, script, nil) + assert.Equal(t, CadenceUFix64("1000.0"), supply) + }) + t.Run("Should be able to transfer tokens through a forwarder from a vault", func(t *testing.T) { script := templates.GenerateCreateForwarderScript( @@ -309,8 +381,7 @@ func TestExternalTransfers(t *testing.T) { jsoncdc.MustEncode(cadence.Address(exampleTokenAddr)), }, ) - - assert.Equal(t, CadenceUFix64("700.0"), result) + assertEqual(t, CadenceUFix64("400.0"), result) script = templates.GenerateInspectVaultScript(fungibleAddr, exampleTokenAddr, "ExampleToken") result = executeScriptAndCheck(t, b, @@ -319,12 +390,11 @@ func TestExternalTransfers(t *testing.T) { jsoncdc.MustEncode(cadence.Address(joshAddress)), }, ) - - assert.Equal(t, CadenceUFix64("300.0"), result) + assertEqual(t, CadenceUFix64("600.0"), result) script = templates.GenerateInspectSupplyScript(fungibleAddr, exampleTokenAddr, "ExampleToken") supply := executeScriptAndCheck(t, b, script, nil) - assert.Equal(t, CadenceUFix64("1000.0"), supply) + assertEqual(t, CadenceUFix64("1000.0"), supply) }) } diff --git a/transactions/create_forwarder.cdc b/transactions/create_forwarder.cdc index 6eabbe1a..9323dcae 100644 --- a/transactions/create_forwarder.cdc +++ b/transactions/create_forwarder.cdc @@ -45,4 +45,4 @@ transaction(receiver: Address) { target: /storage/exampleTokenForwarder ) } -} +} \ No newline at end of file diff --git a/transactions/privateForwarder/create_account_private_forwarder.cdc b/transactions/privateForwarder/create_account_private_forwarder.cdc new file mode 100644 index 00000000..4507d3be --- /dev/null +++ b/transactions/privateForwarder/create_account_private_forwarder.cdc @@ -0,0 +1,32 @@ +import FungibleToken from 0xFUNGIBLETOKENADDRESS +import ExampleToken from 0xTOKENADDRESS +import PrivateReceiverForwarder from 0xPRIVATEFORWARDINGADDRESS + +// This transaction is used to create a user's Flow account with a private forwarder + +transaction { + prepare(payer: AuthAccount) { + // Pay for the account creation with the Dapper payer + let acct = AuthAccount(payer: payer) + + // Destroy Dapper user's FLOW token receiver + acct.unlink(/public/flowTokenReceiver) + + // Create a private receiver + acct.link<&{FungibleToken.Receiver}>( + /private/flowTokenReceiver, + target: /storage/flowTokenVault + ) + let receiverCapability = acct.getCapability<&{FungibleToken.Receiver}>(/private/flowTokenReceiver) + + // Use the private receiver to create a private forwarder + let forwarder <- PrivateReceiverForwarder.createNewForwarder(recipient: receiverCapability) + + acct.save(<-forwarder, to: PrivateReceiverForwarder.PrivateReceiverStoragePath) + + acct.link<&PrivateReceiverForwarder.Forwarder>( + PrivateReceiverForwarder.PrivateReceiverPublicPath, + target: PrivateReceiverForwarder.PrivateReceiverStoragePath + ) + } +} \ No newline at end of file diff --git a/transactions/privateForwarder/create_private_forwarder.cdc b/transactions/privateForwarder/create_private_forwarder.cdc new file mode 100644 index 00000000..73cff707 --- /dev/null +++ b/transactions/privateForwarder/create_private_forwarder.cdc @@ -0,0 +1,26 @@ +import FungibleToken from 0xFUNGIBLETOKENADDRESS +import ExampleToken from 0xTOKENADDRESS +import PrivateReceiverForwarder from 0xPRIVATEFORWARDINGADDRESS + +// This transaction creates a new private receiver in an account that +// doesn't already have a private receiver or a public token receiver +// but does already have a Vault + +transaction { + + prepare(acct: AuthAccount) { + receiverCapability = signer.link<&ExampleToken.Vault{FungibleToken.Receiver}>( + /private/exampleTokenReceiver, + target: /storage/exampleTokenVault + ) + + let vault <- PrivateReceiverForwarder.createNewForwarder(recipient: receiverCapability) + + acct.save(<-vault, to: PrivateReceiverForwarder.PrivateReceiverStoragePath) + + signer.link<&{PrivateReceiverForwarder.Forwarder}>( + PrivateReceiverForwarder.PrivateReceiverPublicPath, + target: PrivateReceiverForwarder.PrivateReceiverStoragePath + ) + } +} diff --git a/transactions/privateForwarder/deploy_forwarder_contract.cdc b/transactions/privateForwarder/deploy_forwarder_contract.cdc new file mode 100644 index 00000000..9ff54564 --- /dev/null +++ b/transactions/privateForwarder/deploy_forwarder_contract.cdc @@ -0,0 +1,9 @@ +transaction(contractName: String, code: [UInt8], senderStoragePath: StoragePath, storagePath: StoragePath, publicPath: PublicPath) { + + prepare(signer: AuthAccount) { + + signer.contracts.add(name: contractName, code: code, senderStoragePath, storagePath, publicPath) + + } +} + diff --git a/transactions/privateForwarder/setup_and_create_forwarder.cdc b/transactions/privateForwarder/setup_and_create_forwarder.cdc new file mode 100644 index 00000000..517a805e --- /dev/null +++ b/transactions/privateForwarder/setup_and_create_forwarder.cdc @@ -0,0 +1,44 @@ + +import FungibleToken from 0xFUNGIBLETOKENADDRESS +import ExampleToken from 0xTOKENADDRESS +import PrivateReceiverForwarder from 0xPRIVATEFORWARDINGADDRESS + +// This transaction adds a Vault, a private receiver forwarder +// a balance capability, and a public capability for the receiver + +transaction { + + prepare(signer: AuthAccount) { + + if signer.borrow<&ExampleToken.Vault>(from: /storage/exampleTokenVault) == nil { + // Create a new ExampleToken Vault and put it in storage + signer.save( + <-ExampleToken.createEmptyVault(), + to: /storage/exampleTokenVault + ) + } + + signer.link<&{FungibleToken.Receiver}>( + /private/exampleTokenReceiver, + target: /storage/exampleTokenVault + ) + + let receiverCapability = signer.getCapability<&{FungibleToken.Receiver}>(/private/exampleTokenReceiver) + + // Create a public capability to the Vault that only exposes + // the balance field through the Balance interface + signer.link<&ExampleToken.Vault{FungibleToken.Balance}>( + /public/exampleTokenBalance, + target: /storage/exampleTokenVault + ) + + let forwarder <- PrivateReceiverForwarder.createNewForwarder(recipient: receiverCapability) + + signer.save(<-forwarder, to: PrivateReceiverForwarder.PrivateReceiverStoragePath) + + signer.link<&PrivateReceiverForwarder.Forwarder>( + PrivateReceiverForwarder.PrivateReceiverPublicPath, + target: PrivateReceiverForwarder.PrivateReceiverStoragePath + ) + } +} diff --git a/transactions/privateForwarder/transfer_private_many_accounts.cdc b/transactions/privateForwarder/transfer_private_many_accounts.cdc new file mode 100644 index 00000000..88bde15d --- /dev/null +++ b/transactions/privateForwarder/transfer_private_many_accounts.cdc @@ -0,0 +1,31 @@ +import FungibleToken from 0xFUNGIBLETOKENADDRESS +import ExampleToken from 0xTOKENADDRESS +import PrivateReceiverForwarder from 0xPRIVATEFORWARDINGADDRESS + +transaction(addressAmountMap: {Address: UFix64}) { + + // The Vault resource that holds the tokens that are being transferred + let vaultRef: &ExampleToken.Vault + + let privateForwardingSender: &PrivateReceiverForwarder.Sender + + prepare(signer: AuthAccount) { + + // Get a reference to the signer's stored vault + self.vaultRef = signer.borrow<&ExampleToken.Vault>(from: /storage/exampleTokenVault) + ?? panic("Could not borrow reference to the owner's Vault!") + + self.privateForwardingSender = signer.borrow<&PrivateReceiverForwarder.Sender>(from: PrivateReceiverForwarder.SenderStoragePath) + ?? panic("Could not borrow reference to the owner's Vault!") + + } + + execute { + + for address in addressAmountMap.keys { + + self.privateForwardingSender.sendPrivateTokens(address, tokens: <-self.vaultRef.withdraw(amount: addressAmountMap[address]!)) + + } + } +} diff --git a/transactions/transfer_many_accounts.cdc b/transactions/transfer_many_accounts.cdc new file mode 100644 index 00000000..2e2a1ac3 --- /dev/null +++ b/transactions/transfer_many_accounts.cdc @@ -0,0 +1,36 @@ +import FungibleToken from 0xFUNGIBLETOKENADDRESS +import ExampleToken from 0xTOKENADDRESS + +transaction(addressAmountMap: {Address: UFix64}) { + + // The Vault resource that holds the tokens that are being transferred + let vaultRef: &ExampleToken.Vault + + prepare(signer: AuthAccount) { + + // Get a reference to the signer's stored vault + self.vaultRef = signer.borrow<&ExampleToken.Vault>(from: /storage/exampleTokenVault) + ?? panic("Could not borrow reference to the owner's Vault!") + } + + execute { + + for address in addressAmountMap.keys { + + // Withdraw tokens from the signer's stored vault + let sentVault <- self.vaultRef.withdraw(amount: addressAmountMap[address]!) + + // Get the recipient's public account object + let recipient = getAccount(address) + + // Get a reference to the recipient's Receiver + let receiverRef = recipient.getCapability(/public/exampleTokenReceiver) + .borrow<&{FungibleToken.Receiver}>() + ?? panic("Could not borrow receiver reference to the recipient's Vault") + + // Deposit the withdrawn tokens in the recipient's receiver + receiverRef.deposit(from: <-sentVault) + + } + } +}