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

feat: init Lazer Aptos contract #2381

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

tejasbadadare
Copy link
Contributor

@tejasbadadare tejasbadadare commented Feb 14, 2025

First pass at the Aptos Lazer contract. Keeps the same API as the Solana and EVM contracts.
Uses Ed25519 signatures as recommended by Aptos docs.

Deployed to devnet here.
Example transaction of initializing the contract here.

Copy link

vercel bot commented Feb 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 1:00am
proposals ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 1:00am
staking ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 1:00am
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
component-library ⬜️ Ignored (Inspect) Visit Preview Feb 19, 2025 1:00am
entropy-debugger ⬜️ Ignored (Inspect) Visit Preview Feb 19, 2025 1:00am
insights ⬜️ Ignored (Inspect) Visit Preview Feb 19, 2025 1:00am

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should not be in the PR?

subdir = "aptos-framework"

[addresses]
pyth_lazer = "0x8731685005cfb169b4da4bbfab0c91c5ba59508bbd6d26990ee2be7225cb34d1" # Temporary key during development
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add this to dev addresses maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure yeah

Comment on lines +22 to +25
struct TrustedSignerInfo has store, drop {
pubkey: vector<u8>, // Ed25519 public key (32 bytes)
expires_at: u64, // Unix timestamp
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh i don't know much about aptos, i thought drop was only for object that are not stored in the global storage?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it because it's only used inside another struct? and not being stored separately?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop is needed for any type that can be discarded, we need it here because it's stored in a vector that might remove elements (when removing a trusted signer)

num_trusted_signers: 0,
trusted_signers: vector::empty(),
};
move_to(account, storage);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we move this to the top_authority address?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this way any new signer can call initialize and create a new Storage?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the move_to operation will fail if Storage already exists at the account's address, so it's effectively a one-time initialization. looks to be a pattern in aptos contracts: https://aptos.dev/en/build/guides/build-e2e-dapp/1-create-smart-contract#create-list-function

const EINSUFFICIENT_FEE: u64 = 6;

/// Constants
const MAX_NUM_TRUSTED_SIGNERS: u8 = 2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's actually remove this MAX. I don't think we should've had it in the solana contract either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants