You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/learn/add-gas-currency.md
+12-4Lines changed: 12 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,25 +56,33 @@ To enable a token as gas currency, two [governance proposals](/what-is-celo/usin
56
56
57
57
### Enabling the Oracle
58
58
59
+
#### Adding a new token to SortedOracles
60
+
59
61
The first proposal is meant to enable the oracle, by calling `SortedOracle.addOracle(address token, address oracleAddress)`. Potentially, this proposal could also transfer some Celo from the Community Fund to the oracle addresses to pay for gas.
60
62
61
63
An example of such proposal [can be found here](https://github.com/celo-org/governance/blob/main/CGPs/cgp-0085.md).
62
64
63
-
### Reporting
65
+
#### Creating an equivalent Oracle
66
+
67
+
SortedOracles supports flagging two tokens as "equivalent". This way, no new oracle has to be deployed, which is useful for fiat-backed stablecoins. [Here is an example](https://github.com/celo-org/governance/pull/419/files#diff-ba5ba5397b269ceb4b93f3876bedabac605daeec083a364a270675242fe7c424) of this approach. Using this approach, it is not needed to submit two proposals, the change can be done in only one.
68
+
69
+
##### Reporting
64
70
65
71
Before submitting the second proposal, at least one of the oracle addresses need to call `report(address token, uint256 value, address lesserKey, address greaterKey)`. This will make a price available to the protocol for gas pricing.
66
72
67
73
### Enabling as Gas Token
68
74
69
-
The second proposal enables the gas token by calling `addToken(address tokenAddress)`. After this proposal passes, EOAs should be able to pay for gas in the enabled token.
75
+
The second proposal enables the gas token by calling `FeeCurrencyDirectory.setCurrencyConfig(address token, address oracle, uint256 intrinsicGas)`. `intrinsicGas` is the estimated average amount of gas used by the functions `creditGasFees(...)` and `debitGasFees(...)`. A benchmark is recommended as an attachment to the governance proposal.
76
+
77
+
After this proposal passes, EOAs should be able to pay for gas in the enabled token.
70
78
71
79
An example of such proposal [can be found here](https://github.com/sirpy/governance/blob/1cee2314b357246385819e7e0713a272a55b0ec3/CGPs/cgp-0089.md).
72
80
73
-
It would be a good consideration to update popular tooling (like contractkit) before this proposal passes so that most developers are ready to use the new gas as soon as it enabled.
81
+
It would be a good consideration to update popular tooling (like [contractkit](https://docs.celo.org/developer/contractkit)) before this proposal passes, so that most developers are ready to use the new gas as soon as it is enabled.
74
82
75
83
### Enabling with just one proposal
76
84
77
-
It is possible to simplify this process to one governance proposal. That'd proposal would have to enable the Governance contract as an oracle for the token to enable as gas token.
85
+
It is possible to simplify this process to one governance proposal. That proposal would have to enable the Governance contract as an oracle for the token to enable as gas token.
78
86
79
87
Then, the governance proposal itself should report a reference value within the same proposal. This is particularly safe to do with stablecoins.
0 commit comments