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

[Flow EVM] Adding FLOW token bridge event #5538

Merged
merged 9 commits into from
Mar 21, 2024
Next Next commit
add events
  • Loading branch information
ramtinms committed Mar 11, 2024
commit 83bb106dfd58199ba7c2fe5ca6f9ff4cba3d5b4d
15 changes: 15 additions & 0 deletions fvm/evm/stdlib/contract.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ contract EVM {
access(all)
event CadenceOwnedAccountCreated(addressBytes: [UInt8; 20])

/// FLOWTokenDeposit is emitted when FLOW tokens is bridged
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are using past tense for events. FLOWTokensDeposited.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update those to use past participle.

/// into the EVM environment. Note that this event is not emitted
/// for transfer of flow tokens between two EVM addresses.
access(all)
event FLOWTokenDeposit(addressBytes: [UInt8; 20], amount: UFix64)

/// FLOWTokenWithdraw is emitted when FLOW tokens are bridged
/// out of the EVM environment. Note that this event is not emitted
/// for transfer of flow tokens between two EVM addresses.
access(all)
event FLOWTokenWithdraw(addressBytes: [UInt8; 20], amount: UFix64)

/// EVMAddress is an EVM-compatible address
access(all)
struct EVMAddress {
Expand Down Expand Up @@ -56,10 +68,12 @@ contract EVM {
/// Deposits the given vault into the EVM account with the given address
access(all)
fun deposit(from: @FlowToken.Vault) {
let amount = from.balance
InternalEVM.deposit(
from: <-from,
to: self.bytes
)
emit FLOWTokenDeposit(addressBytes: self.bytes, amount: amount)
}
}

Expand Down Expand Up @@ -224,6 +238,7 @@ contract EVM {
from: self.addressBytes,
amount: balance.attoflow
) as! @FlowToken.Vault
emit FLOWTokenWithdraw(addressBytes: self.addressBytes, amount: balance.inFLOW)
return <-vault
}

Expand Down