@@ -9,7 +9,7 @@ use host::*;
99
1010use std:: error:: Error ;
1111
12- use athena_interface:: { Address , AthenaContext , Encode , MethodSelector } ;
12+ use athena_interface:: { Address , AthenaContext , CallerBuilder , Encode , MethodSelector } ;
1313use athena_sdk:: { host:: HostInterface , AthenaStdin , ExecutionClient } ;
1414use athena_vm_sdk:: { wallet:: SpendArguments , Pubkey } ;
1515
@@ -50,8 +50,8 @@ fn main() {
5050 ) ;
5151
5252 // send some coins
53- let address_bob = Address :: from ( [ 0xBB ; 24 ] ) ;
54- let context = AthenaContext :: new ( ADDRESS_ALICE , address_bob , 0 ) ;
53+ let caller = CallerBuilder :: new ( Address :: from ( [ 0xBB ; 24 ] ) ) . build ( ) ;
54+ let context = AthenaContext :: new ( ADDRESS_ALICE , caller , 0 ) ;
5555
5656 let mut stdin = AthenaStdin :: new ( ) ;
5757 let wallet = host
@@ -70,9 +70,7 @@ fn main() {
7070 assert ! ( alice_balance >= 120 ) ;
7171 println ! (
7272 "sending {} coins {} -> {}" ,
73- args. amount,
74- context. address( ) ,
75- args. recipient,
73+ args. amount, context. caller. account, args. recipient,
7674 ) ;
7775 // calculate method selector
7876 let method_selector = MethodSelector :: from ( "athexp_spend" ) ;
@@ -107,7 +105,7 @@ mod tests {
107105 payload:: ExecutionPayloadBuilder , payload:: Payload , Address , AthenaMessage , Balance , Encode ,
108106 MessageKind , MethodSelector , StatusCode ,
109107 } ;
110- use athena_interface:: { AthenaContext , Decode , ExecutionResult } ;
108+ use athena_interface:: { AthenaContext , CallerBuilder , Decode , ExecutionResult } ;
111109 use athena_runner:: vm:: AthenaRevision ;
112110 use athena_runner:: AthenaVm ;
113111 use athena_sdk:: host:: MockHostInterface ;
@@ -241,6 +239,7 @@ mod tests {
241239 Balance :: default ( ) ,
242240 ) ,
243241 super :: ELF ,
242+ Address :: default ( ) ,
244243 ) ;
245244
246245 // the call should succeed, and it should return false
@@ -274,6 +273,7 @@ mod tests {
274273 Balance :: default ( ) ,
275274 ) ,
276275 super :: ELF ,
276+ Address :: default ( ) ,
277277 ) ;
278278
279279 // the call should succeed, and it should return true
@@ -327,9 +327,10 @@ mod tests {
327327 stdin. write_vec ( args. encode ( ) ) ;
328328
329329 let sender = ADDRESS_ALICE ;
330- let context = AthenaContext :: new ( sender, Address :: default ( ) , 0 ) ;
330+ let context = AthenaContext :: new ( sender, CallerBuilder :: new ( Address :: default ( ) ) . build ( ) , 0 ) ;
331331 let mut host = MockHostInterface :: new ( ) ;
332332 host. expect_call ( ) . returning ( move |msg| {
333+ // the callee becomes the sender in the proxied call
333334 assert_eq ! ( sender, msg. sender) ;
334335 assert_eq ! ( args. destination, msg. recipient) ;
335336 assert_eq ! ( args. amount, msg. value) ;
0 commit comments