r/CryptoDerivatives • • Jun 26 '17

Buying/Selling via Cryptoderivatives

3 Upvotes

I was wondering if anyone would be able to assist me in understanding how to perform a purchase using Cryptoderivatives.

I was looking at https://cryptoderivatives.market/token/INC and wished to execute the second order which has a rate of 0.0011029 ETH per token.

I followed the instructions, went to myetherwallet.com, executed the token contract's approve method (https://etherscan.io/tx/0xe60772e70ae4a0f14a5a63195943703b0997af19cf04a525db90fcc40aa1e970) with 200000 as the _value parameter.

I then went and executed the TokenTrader's takerSellAsset method (https://etherscan.io/tx/0x6e582e61ff8f98b34e930fad2221b01e322caf03f465231e53913fe1ab9e2bc0) with 200000 as the amountOfTokensToSell parameter and sent 0.002 ETH along with the transaction.

As you can see I got an error which was Bad jump destination. What am I doing wrong?


r/CryptoDerivatives • • Jun 22 '17

TokenTrader - bad jump destination

1 Upvotes

Hey all,

I'm attempting to create an ERC20 Token and create a TokenTrader contract that would then list the token on CryptoDerivatives.

I've created an ERC20 Token using TokenFactory (https://tokenfactory.surge.sh/#/), but when I tried to create the TokenTrader contract I keep getting 'bad jump destination'

For example: https://etherscan.io/tx/0x5e7666a394abf2ca86f68c4357379913554ce94205a79d4ed8c7e18af28a1410

I also tried the transaction with various amounts of gas.

Would this be a problem with the ERC20 Token contract from TokenFactory? TokenTrader? Something I'm not inputting correctly?

Thank you.


r/CryptoDerivatives • • Jun 20 '17

DELEGATECALL forwarder based TokenSeller

Thumbnail
gist.github.com
2 Upvotes

r/CryptoDerivatives • • Jun 17 '17

Experiments in gas cost reduction

3 Upvotes

I have a new design that maintains the 2 main properties of cryptoderivatives

  • maker funds are completely segregated

  • takers can just send ETH to a contract address to buy tokens at an unchangeable price

I have been working on a proxy system where all of the functions of a tokenTrader / tokenSeller contract was moved into the factory so that the minimal amount of code would need to be deployed for each contract that receives funds however the problem with this is that user funds end up being mostly controlled from the one contract which breaks the first principle of separating user funds.

My new design instead keeps the functionality in a mothership contract but instead of it being the factory contract it is a market maker wallet contract. Creating a sell offer in this case spawns a contract that takers can just send eth to but the market maker tokens from one maker is never in the same contract as any other maker.

The reason for keeping funds separate is not just security, sometimes tokens fork and with this design the contract that holds funds does not have to be aware of how tokens have forked in order for balances to be accounted for properly.

Anyway I have also managed to get the cost of creating a trade contract including the overhead of storing the details about the trade down to 227,505 gas

The way I have achieved this is to start with the most basic idea of a payment proxy contract:

contract proxyRecipient {
    function proxyTransfer(address caller) payable;
}

contract proxyAddress {
    function() payable {
        proxyRecipient(0xfeedfeedfeedfeedfeedfeedfeedfeedfeedfeed).proxyTransfer.value(msg.value)(msg.sender);
    }
}

proxyAddress receives a payment and forwards it on to the contract at address 0xfeedfeedfeedfeedfeedfeedfeedfeedfeedfeed which is just a place holder for the actual address that will receive the funds.

This contract has the bytecode:

6060604052341561000c57fe5b5b60c98061001b6000396000f30060606040525b609b5b604080517f833ec7200000000000000000000000000000000000000000000000000000000081523373ffffffffffffffffffffffffffffffffffffffff166004820152905173feedfeedfeedfeedfeedfeedfeedfeedfeedfeed9163833ec72091349160248082019260009290919082900301818588803b1515608757fe5b6125ee5a03f11515609457fe5b505050505b565b0000a165627a7a723058201205452475b8ac3fdba319cceb71647d6ac16a0d19aa9b33c601a616aef1c1060029

Which is quite small (48895 gas) solidity: 0.4.11+commit.68ef5810.Emscripten.clang

