builtins.sol 785 B

12345678910111213141516171819202122232425262728293031
  1. import 'solana';
  2. contract builtins {
  3. function hash_ripemd160(bytes bs) public pure returns (bytes20) {
  4. return ripemd160(bs);
  5. }
  6. function hash_kecccak256(bytes bs) public pure returns (bytes32) {
  7. return keccak256(bs);
  8. }
  9. function hash_sha256(bytes bs) public pure returns (bytes32) {
  10. return sha256(bs);
  11. }
  12. function mr_now() public view returns (uint64) {
  13. return block.timestamp;
  14. }
  15. function mr_slot() public view returns (uint64) {
  16. return block.slot;
  17. }
  18. function pda(bytes seed1, bytes seed2, address addr) public pure returns (address) {
  19. return create_program_address([seed1, seed2], addr);
  20. }
  21. function pda_with_bump(bytes seed1, bytes seed2, address addr) public pure returns (address, bytes1) {
  22. return try_find_program_address([seed1, seed2], addr);
  23. }
  24. }