A synthetic token is an ERC20 smart contract that proof of ownership of the original token. The owner of synthetic tokens has the right to exchange his token for the original using the properties of the contract.
npm install
truffle run coverage
truffle dashboard
truffle migrate --network dashboard
When we create a synthetic token, we need to stick to the settings of the original token.
- Decimal numbers must be the same as the original token
- If the capitalization of the synthetic token is greater than the original token, we will not be able to block the original tokens
- Synthetic token contract can't work without Locked-Deal contract
constructor(
string memory _name, // token name
string memory _symbol, // token symbol
uint _cap, // set the capitalization of synthetic tokens
uint8 _decimals, // token decimals
address _owner, // who will take synthetic tokens
address _lockedDealAddress, // can't be zero address
address _whitelistAddress
)
Testnet tx (without a whitelist): link
Testnet tx (with a whitelist): link
Using SetLockingDetails function allows us to transfer one-time original tokens to a contract of synthetic tokens.
// Can only use the owner address or Governer contract.
SetLockingDetails(
address _tokenAddress, // address of original token
uint64[] calldata _unlockTimes, // times when we can unlock original tokens
uint8[] calldata _ratios, // ratios for the time how much we take
uint256 _finishTime // after finish time we can transfer tokens
)
Testnet tx: link
getActivationResult is view function that returns main information about locking tokens.
- Total tokens
- Creditable amount
- Unlock times
- Unlock amounts
getActivationResult(uint _amountToActivate)
public
view
returns(uint TotalTokens, uint CreditableAmount, uint64[] memory unlockTimes, uint256[] memory unlockAmounts)
Each user that have synthetic tokens can “Open” the Envelope to receive the original token. User can open the Envelopes only after the expiration of the agreement by using Locked-Deal contract.
// try to take original tokens if time is up or create new locked pools
ActivateSynthetic(uint _amountToActivate)
//or
ActivateSynthetic() // _amountToActivate = balance of the tokens that the sender has
Testnet tx (without a creating new pool): link
Testnet tx (with a creating new pool): link
The-Poolz Contracts is released under the MIT License.