# ICON

## Code

* `minter.py`
* Code can be found in [HERE](https://github.com/orbit-chain/bridge-contract)

## Events

### Swap

```bash
@eventlog
def Swap(self, hubContract: bytes, fromChain: str, toChain: str, fromAddr: bytes, toAddr: bytes, tokenAddress: bytes, bytes32s: bytes, uints: bytes, data: bytes):
        pass
```

This event occurs when a bridge operator performs bridging with ICON Minter through the Orbit Bridge System.

* `bytes hubContract` : Orbit Hub Contract Address
* `str fromChain` : Chain Symbol requesting bridging
* `str toChain` : Chain Symbol to execute bridging
* `bytes fromAddr` : Address of the chain requesting bridging
* `bytes toAddr` : Address of chain to execute bridging
* `bytes tokenAddress` : Token Address minted by bridging execution
* `bytes bytes32s` : Bytes32 data array used in the bridging consensus process
* `bytes uints` : Uint data array used in the bridging consensus process
* `bytes data` : Execution data for Bridge Receiver

### SwapNFT

```bash
@eventlog
def SwapNFT(self, hubContract: bytes, fromChain: str, toChain: str, fromAddr: bytes, toAddr: bytes, tokenAddress: bytes, bytes32s: bytes, uints: bytes, data: bytes):
        pass
```

This event occurs when a bridge operator performs bridging with ICON Minter through the Orbit Bridge System.

* `bytes hubContract` : Orbit Hub Contract Address
* `str fromChain` : Chain Symbol requesting bridging
* `str toChain` : Chain Symbol to execute bridging
* `bytes fromAddr` : Address of the chain requesting bridging
* `bytes toAddr` : Address of chain to execute bridging
* `bytes tokenAddress` : Token Address minted by bridging execution
* `bytes bytes32s` : Bytes32 data array used in the bridging consensus process
* `bytes uints` : Uint data array used in the bridging consensus process
* `bytes data` : Execution data for Bridge Receiver

### SwapRequest

```bash
@eventlog
def SwapRequest(self, fromChain: str, toChain: str, fromAddr: bytes, toAddr: bytes, token: bytes, tokenAddress: bytes, decimal: int, amount: int, depositId: int, data: bytes):
    pass
```

Event occurs when a user who uses the Orbit Bridge System requests bridging to ICON Minter

* `str fromChain` : Chain Symbol requesting bridging
* `str toChain` : Chain Symbol to execute bridging
* `bytes fromAddr` : Address of the chain requesting bridging
* `bytes toAddr` : Address of chain to execute bridging
* `bytes token` : Token Information to be executed bridging
* `bytes tokenAddress` : Token Address  requesting bridging
* `int decimal` : Token Decimal requesting bridging
* `int amount` : Token Amount requesting bridging
* `int depositId` : Unique Identifier of bridging request
* `bytes data` : Execution data for Bridge Receiver

## Interface

```bash
class MinterInterface(InterfaceScore):
    @interface
    def getTokenAddress(self, token: bytes) -> Address:
        pass

    @interface
    def getChainId(self, chain: str) -> bytes:
        pass

    @interface
    def swap(self, hubContract: bytes, fromChain: str, fromAddr: bytes, toAddr: bytes, token: bytes, bytes32s: bytes, uints: bytes, sigs: str, data: bytes = None):
        pass
    
    @interface
    def swapNFT(self, hubContract: bytes, fromChain: str, fromAddr: bytes, toAddr: bytes, token: bytes, bytes32s: bytes, uints: bytes, sigs: str, data: bytes = None):
        pass
    
    @interface
    @payable
    def requestSwap(self, tokenAddress: Address, toChain: str, toAddr: bytes, amount: int, data: bytes = None):
        pass

    @interface
    @payable
    def def requestSwapNFT(self, nftAddress: Address, toChain: str, toAddr: bytes, tokenId: int, data: bytes = None):
        pass
```
