Melcor
The core smart contract of the platform.
AllowedToken
setAllowedToken
setAllowedToken(
uint256 _tokenId,
address _token,
uint8 _fee,
bool _disabled
) internal onlyOwner
Writes the AllowedToken parameters to the contract.
Parameters:
Name | Type | Description |
---|---|---|
_tokenId | uint256 | Token ID |
_token | address | Token Address |
_fee | uint256 | Commission when using a token |
_disabled | bool | Allows to enable/disable the token |
addAllowedToken
function addAllowedToken(address _token, uint256 _fee) external
Adds a token that can be used in calculations on the platform. Uses the setAllowedToken function
Parameters:
Name | Type | Description |
---|---|---|
_token | address | Address of token |
_fee | uint256 | Commission when using a token |
updateAllowedToken
function updateAllowedToken(
uint256 _tokenId,
address _token,
uint8 _fee,
bool _disabled
) external
Updates an existing AllowedToken.
Parameters:
Name | Type | Description |
---|---|---|
_tokenId | uint256 | Token ID |
_token | address | Token Address |
_fee | uint256 | Commission when using a token |
_disabled | bool | Allows to enable/disable the token |
DeliveryCountry
setDeliveryCountry
function setDeliveryCountry(
uint256 _deliveryCountryId,
string memory _metadata
) internal
Writes the DeliveryCountry parameters to the contract.
Parameters:
Name | Type | Description |
---|---|---|
_deliveryCountryId | uint256 | Delivery Country ID |
_metadata | string memory | IPFS CID |
createDeliveryCountry
function createDeliveryCountry(string memory _metadata) external
Adds a delivery country.
Parameters:
Name | Type | Description |
---|---|---|
_metadata | string memory | IPFS CID |
updateDeliveryCountry
function updateDeliveryCountry(
uint256 _deliveryCountryId,
string memory _metadata
) external
Updates a delivery country.
Parameters:
Name | Type | Description |
---|---|---|
_deliveryCountryId | uint256 | Delivery Country ID |
_metadata | string memory | IPFS CID |
ProductCategory
setProductCategory
function setProductCategory(
uint256 _productCategoryId,
string memory _metadata
) internal onlyOwner
Writes the ProductCategory parameters to the contract.
Parameters:
Name | Type | Description |
---|---|---|
_productCategoryId | uint256 | Product Category Id |
_metadata | string memory | IPFS CID |
createProductCategory
function createProductCategory(string memory _metadata) external
Adds a product category.
Parameters:
Name | Type | Description |
---|---|---|
_metadata | string memory | IPFS CID |
updateProductCategory
function updateProductCategory(
uint256 _productCategoryId,
string memory _metadata
) external
Updates an existing product category.
Parameters:
Name | Type | Description |
---|---|---|
_productCategoryId | uint256 | Product Category Id |
_metadata | string memory | IPFS CID |
Store
setStore
function setStore(
uint256 _storeId,
string memory _metadata,
uint256[] memory _deliveryCountries,
address _owner,
uint16 _score,
bool _disabled
) internal
Writes the Store parameters to the contract.
Parameters:
Name | Type | Description |
---|---|---|
_storeId | uint256 | Store ID |
_metadata | string memory | IPFS CID |
_deliveryCountries | uint256[] memory | Delivery Countries IDS |
_owner | address | Owner Address |
_score | uint26 | Score |
_disabled | bool | Allows to enable/disable the store |
createStore
function createStore(
string memory _metadata,
uint256[] memory _deliveryCountries,
bool _disabled
) external
Adds a store.
Parameters:
Name | Type | Description |
---|---|---|
_metadata | string memory | IPFS CID |
_deliveryCountries | uint256[] memory | Delivery Countries IDS |
_disabled | bool | Allows to enable/disable the store |
updateStore
function updateStore(
uint256 _storeId,
uint256[] memory _deliveryCountries,
string memory _metadata,
bool _disabled
) external
Updates an existing store.
Parameters:
Name | Type | Description |
---|---|---|
_storeId | uint256 | Store ID |
_deliveryCountries | uint256[] memory | Delivery Countries IDS |
_metadata | string memory | IPFS CID |
_disabled | bool | Allows to enable/disable the store |
changeStoreVendorStatus
function changeStoreVendorStatus(
uint256 _storeId,
address _vendor,
bool _status
) external
Makes the specified user a shop vendor.
Parameters:
Name | Type | Description |
---|---|---|
_storeId | uint256 | Store ID |
_vendor | address | Vendor Address |
_status | bool | 'true' authorizes, 'false' removes |
updateStoreScore
function updateStoreScore(
uint256 _storeId,
bool _positive,
uint16 _amount
) external
Updates a product score.
Parameters:
Name | Type | Description |
---|---|---|
_storeId | uint256 | Score ID |
_positive | bool | 'true' to raise the rating, else 'false' |
_amount | uint256 | Score Amount |
Collection
setCollection
function setCollection(
uint256 _collectionId,
uint256 _storeId,
uint256 _productCategoryId,
string memory _metadata,
address _owner,
bool _disabled
) internal
Writes the Collection parameters to the contract.
Parameters:
Name | Type | Description |
---|---|---|
_collectionId | uint256 | Collection ID |
_storeId | uint256 | Store ID |
_productCategoryId | uint256 | Product Category ID |
_metadata | string memory | IPFS CID |
_owner | address | Owner Address |
_disabled | bool | Allows to enable/disable the collection |
createCollection
function createCollection(
uint256 _storeId,
uint256 _productCategoryId,
string memory _metadata,
bool _disabled
) external
Adds a collection.
Parameters:
Name | Type | Description |
---|---|---|
_storeId | uint256 | Store ID |
_productCategoryId | uint256 | Product Category ID |
_metadata | string memory | IPFS CID |
_disabled | bool | Allows to enable/disable the collection |
updateCollection
function updateCollection(
uint256 _collectionId,
uint256 _storeId,
uint256 _productCategoryId,
string memory _metadata,
bool _disabled
) external
Updates an existing collection.
Parameters:
Name | Type | Description |
---|---|---|
_collectionId | uint256 | Collection ID |
_storeId | uint256 | Store ID |
_productCategoryId | uint256 | Product Category ID |
_metadata | string memory | IPFS CID |
_disabled | bool | Allows to enable/disable the collection |
createBaseCollection
function createBaseCollection(
uint256 _productCategoryId,
string memory _metadata
) external onlyOwner
Adds a base collection.
Parameters:
Name | Type | Description |
---|---|---|
_productCategoryId | uint256 | Product Category ID |
_metadata | string memory | IPFS CID |
Product
setProduct
function setProduct(
uint256 _productId,
uint256 _storeId,
string memory _metadata,
uint256 _tokenId,
uint256 _collectionId,
address _vendor,
uint256 _amount,
uint256[3] memory _deposit,
uint16 _score,
bool _needGuarantor,
bool _disabled
) internal
Writes the Product parameters to the contract.
Parameters:
Name | Type | Description |
---|---|---|
_productId | uint256 | Product ID |
_storeId | uint256 | Store ID |
_metadata | string memory | IPFS CID |
_tokenId | uint256 | Allowed Token ID |
_collectionId | uint256 | Your Store Collection ID |
_vendor | address | Vendor Address |
_amount | uint256 | Product Amount |
_deposit | uint256[3] memory | [Price, Vendor Deposit, Customer Deposit] |
_score | uint16 | Score |
_needGuarantor | bool | 'true' for Guarantor System, 'false' for Deposit System |
_disabled | bool | Allows to enable/disable the collection |
createProduct
function createProduct(
uint256 _storeId,
string memory _metadata,
uint256 _tokenId,
uint256 _collectionId,
uint256 _amount,
uint256[3] memory _deposit,
bool _needGuarantor,
bool _disabled
) external
Creates a product.
Parameters:
Name | Type | Description |
---|---|---|
_storeId | uint256 | Store ID |
_metadata | string memory | IPFS CID |
_tokenId | uint256 | Allowed Token ID |
_collectionId | uint256 | Your Store Collection ID |
_amount | uint256 | Product Amount |
_deposit | uint256[3] memory | [Price, Vendor Deposit, Customer Deposit] |
_needGuarantor | bool | 'true' for Guarantor System, 'false' for Deposit System |
_disabled | bool | Allows to enable/disable the collection |
updateProduct
function createProduct(
uint256 _productId,
uint256 _storeId,
string memory _metadata,
uint256 _tokenId,
uint256 _collectionId,
uint256 _amount,
uint256[3] memory _deposit,
bool _needGuarantor,
bool _disabled
) external
Updates an existing product.
Parameters:
Name | Type | Description |
---|---|---|
_productId | uint256 | Product ID |
_storeId | uint256 | Store ID |
_metadata | string memory | IPFS CID |
_tokenId | uint256 | Allowed Token ID |
_collectionId | uint256 | Your Store Collection ID |
_amount | uint256 | Product Amount |
_deposit | uint256[3] memory | [Price, Vendor Deposit, Customer Deposit] |
_needGuarantor | bool | 'true' for Guarantor System, 'false' for Deposit System |
_disabled | bool | Allows to enable/disable the collection |
updateProductScore
updateProductScore(
uint256 _productId,
bool _positive,
uint16 _amount
) external
Updates a product score.
Parameters:
Name | Type | Description |
---|---|---|
_productId | uint256 | Product ID |
_positive | bool | 'true' to raise the rating, else 'false' |
_amount | uint256 | Score Amount |
Order
setOrder
function setOrder(
uint256 _productId,
string memory _metadata,
address _customer,
uint16 _amount
) internal
Writes the Order parameters to the contract.
Parameters:
Name | Type | Description |
---|---|---|
_productId | uint256 | Product ID |
_metadata | string memory | IPFS CID |
_customer | address | Customer Address |
_amount | uint16 | Product Amount |
createOrder
function createOrder(
uint256 _productId,
string memory _metadata,
uint16 _amount
) external
Creates an Order.
Parameters:
Name | Type | Description |
---|---|---|
_productId | uint256 | Product ID |
_metadata | string memory | IPFS CID |
_amount | uint16 | Product Amount |
createMultiOrder
function createMultiOrder(
uint256[] memory _productIds,
string[] memory _metadata,
uint16[] memory _amount
) external
Creates an few Orders.
Parameters:
Name | Type | Description |
---|---|---|
_productId | uint256[] memory | Products IDs |
_metadata | string[] memory | IPFS CIDs |
_amount | uint16[] | Product Amount |
acceptOrder
function acceptOrder(
uint256 _orderId,
uint256 _guarantorId,
string[3] memory _keys
) external
Allows the vendor to accept an offer to purchase a product.
Parameters:
Name | Type | Description |
---|---|---|
_orderId | uint256 | Order ID |
_guarantorId | uint256 | Guarantor ID |
_keys | string[3] memory | [Vendor Encrypted key, Customer Encrypted key, Guarantor Encrypted key] |
For more information about encryption, see the Messaging section.
depositOrder
function depositOrder(uint256 _orderId) external
Deposits funds from the customer's to the escrow smart contract.
Parameters:
Name | Type | Description |
---|---|---|
_orderId | uint256 | Order ID |
deliveryOrder
function deliveryOrder(uint256 _orderId) external
Changes the status of the order to SHIPPED.
Parameters:
Name | Type | Description |
---|---|---|
_orderId | uint256 | Order ID |
confirmOrder
function confirmOrder(
uint256 _orderId,
uint8 _productGrade,
uint8 _vendorGrade,
uint8 _guarantorGrade,
string memory _metadata
) external
Transfers funds from the escrow smart contract to the vendor's account.
Parameters:
Name | Type | Description |
---|---|---|
_orderId | uint256 | Order ID |
_productGrade | uint8 | Product Grade |
_vendorGrade | uint8 | Vendor Grade |
_guarantorGrade | uint8 | Guarantor Grade |
_metadata | string memory | IPFS CID |
setPubKey
function setPubKey(bytes memory _publicKey) external
Sets the public encryption key for the address.
Parameters:
Name | Type | Description |
---|---|---|
_publicKey | bytes memory | Public Key |
dispute
function dispute(uint256 _orderId) external
Opens a dispute.
Parameters:
Name | Type | Description |
---|---|---|
_orderId | uint256 | Order ID |
resolveDispute
function resolveDispute(uint256 _orderId, bool _isCustomerWin) external
Opens a dispute.
Parameters:
Name | Type | Description |
---|---|---|
_orderId | uint256 | Order ID |
_isCustomerWin | bool | 'true' if customer win, else 'false' |
Guarantor
setGuarantor
function setGuarantor(
uint256 _guarantorId,
uint8 _fee,
bool _disabled
) internal
Writes the Guarantor parameters to the contract.
Parameters:
Name | Type | Description |
---|---|---|
_guarantorId | uint256 | Guarantor ID |
_fee | uint8 | Guarantor Fee |
_disabled | bool | 'true' for disable Guarantor, else 'false' |
registerGuarantor
function registerGuarantor(uint8 _fee) external
Allows you to register yourself as a guarantor.
Parameters:
Name | Type | Description |
---|---|---|
_fee | uint8 | Guarantor Fee |
updateGuarantor
function updateGuarantor(
uint256 _guarantorId,
uint8 _fee,
bool _disabled
) external
Updates an existing guarantor.
Parameters:
Name | Type | Description |
---|---|---|
_guarantorId | uint256 | Guarantor ID |
_fee | uint8 | Guarantor Fee |
_disabled | bool | 'true' for disable Guarantor, else 'false' |
Review
setReview
function setReview(
uint256 _orderId,
uint8 _productGrade,
uint8 _vendorGrade,
uint8 _guarantorGrade,
string memory _metadata,
address _sender
) external
Writes the Review parameters to the contract.
Parameters:
Name | Type | Description |
---|---|---|
_orderId | uint256 | Order ID |
_productGrade | uint8 | Product Grade |
_vendorGrade | uint8 | Vendor Grade |
_guarantorGrade | uint8 | Guarantor Grade |
_metadata | string memory | IPFS CID |
_sender | address | Review Sender Address |
updateReview
function updateReview(
uint256 _orderId,
uint8 _productGrade,
uint8 _vendorGrade,
uint8 _guarantorGrade,
string memory _metadata
) external
Allows update a product review.
Parameters:
Name | Type | Description |
---|---|---|
_orderId | uint256 | Order ID |
_productGrade | uint8 | Product Grade |
_vendorGrade | uint8 | Vendor Grade |
_guarantorGrade | uint8 | Guarantor Grade |
_metadata | string memory | IPFS CID |
Faucet
setFaucet
function setFaucet(address _faucet) external onlyOwner
Sets faucet address.
Parameters:
Name | Type | Description |
---|---|---|
_faucet | address | Faucet Address |