SecretShopUpgradable
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
Name | Type | Description |
---|
order | struct Market.Order | order by the maker |
shared | struct Market.SettleShared | some option of the taker |
detail | struct Market.SettleDetail | detail by the taker |
pause
unpause
function unpause() public
initialize
function initialize(address owner_, uint256 feeCapPct_, address weth_) public
initialize
Name | Type | Description |
---|
owner_ | address | |
feeCapPct_ | uint256 | max fee percentage |
weth_ | address | address of wrapped eth |
updateFeeCap
function updateFeeCap(uint256 val) public virtual
Name | Type | Description |
---|
val | uint256 | new Fee Cap |
updateDelegates
function updateDelegates(address[] toAdd, address[] toRemove) public virtual
update Delegates address
Name | Type | Description |
---|
toAdd | address[] | the array of delegate address that want to add |
toRemove | address[] | the array to delegate address that want to remove |
updateCurrencies
function updateCurrencies(contract IERC20Upgradeable[] toAdd, contract IERC20Upgradeable[] toRemove) public
update Currencies address
Name | Type | Description |
---|
toAdd | contract IERC20Upgradeable[] | the array of currency address that want to add |
toRemove | contract 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
Name | Type | Description |
---|
order | struct Market.Order | order by the maker |
run
function run(struct Market.RunInput input) public payable virtual
Entry of a contract call
Name | Type | Description |
---|
input | struct Market.RunInput | a 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
Name | Type | Description |
---|
order | struct Market.Order | order by the maker |
shared | struct Market.SettleShared | some option of the taker |
detail | struct Market.SettleDetail | detail by the taker |
_takePayment
function _takePayment(contract IERC20Upgradeable currency, address from, uint256 amount) internal virtual returns (uint256)
transfer some kind ERC20 to this contract
Name | Type | Description |
---|
currency | contract IERC20Upgradeable | currency's address |
from | address | who pays |
amount | uint256 | how much pay |
_transferTo
function _transferTo(contract IERC20Upgradeable currency, address to, uint256 amount) internal virtual
transfer some kind ERC20
Name | Type | Description |
---|
currency | contract IERC20Upgradeable | currency's address |
to | address | who receive |
amount | uint256 | how 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
Name | Type | Description |
---|
itemHash | bytes32 | the item's hash |
seller | address | who sell the item |
currency | contract IERC20Upgradeable | currency's address |
sd | struct Market.SettleDetail | detail by the taker |
price | uint256 | the 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
Name | Type | Description |
---|
currency | contract IERC20Upgradeable | address of the currency, 0 for native token |
Name | Type | Description |
---|
[0] | bool | bool 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
Name | Type | Description |
---|
order | struct Market.Order | order by the maker |
item | struct Market.OrderItem | which item to be hashed in the order |
Name | Type | Description |
---|
[0] | bytes32 | hash the item's hash, which is unique |
_assertDelegation
function _assertDelegation(struct Market.Order order, struct Market.SettleDetail detail) internal view virtual
judge delegate type
Name | Type | Description |
---|
order | struct Market.Order | order by the maker |
detail | struct Market.SettleDetail | settle detail by the taker |
_hash
function _hash(struct Market.Order order) private pure returns (bytes32)
hash typed data of an Order
Name | Type | Description |
---|
order | struct Market.Order | order by the maker |
Name | Type | Description |
---|
[0] | bytes32 | hash typed data hash |
_hash
function _hash(struct Market.OrderItem[] orderItems) private pure returns (bytes32)
hash typed data of a array of orderItem
Name | Type | Description |
---|
orderItems | struct Market.OrderItem[] | |
Name | Type | Description |
---|
[0] | bytes32 | hash typed data hash |
_hash
function _hash(struct Market.OrderItem orderItem) private pure returns (bytes32)
hash typed data of an orderItem
Name | Type | Description |
---|
orderItem | struct Market.OrderItem | orderItem |
Name | Type | Description |
---|
[0] | bytes32 | hash typed data hash |