Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Goshimmer_without_tipselection
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
COLLET Ismael
Goshimmer_without_tipselection
Commits
85d860f5
Unverified
Commit
85d860f5
authored
4 years ago
by
jonastheis
Browse files
Options
Downloads
Patches
Plain Diff
Bones
parent
376cba20
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dapps/valuetransfers/packages/tangle/factory.go
+8
-8
8 additions, 8 deletions
dapps/valuetransfers/packages/tangle/factory.go
with
8 additions
and
8 deletions
dapps/valuetransfers/packages/tangle/factory.go
+
8
−
8
View file @
85d860f5
package
tangle
import
(
"github.com/iotaledger/goshimmer/dapps/valuetransfers/packages/branchmanager"
"github.com/iotaledger/goshimmer/dapps/valuetransfers/packages/payload"
"github.com/iotaledger/goshimmer/dapps/valuetransfers/packages/tipmanager"
"github.com/iotaledger/goshimmer/dapps/valuetransfers/packages/transaction"
"github.com/iotaledger/hive.go/events"
)
// ValueObjectFactory acts as a factory to create new value objects.
type
ValueObjectFactory
struct
{
branchManager
*
branchmanager
.
BranchManager
tipManager
*
tipmanager
.
TipManager
Events
*
ValueObjectFactoryEvents
tipManager
*
tipmanager
.
TipManager
Events
*
ValueObjectFactoryEvents
}
func
NewValueObjectFactory
(
branchManager
*
branchmanager
.
BranchManager
,
tipManager
*
tipmanager
.
TipManager
)
*
ValueObjectFactory
{
// NewValueObjectFactory creates a new ValueObjectFactory.
func
NewValueObjectFactory
(
tipManager
*
tipmanager
.
TipManager
)
*
ValueObjectFactory
{
return
&
ValueObjectFactory
{
branchManager
:
branchManager
,
tipManager
:
tipManager
,
tipManager
:
tipManager
,
Events
:
&
ValueObjectFactoryEvents
{
ValueObjectConstructed
:
events
.
NewEvent
(
valueObjectConstructedEvent
),
},
}
}
// IssueTransaction creates a new value object including tip selection and returns it.
// It also triggers the ValueObjectConstructed event once it's done.
func
(
v
*
ValueObjectFactory
)
IssueTransaction
(
tx
*
transaction
.
Transaction
)
*
payload
.
Payload
{
// TODO: we need a way to get the currently liked branches. e.g. branchManager.LikedBranches()
parent1
,
parent2
:=
v
.
tipManager
.
Tips
()
valueObject
:=
payload
.
New
(
parent1
,
parent2
,
tx
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment