Skip to content

Commit de9b2f7

Browse files
committed
Some corrections for solidity smart contracts.
1 parent d80b096 commit de9b2f7

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

linera-execution/solidity/Linera.sol

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,19 @@ library Linera {
6363
return LineraTypes.AccountOwner(owner.choice, owner.reserved, hash, owner.address20);
6464
}
6565

66-
function account_to(Linera.Account memory account)
66+
struct Account {
67+
ChainId chain_id;
68+
AccountOwner owner;
69+
}
70+
71+
function account_to(Linera.Account memory account_i)
6772
internal
6873
pure
6974
returns (LineraTypes.Account memory)
7075
{
71-
LineraTypes.ChainId memory chain_id = chainid_to(account.chain_id);
72-
LineraTypes.AccountOwner memory owner = accountowner_to(account.owner);
73-
return LineraTypes.Account(chain_id, owner);
76+
LineraTypes.ChainId memory chain_id2 = chainid_to(account_i.chain_id);
77+
LineraTypes.AccountOwner memory owner2 = accountowner_to(account_i.owner);
78+
return LineraTypes.Account(chain_id2, owner2);
7479
}
7580

7681
struct AccountOwnerBalance {
@@ -570,10 +575,11 @@ library Linera {
570575
return opt_uint32_from(output2);
571576
}
572577

573-
function transfer(Linera.AccountOwner account, uint256 amount) internal {
578+
function transfer(Linera.Account memory account, uint256 amount) internal {
574579
address precompile = address(0x0b);
575-
LineraTypes.AccountOwner account2 = account_to(account);
576-
LineraTypes.ContractRuntimePrecompile_Transfer memory transfer_ = LineraTypes.ContractRuntimePrecompile_Transfer(account2, amount);
580+
LineraTypes.Account memory account2 = account_to(account);
581+
LineraTypes.Amount memory amount2 = LineraTypes.Amount(bytes32(amount));
582+
LineraTypes.ContractRuntimePrecompile_Transfer memory transfer_ = LineraTypes.ContractRuntimePrecompile_Transfer(account2, amount2);
577583
LineraTypes.ContractRuntimePrecompile memory contract_ = LineraTypes.ContractRuntimePrecompile_case_transfer(transfer_);
578584
LineraTypes.RuntimePrecompile memory input1 = LineraTypes.RuntimePrecompile_case_contract(contract_);
579585
bytes memory input2 = LineraTypes.bcs_serialize_RuntimePrecompile(input1);

0 commit comments

Comments
 (0)