MoCVendors

View Source: contracts/MoCVendors.sol

↗ Extends: MoCVendorsEvents, MoCBase, MoCLibConnection, Governed, IMoCVendors

MoCVendors - version: 0.1.12

Structs

VendorDetails

struct VendorDetails {
 bool isActive,
 uint256 markup,
 uint256 totalPaidInMoC,
 uint256 staking
}

Contract Members

Constants & Variables

contract IMoC internal moc;

contract IMoCState internal mocState;

contract IMoCExchange internal mocExchange;

uint8 public constant VENDORS_LIST_ARRAY_MAX_LENGTH;

uint256 public constant VENDOR_MAX_MARKUP;

address public vendorGuardianAddress;

mapping(address => struct MoCVendors.VendorDetails) public vendors;

address[] public vendorsList;

uint256[50] private upgradeGap;

VendorRegistered

Parameters

NameTypeDescription

account

address

markup

uint256

VendorUpdated

Parameters

NameTypeDescription

account

address

markup

uint256

VendorUnregistered

Parameters

NameTypeDescription

account

address

VendorStakeAdded

Parameters

NameTypeDescription

account

address

staking

uint256

VendorStakeRemoved

Parameters

NameTypeDescription

account

address

staking

uint256

TotalPaidInMoCReset

Parameters

NameTypeDescription

account

address

VendorGuardianAddressChanged

Parameters

NameTypeDescription

vendorGuardianAddress

address

VendorReceivedMarkup

Parameters

NameTypeDescription

vendorAdress

address

paidMoC

uint256

paidRBTC

uint256

Modifiers

onlyActiveVendor

Checks if vendor (msg.sender) is active

modifier onlyActiveVendor() internal

Arguments

onlyVendorGuardian

Checks if address is allowed to call function

modifier onlyVendorGuardian() internal

Arguments

Functions

initialize

Initializes the contract

function initialize(address connectorAddress, address _governor, address _vendorGuardianAddress) public nonpayable initializer 

Arguments

NameTypeDescription

connectorAddress

address

MoCConnector contract address

_governor

address

Governor contract address

_vendorGuardianAddress

address

Address which will be authorized to register and unregister vendors.

getVendorsCount

Gets the count of active registered vendors

function getVendorsCount() public view
returns(vendorsCount uint256)

Returns

Amount of active registered vendors

Arguments

registerVendor

Allows to register a vendor

function registerVendor(address account, uint256 markup) public nonpayable onlyVendorGuardian 
returns(isActive bool)

Returns

true if vendor was registered successfully; otherwise false

Arguments

NameTypeDescription

account

address

Vendor address

markup

uint256

Markup which vendor will perceive from mint/redeem operations

unregisterVendor

Allows to unregister a vendor

function unregisterVendor(address account) public nonpayable onlyVendorGuardian 
returns(isActive bool)

Returns

false if vendor was unregistered successfully; otherwise false

Arguments

NameTypeDescription

account

address

Vendor address

addStake

Allows an active vendor (msg.sender) to add staking

function addStake(uint256 staking) public nonpayable onlyActiveVendor 

Arguments

NameTypeDescription

staking

uint256

Staking the vendor wants to add

removeStake

Allows an active vendor (msg.sender) to remove staking

function removeStake(uint256 staking) public nonpayable onlyActiveVendor 

Arguments

NameTypeDescription

staking

uint256

Staking the vendor wants to remove

updatePaidMarkup

⤾ overrides IMoCVendors.updatePaidMarkup

Allows to update paid markup to vendor

function updatePaidMarkup(address account, uint256 mocAmount, uint256 rbtcAmount) public nonpayable onlyWhitelisted 
returns(bool)

Arguments

NameTypeDescription

account

address

Vendor address

mocAmount

uint256

paid markup in MoC

rbtcAmount

uint256

paid markup in RBTC

getIsActive

⤾ overrides IMoCVendors.getIsActive

Gets if a vendor is active

function getIsActive(address account) public view
returns(bool)

Returns

true if vendor is active; false otherwise

Arguments

NameTypeDescription

account

address

Vendor address

getMarkup

⤾ overrides IMoCVendors.getMarkup

Gets vendor markup

function getMarkup(address account) public view
returns(uint256)

Returns

Vendor markup

Arguments

NameTypeDescription

account

address

Vendor address

getTotalPaidInMoC

⤾ overrides IMoCVendors.getTotalPaidInMoC

Gets vendor total paid in MoC

function getTotalPaidInMoC(address account) public view
returns(uint256)

Returns

Vendor total paid in MoC

Arguments

NameTypeDescription

account

address

Vendor address

getStaking

⤾ overrides IMoCVendors.getStaking

Gets vendor staking

function getStaking(address account) public view
returns(uint256)

Returns

Vendor staking

Arguments

NameTypeDescription

account

address

Vendor address

resetTotalPaidInMoC

⤾ overrides IMoCVendors.resetTotalPaidInMoC

Allows to reset all active vendor's total paid in MoC during settlement

function resetTotalPaidInMoC() public nonpayable onlyWhitelisted 

Arguments

getVendorGuardianAddress

Returns the address is authorized to register and unregister vendors.

function getVendorGuardianAddress() public view
returns(address)

Arguments

setVendorGuardianAddress

Sets the address which will be authorized to register and unregister vendors.

function setVendorGuardianAddress(address _vendorGuardianAddress) public nonpayable onlyAuthorizedChanger 

Arguments

NameTypeDescription

_vendorGuardianAddress

address

Address which will be authorized to register and unregister vendors.

initializeContracts

function initializeContracts() internal nonpayable

Arguments

initializeValues

function initializeValues(address _governor, address _vendorGuardianAddress) internal nonpayable

Arguments

NameTypeDescription

_governor

address

_vendorGuardianAddress

address

setVendorGuardianAddressInternal

Sets the address which will be authorized to register and unregister vendors.

function setVendorGuardianAddressInternal(address _vendorGuardianAddress) internal nonpayable

Arguments

NameTypeDescription

_vendorGuardianAddress

address

Address which will be authorized to register and unregister vendors.

Last updated