Skip to content

Commit

Permalink
Merge pull request #365 from invariant-labs/devnet-deploy
Browse files Browse the repository at this point in the history
Devnet deploy
  • Loading branch information
Sniezka1927 authored Jun 18, 2024
2 parents 2796120 + a131d06 commit 3aca231
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@ members = ["programs/invariant", "programs/staker"]
invariant = "HyaB3W9q6XdA5xwpU4XnSZV94htfmbmqJXZcEbRaJutt"
staker = "MJ6WF1tpEJ7Gk8ULqejDJapRfqBwBEp1dH5QvAgYxu9"

[programs.devnet]
invariant = "D8Xd5VFXJeANivc4LXEzYqiE8q2CGVbjym5JiynPCP6J"

[scripts]
test = "ts-mocha -p ./tsconfig.json -t 1000000"
3 changes: 2 additions & 1 deletion docs/docs/solana/quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ import { Market, Pair } from '@invariant-labs/sdk'

| Endpoint | Program ID |
| -------- | :------------------------------------------: |
| Devnet | 9aiirQKPZ2peE9QrXYmsbTtR7wSDJi2HkQdHuaMpTpei |
| Devnet | D8Xd5VFXJeANivc4LXEzYqiE8q2CGVbjym5JiynPCP6J |
| Mainnet | 48XDC18nH5FLq8kKfE6MJK2hcPFD7xsJQc4dSAgQWNAi |

Data structures are an exact mapping, with the only changes being type and case. Methods called by a user have a corresponding method, that creates instructions, adds them to transaction, signs, and sends it. All methods (including ones used only by admin) have corresponding methods that return just the instruction.

Before you begin making your first pool and position, you must first construct the market as shown below.

```ts
const market = await Market.build([Network.MAIN | Network.DEV], provider.wallet, connection)
```
2 changes: 1 addition & 1 deletion scripts/staker/create-stake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const INCENTIVE: PublicKey = new PublicKey('8Bhd6me9j6AS9N6f6BxRZkgsY9nBaEBzq2ma
const TOKEN_X: PublicKey = new PublicKey(MOCK_TOKENS.USDC)
const TOKEN_Y: PublicKey = new PublicKey(MOCK_TOKENS.SOL)
const POSITION_INDEX = 0
const INVARIANT = new PublicKey('9aiirQKPZ2peE9QrXYmsbTtR7wSDJi2HkQdHuaMpTpei')
const INVARIANT = new PublicKey('D8Xd5VFXJeANivc4LXEzYqiE8q2CGVbjym5JiynPCP6J')
const FEE_TIER = FEE_TIERS[0]

const main = async () => {
Expand Down
2 changes: 1 addition & 1 deletion sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@invariant-labs/sdk",
"version": "0.9.66",
"version": "0.9.67",
"description": "",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const getMarketAddress = (network: Network) => {
case Network.LOCAL:
return 'HyaB3W9q6XdA5xwpU4XnSZV94htfmbmqJXZcEbRaJutt'
case Network.DEV:
return '9aiirQKPZ2peE9QrXYmsbTtR7wSDJi2HkQdHuaMpTpei'
return 'D8Xd5VFXJeANivc4LXEzYqiE8q2CGVbjym5JiynPCP6J'
case Network.MAIN:
return 'HyaB3W9q6XdA5xwpU4XnSZV94htfmbmqJXZcEbRaJutt'
default:
Expand Down
18 changes: 17 additions & 1 deletion sdk/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ export const tou64 = (amount: BN) => {
}

export const fromFee = (fee: BN): BN => {
// e.g fee - BN(1) -> 0.001%
// 0.001%
return fee.mul(FEE_OFFSET)
}

Expand All @@ -280,21 +280,37 @@ export const feeToTickSpacing = (fee: BN): number => {
}

export const FEE_TIERS: FeeTier[] = [
// 0.001%
{ fee: fromFee(new BN(1)), tickSpacing: 1 },
// 0.003%
{ fee: fromFee(new BN(3)), tickSpacing: 1 },
// 0.005%
{ fee: fromFee(new BN(5)), tickSpacing: 1 },
// 0.01%
{ fee: fromFee(new BN(10)), tickSpacing: 1 },
// 0.02%
{ fee: fromFee(new BN(20)), tickSpacing: 5 },
// 0.05%
{ fee: fromFee(new BN(50)) },
// 0.1%
{ fee: fromFee(new BN(100)) },
// 0.2%
{ fee: fromFee(new BN(200)), tickSpacing: 5 },
// 0.3%
{ fee: fromFee(new BN(300)) },
// 0.5%
{ fee: fromFee(new BN(500)), tickSpacing: 5 },
// 1%
{ fee: fromFee(new BN(1000)) },
// 3%
{ fee: fromFee(new BN(3000)), tickSpacing: 5 },
// 5%
{ fee: fromFee(new BN(5000)), tickSpacing: 5 },
// 10%
{ fee: fromFee(new BN(10000)), tickSpacing: 5 },
// 25%
{ fee: fromFee(new BN(25000)), tickSpacing: 5 },
// 50%
{ fee: fromFee(new BN(50000)), tickSpacing: 5 }
]

Expand Down

0 comments on commit 3aca231

Please sign in to comment.