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

feat: flashloans #304

Open
wants to merge 48 commits into
base: feat/sdk-50
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
9e0f907
feat: flashloans
Jun 7, 2024
c9e20a4
Merge branch 'refs/heads/feat/sdk-50' into feat/flashloans
Jun 7, 2024
574c0a9
formatting
Jun 7, 2024
3e8c34d
Merge branch 'refs/heads/feat/sdk-50' into feat/flashloans
Jun 7, 2024
e46cf87
Merge branch 'refs/heads/feat/sdk-50' into feat/flashloans
Jun 11, 2024
089e42c
Merge pull request #283 from neutron-org/feat/sdk-50
pr0n00gler Jun 11, 2024
10b3184
bump neutronjsplus to 0.4.1
sotnikov-s Jun 14, 2024
601f061
Merge pull request #310 from neutron-org/chore/bump-neutronjsplus-to-…
pr0n00gler Jun 14, 2024
424caf1
add new vars
quasisamurai Jun 19, 2024
7df688f
fix env typos
quasisamurai Jun 19, 2024
84383a4
add tokenfactory params tests
jcompagni10 Jun 20, 2024
d6dbf48
fix tests
jcompagni10 Jun 21, 2024
924835f
lint
jcompagni10 Jun 21, 2024
0ea9681
disable setBeforeSendHook tests
jcompagni10 Jun 21, 2024
1a129e5
lint
jcompagni10 Jun 21, 2024
df4229c
Merge branch 'feat/whitelist-tf-hooks-core-changes' into feat/whiteli…
jcompagni10 Jun 21, 2024
bd044eb
fix incorrect params in TF test
jcompagni10 Jun 21, 2024
82cafb0
lint
jcompagni10 Jun 21, 2024
84b8f5b
fix incorrect params in TF test
jcompagni10 Jun 21, 2024
e128aa2
update neutron jsplus dep
jcompagni10 Jun 25, 2024
f2022e8
lint
jcompagni10 Jun 25, 2024
158adec
Merge branch 'feat/whitelist-tf-hooks-core-changes' into feat/dynamic…
quasisamurai Jun 28, 2024
2205329
whitelist denom hooks for tf tests
jcompagni10 Jun 29, 2024
16e0502
misc cleanup
jcompagni10 Jun 29, 2024
02686cc
add wait for timelock proposal
jcompagni10 Jun 29, 2024
af21a6a
lint
jcompagni10 Jun 29, 2024
ab6ae4d
fix: add test that empty metadata_JSON does not break contract serial…
NeverHappened Jul 1, 2024
48b0fa2
change tf proposal title and description
jcompagni10 Jul 1, 2024
6b33cec
add test for set non-whitelisted hook failure
jcompagni10 Jul 1, 2024
153302e
specify neutronjsplus dep with hash
jcompagni10 Jul 2, 2024
7ed5175
cleanup test for failing whitelist and change subdao voting period
jcompagni10 Jul 2, 2024
d8260ed
also test for last_updated query before marketmap created
NeverHappened Jul 2, 2024
b2be1b5
fix whitelist proposal
jcompagni10 Jul 2, 2024
ca9a9ea
lint
jcompagni10 Jul 2, 2024
ace269e
remove temp fee_collector_address
jcompagni10 Jul 2, 2024
2b5fc0c
attempt to fix njs problem
quasisamurai Jul 3, 2024
2ab1175
another attempt to fix dependency
quasisamurai Jul 3, 2024
45549ff
Merge branch 'main' into feat/flashloans
Jul 3, 2024
bd5a28b
run tokenfactory tests in_band
jcompagni10 Jul 3, 2024
0645791
fix tests
pr0n00gler Jul 4, 2024
8e7c707
upd neutronjplus commit
pr0n00gler Jul 4, 2024
43b9d50
Merge pull request #314 from neutron-org/feat/whitelist-tf-hooks
pr0n00gler Jul 4, 2024
5208633
Merge branch 'main' into feat/dynamic-fees
quasisamurai Jul 4, 2024
a1732eb
Merge branch 'main' into feat/flashloans
Jul 5, 2024
d0797f1
Merge branch 'main' into fix/empty-metadata
NeverHappened Jul 5, 2024
726f5e0
Merge pull request #321 from neutron-org/fix/empty-metadata
pr0n00gler Jul 5, 2024
dda76d0
Merge pull request #325 from neutron-org/feat/dynamic-fees
pr0n00gler Jul 6, 2024
358f15f
Merge branch 'main' into feat/flashloans
Jul 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"test": "yarn test:parallel && yarn test:run_in_band",
"test:parallel": "jest -b src/testcases/parallel",
"test:run_in_band": "yarn test:tge:auction && yarn test:tge:credits && yarn test:interchaintx && yarn test:interchain_kv_query && yarn test:interchain_tx_query_plain && yarn test:tokenomics && yarn test:reserve && yarn test:ibc_hooks && yarn test:float && yarn test:parameters && yarn test:dex_stargate && yarn test:dex_bindings && yarn test:slinky && yarn test:chain_manager && yarn test:feemarket && yarn test:globalfee",
"test:run_in_band": "yarn test:tge:auction && yarn test:tge:credits && yarn test:interchaintx && yarn test:interchain_kv_query && yarn test:interchain_tx_query_plain && yarn test:tokenomics && yarn test:reserve && yarn test:ibc_hooks && yarn test:float && yarn test:parameters && yarn test:dex_stargate && yarn test:dex_bindings && yarn test:slinky && yarn test:chain_manager && yarn test:feemarket && yarn test:globalfee && yarn test:tokenfactory && yarn test:flashloans",
"test:simple": "jest -b src/testcases/parallel/simple",
"test:slinky": "jest -b src/testcases/run_in_band/slinky",
"test:stargate_queries": "jest -b src/testcases/parallel/stargate_queries",
Expand All @@ -24,7 +24,8 @@
"test:ibc_hooks": "jest -b src/testcases/run_in_band/ibc_hooks",
"test:parameters": "jest -b src/testcases/run_in_band/parameters",
"test:chain_manager": "jest -b src/testcases/run_in_band/chain_manager",
"test:tokenfactory": "jest -b src/testcases/parallel/tokenfactory",
"test:flashloans": "jest -b src/testcases/run_in_band/flashloans",
"test:tokenfactory": "jest -b src/testcases/run_in_band/tokenfactory",
"test:overrule": "jest -b src/testcases/parallel/overrule",
"test:tge:vesting_lp_vault": "jest -b src/testcases/parallel/tge.vesting_lp_vault",
"test:tge:credits_vault": "jest -b src/testcases/parallel/tge.credits_vault",
Expand All @@ -47,7 +48,7 @@
"@cosmos-client/core": "^0.47.4",
"@cosmos-client/cosmwasm": "^0.40.3",
"@cosmos-client/ibc": "^1.2.1",
"@neutron-org/neutronjsplus": "https://github.com/neutron-org/neutronjsplus.git#58eb19ae11067de3bd73d0c4cd2889aca422d079",
"@neutron-org/neutronjsplus": "https://github.com/neutron-org/neutronjsplus.git#40c2c30434e63ab989e42408a94034589d5985d8",
"@types/lodash": "^4.14.182",
"@types/long": "^5.0.0",
"axios": "^0.27.2",
Expand Down Expand Up @@ -86,7 +87,9 @@
"eslint --max-warnings=0",
"jest --bail --findRelatedTests"
],
"./**/*.{ts,tsx,js,jsx,md,json}": ["prettier --write"]
"./**/*.{ts,tsx,js,jsx,md,json}": [
"prettier --write"
]
},
"engines": {
"node": ">=16.0 <17"
Expand Down
3 changes: 3 additions & 0 deletions setup/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ services:
- RELAYER_NEUTRON_CHAIN_SIGN_KEY_NAME=demowallet3
- RELAYER_NEUTRON_CHAIN_GAS_PRICES=0.5untrn
- RELAYER_NEUTRON_CHAIN_GAS_ADJUSTMENT=1.4
- RELAYER_NEUTRON_CHAIN_DENOM=untrn
- RELAYER_NEUTRON_CHAIN_MAX_GAS_PRICE=1000
- RELAYER_NEUTRON_CHAIN_GAS_PRICE_MULTIPLIER=1.1
- RELAYER_NEUTRON_CHAIN_CONNECTION_ID=connection-0
- RELAYER_NEUTRON_CHAIN_DEBUG=true
- RELAYER_NEUTRON_CHAIN_ACCOUNT_PREFIX=neutron
Expand Down
83 changes: 76 additions & 7 deletions src/testcases/run_in_band/chain_manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ import {
import { Wallet } from '@neutron-org/neutronjsplus/dist/types';
import cosmosclient from '@cosmos-client/core';
import { waitSeconds } from '@neutron-org/neutronjsplus/dist/wait';
import { updateCronParamsProposal } from '@neutron-org/neutronjsplus/dist/proposal';
import {
updateCronParamsProposal,
updateTokenfactoryParamsProposal,
} from '@neutron-org/neutronjsplus/dist/proposal';

import config from '../../config.json';

Expand Down Expand Up @@ -128,7 +131,7 @@ describe('Neutron / Chain Manager', () => {
});
});

