util

package
v0.0.0-...-24e5678 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2023 License: LGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Zero       = big.NewInt(0)
	ZeroAmount = amount.NewAmount(0, 0)
	MaxUint256 = ToAmount(Sub(Exp(big.NewInt(2), big.NewInt(256)), big.NewInt(1)))

	ZeroAddress = common.Address{}
)

Functions

func Abs

func Abs(a *big.Int) *big.Int

func Accounts

func Accounts() (*key.MemoryKey, common.Address, []key.Key, []common.Address, error)

func Add

func Add(a, b *big.Int) *big.Int

func AddBlock

func AddBlock(cn *chain.Chain, ctx *types.Context, tx *types.Transaction, signer key.Key) (hash.Hash256, error)

func AddC

func AddC(a *big.Int, b int64) *big.Int

func Approx

func Approx(a, b, _precision float64) bool

func Chain

func Chain(idx int, ctx *types.Context, adm common.Address) (*chain.Chain, error)

func Clone

func Clone(a *big.Int) *big.Int

func CloneAmountSlice

func CloneAmountSlice(input []*amount.Amount) []*amount.Amount

func CloneSlice

func CloneSlice(input []*big.Int) []*big.Int

func CubicFunc

func CubicFunc(a, b, c, d, x float64) float64

func CubicRoot

func CubicRoot(a, b, c, d float64) (float64, error)

3차방정식 일반해 :

func DeployTokens

func DeployTokens(ctx *types.Context, classId uint64, size uint8, deployer common.Address) []common.Address

func Div

func Div(a, b *big.Int) *big.Int

func DivC

func DivC(a *big.Int, b int64) *big.Int

func ExType

func ExType(cc *types.ContractContext, cont common.Address) (uint8, error)

func Exec

func Exec(ctx *types.Context, user common.Address, contAddr common.Address, methodName string, args []interface{}) ([]interface{}, error)

func Exp

func Exp(a, b *big.Int) *big.Int

func FeeAddress

func FeeAddress(cc *types.ContractContext, cont, from common.Address) (uint64, error)

func GPrintf

func GPrintf(format string, v ...interface{})

func GPrintln

func GPrintln(v ...interface{})

func GPrintlnT

func GPrintlnT(title string, v ...interface{})

func GetCC

func GetCC(ctx *types.Context, contAddr common.Address, user common.Address) (*types.ContractContext, error)

func GetDy

func GetDy(cc *types.ContractContext, cont common.Address, in, out uint8, dx *big.Int, from common.Address) (*big.Int, error)

func GetMintAdminFee

func GetMintAdminFee(cc *types.ContractContext, cont common.Address, _reserve0, _reserve1 *big.Int) (*big.Int, error)

func IsPlus

func IsPlus(a *big.Int) bool

func MakeAmountSlice

func MakeAmountSlice(size uint8) []*amount.Amount

func MakeSlice

func MakeSlice(size uint8) []*big.Int

func MaxInArray

func MaxInArray(a []*big.Int) (int, *big.Int)

func Min

func Min(a, b *big.Int) *big.Int

func MinInArray

func MinInArray(a []*big.Int) (int, *big.Int)

func MintedAdminBalance

func MintedAdminBalance(cc *types.ContractContext, cont common.Address) (*big.Int, error)

func Mul

func Mul(a, b *big.Int) *big.Int

func MulC

func MulC(a *big.Int, b int64) *big.Int

func MulDiv

func MulDiv(a, b, denominator *big.Int) *big.Int

func MulDivC

func MulDivC(a, b *big.Int, denominator int64) *big.Int

func MulDivCC

func MulDivCC(a *big.Int, b, denominator int64) *big.Int

func MulF

func MulF(a *big.Int, b float64) (*big.Int, error)

func Newtonian

func Newtonian(a, b, c, d, x0 float64) (float64, error)

3차방정식 해 - Newtonian Method x0 initial

