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

[x/gamm][StableSwap] Add scaling factor #1277

Closed
Tracked by #1451
ValarDragon opened this issue Apr 18, 2022 · 0 comments · Fixed by #1354
Closed
Tracked by #1451

[x/gamm][StableSwap] Add scaling factor #1277

ValarDragon opened this issue Apr 18, 2022 · 0 comments · Fixed by #1354
Assignees
Labels
T:task ⚙️ A task belongs to a story

Comments

@ValarDragon
Copy link
Member

No description provided.

@ValarDragon ValarDragon mentioned this issue Apr 18, 2022
6 tasks
@ValarDragon ValarDragon changed the title Add a scaling factor parameter, where basically all arguments are scaled down by. Imagine stablecoin 1 is such that 10 stablecoin1 = $1, but stablecoin2 is such that 1000 stablecoin2 = $1. (Precision differences)We need an argument in the parameters, that each asset is individually divided by, in order to be comparableThis is how we feed sdk.Dec's to all internal functions Stableswap: Add scaling factor Apr 18, 2022
@mattverse mattverse self-assigned this Apr 26, 2022
@mergify mergify bot closed this as completed in #1354 May 4, 2022
mergify bot pushed a commit that referenced this issue May 4, 2022
Closes: #1277

## What is the purpose of the change

This PR adds scaling factors to current stable swap implementation. 

For context on why scaling factors are needed: Suppose 1000 stablecoin1 equals 1 dollars, 100 stablecoin2 equals 2 dollars due to precision difference. Currently we compare each pool assets without considering these differences in precisions in `calcOutAmtGivenIn`, `calcInAmtGivenOut`, `SpotPrice`. 

This PR adds a field of scaling factors for each pool asset so that when internally calculating in `amm.go`, we compare two different assets upon same precision points. We do this by feeding the internal functions assets / scaling factors.

## Brief change log

- Adds scaling factor to stableswap
*(for example:)*
 
  - *The metadata is stored in the blob store on job creation time as a persistent artifact*
  - *Deployments RPC transmits only the blob storage reference*
  - *Daemons retrieve the RPC data from the blob cache*


## Testing and Verifying

This change is a trivial rework / code cleanup without any test coverage.


## Documentation and Release Note

  - Does this pull request introduce a new feature or user-facing behavior changes? yes
  - Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`? no
  - How is the feature or change documented? not applicable
czarcas7ic pushed a commit that referenced this issue May 5, 2022
Closes: #1277

## What is the purpose of the change

This PR adds scaling factors to current stable swap implementation. 

For context on why scaling factors are needed: Suppose 1000 stablecoin1 equals 1 dollars, 100 stablecoin2 equals 2 dollars due to precision difference. Currently we compare each pool assets without considering these differences in precisions in `calcOutAmtGivenIn`, `calcInAmtGivenOut`, `SpotPrice`. 

This PR adds a field of scaling factors for each pool asset so that when internally calculating in `amm.go`, we compare two different assets upon same precision points. We do this by feeding the internal functions assets / scaling factors.

## Brief change log

- Adds scaling factor to stableswap
*(for example:)*
 
  - *The metadata is stored in the blob store on job creation time as a persistent artifact*
  - *Deployments RPC transmits only the blob storage reference*
  - *Daemons retrieve the RPC data from the blob cache*


## Testing and Verifying

This change is a trivial rework / code cleanup without any test coverage.


## Documentation and Release Note

  - Does this pull request introduce a new feature or user-facing behavior changes? yes
  - Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`? no
  - How is the feature or change documented? not applicable
czarcas7ic added a commit that referenced this issue May 5, 2022
* upgrade init

* add voting period to init image

* upgrade mvp

* move upgrade to setup

* permission fix

* github permissions

* delete to readd

* readd

* remove chmod

* permissions attempt

* permission change

* clean up

* remove init docker image creation

* test yml

* re add git diff

* revert dockerfile

* final github ci test

* revert

* initial code review changes

* Apply suggestions from code review

Co-authored-by: Roman <roman@osmosis.team>

* code review

* simple code 0 check

* Add scaling factors (#1354)

Closes: #1277

## What is the purpose of the change

This PR adds scaling factors to current stable swap implementation. 

For context on why scaling factors are needed: Suppose 1000 stablecoin1 equals 1 dollars, 100 stablecoin2 equals 2 dollars due to precision difference. Currently we compare each pool assets without considering these differences in precisions in `calcOutAmtGivenIn`, `calcInAmtGivenOut`, `SpotPrice`. 

This PR adds a field of scaling factors for each pool asset so that when internally calculating in `amm.go`, we compare two different assets upon same precision points. We do this by feeding the internal functions assets / scaling factors.

## Brief change log

- Adds scaling factor to stableswap
*(for example:)*
 
  - *The metadata is stored in the blob store on job creation time as a persistent artifact*
  - *Deployments RPC transmits only the blob storage reference*
  - *Daemons retrieve the RPC data from the blob cache*


## Testing and Verifying

This change is a trivial rework / code cleanup without any test coverage.


## Documentation and Release Note

  - Does this pull request introduce a new feature or user-facing behavior changes? yes
  - Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`? no
  - How is the feature or change documented? not applicable

* address roman comments

Co-authored-by: Roman <roman@osmosis.team>
Co-authored-by: Matt, Park <45252226+mattverse@users.noreply.github.com>
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
@p0mvn p0mvn changed the title Stableswap: Add scaling factor [x/gamm] Stableswap: Add scaling factor May 9, 2022
@p0mvn p0mvn mentioned this issue May 9, 2022
55 tasks
@p0mvn p0mvn added the T:task ⚙️ A task belongs to a story label May 9, 2022
@p0mvn p0mvn changed the title [x/gamm] Stableswap: Add scaling factor [x/gamm][StableSwap] Add scaling factor May 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T:task ⚙️ A task belongs to a story
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants