Skip to content

Commit

Permalink
Merge pull request #97 from onflow/update-evm-address-comparator
Browse files Browse the repository at this point in the history
Update `EVMAddress` comparison implementation
  • Loading branch information
sisyphusSmiling authored Jul 3, 2024
2 parents ae9e49e + 67e41df commit aed9fbb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cadence/contracts/bridge/FlowEVMBridgeConfig.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ contract FlowEVMBridgeConfig {
// EVM address is different, update the association
FlowEVMBridgeConfig.associateType(targetType, with: targetEVMAddress)
assert(
FlowEVMBridgeConfig.getEVMAddressAssociated(with: targetType)!.bytes == targetEVMAddress.bytes,
FlowEVMBridgeConfig.getEVMAddressAssociated(with: targetType)!.equals(targetEVMAddress),
message: "Problem associating target Type and target EVM Address"
)

Expand Down
4 changes: 2 additions & 2 deletions cadence/contracts/bridge/FlowEVMBridgeUtils.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ contract FlowEVMBridgeUtils {
let decodedCallResult = EVM.decodeABI(types: [Type<EVM.EVMAddress>()], data: callResult.data)
if decodedCallResult.length == 1 {
let actualOwner = decodedCallResult[0] as! EVM.EVMAddress
return actualOwner.bytes == owner.bytes
return actualOwner.equals(owner)
}
return false
}
Expand All @@ -606,7 +606,7 @@ contract FlowEVMBridgeUtils {
let decodedCallResult = EVM.decodeABI(types: [Type<EVM.EVMAddress>()], data: callResult.data)
if decodedCallResult.length == 1 {
let actualApproved = decodedCallResult[0] as! EVM.EVMAddress
return actualApproved.bytes == owner.bytes
return actualApproved.equals(owner)
}
return false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ access(all) contract FlowEVMBridgeHandlerInterfaces {
self.getTargetEVMAddress() == nil: "Target EVM address has already been set"
}
post {
self.getTargetEVMAddress()!.bytes == address!.bytes: "Problem setting target EVM address"
self.getTargetEVMAddress()!.equals(address!): "Problem setting target EVM address"
}
}
access(Admin) fun setMinter(_ minter: @{FlowEVMBridgeHandlerInterfaces.TokenMinter}) {
Expand Down

0 comments on commit aed9fbb

Please sign in to comment.