Skip to content

Commit

Permalink
std::evm functions should take buffer types ethereum#891 (Part 1)
Browse files Browse the repository at this point in the history
fixed comments from ethereum#893
  • Loading branch information
saifkatoutatcom authored and saifalkatout committed Sep 28, 2023
1 parent 87d9847 commit 0309020
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
tarpaulin-report.html
/output
/docs/tmp_snippets
.vscode
.vscode
myProgram/main.fe
6 changes: 3 additions & 3 deletions crates/library/std/src/context.fe
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub struct Context {
if evm::balance() < wei {
revert Error(code: ERROR_INSUFFICIENT_FUNDS_TO_SEND_VALUE)
}
let buffer: RawCallBuffer = RawCallBuffer::new(input_len: 0, output_len: 0)
let mut buffer: RawCallBuffer = RawCallBuffer::new(input_len: 0, output_len: 0)
let success: bool = evm::call(gas: evm::gas_remaining(), addr: to, value: wei,
buffer)
if success {
Expand All @@ -95,14 +95,14 @@ pub struct Context {
self,
addr: address,
value: u256,
buffer: RawCallBuffer
mut buf: RawCallBuffer
) -> bool {
unsafe {
return evm::call(
gas: evm::gas_remaining(),
addr,
value,
buffer
buffer:buf
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/library/std/src/evm.fe
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ pub fn create2(value v: u256, buffer: buf::MemoryBuffer, salt s: u256) -> addres
}

// TODO: return bool (success)
pub fn call(gas: u256, addr: address, value: u256, buffer: buf::RawCallBuffer) -> bool {
pub fn call(gas: u256, addr: address, value: u256, mut buffer: buf::RawCallBuffer) -> bool {
unsafe{ return __call(gas, u256(addr), value, buffer.offset(), buffer.input_len(), buffer.offset(), buffer.output_len()) == 1 }
}

Expand Down

0 comments on commit 0309020

Please sign in to comment.