GithubHelp home page GithubHelp logo

brave-intl / bat-go Goto Github PK

View Code? Open in Web Editor NEW
40.0 40.0 30.0 25.82 MB

Pass "go", collect 200 BAT

License: Mozilla Public License 2.0

Go 98.10% Makefile 1.00% HCL 0.01% Dockerfile 0.15% Shell 0.34% PLpgSQL 0.41%

bat-go's People

Contributors

cld11 avatar dependabot[bot] avatar djandries avatar dlipeles avatar evq avatar hspencer77 avatar husobee avatar maikelmclauflin avatar mschfh avatar nvonpentz avatar onyb avatar orspetol avatar pavelbrm avatar sneagan avatar tarikdem avatar thypon avatar tsmartt avatar v-kat avatar xtat avatar yachtcaptain23 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bat-go's Issues

Circuit tripping alerting changes

To clarify when grants are unavailable when a "circuit" has been tripped, we want to generate an explicit Sentry error specifying the circuit tripping.

We should then change our alerting in our monitoring slack channels to look only for this specific event.

Finally, we should expose an endpoint that can be monitored by DevOps to confirm when this has been tripped, as this is a critical service. (DevOps follow up to this is in https://github.com/brave/devops/issues/535).

check request validation

for cases where a parameter may be missed by the client yet not currently result in an error due to the default value after deserialization

clarify env file setup instructions

First, I don't understand this line:

Ensure that your .env file is populated with values for each of the env vars that does not have a default in docker-compose.yml.

What data should be in the file? What the name I must give for it? I think the README file doesn't fully explain what needs to be done to get 200 BAT. Maybe I missed something elsewhere?

Thanks.

cleanup HTTP clients

we should probably do a bit of cleanup on our HTTP clients. we should expose the errors in a way that upstream consumers can perform different actions based on e.g. 404 vs 500 vs timeout

README Improvements

When I run make in the project I've noticed that not all tests files are being picked up.

[I] โžœ go test -v --tags= ./... | grep "no test files"
?       github.com/acroca/go-symbols    [no test files]
?       github.com/brave-intl/bat-go/bin/create-keypair [no test files]
?       github.com/brave-intl/bat-go/bin/create-tokens  [no test files]
?       github.com/brave-intl/bat-go/bin/get-cert-fingerprint   [no test files]
?       github.com/brave-intl/bat-go/bin/grant-server   [no test files]
?       github.com/brave-intl/bat-go/bin/list-transactions      [no test files]
?       github.com/brave-intl/bat-go/bin/settlement-submit      [no test files]
?       github.com/brave-intl/bat-go/bin/transfer-funds [no test files]
?       github.com/brave-intl/bat-go/bin/vault-create-wallet    [no test files]
?       github.com/brave-intl/bat-go/bin/vault-import-key       [no test files]
?       github.com/brave-intl/bat-go/bin/vault-init     [no test files]
?       github.com/brave-intl/bat-go/bin/vault-sign-settlement  [no test files]
?       github.com/brave-intl/bat-go/bin/vault-unseal   [no test files]
?       github.com/brave-intl/bat-go/bin/verify-tokens  [no test files]
?       github.com/brave-intl/bat-go/controllers        [no test files]
?       github.com/brave-intl/bat-go/datastore  [no test files]
?       github.com/brave-intl/bat-go/utils/pindialer    [no test files]
?       github.com/brave-intl/bat-go/utils/vaultsigner  [no test files]
?       github.com/brave-intl/bat-go/wallet     [no test files]
?       github.com/brave-intl/bat-go/wallet/provider    [no test files]

However create-tokens, grant-server, datastore, utils/vaultsigner all have test files in their directories.

Is this an environmental problem with my computer or reproducible for anyone else?

record document id in settlement output file for manual settlement transactions

In order to keep track of which report authorizes which manual transaction, the settlement transaction will need to have an associated documentId. Currently, the settlement output file does not track this information, thus when it is posted to Eyeshade, there isn't any way to determine which documentId authorizes the transaction.

We should add an extra documentId field for the Transaction struct which will be populated for all transactions whose type is 'manual'.

type Transaction struct {
AltCurrency *altcurrency.AltCurrency `json:"altcurrency"`
Authority string `json:"authority"`
Amount decimal.Decimal `json:"amount"`
ExchangeFee decimal.Decimal `json:"commission"`
Currency string `json:"currency"`
Destination string `json:"address"`
Publisher string `json:"owner"`
BATPlatformFee decimal.Decimal `json:"fees"`
Probi decimal.Decimal `json:"probi"`
ProviderID string `json:"hash" valid:"uuidv4"`
Channel string `json:"publisher"`
SignedTx string `json:"signedTx"`
Status string `json:"status"`
ID string `json:"transactionId" valid:"uuidv4"`
TransferFee decimal.Decimal `json:"fee"`
Type string `json:"type"`
ValidUntil time.Time `json:"validUntil"`
Note string `json:"note"`
}

This way the output file will have the documentId for manual transactions and the authorization information can be persisted in Eyeshade's transaction table when the output file is posted.

Related to brave-intl/bat-ledger#519

compatibility layer: grant server

  • Enable a grant rework schema implementation of this interface, namely:
    • Full wallet information will need to be provided upon claim (namely the paymentID)
    • Full grant information will need to be provided upon claim (namely the value and promotionID)
  • Need a modified claim endpoint to match (requires a corresponding ledger change and deploy)
  • Implement the datastore interface using postgres. (At this point we simply have the ability for the grant server handle claim / redeem requests, but tracking these in postgres instead of redis)
  • Elimination of the grant tokens and signing process can follow.
  • Expose legacy grant info endpoint (for balance and listing un-redeemed grants in wallet info)
  • Indicies

improve currency handling

AltCurrency only supports a few cryptocurrencies which poses a problem for ListTransactions as the returned TransactionInfo uses AltCurrency to store the transfer currency.

We see this in practice when using list-transactions on certain wallets (Uphold supports additional currencies such as USD).

update repo from recent ledger changes

features

  • fastly token check
    • validate in grants get and put
  • cohorts = control,grant,test,ads
  • wallet cooldown w/ bypass
  • get list of allowed ads countries from ads server, do xor for ads grants vs others

endpoints

modify

  • GET /v3/grants
    • always respond 404 after android check
  • GET /v4/grants
    • ads android
  • GET /v5/grants
    • ugp ads
    • android hacks

add

  • POST /v2/wallet/{paymentId}/claim
    • use create and commit tx
  • GET /v2/wallet/{paymentId}/grants/{type}
    • composite grants
    • promotion id exclusions

remove

  • GET /v1/owners/{owner}/wallet
  • POST /v3/owners/{owner}/wallet/card
  • PUT /v1/owners/{owner}/wallet
  • PATCH /v1/owners/{owner}/wallet

instrumentation

  • funds_received_count
  • votes_issued_counter
  • viewRefresh_request_buckets_milliseconds
  • anonizeRegister_request_buckets_milliseconds
  • anonizeVerify_request_buckets_milliseconds
  • uphold_request_buckets_milliseconds

compatibility layer: ledger server

  • All tracking of promotions should be migrated (fetching promotions), except legacy filtering logic
  • Claim by polling through
  • Poll through to implement the total ads earnings by payment id endpoint
  • Poll claimed grant endpoint - returns active claims, can calculate balance
  • Remove logic to determine which grants to use, simply pass signed transaction to grant server

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.