func Owner

func Pow10

func Pow10(a int) *big.Int

func Printf

func Printf(format string, v ...interface{})

func Println

func Println(v ...interface{})

func PrintlnT

func PrintlnT(title string, v ...interface{})

func RemoveChain

func RemoveChain(idx int) (string, error)

AfterSuite 에서 일괄 삭제

func SafeTransfer

func SafeTransfer(cc *types.ContractContext, token, to common.Address, am *big.Int) error

token.Transfer(to,Amount)

func SafeTransferFrom

func SafeTransferFrom(cc *types.ContractContext, token, from, to common.Address, am *big.Int) error

token.TansferFrom(from, to, Amount)

func Sleep

func Sleep(cn *chain.Chain, ctx *types.Context, tx *types.Transaction, seconds uint64, signer key.Key) (*types.Context, error)

func Sqrt

func Sqrt(a *big.Int) *big.Int

func Sub

func Sub(a, b *big.Int) *big.Int

func SubC

func SubC(a *big.Int, b int64) *big.Int

func Sum

func Sum(a []*big.Int) *big.Int

func ToAmount

func ToAmount(b *big.Int) *amount.Amount

func ToAmounts

func ToAmounts(b []*big.Int) []*amount.Amount

func ToBigInt

func ToBigInt(a float64) (*big.Int, error)

func ToBigInts

func ToBigInts(b []*amount.Amount) []*big.Int

func ToFloat64

func ToFloat64(a *big.Int) float64

max uint256 = 115792089237316195423570985008687907853269984665640564039457584007913129639935 ~ 1.1e+77 max float64 = 1.7976931348623157e+308 max float32 = 3.4028234663852886e+38

func TokenAllowance

func TokenAllowance(cc *types.ContractContext, token, owner, spender common.Address) (*big.Int, error)

token.BalanceOf(from)

func TokenApprove

func TokenApprove(cc *types.ContractContext, token, to common.Address, am *big.Int) error

token.Apporve(to,Amount)

func TokenBalanceOf

func TokenBalanceOf(cc *types.ContractContext, token, from common.Address) (*big.Int, error)

token.BalanceOf(from)

func TokenIndex

func TokenIndex(cc *types.ContractContext, cont, _token common.Address) (uint8, error)

func TokenTotalSupply

func TokenTotalSupply(cc *types.ContractContext, token common.Address) (*big.Int, error)

token.TotalSupply()

func ViewAddress

func ViewAddress(ctx *types.Context, contAddr common.Address, methodName string) (common.Address, error)

func ViewAmount

func ViewAmount(ctx *types.Context, contAddr common.Address, methodName string) (*amount.Amount, error)

func WhoIs

func WhoIs(addr common.Address) string

admin 0xDC5b20847F43d67928F49Cd4f85D696b5A7617B5 alice 0xcca18d832a5C4fA1235e6c1cEa7E4645cca00395 bob 0x678658741a8A61B92EF6B5700397a83C92729d60 charlie 0x632B713ABAA2cBC9ef18B61678c5d65027a4d2f0 eve 0xf3dA6Ce653D680EBAcC26873d38F91aCf33C56Ac factory 0xD9840365E3C375fF1B8c20fFC69EA8B1553B0C8d router 0x989f4aB3c2A695Ee43c67077927c3ca12e1e6a7b pair 0xc65bc0ED7dd73Aa66A8C0f7049e861D5CB7eb0B0 swap 0x0000000000000000000000000000000000000000 token0 0xa2C894E874E9A0ed61Ad4f35CBEdFA861c49c7BF token1 0xe2E3a5952D2Ac311017280601F8354280394946e stableToken0 0x83F875dBa87a5D2387B73222a19259A3a31a1495 stableToken1 0xC59B7d36115849B750b45E498bbE500F0282193A stableToken2 0x5C0F85555eCAFc734BCE666D0eCe5E902A26DC4c

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL