Comments (4)
invokeTransferFrom()
is invoked not by token owner, but by spender, who have allowance to spend some amount from token owner, so:
- invoker.GetMSPId(), invoker.GetId() - spender
- fromMspId, fromCertId - owner
- toMspId, toCertId - recipient
you can see example in test https://github.com/s7techlab/cckit/blob/master/examples/erc20/erc20_test.go#L101
from cckit.
// getAllowance gets amount of token allowed by wallet owner to spend by spender
func getAllowance(c r.Context, ownerMspId, ownerCertId, spenderMspId, spenderCertId string) (int, error) {
return c.State().GetInt(allowanceKey(ownerMspId, ownerCertId, spenderMspId, spenderCertId), 0)
}
in the invokeTransferFrom()
function
invoker.GetMSPID()
andinvoker.GetID()
are spender requisitesfromMspId
,fromCertId
are wallet owner requisites
from cckit.
// getAllowance gets amount of token allowed by wallet owner to spend by spender func getAllowance(c r.Context, ownerMspId, ownerCertId, spenderMspId, spenderCertId string) (int, error) { return c.State().GetInt(allowanceKey(ownerMspId, ownerCertId, spenderMspId, spenderCertId), 0) }
in the
invokeTransferFrom()
function
invoker.GetMSPID()
andinvoker.GetID()
are spender requisitesfromMspId
,fromCertId
are wallet owner requisites
you're right. I mean, it would be the token owner to invoke transferFrom()
in the code above. So I think the Invoker's MspId should be placed in ownerMspId when calling getAllowance ()
.
What i understood...
in the invokeTransferFrom()
function
invoker.GetMSPId()
,invoker.GetId()
>> token ownerfromMspId
,fromCertId
>> token Sender
Please reply if I misunderstand.
from cckit.
@vitiko Thanks for answer.
I misunderstood the concept.
from cckit.
Related Issues (20)
- Main function of ERC20 example HOT 2
- ERC20 contract allowance check HOT 2
- ERC20 Contract invokeTransferFrom HOT 2
- router handler error: write: key from field *message.Commodity.XXX_NoUnkeyedLiteral: field type not supported for key extraction HOT 1
- Encryption extention can no longer depend on the shim/ext/entities
- Problem while running tests
- hlf-sdk-go: remove from deps or always update that to latest version
- ERC20 instructions mention dep
- when to upgrade fabric v2.x? HOT 1
- Can not run tests (Windows 10, go 1.14.2) HOT 1
- It there any way to use Stub.GetQueryResult? HOT 5
- NULL characters appearing in CouchDB when using composite keys HOT 2
- cckit unit test returns "not implemented" HOT 2
- Upgrade to fabric-go-chaincode HOT 1
- Initial Commands HOT 3
- Testing with mock data? HOT 1
- Getting a deprecation warning message while deploying a chaincode
- How to install the Chaincode in Example to Fabric Docker?
- chaincode to chaincode invokes dumps data into state on the wrong moment
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cckit.