Add abi signature encoding list
This commit is contained in:
parent
b1c03932ad
commit
2836b314f7
15
README.md
15
README.md
@ -658,16 +658,20 @@ Use cases of sealing include:
|
||||
|
||||
An backend contract to limit access to a resource by time.
|
||||
|
||||
The smart contract managing the resource calls ‘have(address)‘ on this
|
||||
The smart contract managing the resource calls `have(address)` on this
|
||||
contract to check if it can be made use of at the current point in time.
|
||||
This also implements [ACL](#acl).
|
||||
|
||||
When the resource is made use of, it calls ‘poke(address)‘ method to
|
||||
When the resource is made use of, it calls `poke(address)` method to
|
||||
register when it has been made use of.
|
||||
|
||||
The `next(address)` method returns the timestamp from which the resource
|
||||
may be used again by the given address. The implementer is permitted to
|
||||
change the value at any time.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
8f5bc7bf
|
||||
242824a9
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
@ -676,6 +680,11 @@ register when it has been made use of.
|
||||
// Implements ACL
|
||||
function have(address _address) external view returns(bool);
|
||||
|
||||
// Returns the timestamp when the resource may next be used by the given address.
|
||||
// A return value of 0 or a timestamp before the current timestamp indicates that the resource may used momentarily.
|
||||
// A return value of max uint265 can be used to indicate that the resource may never be used again by the address.
|
||||
function next(address _address) external returns(bool);
|
||||
|
||||
// Must be called when the resource is being used.
|
||||
function poke(address _address) external returns(bool);
|
||||
}
|
||||
|
@ -2,9 +2,11 @@
|
||||
|
||||
An backend contract to limit access to a resource by time.
|
||||
|
||||
The smart contract managing the resource calls `have(address)` on this contract to check if it can be made use of at the current point in time. This also implements @ref{acl, ACL}.
|
||||
The smart contract managing the resource calls @code{have(address)} on this contract to check if it can be made use of at the current point in time. This also implements @ref{acl, ACL}.
|
||||
|
||||
When the resource is made use of, it calls `poke(address)` method to register when it has been made use of.
|
||||
When the resource is made use of, it calls @code{poke(address)} method to register when it has been made use of.
|
||||
|
||||
The @code{next(address)} method returns the timestamp from which the resource may be used again by the given address. The implementer is permitted to change the value at any time.
|
||||
|
||||
|
||||
@subsubsection ERC165 Interface identifier
|
||||
|
@ -658,16 +658,20 @@ Use cases of sealing include:
|
||||
|
||||
An backend contract to limit access to a resource by time.
|
||||
|
||||
The smart contract managing the resource calls ‘have(address)‘ on this
|
||||
The smart contract managing the resource calls `have(address)` on this
|
||||
contract to check if it can be made use of at the current point in time.
|
||||
This also implements [ACL](#acl).
|
||||
|
||||
When the resource is made use of, it calls ‘poke(address)‘ method to
|
||||
When the resource is made use of, it calls `poke(address)` method to
|
||||
register when it has been made use of.
|
||||
|
||||
The `next(address)` method returns the timestamp from which the resource
|
||||
may be used again by the given address. The implementer is permitted to
|
||||
change the value at any time.
|
||||
|
||||
#### ERC165 Interface identifier
|
||||
|
||||
8f5bc7bf
|
||||
242824a9
|
||||
|
||||
#### Solidity interface definition
|
||||
|
||||
@ -676,6 +680,11 @@ register when it has been made use of.
|
||||
// Implements ACL
|
||||
function have(address _address) external view returns(bool);
|
||||
|
||||
// Returns the timestamp when the resource may next be used by the given address.
|
||||
// A return value of 0 or a timestamp before the current timestamp indicates that the resource may used momentarily.
|
||||
// A return value of max uint265 can be used to indicate that the resource may never be used again by the address.
|
||||
function next(address _address) external returns(bool);
|
||||
|
||||
// Must be called when the resource is being used.
|
||||
function poke(address _address) external returns(bool);
|
||||
}
|
||||
|
37
scripts/abilist.py
Normal file
37
scripts/abilist.py
Normal file
@ -0,0 +1,37 @@
|
||||
# standard imports
|
||||
import json
|
||||
import sys
|
||||
|
||||
# external imports
|
||||
import sha3
|
||||
|
||||
|
||||
f = open(sys.argv[1], 'r')
|
||||
o = json.load(f)
|
||||
f.close()
|
||||
|
||||
ks = []
|
||||
r = {}
|
||||
for v in o:
|
||||
if v['type'] != "function":
|
||||
continue
|
||||
name = ''
|
||||
try:
|
||||
name = v['name']
|
||||
except KeyError:
|
||||
continue
|
||||
args = []
|
||||
for vv in v['inputs']:
|
||||
args.append(vv['type'])
|
||||
sig = '{}({})'.format(name, ','.join(args))
|
||||
h = sha3.keccak_256()
|
||||
h.update(sig.encode('utf-8'))
|
||||
z = h.digest()
|
||||
k = z[:4].hex()
|
||||
#ks.append(k)
|
||||
r[k] = sig
|
||||
|
||||
ks = list(r.keys())
|
||||
ks.sort()
|
||||
for k in ks:
|
||||
print("{}\t{}".format(k, r[k]))
|
@ -9,6 +9,11 @@ interface IThrottle {
|
||||
// Implements ACL
|
||||
function have(address _address) external view returns(bool);
|
||||
|
||||
// Returns the timestamp when the resource may next be used by the given address.
|
||||
// A return value of 0 or a timestamp before the current timestamp indicates that the resource may used momentarily.
|
||||
// A return value of max uint265 can be used to indicate that the resource may never be used again by the address.
|
||||
function next(address _address) external returns(bool);
|
||||
|
||||
// Must be called when the resource is being used.
|
||||
function poke(address _address) external returns(bool);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user