Aug 03, 2018
Staking Launch on Ropsten
Since we first launched our crowdsale back in early May, we’ve had just over 700 ETH contributed, allowing us to really dedicate the time to build LinkPool into a simple and easy to use platform for Chainlink nodes. Most of the large pieces of work for our launch are now complete or underway, and we can’t wait to keep on sharing more about what we’re building.
This update is going to focus on a lot of the recent work largely around the smart contract that powered our crowdsale, how distributions will work and how you can transfer your LP tokens.
Unsold Portion Distribution
In our last update, we announced that the all unsold portions of our crowdsale will be distributed to each contributor depending on how much they’ve contributed. I’m pleased to say that this has been completed, and the latest version of the contract has the new amounts added on-top.
To check your amount in the contract, on the “Read Contract” tab, enter the address you contributed from and you’ll see similar to:
'owners' response in Etherscan
To explain this further:
key: This is your unique key in the contract, mapped to your address. If you transfer all your tokens away and then some back, you will still retain the same key.
percentage: The % you’ll get of all tokens that get sent to this contract, for example from staking or NaaS. To calculate the exact percentage, divide your amount by 1000. So for the above screenshot, this would result in 37.000, i.e 37%. The image above is from one of the LinkPool wallets.
shareTokens: These are the transferable token representation of the percentage you own. The value given to you is in the smallest unit for Ethereum, wei. You can convert this value by using a website like http://eth-converter.com/ to give you your ether value.
We encourage everyone to check their new contribution amount in-case of any queries. We will be locking the contract on the 10th of August making it completely immutable.
The way distribution was executed was by a Truffle framework script that migrated the data from the old contract, increased each contributors share, deploying a new contract and then setting all the amounts as-if they was what was contributed originally.
For full transparency, this was uploaded to the GitHub repository for the PoolOwners contract and can be found here.
The distribution calculation from that script:
let contribution = Number(contributors.stakedAmounts[i].amount); let extraShare = contribution / totalAmount * unsold;
let totalContribution = contribution + extraShare;
let quoitent = (totalContribution / precision >> 0); totalContribution = quoitent * precision;
This snippet above shows how the distribution amount is calculated for each contributor. The contribution amount is divided by the total contributed (701.2 ether) then multiplied by the unsold amount. This provides the wei amount to add onto the existing contribution.
After that, the full amount is divided by the minimum precision of 0.04 ether taking the quotient, and then the quotient multiplied by the precision to get the complete amount. The reason we have to use a precision will be explained under token transfers.
To give a step by step process of how distribution works:
- Once the balance in the contract is greater than the minimum distribution threshold, distribution can be started by any one with an active ownership in the pool.
- When distribution is active, each owner can then claim their tokens, instantly adding them to their balance allowing them to be withdrawn at any time.
- Once every active owner has claimed their tokens, this will then mark distribution as complete.
That process can be repeated at any time as long as the contract balance is greater than the minimum threshold and distribution isn’t already active.
An unfortunate side-effect of this implementation is that the transferring of LP tokens between wallets is blocked when token distribution is active. This is to stop any problems during distribution and current percentages changing in the contract.
In regards to token claiming, any pool owner can claim any other active owners tokens on behalf of them. This is to ensure that the contract is never waiting on any one person to complete distribution; also allowing LinkPool to claim all tokens on behalf of owners, subsequently paying the gas.
The transferring of LP crowdsale tokens between wallets is now unlocked. Since the crowdsale dashboard isn’t yet completed, the only way to to transfer tokens is to manually interact on Etherscan or MEW.
To show how this is done on Etherscan:
- First click the Write Contract tab on the contract address.
- Scroll down to
- In the
_addressfield, enter the address of the wallet you’d like to send the tokens to.
- In the
_amountfield, enter the amount in wei you’d like to send. Remember, the amount has to be divisible by 0.04 ether. For example, 0.16 ether is fine, but 0.18 ether isn’t.
'sendOwnership' contract functionality
The reason for the minimum precision amount of 0.04 ether is due to the smallest percentage possible being 0.001%, represented as
1 in the contract. If amounts not divisible by the minimum precision was allowed, it would result in the total percentage of all owners in the contract to decrease from 100%.
Precision can be increased so the minimum percentage is 0.0001% for example, but this then increases the gas costs overall. We find the precision of 5 to be a perfect balance of gas cost and function.
The development of the crowdsale dashboard is now underway, with the first mocks being designed. This dashboard will have the following functionality:
- Show you a simple summary of your ownership, the percentage and the amount of tokens you hold.
- The amount of tokens you’ve earned while having active ownership, current amount of tokens unclaimed.
- Previous distributions, how many tokens were distributed, what token was distributed and the amount of owners that claimed.
- The easy ability to transfer LP tokens to another wallet.
With this now being in active development, we hope we can release it soon!
We’ve since upgraded the contract that was originally mentioned in this article and the link has been updated:
- Old: 0x18824bcda34ad2f4e4209521d9e49bd216fda6a3
- New: 0x3ab2ab661311501f4b3c9b17d40e3d95f9bc577f
Reasons for the upgrade:
- With the only way of sending ownership being the `sendOwnership` method, this makes the trust-less exchange of ownership tokens extremely difficult. I find this completely unfair on everyone as contributors, as if you’d like sell any portion of your contribution, the contract shouldn’t make that difficult for you.
- No way to currently batch claim tokens in the contract. A batch claiming will drastically reduce gas of claiming, and meaning that tokens can be claimed for everyone in one single transaction, block height depending.
- I’ve spotted an issue with a 3rd party library `ItMap` that is used in the contract. There’s no vulnerability, rather the sending of ownership can fail intermittently for a single person at certain times.
The upgraded contract will have methods similar to ERC20 & 677’s `transferAndCall`. This will allow DEX’s to be built easily around the ownership tokens. Creating a LP DEX isn’t high in our priority list, but something we’ll potentially look at in the future if there’s been no community effort.
Thanks for reading and your support!