Comment on page
📎
Rental Smart Contract Interaction Guide
This guide provides detailed instructions on how to interact with a Rental Smart Contract on the Stellar blockchain. Before proceeding, make sure to clone and build the Setlien project from the GitHub repository (https://github.com/arbach/stelien) to generate the setlien.wasm file.
The steps outlined below include deployment, initialization, lease, rent, end lease, end rent, and claim token operations
Deploy the smart contract using the
soroban contract deploy
command. This step returns a RENTAL_CONTRACT_ID
that will be used in the subsequent operations.soroban contract deploy \
--wasm target/wasm32-unknown-unknown/release/setlien.wasm \
--rpc-url https://rpc-futurenet.stellar.org:443 \
--network-passphrase 'Test SDF Future Network ; October 2022'
The initialization step sets the admin of the rental contract and the payment token that is accepted for payments. Use the
soroban contract invoke
command to perform this step.soroban contract invoke \
--id ${RENTAL_CONTRACT_ID} \
--rpc-url https://rpc-futurenet.stellar.org:443 \
--network-passphrase 'Test SDF Future Network ; October 2022' \
-- initialize --_admin ${ADMIN_PUB_KEY} --_payment_token ${PAYMENT_TOKEN_ADDRESS}
This step allows a leaser to list their NFT token for leasing. Use the
soroban contract invoke
command with the lease
argument to perform this step. The transaction is signed by the LEASER_SECRET_KEY
.soroban contract invoke \
--id ${RENTAL_CONTRACT_ID} \
--source ${LEASER_SECRET_KEY} \
--rpc-url https://rpc-futurenet.stellar.org:443 \
--network-passphrase 'Test SDF Future Network ; October 2022' \
-- lease --leaser ${LEASE_PUB_KEY} --token ${NFT_TOKEN_ADDRESS} --_price 10 --_duration 172800
This step allows a renter to pay with the
PAYMENT_TOKEN
and rent the NFT token listed by the leaser. Use the soroban contract invoke
command with the rent
argument to perform this step. The transaction is signed by the RENTER_SECRET_KEY
.soroban contract invoke \
--id ${RENTAL_CONTRACT_ID} \
--source ${RENTER_SECRET_KEY} \
--rpc-url https://rpc-futurenet.stellar.org:443 \
--network-passphrase 'Test SDF Future Network ; October 2022' \
-- rent --renter ${RENTER_PUB_KEY} --token ${NFT_TOKEN_ADDRESS} --_duration 86400
This step allows a leaser to delist their NFT token from leasing. Use the
soroban contract invoke
command with the end_lease
argument to perform this step. The transaction is signed by the LEASER_SECRET_KEY
.soroban contract invoke \
--id ${RENTAL_CONTRACT_ID} \
--source ${LEASER_SECRET_KEY} \
--rpc-url https://rpc-futurenet.stellar.org:443 \
--network-passphrase 'Test SDF Future Network ; October 2022' \
-- end_lease --leaser ${LEASER_PUB_KEY} --token ${NFT_TOKEN_ADDRESS}
This step allows a renter to return their rented NFT token. Use the
soroban contract invoke
command with the end_rent
argument to perform this step. The transaction is signed by the RENTER_SECRET_KEY
.soroban contract invoke \
--id ${RENTAL_CONTRACT_ID} \
--source ${RENTER_SECRET_KEY} \
--rpc-url https://rpc-futurenet.stellar.org:443 \
--network-passphrase 'Test SDF Future Network ; October 2022' \
-- end_rent --renter ${RENTER_PUB_KEY} --token ${NFT_TOKEN_ADDRESS}
This step allows a leaser to claim their NFT token that was rented and wasn't returned on time. Use the
soroban contract invoke
command with the claim_token
argument to perform this step. The transaction is signed by the LEASER_SECRET_KEY
.soroban contract invoke \
--id ${RENTAL_CONTRACT_ID} \
--source ${LEASER_SECRET_KEY} \
--rpc-url https://rpc-futurenet.stellar.org:443 \
--network-passphrase 'Test SDF Future Network ; October 2022' \
-- claim_token --leaser ${LEASER_PUB_KEY} --token ${NFT_TOKEN_ADDRESS} --relist false
Please ensure you replace all instances of
${VARIABLE_NAME}
in the commands above with your actual data.
Last modified 4mo ago