Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/abstraction account #45

Merged
merged 2 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
vaultapi "github.com/hashicorp/vault/api"
accountFactory "github.com/rarimo/geo-points-svc/internal/contracts/abstractionaccountfactory"
accountFactory "github.com/rarimo/geo-points-svc/internal/contracts/extendedaccountfactory"
pointTokens "github.com/rarimo/geo-points-svc/internal/contracts/points"

"gitlab.com/distributed_lab/dig"
Expand Down Expand Up @@ -107,12 +107,12 @@ func (r *AbstractionConfig) CreateAccount(ctx context.Context, nullifier [32]byt
return common.Address{}, fmt.Errorf("failed to get keyed transactor: %w", err)
}

accountFactoryInstance, err := accountFactory.NewAbstractionAccountFactory(r.AccountFactory, r.RPC)
accountFactoryInstance, err := accountFactory.NewExtendedAccountFactory(r.AccountFactory, r.RPC)
if err != nil {
return common.Address{}, fmt.Errorf("failed to get account factory: %w", err)
}

tx, err := accountFactoryInstance.DeployAbstractionAccount(signerOpts, nullifier)
tx, err := accountFactoryInstance.DeployAbstractAccount(signerOpts, nullifier)
if err != nil {
return common.Address{}, fmt.Errorf("failed to deploy abstraction account: %w", err)
}
Expand All @@ -125,20 +125,20 @@ func (r *AbstractionConfig) CreateAccount(ctx context.Context, nullifier [32]byt
return common.Address{}, fmt.Errorf("failed to wait mined transaction: %w", err)
}

abi, err := accountFactory.AbstractionAccountFactoryMetaData.GetAbi()
abi, err := accountFactory.ExtendedAccountFactoryMetaData.GetAbi()
if err != nil {
return common.Address{}, fmt.Errorf("failed to get contract abi: %w", err)
}

abstractionAccountDeployedTopic := abi.Events["AbstractionAccountDeployed"].ID
abstractionAccountDeployedTopic := abi.Events["AbstractAccountDeployed"].ID

var event *accountFactory.AbstractionAccountFactoryAbstractionAccountDeployed
var event *accountFactory.ExtendedAccountFactoryAbstractAccountDeployed
for _, log := range rec.Logs {
if !bytes.Equal(log.Topics[0][:], abstractionAccountDeployedTopic[:]) {
continue
}

event, err = accountFactoryInstance.ParseAbstractionAccountDeployed(*log)
event, err = accountFactoryInstance.ParseAbstractAccountDeployed(*log)
if err != nil {
return common.Address{}, fmt.Errorf("failed to unpack log: %w", err)
}
Expand All @@ -149,12 +149,12 @@ func (r *AbstractionConfig) CreateAccount(ctx context.Context, nullifier [32]byt
}

func (r *AbstractionConfig) GetAccount(nullifier [32]byte) (common.Address, error) {
accountFactoryInstance, err := accountFactory.NewAbstractionAccountFactory(r.AccountFactory, r.RPC)
accountFactoryInstance, err := accountFactory.NewExtendedAccountFactory(r.AccountFactory, r.RPC)
if err != nil {
return common.Address{}, fmt.Errorf("failed to get account factory: %w", err)
}

accountAddress, err := accountFactoryInstance.GetAbstractionAccount(nil, nullifier)
accountAddress, err := accountFactoryInstance.GetAbstractAccount(nil, nullifier)
if err != nil {
return common.Address{}, fmt.Errorf("failed to get abstraction account: %w", err)
}
Expand Down
Loading
Loading