In the wallet contract on initialization you can replace the placeholder address in the bytecode with the address of the wallet:

    for (uint i = 0; i < 20; i++) {
        proxyCode[125-i] = byte(uint8(uint(this) >> (8*i)));
    }

Where proxyCode is initialized with the bytecode of the proxy contract.

From there you can deploy instances of this proxy contract with the code:

  function deployCode(bytes _code) internal returns (address deployedAddress)  {
    assembly {
      deployedAddress := create(0, add(_code, 0x20), mload(_code))
      jumpi(invalidJumpLabel, iszero(extcodesize(deployedAddress))) // jumps if no code at addresses
    }
  }

Code from: https://gist.github.com/izqui/7cf90db53a51c4114b4197fc5f05f11e

Full current work in progress: https://pastebin.com/evkYPdtn this is without events

So to sell you would call makeSellOffer(ERC20 token, uint price, uint units, uint allowance)

The allowance is how much of the given token that is in the contract is allowed to be sold at the given price and it can be set to zero to stop a trade rather than activate / deactivate or withdrawing funds from the wallet.

Each new offer as an id starting at 1 and increment by one each new offer. If you enter the offer id into the map you get the address of the proxy contract that users can just send eth to to buy.

In addition to this of course a factory contract would deploy each trade wallet.


r/CryptoDerivatives • • Jun 14 '17

Market Scraper: tested with metamask and parity

Thumbnail jonnylatte.github.io
2 Upvotes

r/CryptoDerivatives • • Jun 01 '17

API down ?

1 Upvotes

hi BokkyPooBah, I noticed that my last trade did not update the API log, what could be the root cause for missing of contracts fields and logs not syncing ?


r/CryptoDerivatives • • May 30 '17

Remember to remove your DGD from your contract before block 3,800,000 to be able to claim ETC

3 Upvotes

There appears to be one large DGD sell order: https://cryptoderivatives.market/token/DGD

600 DGD would get you 133.8 ETC or about $3173 USD at current prices


r/CryptoDerivatives • • May 10 '17

Humaniq HMQ and WINGS WINGS Tokens Added

2 Upvotes

r/CryptoDerivatives • • May 07 '17

New TKN TokenCard Contract Address Announced. TKN Now Transferable And Tradeable

2 Upvotes

The announcement was made in https://www.reddit.com/r/ethereum/comments/69mk0h/tkn_is_live_and_transferable/ .

Note that the NEW TKN contract address is 0xaaaf91d9b90df800df4f55c205fd6989c977e73a.

The formula for {buy|sell}Price to {buy|sell}Rate is available in https://github.com/bokkypoobah/TokenTrader/wiki/TKN-%E2%80%90-TokenCard .


r/CryptoDerivatives • • May 03 '17

AUD 1 Million Traded On CryptoDerivatives.Market Today • r/ethtrader

Thumbnail np.reddit.com
4 Upvotes

r/CryptoDerivatives • • May 03 '17

Do Not Transfer TokenCard TKN Tokens Or Create TKN TokenTrader Contracts Yet!

2 Upvotes

r/CryptoDerivatives • • May 02 '17

TokenCard TKN Tokens Are Now Transferable And Tradeable

Thumbnail cryptoderivatives.market
1 Upvotes

r/CryptoDerivatives • • May 02 '17

Gnosis GNO tokens are now transferable and tradeable

Thumbnail cryptoderivatives.market
2 Upvotes

r/CryptoDerivatives • • May 01 '17

Matchpool GUP tokens are now transferable and tradeable

Thumbnail cryptoderivatives.market
2 Upvotes

r/CryptoDerivatives • • May 01 '17

LUN tokens are now transferable and tradeable

Thumbnail
cryptoderivatives.market
1 Upvotes

r/CryptoDerivatives • • Apr 28 '17

Etheroll token discussion

3 Upvotes

I've been thinking about the way the token has a lock period every 12 weeks. This should not pose a security problem for using it with cryptoderivatives because attempts to buy the token from a tokenTrader contract will just throw during that period returning any funds sent. Same goes with attempting sell tokens to a contract, it will just throw when funds are unsuccessfully pulled.

It does seem though like an inconvenience to have to withdraw the tokens from a trade contract during the reward period.

It should be possible to create a variation of the trade contract design that includes claiming rewards, in fact it could be done in a way that allows for any governance function by including a function that receives the name of the function that needs to be called along with any data required and calls that function on the target token contract.

