What is AmiShop ?
This version is the MVP version, its not suppose to reflect our entire version describe in our white paper.
What this version is supposed to do:
Allow shop and teller to add geolocalised point, to be visible by user reading smart contract.
For teller to have the possibility to sell ETH.
The map is cut in zone https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
And we store address of shop and teller in a mapping country => postal Code:
mapping(bytes2 => mapping(bytes16 => address[])) shopInZone;
This way someone could easily get all the shop in his postalcode by just call the function:
function getZoneShop(bytes2 _country, bytes16 _postalcode) public view returns (address[]) {
return shopInZone[_country][_postalcode];
}
He could then loop on the function getShop with all the address he gets from this previous function:
function getShop(address _shop) public view returns (
int32 lat,
int32 lng,
bytes2 countryId,
bytes16 postalCode,
bytes16 cat,
bytes16 name,
bytes32 description,
bytes16 opening
) {
Shop storage theShop = shop[_shop];
lat = theShop.lat;
lng = theShop.lng;
countryId = theShop.countryId;
postalCode = theShop.postalCode;
cat = theShop.cat;
name = theShop.name;
description = theShop.description;
opening = theShop.opening;
}
This smart contract is supposed to be used just like that by the most Dapps possible to show their user where they could spend their crypto or buy or sell cryptos.
We keep moderator roles contralised for now, but we will use decentralised arbitration court later to be able to delete illegal shop for example.
To be able to register a shop or a teller, the ethereum user need to be certified
we keep this role centralised as well for now but we'll use decentralised KYC services like uport soon.
To become a certified subscriber will either need to register their phone, or pass KYC.
To operate on a zone a shop or a teller will need to stake AMIS. The price will differ among zone and will be automatically calculated by the smart contract regarding different parameter like localisation, number of teller or shop already present. For now the price a user need to stake is set by the free decentralized marketplace as exposed in all the exchange offering Amis.
- The role of a Centralized moderator will be introduced with the v0.1.0b release:
Main actions:
-Set the licence price.
-Delete fraudulent shop/teller.
-Open/close zone (country).
-Certify user to be able to register.
To be integrated on the futures versions:
-Loyalty program
-Affiliate/referal program
-Auction system on zone and category.
-Dynamic licence pricing
-Decentralized moderation.
-Decentralized KYC
Upgradable VS non-upgradable
Some of these smart contracts may not be upgradable, only the funds and certification are due to reside on a separate contract which is upgrable, but for the data structure and the logic, we believe that many changes will come into play, so we keep things simple and cheaper in gas by having logic and data in the smart contract.
If someone registers a new point of Sale (POS) on the outdated contract during migration phase, a manual load with all deltas may have to be reprocessed onto the new smart contract.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
This repo its a truffle project, you first need to have truffle installed. And then install all the dependencies
npm install
truffle install bytes
Coming soon
You need to call:
function transfer(address _to, uint _value, bytes _data) public returns (bool);
Of the AMIS contract with the address of AmishopCore as a parameter
address _to
: AmishopCore addressuint _value
: At least the licence price for your zonebytes _data
: Formatted list of arguments- Data classification for shops, stores, retailers and Point of Sale:
PARAM | BYTES NUMBERS | value | value in hex |
---|---|---|---|
category | 1st | 1 for shop | 0x31 |
Latitude | 5 bytes | latitude * 10000 => if first bytes is 0x01 the value will be negative if not positive, then Hex value padded in 4 bytes - We keep 5 digit for the latitude parameter - So we need to multiply the parameter byt 10000 to store it on the EVM Exemple: 36.14081 * 10000 = 3614081 | 00496E39 |
Longitude | 5 bytes | longitude * 10000 => if first bytes is 0x01 the value will be negative if not positive, then Hex value padded in 4 bytes - We keep 5 digit for the longitude parameter - So we need to multiply the parameter byt 10000 to store it on the EVM Exemple:5.35360 * 10000 = 535360 | 000386BB |
CountryID | 2bytes | -Country Code ID. We use the ISO ALPHA 2 format: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 Ex for Gibraltar: GI | 4749 |
PostalCode | 16bytes | -Postal code value in ascii Hex, padded in 16 bytes Exemple for Gibraltar: GX11 1AA | 475831312031414100000000000000000000 |
Category | 16bytes | -Catogory value in ascii Hex, padded in 16 bytes. The category will be use for the search engine, and for the keyword staking keyword. Exemple: restaurant | 72657374617572616e74000000000000 |
Name | 16bytes | Name of the shop, in ascii Hex, padded in 16 bytes. Exemple: Cool shop | 436f6f6c204a6f620000000000000000 |
Description | 32bytes | Description of the shop, in ascii Hex, padded in 32 bytes Exemple: I sell cool things for ETH | 492073656c6c20636f6f6c207468696e677320666f7220455448000000000000 |
So the final _data
parameter will looks like:
0x3100496E39000386BB47494758313120314141000000000000000072657374617572616e74000000000000436f6f6c204a6f620000000000000000492073656c6c20636f6f6c207468696e677320666f7220455448000000000000
this hex string will be parsed on the fallback fonction of the AmishopCore
- FOR TELLER
PARAM | BYTES NUMBERS | value | value in hex |
---|---|---|---|
category | 1st | 2 for teller | 0x32 |
Latitude | 4 bytes | latitude * 10000 => Hex value padded in 4 bytes - We keep 5 digit for the latitude parameter - So we need to multiply the parameter byt 10000 to store it on the EVM Exemple: 36.14081 * 10000 = 3614081 | 00496E39 |
Longitude | 4 bytes | longitude * 10000 => Hex value padded in 4 bytes - We keep 5 digit for the longitude parameter - So we need to multiply the parameter byt 10000 to store it on the EVM Exemple:5.35360 * 10000 = 535360 | 000386BB |
CountryID | 2bytes | -Country Code ID. We use the ISO ALPHA 2 format: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 Ex for Gibraltar: GI | 4749 |
PostalCode | 16bytes | -Postal code value in ascii Hex, padded in 16 bytes Exemple for Gibraltar: GX11 1AA | 475831312031414100000000000000000000 |
AvatarID | 1 byte | -AvatarID for the front-end app, number in hexa -Value could be anything between 1-10 currently exemple : 1 | 31 |
CurrencyID | 1 byte | Number between 1 and 100 cf annexe1. Ex: 1 (= USD) | 31 |
messengerID | 16bytes | Nickname telegram to be contacted. In Ascii Hex value padded in 16 bytes. Ex: if the link of a telegram user is http://t.me/user1 , this user should put user1 in the field. Exemple: user1 | 75736572310000000000000000000000 |
rates | 2 bytes | Margin the ETH seller want to take from his trade, the value should be multiplied by 10 to keep a decimal when stored in EVM. Exemple: 5.6 % => 56 in hex padded in 2 bytes | 0038 |
The final _data
value will looks like:
0x3200496E39000386BB47494758313120314141000000000000000000003131757365723100000000000000000000000038 this hex string will be parsed on the fallback fonction of the DetherCore
A teller can update his data, however he can't move his location, if he want to do this he will have to delete his sell point, and then to recreate a new one.
UpdateTeller()
currencyId
: int8 - cf annexe1 for table of Currencymessenger
: telegram nickname (max 16 bytes)avatarId
: 1 - 100 value for avatarrates
: margin seller want to take * 10, for 8.7%, put 87online
: true if teller want to stay visible, false if teller want to pass offlinePAYABLE FUNCTION
, you can send ETH during transaction.
Test are located on the test/ folder, you can run it in the truffle console directly
truffle develop
test
You need to have an .env files with valid mnemonic phrase with ETH:
MNEMONIC = "xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx"
Then deploy (on kovan, ropsten):
truffle migrate --network kovan
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
- Mehdi Amari - Fukunaga42
- Stéphane Roche - Janaka-Steph
- Amisolution - Amisolution
This project is licensed under the MIT License - see the LICENSE.md file for details