-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/FbV2-docs
- Loading branch information
Showing
99 changed files
with
3,279 additions
and
739 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,11 @@ jobs: | |
with: | ||
pattern: '.github/renovate.json' # Regular expression for filename to validate, default to *.json | ||
|
||
- name: jsonc-syntax-check | ||
uses: stevieb9/[email protected] | ||
with: | ||
pattern: .vscode/*.json' | ||
|
||
|
||
- name: yaml-lint | ||
uses: ibiqlik/action-yamllint@v3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
{ | ||
// This file (like all vscode metadata files) uses JSON with Comments (JSONC) format, which supports: | ||
// - Comments (both single and multi-line) | ||
// - Trailing commas | ||
// - More lenient syntax than standard JSON | ||
|
||
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. | ||
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp | ||
|
||
// List of extensions which should be recommended for users of this workspace. | ||
"recommendations": [ | ||
"dbaeumer.vscode-eslint", | ||
"editorconfig.editorconfig", | ||
"juanblanco.solidity", | ||
"golang.go", | ||
"bierner.markdown-mermaid", | ||
"bpruitt-goddard.mermaid-markdown-syntax-highlighting", | ||
], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,22 @@ | |
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
## [0.5.5](https://github.com/synapsecns/sanguine/compare/@synapsecns/[email protected]...@synapsecns/[email protected]) (2024-11-19) | ||
|
||
**Note:** Version bump only for package @synapsecns/bridge-docs | ||
|
||
|
||
|
||
|
||
|
||
## [0.5.4](https://github.com/synapsecns/sanguine/compare/@synapsecns/[email protected]...@synapsecns/[email protected]) (2024-11-13) | ||
|
||
**Note:** Version bump only for package @synapsecns/bridge-docs | ||
|
||
|
||
|
||
|
||
|
||
## [0.5.3](https://github.com/synapsecns/sanguine/compare/@synapsecns/[email protected]...@synapsecns/[email protected]) (2024-11-07) | ||
|
||
**Note:** Version bump only for package @synapsecns/bridge-docs | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,79 @@ | |
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
|
||
## [0.14.6](https://github.com/synapsecns/sanguine/compare/@synapsecns/[email protected]...@synapsecns/[email protected]) (2024-11-28) | ||
|
||
|
||
### Bug Fixes | ||
|
||
* **contracts-rfq:** `TokenZapV1` native gas token behaviour [SLT-389] ([#3418](https://github.com/synapsecns/sanguine/issues/3418)) ([ee3705a](https://github.com/synapsecns/sanguine/commit/ee3705a1fabf52746a933964d6d52ba1ca2379d6)) | ||
|
||
|
||
|
||
|
||
|
||
## [0.14.5](https://github.com/synapsecns/sanguine/compare/@synapsecns/[email protected]...@synapsecns/[email protected]) (2024-11-25) | ||
|
||
**Note:** Version bump only for package @synapsecns/contracts-rfq | ||
|
||
|
||
|
||
|
||
|
||
## [0.14.4](https://github.com/synapsecns/sanguine/compare/@synapsecns/[email protected]...@synapsecns/[email protected]) (2024-11-24) | ||
|
||
**Note:** Version bump only for package @synapsecns/contracts-rfq | ||
|
||
|
||
|
||
|
||
|
||
## [0.14.3](https://github.com/synapsecns/sanguine/compare/@synapsecns/[email protected]...@synapsecns/[email protected]) (2024-11-23) | ||
|
||
**Note:** Version bump only for package @synapsecns/contracts-rfq | ||
|
||
|
||
|
||
|
||
|
||
## [0.14.2](https://github.com/synapsecns/sanguine/compare/@synapsecns/[email protected]...@synapsecns/[email protected]) (2024-11-22) | ||
|
||
**Note:** Version bump only for package @synapsecns/contracts-rfq | ||
|
||
|
||
|
||
|
||
|
||
## [0.14.1](https://github.com/synapsecns/sanguine/compare/@synapsecns/[email protected]...@synapsecns/[email protected]) (2024-11-22) | ||
|
||
**Note:** Version bump only for package @synapsecns/contracts-rfq | ||
|
||
|
||
|
||
|
||
|
||
# [0.14.0](https://github.com/synapsecns/sanguine/compare/@synapsecns/[email protected]...@synapsecns/[email protected]) (2024-11-22) | ||
|
||
|
||
### Features | ||
|
||
* **contracts-rfq:** Token Zap [SLT-389] ([#3352](https://github.com/synapsecns/sanguine/issues/3352)) ([743e859](https://github.com/synapsecns/sanguine/commit/743e859e3274ed449c6410441bd664ff2aaf9740)), closes [#3382](https://github.com/synapsecns/sanguine/issues/3382) | ||
|
||
|
||
|
||
|
||
|
||
# [0.13.0](https://github.com/synapsecns/sanguine/compare/@synapsecns/[email protected]...@synapsecns/[email protected]) (2024-11-18) | ||
|
||
|
||
### Features | ||
|
||
* **contracts-rfq:** rework permisionless cancellation [SLT-489] ([#3382](https://github.com/synapsecns/sanguine/issues/3382)) ([7932f41](https://github.com/synapsecns/sanguine/commit/7932f416341a227db295c33f232efde89fd2c50c)) | ||
|
||
|
||
|
||
|
||
|
||
## [0.12.1](https://github.com/synapsecns/sanguine/compare/@synapsecns/[email protected]...@synapsecns/[email protected]) (2024-11-11) | ||
|
||
**Note:** Version bump only for package @synapsecns/contracts-rfq | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.20; | ||
|
||
// ════════════════════════════════════════════════ INTERFACES ═════════════════════════════════════════════════════ | ||
|
||
import {IAdminV2} from "./interfaces/IAdminV2.sol"; | ||
import {IAdminV2Errors} from "./interfaces/IAdminV2Errors.sol"; | ||
|
||
// ═════════════════════════════════════════════ EXTERNAL IMPORTS ══════════════════════════════════════════════════ | ||
|
||
import {AccessControlEnumerable} from "@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol"; | ||
import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; | ||
import {Address} from "@openzeppelin/contracts/utils/Address.sol"; | ||
|
||
/// @title AdminV2 | ||
/// @notice Provides administrative functions and controls for managing the FastBridgeV2 contract, | ||
/// including access control and configuration settings. | ||
contract AdminV2 is AccessControlEnumerable, IAdminV2, IAdminV2Errors { | ||
using SafeERC20 for IERC20; | ||
|
||
/// @notice The address reserved for the native gas token (ETH on Ethereum and most L2s, AVAX on Avalanche, etc.). | ||
address public constant NATIVE_GAS_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; | ||
|
||
/// @notice The role identifier for the Quoter API's off-chain authentication. | ||
/// @dev Only addresses with this role can post FastBridge quotes to the API. | ||
bytes32 public constant QUOTER_ROLE = keccak256("QUOTER_ROLE"); | ||
|
||
/// @notice The role identifier for the Prover's on-chain authentication in FastBridge. | ||
/// @dev Only addresses with this role can provide proofs that a FastBridge request has been relayed. | ||
bytes32 public constant PROVER_ROLE = keccak256("PROVER_ROLE"); | ||
|
||
/// @notice The role identifier for the Guard's on-chain authentication in FastBridge. | ||
/// @dev Only addresses with this role can dispute submitted relay proofs during the dispute period. | ||
bytes32 public constant GUARD_ROLE = keccak256("GUARD_ROLE"); | ||
|
||
/// @notice The role identifier for the Canceler's on-chain authentication in FastBridge. | ||
/// @dev Only addresses with this role can cancel a FastBridge transaction without the cancel delay. | ||
bytes32 public constant CANCELER_ROLE = keccak256("CANCELER_ROLE"); | ||
|
||
/// @notice The role identifier for the Governor's on-chain administrative authority. | ||
/// @dev Only addresses with this role can perform administrative tasks within the contract. | ||
bytes32 public constant GOVERNOR_ROLE = keccak256("GOVERNOR_ROLE"); | ||
|
||
/// @notice The denominator for fee rates, representing 100%. | ||
uint256 public constant FEE_BPS = 1e6; | ||
/// @notice The maximum protocol fee rate: 1% of the origin amount. | ||
uint256 public constant FEE_RATE_MAX = 0.01e6; | ||
|
||
/// @notice The minimum cancel delay that can be set by the governor. | ||
uint256 public constant MIN_CANCEL_DELAY = 1 hours; | ||
/// @notice The default cancel delay set during contract deployment. | ||
uint256 public constant DEFAULT_CANCEL_DELAY = 1 days; | ||
|
||
/// @notice The protocol fee rate taken on the origin amount deposited in the origin chain. | ||
uint256 public protocolFeeRate; | ||
|
||
/// @notice The accumulated protocol fee amounts. | ||
mapping(address => uint256) public protocolFees; | ||
|
||
/// @notice The delay period after which a transaction can be permissionlessly cancelled. | ||
uint256 public cancelDelay; | ||
|
||
/// @notice This variable is deprecated and should not be used. | ||
/// @dev Use ZapNative V2 requests instead. | ||
uint256 public immutable chainGasAmount = 0; | ||
|
||
constructor(address defaultAdmin) { | ||
_grantRole(DEFAULT_ADMIN_ROLE, defaultAdmin); | ||
_setCancelDelay(DEFAULT_CANCEL_DELAY); | ||
} | ||
|
||
/// @inheritdoc IAdminV2 | ||
function setCancelDelay(uint256 newCancelDelay) external onlyRole(GOVERNOR_ROLE) { | ||
_setCancelDelay(newCancelDelay); | ||
} | ||
|
||
/// @inheritdoc IAdminV2 | ||
function setProtocolFeeRate(uint256 newFeeRate) external onlyRole(GOVERNOR_ROLE) { | ||
if (newFeeRate > FEE_RATE_MAX) revert FeeRateAboveMax(); | ||
uint256 oldFeeRate = protocolFeeRate; | ||
protocolFeeRate = newFeeRate; | ||
emit FeeRateUpdated(oldFeeRate, newFeeRate); | ||
} | ||
|
||
/// @inheritdoc IAdminV2 | ||
function sweepProtocolFees(address token, address recipient) external onlyRole(GOVERNOR_ROLE) { | ||
// Early exit if no accumulated fees. | ||
uint256 feeAmount = protocolFees[token]; | ||
if (feeAmount == 0) return; | ||
// Reset the accumulated fees first. | ||
protocolFees[token] = 0; | ||
emit FeesSwept(token, recipient, feeAmount); | ||
// Sweep the fees as the last transaction action. | ||
if (token == NATIVE_GAS_TOKEN) { | ||
Address.sendValue(payable(recipient), feeAmount); | ||
} else { | ||
IERC20(token).safeTransfer(recipient, feeAmount); | ||
} | ||
} | ||
|
||
/// @notice Internal logic to set the cancel delay. Security checks are performed outside of this function. | ||
/// @dev This function is marked as private to prevent child contracts from calling it directly. | ||
function _setCancelDelay(uint256 newCancelDelay) private { | ||
if (newCancelDelay < MIN_CANCEL_DELAY) revert CancelDelayBelowMin(); | ||
uint256 oldCancelDelay = cancelDelay; | ||
cancelDelay = newCancelDelay; | ||
emit CancelDelayUpdated(oldCancelDelay, newCancelDelay); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.