diff --git a/Makefile b/Makefile index 4ff2b389..75df1fb5 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ test.prepare: cp -r "$(PWD)/_deploy/p/demo/gnoswap" ".test/examples/gno.land/p/demo" # gnoswap base package - cp -r "$(PWD)/_deploy/r/gnoswap" ".test/examples/gno.land/r/gnoswap" # gnoswap base realm + cp -r "$(PWD)/_deploy/r/demo/gnoswap" ".test/examples/gno.land/r/demo/gnoswap" # gnoswap base realm cp -r "$(PWD)/gov" "$(PWD)/pool" "$(PWD)/position" "$(PWD)/router" "$(PWD)/staker" ".test/examples/gno.land/r/demo" # gnoswap realm diff --git a/README.md b/README.md index 1697e1de..9614e3f7 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ To run unit tests, follow these steps: ### Set Up Gnoswap Contracts in Gno Core 1. Clone the `gnoswap` contracts repository: + ``` $ cd $WORKDIR $ git clone https://github.com/gnoswap-labs/gnoswap.git @@ -38,39 +39,41 @@ To run unit tests, follow these steps: ``` 2. Copy the `gnoswap` contracts into the Gno core: + ``` # copy grc20 tokens $ cp -R __local/grc20_tokens/* $WORK_DIR/gno/examples/gno.land/r/demo $ cp -R _deploy/r/demo/* $WORK_DIR/gno/examples/gno.land/r/demo - + # copy gnoswap base packages ( includes uint256, int256 and bit of pool calculation ) $ cp -R _deploy/p/demo/gnoswap $WORK_DIR/gno/examples/gno.land/p/demo - + # copy gnoswap base realms ( includes common logic, variables and consts ) $ cp -R _deploy/r/gnoswap $WORK_DIR/gno/examples/gno.land/r/gnoswap - + # copy gnoswap realms $ cp -R gov pool position router staker $WORK_DIR/gno/examples/gno.land/r/demo ``` 3. Move all test cases into its own directory: + ``` # Governance $ cd $WORKDIR/gno/examples/gno.land/r/demo/gov $ mv _TEST_/* . - + # Pool $ cd $WORKDIR/gno/examples/gno.land/r/demo/pool $ mv _TEST_/* . - + # Position $ cd $WORKDIR/gno/examples/gno.land/r/demo/position $ mv _TEST_/* . - + # Router $ cd $WORKDIR/gno/examples/gno.land/r/demo/router $ mv _TEST_/* . - + # Staker $ cd $WORKDIR/gno/examples/gno.land/r/demo/staker $ mv _TEST_/* . @@ -87,10 +90,12 @@ $ gno test -root-dir $WORKDIR/gno-for-swap -verbose=true $WORKDIR/gno/examples/g The contracts can be tested using [testscript](https://github.com/gnolang/gno/blob/d54ca62749f79a6992da520e1659ba0dbbdd980b/gno.land/pkg/integration/doc.go) ### Change Admin Address -1. Open `$WORKDIR/gno/examples/gno.land/r/gnoswap/consts/consts.gno` + +1. Open `$WORKDIR/gno/examples/gno.land/r/demo/gnoswap/consts/consts.gno` 2. Change `GNOSWAP_ADMIN`, `FEE_COLLECTOR` to `g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5` ### Testing + ``` $ cd $WORKDIR/gnoswap $ cp __local/test/gnoswap.txtar $WORKDIR/gno/gno.land/cmd/gnoland/testdata/ @@ -100,14 +105,11 @@ $ go test -v . -run Testdata/gnoswap ``` ## WARNING -> [!WARNING] -> To deploy `pool` contract, `9781838` gas is required which is close to the [block gas limit](https://github.com/gnolang/gno/blob/831bb6f92e1a2217242169dab1f4fd1f87e5eaa0/tm2/pkg/bft/types/params.go#L26-L27). + +> [!WARNING] To deploy `pool` contract, `9781838` gas is required which is close to the [block gas limit](https://github.com/gnolang/gno/blob/831bb6f92e1a2217242169dab1f4fd1f87e5eaa0/tm2/pkg/bft/types/params.go#L26-L27). > > So, when changing the `pool` contract, make sure to test it on actual network before making PR. - -> [!WARNING] -> To deploy `uint256` contract, `9731522` gas is required which is close to the [block gas limit](https://github.com/gnolang/gno/blob/831bb6f92e1a2217242169dab1f4fd1f87e5eaa0/tm2/pkg/bft/types/params.go#L26-L27). +> [!WARNING] To deploy `uint256` contract, `9731522` gas is required which is close to the [block gas limit](https://github.com/gnolang/gno/blob/831bb6f92e1a2217242169dab1f4fd1f87e5eaa0/tm2/pkg/bft/types/params.go#L26-L27). > > So, when changing the `uint256` contract, make sure to test it on actual network before making PR. - diff --git a/__local/test/gnoswap.txtar b/__local/test/gnoswap.txtar index 3e8529be..e0cf795b 100644 --- a/__local/test/gnoswap.txtar +++ b/__local/test/gnoswap.txtar @@ -10,8 +10,8 @@ loadpkg gno.land/r/demo/users loadpkg gno.land/r/demo/wugnot loadpkg gno.land/r/demo/foo20 -loadpkg gno.land/r/gnoswap/consts -loadpkg gno.land/r/gnoswap/common +loadpkg gno.land/r/demo/gnoswap/consts +loadpkg gno.land/r/demo/gnoswap/common loadpkg gno.land/r/demo/gns loadpkg gno.land/r/demo/gnft diff --git a/__local/test/test_data.mk b/__local/test/test_data.mk index 0ac510d9..03779927 100644 --- a/__local/test/test_data.mk +++ b/__local/test/test_data.mk @@ -16,15 +16,15 @@ ADDR_WUGNOT := g1pf6dv9fjk3rn0m4jjcne306ga4he3mzmupfjl6 MAX_UINT64 := 18446744073709551615 TX_EXPIRE := 9999999999 -NOW := $(shell date +%s) -INCENTIVE_START := $(shell expr $(NOW) + 360) # GIVE ENOUGH TIME TO EXECUTE PREVIOUS TXS -INCENTIVE_END := $(shell expr $(NOW) + 360 + 7776000) # 7776000 SECONDS = 90 DAY +# INCENTIVE_START +# TOMORROW_MIDNIGHT := $(shell date +%s) # DEV +TOMORROW_MIDNIGHT := $(shell (gdate -ud 'tomorrow 00:00:00' +%s)) +INCENTIVE_END := $(shell expr $(TOMORROW_MIDNIGHT) + 7776000) # 7776000 SECONDS = 90 DAY MAKEFILE := $(shell realpath $(firstword $(MAKEFILE_LIST))) -# GNOLAND_RPC_URL ?= localhost:26657 -GNOLAND_RPC_URL ?= localhost:26657 # 36657 for gnodev, 26657 for gnoland +GNOLAND_RPC_URL ?= localhost:26657 CHAINID ?= dev ROOT_DIR:=$(shell dirname $(MAKEFILE))/../../ @@ -151,12 +151,12 @@ deploy-package-pool: # deploy common realms deploy-consts: $(info ************ deploy consts ************) - @echo "" | gnokey maketx addpkg -pkgdir $(ROOT_DIR)/_deploy/r/gnoswap/consts -pkgpath gno.land/r/gnoswap/consts -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx addpkg -pkgdir $(ROOT_DIR)/_deploy/r/demo/gnoswap/consts -pkgpath gno.land/r/demo/gnoswap/consts -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null @echo deploy-common: $(info ************ deploy common ************) - @echo "" | gnokey maketx addpkg -pkgdir $(ROOT_DIR)/_deploy/r/gnoswap/common -pkgpath gno.land/r/gnoswap/common -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx addpkg -pkgdir $(ROOT_DIR)/_deploy/r/demo/gnoswap/common -pkgpath gno.land/r/demo/gnoswap/common -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 10000000 -memo "" gnoswap_admin > /dev/null @echo # deploy gnoswap realms @@ -351,7 +351,7 @@ create-external-incentive: @echo # THEN CREATE EXTERNAL INCENTIVE - @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func CreateExternalIncentive -args "gno.land/r/demo/foo:gno.land/r/demo/gns:500" -args "gno.land/r/demo/obl" -args 100000000000000 -args $(INCENTIVE_START) -args $(INCENTIVE_END) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null + @echo "" | gnokey maketx call -pkgpath gno.land/r/demo/staker -func CreateExternalIncentive -args "gno.land/r/demo/foo:gno.land/r/demo/gns:500" -args "gno.land/r/demo/obl" -args 100000000000000 -args $(TOMORROW_MIDNIGHT) -args $(INCENTIVE_END) -insecure-password-stdin=true -remote $(GNOLAND_RPC_URL) -broadcast=true -chainid $(CHAINID) -gas-fee 1ugnot -gas-wanted 9000000 -memo "" gnoswap_admin > /dev/null @echo diff --git a/_deploy/r/gnoswap/common/allow_non_gnoswap_contracts.gno b/_deploy/r/demo/gnoswap/common/allow_non_gnoswap_contracts.gno similarity index 95% rename from _deploy/r/gnoswap/common/allow_non_gnoswap_contracts.gno rename to _deploy/r/demo/gnoswap/common/allow_non_gnoswap_contracts.gno index b8ae9cfe..6f190cb9 100644 --- a/_deploy/r/gnoswap/common/allow_non_gnoswap_contracts.gno +++ b/_deploy/r/demo/gnoswap/common/allow_non_gnoswap_contracts.gno @@ -3,7 +3,7 @@ package common import ( "std" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" ) var ( diff --git a/_deploy/r/gnoswap/common/gno.mod b/_deploy/r/demo/gnoswap/common/gno.mod similarity index 55% rename from _deploy/r/gnoswap/common/gno.mod rename to _deploy/r/demo/gnoswap/common/gno.mod index 60526f30..5d81d6b8 100644 --- a/_deploy/r/gnoswap/common/gno.mod +++ b/_deploy/r/demo/gnoswap/common/gno.mod @@ -1,7 +1,7 @@ -module gno.land/r/gnoswap/common +module gno.land/r/demo/gnoswap/common require ( gno.land/p/demo/gnoswap/int256 v0.0.0-latest gno.land/p/demo/gnoswap/uint256 v0.0.0-latest - gno.land/r/gnoswap/consts v0.0.0-latest + gno.land/r/demo/gnoswap/consts v0.0.0-latest ) diff --git a/_deploy/r/gnoswap/common/liquidity_amounts.gno b/_deploy/r/demo/gnoswap/common/liquidity_amounts.gno similarity index 99% rename from _deploy/r/gnoswap/common/liquidity_amounts.gno rename to _deploy/r/demo/gnoswap/common/liquidity_amounts.gno index 95ac5765..3b0ec2f2 100644 --- a/_deploy/r/gnoswap/common/liquidity_amounts.gno +++ b/_deploy/r/demo/gnoswap/common/liquidity_amounts.gno @@ -1,7 +1,7 @@ package common import ( - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" u256 "gno.land/p/demo/gnoswap/uint256" ) diff --git a/_deploy/r/gnoswap/common/tick_math.gno b/_deploy/r/demo/gnoswap/common/tick_math.gno similarity index 100% rename from _deploy/r/gnoswap/common/tick_math.gno rename to _deploy/r/demo/gnoswap/common/tick_math.gno diff --git a/_deploy/r/gnoswap/consts/consts.gno b/_deploy/r/demo/gnoswap/consts/consts.gno similarity index 100% rename from _deploy/r/gnoswap/consts/consts.gno rename to _deploy/r/demo/gnoswap/consts/consts.gno diff --git a/_deploy/r/demo/gnoswap/consts/gno.mod b/_deploy/r/demo/gnoswap/consts/gno.mod new file mode 100644 index 00000000..0cc319e3 --- /dev/null +++ b/_deploy/r/demo/gnoswap/consts/gno.mod @@ -0,0 +1 @@ +module gno.land/r/demo/gnoswap/consts diff --git a/_deploy/r/demo/gns/gno.mod b/_deploy/r/demo/gns/gno.mod index 9c123112..2df94d2f 100644 --- a/_deploy/r/demo/gns/gno.mod +++ b/_deploy/r/demo/gns/gno.mod @@ -5,5 +5,5 @@ require ( gno.land/p/demo/ufmt v0.0.0-latest gno.land/p/demo/users v0.0.0-latest gno.land/r/demo/users v0.0.0-latest - gno.land/r/gnoswap/consts v0.0.0-latest + gno.land/r/demo/gnoswap/consts v0.0.0-latest ) diff --git a/_deploy/r/demo/gns/gns.gno b/_deploy/r/demo/gns/gns.gno index 5f5824f5..d98b6c88 100644 --- a/_deploy/r/demo/gns/gns.gno +++ b/_deploy/r/demo/gns/gns.gno @@ -10,7 +10,7 @@ import ( pusers "gno.land/p/demo/users" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" ) const MAXIMUM_SUPPLY = uint64(1_000_000_000_000_000) // 1B diff --git a/_deploy/r/gnoswap/consts/gno.mod b/_deploy/r/gnoswap/consts/gno.mod deleted file mode 100644 index bddf7a4b..00000000 --- a/_deploy/r/gnoswap/consts/gno.mod +++ /dev/null @@ -1 +0,0 @@ -module gno.land/r/gnoswap/consts diff --git a/gov/gno.mod b/gov/gno.mod index 4c984993..275da1b7 100644 --- a/gov/gno.mod +++ b/gov/gno.mod @@ -4,5 +4,5 @@ require ( gno.land/p/demo/ufmt v0.0.0-latest gno.land/p/demo/users v0.0.0-latest gno.land/r/demo/gns v0.0.0-latest - gno.land/r/gnoswap/consts v0.0.0-latest + gno.land/r/demo/gnoswap/consts v0.0.0-latest ) diff --git a/gov/gno_helper.gno b/gov/gno_helper.gno index 6d081ec0..35fd8d85 100644 --- a/gov/gno_helper.gno +++ b/gov/gno_helper.gno @@ -3,7 +3,7 @@ package gov import ( "std" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" ) func GetOrigPkgAddr() std.Address { diff --git a/pool/_RPC_dry.gno b/pool/_RPC_dry.gno index fa4a057a..028be9ce 100644 --- a/pool/_RPC_dry.gno +++ b/pool/_RPC_dry.gno @@ -1,9 +1,9 @@ package pool import ( - "gno.land/r/gnoswap/common" + "gno.land/r/demo/gnoswap/common" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" plp "gno.land/p/demo/gnoswap/pool" // pool package diff --git a/pool/_TEST_/_TEST_0_INIT_TOKEN_REGISTER_test.gno b/pool/_TEST_/_TEST_0_INIT_TOKEN_REGISTER_test.gno index 86c8735b..3b7b6068 100644 --- a/pool/_TEST_/_TEST_0_INIT_TOKEN_REGISTER_test.gno +++ b/pool/_TEST_/_TEST_0_INIT_TOKEN_REGISTER_test.gno @@ -20,7 +20,7 @@ import ( "gno.land/r/demo/gns" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" pusers "gno.land/p/demo/users" ) diff --git a/pool/_TEST_/_TEST_0_INIT_VARIABLE_AND_HELPER_test.gno b/pool/_TEST_/_TEST_0_INIT_VARIABLE_AND_HELPER_test.gno index ae9c44dc..7ec3977a 100644 --- a/pool/_TEST_/_TEST_0_INIT_VARIABLE_AND_HELPER_test.gno +++ b/pool/_TEST_/_TEST_0_INIT_VARIABLE_AND_HELPER_test.gno @@ -4,7 +4,7 @@ import ( "std" "testing" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" ) var ( diff --git a/pool/_TEST_/_TEST_pool_dryswap_and_swap_test.gn b/pool/_TEST_/_TEST_pool_dryswap_and_swap_test.gn index 74497844..49f5bb73 100644 --- a/pool/_TEST_/_TEST_pool_dryswap_and_swap_test.gn +++ b/pool/_TEST_/_TEST_pool_dryswap_and_swap_test.gn @@ -4,7 +4,7 @@ import ( "std" "testing" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" "gno.land/r/demo/bar" "gno.land/r/demo/foo" diff --git a/pool/_TEST_/_TEST_pool_multi_token_test.gn b/pool/_TEST_/_TEST_pool_multi_token_test.gn index db857dd7..e67271a1 100644 --- a/pool/_TEST_/_TEST_pool_multi_token_test.gn +++ b/pool/_TEST_/_TEST_pool_multi_token_test.gn @@ -5,7 +5,7 @@ import ( "strconv" "testing" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" "gno.land/r/demo/bar" "gno.land/r/demo/baz" diff --git a/pool/_TEST_/_TEST_pool_native_swap_test.gn b/pool/_TEST_/_TEST_pool_native_swap_test.gn index a28f9019..b45acd55 100644 --- a/pool/_TEST_/_TEST_pool_native_swap_test.gn +++ b/pool/_TEST_/_TEST_pool_native_swap_test.gn @@ -4,7 +4,7 @@ import ( "std" "testing" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" "gno.land/r/demo/gns" diff --git a/pool/_TEST_/_TEST_pool_single_lp_test.gn b/pool/_TEST_/_TEST_pool_single_lp_test.gn index cd956bf3..342455a2 100644 --- a/pool/_TEST_/_TEST_pool_single_lp_test.gn +++ b/pool/_TEST_/_TEST_pool_single_lp_test.gn @@ -9,7 +9,7 @@ import ( "gno.land/r/demo/foo" "gno.land/r/demo/gns" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" "gno.land/p/demo/json" diff --git a/pool/_TEST_/_TEST_pool_test.gn b/pool/_TEST_/_TEST_pool_test.gn index c2eb7ee2..cebbcd70 100644 --- a/pool/_TEST_/_TEST_pool_test.gn +++ b/pool/_TEST_/_TEST_pool_test.gn @@ -10,7 +10,7 @@ import ( "gno.land/r/demo/baz" "gno.land/r/demo/foo" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" "gno.land/r/demo/gns" ) diff --git a/pool/_TEST_/z0_rpc_filetest.gno b/pool/_TEST_/z0_rpc_filetest.gno index d99110d4..36d9c735 100644 --- a/pool/_TEST_/z0_rpc_filetest.gno +++ b/pool/_TEST_/z0_rpc_filetest.gno @@ -15,7 +15,7 @@ import ( "gno.land/p/demo/json" pusers "gno.land/p/demo/users" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" pl "gno.land/r/demo/pool" ) diff --git a/pool/_TEST_/z1_single_lp_filetest.gno b/pool/_TEST_/z1_single_lp_filetest.gno index 5d7e0530..b6be0e4f 100644 --- a/pool/_TEST_/z1_single_lp_filetest.gno +++ b/pool/_TEST_/z1_single_lp_filetest.gno @@ -15,7 +15,7 @@ import ( "gno.land/p/demo/json" pusers "gno.land/p/demo/users" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" pl "gno.land/r/demo/pool" ) diff --git a/pool/emergency_halt.gno b/pool/emergency_halt.gno index c1a8ad52..df31053f 100644 --- a/pool/emergency_halt.gno +++ b/pool/emergency_halt.gno @@ -4,7 +4,7 @@ import ( "std" "gno.land/p/demo/ufmt" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" ) var ( diff --git a/pool/gno.mod b/pool/gno.mod index e65d3ced..ca154c8c 100644 --- a/pool/gno.mod +++ b/pool/gno.mod @@ -9,6 +9,6 @@ require ( gno.land/p/demo/users v0.0.0-latest gno.land/r/demo/gns v0.0.0-latest gno.land/r/demo/gov v0.0.0-latest - gno.land/r/gnoswap/common v0.0.0-latest - gno.land/r/gnoswap/consts v0.0.0-latest + gno.land/r/demo/gnoswap/common v0.0.0-latest + gno.land/r/demo/gnoswap/consts v0.0.0-latest ) diff --git a/pool/pool.gno b/pool/pool.gno index 7cc26ed5..04bbcfef 100644 --- a/pool/pool.gno +++ b/pool/pool.gno @@ -7,8 +7,8 @@ import ( plp "gno.land/p/demo/gnoswap/pool" - "gno.land/r/gnoswap/common" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/common" + "gno.land/r/demo/gnoswap/consts" gv "gno.land/r/demo/gov" diff --git a/pool/pool_manager.gno b/pool/pool_manager.gno index 73692566..411df52a 100644 --- a/pool/pool_manager.gno +++ b/pool/pool_manager.gno @@ -6,8 +6,8 @@ import ( "gno.land/p/demo/ufmt" - "gno.land/r/gnoswap/common" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/common" + "gno.land/r/demo/gnoswap/consts" "gno.land/r/demo/gns" diff --git a/pool/position.gno b/pool/position.gno index f9c0a292..8eb7e684 100644 --- a/pool/position.gno +++ b/pool/position.gno @@ -5,7 +5,7 @@ import ( "std" "gno.land/p/demo/ufmt" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" i256 "gno.land/p/demo/gnoswap/int256" u256 "gno.land/p/demo/gnoswap/uint256" diff --git a/pool/position_modify.gno b/pool/position_modify.gno index 37bd04d0..8265bea8 100644 --- a/pool/position_modify.gno +++ b/pool/position_modify.gno @@ -1,7 +1,7 @@ package pool import ( - "gno.land/r/gnoswap/common" + "gno.land/r/demo/gnoswap/common" i256 "gno.land/p/demo/gnoswap/int256" diff --git a/pool/tick.gno b/pool/tick.gno index 43c4ffe3..e72ba24c 100644 --- a/pool/tick.gno +++ b/pool/tick.gno @@ -1,7 +1,7 @@ package pool import ( - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" i256 "gno.land/p/demo/gnoswap/int256" u256 "gno.land/p/demo/gnoswap/uint256" diff --git a/pool/tick_bitmap.gno b/pool/tick_bitmap.gno index e058a5a4..d7e30c28 100644 --- a/pool/tick_bitmap.gno +++ b/pool/tick_bitmap.gno @@ -2,7 +2,7 @@ package pool import ( "gno.land/p/demo/ufmt" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" plp "gno.land/p/demo/gnoswap/pool" diff --git a/pool/token_register.gno b/pool/token_register.gno index 5606deb1..b3148e89 100644 --- a/pool/token_register.gno +++ b/pool/token_register.gno @@ -7,7 +7,7 @@ import ( pusers "gno.land/p/demo/users" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" ) // GRC20Interface is the interface for GRC20 tokens diff --git a/pool/withdrawal_fee.gno b/pool/withdrawal_fee.gno index 7c745743..87aa2424 100644 --- a/pool/withdrawal_fee.gno +++ b/pool/withdrawal_fee.gno @@ -3,8 +3,8 @@ package pool import ( "std" - "gno.land/r/gnoswap/common" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/common" + "gno.land/r/demo/gnoswap/consts" "gno.land/p/demo/ufmt" diff --git a/position/_RPC_api.gno b/position/_RPC_api.gno index 2d8163bf..9e75a143 100644 --- a/position/_RPC_api.gno +++ b/position/_RPC_api.gno @@ -7,9 +7,9 @@ import ( "gno.land/p/demo/json" "gno.land/p/demo/ufmt" - "gno.land/r/gnoswap/common" + "gno.land/r/demo/gnoswap/common" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" pl "gno.land/r/demo/pool" diff --git a/position/_RPC_dry.gno b/position/_RPC_dry.gno index e186e8d2..4812248b 100644 --- a/position/_RPC_dry.gno +++ b/position/_RPC_dry.gno @@ -1,7 +1,7 @@ package position import ( - "gno.land/r/gnoswap/common" + "gno.land/r/demo/gnoswap/common" i256 "gno.land/p/demo/gnoswap/int256" u256 "gno.land/p/demo/gnoswap/uint256" diff --git a/position/_TEST_/_TEST_0_INIT_TOKEN_REGISTER_test.gno b/position/_TEST_/_TEST_0_INIT_TOKEN_REGISTER_test.gno index d82dd7d4..6699bba9 100644 --- a/position/_TEST_/_TEST_0_INIT_TOKEN_REGISTER_test.gno +++ b/position/_TEST_/_TEST_0_INIT_TOKEN_REGISTER_test.gno @@ -17,7 +17,7 @@ import ( "gno.land/r/demo/gns" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" pusers "gno.land/p/demo/users" diff --git a/position/_TEST_/_TEST_0_INIT_VARIABLE_AND_HELPER_test.gno b/position/_TEST_/_TEST_0_INIT_VARIABLE_AND_HELPER_test.gno index 31ae8d80..482dcb5e 100644 --- a/position/_TEST_/_TEST_0_INIT_VARIABLE_AND_HELPER_test.gno +++ b/position/_TEST_/_TEST_0_INIT_VARIABLE_AND_HELPER_test.gno @@ -4,7 +4,7 @@ import ( "std" "testing" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" "gno.land/r/demo/gnft" diff --git a/position/_TEST_/_TEST_position_api_test.gn b/position/_TEST_/_TEST_position_api_test.gn index f90d512a..f64ad780 100644 --- a/position/_TEST_/_TEST_position_api_test.gn +++ b/position/_TEST_/_TEST_position_api_test.gn @@ -6,7 +6,7 @@ import ( "std" "testing" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" "gno.land/r/demo/bar" "gno.land/r/demo/foo" diff --git a/position/_TEST_/_TEST_position_increase_decrease_test.gn b/position/_TEST_/_TEST_position_increase_decrease_test.gn index f3ee37db..d3225d06 100644 --- a/position/_TEST_/_TEST_position_increase_decrease_test.gn +++ b/position/_TEST_/_TEST_position_increase_decrease_test.gn @@ -4,8 +4,8 @@ import ( "std" "testing" - "gno.land/r/gnoswap/common" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/common" + "gno.land/r/demo/gnoswap/consts" "gno.land/r/demo/bar" "gno.land/r/demo/foo" diff --git a/position/_TEST_/_TEST_position_test.gn b/position/_TEST_/_TEST_position_test.gn index 10f88059..eb91be70 100644 --- a/position/_TEST_/_TEST_position_test.gn +++ b/position/_TEST_/_TEST_position_test.gn @@ -5,7 +5,7 @@ import ( "std" "testing" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" pl "gno.land/r/demo/pool" diff --git a/position/_TEST_/_TEST_position_test_two_position_used_single_swap_test.gn b/position/_TEST_/_TEST_position_test_two_position_used_single_swap_test.gn index 684f0a2d..889ab6d8 100644 --- a/position/_TEST_/_TEST_position_test_two_position_used_single_swap_test.gn +++ b/position/_TEST_/_TEST_position_test_two_position_used_single_swap_test.gn @@ -4,7 +4,7 @@ import ( "std" "testing" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" pl "gno.land/r/demo/pool" diff --git a/position/gno.mod b/position/gno.mod index d50bcc4b..2979dcbb 100644 --- a/position/gno.mod +++ b/position/gno.mod @@ -10,6 +10,6 @@ require ( gno.land/r/demo/gnft v0.0.0-latest gno.land/r/demo/pool v0.0.0-latest gno.land/r/demo/wugnot v0.0.0-latest - gno.land/r/gnoswap/common v0.0.0-latest - gno.land/r/gnoswap/consts v0.0.0-latest + gno.land/r/demo/gnoswap/common v0.0.0-latest + gno.land/r/demo/gnoswap/consts v0.0.0-latest ) diff --git a/position/gno_helper.gno b/position/gno_helper.gno index 75fd55b5..ba3c5c67 100644 --- a/position/gno_helper.gno +++ b/position/gno_helper.gno @@ -3,7 +3,7 @@ package position import ( "std" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" ) func GetOrigPkgAddr() std.Address { diff --git a/position/liquidity_management.gno b/position/liquidity_management.gno index 9247495d..4104cb4d 100644 --- a/position/liquidity_management.gno +++ b/position/liquidity_management.gno @@ -1,9 +1,9 @@ package position import ( - "gno.land/r/gnoswap/common" + "gno.land/r/demo/gnoswap/common" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" pl "gno.land/r/demo/pool" diff --git a/position/nft_helper.gno b/position/nft_helper.gno index 4e6719d7..48f673b4 100644 --- a/position/nft_helper.gno +++ b/position/nft_helper.gno @@ -4,7 +4,7 @@ import ( "std" "gno.land/p/demo/ufmt" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" "gno.land/r/demo/gnft" ) diff --git a/position/position.gno b/position/position.gno index 1abf458b..34e9ef67 100644 --- a/position/position.gno +++ b/position/position.gno @@ -9,8 +9,8 @@ import ( u256 "gno.land/p/demo/gnoswap/uint256" - "gno.land/r/gnoswap/common" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/common" + "gno.land/r/demo/gnoswap/consts" pl "gno.land/r/demo/pool" ) diff --git a/position/sqrt_price_math.gno b/position/sqrt_price_math.gno index 66b9a1ed..bcf980ca 100644 --- a/position/sqrt_price_math.gno +++ b/position/sqrt_price_math.gno @@ -1,7 +1,7 @@ package position import ( - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" i256 "gno.land/p/demo/gnoswap/int256" u256 "gno.land/p/demo/gnoswap/uint256" diff --git a/position/wrap_unwrap.gno b/position/wrap_unwrap.gno index 8bdd4f5e..aa43738c 100644 --- a/position/wrap_unwrap.gno +++ b/position/wrap_unwrap.gno @@ -6,7 +6,7 @@ import ( "gno.land/r/demo/wugnot" "gno.land/p/demo/ufmt" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" ) func wrap(ugnotAmount uint64) { diff --git a/router/_RPC_api.gno b/router/_RPC_api.gno index 84d79a91..cc2b1f8f 100644 --- a/router/_RPC_api.gno +++ b/router/_RPC_api.gno @@ -7,8 +7,8 @@ import ( "gno.land/p/demo/json" "gno.land/p/demo/ufmt" - "gno.land/r/gnoswap/common" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/common" + "gno.land/r/demo/gnoswap/consts" pl "gno.land/r/demo/pool" diff --git a/router/_TEST_/_TEST_0_INIT_TOKEN_REGISTER_test.gno b/router/_TEST_/_TEST_0_INIT_TOKEN_REGISTER_test.gno index 06c9339a..d36776af 100644 --- a/router/_TEST_/_TEST_0_INIT_TOKEN_REGISTER_test.gno +++ b/router/_TEST_/_TEST_0_INIT_TOKEN_REGISTER_test.gno @@ -17,7 +17,7 @@ import ( "gno.land/r/demo/gns" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" pusers "gno.land/p/demo/users" diff --git a/router/_TEST_/_TEST_0_INIT_VARIABLE_AND_HELPER_test.gno b/router/_TEST_/_TEST_0_INIT_VARIABLE_AND_HELPER_test.gno index f9d41ba8..a7402d4c 100644 --- a/router/_TEST_/_TEST_0_INIT_VARIABLE_AND_HELPER_test.gno +++ b/router/_TEST_/_TEST_0_INIT_VARIABLE_AND_HELPER_test.gno @@ -4,7 +4,7 @@ import ( "std" "testing" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" ) var ( diff --git a/router/_TEST_/_TEST_router_ratio_test.gn b/router/_TEST_/_TEST_router_ratio_test.gn index 337e4f2e..204aeef3 100644 --- a/router/_TEST_/_TEST_router_ratio_test.gn +++ b/router/_TEST_/_TEST_router_ratio_test.gn @@ -9,8 +9,8 @@ import ( "gno.land/p/demo/json" - "gno.land/r/gnoswap/common" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/common" + "gno.land/r/demo/gnoswap/consts" "gno.land/r/demo/bar" "gno.land/r/demo/foo" diff --git a/router/_TEST_/_TEST_router_swap_route_1route_1hop_native_in_out_test.gn b/router/_TEST_/_TEST_router_swap_route_1route_1hop_native_in_out_test.gn index 5fcc127b..d8de441e 100644 --- a/router/_TEST_/_TEST_router_swap_route_1route_1hop_native_in_out_test.gn +++ b/router/_TEST_/_TEST_router_swap_route_1route_1hop_native_in_out_test.gn @@ -6,7 +6,7 @@ import ( "gno.land/p/demo/json" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" pl "gno.land/r/demo/pool" pn "gno.land/r/demo/position" diff --git a/router/_TEST_/_TEST_router_swap_route_1route_1hop_out_range_test.gn b/router/_TEST_/_TEST_router_swap_route_1route_1hop_out_range_test.gn index 4dd8046a..f234f698 100644 --- a/router/_TEST_/_TEST_router_swap_route_1route_1hop_out_range_test.gn +++ b/router/_TEST_/_TEST_router_swap_route_1route_1hop_out_range_test.gn @@ -6,7 +6,7 @@ import ( "gno.land/p/demo/json" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" pl "gno.land/r/demo/pool" pn "gno.land/r/demo/position" diff --git a/router/_TEST_/_TEST_router_swap_route_1route_1hop_test.gn b/router/_TEST_/_TEST_router_swap_route_1route_1hop_test.gn index 8c2ea393..f079d7f3 100644 --- a/router/_TEST_/_TEST_router_swap_route_1route_1hop_test.gn +++ b/router/_TEST_/_TEST_router_swap_route_1route_1hop_test.gn @@ -4,7 +4,7 @@ import ( "std" "testing" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" pl "gno.land/r/demo/pool" pn "gno.land/r/demo/position" diff --git a/router/_TEST_/_TEST_router_swap_route_1route_2hop_wrapped_native_in_out_test.gn b/router/_TEST_/_TEST_router_swap_route_1route_2hop_wrapped_native_in_out_test.gn index 363eebac..672269f2 100644 --- a/router/_TEST_/_TEST_router_swap_route_1route_2hop_wrapped_native_in_out_test.gn +++ b/router/_TEST_/_TEST_router_swap_route_1route_2hop_wrapped_native_in_out_test.gn @@ -5,7 +5,7 @@ import ( "std" "testing" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" pl "gno.land/r/demo/pool" pn "gno.land/r/demo/position" diff --git a/router/_TEST_/_TEST_router_swap_route_1route_3hop_wrapped_native_middle_test.gn b/router/_TEST_/_TEST_router_swap_route_1route_3hop_wrapped_native_middle_test.gn index 7c699fe5..1c97a991 100644 --- a/router/_TEST_/_TEST_router_swap_route_1route_3hop_wrapped_native_middle_test.gn +++ b/router/_TEST_/_TEST_router_swap_route_1route_3hop_wrapped_native_middle_test.gn @@ -5,7 +5,7 @@ import ( "std" "testing" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" pl "gno.land/r/demo/pool" pn "gno.land/r/demo/position" diff --git a/router/_TEST_/_TEST_router_swap_route_2route_2hop_test.gn b/router/_TEST_/_TEST_router_swap_route_2route_2hop_test.gn index b5a1c044..c0e5f824 100644 --- a/router/_TEST_/_TEST_router_swap_route_2route_2hop_test.gn +++ b/router/_TEST_/_TEST_router_swap_route_2route_2hop_test.gn @@ -5,7 +5,7 @@ import ( "std" "testing" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" pl "gno.land/r/demo/pool" pn "gno.land/r/demo/position" diff --git a/router/_TEST_/_TEST_routes_find_swap_path_test.gn b/router/_TEST_/_TEST_routes_find_swap_path_test.gn index 34cd8db3..99731e9d 100644 --- a/router/_TEST_/_TEST_routes_find_swap_path_test.gn +++ b/router/_TEST_/_TEST_routes_find_swap_path_test.gn @@ -4,8 +4,8 @@ import ( "std" "testing" - "gno.land/r/gnoswap/common" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/common" + "gno.land/r/demo/gnoswap/consts" pl "gno.land/r/demo/pool" pn "gno.land/r/demo/position" diff --git a/router/gno.mod b/router/gno.mod index 10ee5f7a..b2761fbc 100644 --- a/router/gno.mod +++ b/router/gno.mod @@ -8,6 +8,6 @@ require ( gno.land/p/demo/users v0.0.0-latest gno.land/r/demo/pool v0.0.0-latest gno.land/r/demo/wugnot v0.0.0-latest - gno.land/r/gnoswap/common v0.0.0-latest - gno.land/r/gnoswap/consts v0.0.0-latest + gno.land/r/demo/gnoswap/common v0.0.0-latest + gno.land/r/demo/gnoswap/consts v0.0.0-latest ) diff --git a/router/gno_helper.gno b/router/gno_helper.gno index 1e045bec..07de7335 100644 --- a/router/gno_helper.gno +++ b/router/gno_helper.gno @@ -3,7 +3,7 @@ package router import ( "std" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" ) func GetOrigPkgAddr() std.Address { diff --git a/router/router.gno b/router/router.gno index 833ee11a..40346094 100644 --- a/router/router.gno +++ b/router/router.gno @@ -7,8 +7,8 @@ import ( "gno.land/p/demo/ufmt" - "gno.land/r/gnoswap/common" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/common" + "gno.land/r/demo/gnoswap/consts" i256 "gno.land/p/demo/gnoswap/int256" u256 "gno.land/p/demo/gnoswap/uint256" diff --git a/router/swap_inner.gno b/router/swap_inner.gno index 265202aa..a659b567 100644 --- a/router/swap_inner.gno +++ b/router/swap_inner.gno @@ -7,7 +7,7 @@ import ( pl "gno.land/r/demo/pool" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" i256 "gno.land/p/demo/gnoswap/int256" u256 "gno.land/p/demo/gnoswap/uint256" @@ -81,7 +81,7 @@ func _swapDry( data.tokenIn, data.tokenOut, data.fee, - + zeroForOne, amountSpecified.ToString(), sqrtPriceLimitX96.ToString(), diff --git a/router/swap_multi.gno b/router/swap_multi.gno index d01675bf..a8760428 100644 --- a/router/swap_multi.gno +++ b/router/swap_multi.gno @@ -3,7 +3,7 @@ package router import ( "std" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" i256 "gno.land/p/demo/gnoswap/int256" u256 "gno.land/p/demo/gnoswap/uint256" diff --git a/router/token_register.gno b/router/token_register.gno index 24a17b14..c2591a2f 100644 --- a/router/token_register.gno +++ b/router/token_register.gno @@ -7,7 +7,7 @@ import ( pusers "gno.land/p/demo/users" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" ) type GRC20Interface interface { diff --git a/router/wrap_unwrap.gno b/router/wrap_unwrap.gno index b766ffa9..ffd3f7cc 100644 --- a/router/wrap_unwrap.gno +++ b/router/wrap_unwrap.gno @@ -6,7 +6,7 @@ import ( "gno.land/r/demo/wugnot" "gno.land/p/demo/ufmt" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" ) func wrap(ugnotAmount uint64) { diff --git a/staker/_RPC_api_incentive.gno b/staker/_RPC_api_incentive.gno index 00f7ffd7..a2833208 100644 --- a/staker/_RPC_api_incentive.gno +++ b/staker/_RPC_api_incentive.gno @@ -8,24 +8,30 @@ import ( "gno.land/p/demo/ufmt" pl "gno.land/r/demo/pool" -) -const INTERNAL_REWARD_TOKEN_PATH = "gno.land/r/demo/gns" + "gno.land/r/demo/gnoswap/consts" +) type RewardToken struct { PoolPath string `json:"poolPath"` RewardsTokenList []string `json:"rewardsTokenList"` } -type ApiIncentive struct { +type ApiExternalIncentive struct { PoolPath string `json:"poolPath"` RewardToken string `json:"rewardToken"` RewardAmount string `json:"rewardAmount"` StartTimestamp int64 `json:"startTimestamp"` EndTimestamp int64 `json:"endTimestamp"` + Active bool `json:"active"` Refundee string `json:"refundee"` } +type ApiInternalIncentive struct { + PoolPath string `json:"poolPath"` + Tier uint64 `json:"tier"` +} + func ApiGetRewardTokens() string { rewardTokens := []RewardToken{} @@ -36,7 +42,7 @@ func ApiGetRewardTokens() string { // HANDLE INTERNAL _, ok := poolTiers[poolPath] if ok { - thisPoolRewardTokens = append(thisPoolRewardTokens, INTERNAL_REWARD_TOKEN_PATH) + thisPoolRewardTokens = append(thisPoolRewardTokens, consts.GNS_PATH) } // HANDLE EXTERNAL @@ -79,11 +85,11 @@ func ApiGetRewardTokens() string { return string(b) } -func ApiGetIncentives() string { - apiIncentives := []ApiIncentive{} +func ApiGetExternalIncentives() string { + apiExternalIncentives := []ApiExternalIncentive{} for _, incentive := range incentives { - apiIncentives = append(apiIncentives, ApiIncentive{ + apiExternalIncentives = append(apiExternalIncentives, ApiExternalIncentive{ PoolPath: incentive.targetPoolPath, RewardToken: incentive.rewardToken, RewardAmount: incentive.rewardAmount.ToString(), @@ -101,13 +107,19 @@ func ApiGetIncentives() string { // RESPONSE (ARRAY) NODE responses := json.ArrayNode("", []*json.Node{}) - for _, incentive := range apiIncentives { + for _, incentive := range apiExternalIncentives { + active := false + if time.Now().Unix() >= incentive.StartTimestamp && time.Now().Unix() <= incentive.EndTimestamp { + active = true + } + _incentiveNode := json.ObjectNode("", map[string]*json.Node{ "poolPath": json.StringNode("poolPath", incentive.PoolPath), "rewardToken": json.StringNode("rewardToken", incentive.RewardToken), "rewardAmount": json.StringNode("rewardAmount", incentive.RewardAmount), "startTimestamp": json.NumberNode("startTimestamp", float64(incentive.StartTimestamp)), "endTimestamp": json.NumberNode("endTimestamp", float64(incentive.EndTimestamp)), + "active": json.BoolNode("active", active), "refundee": json.StringNode("refundee", incentive.Refundee), }) responses.AppendArray(_incentiveNode) @@ -121,7 +133,48 @@ func ApiGetIncentives() string { b, err := json.Marshal(node) if err != nil { - panic(ufmt.Sprintf("[STAKER] _RPC_api_stake.gno__ApiGetIncentives() || json marshal error: %s", err.Error())) + panic(ufmt.Sprintf("[STAKER] _RPC_api_stake.gno__ApiGetExternalIncentives() || json marshal error: %s", err.Error())) + } + + return string(b) +} + +func ApiGetInternalIncentives() string { + apiInternalIncentives := []ApiInternalIncentive{} + + for poolPath, tier := range poolTiers { + apiInternalIncentives = append(apiInternalIncentives, ApiInternalIncentive{ + PoolPath: poolPath, + Tier: tier, + }) + } + + // STAT NODE + _stat := json.ObjectNode("", map[string]*json.Node{ + "height": json.NumberNode("height", float64(std.GetHeight())), + "timestamp": json.NumberNode("timestamp", float64(time.Now().Unix())), + }) + + // RESPONSE (ARRAY) NODE + responses := json.ArrayNode("", []*json.Node{}) + for _, incentive := range apiInternalIncentives { + _incentiveNode := json.ObjectNode("", map[string]*json.Node{ + "poolPath": json.StringNode("poolPath", incentive.PoolPath), + "rewardToken": json.StringNode("rewardToken", consts.GNS_PATH), + "tier": json.NumberNode("tier", float64(incentive.Tier)), + }) + responses.AppendArray(_incentiveNode) + } + + // RETURN + node := json.ObjectNode("", map[string]*json.Node{ + "stat": _stat, + "response": responses, + }) + + b, err := json.Marshal(node) + if err != nil { + panic(ufmt.Sprintf("[STAKER] _RPC_api_stake.gno__ApiGetInternalIncentives() || json marshal error: %s", err.Error())) } return string(b) diff --git a/staker/_RPC_api_stake.gno b/staker/_RPC_api_stake.gno index 3d7e8b4a..6a83e01e 100644 --- a/staker/_RPC_api_stake.gno +++ b/staker/_RPC_api_stake.gno @@ -8,6 +8,8 @@ import ( "gno.land/p/demo/ufmt" u256 "gno.land/p/demo/gnoswap/uint256" + + "gno.land/r/demo/gnoswap/consts" ) type LpTokenReward struct { @@ -63,7 +65,7 @@ func ApiGetRewards() string { rewards = append(rewards, Reward{ IncentiveType: "INTERNAL", TargetPoolPath: deposit.targetPoolPath, - RewardTokenPath: INTERNAL_REWARD_TOKEN_PATH, + RewardTokenPath: consts.GNS_PATH, RewardTokenAmount: internalGNS.ToString(), }) } diff --git a/staker/_TEST_/_TEST_0_INIT_TOKEN_REGISTER_test.gno b/staker/_TEST_/_TEST_0_INIT_TOKEN_REGISTER_test.gno index 5b9ba97f..f181db81 100644 --- a/staker/_TEST_/_TEST_0_INIT_TOKEN_REGISTER_test.gno +++ b/staker/_TEST_/_TEST_0_INIT_TOKEN_REGISTER_test.gno @@ -17,7 +17,7 @@ import ( "gno.land/r/demo/gns" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" pusers "gno.land/p/demo/users" diff --git a/staker/_TEST_/_TEST_0_INIT_VARIABLE_AND_HELPER_test.gno b/staker/_TEST_/_TEST_0_INIT_VARIABLE_AND_HELPER_test.gno index 479b8f84..7783d719 100644 --- a/staker/_TEST_/_TEST_0_INIT_VARIABLE_AND_HELPER_test.gno +++ b/staker/_TEST_/_TEST_0_INIT_VARIABLE_AND_HELPER_test.gno @@ -4,7 +4,7 @@ import ( "std" "testing" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" ) var ( diff --git a/staker/_TEST_/_TEST_staker_collect_reward_test.gn b/staker/_TEST_/_TEST_staker_collect_reward_test.gn index e7be8c6b..1d7ad6fb 100644 --- a/staker/_TEST_/_TEST_staker_collect_reward_test.gn +++ b/staker/_TEST_/_TEST_staker_collect_reward_test.gn @@ -4,7 +4,7 @@ import ( "std" "testing" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" pl "gno.land/r/demo/pool" pn "gno.land/r/demo/position" diff --git a/staker/_TEST_/_TEST_staker_get_test.gn b/staker/_TEST_/_TEST_staker_get_test.gn index 4c8de4c3..ea758b80 100644 --- a/staker/_TEST_/_TEST_staker_get_test.gn +++ b/staker/_TEST_/_TEST_staker_get_test.gn @@ -4,7 +4,7 @@ import ( "std" "testing" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" pl "gno.land/r/demo/pool" pn "gno.land/r/demo/position" diff --git a/staker/_TEST_/_TEST_staker_internal_external_test.gn b/staker/_TEST_/_TEST_staker_internal_external_test.gn index 0ea2650f..2c059805 100644 --- a/staker/_TEST_/_TEST_staker_internal_external_test.gn +++ b/staker/_TEST_/_TEST_staker_internal_external_test.gn @@ -4,7 +4,7 @@ import ( "std" "testing" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" pl "gno.land/r/demo/pool" pn "gno.land/r/demo/position" diff --git a/staker/_TEST_/_TEST_staker_manage_pool_tiers_test.gn b/staker/_TEST_/_TEST_staker_manage_pool_tiers_test.gn index 5b067a08..febdbe78 100644 --- a/staker/_TEST_/_TEST_staker_manage_pool_tiers_test.gn +++ b/staker/_TEST_/_TEST_staker_manage_pool_tiers_test.gn @@ -6,7 +6,7 @@ import ( pl "gno.land/r/demo/pool" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" "gno.land/r/demo/gns" ) diff --git a/staker/_TEST_/_TEST_staker_mint_and_stake_test.gn b/staker/_TEST_/_TEST_staker_mint_and_stake_test.gn index 55fed9f1..ed19a6e0 100644 --- a/staker/_TEST_/_TEST_staker_mint_and_stake_test.gn +++ b/staker/_TEST_/_TEST_staker_mint_and_stake_test.gn @@ -12,7 +12,7 @@ import ( "gno.land/r/demo/gns" "gno.land/r/demo/qux" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" ) func init() { diff --git a/staker/_TEST_/_TEST_staker_one_external_native_test.gn b/staker/_TEST_/_TEST_staker_one_external_native_test.gn index 777fb5a7..d083bacd 100644 --- a/staker/_TEST_/_TEST_staker_one_external_native_test.gn +++ b/staker/_TEST_/_TEST_staker_one_external_native_test.gn @@ -14,7 +14,7 @@ import ( "gno.land/r/demo/gnft" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" ) func init() { diff --git a/staker/_TEST_/_TEST_staker_one_external_test.gn b/staker/_TEST_/_TEST_staker_one_external_test.gn index 6b75f9b4..f4ec7ca4 100644 --- a/staker/_TEST_/_TEST_staker_one_external_test.gn +++ b/staker/_TEST_/_TEST_staker_one_external_test.gn @@ -16,7 +16,7 @@ import ( "gno.land/r/demo/gnft" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" ) func init() { diff --git a/staker/_TEST_/_TEST_staker_one_increase_external_test.gn b/staker/_TEST_/_TEST_staker_one_increase_external_test.gn index ca219c8f..a4934530 100644 --- a/staker/_TEST_/_TEST_staker_one_increase_external_test.gn +++ b/staker/_TEST_/_TEST_staker_one_increase_external_test.gn @@ -15,7 +15,7 @@ import ( "gno.land/r/demo/obl" "gno.land/r/demo/gnft" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" ) func init() { diff --git a/staker/_TEST_/_TEST_staker_rpc_get_test.gn b/staker/_TEST_/_TEST_staker_rpc_get_test.gn index c2e7f854..0b1396b0 100644 --- a/staker/_TEST_/_TEST_staker_rpc_get_test.gn +++ b/staker/_TEST_/_TEST_staker_rpc_get_test.gn @@ -15,7 +15,7 @@ import ( "gno.land/r/demo/gnft" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" ) func init() { diff --git a/staker/gno.mod b/staker/gno.mod index b839c154..ffd0fbfc 100644 --- a/staker/gno.mod +++ b/staker/gno.mod @@ -11,6 +11,6 @@ require ( gno.land/r/demo/gov v0.0.0-latest gno.land/r/demo/pool v0.0.0-latest gno.land/r/demo/position v0.0.0-latest - gno.land/r/gnoswap/common v0.0.0-latest - gno.land/r/gnoswap/consts v0.0.0-latest + gno.land/r/demo/gnoswap/common v0.0.0-latest + gno.land/r/demo/gnoswap/consts v0.0.0-latest ) diff --git a/staker/gno_helper.gno b/staker/gno_helper.gno index ff807a00..54df7ae9 100644 --- a/staker/gno_helper.gno +++ b/staker/gno_helper.gno @@ -3,7 +3,7 @@ package staker import ( "std" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" ) func GetOrigPkgAddr() std.Address { diff --git a/staker/manage_pool_tiers.gno b/staker/manage_pool_tiers.gno index b9e22ab6..50302405 100644 --- a/staker/manage_pool_tiers.gno +++ b/staker/manage_pool_tiers.gno @@ -7,7 +7,7 @@ import ( "gno.land/p/demo/ufmt" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" ) // GetPoolWithTiers returns list of pools with their tiers diff --git a/staker/mint_stake.gno b/staker/mint_stake.gno index f1885602..394c83ba 100644 --- a/staker/mint_stake.gno +++ b/staker/mint_stake.gno @@ -3,7 +3,7 @@ package staker import ( pn "gno.land/r/demo/position" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" ) // MintAndStake mints and stakes the LP token diff --git a/staker/reward_fee.gno b/staker/reward_fee.gno index c6375a2a..50625660 100644 --- a/staker/reward_fee.gno +++ b/staker/reward_fee.gno @@ -1,8 +1,8 @@ package staker import ( - "gno.land/r/gnoswap/common" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/common" + "gno.land/r/demo/gnoswap/consts" "gno.land/p/demo/ufmt" diff --git a/staker/reward_math.gno b/staker/reward_math.gno index 4f31f9ad..28cdeda1 100644 --- a/staker/reward_math.gno +++ b/staker/reward_math.gno @@ -4,7 +4,7 @@ import ( "std" "time" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" "gno.land/p/demo/ufmt" diff --git a/staker/staker.gno b/staker/staker.gno index 4e9172a5..e3938d16 100644 --- a/staker/staker.gno +++ b/staker/staker.gno @@ -5,12 +5,12 @@ import ( "time" "gno.land/p/demo/ufmt" - "gno.land/r/gnoswap/common" + "gno.land/r/demo/gnoswap/common" "gno.land/r/demo/gnft" "gno.land/r/demo/gns" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" pl "gno.land/r/demo/pool" pn "gno.land/r/demo/position" @@ -296,7 +296,7 @@ func checkStartTime(startTimestamp int64) { isMidnight := hour == 0 && minute == 0 && second == 0 if !isMidnight { - panic(ufmt.Sprintf("[STAKER] staker.gno__checkStartTime() || startTime(%s) must be midnight of the day", startTime.String())) + panic(ufmt.Sprintf("[STAKER] staker.gno__checkStartTime() || startTime(%d = %s) must be midnight of the day", startTimestamp, startTime.String())) } } diff --git a/staker/token_register.gno b/staker/token_register.gno index 41d79751..179647b2 100644 --- a/staker/token_register.gno +++ b/staker/token_register.gno @@ -6,7 +6,7 @@ import ( "gno.land/p/demo/ufmt" pusers "gno.land/p/demo/users" - "gno.land/r/gnoswap/consts" + "gno.land/r/demo/gnoswap/consts" ) type GRC20Interface interface {