Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move GetBalance.sol to wasp repo #1650

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,33 +42,7 @@ uint256 nfts = ISC.accounts.getL2NFTAmount(agentID);

### Full Example Code

```solidity
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@iota/iscmagic/ISC.sol";

contract GetBalance {
event GotAgentID(bytes agentID);
event GotBaseBalance(uint64 baseBalance);
event GotNativeTokenBalance(uint256 nativeTokenBalance);
event GotNFTIDs(uint256 nftBalance);

function getBalance(bytes memory nativeTokenID) public {
ISCAgentID memory agentID = ISC.sandbox.getSenderAccount();
emit GotAgentID(agentID.data);

uint64 baseBalance = ISC.accounts.getL2BalanceBaseTokens(agentID);
emit GotBaseBalance(baseBalance);

NativeTokenID memory id = NativeTokenID({ data: nativeTokenID});
uint256 nativeTokens = ISC.accounts.getL2BalanceNativeTokens(id, agentID);
emit GotNativeTokenBalance(nativeTokens);

uint256 nfts = ISC.accounts.getL2NFTAmount(agentID);
emit GotNFTIDs(nfts);
}
}
```solidity reference
https://github.com/iotaledger/wasp/blob/develop/packages/evm/evmtest/wiki_how_tos/GetBalance.sol
```

Original file line number Diff line number Diff line change
Expand Up @@ -42,33 +42,7 @@ uint256 nfts = ISC.accounts.getL2NFTAmount(agentID);

### Full Example Code

```solidity
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@iota/iscmagic/ISC.sol";

contract GetBalance {
event GotAgentID(bytes agentID);
event GotBaseBalance(uint64 baseBalance);
event GotNativeTokenBalance(uint256 nativeTokenBalance);
event GotNFTIDs(uint256 nftBalance);

function getBalance(bytes memory nativeTokenID) public {
ISCAgentID memory agentID = ISC.sandbox.getSenderAccount();
emit GotAgentID(agentID.data);

uint64 baseBalance = ISC.accounts.getL2BalanceBaseTokens(agentID);
emit GotBaseBalance(baseBalance);

NativeTokenID memory id = NativeTokenID({ data: nativeTokenID});
uint256 nativeTokens = ISC.accounts.getL2BalanceNativeTokens(id, agentID);
emit GotNativeTokenBalance(nativeTokens);

uint256 nfts = ISC.accounts.getL2NFTAmount(agentID);
emit GotNFTIDs(nfts);
}
}
```solidity reference
https://github.com/iotaledger/wasp/blob/develop/packages/evm/evmtest/wiki_how_tos/GetBalance.sol
```

Loading