Redeeming
In order to use your Chainflip account, you need to fund it.
Redeem via State Chain Gateway
As explained in the State Chain Overview, the StateChainGateway
contract has two main entry points for those looking to interact with the protocol:
- Funding a State Chain account with $FLIP tokens
- Redeeming $FLIP tokens from a State Chain account
Redeeming from a State Chain account
After the user has submitted a redemption request to the State Chain, the protocol will submit the redemption to the State Chain Gateway. The contract will store it as a Redemption struct. The redemption is considered to be pending and can be checked with the view function below.
Param | Description | Data type |
---|---|---|
amount | Amount of $FLIP tokens redeemed | uint256 |
redeemAddress | Ethereum address that will receive the redeemed $FLIP | address |
startTime | Starting timestamp in which the Redemption can be executed | uint48 |
expiryTime | Timestamp in which the redemption expires and can't be executed anymore | uint48 |
executor | Address that can execute the redemption. By default any address can execute any redemption. | address |
struct Redemption {
uint256 amount;
address redeemAddress;
uint48 startTime;
uint48 expiryTime;
address executor;
}
function getPendingRedemption(bytes32 nodeID) external view returns (Redemption memory);
As previously explained, the fail-safe mechanism adds a 2-day delay between the registry of the redemption and the time when it can be executed. After that delay and until the expiry time, the redemption can be executed to complete the redemption process. In the event of the redemption having specified an executor address, only that address can execute the redemption. Otherwise, any address can execute it.
The protocol doesn't automatically execute the redemptions, the user needs to make smart contract call below specifying the nodeID of the account following the same format as the funding function.
function executeRedemption(bytes32 nodeID) external returns (address, uint256);