Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/loredanacirstea/solcosm
Solidity interfaces and inheritable contracts for Cosmos SDK structs, messages and queries
https://github.com/loredanacirstea/solcosm
Last synced: about 1 month ago
JSON representation
Solidity interfaces and inheritable contracts for Cosmos SDK structs, messages and queries
- Host: GitHub
- URL: https://github.com/loredanacirstea/solcosm
- Owner: loredanacirstea
- License: gpl-3.0
- Created: 2022-12-21T20:41:25.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-22T14:28:29.000Z (almost 2 years ago)
- Last Synced: 2024-10-11T16:32:58.621Z (about 1 month ago)
- Language: Solidity
- Size: 106 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# solcosm
Solidity interfaces and inheritable contracts for Cosmos SDK structs, messages and queries
This project is in-development, as part of the [Quasar module for Cosmos-EVM chains](https://www.youtube.com/playlist?list=PL323JufuD9JB1R28TdzCtiiIwTHy9TX5C).
Test it on the [Mythos chain](https://github.com/cosmos/chain-registry/tree/943428722d7715ecd95cba702bde1be5cc5a06b1/mythos). Ask for the non-tradable gas token in the [Mythos Discord](https://discord.gg/8W5jeBke4f).
## Usage
```sh
npm install loredanacirstea/solcosm
yarn add loredanacirstea/solcosm
``````shell
cd solcosm
npx hardhat help
npx hardhat test
REPORT_GAS=true npx hardhat test
npx hardhat node
npx hardhat run scripts/deploy.ts
```This is an example meant only for didactic purposes.
```solidity
import "loredanacirstea/solcosm/contracts/CosmosSdk.sol";contract MyContract is CosmosSdkBank, CosmosSdkGov, CosmosSdkDistribution, CosmosSdkAuth, CosmosSdkAuthz, CosmosSdkSlashing, CosmosSdkStaking {
receive() payable external {}function delegateFromMyContract(address validator, uint256 amount) public {
MsgDelegate memory message = MsgDelegate(address(this), validator, Coin("aMYT", amount));
DoDelegate(message);
}function getAndIncreaseDelegation(address validator) view public returns(QueryDelegationResponse memory data) {
QueryDelegationRequest memory query = QueryDelegationRequest(address(this), validator);
QueryDelegationResponse memory result = GetDelegation(query);
result.DelegationResponse.Balance.Amount = result.DelegationResponse.Balance.Amount + 10000;
return result;
}
}
```