Questions about transferring between partitions
lyonnee opened this issue · 1 comments
I am trying to deploy a set of UniversalToken contracts.
When I tried to use Golang to write a program to complete the contract interaction, I encountered some problems.
try to solve it myself, but I can’t solve any problem.
1.Why can only operators transfer between partitions?
2.When I failed to transfer tokens between partitions, I think there may be a problem with the parameters I passed in.
I assume that the contract has 3 partitions, namely A B C.
I want to transfer token from B partition to A partition.
`instance,_ := contract.NewCTCA(common.HexToAddress("0x7f74e35A58230C8Bc304eF5Ed7581F1F70bfEea8"),client)
fromPartition := [32]byte{}
copy(fromPartition[:],("B"))
tx,err := instance.OperatorTransferByPartition(auth,fromPartition,fromAddress,common.HexToAddress(""),big.NewInt(1000000000000000000),[]byte("A"),[]byte("A"));`
The above code executes the hash: 0x9719370a7720f7346cc3007c662383cdfddffdfdfb0f3fd93cac4e3fca1ca9a6
The result of the execution is successful, but the token is not transferred from partition A to partition B.
0x7f74e35A58230C8Bc304eF5Ed7581F1F70bfEea8 This is the contract I deployed on the Ropsten test network.
Is there a good demo for my reference?
Hello @lyonnee ,
Sorry for the late reply.
1.We're used to use the last "data"/"operatorData" parameter to inject a certificate like it is done in this example. If we use the "data" parameter to pass the certificate, we have no parameter left in transferByPartition function to inject the name of the destination partition, which is why we use the operatorTransferByPartition function, where:
- "data" is used to pass the destination partition
- "operatorData" is used to pass the certificate
Nevertheless, this doesn't mean only operators can transfer between partition: indeed, tokenHolders can call operatorTransferByPartition by indicating their own address as "from" address.
2.Here's an example of transfer between partitions.
The destination partition is the following:
0x6c6f636b65640000000000000000000000000000000000000000000000000000
The data needs to be the name of the destination partition preceded by the following flag:
0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
In conclusion, the "data" parameter needs to be:
0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6c6f636b65640000000000000000000000000000000000000000000000000000