# Klaytn

## Code

* `KlaytnVault.sol`
* `KlaytnVault.impl.sol`
* `MultiSigWallet.sol`

## Address

* Klaytn Vault Contract Address: `0x9Abc3F6c11dBd83234D6E6b2c373Dfc1893F648D`

## Events

### Deposit

```bash
event Deposit(string toChain, address fromAddr, bytes toAddr, address token, uint8 decimal, uint amount, uint depositId, bytes data);
```

Event occurs when a user using the Orbit Bridge System requests bridging to Klaytn Vault

* `string fromChain` : Chain Symbol requesting bridging
* `string toChain` : Chain Symbol to execute bridging
* `bytes fromAddr` : Address of the chain requesting bridging
* `bytes toAddr` : Address of chain to execute bridging
* `address token` : Token Information to be executed bridging
* `uint8 decimal` : Token Decimal requesting bridging
* `uint amount` : Token Amount requesting bridging
* `uint depositId` : Unique Identifier of bridging request
* `bytes data` : Execution data requested for bridging

### DepositNFT

```bash
event DepositNFT(string toChain, address fromAddr, bytes toAddr, address token, uint tokenId, uint amount, uint depositId, bytes data);
```

Event occurs when a user using the Orbit Bridge System requests NFT bridging to Klaytn Vault

* `string fromChain` : Chain Symbol requesting bridging
* `string toChain` : Chain Symbol to execute bridging
* `bytes fromAddr` : Address of the chain requesting bridging
* `bytes toAddr` : Address of chain to execute bridging
* `address token` : Token Information to be executed bridging
* `uint tokenId` : Token ID requesting bridging
* `uint amount` : Token Amount requesting bridging
* `uint depositId` : Unique Identifier of bridging request
* `bytes data` : Execution data requested for bridging

### Withdraw

```bash
event Withdraw(string fromChain, bytes fromAddr, bytes toAddr, bytes token, bytes32[] bytes32s, uint[] uints, bytes data);
```

An event occurs when a bridge operator executes bridging with Klaytn Vault through the Orbit Bridge System.

* `string fromChain` : Chain Symbol requesting bridging
* `bytes fromAddr` : Address of the chain requesting bridging
* `bytes toAddr` : Address of chain to execute bridging
* `bytes token` : Token Address released by bridging execution
* `bytes32[] bytes32s` : Bytes32 data array used in the bridging consensus process
* `uint[] uints` : Uint data array used in the bridging consensus process
* `bytes data` : Execution data for Bridge Receiver

### WithdrawNFT

```bash
event WithdrawNFT(string fromChain, bytes fromAddr, bytes toAddr, bytes token, bytes32[] bytes32s, uint[] uints, bytes data);
```

An event occurs when a bridge operator executes NFT bridging with Klaytn Vault through the Orbit Bridge System.

* `string fromChain` : Chain Symbol requesting bridging
* `bytes fromAddr` : Address of the chain requesting bridging
* `bytes toAddr` : Address of chain to execute bridging
* `bytes token` : Token Address released by bridging execution
* `bytes32[] bytes32s` : Bytes32 data array used in the bridging consensus process
* `uint[] uints` : Uint data array used in the bridging consensus process
* `bytes data` : Execution data for Bridge Receiver

## Interface

```bash
pragma solidity 0.5.0;

interface KlaytnVault {
    function getVersion() public pure returns(string memory);
    function getChainId(string memory _chain) public view returns(bytes32);
    
    function deposit(string memory toChain, bytes memory toAddr) payable public;
    function deposit(string memory toChain, bytes memory toAddr, bytes memory data) payable public;
    
    function depositToken(address token, string memory toChain, bytes memory toAddr, uint amount) public;
    function depositToken(address token, string memory toChain, bytes memory toAddr, uint amount, bytes memory data) public;
    
    function depositNFT(address token, string memory toChain, bytes memory toAddr, uint tokenId) public;
    function depositNFT(address token, string memory toChain, bytes memory toAddr, uint tokenId, bytes memory data) public;
    
    function withdraw(address hubContract, string memory fromChain, bytes memory fromAddr, bytes memory toAddr, bytes memory token, bytes32[] memory bytes32s, uint[] memory uints, bytes memory data, uint8[] memory v, bytes32[] memory r, bytes32[] memory s) public;
    function withdrawNFT(address hubContract, string memory fromChain, bytes memory fromAddr, bytes memory toAddr, bytes memory token, bytes32[] memory bytes32s, uint[] memory uints, bytes memory data, uint8[] memory v, bytes32[] memory r, bytes32[] memory s) public;
}
```
