Scriptable ERC721

I don’t know if there is already a similar work in progress, if so please let me know.

The current erc721 is static. I think erc721 can be dynamic. This can be done by supporting script.

  1. the creator writes the script, so the creator can control how NFT behaves.
  2. once the NFT is minted, the script can’t be modified.
  3. some parameters in the script can be modified by the NFT owner.
  4. multiple script type support, such as p5js, raphael, etc.

Below is an example of how to extend the ERC721:

interface ERC721Scriptable {
	event ParamsUpdated(uint256 indexed tokenId, string oldParamsURI, string newParamsURI);
	function scriptType() external view returns (string);
	function scriptURI(uint256 tokenId) external view returns (string);
	// hash result of params, protect params from being modified
	function paramsHash(uint256 tokenId) external view returns (bytes32);
	function paramsURI(uint256 tokenId) external view returns (string);
	function updateParamsURI(uint256 tokenId, string paramsURI) external;

A p5js script example

function setup() {
  createCanvas(400, 400);

  ellipse(200, 200, 80/*{ellipse1}*/, 80/*{ellipse2}*/);
  text('world'/*{title}*/, 10, 30);

The params example of the above script

	"bgcolor": 100,
	"ellipse1": 60,
	"ellipse2": 60,
	"title": "hello world"