Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to 0x

Avatar for 1VQ9 1VQ9
August 29, 2018

Introduction to 0x

Avatar for 1VQ9

1VQ9

August 29, 2018
Tweet

More Decks by 1VQ9

Other Decks in Technology

Transcript

  1. 0xProject - Introduction Mission Create a tokenized world where all

    value can flow freely. Mission statement શͯͷՁ஋͕ࣗ༝ʹߦ͖དྷ͢ΔɺτʔΫϯԽ͞ΕͨੈքΛ࡞Δ (Warren 2018)
  2. 0xProject - Introduction Y1SPUPDPM 0⒎DIBJOPSEFSSFMBZ 0ODIBJOTFUUMFNFOU Ϣʔβʔͷࢿ࢈Λ༬͔Βͳ͍ͨΊɺݖݶ͸ৗʹϢʔβʔʹ͋Δ ΦʔμʔϒοΫ͸ϒϩοΫνΣʔϯ্ʹͳ͍ͨΊɺνΣʔϯ΁ͷෛՙ͕গͳ͍ .BLFS͕&3$τʔΫϯͷBQQSPWFΛ࣮ߦ͠ɺ %&9DPOUSBDUʹτʔΫϯ"ͷҠಈΛڐՄ

     .BLFS͕PSEFSΦϒδΣΫτΛ࡞੒ͯ͠ൿີ伴Ͱॺ ໊͠ɺσʔλΛͳΜΒ͔ͷํ๏ 3FMBZFSͳͲ Ͱڞ༗͢Δ  0SEFSΦϒδΣΫτΛऔಘͨ͠5BLFS͸ަ׵ର৅ͷ &3$τʔΫϯ#ͷBQQSPWFΛ࣮ߦ͠ɺ%&9DPOUSBDU ʹτʔΫϯͷҠಈΛڐՄ͢Δ  5BLFS͕%&9ίϯτϥΫτͷpMM0SEFS"TZODΛ࣮ ߦ͠ɺ%&9ίϯτϥΫτ͕औҾΛ࣮ߦ͢Δ
  3. 0xProject - Introduction Y1SPUPDPM YKTFYBNQMF // Unlimited allowances to 0x

    proxy contract for maker and taker const setMakerAllowTxHash = await zeroEx.token.setUnlimitedProxyAllowanceAsync(ZRX_ADDRESS, makerAddress); await zeroEx.awaitTransactionMinedAsync(setMakerAllowTxHash); // Generate order const order = { maker: makerAddress, taker: ZeroEx.NULL_ADDRESS, feeRecipient: ZeroEx.NULL_ADDRESS, makerTokenAddress: ZRX_ADDRESS, takerTokenAddress: WETH_ADDRESS, exchangeContractAddress: EXCHANGE_ADDRESS, salt: ZeroEx.generatePseudoRandomSalt(), makerFee: new BigNumber(0), takerFee: new BigNumber(0), makerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(0.2), DECIMALS), // Base 18 decimals takerTokenAmount: ZeroEx.toBaseUnitAmount(new BigNumber(0.3), DECIMALS), // Base 18 decimals expirationUnixTimestampSec: new BigNumber(Date.now() + 3600000), // Valid for up to an hour };
  4. 0xProject - Introduction Y1SPUPDPM YKTFYBNQMF { "metadata" : { "takerToken"

    : { "name" : "Wrapped Ether", "decimals" : 18, "symbol" : "WETH" }, "makerToken" : { "symbol" : "ZRX", "name" : "0x", "decimals" : 18 } }, "signedOrder" : { "expirationUnixTimestampSec" : "1535607960", "maker" : "0x00 “, "makerFee" : "0", "feeRecipient" : "0x0000000000000000000000000000000000000000", "takerTokenAmount" : "1000000000000000000", "makerTokenAddress" : "0xe41d2489571d322189246dafa5ebde1f4699f498", "ecSignature" : { "r" : "0xc370fdb353f34c22499dcb299338f7152ab48258d9bafec85c40ff420c58b390", "s" : "0x1f08d374ec972fa4034275c174ac445b8b0a3e9e03b8eab0b2588c203d388ccc", "v" : 27 }, "takerFee" : "0", "makerTokenAmount" : "100000000000000000000", "salt" : "525051204772790397684327286494460896733275278658192814608150085920209666577", "taker" : "0x0000000000000000000000000000000000000000", "takerTokenAddress" : "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "exchangeContractAddress" : "0x12459c951127e0c374ff9105dda097662a027093" } } 0SEFS0CKFDUͷྫ
  5. 0xProject - Introduction Y1SPUPDPM YKTFYBNQMF // fill͢ΔྔΛܾΊΔ const shouldThrowOnInsufficientBalanceOrAllowance =

    true; const fillTakerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(0.1), DECIMALS); // fillOrderAsync Ͱfill͢Δ const txHash = await zeroEx.exchange.fillOrderAsync( signedOrder, fillTakerTokenAmount, shouldThrowOnInsufficientBalanceOrAllowance, takerAddress, );
  6. 0xProject - Relayers ΦʔμʔϒοΫͷϝϯςφϯε΍ྲྀಈੑͷڙڅɺϢʔβʔΠϯλʔϑΣʔεͷఏڙͳ ͲͷαʔϏεΛఏڙ͠ɺख਺ྉΛϢʔβʔ͔Β௃ऩ͢ΔऔҾॴ { ɹ“signedOrder" : { "expirationUnixTimestampSec"

    : "1535607960", "maker" : "0x00 ", "makerFee" : "0", "feeRecipient" : "0x0000000000000000000000000000000000000000", "takerTokenAmount" : "1000000000000000000", "makerTokenAddress" : "0xe41d2489571d322189246dafa5ebde1f4699f498", "ecSignature" : { "r" : "0xc370fdb353f34c22499dcb299338f7152ab48258d9bafec85c40ff420c58b390", "s" : "0x1f08d374ec972fa4034275c174ac445b8b0a3e9e03b8eab0b2588c203d388ccc", "v" : 27 }, "takerFee" : "0", "makerTokenAmount" : "100000000000000000000", "salt" : "525051204772790397684327286494460896733275278658192814608150085920209666577", "taker" : "0x0000000000000000000000000000000000000000", "takerTokenAddress" : "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "exchangeContractAddress" : "0x12459c951127e0c374ff9105dda097662a027093" } }
  7. 0xProject - Volume of 0x relayers Relayers 10+ Aggregate volume

    $200M+ Trades 120K+ 0x - NIFTY (Jul, 2018) https://0xtracker.com/
  8. References 0x - NIFTY (Jul, 2018) https://docs.google.com/presentation/d/1D5ybhJkNb7FYlIgHM3g37NBFSSI4XgkQecWbnsiBj1E/edit Welcome to the

    0x Community https://blog.0xproject.com/welcome-to-the-0x-community-9d99dfe0a52b The 0x Mission and Values https://blog.0xproject.com/the-0x-mission-and-values-181a58706f9f 18 Ideas for 0x Relayers in 2018 https://blog.0xproject.com/18-ideas-for-0x-relayers-in-2018-80a1498b955f