solcosm
v0.0.3
Published
Solidity interfaces and inheritable contracts for Cosmos SDK structs, messages and queries
Downloads
17
Maintainers
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.
Test it on the Mythos chain. Ask for the non-tradable gas token in the Mythos Discord.
Usage
npm install loredanacirstea/solcosm
yarn add loredanacirstea/solcosm
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.
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;
}
}