-
Notifications
You must be signed in to change notification settings - Fork 229
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Skipped Deployments
|
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure yeah
struct TrustedSignerInfo has store, drop { | ||
pubkey: vector<u8>, // Ed25519 public key (32 bytes) | ||
expires_at: u64, // Unix timestamp | ||
} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
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.