This project is a truffle project. There are multiple files in the contracts folder and you can select between:
Bridge.sol
: This is the base bridge interface.Implementation
/generic/721/ERC721.sol
: This is the base ERC-721 token interface.
bridge/Implementation/BridgeFeatures/
folder contains the different functions of the bridge.
The bridge implements the ERC-1538 proxy pattern in order to be upgradable:
ImplBridgeFunMigrateFromERC721.sol
: This implements logic data of the arrival bridge (IOU minting / transfert / ...).ImplERC721TokenReceiver.sol
: Handle the receipt of an NFT, the ERC721 smart contract calls this function on the recipient after atransfer
.ImplBridgeFunInit.sol
: This implements logic data of a bridge initialization.ImplBridgeFunMigrateToERC721.sol
: This implements logic data of the departure bridge (migration intent / escrow and signature hash generation)
bridge/Implementation/Proxification/
folder contains the different functions of the ERC-1538 proxy pattern for Bridge deployment. Get more infos here
bridge/Implementation/Test/
folder contains an implementation of a token ERC-721 and a custom ERC-721 with premint functions (IOU)
$ npm test
To deploy the bridge you need to choose which network it will be operating on. To this, find the universe unique id (last 4 bytes of keccak256 hash of the nameof the network) and add it line 45-48 (await instancedInit.init("0xe35d7d6b");
) to the deployement script here
Update truffle-config.js with your credentials and network data:
networks : {
rinkeby: {
provider: () => new HDWalletProvider('yourprivatekey', `your_rpc_url`),
network_id: 4, // (eg : 4 = Rinkeby)
gas: 5500000, // Rinkeby has a lower block limit than mainnet
confirmations: 2, // # of confs to wait between deployments. (default: 0)
timeoutBlocks: 200, // # of blocks before a deployment times out (minimum/default: 50)
skipDryRun: true // Skip dry run before migrations? (default: false for public nets )
},
}
Deploy all contracts on this network (migration/bridge/erc721/iou): (after setting configuration for the Manipulator (see MANIPULATOR.md))
$ truffle migrate --network rinkeby --reset
Please note all the deployement informations. The BridgeTransparentProxy contract address is the address of your bridge. You can then use that address in the relay configuration.