Skip to content

Commit

Permalink
Add and run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
QEDK committed Nov 3, 2021
1 parent 7077c9d commit f75a27b
Show file tree
Hide file tree
Showing 50 changed files with 35,510 additions and 944 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ name: Node.js CI

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get node.js
uses: actions/setup-node@v1
with:
node-version: '14.x'
- run: npm install
- run: npx hardhat compile --show-stack-traces
- uses: actions/checkout@v2
- name: Get node.js
uses: actions/setup-node@v1
with:
node-version: "14.x"
- run: npm install
- run: npx hardhat compile --show-stack-traces
15 changes: 15 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"overrides": [
{
"files": "*.sol",
"options": {
"printWidth": 120,
"tabWidth": 4,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": false,
"explicitTypes": "always"
}
}
]
}
38 changes: 18 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

FxPortal for Polygon(prev Matic)Chain. No mapping. Seamless communication with Ethereum Network.

Audit - [Fx-Portal Contracts Audit by Halborn](https://github.com/fx-portal/contracts/blob/main/Polygon_FX_Portal_Smart_Contract_Security_Audit_Halborn_v1_0%20(1).pdf)
Audit - [Fx-Portal Contracts Audit by Halborn](<https://github.com/fx-portal/contracts/blob/main/Polygon_FX_Portal_Smart_Contract_Security_Audit_Halborn_v1_0%20(1).pdf>)

### What is Fx bridge (fx-portal)?

Expand All @@ -12,45 +12,43 @@ In short, it's Meta bridge. This bridge allows any state-syncs without mapping.

#### Some use-cases of Fx-portal

* [ERC20 token tranfer from Ethereum to Matic-Chain without mapping request](https://github.com/jdkanani/fx-portal/tree/main/contracts/examples/erc20-transfer)
* [Lazy minting of ERC20 tokens on MaticChain](https://github.com/jdkanani/fx-portal/tree/main/contracts/examples/mintable-erc20-transfer)
* [State Transfer between Ethereum-Matic](https://github.com/jdkanani/fx-portal/tree/main/contracts/examples/state-transfer)
- [ERC20 token tranfer from Ethereum to Matic-Chain without mapping request](https://github.com/jdkanani/fx-portal/tree/main/contracts/examples/erc20-transfer)
- [Lazy minting of ERC20 tokens on MaticChain](https://github.com/jdkanani/fx-portal/tree/main/contracts/examples/mintable-erc20-transfer)
- [State Transfer between Ethereum-Matic](https://github.com/jdkanani/fx-portal/tree/main/contracts/examples/state-transfer)

**What about [PoS portal](https://docs.matic.network/docs/develop/ethereum-matic/pos/getting-started)?**

PoS Portal is another bridge, but it works only for few ERC standards and requires mappings. It is more developer-friendly, allows customization without much headache.
PoS Portal is another bridge, but it works only for few ERC standards and requires mappings. It is more developer-friendly, allows customization without much headache.

While Fx-portal focuses on permissionless-ness and flexibility, a developer might have to write more code but more customizable than PoS Portal. It requires no mapping.

**Can I build my bridge?**

Yes. You can check docs here: https://docs.matic.network/docs/develop/l1-l2-communication/ethereum-to-matic
https://docs.matic.network/docs/develop/l1-l2-communication/matic-to-ethereum
https://docs.matic.network/docs/develop/l1-l2-communication/matic-to-ethereum

### What are FxChild and FxRoot?

`FxChild` (FxChild.sol) and `FxRoot` (FxRoot.sol) are main contracts on which mapping-less bridge works. It calls and passes data to user-defined methods on another chain without mapping.
`FxChild` (FxChild.sol) and `FxRoot` (FxRoot.sol) are main contracts on which mapping-less bridge works. It calls and passes data to user-defined methods on another chain without mapping.

**Mumbai**

| Contract | Deployed address |
| :----- | :- |
| [FxRoot (Goerli)](https://goerli.etherscan.io/address/0x3d1d3E34f7fB6D26245E6640E1c50710eFFf15bA#code) | `0x3d1d3E34f7fB6D26245E6640E1c50710eFFf15bA` |
| [FxChild (Mumbai)](https://explorer-mumbai.maticvigil.com/address/0xCf73231F28B7331BBe3124B907840A94851f9f11/contracts) | `0xCf73231F28B7331BBe3124B907840A94851f9f11`|
| Contract | Deployed address |
| :---------------------------------------------------------------------------------------------------------------------- | :------------------------------------------- |
| [FxRoot (Goerli)](https://goerli.etherscan.io/address/0x3d1d3E34f7fB6D26245E6640E1c50710eFFf15bA#code) | `0x3d1d3E34f7fB6D26245E6640E1c50710eFFf15bA` |
| [FxChild (Mumbai)](https://explorer-mumbai.maticvigil.com/address/0xCf73231F28B7331BBe3124B907840A94851f9f11/contracts) | `0xCf73231F28B7331BBe3124B907840A94851f9f11` |

**Mainnet**


| Contract | Deployed address |
| :----- | :- |
| [FxRoot (Ethereum Mainnet)](https://etherscan.io/address/0xfe5e5d361b2ad62c541bab87c45a0b9b018389a2#code) | `0xfe5e5D361b2ad62c541bAb87C45a0B9B018389a2` |
| [FxChild (Matic Mainnnet)](https://explorer-mainnet.maticvigil.com/address/0x8397259c983751DAf40400790063935a11afa28a/contracts) | `0x8397259c983751DAf40400790063935a11afa28a`|

| Contract | Deployed address |
| :------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------- |
| [FxRoot (Ethereum Mainnet)](https://etherscan.io/address/0xfe5e5d361b2ad62c541bab87c45a0b9b018389a2#code) | `0xfe5e5D361b2ad62c541bAb87C45a0B9B018389a2` |
| [FxChild (Matic Mainnnet)](https://explorer-mainnet.maticvigil.com/address/0x8397259c983751DAf40400790063935a11afa28a/contracts) | `0x8397259c983751DAf40400790063935a11afa28a` |

You can deploy your own `FxChild` and `FxRoot`, but no need. Except you want to have some fun and have extra ETH to throw away.

### What can I build with it?

* Arbitrary state bridge (examples/state-transfer)
* Normal ERC20 bridge (examples/erc2-transfer)
* ERC20 token generator bridge (example/mintable-erc20-transfer)
- Arbitrary state bridge (examples/state-transfer)
- Normal ERC20 bridge (examples/erc2-transfer)
- ERC20 token generator bridge (example/mintable-erc20-transfer)
78 changes: 39 additions & 39 deletions config/config.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
{
"mainnet":{
"fxRoot":{
"address":"0xfe5e5D361b2ad62c541bAb87C45a0B9B018389a2"
},
"fxChild":{
"address":"0x8397259c983751DAf40400790063935a11afa28a"
},
"checkpointManager":{
"address":"0x86E4Dc95c7FBdBf52e33D563BbDB00823894C287"
},
"fxERC20":{
"address":"0xAd87e3b217c66B0D45dEaFBC540330d300811b94"
},
"fxERC721":{
"address":"0x467c9BA5DAB81C8975F7d8237ECe61918AA6e8fF"
},
"fxERC1155":{
"address":"0x4443c9877aB1767e1080fa70Ac038758e526c609"
}
},
"testnet":{
"fxRoot":{
"address":"0x3d1d3E34f7fB6D26245E6640E1c50710eFFf15bA"
},
"fxChild":{
"address":"0xCf73231F28B7331BBe3124B907840A94851f9f11"
},
"checkpointManager":{
"address":"0x2890bA17EfE978480615e330ecB65333b880928e"
},
"fxERC20":{
"address":"0xDDE69724AeFBdb084413719fE745aB66e3b055C7"
},
"fxERC721":{
"address":"0xf2720927E048726267C0221ffA41A88528048726"
},
"fxERC1155":{
"address":"0x80be8Cf927047A40d3f5791BF7436D8c95b3Ae5C"
}
"mainnet": {
"fxRoot": {
"address": "0xfe5e5D361b2ad62c541bAb87C45a0B9B018389a2"
},
"fxChild": {
"address": "0x8397259c983751DAf40400790063935a11afa28a"
},
"checkpointManager": {
"address": "0x86E4Dc95c7FBdBf52e33D563BbDB00823894C287"
},
"fxERC20": {
"address": "0xAd87e3b217c66B0D45dEaFBC540330d300811b94"
},
"fxERC721": {
"address": "0x467c9BA5DAB81C8975F7d8237ECe61918AA6e8fF"
},
"fxERC1155": {
"address": "0x4443c9877aB1767e1080fa70Ac038758e526c609"
}
},
"testnet": {
"fxRoot": {
"address": "0x3d1d3E34f7fB6D26245E6640E1c50710eFFf15bA"
},
"fxChild": {
"address": "0xCf73231F28B7331BBe3124B907840A94851f9f11"
},
"checkpointManager": {
"address": "0x2890bA17EfE978480615e330ecB65333b880928e"
},
"fxERC20": {
"address": "0xDDE69724AeFBdb084413719fE745aB66e3b055C7"
},
"fxERC721": {
"address": "0xf2720927E048726267C0221ffA41A88528048726"
},
"fxERC1155": {
"address": "0x80be8Cf927047A40d3f5791BF7436D8c95b3Ae5C"
}
}
}
6 changes: 5 additions & 1 deletion contracts/FxChild.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ interface IStateReceiver {

// IFxMessageProcessor represents interface to process message
interface IFxMessageProcessor {
function processMessageFromRoot(uint256 stateId, address rootMessageSender, bytes calldata data) external;
function processMessageFromRoot(
uint256 stateId,
address rootMessageSender,
bytes calldata data
) external;
}

/**
Expand Down
3 changes: 1 addition & 2 deletions contracts/FxRoot.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;


interface IStateSender {
function syncState(address receiver, bytes calldata data) external;
}
Expand All @@ -10,7 +9,7 @@ interface IFxStateSender {
function sendMessageToChild(address _receiver, bytes calldata _data) external;
}

/**
/**
* @title FxRoot root contract for fx-portal
*/
contract FxRoot is IFxStateSender {
Expand Down
Loading

0 comments on commit f75a27b

Please sign in to comment.