-
Notifications
You must be signed in to change notification settings - Fork 10
Adapter calculate and retrieve total spendable amount #385
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
Adapter calculate and retrieve total spendable amount #385
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you have great progress on the task already 🎉
Can you also make sure to include a list of the Changelog in PR so we can later add it to the CHANGELOG.md file.
After some discussion with Ivo, we came to the following changes: This could change in the future, as we will introduce the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also make sure to fix the gitmodule
- adapter - ABI & bytecode files clean up
6c3f3ae
to
f2b2fa2
Compare
TODO:
|
@@ -20,11 +20,30 @@ ip_rate_limit = { type = 'ip', timeframe = 20000 } | |||
sid_rate_limit = { type = 'sid', timeframe = 20000 } | |||
|
|||
ethereum_core_address = '0x333420fc6a897356e69b62417cd17ff012177d2b' | |||
# TODO: Replace with real contract address | |||
outpace_address = '0x333420fc6a897356e69b62417cd17ff012177d2b' | |||
# TODO: Replace with real contract address |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to make tests reproducible we can create a ganache snapshot of the required deployments and use it on startup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a cool idea for enhancement!
How can we do that?
TODO: uncomment sweeper test case once we figure out what's wrong with the contract call
sweeper test case
Implemented
adapter.get_deposit(...)
for the Ethereum and Dummy adapters, including an integration test.Change Log:
adapter::EthereumAdapter
- Added aget_deposit()
function which calculates and returns total spendable amount, using theOUTPACE
andERC20
ABI's.adapter::ethereum::Error
- Added two new possible errors. The first beingTokenNotWhitelisted
which is returned when the function is called with a channel with a deposit asset not being in the config's whitelist. The second isInvalidDepositAsset
which is used when a channel's deposit asset cannot be converted toAddress
. This error is here temporarily and I assume it will be gone soon when thechannel_v5
replaces the oldchannel
in the adapter.dev.toml and prod.toml configs
- Changed the structure oftoken_addr_whitelist
from an array of strings, to an array with objects that containaddress
,min_token_units_for_deposit
andprecision
.primitives::adapter::Deposit
- new struct representing theget_deposit()
output. Added signature forget_deposit
in theimpl
primitives::channel_validator::asset_listed()
- Changedasset_listed()
function to work with the new token whitelist structure from String Vec to HashMap.primitives::config
- Changed token whitelist from String Vec to HashMap. Added a new struct calledTokenInfo
which represents the value for the token whitelist HashMap.