-
Notifications
You must be signed in to change notification settings - Fork 16
CSUB-518: Pt. 2 - Set Gate Faucet Address #1276
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
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #1276 +/- ##
=====================================
Coverage 8.32% 8.32%
=====================================
Files 28 28
Lines 889 889
Branches 114 114
=====================================
Hits 74 74
Misses 815 815 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
For full LLVM coverage report click here! |
a190be7 to
f322646
Compare
05328f2 to
352310f
Compare
6be08a2 to
9a3478c
Compare
atodorov
left a comment
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.
Working on an integration test for set_gate_contract() and will merge that one first, before merging this one.
Otherwise looks good.
8bb6f5c to
9374d38
Compare
nathanwhit
left a comment
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.
A couple of nitpicks but the actual content LGTM
- more descriptive names - assert on WeightInfo - return WeightInfo > 0 to pass CI before benchmarks have the chance to update the weights with correct values
9374d38 to
5814f81
Compare
Rationale
A successful GCRE->CTC swap results in a minting of CTC.
A successful swap of GATE results in a transfer, where the source of funds is an on-chain storage object called the gate faucet address, and the destination is the signer of the extrinsic.
This gate faucet must be set before the
request_collect_coins_v2extrinsic is called. If the on-chain storage value has not been set an error will be raised.This PR adds a
set_gate_faucetextrinsic that allows a key with sudo privileges to specify which on-chain wallet is to be used as the source argument in the transfer function call.The value gets persisted as an
OptionQueryfor anAccountId. AnOptionQuerywill return theNonevariant when not set.The getter for the faucet address is
Creditcoin::gate_faucet_address. Its definition is the following:Unit tests implemented:
- [x] When not previously set storage value should return the correct option (None)
- [x] The extrinsic can only be set by a root user
- [x] The extrinsic can be set and the storage value is persisted
- [ ] add TODO's here
This PR is based off of Pt. 1. When Pt 1 gets merged into dev this part will get rebased. Will likely need to fix merge conflicts caused by
creditcoin-jsupdates. This pattern will continue for part 3 and 4.This extrinsic can be called on the javascript side like so: