Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure directories and contract content + README updates #52

Merged
merged 21 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e4b59b2
rename BridgePermissions to IBridgePermissions
sisyphusSmiling Apr 25, 2024
e868ab9
remove manual setup scripts
sisyphusSmiling Apr 25, 2024
18e4b18
move interface related contracts to bridge/interfaces
sisyphusSmiling Apr 25, 2024
da8622f
move test contracts & scripts to tests/ directory
sisyphusSmiling Apr 25, 2024
6c31ced
move test related txns to cadence/tests/transactions
sisyphusSmiling Apr 25, 2024
d971c85
update README and outline desired framing
sisyphusSmiling Apr 19, 2024
15b79f3
update README
sisyphusSmiling Apr 25, 2024
6c59d44
add default implementation to IBridgePermissions.allowsBridging()
sisyphusSmiling Apr 25, 2024
27f441d
fix README typos
sisyphusSmiling Apr 25, 2024
8b751a2
add symbol derivation to SerializeMetadata
sisyphusSmiling Apr 26, 2024
d730a2f
remove redundant code when deploying EVM contract
sisyphusSmiling Apr 16, 2024
0f11b90
consolidate EVM deployment logic
sisyphusSmiling Apr 26, 2024
933e051
simplify symbol derivation
sisyphusSmiling Apr 26, 2024
27e689c
consolidate Cadence contract deployment logic
sisyphusSmiling Apr 26, 2024
1ed9600
move EVMBridgedMetadataViews & URI into MetadataViews
sisyphusSmiling Apr 26, 2024
8f12130
add pause functionality
sisyphusSmiling Apr 26, 2024
a5f4876
restructure solidity/ dir
sisyphusSmiling Apr 26, 2024
373c691
update comment typos
sisyphusSmiling Apr 26, 2024
d0a2a0d
Apply suggestions from code review
sisyphusSmiling Apr 26, 2024
eea0627
Apply suggestions from code review
sisyphusSmiling Apr 26, 2024
36718c2
add pause script & test validation + update setter transaction interface
sisyphusSmiling Apr 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
229 changes: 147 additions & 82 deletions README.md

Large diffs are not rendered by default.

257 changes: 62 additions & 195 deletions cadence/contracts/bridge/FlowEVMBridge.cdc

Large diffs are not rendered by default.

40 changes: 39 additions & 1 deletion cadence/contracts/bridge/FlowEVMBridgeConfig.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ contract FlowEVMBridgeConfig {
*******************/

access(all) entitlement Fee
access(all) entitlement Pause

/*************
Fields
Expand All @@ -29,6 +30,9 @@ contract FlowEVMBridgeConfig {
/// Default ERC20.decimals() value
access(all)
let defaultDecimals: UInt8
/// Flag enabling pausing of bridge operations
access(self)
var paused: Bool
/// Mapping of Type to its associated EVMAddress as relevant to the bridge
access(self)
let typeToEVMAddress: {Type: EVM.EVMAddress}
Expand Down Expand Up @@ -65,14 +69,25 @@ contract FlowEVMBridgeConfig {
///
access(all)
event BridgeFeeUpdated(old: UFix64, new: UFix64, isOnboarding: Bool)
// TODO
/// Emitted whenever a TokenHandler is configured
///
access(all)
event HandlerConfigured(targetType: Type, targetEVMAddress: String?, isEnabled: Bool)
/// Emitted whenever the bridge is paused
///
access(all)
event PauseStatusUpdated(paused: Bool)

/*************
Getters
*************/

/// Returns whether the bridge is paused
access(all)
view fun isPaused(): Bool {
return self.paused
}

/// Retrieves the EVMAddress associated with a given Type if it has been onboarded to the bridge
///
access(all)
Expand Down Expand Up @@ -220,6 +235,28 @@ contract FlowEVMBridgeConfig {
FlowEVMBridgeConfig.baseFee = new
}

/// Pauses the bridge, preventing all bridge operations
///
access(Pause)
fun pauseBridge() {
if FlowEVMBridgeConfig.isPaused() {
return
}
FlowEVMBridgeConfig.paused = true
emit PauseStatusUpdated(paused: true)
}

/// Unpauses the bridge, allowing bridge operations to resume
///
access(Pause)
fun unpauseBridge() {
if !FlowEVMBridgeConfig.isPaused() {
return
}
FlowEVMBridgeConfig.paused = false
emit PauseStatusUpdated(paused: false)
}

/// Sets the target EVM contract address on the handler for a given Type, associating the Cadence type with the
/// provided EVM address. If a TokenHandler does not exist for the given Type, the operation reverts.
///
Expand Down Expand Up @@ -282,6 +319,7 @@ contract FlowEVMBridgeConfig {
self.onboardFee = 0.0
self.baseFee = 0.0
self.defaultDecimals = 18
self.paused = false

// Although $FLOW does not have ERC20 address, we associate the the Vault with the EVM address from which
// EVM transfers originate
Expand Down
Loading
Loading