-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…stead-of-makefile GSW-980 test: apply txtar instead of makefile
- Loading branch information
Showing
170 changed files
with
4,961 additions
and
5,749 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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,215 @@ | ||
# GNOSWAP TXTAR TESTING | ||
|
||
loadpkg gno.land/r/demo/users | ||
loadpkg gno.land/p/demo/ufmt | ||
|
||
loadpkg gno.land/r/demo/wugnot | ||
loadpkg gno.land/r/demo/foo20 | ||
|
||
loadpkg gno.land/r/gnoswap/consts | ||
|
||
loadpkg gno.land/p/demo/uint256 | ||
loadpkg gno.land/p/demo/int256 | ||
|
||
loadpkg gno.land/r/gnoswap/common | ||
loadpkg gno.land/r/demo/gns | ||
loadpkg gno.land/r/demo/obl | ||
loadpkg gno.land/r/demo/gnft | ||
loadpkg gno.land/r/demo/gov | ||
loadpkg gno.land/r/demo/pool | ||
loadpkg gno.land/r/demo/gov | ||
loadpkg gno.land/r/demo/pool | ||
loadpkg gno.land/r/demo/position | ||
loadpkg gno.land/r/demo/router | ||
loadpkg gno.land/r/demo/staker | ||
|
||
## add user | ||
adduser user | ||
|
||
## start a new node | ||
gnoland start | ||
|
||
## foo20_register | ||
gnokey maketx addpkg -pkgdir $WORK/foo20_register -pkgpath gno.land/r/demo/foo20_register -gas-fee 1ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | ||
|
||
## wugnot_register | ||
gnokey maketx addpkg -pkgdir $WORK/wugnot_register -pkgpath gno.land/r/demo/wugnot_register -gas-fee 1ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | ||
|
||
## gns_register | ||
gnokey maketx addpkg -pkgdir $WORK/gns_register -pkgpath gno.land/r/demo/gns_register -gas-fee 1ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | ||
|
||
# user faucet // user | ||
gnokey maketx call -pkgpath gno.land/r/demo/gns -func Faucet -gas-fee 1ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test user | ||
gnokey maketx call -pkgpath gno.land/r/demo/gns -func Faucet -gas-fee 1ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test user | ||
gnokey maketx call -pkgpath gno.land/r/demo/gns -func Faucet -gas-fee 1ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test user | ||
gnokey maketx call -pkgpath gno.land/r/demo/gns -func Faucet -gas-fee 1ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test user | ||
gnokey maketx call -pkgpath gno.land/r/demo/gns -func Faucet -gas-fee 1ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test user | ||
gnokey maketx call -pkgpath gno.land/r/demo/foo20 -func Faucet -gas-fee 1ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test user | ||
|
||
# pool creation fee approve // user | ||
gnokey maketx call -pkgpath gno.land/r/demo/gns -func Approve -args "g15z32w7txv6lw259xzhzzmwtwmcjjc0m6dqzh6f" -args "500000000" -gas-fee 1ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test user | ||
|
||
# pool create (foo20:gns) // user | ||
gnokey maketx call -pkgpath gno.land/r/demo/pool -func CreatePool -args "gno.land/r/demo/foo20" -args "gno.land/r/demo/gns" -args 3000 -args 79228162514264337593543950337 -gas-fee 1ugnot -gas-wanted 5000000 -broadcast -chainid=tendermint_test user | ||
|
||
# approve foo20 | ||
gnokey maketx call -pkgpath gno.land/r/demo/foo20 -func Approve -args "g15z32w7txv6lw259xzhzzmwtwmcjjc0m6dqzh6f" -args "5000000" -gas-fee 1ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | ||
|
||
# approve gns | ||
gnokey maketx call -pkgpath gno.land/r/demo/gns -func Approve -args "g15z32w7txv6lw259xzhzzmwtwmcjjc0m6dqzh6f" -args "5000000" -gas-fee 1ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | ||
|
||
# faucet mint tokens | ||
gnokey maketx call -pkgpath gno.land/r/demo/foo20 -func Faucet -gas-fee 1ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | ||
gnokey maketx call -pkgpath gno.land/r/demo/gns -func Faucet -gas-fee 1ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | ||
|
||
# position mint | ||
gnokey maketx call -pkgpath gno.land/r/demo/position -func Mint -args "gno.land/r/demo/foo20" -args "gno.land/r/demo/gns" -args 3000 -args -1020 -args 1020 -args 5000000 -args 5000000 -args 0 -args 0 -args 9876543210 -args "g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5" -gas-fee 1ugnot -gas-wanted 50000000 -broadcast -chainid=tendermint_test test1 | ||
|
||
# approve additional mint amount | ||
gnokey maketx call -pkgpath gno.land/r/demo/foo20 -func Approve -args "g15z32w7txv6lw259xzhzzmwtwmcjjc0m6dqzh6f" -args "1000000" -gas-fee 1ugnot -gas-wanted 50000000 -broadcast -chainid=tendermint_test test1 | ||
gnokey maketx call -pkgpath gno.land/r/demo/gns -func Approve -args "g15z32w7txv6lw259xzhzzmwtwmcjjc0m6dqzh6f" -args "1000000" -gas-fee 1ugnot -gas-wanted 50000000 -broadcast -chainid=tendermint_test test1 | ||
|
||
# increase liquidity | ||
gnokey maketx call -pkgpath gno.land/r/demo/position -func IncreaseLiquidity -args 1 -args "1000000" -args "1000000" -args "0" -args "0" -args 9876543210 -gas-fee 1ugnot -gas-wanted 50000000 -broadcast -chainid=tendermint_test test1 | ||
|
||
# collect fee after mint | ||
gnokey maketx call -pkgpath gno.land/r/demo/position -func CollectFee -args 1 -gas-fee 1ugnot -gas-wanted 50000000 -broadcast -chainid=tendermint_test test1 | ||
|
||
# decrease liquidity | ||
gnokey maketx call -pkgpath gno.land/r/demo/position -func DecreaseLiquidity -args 1 -args 10 -args "0" -args "0" -args 9876543210 -args false -gas-fee 1ugnot -gas-wanted 50000000 -broadcast -chainid=tendermint_test test1 | ||
|
||
# approve nft to staker ( for staking ) | ||
gnokey maketx call -pkgpath "gno.land/r/demo/gnft" -func Approve -args "g1puv9dz470prjshjm9qyg25dyfvrgph2kvjph68" -args "1" -gas-fee 1ugnot -gas-wanted 50000000 -broadcast -chainid=tendermint_test test1 | ||
# stake token | ||
gnokey maketx call -pkgpath gno.land/r/demo/staker -func StakeToken -args 1 -gas-fee 1ugnot -gas-wanted 50000000 -broadcast -chainid=tendermint_test test1 | ||
|
||
# collect fee after stake | ||
gnokey maketx call -pkgpath gno.land/r/demo/position -func CollectFee -args 1 -gas-fee 1ugnot -gas-wanted 50000000 -broadcast -chainid=tendermint_test test1 | ||
|
||
# approve input token to pool for swap // user | ||
gnokey maketx call -pkgpath "gno.land/r/demo/foo20" -func Approve -args "g15z32w7txv6lw259xzhzzmwtwmcjjc0m6dqzh6f" -args 1000000 -gas-fee 1ugnot -gas-wanted 50000000 -broadcast -chainid=tendermint_test user | ||
# approve output token to router for fee // user | ||
gnokey maketx call -pkgpath "gno.land/r/demo/gns" -func Approve -args "g1pjtpgjpsn4hjfv2n4mpz8cczdn32jkpsqwxuav" -args 18446744073709551615 -gas-fee 1ugnot -gas-wanted 50000000 -broadcast -chainid=tendermint_test user | ||
# swap foo20 to gns // user | ||
gnokey maketx call -pkgpath "gno.land/r/demo/router" -func SwapRoute -args "gno.land/r/demo/foo20" -args "gno.land/r/demo/gns" -args 1000000 -args "EXACT_IN" -args "gno.land/r/demo/foo20:gno.land/r/demo/gns:3000" -args "100" -args 1 -gas-fee 1ugnot -gas-wanted 50000000 -broadcast -chainid=tendermint_test user | ||
|
||
# approve fee of fee | ||
gnokey maketx call -pkgpath gno.land/r/demo/foo20 -func Approve -args "g15z32w7txv6lw259xzhzzmwtwmcjjc0m6dqzh6f" -args "500000000" -gas-fee 1ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test1 | ||
|
||
# collect fee after swap | ||
gnokey maketx call -pkgpath gno.land/r/demo/position -func CollectFee -args 1 -gas-fee 1ugnot -gas-wanted 50000000 -broadcast -chainid=tendermint_test test1 | ||
|
||
# unstake token | ||
gnokey maketx call -pkgpath gno.land/r/demo/staker -func UnstakeToken -args 1 -gas-fee 1ugnot -gas-wanted 50000000 -broadcast -chainid=tendermint_test test1 | ||
|
||
|
||
-- foo20_register/foo20_register.gno -- | ||
package token_register | ||
|
||
import ( | ||
token "gno.land/r/demo/foo20" | ||
|
||
pusers "gno.land/p/demo/users" | ||
|
||
pl "gno.land/r/demo/pool" | ||
rr "gno.land/r/demo/router" | ||
sr "gno.land/r/demo/staker" | ||
) | ||
|
||
type NewToken struct{} | ||
|
||
func (NewToken) Transfer() func(to pusers.AddressOrName, amount uint64) { | ||
return token.Transfer | ||
} | ||
|
||
func (NewToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { | ||
return token.TransferFrom | ||
} | ||
|
||
func (NewToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { | ||
return token.BalanceOf | ||
} | ||
|
||
func (NewToken) Approve() func(spender pusers.AddressOrName, amount uint64) { | ||
return token.Approve | ||
} | ||
|
||
func init() { | ||
pl.RegisterGRC20Interface("gno.land/r/demo/foo20", NewToken{}) | ||
rr.RegisterGRC20Interface("gno.land/r/demo/foo20", NewToken{}) | ||
sr.RegisterGRC20Interface("gno.land/r/demo/foo20", NewToken{}) | ||
} | ||
|
||
-- wugnot_register/wugnot_register.gno -- | ||
package token_register | ||
|
||
import ( | ||
token "gno.land/r/demo/wugnot" | ||
|
||
pusers "gno.land/p/demo/users" | ||
|
||
pl "gno.land/r/demo/pool" | ||
rr "gno.land/r/demo/router" | ||
sr "gno.land/r/demo/staker" | ||
) | ||
|
||
type NewToken struct{} | ||
|
||
func (NewToken) Transfer() func(to pusers.AddressOrName, amount uint64) { | ||
return token.Transfer | ||
} | ||
|
||
func (NewToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { | ||
return token.TransferFrom | ||
} | ||
|
||
func (NewToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { | ||
return token.BalanceOf | ||
} | ||
|
||
func (NewToken) Approve() func(spender pusers.AddressOrName, amount uint64) { | ||
return token.Approve | ||
} | ||
|
||
func init() { | ||
pl.RegisterGRC20Interface("gno.land/r/demo/wugnot", NewToken{}) | ||
rr.RegisterGRC20Interface("gno.land/r/demo/wugnot", NewToken{}) | ||
sr.RegisterGRC20Interface("gno.land/r/demo/wugnot", NewToken{}) | ||
} | ||
|
||
-- gns_register/gns_register.gno -- | ||
package token_register | ||
|
||
import ( | ||
token "gno.land/r/demo/gns" | ||
|
||
pusers "gno.land/p/demo/users" | ||
|
||
pl "gno.land/r/demo/pool" | ||
rr "gno.land/r/demo/router" | ||
sr "gno.land/r/demo/staker" | ||
) | ||
|
||
type NewToken struct{} | ||
|
||
func (NewToken) Transfer() func(to pusers.AddressOrName, amount uint64) { | ||
return token.Transfer | ||
} | ||
|
||
func (NewToken) TransferFrom() func(from, to pusers.AddressOrName, amount uint64) { | ||
return token.TransferFrom | ||
} | ||
|
||
func (NewToken) BalanceOf() func(owner pusers.AddressOrName) uint64 { | ||
return token.BalanceOf | ||
} | ||
|
||
func (NewToken) Approve() func(spender pusers.AddressOrName, amount uint64) { | ||
return token.Approve | ||
} | ||
|
||
func init() { | ||
pl.RegisterGRC20Interface("gno.land/r/demo/gns", NewToken{}) | ||
rr.RegisterGRC20Interface("gno.land/r/demo/gns", NewToken{}) | ||
sr.RegisterGRC20Interface("gno.land/r/demo/gns", NewToken{}) | ||
} |
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 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Trịnh Đức Bảo Linh(Kevin) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,4 @@ | ||
# Int256 | ||
|
||
Wrap uint256 to perform with negative numbers. | ||
|
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,20 @@ | ||
package int256 | ||
|
||
import ( | ||
"gno.land/p/demo/uint256" | ||
) | ||
|
||
// Abs returns |z| | ||
func (z *Int) Abs() *uint256.Uint { | ||
return z.abs.Clone() | ||
} | ||
|
||
// AbsGt returns true if |z| > x, where x is a uint256 | ||
func (z *Int) AbsGt(x *uint256.Uint) bool { | ||
return z.abs.Gt(x) | ||
} | ||
|
||
// AbsLt returns true if |z| < x, where x is a uint256 | ||
func (z *Int) AbsLt(x *uint256.Uint) bool { | ||
return z.abs.Lt(x) | ||
} |
Oops, something went wrong.