fisherBridgeSendCoin
Function Type: external payable
Function Signature: fisherBridgeSendCoin(address,address,uint256,uint256,uint256,bytes)
Access Control: onlyFisherExecutor
Returns: void
Facilitates native coin deposits from external chain to EVVM through the fisher bridge system. This function validates user signatures using asyncNonce system, accepts native currency payments, and emits events for cross-chain processing coordination.
Parameters
| Parameter | Type | Description |
|---|---|---|
from | address | User initiating the deposit from external chain |
addressToReceive | address | Recipient address for EVVM balance credit |
priorityFee | uint256 | Fee amount paid to the fisher executor |
amount | uint256 | Amount of native coins to deposit to EVVM |
nonce | uint256 | User-managed sequential nonce for replay protection |
signature | bytes | Cryptographic signature (EIP-191) from the from address authorizing this deposit. |
Access Control
modifier onlyFisherExecutor() {
if (msg.sender != fisherExecutor.current) {
revert();
}
_;
}
Only addresses with the current fisherExecutor role can call this function.
Workflow
1. Nonce Validation
if (asyncNonce[from][nonce]) revert CoreError.AsyncNonceAlreadyUsed();
Checks if nonce has already been used. The External Chain Station uses asyncNonce[from][nonce] mapping instead of Core.sol's nonce system.
2. Signature Verification
if (
SignatureRecover.recoverSigner(
AdvancedStrings.buildSignaturePayload(
evvmID,
hostChainAddress.currentAddress,
Hash.hashDataForFisherBridge(
addressToReceive,
address(0), // Native coins
priorityFee,
amount
),
fisherExecutor.current,
nonce,
true
),
signature
) != from
) revert CoreError.InvalidSignature();
Validates EIP-191 signature by recovering the signer and comparing to from address. Uses SignatureRecover.recoverSigner() with payload built by AdvancedStrings.buildSignaturePayload().
For more information about the signature structure, refer to the Fisher Bridge Signature Structure.
3. Payment Validation
if (msg.value != amount + priorityFee)
revert Error.InsufficientBalance();
Ensures the fisher executor sends exactly the required amount:
amount: Native coins for deposit to EVVMpriorityFee: Fee paid to the fisher executor
4. Mark Nonce as Used
asyncNonce[from][nonce] = true;
Marks this nonce as consumed to prevent replay attacks.
5. Event Emission
emit FisherBridgeSend(
from,
addressToReceive,
address(0), // Native coins
priorityFee,
amount,
nonce
);
Emits event with transfer details for cross-chain coordination.
Native Coin Handling
Payment Structure
The msg.value must equal the sum of:
- Deposit Amount: Native coins to be credited in EVVM
- Priority Fee: Compensation for the fisher executor
Value Validation
Total Required = amount + priorityFee
msg.value must equal Total Required
Unlike ERC20 deposits, native coin deposits require exact payment matching.
Event Definition
event FisherBridgeSend(
address indexed from,
address indexed addressToReceive,
address indexed tokenAddress, // address(0) for native coins
uint256 priorityFee,
uint256 amount,
uint256 nonce
);
Event Parameters
from: User who authorized the deposit (indexed)addressToReceive: Recipient on EVVM (indexed)tokenAddress:address(0)for native coins (indexed)priorityFee: Fee paid to fisher executoramount: Native coin deposit amountnonce: Execution nonce used for this transaction
Cross-Chain Processing
Host Chain Coordination
- Event Monitoring: Host chain services monitor for
FisherBridgeSendevents withtokenAddress == address(0) - Native Coin Recognition: Identify native coin deposits by zero address
- EVVM Credit: Host chain station credits
addressToReceivewithamountof native coins - Fee Handling: Priority fee management through EVVM balance system
Signature Consistency
The signature format includes address(0) for native coins, ensuring consistency between external and host chain validation.
Fisher Bridge Benefits
For Users
- Gasless Deposits: Users don't pay gas fees on external chain
- Direct Payment: Simple native currency payment to fisher
- Signature Authorization: Single signature authorizes the deposit
For Fisher Executors
- Priority Fees: Earn fees in native currency
- Direct Payment: Receive both deposit and fee in single transaction
- Service Revenue: Generate income from cross-chain deposit facilitation
Security Features
Signature Security
- EIP-191 Standard: Uses Ethereum's signed message standard (see signature format)
- SignatureRecover: Uses
SignatureRecover.recoverSigner()to validate signatures - AdvancedStrings: Payload built with
AdvancedStrings.buildSignaturePayload() - Native Coin Identifier:
address(0)clearly identifies native coin deposits - Replay Protection:
asyncNoncemapping prevents signature reuse - Parameter Binding: Signature tied to specific deposit parameters
Payment Security
- Exact Value Matching: Requires precise payment amount
- Atomic Operation: Payment and validation in single transaction
- Fee Transparency: Clear separation of deposit amount and priority fee
Access Control
- Fisher Authorization: Only authorized executors can accept deposits
- Signature Validation: Cryptographic proof of user consent required (see signature format)
Error Conditions
| Error | Condition |
|---|---|
CoreError.AsyncNonceAlreadyUsed() | Nonce has already been used for this user |
CoreError.InvalidSignature() | Signature verification fails |
Error.InsufficientBalance() | msg.value != amount + priorityFee |
| Access Control Revert | Called by unauthorized address |
Usage Flow
- User Intent: User wants to deposit native coins to EVVM
- Signature Creation: User signs authorization message with deposit details
- Fisher Payment: Fisher sends
amount + priorityFeein native currency - Fisher Execution: Fisher calls
fisherBridgeSendCoinwith signature - Validation: Function validates signature and payment amount
- Event Emission: Event emitted for cross-chain coordination
- Cross-Chain: Host chain services process the deposit to EVVM
- Balance Credit: Recipient receives native coins in EVVM balance
Payment Example
For a deposit of 1 ETH with 0.01 ETH priority fee:
fisherBridgeSendCoin{value: 1.01 ether}(
userAddress,
recipientAddress,
0.01 ether, // priorityFee
1 ether, // amount
userNonce, // nonce
signature
);
Result:
- External Station: Receives 1.01 ETH
- EVVM Credit: Recipient gets 1 ETH balance
- Fisher Fee: 0.01 ETH compensation
Integration Requirements
Off-Chain Services
- Event Monitoring: Listen for
FisherBridgeSendevents withaddress(0) - Native Coin Processing: Handle native currency cross-chain transfers
- Nonce Synchronization: Maintain coordination with host chain
Payment Coordination
- User-Fisher Agreement: Establish terms for deposit and fee amounts
- Payment Verification: Ensure correct value transmission
- Cross-Chain Messaging: Coordinate with host chain for EVVM crediting
The fisher executor must send exactly amount + priorityFee in native currency. Any deviation will cause transaction failure.
Native coins are consistently represented as address(0) throughout the system, from signature creation to EVVM balance crediting.