0xProject / 0x-launch-kit

Start an exchange in under a minute
https://0x.org/launch-kit
Apache License 2.0
382 stars 236 forks source link

Prompt for the Fee Asset Data #30

Open dekz opened 4 years ago

dekz commented 4 years ago

V2 assumed ZRX was the fee asset data and no prompt was made. In V3 Fee Asset data can be any token and isn't being set in the wizard.

MAKER_FEE_ASSET_DATA and TAKER_FEE_ASSET_DATA should be set in the backend container.

Prompt for the ERC20 contract address and encode as ERC20 asset data for the golden path.

SvenMeyer commented 4 years ago

@dekz maybe you can already give an example how a proper value set would look like in docker-compose.yml ?

dekz commented 4 years ago
backend:
        image: 0xorg/launch-kit-backend:v3
        environment:
            HTTP_PORT: '3000'
            CHAIN_ID: '1'
            WHITELIST_ALL_TOKENS: 'true'
            FEE_RECIPIENT: '0x0000000000000000000000000000000000000001'
            MAKER_FEE_UNIT_AMOUNT: '1'
            TAKER_FEE_UNIT_AMOUNT: '1'
            MAKER_FEE_ASSET_DATA: '0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
            TAKER_FEE_ASSET_DATA: '0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
            MESH_ENDPOINT: 'ws://mesh:60557'
        ports:
            - '3000:3000'

Should set the correct values when the order is created. Here both Maker and Taker fees are in WETH 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.

SvenMeyer commented 4 years ago

... and ..._FEE_UNIT_AMOUNT is whatever smallest unit that currency has, so in case of (W)ETH it would be 10^-18 ETH = 1 wei or is it percent of trade volume?

dekz commented 4 years ago

You are correct, for WETH it is wei.

Percentage based fees is not currently supported.

SvenMeyer commented 4 years ago

1) Thanks , that's good to know 2) Most exchanges work with a percentage based fee, as it is more fair (I would say). Would be great if that could be supported as well ...

vlddm commented 4 years ago

Got a error while creating order:

Unknown fee token: 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2

My setup is:

        MAKER_FEE_ASSET_DATA: '0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
        TAKER_FEE_ASSET_DATA: '0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
        MAKER_FEE_UNIT_AMOUNT: '100000000000000'
        TAKER_FEE_UNIT_AMOUNT: '100000000000000'
AdamSC1-ddg commented 4 years ago
backend:
        image: 0xorg/launch-kit-backend:v3
        environment:
            HTTP_PORT: '3000'
            CHAIN_ID: '1'
            WHITELIST_ALL_TOKENS: 'true'
            FEE_RECIPIENT: '0x0000000000000000000000000000000000000001'
            MAKER_FEE_UNIT_AMOUNT: '1'
            TAKER_FEE_UNIT_AMOUNT: '1'
            MAKER_FEE_ASSET_DATA: '0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
            TAKER_FEE_ASSET_DATA: '0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
            MESH_ENDPOINT: 'ws://mesh:60557'
        ports:
            - '3000:3000'

Should set the correct values when the order is created. Here both Maker and Taker fees are in WETH 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.

@dekz Can either of these fees be set to a relative address, for example can we take the maker side fee in wETH and then the taker side fee in the counter-party token? Such as by echoing out the relevant address on each call?

Since it is an open order relayer and has a forwarding contract I imagine we could set one of the fees to a specific token if we were only trading one pair ETH/[X], but its unclear how it would work if multiple pair types are available.