chainmanager

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainManager

type ChainManager struct {
	// contains filtered or unexported fields
}

ChainManager manipulates chains

func New

func New(env *solo.Solo) *ChainManager

New instantiates a chain manager

func (*ChainManager) ChangeChainFees

func (chainManager *ChainManager) ChangeChainFees(authorizedSigScheme signaturescheme.SignatureScheme, chain *solo.Chain, newChainOwnerFee int64)

ChangeChainFees changes chains owner fee as 'authorized signature' scheme. Anyone with an authorized signature can use this. See 'GrantDeployPermission' on how to (de)authorize chain changes. Fails test on error.

func (*ChainManager) DeployWasmContract

func (chainManager *ChainManager) DeployWasmContract(chain *solo.Chain, contractOriginator signaturescheme.SignatureScheme, contractName string, contractWasmFilePath string)

DeployWasmContract uploads and deploys 'constract wasm file'

func (*ChainManager) Dispose

func (chainManager *ChainManager) Dispose()

Dispose implements Disposable for ChainManager

func (*ChainManager) GetContractRecord

func (chainManager *ChainManager) GetContractRecord(chain *solo.Chain, contractName string) (*root.ContractRecord, error)

GetContractRecord searches 'chain' for 'contract record' by name

func (*ChainManager) GrantDeployPermission

func (chainManager *ChainManager) GrantDeployPermission(chain *solo.Chain, authorizedAgentID coretypes.AgentID)

GrantDeployPermission gives permission, as the chain originator, to 'agentID' to deploy SCs into the specified chain. Fails test on error.

func (*ChainManager) MustGetContractID

func (chainManager *ChainManager) MustGetContractID(chain *solo.Chain, contractName string) coretypes.ContractID

MustGetContractID ensures 'chain' contains 'contract' and returns its ContractID. Fails test on error.

func (*ChainManager) MustGetContractRecord

func (chainManager *ChainManager) MustGetContractRecord(chain *solo.Chain, contractName string) *root.ContractRecord

MustGetContractRecord searches 'chain' for 'contract record' by name. Fails test on error.

func (*ChainManager) MustTransferBetweenChains

func (chainManager *ChainManager) MustTransferBetweenChains(depositorSigScheme signaturescheme.SignatureScheme, sourceChain *solo.Chain, color balance.Color, transferAmount int64,
	destinationChain *solo.Chain, receiverSigScheme signaturescheme.SignatureScheme)

MustTransferBetweenChains makes transfer of 'amount' of 'color' from the depositors account in 'sourceChain' to the receivers account in 'destinationChain'. Transfers to 'depositor' if no receiver is defined. Fails test on error. Important: Due to the current logic in the accounts contract (from IOTA Foundation), all tokens of 'depositor' are withdrawn from 'sourceChain' to his address in the value tangle.

func (*ChainManager) MustTransferToValueTangleToSelf

func (chainManager *ChainManager) MustTransferToValueTangleToSelf(depositorSigScheme signaturescheme.SignatureScheme, chain *solo.Chain, color balance.Color, transferAmount int64)

MustTransferToValueTangleToSelf makes transfer of 'amount' of 'color' from the depositors account in 'chain' to the depositors address in the value tangle. Fails test on error. Important: Due to the current logic in the accounts contract (from IOTA Foundation), all tokens of 'depositor' are withdrawn from 'chain' to his address in the value tangle.

func (*ChainManager) MustTransferWithinChain

func (chainManager *ChainManager) MustTransferWithinChain(depositorSigScheme signaturescheme.SignatureScheme, chain *solo.Chain, color balance.Color, transferAmount int64,
	receiverSigScheme signaturescheme.SignatureScheme)

MustTransferWithinChain makes transfer of 'amount' of 'color' from the depositors account in 'chain' to the receivers account in the same chain. Nothing is transfered if no receiver is defined. Fails test on error. Important: Due to the current logic in the accounts contract (from IOTA Foundation), all tokens are withdrawn from 'sourceChain', not only the specified color and amount.

func (*ChainManager) NewChain

func (chainManager *ChainManager) NewChain(chainOriginator signaturescheme.SignatureScheme, chainName string, validatorFeeTarget ...coretypes.AgentID) *solo.Chain

NewChain instantiates a new chain

If 'chainOriginator' is nil, a new SignatureScheme is generated and 1337 iota tokens are assigned to it (amount of funds is defined in utxodb.RequestFundsAmount)
If 'validatorFeeTarget' is skipped, it is assumed equal to the chainOriginators AgentID

Fails test on error.

func (*ChainManager) NewChainAndDeployWasmContract

func (chainManager *ChainManager) NewChainAndDeployWasmContract(chainOriginator signaturescheme.SignatureScheme, chainName string,
	contractOriginator signaturescheme.SignatureScheme, contractName string, contractWasmFilePath string,
	validatorFeeTarget ...coretypes.AgentID) (*solo.Chain, *root.ContractRecord)

NewChainAndDeployWasmContract calls NewChain and then DeployWasmContract

func (*ChainManager) RequireBalance

func (chainManager *ChainManager) RequireBalance(sigScheme signaturescheme.SignatureScheme, chain *solo.Chain, color balance.Color, expectedBalance int64)

RequireBalance verifies if the signature scheme has the expected balance of 'color' in 'chain'. Fails test if balance is not equal to expectedBalance.

func (*ChainManager) RevokeDeployPermission

func (chainManager *ChainManager) RevokeDeployPermission(chain *solo.Chain, authorizedAgentID coretypes.AgentID)

RevokeDeployPermission revokes permission, as the chain originator, from 'agentIDs' to deploy SCs into 'chain'. Fails test on error.

func (*ChainManager) TransferBetweenChains

func (chainManager *ChainManager) TransferBetweenChains(depositorSigScheme signaturescheme.SignatureScheme, sourceChain *solo.Chain, color balance.Color, transferAmount int64,
	destinationChain *solo.Chain, receiverSigScheme signaturescheme.SignatureScheme) error

TransferBetweenChains makes transfer of 'amount' of 'color' from the depositors account in 'sourceChain' to the receivers account in 'destinationChain'. Transfers to 'depositor' if no receiver is defined. Important: Due to the current logic in the accounts contract (from IOTA Foundation), all tokens of 'depositor' are withdrawn from 'sourceChain' to his address in the value tangle.

func (*ChainManager) TransferToValueTangleToSelf

func (chainManager *ChainManager) TransferToValueTangleToSelf(depositorSigScheme signaturescheme.SignatureScheme, chain *solo.Chain, color balance.Color, transferAmount int64) error

TransferToValueTangleToSelf makes transfer of 'amount' of 'color' from the depositors account in 'chain' to the depositors address in the value tangle. Important: Due to the current logic in the accounts contract (from IOTA Foundation), all tokens of 'depositor' are withdrawn from 'chain' to his address in the value tangle.

func (*ChainManager) TransferWithinChain

func (chainManager *ChainManager) TransferWithinChain(depositorSigScheme signaturescheme.SignatureScheme, chain *solo.Chain, color balance.Color, transferAmount int64,
	receiverSigScheme signaturescheme.SignatureScheme) error

TransferWithinChain makes transfer of 'amount' of 'color' from the depositors account in 'chain' to the receivers account in the same chain. Nothing is transfered if no receiver is defined. Important: Due to the current logic in the accounts contract (from IOTA Foundation), all tokens are withdrawn from 'sourceChain', not only the specified color and amount.

Jump to

Keyboard shortcuts

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