forked from hyperledger/solang
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add function annotations 🚀 (hyperledger#1557)
- Loading branch information
Showing
82 changed files
with
1,407 additions
and
961 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
contract Foo { | ||
@account(oneAccount) | ||
@signer(mySigner) | ||
@mutableAccount(otherAccount) | ||
@mutableSigner(otherSigner) | ||
function bar() external returns (uint64) { | ||
assert(tx.accounts.mySigner.is_signer); | ||
assert(tx.accounts.otherSigner.is_signer); | ||
assert(tx.accounts.otherSigner.is_writable); | ||
assert(tx.accounts.otherAccount.is_writable); | ||
|
||
tx.accounts.otherAccount.data[0] = 0xca; | ||
tx.accounts.otherSigner.data[1] = 0xfe; | ||
|
||
return tx.accounts.oneAccount.lamports; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import '../../solana-library/spl_token.sol'; | ||
|
||
contract AccountData { | ||
function token_account(address addr) view public returns (SplToken.TokenAccountData) { | ||
return SplToken.get_token_account_data(addr); | ||
@account(addr) | ||
function token_account() view external returns (SplToken.TokenAccountData) { | ||
return SplToken.get_token_account_data(tx.accounts.addr); | ||
} | ||
|
||
function mint_account(address addr) view public returns (SplToken.MintAccountData) { | ||
return SplToken.get_mint_account_data(addr); | ||
@account(addr) | ||
function mint_account() view external returns (SplToken.MintAccountData) { | ||
return SplToken.get_mint_account_data(tx.accounts.addr); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.