Skip to content

Commit

Permalink
add transaction info
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronmgdr committed Jun 13, 2024
1 parent 71dfda7 commit f1eee8b
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions src/celo/cel2-transaction-interfaces-example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@


# Transactions

## creating api

### cip66

The new transaction type for paying for gas in fee currencies cip66.
the TLDR is it denominiate fees in CELO instead of FeeToken, which makes is behavior
much more like eip1559 transactions. maxFeePerGas/MaxPriorityFee can now be calculated / built the exact same way as eip1559 transactions. But it has an additional field `maxFeePerFeeCurrency` which serves as the limit / a hedge against exchange rate risk. as the transaction is "billed" in native celo but paid in the fee token.


```typescript

// Explicitly
// here the sender / dev must calculate the maxFeePerFeeCurrency by hand
// this is what https://github.com/celo-org/viem/pull/13 enables
sendTransaction({
...typicalEIP1559TransactionParams,
feeCurrency: '0xTokenAddress',
maxFeePerFeeCurrency: 10000000n,
})


// Implicitly
// Today this creates a cip64 transaction, eventually we'd like it to default
// to creating a cip66 by calculating maxFeePerFeeCurrency for the user
// this requires knowing and multiply together
// the maxFeePerGas, the gasLimit, and the exchange rate of CELO to feeToken.
sendTransaction({
...typicalEIP1559TransactionParams,
feeCurrency: '0xTokenAddress',
})
```

### op deposit transactions

finally add the ability to serialize deposit transactions.

```typescript
sendTransaction({
from: '0x977f82a600a1414e583f7f13623f1ac5d58b1c0b',
sourceHash:
'0x18040f35752170c3339ddcd850f185c9cc46bdef4d6e1f2ab323f4d3d7104319',
type: 'deposit'
})

```

this is of course not the same as actually building a deposit transaction, which would be part of celo inclusion in op-stack extensions.


## reading api

The changes here are minimal and it come down to

1. dont add properties to transactions that dont exist on them (ie `feeCurrency` was added to transactions in viem which did not have have )

2. add maxFeePerGas as optional property when it is on the args.


`maxFeeInFeeCurrency?: bigint`
`feeCurrency?: Address | undefined` // instead of or in addition to `null`.

File renamed without changes.

0 comments on commit f1eee8b

Please sign in to comment.