-
Notifications
You must be signed in to change notification settings - Fork 63
contract.ExchangeV1
Aleksey Bykhun edited this page Jan 18, 2023
·
1 revision
Inherits: Ownable, ExchangeDomainV1
bytes4 private constant _INTERFACE_ID_FEES = 0xb7799584;
uint256 private constant UINT256_MAX = 2 ** 256 - 1;
address payable public beneficiary;
address public buyerFeeSigner;
TransferProxy public transferProxy;
TransferProxyForDeprecated public transferProxyForDeprecated;
ERC20TransferProxy public erc20TransferProxy;
ExchangeStateV1 public state;
ExchangeOrdersHolderV1 public ordersHolder;
constructor(
TransferProxy _transferProxy,
TransferProxyForDeprecated _transferProxyForDeprecated,
ERC20TransferProxy _erc20TransferProxy,
ExchangeStateV1 _state,
ExchangeOrdersHolderV1 _ordersHolder,
address payable _beneficiary,
address _buyerFeeSigner
);
function setBeneficiary(address payable newBeneficiary) external onlyOwner;
function setBuyerFeeSigner(address newBuyerFeeSigner) external onlyOwner;
function exchange(
Order calldata order,
Sig calldata sig,
uint256 buyerFee,
Sig calldata buyerFeeSig,
uint256 amount,
address buyer
) external payable;
function validateEthTransfer(uint256 value, uint256 buyerFee) internal view;
function cancel(OrderKey calldata key) external;
function validateOrderSig(Order memory order, Sig memory sig) internal view;
function validateBuyerFeeSig(Order memory order, uint256 buyerFee, Sig memory sig) internal view;
function prepareBuyerFeeMessage(Order memory order, uint256 fee) public pure returns (string memory);
function prepareMessage(Order memory order) public pure returns (string memory);
function transferWithFeesPossibility(
Asset memory firstType,
uint256 value,
address from,
address to,
bool hasFee,
uint256 sellerFee,
uint256 buyerFee,
Asset memory secondType
) internal;
function transfer(Asset memory asset, uint256 value, address from, address to) internal;
function transferWithFees(
Asset memory firstType,
uint256 value,
address from,
address to,
uint256 sellerFee,
uint256 buyerFee,
Asset memory secondType
) internal;
function transferFeeToBeneficiary(Asset memory asset, address from, uint256 total, uint256 sellerFee, uint256 buyerFee)
internal
returns (uint256);
function emitBuy(Order memory order, uint256 amount, address buyer) internal;
function subFeeInBp(uint256 value, uint256 total, uint256 feeInBp)
internal
pure
returns (uint256 newValue, uint256 realFee);
function subFee(uint256 value, uint256 fee) internal pure returns (uint256 newValue, uint256 realFee);
function verifyOpenAndModifyOrderState(OrderKey memory key, uint256 selling, uint256 amount) internal;
function getFeeSide(AssetType sellType, AssetType buyType) internal pure returns (FeeSide);
event Buy(
address indexed sellToken,
uint256 indexed sellTokenId,
uint256 sellValue,
address owner,
address buyToken,
uint256 buyTokenId,
uint256 buyValue,
address buyer,
uint256 amount,
uint256 salt
);
event Cancel(
address indexed sellToken,
uint256 indexed sellTokenId,
address owner,
address buyToken,
uint256 buyTokenId,
uint256 salt
);
enum FeeSide {
NONE,
SELL,
BUY
}