Skip to content

Commit

Permalink
feat(michelson-ast): added Signature and Key
Browse files Browse the repository at this point in the history
  • Loading branch information
woxjro committed Oct 10, 2024
1 parent 71f65e8 commit 7ce0521
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
9 changes: 6 additions & 3 deletions michelson-ast/src/val.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub enum Val {
//Chain_id,
//Contract { ty: Ty },
Int(i128),
//Key,
Key(String),
//Key_hash,
//Lambda { ty1: Ty, ty2: Ty },
//List { ty: Type },
Expand All @@ -25,7 +25,7 @@ pub enum Val {
//Sapling_state {n},
//Sapling_transaction {n},
//Set cty,
//Signature,
Signature(String),
String(String),
//Ticket cty,
//Timepstamp,
Expand All @@ -40,7 +40,10 @@ impl ToString for Val {
Val::Int(i) => i.to_string(),
Val::Mutez(m) => m.to_string(),
Val::Nat(n) => n.to_string(),
v => todo!("{:?} is not implemented", v),
Val::String(s) => format!("\"{}\"", s.clone()),
Val::Key(k) => format!("\"{}\"", k.clone()),
Val::Signature(s) => format!("\"{}\"", s.clone()),
// v => todo!("{:?} is not implemented", v),
}
}
}
17 changes: 15 additions & 2 deletions src/michelify/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,23 @@ impl StackType {
val: MichelsonVal::Bool(false),
}],
StackType::Key => {
todo!()
// ref: https://tezos.gitlab.io/michelson-reference/#example-opcodes/check_signature.tz
vec![MichelsonInstruction::Push {
ty: MichelsonType::Key,
val: MichelsonVal::Key(
"edpkuBknW28nW72KG6RoHtYW7p12T6GKc7nAbwYX5m8Wd9sDVC9yav".to_string(),
),
}]
}
StackType::Signature => {
todo!()
// ref: https://tezos.gitlab.io/michelson-reference/#example-opcodes/check_signature.tz
vec![MichelsonInstruction::Push {
ty: MichelsonType::Signature,
val: MichelsonVal::Signature(
"edsigu3QszDjUpeqYqbvhyRxMpVFamEnvm9FYnt7YiiNt9nmjYfh8ZTbsybZ5WnBkhA7zfHsRVyuTnRsGLR6fNHt1Up1FxgyRtF"
.to_string(),
),
}]
}
StackType::Bytes => vec![
MichelsonInstruction::Push {
Expand Down

0 comments on commit 7ce0521

Please sign in to comment.