Skip to content

Commit

Permalink
feat(rc-1): updates to release candidate smart contract packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexangelj committed Jan 31, 2022
1 parent d983009 commit b2909d6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@primitivefi/rmm-sdk",
"version": "1.1.0-beta.5",
"description": "A Software Development Kit for Primitive RMM-01.",
"description": "A Software Development Kit for Primitive RMM-01.",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"license": "GPL-3.0-or-later",
Expand Down Expand Up @@ -33,8 +33,8 @@
"prettier": ">=2.0.0"
},
"dependencies": {
"@primitivefi/rmm-core": "^2.0.0-beta.5",
"@primitivefi/rmm-manager": "^2.0.0-beta.5",
"@primitivefi/rmm-core": "^1.0.0-rc.1",
"@primitivefi/rmm-manager": "^1.0.0-rc.1",
"@primitivefi/rmm-math": "^2.0.0-rc.1",
"@uniswap/sdk-core": "^3.0.1",
"shelljs": "0.8.5",
Expand Down
6 changes: 3 additions & 3 deletions src/entities/calibration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ export class Calibration extends Engine implements ICalibration {
static readonly MAX_SIGMA = Percentage.BasisPoints * 1e3
/** Minimum gamma value inclusive, equal to 9000 basis points, or 90.00%. */
static readonly MIN_GAMMA = Percentage.BasisPoints - 1e3
/** Maximum gamma value inclusive, equal to 9999 basis points, or 99.99%. */
static readonly MAX_GAMMA = Percentage.BasisPoints - 1
/** Maximum gamma value inclusive, equal to 10_000 basis points, or 100%. */
static readonly MAX_GAMMA = Percentage.BasisPoints

/** {@inheritdoc ICalibration.strike} */
public readonly strike: Wei
Expand Down Expand Up @@ -132,7 +132,7 @@ export class Calibration extends Engine implements ICalibration {
`Sigma Error: Implied volatility outside of bounds 1-10_000_000 basis points: ${sigma}`
)
invariant(isValidMaturity(maturity), `Maturity out of bounds > 0 && < 2^32 -1: ${maturity}`)
invariant(isValidGamma(gamma), `Gamma Error: Fee outside of bounds 1-9_9999 basis points: ${gamma}`)
invariant(isValidGamma(gamma), `Gamma Error: Outside of bounds (9_000, 10_000): ${gamma}`)

this.strike = weiToWei(strike, stable.decimals)
this.sigma = new Percentage(toBN(sigma))
Expand Down
14 changes: 9 additions & 5 deletions test/Calibration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,19 @@ describe('Calibration', function() {
})

it('#gamma fails out of bounds', async function() {
expect(() => parseCalibration(AddressZero, token0, token1, { strike, sigma, maturity, gamma: '0' })).toThrow()
expect(() =>
parseCalibration(AddressZero, token0, token1, { strike, sigma, maturity, gamma: (1e8).toString() })
parseCalibration(AddressZero, token0, token1, { strike, sigma, maturity, gamma: (9_000 - 1).toString() })
).toThrow()
expect(() =>
parseCalibration(AddressZero, token0, token1, { strike, sigma, maturity, gamma: (10_000 + 1).toString() })
).toThrow()
})
it('#gamma succeeds on bounds', async function() {
expect(() => parseCalibration(AddressZero, token0, token1, { strike, sigma, maturity, gamma: '1' })).toBeDefined()
expect(() =>
parseCalibration(AddressZero, token0, token1, { strike, sigma, maturity, gamma: (1e7).toString() })
).toBeDefined()
parseCalibration(AddressZero, token0, token1, { strike, sigma, maturity, gamma: (9_000).toString() })
).not.toThrow()
expect(() =>
parseCalibration(AddressZero, token0, token1, { strike, sigma, maturity, gamma: (10_000).toString() })
).not.toThrow()
})
})
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1740,18 +1740,18 @@
resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-4.4.1.tgz#3382db2cd83ab565ed9626765e7da92944b45de8"
integrity sha512-o+pHCf/yMLSlV5MkDQEzEQL402i6SoRnktru+0rdSxVEFZcTzzGhZCAtZjUFyKGazMSv1TilzMg+RbED1N8XHQ==

"@primitivefi/rmm-core@2.0.0-beta.5", "@primitivefi/rmm-core@^2.0.0-beta.5":
version "2.0.0-beta.5"
resolved "https://registry.yarnpkg.com/@primitivefi/rmm-core/-/rmm-core-2.0.0-beta.5.tgz#c03426e880f5dff9f8aacd5ffb378f18182f756a"
integrity sha512-fqtN89L4/gxA+M2heUkGlY9/907oJfBwWaWgE5XfhMP5KE+YeE0yKWgo4HNpkx1VPqpoDJU84LmDnCd+8xhVvg==
"@primitivefi/rmm-core@^1.0.0-rc.1":
version "1.0.0-rc.1"
resolved "https://registry.yarnpkg.com/@primitivefi/rmm-core/-/rmm-core-1.0.0-rc.1.tgz#42e378e38d2f8655507c7e790de71c0a10622ff9"
integrity sha512-q9Syd9nSWv3xpfMIkPikmUDfDILubtWg8U1xHdlxOwxgQ/f33ZxnA0zje8XoAoce6utwTOn3MAbGpvxe4MIN6g==

"@primitivefi/rmm-manager@^2.0.0-beta.5":
version "2.0.0-beta.5"
resolved "https://registry.yarnpkg.com/@primitivefi/rmm-manager/-/rmm-manager-2.0.0-beta.5.tgz#e71dc3e309b22831bb2e5c858ef0ca8d174f61d5"
integrity sha512-tNXWq8sM89E8zrlF3hVobCkly0jphTyGrzhSoxxpH0TTRIBN05tLCkCGEh/WKcTh20sZw8s2QTTxs9yPoS3gTQ==
"@primitivefi/rmm-manager@^1.0.0-rc.1":
version "1.0.0-rc.1"
resolved "https://registry.yarnpkg.com/@primitivefi/rmm-manager/-/rmm-manager-1.0.0-rc.1.tgz#6ca21e96d14f304e56e02aefaaea15d5a3352a2a"
integrity sha512-+aJOw8eU9b0B1dZOWkIWoAbApVOMf3DGzmKRBSV4ugSd2mMdlgMMoFosVpd3AZU4n79yBzM5LgvxM7y6Ley+sA==
dependencies:
"@openzeppelin/contracts" "^4.1.0"
"@primitivefi/rmm-core" "2.0.0-beta.5"
"@primitivefi/rmm-core" "^1.0.0-rc.1"
base64-sol "^1.1.0"

"@primitivefi/rmm-math@^2.0.0-rc.1":
Expand Down

0 comments on commit b2909d6

Please sign in to comment.