Smart contract of the “distillatory vessel” ambix.sol for interrupted ICO

Sergei Lonshakov
Robonomics Network by Airalab
3 min readJul 24, 2017

--

There is a contract Ambix.sol at Airalab. We are going to realize it for air token connection of the first and second phase.

In theory the same contract is possible to be used for interrupted ICO due to a found exposure of multisig wallets made in parity 1.5 or higher.

The description of the contract Ambix.sol

The contract Ambix.sol gives an opportunity to modify one set of tokens into another one according to the prescribed receipt. The receipt of the distillatory vessel is assigned with the following formula:

(N1 * A1 | N’1 * A’1 | N»1 * A»1 …)

& (N2 * A2 | N’2 * A’2 | N»2 * A»2 …) …

& (Nn * An | N’n * A’n | N»n * A»n …)

= M1 * B1 & M2 * B2 … & Mm * Bm

where A, B — input and output tokens

N, M — token value coeficients

n, m — input / output dimetion size

| — is alternative operator (logical OR)

& — is associative operator (logical AND)

Halfway through the distillation, an input token is burnt and we obtain the emission of an output token.

function run() {

TokenEmission token;

uint value;

uint i;

uint j;

// Take a source tokens

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

bool tokenBurned = false;

// Try to transfer alternatives and burn it

for (j = 0; j < rSource[i].length; ++j) {

token = rSource[i][j];

value = rSourceCoef[i][j];

if (token.transferFrom(msg.sender, this, value)) {

token.burn(value);

tokenBurned = true;

break;

}

}

if (!tokenBurned) throw;

}

// Generate sink tokens

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

token = rSink[i];

value = rSinkCoef[i];

token.emission(value);

if (!token.transfer(msg.sender, value)) throw;

}

}

The distillatory vessel in current conditions will not be able to deal with ERC20 tokens having no burn() and emission() function. Thereafter to allow basic ERC20 tokens working with the contract Ambix.sol it’s crucial to upgrade the contract. Afterwards the ICO continuation logic can be as follows.

How to continue an interrupted ICO

ICO can’t continue as the beneficiary of raised funds in the main ICO contract is the defenseless multisig contract beyond the interchange of this address.

The second part of the problem centers on the token emission, which is passed to the main ICO contract or else tokens, were issued in advance and transferred to the account of the main ICO contract.

It should come as no surprise that apparently to continue ICO it’s essential to design a new ICO contract specifying the new beneficiary.

In my opinion, it can be fulfilled this way:

  1. A new compatible ERC20 token contract that has emission function is created. for instance TokenEmission.sol
  2. A new main ICO contract specifying the new beneficiary and the new created token is designed.
  3. The emission of unexpanded before the attack on multisig tokens and their transfer to the new main ICO contract are accomplished.
  4. The contract of the distillatory vessel ambix.sol is built up which is shown the receipt, par example to create one new token for an input one (1:1)
  5. The contract Ambix.sol is appoint by the issuer of the new token contract

Thus, the rest of tokens can be distributed and the funds necessary for the team can be received in addition. All the tokens received before the end of the ICO will be able to be distilled to a new token contract. The community can feel certain that additional tokens will not be created after ICO as the emission function is given back non-returnable to the contract of the distillatory vessel.

All presented source code by Airalab is open and can be used under BSD 3-clause license: https://github.com/airalab/core/blob/master/LICENSE

--

--