Skip to main content

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:

NameTypeDescription
_tokenIduint256Token ID
_tokenaddressToken Address
_feeuint256Commission when using a token
_disabledboolAllows 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:

NameTypeDescription
_tokenaddressAddress of token
_feeuint256Commission when using a token

updateAllowedToken

function updateAllowedToken(
uint256 _tokenId,
address _token,
uint8 _fee,
bool _disabled
) external

Updates an existing AllowedToken.

Parameters:

NameTypeDescription
_tokenIduint256Token ID
_tokenaddressToken Address
_feeuint256Commission when using a token
_disabledboolAllows to enable/disable the token

DeliveryCountry

setDeliveryCountry

function setDeliveryCountry(
uint256 _deliveryCountryId,
string memory _metadata
) internal

Writes the DeliveryCountry parameters to the contract.

Parameters:

NameTypeDescription
_deliveryCountryIduint256Delivery Country ID
_metadatastring memoryIPFS CID

createDeliveryCountry

function createDeliveryCountry(string memory _metadata) external

Adds a delivery country.

Parameters:

NameTypeDescription
_metadatastring memoryIPFS CID

updateDeliveryCountry

function updateDeliveryCountry(
uint256 _deliveryCountryId,
string memory _metadata
) external

Updates a delivery country.

Parameters:

NameTypeDescription
_deliveryCountryIduint256Delivery Country ID
_metadatastring memoryIPFS CID

ProductCategory

setProductCategory

function setProductCategory(
uint256 _productCategoryId,
string memory _metadata
) internal onlyOwner

Writes the ProductCategory parameters to the contract.

Parameters:

NameTypeDescription
_productCategoryIduint256Product Category Id
_metadatastring memoryIPFS CID

createProductCategory

function createProductCategory(string memory _metadata) external

Adds a product category.

Parameters:

NameTypeDescription
_metadatastring memoryIPFS CID

updateProductCategory

function updateProductCategory(
uint256 _productCategoryId,
string memory _metadata
) external

Updates an existing product category.

Parameters:

NameTypeDescription
_productCategoryIduint256Product Category Id
_metadatastring memoryIPFS 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:

NameTypeDescription
_storeIduint256Store ID
_metadatastring memoryIPFS CID
_deliveryCountriesuint256[] memoryDelivery Countries IDS
_owneraddressOwner Address
_scoreuint26Score
_disabledboolAllows to enable/disable the store

createStore

function createStore(
string memory _metadata,
uint256[] memory _deliveryCountries,
bool _disabled
) external

Adds a store.

Parameters:

NameTypeDescription
_metadatastring memoryIPFS CID
_deliveryCountriesuint256[] memoryDelivery Countries IDS
_disabledboolAllows to enable/disable the store

updateStore

function updateStore(
uint256 _storeId,
uint256[] memory _deliveryCountries,
string memory _metadata,
bool _disabled
) external

Updates an existing store.

Parameters:

NameTypeDescription
_storeIduint256Store ID
_deliveryCountriesuint256[] memoryDelivery Countries IDS
_metadatastring memoryIPFS CID
_disabledboolAllows to enable/disable the store

changeStoreVendorStatus

function changeStoreVendorStatus(
uint256 _storeId,
address _vendor,
bool _status
) external

Makes the specified user a shop vendor.

Parameters:

NameTypeDescription
_storeIduint256Store ID
_vendoraddressVendor Address
_statusbool'true' authorizes, 'false' removes

updateStoreScore

function updateStoreScore(
uint256 _storeId,
bool _positive,
uint16 _amount
) external

Updates a product score.

Parameters:

NameTypeDescription
_storeIduint256Score ID
_positivebool'true' to raise the rating, else 'false'
_amountuint256Score 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:

NameTypeDescription
_collectionIduint256Collection ID
_storeIduint256Store ID
_productCategoryIduint256Product Category ID
_metadatastring memoryIPFS CID
_owneraddressOwner Address
_disabledboolAllows to enable/disable the collection

createCollection

function createCollection(
uint256 _storeId,
uint256 _productCategoryId,
string memory _metadata,
bool _disabled
) external

Adds a collection.

Parameters:

NameTypeDescription
_storeIduint256Store ID
_productCategoryIduint256Product Category ID
_metadatastring memoryIPFS CID
_disabledboolAllows 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:

NameTypeDescription
_collectionIduint256Collection ID
_storeIduint256Store ID
_productCategoryIduint256Product Category ID
_metadatastring memoryIPFS CID
_disabledboolAllows to enable/disable the collection

createBaseCollection

function createBaseCollection(
uint256 _productCategoryId,
string memory _metadata
) external onlyOwner

Adds a base collection.

Parameters:

NameTypeDescription
_productCategoryIduint256Product Category ID
_metadatastring memoryIPFS 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:

