Skip to content

Commit

Permalink
feat: GMP decoding, remove deprecated contracts, naming improvements (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
nmlinaric authored Jun 7, 2024
1 parent e4bb75f commit 415bfb2
Show file tree
Hide file tree
Showing 53 changed files with 141 additions and 4,644 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# sygma-solidity

Sygma uses Solidity smart contracts to enable transfers to and from EVM compatible chains. These contracts consist of a core bridge contract (Bridge.sol) and a set of handler contracts (ERC20Handler.sol, ERC721Handler.sol, PermissionedGenericHandler.sol, PermissionlessGenericHandler.sol). The bridge contract is responsible for initiating and executing proposed transfers. The handlers are used by the bridge contract to interact with other existing contracts.
Sygma uses Solidity smart contracts to enable transfers to and from EVM compatible chains. These contracts consist of a core bridge contract (Bridge.sol) and a set of handler contracts (ERC20Handler.sol, ERC721Handler.sol, GmpHandler.sol). The bridge contract is responsible for initiating and executing proposed transfers. The handlers are used by the bridge contract to interact with other existing contracts.

## Deployments

Expand Down
12 changes: 3 additions & 9 deletions contracts/Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,7 @@ contract Bridge is Pausable, Context, EIP712 {
@return handlerResponse a handler response:
- ERC20Handler: responds with an empty data.
- ERC721Handler: responds with the deposited token metadata acquired by calling a tokenURI method in the token contract.
- PermissionedGenericHandler: responds with the raw bytes returned from the call to the target contract.
- PermissionlessGenericHandler: responds with an empty data.
- GmpHandler: responds with an empty data.
*/
function deposit(uint8 destinationDomainID, bytes32 resourceID, bytes calldata depositData, bytes calldata feeData)
external payable whenNotPaused
Expand Down Expand Up @@ -289,9 +288,7 @@ contract Bridge is Pausable, Context, EIP712 {
- data Data originally provided when deposit was made.
@param signature bytes memory signature composed of MPC key shares
@notice Emits {ProposalExecution} event.
@notice Behaviour of this function is different for {PermissionedGenericHandler} and other specific ERC handlers.
In the case of ERC handler, when execution fails, the handler will terminate the function with revert.
In the case of {PermissionedGenericHandler}, when execution fails, the handler will emit a failure event and terminate the function normally.
@notice For ERC handlers, when execution fails, the handler will terminate the function with revert.
*/
function executeProposal(Proposal memory proposal, bytes calldata signature) public {
Proposal[] memory proposalArray = new Proposal[](1);
Expand All @@ -310,9 +307,7 @@ contract Bridge is Pausable, Context, EIP712 {
- data Data originally provided when deposit was made.
@param signature bytes memory signature for the whole array composed of MPC key shares
@notice Emits {ProposalExecution} event for each proposal in the batch.
@notice Behaviour of this function is different for {PermissionedGenericHandler} and other specific handlers.
In the case of ERC handler, when execution fails, the handler will terminate the function with revert.
In the case of {PermissionedGenericHandler}, when execution fails, the handler will emit a failure event and terminate the function normally.
@notice For ERC handlers, when execution fails, the handler will terminate the function with revert.
*/
function executeProposals(Proposal[] memory proposals, bytes calldata signature) public whenNotPaused {
if (proposals.length == 0) revert EmptyProposalsArray();
Expand Down Expand Up @@ -382,7 +377,6 @@ contract Bridge is Pausable, Context, EIP712 {
@notice Only callable by address that has the right to call the specific function,
which is mapped in {functionAccess} in AccessControlSegregator contract.
@param txHash Transaction hash which contains deposit that should be retried
@notice This is not applicable for failed executions on {PermissionedGenericHandler}
*/
function retry(string memory txHash) external onlyAllowed {
emit Retry(txHash);
Expand Down
4 changes: 2 additions & 2 deletions contracts/TestContracts.sol
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,10 @@ contract TestDeposit {

/**
This helper can be used to prepare execution data for Bridge.deposit() on the source chain
if PermissionlessGenericHandler is used
if GmpHandler is used
and if the target function accepts (address depositor, bytes executionData).
The execution data (packed as bytes) will be packed together with depositorAddress
in PermissionlessGenericHandler before execution on the target chain.
in GmpHandler before execution on the target chain.
This function packs the bytes parameter together with a fake address and removes the address.
After repacking in the handler together with depositorAddress, the offsets will be correct.
Usage: pack all parameters as bytes, then use this function, then pack the result of this function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import "../interfaces/IHandler.sol";
@author ChainSafe Systems.
@notice This contract is intended to be used with the Bridge contract.
*/
contract PermissionlessGenericHandler is IHandler {
contract GmpHandler is IHandler {
uint256 public constant MAX_FEE = 1000000;

address public immutable _bridgeAddress;
Expand Down
171 changes: 0 additions & 171 deletions contracts/handlers/PermissionedGenericHandler.sol

This file was deleted.

102 changes: 0 additions & 102 deletions contracts/handlers/fee/DynamicERC20FeeHandlerEVM.sol

This file was deleted.

Loading

0 comments on commit 415bfb2

Please sign in to comment.