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

FeeCurrency Adapter #10907

Merged
merged 26 commits into from
Jan 29, 2024
Merged

Conversation

pahor167
Copy link
Contributor

Description

The FeeCurrencyAdapter enables the use of feeTokens with fewer than 18 decimal places as the fee currency. From the perspective of the blockchain client, interactions with the FeeCurrencyAdapter are analogous to those with a standard 18-decimal-place token. However, internally, the FeeCurrencyAdapter automatically adjusts the scale of amounts to match the decimal places of the underlying token.

Tested

Unit tests added

Related issues

Backwards compatibility

Yes

@pahor167 pahor167 requested a review from a team as a code owner January 25, 2024 10:48
@pahor167 pahor167 changed the base branch from master to release/core-contracts/11 January 25, 2024 10:49
@pahor167 pahor167 requested a review from a team January 25, 2024 10:58
@martinvol martinvol mentioned this pull request Jan 25, 2024
}
}

contract FeeCurrencyAdapter_Initialize is FeeCurrencyAdapterTest {
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be good to include a fuzzing test in the initialize(), to test various values for _expectedDecimals. Ideally, would also test cases when _expectedDecimals < decimal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

Copy link
Contributor

@soloseng soloseng Jan 26, 2024

Choose a reason for hiding this comment

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

I did not mean for you to try and implement a fuzzing test from scratch. Foundry has a built in fuzzing tooling that can be used to implement fuzzing. see docs for more details on how to implement

@pahor167 pahor167 changed the base branch from release/core-contracts/11 to release/core-contracts/11_2 January 26, 2024 14:04
@pahor167 pahor167 enabled auto-merge (squash) January 26, 2024 22:17
Copy link
Contributor

@mcortesi mcortesi left a comment

Choose a reason for hiding this comment

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

approved but askign for a smal lchange

@pahor167 pahor167 disabled auto-merge January 26, 2024 22:19
* @notice Returns wrapped token address.
* @return The wrapped token address.
*/
function getWrappedToken() external view returns (address) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be part of IAdapter

@@ -0,0 +1,168 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.7 <0.8.20;
Copy link
Contributor

Choose a reason for hiding this comment

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

stability may not be the same folder for this file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What other folder are you suggesting ?

@pahor167 pahor167 merged commit e0e3578 into release/core-contracts/11_2 Jan 29, 2024
25 checks passed
@pahor167 pahor167 deleted the pahor/feeCurrencyWrapper branch January 29, 2024 18:06
pahor167 added a commit that referenced this pull request Apr 19, 2024
* Release: Sorted oracles update (#10891)

* Sorted oracles update

* integration test fixes

* constants added

* Update packages/protocol/contracts/stability/SortedOracles.sol

Co-authored-by: Martín Volpe <[email protected]>

* Removal of Mento reference

* Update packages/protocol/test-sol/stability/SortedOracles.t.sol

Co-authored-by: soloseng <[email protected]>

* Update packages/protocol/test-sol/stability/SortedOracles.t.sol

Co-authored-by: soloseng <[email protected]>

* PR comments

* Equivalent tokens on top of updated sorted oracles  (Based of CR10) (#10904)

* Brought changes from https://github.com/celo-org/celo-monorepo/pull/10895/files#diff-ba272032c5f1b7e89d5777b3c886685b581324bdf22733ee272e2790f5d631df

* Fuzzy added

---------

Co-authored-by: pahor167 <[email protected]>

* prettify fix

---------

Co-authored-by: Martín Volpe <[email protected]>
Co-authored-by: soloseng <[email protected]>

* FeeCurrency Adapter (#10907)

* FeeCurrency Adapter

* PR comments

* Format documents

* gitmodules

* submodules added

* solidity version fix

* OZ contracts same commit as master

* Revert "OZ contracts same commit as master"

This reverts commit 8d8f2d6.

* OZ to same commit as master

* Getter&Setter for wrapped token

* Proxy added

* split of FeeCurrencyAdapter

* prettier fix

* refactor

* Update packages/protocol/test-sol/stability/FeeCurrencyAdapter.t.sol

Co-authored-by: Martín Volpe <[email protected]>

* PR comments

* PR comments

* Decimals + Total supply added

* Update packages/protocol/contracts-0.8/stability/FeeCurrencyAdapter.sol

* Update packages/protocol/contracts-0.8/stability/FeeCurrencyAdapter.sol

* Trigger

* Wrapper reference removed

* interface added

---------

Co-authored-by: Martín Volpe <[email protected]>
Co-authored-by: Tim Moreton <[email protected]>
Co-authored-by: alvarof2 <[email protected]>

* Calculation of unlockable gold (#10731)

* Fix for historical vote records

* contractkit fix

* lint fix

* Governance version update

* PR comments

* extended test

* Remove console.log

* Test

* lint fix

* version fix

* version fix

---------

Co-authored-by: Martín Volpe <[email protected]>

* Gas Price Minimum should never be zero (#10909)

* GasPriceMinimum backward compatibility fix (#10922)

* Update Dockerfiles (#10915)

* Remove references to packages deleted

* Remove circleci dockerfiles and workflow

* Delete reference to patches folder

* Update workload-id-provider in metadata-crawler-build job (#10916)

Use `master` workload-id-provider pool

* fix ganache dependency resolution (#10917)

* fix & cleanup

* fixed resolved field in lock file

* test

* Tooling fix

* lint fix

* revert of gas price minimum

* Update packages/protocol/lib/compatibility/ast-code.ts

Co-authored-by: Martín Volpe <[email protected]>

---------

Co-authored-by: Javier Cortejoso <[email protected]>
Co-authored-by: soloseng <[email protected]>
Co-authored-by: Martín Volpe <[email protected]>

* Storage gap for FeeCurrencyAdapter (#10933)

Storage gap

* Debit 0 value check (#10930)

* Removal of SortedOracle multiplier (#10931)

* Removal of SortedOracle multiplier

* removal of comment

* Make super of FeeCurrencyAdapterOwnable.sol explicit (#10944)

* Added note to FeeCurrencyAdapter.sol initializer (#10943)

* FeeAdapter debit round up (#10940)

* Round up of debit

* PR comments

* Code quality post audit (#10945)

Code quality

* SortedOracles sourced from Mento core for CR10 (#10946)

* SortedOracles sourced from Mento core

* PR comments

* Update gap size to follow 50 rule (#10948)

* CR11 fix verification (#10951)

* Force AddressSortedLinkedListWithMedian library redeploy for CR11

* CI fix

* PR comments

* yarn lock

* Updates specification of SrotedOracles (#10970)

* Update Natspec for FeeAdapter (#10969)

* dockerfile

---------

Co-authored-by: Martín Volpe <[email protected]>
Co-authored-by: soloseng <[email protected]>
Co-authored-by: Tim Moreton <[email protected]>
Co-authored-by: alvarof2 <[email protected]>
Co-authored-by: Javier Cortejoso <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support FeeCurrencies with less than 18 digits
6 participants