Search
⌃K

Bridge (DEPRECATED)

Upgraded to multichain
This bridge is used for functions like Deposit or Claim. For instance, the user deposits some DEI on the Ethereum mainnet network and wants to claim them on the Polygon. To this function be performed, it needs Muon nodes' sign. They check if this wallet has that amount of deposited DEI on the Ethereum mainnet.

Deployments

Ethereum Mainnet
Polygon
Fantom
BSC
Andromeda
Arbitrum
0x7aB4C5738e39E613186AFFD4c50DbfDFF6c22065
0x7aB4C5738e39E613186AFFD4c50DbfDFF6c22065
0x7aB4C5738e39E613186AFFD4c50DbfDFF6c22065
0x70A4c35eABFa973B27Cb3d489e154DB6d9A24ebD
0x7Be7EC9B8438Fbf91e3e00B02fd46cA53F9cC144
0x9A5d6D10F59fEe47694A154B472De5aC113C6C08
The following codes are for ETH mainnet which you can find here:

State Variables

Ownable (Inherited)

Bridge specific

uint256 public lastTxId
Uses as unique id for deposit tx
uint public network
Chain id that this contract deployed on
uint public minReqSigs
Minimum required signature
uint public scale
Used for math calculations
uint public bridgeReserve
It adjusts buyback & recollaterlize on dei pools
address public muonContract
Address of muon signature verifier
address public deiAddress
Address of DEI
uint8 public ETH_APP_ID
Muon's eth app id
bool public mintable
Uses mint functions instead of transfer
mapping (uint => address) public sideContracts
Used to specify the bridge contract address on each chains
mapping(uint => address) public tokens
Determines each token's id (e.g. DEI id = 0)
mapping(uint => Transaction) private txs
Stores deposite transactions details
mapping(address => mapping(uint => uint[])) private userTxs
Stores user's transactions id to a specific destination
mapping(uint => mapping(uint => bool)) public claimedTxs
Stores all transactions are claimed from a specific source
mapping(uint => uint) public fee
Determines each token's fee
mapping(uint => uint) public collectedFee
Sum of collected fee amounts that owner claimed for each token

Structs

Transaction {
uint txId;
uint tokenId;
uint amount;
uint fromChain;
uint toChain;
address user;
uint txBlockNo;
}

Public Functions

deposit(uint amount, uint toChain,uint tokenId) external returns (uint txId)
Used to deposit user's funds on source chain
depositFor(address user, uint amount, uint toChain, uint tokenId) external returns (uint txId)
Used to deposit a user's funds for another user on source chain
deposit(uint amount, uint toChain, uint tokenId, uint referralCode) external returns (uint txId)
Used to deposit user's funds with referral code (used by Deus partners) on source chain
depositFor(address user, uint amount, uint toChain, uint tokenId, uint referralCode) external returns (uint txId)
Used to deposit a user's funds with referral code (used by Deus partners) for another user on source chain
_deposit(address user, uint amount, uint toChain, uint tokenId) internal whenNotPaused() returns (uint txId)
Actual function for deposit which is called by above deposit functions
claim(address user, uint amount, uint fromChain, uint toChain, uint tokenId, uint txId, bytes calldata _reqId, SchnorrSign[] calldata sigs) external
Used for claim funds on destination chain which have been deposited

Restricted Functions

setBridgeReserve(uint bridgeReserve_) external onlyOwner
Sets bridgeReserve which adjusts buyback & recollaterlize on dei pools
setToken(uint tokenId, address tokenAddress) external onlyOwner
Assign a specific token id to a specific token address
setNetworkID(uint network_) external onlyOwner
Sets network which is the chain id that this contract deployed on
setFee(uint tokenId, uint fee_) external onlyOwner
Assign a fee to a specific token id
setDeiAddress(address deiAddress_) external onlyOwner
Sets deiAddress
setMinReqSigs(uint minReqSigs_) external onlyOwner
Sets minimum required signature
setSideContract(uint network_, address address_) external onlyOwner
Sets the bridge contract address on each chains
setMintable(bool mintable_) external onlyOwner
Sets mintable
setEthAppId(uint8 ETH_APP_ID_) external onlyOwner
Sets ETH_APP_ID
setMuonContract(address muonContract_) external onlyOwner
Sets muonContract
pause() external onlyOwner
Used to pause claim and deposit functions
unpase() external onlyOwner
Used to unpause claim and deposit functions
withdrawFee(uint tokenId, address to) external onlyOwner
Used by owner to claim fee for each tokens

View Functions

collatDollarBalance(uint collat_usd_price) public view returns (uint)
This function gives the abitlity to the bridge so can behave like DEI pool
pendingTxs(uint fromChain, uint[] calldata ids) public view returns (bool[] memory unclaimedIds)
Each deposit has a unique id on the source chain; this function returns the status of ids whether they are claimed or not
getUserTxs(address user, uint toChain) public view returns (uint[] memory)
Returns deposit transactions ids to the destination chain for a user
getTransaction(uint txId_) public view returns(uint txId, uint tokenId, uint amount, uint fromChain, uint toChain, address user, uint txBlockNo, uint currentBlockNo)
Returns the Transaction details which are: transaction id, token id, deposited amount, source chain, destination chain, user's address, transaction block number, current block number
getExecutingChainID() public view returns (uint)
Returns the chain id that this contract deployed on

Events

Deposit(address indexed user, uint tokenId, uint amount, uint indexed toChain, uint txId)
Emitted when deposit and depositFor happen
DepositWithReferralCode(address indexed user, uint tokenId, uint amount, uint indexed toChain, uint txId, uint referralCode)
Emitted when deposit and depositFor with referral code happen
Claim(address indexed user, uint tokenId, uint amount, uint indexed fromChain, uint txId)
Emitted when claim happens