Tellers and Shops
Definition
From a usage perspective, the Dether protocol was created from day one with the idea of building a worldwide map of POIs (Points Of Interests) for any related crypto service. As a consequence, two main types of services exist in the current state of the world. On the one hand, individuals willing to buy and sell crypto. On the other hand, there are shops (retailers) willing to sell goods and services for crypto. Sometimes, an individual can have both activities. But in order to have the most accurate map possible, we chose tos differentiate those actors from the protocol level.
Tellers
Tellers are individuals willing to actively buy and/or sell crypto for cash locally. They can make a profit from it as they are free to chose their fee percentage on trades they operate. They first need to own a zone first in order to be visible on the map. As a zone owner, a teller is the exclusive crypto seller that appears on that zone on the map.
How does one become a Dether teller?
First, you need to own a zone: detherJS can be used for that.
Either the zone is free (no one owns the zone) and it is then possible to create a point of sale on it. Or the zone is already taken, and the only way to get it is to open an auction.
Create a zonein the smart contract
DTH tokens are sent through the ERC223 transfer() function of the DTH contract to the ZoneFactory.sol contract. The _data field is parsed with the information you have entered. If all the requirements are OK, and new Zone.sol and a new Teller.sol are created. These two contracts will be specific to this zone. Even if the teller decides to leave its zone, these 2 contracts will remain associated with this geohash6 forever, so only the owner changes.
In detherJS
In detherJS , you need to call this function with the right parameters and enough DTH tokens:
▸ createZone(password
: string, country
: string, geohash6
: string, amount
: number, txOptions
: ITxOptions): Promise‹ContractTransaction›
Defined in dether.ts:589
Parameters:
Name | Type | Value |
---|---|---|
password | string | Password of your wallet |
country | string | ISO 2 country code (https://www.iban.com/country-codes) |
geohash6 | string | 6 character geohash of the zone you want to create |
amount | number | Amount of DTH you want to stake on the zone (minimum 100 DTH), the address doing the transaction must have the DTH on its address |
txOptions | ITxOptions | Transaction options args. By defaults (constants.DEFAULT_TX_OPTIONS) |
Returns: Promise‹ContractTransaction›
Add teller info
Once a zone is owned, you can then add the teller's information on the newly deployed teller contract.
in the smart contractYou simply need to call the addTeller() function from the new deployed Teller.sol contract. You need to give some params (see detherJS for the full explanation of the params needed).
You can call the detherJS.addTeller() function with the right params defined in ITellerArgs .
▸ addTeller(password
: string, tellerData
: ITellerArgs, txOptions
: ITxOptions): Promise‹ContractTransaction›
Defined in dether.ts:337
Parameters:
Name | Type | Value |
---|---|---|
password | string | Password of your wallet |
tellerData | ITellerArgs | Arguments of the teller you want to add |
txOptions | ITxOptions | constants.DEFAULT_TX_OPTIONS |
Returns: Promise‹ContractTransaction›
You can find a full example here in addTellersAndShops.js,
Shops
Shops are the second main entity in the Dether protocol. They represent retailers willing to advertise to the Dether community of users the fact that they accept cryptocurrencies as a means of payment. They don't need to own a zone to be visible. When a shop registers its point of interest on a free zone (a zone that is not owned by a teller), the shop needs to stake at least 42 DTH to be visible. When a shop registers its point of interest on a taken zone (a zone that is owned by a teller), the shops pays a daily fee to the zone owner representing 1/42th of the staked tokens of the shop.
How to register a shop?In smart contractIt is necessary to send the required amount of DTH token to the [Shop.sol] contract with the ERC223 _transfer()_ function. You'll pass a geohash of 12 characters in params for the position you want. The smart contract will check if the position of the shop is in an opened country, and if the position is an owned zone. If it's on a free zone, the number of staked DTH remains the same until the shops is deleted (the staked DTH are then sent back to the address that created the shop), or until a teller owns the zone. If the zone is owned by a teller, you may need to stake more than 42 DTH depending on the staking price defined by the zone owner.
To know the price of the zone, it's possible to call:
If the zone is free, the staking price is 42 DTH without taxes. If the zone is owned, it can be whatever staking price the zone owner has previously set, along with a daily fee of 1/42th of the staking price.
In DetherJSEverything is handled in dehterJS, you only need to call this function
▸ addShop(password
: string, shopData
: IShopArgs, txOptions
: ITxOptions): Promise‹ContractTransaction›
Defined in dether.ts:438
Parameters:
Name | Type | Value |
---|---|---|
password | string | Password of your wallet |
shopData | IShopArgs | params of the shop you want to add |
txOptions | ITxOptions | Transaction options args. By defaults (constants.DEFAULT_TX_OPTIONS) |
Returns: Promise‹ContractTransaction›
To know the staking price to register a shop on a specific zone, you can call:
▸ getLicencePriceInZone(geohash6
: string): Promise‹string›
Defined in dether.ts:433
Parameters:
Name | Type |
---|---|
geohash6 | string |
Returns: Promise‹string›