describe('Add an ALLOW_ONLY strategy (Cron module parameter updates, legacy param changes)', () => {
describe('Add an ALLOW_ONLY strategy (Cron module parameter updates, Tokenfactory module parameter updates, legacy param changes)', () => {
let proposalId: number;
test('create proposal', async () => {
const chainManagerAddress = (await neutronChain.getChainAdmins())[0];
Expand All @@ -152,11 +155,17 @@ describe('Neutron / Chain Manager', () => {
},
},
{
update_params_permission: {
cron_update_params_permission: {
security_address: true,
limit: true,
},
update_cron_params_permission: {
security_address: true,
limit: true,
},
},
{
update_tokenfactory_params_permission: {
denom_creation_fee: true,
denom_creation_gas_consume: true,
fee_collector_address: true,
whitelisted_hooks: true,
},
},
],
Expand Down Expand Up @@ -219,4 +228,64 @@ describe('Neutron / Chain Manager', () => {
expect(cronParams.params.limit).toEqual('42');
});
});

describe('ALLOW_ONLY: change TOKENFACTORY parameters', () => {
let proposalId: number;
beforeAll(async () => {
const chainManagerAddress = (await neutronChain.getChainAdmins())[0];
proposalId = await subdaoMember1.submitUpdateParamsTokenfactoryProposal(
chainManagerAddress,
'Proposal #2',
'Cron update params proposal. Will pass',
updateTokenfactoryParamsProposal({
denom_creation_fee: [{ denom: 'untrn', amount: '1' }],
denom_creation_gas_consume: 20,
fee_collector_address:
'neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2',
whitelisted_hooks: [
{
code_id: 1,
denom_creator: 'neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2',
},
],
}),
'1000',
);

const timelockedProp = await subdaoMember1.supportAndExecuteProposal(
proposalId,
);

expect(timelockedProp.id).toEqual(proposalId);
expect(timelockedProp.status).toEqual('timelocked');
expect(timelockedProp.msgs).toHaveLength(1);
});

test('execute timelocked: success', async () => {
await waitSeconds(10);

await subdaoMember1.executeTimelockedProposal(proposalId);
const timelockedProp = await subDao.getTimelockedProposal(proposalId);
expect(timelockedProp.id).toEqual(proposalId);
expect(timelockedProp.status).toEqual('executed');
expect(timelockedProp.msgs).toHaveLength(1);

const tokenfactoryParams = await neutronChain.queryTokenfactoryParams();
expect(tokenfactoryParams.params.denom_creation_fee).toEqual([
{ denom: 'untrn', amount: '1' },
]);
expect(tokenfactoryParams.params.denom_creation_gas_consume).toEqual(
'20',
);
expect(tokenfactoryParams.params.fee_collector_address).toEqual(
'neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2',
);
expect(tokenfactoryParams.params.whitelisted_hooks).toEqual([
{
code_id: '1',
denom_creator: 'neutron1m9l358xunhhwds0568za49mzhvuxx9ux8xafx2',
},
]);
});
});
});
Loading
Loading