Skip to content

FortaBridgedPolygon

This version of the Forta token is living on the child chain. That would be: - Polygon for production - Mumbai for testing

When tokens are deposited from the root chain, the `childChainManagerProxy` will call the {deposit} function, which will mint corresponding tokens on the child chain. The total supply on the side chain is expected to match the amount of locked tokens on the parent chain.

In order to bridge tokens back from the child chain to the parent chain, any (whitelisted) user can call either the {withdraw} or the {withdrawTo} function. This will burn tokens here, emitting a burn event (Transfer event from the user to address(0)) in the process. This burn event is needed to trigger unlocking the corresponding tokens on the parent chain.

childChainManagerProxy

address childChainManagerProxy

DepositOnlyByChildChainManager

error DepositOnlyByChildChainManager()

flashWhitelistRole

modifier flashWhitelistRole(address user)

constructor

constructor(address _childChainManagerProxy) public

initialize

function initialize(address admin) public

Initializer method, access point to initialize inheritance tree.

Name Type Description
admin address address that will be ADMIN_ROLE.

deposit

function deposit(address user, bytes depositData) external

To avoid token locked on the parent chains not being correctly represented on the child chain, this should NEVER revert (exception: _mint can revert if totalSupply() <= _maxSupply()). Consequently, we might have to temporarily grant WHITELIST_ROLE to the receiver. If the receiver is not whitelisted when the deposit happens, tokens are minted but not usable until the receiver goes through the whitelisting process.

Name Type Description
user address the destination address for the tokens.
depositData bytes encoded data sent by the bridge.

withdraw

function withdraw(uint256 amount) external

Burns tokens in L2 so Polygon's PoS bridge will unlock them in L1.

Name Type Description
amount uint256 of tokens to send to L1

withdrawTo

function withdrawTo(uint256 amount, address receiver) external

_In order for a token holder on the child chain to be able to withdraw tokens to another address on the parent chain, this function will temporarily transfer the tokens to the address of the receiver on the parent chain so that the burn event is correct.

In order to do so, the receiver address must be temporarily granted WHITELIST_ROLE._

Name Type Description
amount uint256 of tokens to send to L1
receiver address destination address in L1

version

function version() external pure returns (string)

Contract version

Since FortaCommon is IVersioned, Forta is deployed in L1 and FortaBridgedPolygon in L2, we need to implement the interface with a method instead of immutable variable.

Name Type Description
[0] string version of FORT deployed in L2

__gap

uint256[49] __gap