README.md (1827B)
1 # erc20-limiter 2 3 These smart contract implementations define value limits for tokens by holders. 4 5 The contracts satisfy the [CIC TokenLimit](https://git.grassecon.net/cicnet/cic-contracts/#tokenlimit) interface. 6 7 8 ## Defining limits 9 10 The `setLimit(token, value)` method set the limit of `token` that the transaction signer will accept to `value`. 11 12 Values are _inclusive_; if `42` is returned, a balance up to and including `42` should be approved. 13 14 A limit of `0` means that the "holder" will categorically not accept a token. 15 16 17 ### Defining limits for contracts 18 19 An alternative `setLimitFor(token, holder, value)` method exists, where the contract `owner` may change the limit for a _smart contract_. 20 21 If smart contract capable of transacting against this method itself does so, the result is the same as if that contract called `setLimit()`. 22 23 The `owner` for the contract defined and managed according to the [ERC173](https://eips.ethereum.org/EIPS/eip-173) standard. 24 25 26 ## Honoring limits 27 28 Limits will only be honored if integrated into the proper context. 29 30 One example of context is to implement a limit check in the `transfer` and `transferFrom` methods of ERC20 tokens. 31 32 33 ## ACL Index variant 34 35 The `LimitIndex.sol` contract variant includes an implementation of the [CIC ACL](https://git.grassecon.net/cicnet/cic-contracts/#acl) interface. 36 37 In this case, any non-zero limit of a token for a holder results in a `true` value being returned. Otherwise, `false` is returned. 38 39 The `LimitIndex.sol` contract takes a regular `Limit.sol` token address as argument, or more specifically a contract that satisfies this interface: 40 41 ``` 42 interface Limiter { 43 function limitOf(address,address) external view returns(uint256); 44 function setLimit(address,uint256) external; 45 function setLimitFor(address,address,uint256) external; 46 } 47 ```