Skip to main content

SecretShopUpgradable

SecretShopUpgradable

RATE_BASE

uint256 RATE_BASE

precision of the parameters

receive

receive() external payable

for contract to receive native token

runSingle

function runSingle(struct Market.Order order, struct Market.SettleShared shared, struct Market.SettleDetail detail) external virtual returns (uint256)

run a single order

NameTypeDescription
orderstruct Market.Orderorder by the maker
sharedstruct Market.SettleSharedsome option of the taker
detailstruct Market.SettleDetaildetail by the taker

pause

function pause() public

unpause

function unpause() public

initialize

function initialize(address owner_, uint256 feeCapPct_, address weth_) public

initialize

NameTypeDescription
owner_address
feeCapPct_uint256max fee percentage
weth_addressaddress of wrapped eth

updateFeeCap

function updateFeeCap(uint256 val) public virtual
NameTypeDescription
valuint256new Fee Cap

updateDelegates

function updateDelegates(address[] toAdd, address[] toRemove) public virtual

update Delegates address

NameTypeDescription
toAddaddress[]the array of delegate address that want to add
toRemoveaddress[]the array to delegate address that want to remove

updateCurrencies

function updateCurrencies(contract IERC20Upgradeable[] toAdd, contract IERC20Upgradeable[] toRemove) public

update Currencies address

NameTypeDescription
toAddcontract IERC20Upgradeable[]the array of currency address that want to add
toRemovecontract IERC20Upgradeable[]the array to currency address that want to remove

verifyOrderSignature

function verifyOrderSignature(struct Market.Order order) external view returns (bool valid)

verify whether the order data is real, necessary for security

NameTypeDescription
orderstruct Market.Orderorder by the maker

run

function run(struct Market.RunInput input) public payable virtual

Entry of a contract call

NameTypeDescription
inputstruct Market.RunInputa struct that contains all data

_emitInventory

function _emitInventory(bytes32 itemHash, struct Market.Order order, struct Market.OrderItem item, struct Market.SettleShared shared, struct Market.SettleDetail detail) internal virtual

_run

function _run(struct Market.Order order, struct Market.SettleShared shared, struct Market.SettleDetail detail) internal virtual returns (uint256)

internal function, real implementation make single trade to be achieved

NameTypeDescription
orderstruct Market.Orderorder by the maker
sharedstruct Market.SettleSharedsome option of the taker
detailstruct Market.SettleDetaildetail by the taker

_takePayment

function _takePayment(contract IERC20Upgradeable currency, address from, uint256 amount) internal virtual returns (uint256)

transfer some kind ERC20 to this contract

NameTypeDescription
currencycontract IERC20Upgradeablecurrency's address
fromaddresswho pays
amountuint256how much pay

_transferTo

function _transferTo(contract IERC20Upgradeable currency, address to, uint256 amount) internal virtual

transfer some kind ERC20

NameTypeDescription
currencycontract IERC20Upgradeablecurrency's address
toaddresswho receive
amountuint256how much receive

_distributeFeeAndProfit

function _distributeFeeAndProfit(bytes32 itemHash, address seller, contract IERC20Upgradeable currency, struct Market.SettleDetail sd, uint256 price) internal virtual

distribute fees and give extra to seller

NameTypeDescription
itemHashbytes32the item's hash
selleraddresswho sell the item
currencycontract IERC20Upgradeablecurrency's address
sdstruct Market.SettleDetaildetail by the taker
priceuint256the item's price

_authorizeUpgrade

function _authorizeUpgrade(address newImplementation) internal

upgrade function

_isNative

function _isNative(contract IERC20Upgradeable currency) internal view virtual returns (bool)

judge whether token is chain native token

NameTypeDescription
currencycontract IERC20Upgradeableaddress of the currency, 0 for native token
NameTypeDescription
[0]boolbool whether the token is a native token

_verifyOrderSignature

function _verifyOrderSignature(struct Market.Order order) internal view virtual returns (bool)

implementation of verifyOrderSignature

_hashItem

function _hashItem(struct Market.Order order, struct Market.OrderItem item) internal view virtual returns (bytes32)

hash an item Data to calculate itemHash

NameTypeDescription
orderstruct Market.Orderorder by the maker
itemstruct Market.OrderItemwhich item to be hashed in the order
NameTypeDescription
[0]bytes32hash the item's hash, which is unique

_assertDelegation

function _assertDelegation(struct Market.Order order, struct Market.SettleDetail detail) internal view virtual

judge delegate type

NameTypeDescription
orderstruct Market.Orderorder by the maker
detailstruct Market.SettleDetailsettle detail by the taker

_hash

function _hash(struct Market.Order order) private pure returns (bytes32)

hash typed data of an Order

NameTypeDescription
orderstruct Market.Orderorder by the maker
NameTypeDescription
[0]bytes32hash typed data hash

_hash

function _hash(struct Market.OrderItem[] orderItems) private pure returns (bytes32)

hash typed data of a array of orderItem

NameTypeDescription
orderItemsstruct Market.OrderItem[]
NameTypeDescription
[0]bytes32hash typed data hash

_hash

function _hash(struct Market.OrderItem orderItem) private pure returns (bytes32)

hash typed data of an orderItem

NameTypeDescription
orderItemstruct Market.OrderItemorderItem
NameTypeDescription
[0]bytes32hash typed data hash