# ExchangeV1 [Git Source](https://github.com/buildship-dev/nft-contracts/blob/fd1c33a9dbefe42158dfc60d10c0afde05c713aa/contracts/utils/Rarible/ExchangeV1.sol) **Inherits:** Ownable, [ExchangeDomainV1](/wiki/src/contracts/utils/Rarible/ExchangeV1.sol/contract.ExchangeDomainV1.md) ## State Variables ### _INTERFACE_ID_FEES ```solidity bytes4 private constant _INTERFACE_ID_FEES = 0xb7799584; ``` ### UINT256_MAX ```solidity uint256 private constant UINT256_MAX = 2 ** 256 - 1; ``` ### beneficiary ```solidity address payable public beneficiary; ``` ### buyerFeeSigner ```solidity address public buyerFeeSigner; ``` ### transferProxy ```solidity TransferProxy public transferProxy; ``` ### transferProxyForDeprecated ```solidity TransferProxyForDeprecated public transferProxyForDeprecated; ``` ### erc20TransferProxy ```solidity ERC20TransferProxy public erc20TransferProxy; ``` ### state ```solidity ExchangeStateV1 public state; ``` ### ordersHolder ```solidity ExchangeOrdersHolderV1 public ordersHolder; ``` ## Functions ### constructor ```solidity constructor( TransferProxy _transferProxy, TransferProxyForDeprecated _transferProxyForDeprecated, ERC20TransferProxy _erc20TransferProxy, ExchangeStateV1 _state, ExchangeOrdersHolderV1 _ordersHolder, address payable _beneficiary, address _buyerFeeSigner ); ``` ### setBeneficiary ```solidity function setBeneficiary(address payable newBeneficiary) external onlyOwner; ``` ### setBuyerFeeSigner ```solidity function setBuyerFeeSigner(address newBuyerFeeSigner) external onlyOwner; ``` ### exchange ```solidity function exchange( Order calldata order, Sig calldata sig, uint256 buyerFee, Sig calldata buyerFeeSig, uint256 amount, address buyer ) external payable; ``` ### validateEthTransfer ```solidity function validateEthTransfer(uint256 value, uint256 buyerFee) internal view; ``` ### cancel ```solidity function cancel(OrderKey calldata key) external; ``` ### validateOrderSig ```solidity function validateOrderSig(Order memory order, Sig memory sig) internal view; ``` ### validateBuyerFeeSig ```solidity function validateBuyerFeeSig(Order memory order, uint256 buyerFee, Sig memory sig) internal view; ``` ### prepareBuyerFeeMessage ```solidity function prepareBuyerFeeMessage(Order memory order, uint256 fee) public pure returns (string memory); ``` ### prepareMessage ```solidity function prepareMessage(Order memory order) public pure returns (string memory); ``` ### transferWithFeesPossibility ```solidity function transferWithFeesPossibility( Asset memory firstType, uint256 value, address from, address to, bool hasFee, uint256 sellerFee, uint256 buyerFee, Asset memory secondType ) internal; ``` ### transfer ```solidity function transfer(Asset memory asset, uint256 value, address from, address to) internal; ``` ### transferWithFees ```solidity function transferWithFees( Asset memory firstType, uint256 value, address from, address to, uint256 sellerFee, uint256 buyerFee, Asset memory secondType ) internal; ``` ### transferFeeToBeneficiary ```solidity function transferFeeToBeneficiary(Asset memory asset, address from, uint256 total, uint256 sellerFee, uint256 buyerFee) internal returns (uint256); ``` ### emitBuy ```solidity function emitBuy(Order memory order, uint256 amount, address buyer) internal; ``` ### subFeeInBp ```solidity function subFeeInBp(uint256 value, uint256 total, uint256 feeInBp) internal pure returns (uint256 newValue, uint256 realFee); ``` ### subFee ```solidity function subFee(uint256 value, uint256 fee) internal pure returns (uint256 newValue, uint256 realFee); ``` ### verifyOpenAndModifyOrderState ```solidity function verifyOpenAndModifyOrderState(OrderKey memory key, uint256 selling, uint256 amount) internal; ``` ### getFeeSide ```solidity function getFeeSide(AssetType sellType, AssetType buyType) internal pure returns (FeeSide); ``` ## Events ### Buy ```solidity event Buy( address indexed sellToken, uint256 indexed sellTokenId, uint256 sellValue, address owner, address buyToken, uint256 buyTokenId, uint256 buyValue, address buyer, uint256 amount, uint256 salt ); ``` ### Cancel ```solidity event Cancel( address indexed sellToken, uint256 indexed sellTokenId, address owner, address buyToken, uint256 buyTokenId, uint256 salt ); ``` ## Enums ### FeeSide ```solidity enum FeeSide { NONE, SELL, BUY } ```