SweetTech: The Sweetcoin Token Generation Event (SWC-TGE)

I thought that generating Sweetcoin would be an easy process of instantiating the token contract on the public chain. I was wrong of course.

We minted all the Sweetcoin that will ever be in one swoop on January 9 this year. It was quite an occasion. But this story is not just about an event, it is about some of the reasoning behind the token generation process.

Always account for the tax man

The IRS has a strong opinion on when it wants a share of the money that is transferred. You read correctly — transferring cryptocurrency constitutes a taxable event in the USA. This complicates things considerably.

Where should the money ideally go?

In order to avoid a tax bill in the millions, the accountants and lawyers advised us that the tokens would have to be minted into each initial account. This way, no transfer had taken place as the tokens had not existed before being stored in the distribution addresses.

The token contract

Some changes were necessary in the smart contract. The constructor had to contain the code for distributing all the minted tokens to a list of addresses. No big deal but the constructor went from looking like this:

function SweetTokenLogic(

address token_,

TokenData data_,

uint256 supply_,

address rolesContract)

TokenLogic(token_, data_, supply_, rolesContract) public

{}

to the slightly more complicated

function SweetTokenLogic(

address token_,

address tokenData_,

address rolesContract,

address[] initialWallets,

uint256[] initialBalances)

TokenLogic(token_, tokenData_, rolesContract) public

{

if (tokenData_ == address(0x0)) {

uint256 totalSupply;

require(initialBalances.length == initialWallets.length);

for (uint256 i = 0; i < initialWallets.length; i++) {

data.setBalances(initialWallets[i], initialBalances[i]);

token.triggerTransfer(address(0x0), initialWallets[i], initialBalances[i]);

totalSupply = Math.add(totalSupply, initialBalances[i]);

}

data.setSupply(totalSupply);

}

}

Readers with a keen eye will notice that this constructor does not account for the possibility of duplicate addresses in the initialWallets parameter. Change this before reusing this code.

Additionaly to the changes in the constructor we had to add a function in the token interface to trigger a transfer from the constructor. Our token contracts are split into Interface — Logic — Data The above constructor is the one for the Logic part. The code is available in our BitBucket.

Logistics of a distribution

For the standard version, we could have minted 100'000'000 Sweetcoins to one owner’s address and take our time in transferring the coins to the different distribution addresses. This was obviously not possible, as all the addresses needed to exist beforehand.

Multi-Signatures galore

Sweetbridge is a multinational organisation with divisions in 11 countries. In addition to those, early contributors and employees were getting their Sweetcoins in the TGE. This meant the creation of 28 multi signature wallets.

In normal times this would not have been a problem but in early January a trading frenzy occured. Pushing gas prices up to 100 Giga Wei (GW) and slowing transaction mining to a crawl.

It took us 5 hours to create the 28 multi-signature wallets. My advice: prepare your multi-sigs well in advance. It is impossible to predict a transaction frenzy. Transactions at 100GW are very costly.

Lessons learned

A regular transfer is a taxable event in the USA. If your organisation is in the USA or has ties to the USA, mind the IRS.

Plan your TGE well in advance. Especially if you will need a lot of multi-signature wallets to hold the tokens. If you have time to get this part done, your wallets will cost 100 times less. Literally.

You can create your token contract at any time, so choose a time with low transaction volume. Celebrate once the contract has been included in a block. Nothing bad will happen if your contract has been around for a week when you celebrate.

Use hardware wallets to secure your funds. Your project invested a lot of time, energy and money into your TGE, don’t get added to the list of hacked ICOs.

Success! Time for bubbles.

All in all a TGE can be one of the most exciting moments for a young project, as you get to see a new cryptocurrency appear. On the other hand, it simply means nothing can stand in the way of the important work of building network utility for the new token!