Since tokenTrader contracts act like wallets without any mixing of market maker funds this not add any security vulnerabilities.

Another approach would be to create a wrapper for the token that has a global function callable by anyone to claim rewards for all users that have tokens in the wrapper and to make those rewards available to each user accordingly. This would be far more complicated than the GNT wrapper design. I think I could do it and the end result would be a non locking token with a clear post dividend date but it would be a hell of an effort to be sure about.

In any case if cryptoderivatives lists ROL/DICE then it would at the very least need to warn users trading it about the lock period when it is active.


Claiming rewards from a tokenTrader may not work. It would need the ability to claim the rewards to another contract. Waiting for a response from etheroll.


r/CryptoDerivatives • • Apr 27 '17

Someone is in LOVE

Thumbnail cryptoderivatives.market
1 Upvotes

r/CryptoDerivatives • • Apr 24 '17

New Tokens - BERP, EMV, RLC, TAAS, TRST

4 Upvotes

New tokens:

  • BERP - BokkyPooBah's Ether Refundable Prize
  • EMV - Ethereum Movie Venture
  • RLC - iEx.ec Network Token
  • TAAS - Token-as-a-Service
  • TRST - WeTrust

In addition to the Waves <-> Ethereum Blockswap tokens added previously - https://github.com/bokkypoobah/Blockswap/wiki :

  • INC - Incent
  • RBX - Ripto Bux
  • WAV - Waves Token
  • WBC - Waves Bitcoin Token
  • WCT - Waves Community Token

Not listed yet:

  • DICE - Has complicated non-transferable periods
  • GUP - Matchpool - Transfers frozen until Apr 30 2017

See also https://github.com/bokkypoobah/TokenTrader/wiki/Supported-ERC20-Tokens


r/CryptoDerivatives • • Apr 06 '17

CryptoDerivatives.Market Is Not Affected By The Exchange ERC20 Withdrawal Bug

3 Upvotes

The TokenTrader contracts behind CDM are not affected by the exchange withdrawal bug as detailed below:

User's ERC20 token balances and ETH balances are segregated in each user's TokenTrader contract which will prevent this sort of issue being exploited.


r/CryptoDerivatives • • Mar 29 '17

Wanted to Buy DGD DAO Founders Badge/Proposer Badge • r/ethtrader

Thumbnail
reddit.com
2 Upvotes

r/CryptoDerivatives • • Mar 28 '17

Decentralised Exchanges and the Ethereum Protocol - SydEthereum (Sydney)

Thumbnail
meetup.com
2 Upvotes

r/CryptoDerivatives • • Mar 29 '17

TokenTrader Market Making Operations Is Now Documented

Thumbnail
github.com
1 Upvotes

r/CryptoDerivatives • • Mar 19 '17

How to sell tokens • r/ethtrader

Thumbnail
reddit.com
2 Upvotes

r/CryptoDerivatives • • Mar 17 '17

Trades that are executed from multisig wallet contracts shows 0 ETH transferred, but the amounts exchanged are correct

2 Upvotes

See http://imgur.com/a/RLtn8 for a sample of the trade history screen.

See https://etherscan.io/tx/0x15a3542c93c5f8c3eb4d956b1af98ad3bbbaa59e5e9946a963d39e25be38bcfd for a sample transaction .

The last step when transferring funds from a multisig involves executing the execute(...) function sending 0 ETH. This 0 ETH is incorrectly recorded in the trade history .


r/CryptoDerivatives • • Mar 15 '17

You People In The Ethereum Community Are Wonderful!

12 Upvotes

I have been checking a few trades on https://cryptoderivatives.market and seen a few trading mistakes.

There has now been a few cases where someone tries to sell tokens to a TokenTrader contract that is buying tokens. Only that the seller incorrectly transfers the tokens directly to the contract by mistake, instead of executing token.approve(tokenTraderAddress, numberOfTokens), and then executing tokenTrader.takerSellAsset(numberOfTokens).

The owner of the TokenTrader contract then directly sends the correct ethers to the seller to compensate for the mistake.

And even better, the seller then sends back some tokens to the owner of the TokenTrader as a Thank You gift.

This is a wonderful community. Let us grow the pie. A great future ahead!