deBridge 백서

deBridge

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 31쪽 중 20쪽

struct IDeBridgeGate.DiscountInfo) public feeDiscount; ``` Fee discount for address ### getNativeInfo ```solidity theme={null} mapping(address => struct IDeBridgeGate.TokenInfo) public getNativeInfo; ``` Returns native token info by wrapped token address ### defiController ```solidity theme={null} address public defiController; ``` DefiController that can supply liquidity to staking strategies (AAVE, Compound, etc.) ### feeProxy ```solidity theme={null} address public feeProxy; ``` Proxy to convert collected fees and transfer to Ethereum treasury ### callProxy ```solidity theme={null} address public callProxy; ``` Address of the proxy to execute user's calls. ### weth ```solidity theme={null} contract IWETH public weth; ``` Wrapped native token contract ### feeContractUpdater ```solidity theme={null} address public feeContractUpdater; ``` Contract that can override `globalFixedNativeFee` ### globalFixedNativeFee ```solidity theme={null} uint256 public globalFixedNativeFee; ``` Fallback fixed fee in native asset (used if chain fixed fee is 0) ### globalTransferFeeBps ```solidity theme={null} uint16 public globalTransferFeeBps; ``` Fallback transfer fee in BPS (used if chain transfer fee is 0) ### wethGate ```solidity theme={null} contract IWethGate public wethGate; ``` WethGate contract used for WETH withdraws affected by EIP1884 ### lockedClaim ```solidity theme={null} uint256 public lockedClaim; ``` Locker for claim method *** ## Functions ### initialize ```solidity theme={null} function initialize( uint8 _excessConfirmations, contract IWETH _weth ) public ``` Constructor that initializes the most important configurations. #### Parameters: | Name | Type | Description | | --------------------- | -------------- | ---------------------------------------------------------------- | | \_excessConfirmations | uint8 | Minimal required confirmations in case of too many confirmations | | \_weth | contract IWETH | Wrapped native token contract | *** ### send ```solidity theme={null} function send( address _tokenAddress, uint256 _amount, uint256 _chainIdTo, bytes _receiver, bytes _permit, bool _useAssetFee, uint32 _referralCode, bytes _autoParams ) external ``` This method is used for the transfer of assets from the [native chain](/dmp-details/dePort/transfer-flow#transfers-from-native-source-chain). It locks an asset in the smart contract in the native chain and enables minting of deAsset on the secondary chain. **Parameters:** | Name | Type | Description | | --------------- | --------- | ------------------------------------------------------------------ | | `_tokenAddress` | `address` | Asset identifier. | | `_amount` | `uint256` | Amount to be transferred (note: the fee can be applied). | | `_chainIdTo` | `uint256` | Chain id of the target chain. | | `_receiver` | `bytes` | Receiver address. | | `_permit` | `bytes` | deadline + signature for approving the spender by signature. | | `_useAssetFee` | `bool` | use assets fee for pay protocol fix (work only for specials token) | | `_referralCode` | `uint32` | Referral code | | `_autoParams` | `bytes` | Auto params for external call in target network | ### claim ```solidity theme={null} function claim( bytes32 _debridgeId, uint256 _amount, uint256 _chainIdFrom, address _receiver, uint256 _nonce, bytes _signatures, bytes _autoParams ) external ``` Is used for transfers [into the native chain](/dmp-details/dePort/transfer-flow#transfers-from-native-source-chain) to unlock the designated amount of asset from collateral and transfer it to the receiver. **Parameters:** | Name | Type | Description | | -------------- | --------- | --------------------------------------------------------------- | | `_debridgeId` | `bytes32` | Asset identifier. | | `_amount` | `uint256` | Amount of the transferred asset (note: the fee can be applied). | | `_chainIdFrom` | `uint256` | Chain where submission was sent | | `_receiver` | `address` | Receiver address. | | `_nonce` | `uint256` | Submission id. | | `_signatures` | `bytes` | Validators signatures to confirm | | `_autoParams` | `bytes` | Auto params for external call | ### flash ```solidity theme={null} function flash( address _tokenAddress, address _receiver, uint256 _amount, bytes _data ) external ``` Get a flash loan, msg.sender must implement IFlashCallback. **Parameters:** | Name | Type | Description | | --------------- | --------- | ----------------------------------------------- | | `_tokenAddress` | `address` | An asset to loan | | `_receiver` | `address` | Where funds should be sent | | `_amount` | `uint256` | Amount to loan | | `_data` | `bytes` | Data to pass to sender's flashCallback function | ### deployNewAsset ```solidity theme={null} function deployNewAsset( bytes _nativeTokenAddress, uint256 _nativeChainId, string _name, string _symbol, uint8 _decimals, bytes _signatures ) external ``` Deploy a deToken(DeBridgeTokenProxy) for an asset. **Parameters:** | Name | Type | Description | | --------------------- | --------- | --------------------------------- | | `_nativeTokenAddress` | `bytes` | A token address on a native chain | | `_nativeChainId` | `uint256` | The token native chain's id | | `_name` | `string` | The token's name | | `_symbol` | `string` | The token's symbol | | `_decimals` | `uint8` | The token's decimals | | `_signatures` | `bytes` | Validators' signatures | ### autoUpdateFixedNativeFee ```solidity theme={null} function autoUpdateFixedNativeFee( uint256 _globalFixedNativeFee ) external ``` Update native fix fee. Called by our fee update contract. **Parameters:** | Name | Type | Description | | ----------------------- | --------- | ----------- | | `_globalFixedNativeFee` | `uint256` | new value | ### updateChainSupport ```solidity theme={null} function updateChainSupport( uint256[] _chainIds, struct IDeBridgeGate.ChainSupportInfo[] _chainSupportInfo, bool _isChainFrom ) external ``` Update asset's fees. **Parameters:** | Name | Type | Description | | ------------------- | ----------------------------------------- | --------------------------------------- | | `_chainIds` | `uint256[]` | Chain identifiers. | | `_chainSupportInfo` | `struct IDeBridgeGate.ChainSupportInfo[]` | Chain support info. | | `_isChainFrom` | `bool` | is true for editing getChainFromConfig. | ### updateGlobalFee ```solidity theme={null} function updateGlobalFee( uint256 _globalFixedNativeFee, uint16 _globalTransferFeeBps ) external ``` Update fallbacks for fixed fee in native asset and transfer fee. **Parameters:** | Name | Type | Description | | ----------------------- | --------- | ------------------------------------------------------------------------- | | `_globalFixedNativeFee` | `uint256` | Fallback fixed fee in native asset, used if a chain fixed fee is set to 0 | | `_globalTransferFeeBps` | `uint16` | Fallback transfer fee in BPS, used if a chain transfer fee is set to 0 | ### updateAssetFixedFees ```solidity theme={null} function updateAssetFixedFees( bytes32 _debridgeId, uint256[] _supportedChainIds, uint256[] _assetFeesInfo ) external ``` Update asset's fees. **Parameters:** | Name | Type | Description | | -------------------- | ----------- | ------------------- | | `_debridgeId` | `bytes32` | Asset identifier. | | `_supportedChainIds` | `uint256[]` | Chain identifiers. | | `_assetFeesInfo` | `uint256[]` | Chain support info. | ### updateExcessConfirmations ```solidity theme={null} function updateExcessConfirmations( uint8 _excessConfirmations ) external ``` Update minimal amount of required signatures, must be > `SignatureVerifier.minConfirmations` to have an effect. **Parameters:** | Name | Type | Description | | ---------------------- | ------- | ------------------------------------- | | `_excessConfirmations` | `uint8` | Minimal amount of required signatures | ### setChainSupport ```solidity theme={null} function setChainSupport( uint256 _chainId, bool _isSupported, bool _isChainFrom ) external ``` Set support for the chains where the token can be transferred. **Parameters:** | Name | Type | Description | | -------------- | --------- | ------------------------------------------------- | | `_chainId` | `uint256` | Chain id where tokens are sent. | | `_isSupported` | `bool` | Whether the token is transferable to other chain. | | `_isChainFrom` | `bool` | Is true for editing getChainFromConfig. | ### setCallProxy ```solidity theme={null} function setCallProxy( address _callProxy ) external ``` Set address of the call proxy. **Parameters:** | Name | Type | Description | | ------------ | --------- | ----------------------------------------- | | `_callProxy` | `address` | Address of the proxy that executes calls. | ### updateAsset ```solidity theme={null} function updateAsset( bytes32 _debridgeId, uint256 _maxAmount, uint16 _minReservesBps, uint256 _amountThreshold ) external ``` Update specific asset's bridge parameters. **Parameters:** | Name | Type | Description | | ------------------ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | | `_debridgeId` | `bytes32` | Asset identifier. | | `_maxAmount` | `uint256` | Maximum amount of current chain token to be wrapped. | | `_minReservesBps` | `uint16` | Minimal reserve ratio in BPS. | | `_amountThreshold` | `uint256` | Threshold amount after which `Math.max(excessConfirmations,SignatureVerifier.minConfirmations)` is used instead of `SignatureVerifier.minConfirmations` | ### setSignatureVerifier ```solidity theme={null} function setSignatureVerifier( address _verifier ) external ``` Set signature verifier address. **Parameters:** | Name | Type | Description | | ----------- | --------- | --------------------------- | | `_verifier` | `address` | Signature verifier address. | ### setDeBridgeTokenDeployer ```solidity theme={null} function setDeBridgeTokenDeployer( address _deBridgeTokenDeployer ) external ``` Set asset deployer address. **Parameters:** | Name | Type | Description | | ------------------------ | --------- | ----------------------- | | `_deBridgeTokenDeployer` | `address` | Asset deployer address. | ### setDefiController ```solidity theme={null} function setDefiController( address _defiController ) external ``` Set defi controller. **Parameters:** | Name | Type | Description | | ----------------- | --------- | ------------------------ | | `_defiController` | `address` | Defi controller address. | ### setFeeContractUpdater ```solidity theme={null} function setFeeContractUpdater( address _value ) external ``` Set fee contract updater, that can update fix native fee. **Parameters:** | Name | Type | Description | | -------- | --------- | --------------------- | | `_value` | `address` | New contract address. | ### setWethGate ```solidity theme={null} function setWethGate( contract IWethGate _wethGate ) external ``` Set wethGate contract, used for weth withdrawals affected by EIP1884. **Parameters:** | Name | Type | Description | | ----------- | -------------------- | --------------------------------- | | `_wethGate` | `contract IWethGate` | Address of new wethGate contract. | ### pause ```solidity theme={null} function pause() external ``` Stop all transfers. ### unpause ```solidity theme={null} function unpause() external ``` Allow transfers again. ### withdrawFee ```solidity theme={null} function withdrawFee( bytes32 _debridgeId ) external ``` Withdraw collected fees to feeProxy. **Parameters:** | Name | Type | Description | | ------------- | --------- | ----------------- | | `_debridgeId` | `bytes32` | Asset identifier. | ### requestReserves ```solidity theme={null} function requestReserves( address _tokenAddress, uint256 _amount ) external ``` Request the assets to be used in DeFi protocol. **Parameters:** | Name | Type | Description | | --------------- | --------- | ------------------ | | `_tokenAddress` | `address` | Asset address. | | `_amount` | `uint256` | Amount to request. | ### returnReserves ```solidity theme={null} function returnReserves( address _tokenAddress, uint256 _amount ) external ``` Return the assets that were used in DeFi protocol. **Parameters:** | Name | Type | Description | | --------------- | --------- | -------------------------- | | `_tokenAddress` | `address` | Asset address. | | `_amount` | `uint256` | Amount of tokens to claim. | ### setFeeProxy ```solidity theme={null} function setFeeProxy( address _feeProxy ) external ``` Set fee converter proxy. **Parameters:** | Name | Type | Description | | ----------- | --------- | ------------------ | | `_feeProxy` | `address` | Fee proxy address. | ### blockSubmission ```solidity theme={null} function blockSubmission( bytes32[] _submissionIds, bool isBlocked ) external ``` Block or unblock a list of submissions. **Parameters:** | Name | Type | Description | | ---------------- | ----------- | -------------------------------- | | `_submissionIds` | `bytes32[]` | IDs of submissions to modify. | | `isBlocked` | `bool` | True to block, false to unblock. | ### updateFlashFee ```solidity theme={null} function updateFlashFee( uint256 _flashFeeBps ) external ``` Update flash fees. **Parameters:** | Name | Type | Description | | -------------- | --------- | --------------- | | `_flashFeeBps` | `uint256` | New fee in BPS. | ### updateFeeDiscount ```solidity theme={null} function updateFeeDiscount( address _address, uint16 _discountFixBps, uint16 _discountTransferBps ) external ``` Update discount settings. **Parameters:** | Name | Type | Description | | ---------------------- | --------- | --------------------------- | | `_address` | `address` | Customer address. | | `_discountFixBps` | `uint16` | Fix discount in BPS. | | `_discountTransferBps` | `uint16` | Transfer % discount in BPS. | ### receive ```solidity theme={null} function receive() external ``` ### \_checkConfirmations ```solidity theme={null} function _checkConfirmations( bytes32 _submissionId, bytes32 _debridgeId, uint256 _amount, bytes _signatures ) internal ``` ### \_addAsset ```solidity theme={null} function _addAsset( bytes32 _debridgeId, address _tokenAddress, bytes _nativeAddress, uint256 _nativeChainId ) internal ``` Add support for the asset. **Parameters:** | Name | Type | Description | | ---------------- | --------- | ----------------------------------- | | `_debridgeId` | `bytes32` | Asset identifier. | | `_tokenAddress` | `address` | Address of the asset on this chain. | | `_nativeAddress` | `bytes` | Address of asset on native chain. | | `_nativeChainId` | `uint256` | Native chain ID. | ### \_send ```solidity theme={null} function _send( bytes _amount, address _chainIdTo, uint256 _permit ) internal returns (uint256 amountAfterFee, bytes32 debridgeId, struct IDeBridgeGate.FeeParams feeParams) ``` Locks asset on the chain and enables minting on the other chain. **Parameters:** | Name | Type | Description | | ------------ | --------- | ---------------------------------------------- | | `_amount` | `bytes` | Amount to be transferred (fee can be applied). | | `_chainIdTo` | `address` | Target chain ID. | | `_permit` | `uint256` | Deadline + signature for permit. | ### \_publishSubmission ```solidity theme={null} function _publishSubmission( bytes32 _debridgeId, uint256 _chainIdTo, uint256 _amount, bytes _receiver, struct IDeBridgeGate.FeeParams feeParams, uint32 _referralCode, struct IDeBridgeGate.SubmissionAutoParamsTo autoParams, bool hasAutoParams ) internal ``` ### \_applyDiscount ```solidity theme={null} function _applyDiscount( uint256 amount, uint16 discountBps ) internal returns (uint256) ``` ### \_validateToken ```solidity theme={null} function _validateToken( address _token ) internal ``` ### \_claim ```solidity theme={null} function _claim( bytes32 _debridgeId, bytes32 _receiver, address _amount ) internal returns (bool isNativeToken) ``` Unlock the asset on the current chain and transfer to receiver. **Parameters:** | Name | Type | Description | | ------------- | --------- | ----------------------------------------------------------- | | `_debridgeId` | `bytes32` | Asset identifier. | | `_receiver` | `bytes32` | Receiver address. | | `_amount` | `address` | Amount of the transferred asset (note: fee can be applied). | ### \_mintOrTransfer ```solidity theme={null} function _mintOrTransfer( address _token, address _receiver, uint256 _amount, bool isNativeToken ) internal ``` ### \_safeTransferETH ```solidity theme={null} function _safeTransferETH( address to, uint256 value ) internal ``` ### \_withdrawWeth ```solidity theme={null} function _withdrawWeth( address _receiver, uint256 _amount ) internal ``` ### \_normalizeTokenAmount ```solidity theme={null} function _normalizeTokenAmount( address _token, uint256 _amount ) internal returns (uint256) ``` ### getDefiAvaliableReserves ```solidity theme={null} function getDefiAvaliableReserves( address _tokenAddress ) external returns (uint256) ``` Get reserves of a token available to use in DeFi. **Parameters:** | Name | Type | Description | | --------------- | --------- | -------------- | | `_tokenAddress` | `address` | Token address. | ### getDebridgeId ```solidity theme={null} function getDebridgeId( uint256 _chainId, address _tokenAddress ) public returns (bytes32) ``` Calculates asset identifier. **Parameters:** | Name | Type | Description | | --------------- | --------- | ------------------------------------ | | `_chainId` | `uint256` | Current chain id. | | `_tokenAddress` | `address` | Address of the asset on other chain. | ### getbDebridgeId ```solidity theme={null} function getbDebridgeId( uint256 _chainId, bytes _tokenAddress ) public returns (bytes32) ``` Calculates asset identifier. **Parameters:** | Name | Type | Description | | --------------- | --------- | ------------------------------------ | | `_chainId` | `uint256` | Current chain id. | | `_tokenAddress` | `bytes` | Address of the asset on other chain. | ### getDebridgeChainAssetFixedFee ```solidity theme={null} function getDebridgeChainAssetFixedFee( bytes32 _debridgeId, uint256 _chainId ) external returns (uint256) ``` Returns asset fixed fee value for specified debridge and chainId. **Parameters:** | Name | Type | Description | | ------------- | --------- | ----------------- | | `_debridgeId` | `bytes32` | Asset identifier. | | `_chainId` | `uint256` | Chain id. | ### getSubmissionIdFrom ```solidity theme={null} function getSubmissionIdFrom( bytes32 _debridgeId, uint256 _chainIdFrom, uint256 _amount, address _receiver, uint256 _nonce, struct IDeBridgeGate.SubmissionAutoParamsFrom _autoParams, bool _hasAutoParams, address _sender ) public returns (bytes32) ``` Calculate submission id for auto claimable transfer. **Parameters:** | Name | Type | Description | | ---------------- | ----------------------------------------------- | --------------------------------------------------------------- | | `_debridgeId` | `bytes32` | Asset identifier. | | `_chainIdFrom` | `uint256` | Chain identifier of the chain where tokens are sent from. | | `_amount` | `uint256` | Amount of the transferred asset (note: the fee can be applied). | | `_receiver` | `address` | Receiver address. | | `_nonce` | `uint256` | Submission id. | | `_autoParams` | `struct IDeBridgeGate.SubmissionAutoParamsFrom` | Auto params for external call. | | `_hasAutoParams` | `bool` | True if auto params are provided. | | `_sender` | `address` | Address that will call claim. | ### getDeployId ```solidity theme={null} function getDeployId( bytes32 _debridgeId, string _name, string _symbol, uint8 _decimals ) public returns (bytes32) ``` Calculates asset identifier for deployment. **Parameters:** | Name | Type | Description
프로젝트로 돌아가기