github.com/onflow/flow-go@v0.33.17/fvm/evm/types/account.go (about)

     1  package types
     2  
     3  // Account is an EVM account, currently
     4  // three types of accounts are supported on Flow EVM,
     5  // externally owned accounts (EOAs), smart contract accounts and bridged accounts
     6  // BridgedAccount is a new type of account in the environment,
     7  // that instead of being managed by public key,
     8  // it is managed by a resource owned by a Flow account.
     9  //
    10  // In other words, the FVM account who owns the FOA resource
    11  // can bridge native tokens to and from the account associated with the bridged account,
    12  // deploy contracts to the environment,
    13  // or call methods on contracts without the need to sign a transaction.
    14  type Account interface {
    15  	// Returns the address of this account
    16  	Address() Address
    17  
    18  	// Returns balance of this account
    19  	Balance() Balance
    20  
    21  	// Deposit deposits the token from the given vault into this account
    22  	Deposit(*FLOWTokenVault)
    23  
    24  	// Withdraw withdraws the balance from account and
    25  	// return it as a FlowTokenVault
    26  	// works only for bridged accounts
    27  	Withdraw(Balance) *FLOWTokenVault
    28  
    29  	// Transfer is a utility method on top of call for transfering tokens to another account
    30  	Transfer(to Address, balance Balance)
    31  
    32  	// Deploy deploys a contract to the environment
    33  	// the new deployed contract would be at the returned address and
    34  	// the contract data is not controlled by the bridge account
    35  	// works only for bridged accounts
    36  	Deploy(Code, GasLimit, Balance) Address
    37  
    38  	// Call calls a smart contract function with the given data.
    39  	// The gas usage is limited by the given gas limit,
    40  	// and the Flow transaction's computation limit.
    41  	// The fees are deducted from the bridged account
    42  	// and are transferred to the target address.
    43  	// if no data is provided it would behave as transfering tokens to the
    44  	// target address
    45  	// works only for bridged accounts
    46  	Call(Address, Data, GasLimit, Balance) Data
    47  }