rent.sol 908 B

123456789101112131415161718192021222324
  1. import "./system_instruction.sol";
  2. import 'minimum_balance.sol';
  3. @program_id("F1ipperKF9EfD821ZbbYjS319LXYiBmjhzkkf5a26rC")
  4. contract rent {
  5. @payer(payer) // The "payer" pays for the data account creation
  6. constructor(address payer) {}
  7. function createSystemAccount(address payer, address newAccount, uint64 space) public view {
  8. // The minimum lamports required for the amount of space allocated to the account
  9. uint64 lamports = minimum_balance(space);
  10. SystemInstruction.create_account(
  11. payer, // lamports sent from this account (payer)
  12. newAccount, // lamports sent to this account (account to be created)
  13. lamports, // lamport amount (minimum lamports required)
  14. space, // space required for the account
  15. SystemInstruction.systemAddress // program owner (system program)
  16. );
  17. }
  18. }