-
Notifications
You must be signed in to change notification settings - Fork 18
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
feat: slinky #ntrn-250 #281
Merged
Merged
Changes from 11 commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
49d00f6
fix: allow for execution of timelocked proposal when overruled in clo…
NeverHappened 4a92918
Merge branch 'main' into fix/closed-proposals-not-overruled
NeverHappened 5cc721b
updated neutronjsplus #NTRN-174
joldie777 1a455b1
Merge pull request #268 from neutron-org/fix/closed-proposals-not-ove…
pr0n00gler 6cee49e
add basic slinky test
NeverHappened f2765be
add oracle docker image
NeverHappened 9428df8
fix docker build
NeverHappened f07731f
Add proposal votes tests
albertandrejev 709d840
Update tests
albertandrejev 05f80cb
remove only
albertandrejev 43e0d79
fix after rebase
albertandrejev 25037fb
fix tests
albertandrejev 7fba8ca
remove not used function
albertandrejev 8d5d087
remove not needed stuff
NeverHappened 7af4e3a
fix tests
albertandrejev dfb057c
remove unused vars
albertandrejev 4b93588
extract slinky stuff into neutronjsplus
NeverHappened 595231d
remove debug output and add comments
albertandrejev 708dff6
fix typo
NeverHappened 83b9b14
remove leftover arg
NeverHappened 08efa09
update neutronjsplus commit
NeverHappened 31897f6
Merge pull request #265 from neutron-org/feat/proposal-votes
pr0n00gler fc56d72
Merge remote-tracking branch 'origin/feat/sdk-50' into feat/slinky
NeverHappened 0ece940
neutronjsplus release
pr0n00gler f57f9bc
Merge pull request #277 from neutron-org/feat/add-mco-title
pr0n00gler bcffb1e
Merge remote-tracking branch 'origin/feat/sdk-50' into feat/slinky
NeverHappened 691fd2a
use neutronjs rc11 to make tests pass
NeverHappened 0140a67
Merge branch 'feat/sdk-50' into feat/slinky
NeverHappened cec723a
Update setup/Makefile
NeverHappened dbb47d1
update neutronjs
NeverHappened c3a0870
fix lint
NeverHappened 5ffd29f
Merge branch 'feat/sdk-50' into feat/slinky
NeverHappened 9ba5eed
Merge branch 'feat/sdk-50' into feat/slinky
NeverHappened fa0ccf9
neutronjsplus 0.4.0-rc17
NeverHappened 2c9e511
neutronjsplus rc18
NeverHappened 225ac02
neutronjsplus rc v19
NeverHappened 3c961d3
Merge branch 'main' into feat/slinky
NeverHappened 6aebde7
recreate yarn.lock
NeverHappened 0b416a3
upd yarn.lock and package.json
pr0n00gler 7854a6b
add slinky to run in band tests
NeverHappened dbca0c3
recreate yarn.lock
NeverHappened ba3a36c
fix neutrojsplus
NeverHappened f2d094b
Merge branch 'feat/sdk-50' into feat/slinky
NeverHappened af9ff20
recreate yarn.lock
NeverHappened 82f6016
use sdk-50 branch now
NeverHappened File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodejs 16.20.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM golang:1.22-bullseye AS builder | ||
|
||
WORKDIR /src/slinky | ||
COPY --from=app go.mod . | ||
|
||
RUN go mod download | ||
|
||
COPY --from=app . . | ||
|
||
RUN make build | ||
|
||
FROM ubuntu:rolling | ||
EXPOSE 8080 | ||
EXPOSE 8002 | ||
|
||
COPY --from=builder /src/slinky/build/* /usr/local/bin/ | ||
COPY --from=builder /src/slinky/config/local/* /oracle/ | ||
RUN apt-get update && apt-get install ca-certificates -y | ||
|
||
WORKDIR /usr/local/bin/ | ||
ENTRYPOINT ["slinky", "--oracle-config-path", "/oracle/oracle.json", "--market-config-path", "/oracle/market.json"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
import '@neutron-org/neutronjsplus'; | ||
import { | ||
WalletWrapper, | ||
CosmosWrapper, | ||
NEUTRON_DENOM, | ||
} from '@neutron-org/neutronjsplus/dist/cosmos'; | ||
import { TestStateLocalCosmosTestNet } from '@neutron-org/neutronjsplus'; | ||
import { getWithAttempts } from '@neutron-org/neutronjsplus/dist/wait'; | ||
import { | ||
Dao, | ||
DaoMember, | ||
getDaoContracts, | ||
} from '@neutron-org/neutronjsplus/dist/dao'; | ||
|
||
const config = require('../../config.json'); | ||
|
||
describe('Neutron / Slinky', () => { | ||
let testState: TestStateLocalCosmosTestNet; | ||
let neutronChain: CosmosWrapper; | ||
let neutronAccount: WalletWrapper; | ||
let daoMember1: DaoMember; | ||
let dao: Dao; | ||
|
||
let proposalId: number; | ||
|
||
beforeAll(async () => { | ||
testState = new TestStateLocalCosmosTestNet(config); | ||
await testState.init(); | ||
neutronChain = new CosmosWrapper( | ||
testState.sdk1, | ||
testState.blockWaiter1, | ||
NEUTRON_DENOM, | ||
); | ||
neutronAccount = new WalletWrapper( | ||
neutronChain, | ||
testState.wallets.qaNeutron.genQaWal1, | ||
); | ||
const daoCoreAddress = (await neutronChain.getChainAdmins())[0]; | ||
const daoContracts = await getDaoContracts(neutronChain, daoCoreAddress); | ||
dao = new Dao(neutronChain, daoContracts); | ||
daoMember1 = new DaoMember(neutronAccount, dao); | ||
}); | ||
|
||
describe('prepare: bond funds', () => { | ||
test('bond form wallet 1', async () => { | ||
await daoMember1.bondFunds('10000'); | ||
await getWithAttempts( | ||
neutronChain.blockWaiter, | ||
async () => | ||
await dao.queryVotingPower(daoMember1.user.wallet.address.toString()), | ||
async (response) => response.power == 10000, | ||
20, | ||
); | ||
}); | ||
}); | ||
|
||
describe('submit proposal', () => { | ||
test('create proposal', async () => { | ||
proposalId = await daoMember1.submitUpdateMarketMap( | ||
'Proposal for update marketmap', | ||
'Add new marketmap with currency pair', | ||
[ | ||
{ | ||
ticker: { | ||
currency_pair: { | ||
Base: 'ETH', | ||
Quote: 'USDT', | ||
}, | ||
decimals: 8, | ||
min_provider_count: 1, | ||
enabled: true, | ||
metadata_JSON: '{}', | ||
}, | ||
providers: { | ||
providers: [ | ||
{ | ||
name: 'kucoin_ws', | ||
off_chain_ticker: 'eth-usdt', | ||
}, | ||
], | ||
}, | ||
paths: { | ||
paths: [ | ||
{ | ||
operations: [ | ||
{ | ||
provider: 'kucoin_ws', | ||
currency_pair: { | ||
Base: 'ETH', | ||
Quote: 'USDT', | ||
}, | ||
invert: false, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
], | ||
); | ||
}); | ||
|
||
describe('vote for proposal', () => { | ||
test('vote YES', async () => { | ||
await daoMember1.voteYes(proposalId); | ||
}); | ||
}); | ||
|
||
describe('execute proposal', () => { | ||
test('check if proposal is passed', async () => { | ||
await neutronChain.blockWaiter.waitBlocks(5); | ||
await dao.checkPassedProposal(proposalId); | ||
}); | ||
test('execute passed proposal', async () => { | ||
await daoMember1.executeProposalWithAttempts(proposalId); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('module fetches prices', () => { | ||
test('currency pairs not empty', async () => { | ||
// wait to make sure we updated the price in oracle module | ||
await neutronChain.blockWaiter.waitBlocks(5); | ||
// check | ||
const res = await neutronChain.queryOracleAllCurrencyPairs(); | ||
expect(res.currency_pairs[0].Base).toBe('ETH'); | ||
expect(res.currency_pairs[0].Quote).toBe('USDT'); | ||
}); | ||
|
||
test('prices not empty', async () => { | ||
const res = await neutronChain.queryOraclePrices(['ETH/USDT']); | ||
expect(+res.prices[0].price.price).toBeGreaterThan(0); | ||
}); | ||
|
||
test('eth price present', async () => { | ||
const res = await neutronChain.queryOraclePrice('ETH', 'USDT'); | ||
expect(+res.price.price).toBeGreaterThan(0); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do not forget to test full testset, because your slinky test can be broken when running in parallel with other governance related tests.