Architecture overview

The Dether system

All the main smart contracts are described in this section: what they do and why. You can find all the addresses of the deployed contracts below:


ZoneFactory.sol is the contract that handles the zone creation mechanism through the tokenFallback() function.
We use the EIP1167CloneFactory.sol to deploy new Zone.sol and Teller.sol contract to save gas cost.

Once created, you can get the zone contract address through different getters:

mapping(bytes6 => address) public geohashToZone; // get the zone contract if exist
mapping(address => bytes6) public zoneToGeohash; // get the geohash associated with the zone contract
mapping(address => address) public ownerToZone; // get the zone owned from the owner address
mapping(address => address[]) public zoneToAuctionBidders; // get bidder on a zone auction
mapping(address => address) public activeBidderToZone; // get the zone a user address is an active bidder on

It's also the contract to listen for all the events going through the protocol. All the zone contracts will emit events through this ZoneFactory.sol contract.



Each geohash6 on Earth has its own Zone.sol contract, in charge of managing its ownership and get taxes. There are two kinds of taxes on the Zone.sol contract.
Zone owner taxes: every day, a zone owner pays 0.04% of what he has staked in DTH to occupy the zone. It's around 15% APR.
Auction taxes: if a user wants to open an auction on a zone, he needs to pay 4% in DTH tokens to be able to start bidding on this zone.

The auction management goes through the tokenFallback() function, by sending DTH to the Zone.sol contract, with the info in the _data field.



Each geohash6 contract has its associated teller contract. This contract is in charge for managing the teller's information. There is a comment section, supposed to get hash of IPFS comments. The comments are associated with the current teller owner. As a result, if a zone ownership changes, a new comment will not be associated with the old zone owner.



This contract handles all actions related to Shops. When a shop registers itself on the map, it's only necessary to use the tokenFallback() of this contract.
It is needed to provide a geohash of 12 characters to determine the shop's position. If this geohash is on a zone where there is no zone owner, the shops stakes 42 DTH without the need to pay any taxes. If the zone is owned by a teller, the shops stakes (a minimum of) the amount of DTH determined by the zone owner and pays to the the zone owner a daily fee of 1/42 of what the shop's staked in DTH.



This contract handles the country data. We mapped the entire world by groups of geohash of 4 characters representing a country. Each country group is associated with a ISO country code 2. When a user wants to open a zone, we are able to verify the information by comparing the first 4 characters of the geohash provided if the geohash6 is on an open country.
Anyone is free to open a new country where they want to operate using the Dether protocol. The Dether team opened a specific list of countries where we decided to operate in our front-end app.



This contract handles all the taxes getted from the protocol. There is a recipient who can withdraw the DTH. But it's not decided yet who it is and if the recipient will be a developer fund or if the recipient will be a null address. Once the recipient changes, it will be irreversible.



This contract is not used yet. It may be activated later on, in another form. It's supposed to handle disputes cases for shops listings. For now, the zone owner is the final referee as he can decide to delete, or not, a shop from his zone.