Syntax & Smart Contract requirements

How to get full advantage of the feature.

General syntax model:

  • // ACL commented line. (top code recommended)

  • var input = {}: Smart Contract object. Data structure where the requested metadata(headers, path, jwt, etc.) is stored.

  • if(ACL)=>{}statement, deploy conditions. This is the ACL-feature execution context, indeed.

  • throw excepted output.

This are the requirements to implement successfully the ACL feature. Let's dive a bit into them just to understand the context of their implementation.

"// ACL" comment: new instance of ACL execution is required.

var intput = {}; reserve memory location for self execution inputs.

if(ACL){

if (path[2] === "_storage"){

res= { private:"you have no perms to see this" };

sendResponse(res);

}else { <Smart-Contract-Logic> }

This statement is the place to deploy every case in which the ACL should throw anything special. for example: "this route should be private" or "this request should return directly data".

"Throw Exception" if custom actions are required otherwise will execute a normal API request.

Last updated