Documentation ¶
Index ¶
- type ChainManager
- func (chainManager *ChainManager) ChangeContractFees(authorizedKeyPair *ed25519.KeyPair, chain *solo.Chain, contractName string, ...)
- func (chainManager *ChainManager) ChangeValidatorFees(authorizedKeyPair *ed25519.KeyPair, chain *solo.Chain, contractName string, ...)
- func (chainManager *ChainManager) DeployWasmContract(chain *solo.Chain, contractOriginatorKeyPair *ed25519.KeyPair, ...)
- func (chainManager *ChainManager) Dispose()
- func (chainManager *ChainManager) GetContractRecord(chain *solo.Chain, contractName string) (*root.ContractRecord, error)
- func (chainManager *ChainManager) GrantAgentDeployPermission(chain *solo.Chain, authorizedAgentID iscp.AgentID)
- func (chainManager *ChainManager) GrantDeployPermission(chain *solo.Chain, authorizedKeyPair *ed25519.KeyPair)
- func (chainManager *ChainManager) Harvest(chain *solo.Chain, color colored.Color, withdrawalAmount uint64)
- func (chainManager *ChainManager) MustGetAgentID(chain *solo.Chain, contractName string) *iscp.AgentID
- func (chainManager *ChainManager) MustGetContractRecord(chain *solo.Chain, contractName string) *root.ContractRecord
- func (chainManager *ChainManager) MustTransferBetweenChains(depositorKeyPair *ed25519.KeyPair, sourceChain *solo.Chain, ...)
- func (chainManager *ChainManager) MustTransferToL1ToSelf(depositorKeyPair *ed25519.KeyPair, chain *solo.Chain, color colored.Color, ...)
- func (chainManager *ChainManager) MustTransferWithinChain(depositorKeyPair *ed25519.KeyPair, chain *solo.Chain, color colored.Color, ...)
- func (chainManager *ChainManager) NewChain(chainOriginatorKeyPair *ed25519.KeyPair, chainName string, ...) *solo.Chain
- func (chainManager *ChainManager) NewChainAndDeployWasmContract(chainOriginatorKeyPair *ed25519.KeyPair, chainName string, ...) (*solo.Chain, *root.ContractRecord)
- func (chainManager *ChainManager) RequireBalance(keyPair *ed25519.KeyPair, chain *solo.Chain, color colored.Color, ...)
- func (chainManager *ChainManager) RequireChainBalance(chain *solo.Chain, color colored.Color, expectedBalance uint64)
- func (chainManager *ChainManager) RequireContractBalance(chain *solo.Chain, contractName string, color colored.Color, ...)
- func (chainManager *ChainManager) RevokeAgentDeployPermission(chain *solo.Chain, authorizedAgentID iscp.AgentID)
- func (chainManager *ChainManager) RevokeDeployPermission(chain *solo.Chain, authorizedKeyPair *ed25519.KeyPair)
- func (chainManager *ChainManager) TransferBetweenChains(depositorKeyPair *ed25519.KeyPair, sourceChain *solo.Chain, ...) error
- func (chainManager *ChainManager) TransferToL1ToSelf(depositorKeyPair *ed25519.KeyPair, chain *solo.Chain, color colored.Color, ...) error
- func (chainManager *ChainManager) TransferWithinChain(depositorKeyPair *ed25519.KeyPair, chain *solo.Chain, color colored.Color, ...) error
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 (*ChainManager) ChangeContractFees ¶ added in v0.9.2
func (chainManager *ChainManager) ChangeContractFees(authorizedKeyPair *ed25519.KeyPair, chain *solo.Chain, contractName string, newContractOwnerFee uint64)
ChangeContractFees changes chains owner fee as 'authorized signature' scheme. Anyone with an authorized key pair can use this. This request costs 'constants.IotaTokensConsumedByRequest' IOTA token. See 'GrantDeployPermission' on how to (de)authorize chain changes. Fails test on error.
func (*ChainManager) ChangeValidatorFees ¶ added in v0.9.2
func (chainManager *ChainManager) ChangeValidatorFees(authorizedKeyPair *ed25519.KeyPair, chain *solo.Chain, contractName string, newValidatorFee uint64)
ChangeValidatorFees changes the validator fee as 'authorized signature' scheme. Anyone with an authorized key pair can use this. This request costs 'constants.IotaTokensConsumedByRequest' IOTA token. See 'GrantDeployPermission' on how to (de)authorize chain changes. Fails test on error.
func (*ChainManager) DeployWasmContract ¶
func (chainManager *ChainManager) DeployWasmContract(chain *solo.Chain, contractOriginatorKeyPair *ed25519.KeyPair, 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) GrantAgentDeployPermission ¶ added in v0.9.2
func (chainManager *ChainManager) GrantAgentDeployPermission(chain *solo.Chain, authorizedAgentID iscp.AgentID)
GrantAgentDeployPermission gives permission, as the chain originator, to 'authorizedAgentID' to deploy SCs into the specified chain. Fails test on error.
func (*ChainManager) GrantDeployPermission ¶
func (chainManager *ChainManager) GrantDeployPermission(chain *solo.Chain, authorizedKeyPair *ed25519.KeyPair)
GrantDeployPermission gives permission, as the chain originator, to 'authorizedKeyPair' to deploy SCs into the specified chain. Fails test on error.
func (*ChainManager) Harvest ¶ added in v0.9.10
func (chainManager *ChainManager) Harvest(chain *solo.Chain, color colored.Color, withdrawalAmount uint64)
Harvest allows the 'chain owner' to withdraw funds from 'chain'to his account in the same 'chain'. This request costs 'constants.IotaTokensConsumedByRequest' IOTA token.
func (*ChainManager) MustGetAgentID ¶ added in v0.9.2
func (chainManager *ChainManager) MustGetAgentID(chain *solo.Chain, contractName string) *iscp.AgentID
MustGetAgentID 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(depositorKeyPair *ed25519.KeyPair, sourceChain *solo.Chain, color colored.Color, transferAmount uint64, destinationChain *solo.Chain, receiverKeyPair *ed25519.KeyPair)
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 L1.
func (*ChainManager) MustTransferToL1ToSelf ¶ added in v0.9.2
func (chainManager *ChainManager) MustTransferToL1ToSelf(depositorKeyPair *ed25519.KeyPair, chain *solo.Chain, color colored.Color, transferAmount uint64)
MustTransferToL1ToSelf makes transfer of 'amount' of 'color' from the depositors account in 'chain' to the depositors address in L1. 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 L1.
func (*ChainManager) MustTransferWithinChain ¶
func (chainManager *ChainManager) MustTransferWithinChain(depositorKeyPair *ed25519.KeyPair, chain *solo.Chain, color colored.Color, transferAmount uint64, receiverKeyPair *ed25519.KeyPair)
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(chainOriginatorKeyPair *ed25519.KeyPair, chainName string, validatorFeeTarget ...*iscp.AgentID) *solo.Chain
NewChain instantiates a new chain with initial balance equal to 'expectedChainIdBalance' which is debited from the chainOriginator's balance.
If 'chainOriginator' is nil, a new KeyPair is generated and 'utxodb.RequestFundsAmount' IOTA tokens are assigned to it If 'validatorFeeTarget' is skipped, it is assumed equal to the chainOriginators AgentID Fails test on error.
func (*ChainManager) NewChainAndDeployWasmContract ¶
func (chainManager *ChainManager) NewChainAndDeployWasmContract(chainOriginatorKeyPair *ed25519.KeyPair, chainName string, contractOriginatorKeyPair *ed25519.KeyPair, contractName string, contractWasmFilePath string, validatorFeeTarget ...*iscp.AgentID) (*solo.Chain, *root.ContractRecord)
NewChainAndDeployWasmContract calls NewChain and then DeployWasmContract
func (*ChainManager) RequireBalance ¶
func (chainManager *ChainManager) RequireBalance(keyPair *ed25519.KeyPair, chain *solo.Chain, color colored.Color, expectedBalance uint64)
RequireBalance verifies if the key pair has the expected balance of 'color' in 'chain'. Fails test if balance is not equal to expectedBalance.
func (*ChainManager) RequireChainBalance ¶ added in v0.9.9
func (chainManager *ChainManager) RequireChainBalance(chain *solo.Chain, color colored.Color, expectedBalance uint64)
RequireBalance verifies if chain's 'agentID' has the expected balance of 'color' in the 'chain' itself. Fails test if balance is not equal to expectedBalance.
func (*ChainManager) RequireContractBalance ¶ added in v0.9.2
func (chainManager *ChainManager) RequireContractBalance(chain *solo.Chain, contractName string, color colored.Color, expectedBalance uint64)
RequireContractBalance verifies if 'contract' has the expected balance of 'color' in 'chain'. Fails test if contract is neither defined, nor found, or if the balance is not equal to expectedBalance.
func (*ChainManager) RevokeAgentDeployPermission ¶ added in v0.9.2
func (chainManager *ChainManager) RevokeAgentDeployPermission(chain *solo.Chain, authorizedAgentID iscp.AgentID)
RevokeAgentDeployPermission revokes permission, as the chain originator, from 'authorizedAgentID' to deploy SCs into 'chain'. Fails test on error.
func (*ChainManager) RevokeDeployPermission ¶
func (chainManager *ChainManager) RevokeDeployPermission(chain *solo.Chain, authorizedKeyPair *ed25519.KeyPair)
RevokeDeployPermission revokes permission, as the chain originator, from 'authorizedKeyPair' to deploy SCs into 'chain'. Fails test on error.
func (*ChainManager) TransferBetweenChains ¶
func (chainManager *ChainManager) TransferBetweenChains(depositorKeyPair *ed25519.KeyPair, sourceChain *solo.Chain, color colored.Color, transferAmount uint64, destinationChain *solo.Chain, receiverKeyPair *ed25519.KeyPair) 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 L1.
func (*ChainManager) TransferToL1ToSelf ¶ added in v0.9.2
func (chainManager *ChainManager) TransferToL1ToSelf(depositorKeyPair *ed25519.KeyPair, chain *solo.Chain, color colored.Color, transferAmount uint64) error
TransferToL1ToSelf makes transfer of 'amount' of 'color' from the depositors account in 'chain' to the depositors address in L1. 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 L1.
func (*ChainManager) TransferWithinChain ¶
func (chainManager *ChainManager) TransferWithinChain(depositorKeyPair *ed25519.KeyPair, chain *solo.Chain, color colored.Color, transferAmount uint64, receiverKeyPair *ed25519.KeyPair) 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.