Skip to content

Commit

Permalink
Merge pull request #45 from rarimo/fix/abstraction-account
Browse files Browse the repository at this point in the history
Fix/abstraction account
  • Loading branch information
Zaptoss authored Oct 4, 2024
2 parents 20b79a1 + 7326a64 commit 1f93601
Show file tree
Hide file tree
Showing 5 changed files with 1,584 additions and 1,532 deletions.
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

0 comments on commit 1f93601

Please sign in to comment.