NameTypeDescription
_productIduint256Product ID
_storeIduint256Store ID
_metadatastring memoryIPFS CID
_tokenIduint256Allowed Token ID
_collectionIduint256Your Store Collection ID
_vendoraddressVendor Address
_amountuint256Product Amount
_deposituint256[3] memory[Price, Vendor Deposit, Customer Deposit]
_scoreuint16Score
_needGuarantorbool'true' for Guarantor System, 'false' for Deposit System
_disabledboolAllows 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:

NameTypeDescription
_storeIduint256Store ID
_metadatastring memoryIPFS CID
_tokenIduint256Allowed Token ID
_collectionIduint256Your Store Collection ID
_amountuint256Product Amount
_deposituint256[3] memory[Price, Vendor Deposit, Customer Deposit]
_needGuarantorbool'true' for Guarantor System, 'false' for Deposit System
_disabledboolAllows 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:

NameTypeDescription
_productIduint256Product ID
_storeIduint256Store ID
_metadatastring memoryIPFS CID
_tokenIduint256Allowed Token ID
_collectionIduint256Your Store Collection ID
_amountuint256Product Amount
_deposituint256[3] memory[Price, Vendor Deposit, Customer Deposit]
_needGuarantorbool'true' for Guarantor System, 'false' for Deposit System
_disabledboolAllows to enable/disable the collection

updateProductScore

updateProductScore(
uint256 _productId,
bool _positive,
uint16 _amount
) external

Updates a product score.

Parameters:

NameTypeDescription
_productIduint256Product ID
_positivebool'true' to raise the rating, else 'false'
_amountuint256Score Amount

Order

setOrder

function setOrder(
uint256 _productId,
string memory _metadata,
address _customer,
uint16 _amount
) internal

Writes the Order parameters to the contract.

Parameters:

NameTypeDescription
_productIduint256Product ID
_metadatastring memoryIPFS CID
_customeraddressCustomer Address
_amountuint16Product Amount

createOrder

function createOrder(
uint256 _productId,
string memory _metadata,
uint16 _amount
) external

Creates an Order.

Parameters:

NameTypeDescription
_productIduint256Product ID
_metadatastring memoryIPFS CID
_amountuint16Product Amount

createMultiOrder

function createMultiOrder(
uint256[] memory _productIds,
string[] memory _metadata,
uint16[] memory _amount
) external

Creates an few Orders.

Parameters:

NameTypeDescription
_productIduint256[] memoryProducts IDs
_metadatastring[] memoryIPFS CIDs
_amountuint16[]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:

NameTypeDescription
_orderIduint256Order ID
_guarantorIduint256Guarantor ID
_keysstring[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:

NameTypeDescription
_orderIduint256Order ID

deliveryOrder

function  deliveryOrder(uint256  _orderId) external

Changes the status of the order to SHIPPED.

Parameters:

NameTypeDescription
_orderIduint256Order 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:

NameTypeDescription
_orderIduint256Order ID
_productGradeuint8Product Grade
_vendorGradeuint8Vendor Grade
_guarantorGradeuint8Guarantor Grade
_metadatastring memoryIPFS CID

setPubKey

function  setPubKey(bytes  memory  _publicKey) external

Sets the public encryption key for the address.

Parameters:

NameTypeDescription
_publicKeybytes memoryPublic Key

dispute

function  dispute(uint256  _orderId) external

Opens a dispute.

Parameters:

NameTypeDescription
_orderIduint256Order ID

resolveDispute

function  resolveDispute(uint256  _orderId, bool  _isCustomerWin) external

Opens a dispute.

Parameters:

NameTypeDescription
_orderIduint256Order ID
_isCustomerWinbool'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:

NameTypeDescription
_guarantorIduint256Guarantor ID
_feeuint8Guarantor Fee
_disabledbool'true' for disable Guarantor, else 'false'

registerGuarantor

function  registerGuarantor(uint8 _fee) external

Allows you to register yourself as a guarantor.

Parameters:

NameTypeDescription
_feeuint8Guarantor Fee

updateGuarantor

function updateGuarantor(
uint256 _guarantorId,
uint8 _fee,
bool _disabled
) external

Updates an existing guarantor.

Parameters:

NameTypeDescription
_guarantorIduint256Guarantor ID
_feeuint8Guarantor Fee
_disabledbool'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:

NameTypeDescription
_orderIduint256Order ID
_productGradeuint8Product Grade
_vendorGradeuint8Vendor Grade
_guarantorGradeuint8Guarantor Grade
_metadatastring memoryIPFS CID
_senderaddressReview Sender Address

updateReview

function  updateReview(
uint256 _orderId,
uint8 _productGrade,
uint8 _vendorGrade,
uint8 _guarantorGrade,
string memory _metadata
) external

Allows update a product review.

Parameters:

NameTypeDescription
_orderIduint256Order ID
_productGradeuint8Product Grade
_vendorGradeuint8Vendor Grade
_guarantorGradeuint8Guarantor Grade
_metadatastring memoryIPFS CID

Faucet

setFaucet

function setFaucet(address _faucet) external onlyOwner

Sets faucet address.

Parameters:

NameTypeDescription
_faucetaddressFaucet Address