An Ethereum smart contract which issues and trades a more regulator-friendly utility token. It is published in 2 versions: with external token(UtilityToken) and using ETH as external funds(UtilityTokenETHOnly).
when deploy it is need to pass parameters in to constructor
| name | type | description |
|---|---|---|
| name | string | name utility token. see ERC20 interface |
| symbol | string | symbol utility token. see ERC20 interface |
| community | address | address of community contract. can be zero then reward mechanism will not work |
| inviterCommission | uint256 | commission (mul by 1e6) to the inviting user, if the user who was invited by the inviter sent a reserve token. can be zero then reward mechanism will not work |
| reserveToken | address | address for external token. used only in UtilityToken.sol |
once installed will be use methods to exchange Note that contract accept tokens, it should be approve before
| name | type | value | description |
|---|---|---|---|
| DECIMALS | uint256 | 1e18 | Fraction part. |
| maxGasPrice | uint256 | 1*DECIMALS | maximum Gas Price(in wei) used for transaction. Transaction fail if reached limit |
| claimMorePerSeconds | uint256 | 10*DECIMALS | how many tokens available to claim after each second after contract deployed |
| claimInitialMax | uint256 | 1000000*DECIMALS | initial amount that can be claimed by contract without transactions failing |
| claimMaxLimit | uint256 | 1000000*DECIMALS | amount that can be claimed one-time by contract |
| claimReserveMinPercent | uint256 | 20 | Reserve min percent. Grant fails if we would have new nativeTokensOutstanding * exchangeRate > reserveTokensbalance * (100 - this number) / 100 |
| claimMaxPercent | uint256 | 2 | claim fails if nativeTokensbeingSent * exchangeRate > reserveTokensbalance * this number / 100 |
| claimDeficitMax | uint256 | 1000000 * DECIMALS | Grant fails if claimDeficitMax exceeds (nativeTokensOutstanding * exchangeRate - reserveTokensbalance) |
| claimLockupPeriod | uint256 | 100 | added limit in seconds for each claim |
| claimLockupPercent | uint256 | 100e4 | 100% mul 1e6. percent that would be lockup for each claim |
| claimGradual | bool | true | if true then limit is gradually decreasing |
| reserveTokenLimitPerDay | uint256 | 20e4 | limit for reserve token |
| method name | called by | contract | description |
|---|---|---|---|
| receiveReserveToken | anyone | UtilityToken.sol | method received Reserve Tokens. |
| receive | anyone | UtilityToken.sol | internal method triggered if contract getting ETH. but is not supported and through an exception |
| donateETH | anyone | UtilityTokenETHOnly.sol | Method used for donate ETH without receiving token |
| receive | anyone | UtilityTokenETHOnly.sol | internal method triggered if contract getting ETH |
| setMaxGasPrice | owner | boths | setting Gas Price(in wei) used for transactions |
| claimingTokenAdd | owner | boths | method add token for claiming |
| claimingTokensView | anyone | boths | returned list of claiming tokens |
| claimingTokensWithdraw | owner | boths | method to withdraw all claiming tokens |
| claim | anyone | boths | getting own tokens instead claimed tokens |
| transfer | anyone | boths | Overrode {ERC20-transfer} method. with rectrictions |
| amountLockUp | anyone | boths | Calculate amount of tokens need to be left at recipient's account |
| whitelistAdd | owner | boths | Adding addresses list to whitelist |
| whitelistRemove | owner | boths | Removing addresses list from whitelist |
| isWhitelisted | anyone | boths | Checks if a address already exists in a whitelist |
method received reserve tokens. Note that tokens need to approved before
internal method triggered if contract getting ETH. but is not supported and through an exception
Method used for donate ETH without receiving token
internal method triggered if contract getting ETH
Params:
| name | type | description |
|---|---|---|
| gasPrice | uint256 | maximum Gas Price(in wei) used for transaction |
Params:
| name | type | description |
|---|---|---|
| tokenForClaiming | address | added token for claiming |
| maxClaimingSpeed | uint256 | percent that we can claim from participant. mul by 1e6 |
| maxClaimingFrequency | uint256 | frequency in seconds that user can be able to claim |
| ownerCanWithdraw | bool | if true owner can withdraw clamed tokens |
| ownerThrottleWithdraw | uint256 | period than owner can withdraw clamed tokens (if ownerCanWithdraw param set true) |
| exchangeRate | uint256 | exchange rate claimed to native tokens. mul by 1e6 |
Returned list of claimng tokens
allow owner to withdraw all claimingTokens
getting utility tokens instead claimed tokens
Params:
| name | type | description |
|---|---|---|
| recipient | address | recipient |
| amount | uint256 | amount |
Overrode {ERC20-transfer} method. There are added some features:
- added validation of restriction limit to transfer
- if recipient is self contract than we will get tokens, burn it and transfer eth to sender (if whitelisted) In all over cases its simple ERC20 Transfer
Params:
| name | type | description |
|---|---|---|
| recipient | address | recipient |
Calculate amount of tokens need to be left at recipient's account
Params:
| name | type | description |
|---|---|---|
| _addresses | address[] | array of addresses which need to be added to whitelist |
Params:
| name | type | description |
|---|---|---|
| _addresses | address[] | array of addresses which need to be removed from whitelist |
Params:
| name | type | description |
|---|---|---|
| addr | address | address which need to be check |
contract can be used in two ways:
- if
ReserveTokenis exernal ERC20 token (UtilityToken.sol)(UT) - if
ReserveTokenis ETH currency (UtilityTokenETHOnly.sol)(UT_eth)
- want to exchange external Token to our Utility Token(UT)
- approve some external erc20 tokens to UT contract (.approve('<UT.address>', '')
- call method receiveReserveToken of UT contract (.receiveReserveToken('false'))
- want to exchange ETH to our Utility Token(UT_eth)
- send directly to UT_eth contract some ETH
- want to manage whitelist (owner option)
- call method whitelistAdd to add some addresses
- call method whitelistRemove to remove some addresses
- want to send UT back to contract (whitelisted user option)
- call method transfer of UT token to UT address (.transfer('<UT.address>', ''))
- want to send UT to some user (whitelisted user option)
- call method transfer of UT token (.transfer('', ''))